Lines Matching refs:actx
441 dispatch_arc4init(arc4ctx_t *actx, isc_entropy_t *entropy, isc_mutex_t *lock) {
444 actx->s[n] = n;
445 actx->i = 0;
446 actx->j = 0;
447 actx->count = 0;
448 actx->entropy = entropy; /* don't have to attach */
449 actx->lock = lock;
453 dispatch_arc4addrandom(arc4ctx_t *actx, unsigned char *dat, int datlen) {
457 actx->i--;
459 actx->i = (actx->i + 1);
460 si = actx->s[actx->i];
461 actx->j = (actx->j + si + dat[n % datlen]);
462 actx->s[actx->i] = actx->s[actx->j];
463 actx->s[actx->j] = si;
465 actx->j = actx->i;
469 dispatch_arc4get8(arc4ctx_t *actx) {
472 actx->i = (actx->i + 1);
473 si = actx->s[actx->i];
474 actx->j = (actx->j + si);
475 sj = actx->s[actx->j];
476 actx->s[actx->i] = sj;
477 actx->s[actx->j] = si;
479 return (actx->s[(si + sj) & 0xff]);
483 dispatch_arc4get16(arc4ctx_t *actx) {
486 val = dispatch_arc4get8(actx) << 8;
487 val |= dispatch_arc4get8(actx);
493 dispatch_arc4stir(arc4ctx_t *actx) {
501 if (actx->entropy != NULL) {
505 result = isc_entropy_getdata(actx->entropy, rnd.rnd,
512 dispatch_arc4addrandom(actx, rnd.rnd, sizeof(rnd.rnd));
519 (void)dispatch_arc4get8(actx);
526 actx->count = 1600000;
530 dispatch_arc4random(arc4ctx_t *actx) {
533 if (actx->lock != NULL)
534 LOCK(actx->lock);
536 actx->count -= sizeof(isc_uint16_t);
537 if (actx->count <= 0)
538 dispatch_arc4stir(actx);
539 result = dispatch_arc4get16(actx);
541 if (actx->lock != NULL)
542 UNLOCK(actx->lock);
548 dispatch_arc4uniformrandom(arc4ctx_t *actx, isc_uint16_t upper_bound) {
571 r = dispatch_arc4random(actx);