• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/bind9-45.100/bind9/lib/isc/

Lines Matching refs:ent

143 	isc_entropy_t  *ent;
194 samplequeue_release(isc_entropy_t *ent, sample_queue_t *sq) {
198 isc_mem_put(ent->mctx, sq->samples, RND_EVENTQSIZE * 4);
199 isc_mem_put(ent->mctx, sq->extra, RND_EVENTQSIZE * 4);
205 samplesource_allocate(isc_entropy_t *ent, sample_queue_t *sq) {
206 sq->samples = isc_mem_get(ent->mctx, RND_EVENTQSIZE * 4);
210 sq->extra = isc_mem_get(ent->mctx, RND_EVENTQSIZE * 4);
212 isc_mem_put(ent->mctx, sq->samples, RND_EVENTQSIZE * 4);
227 add_entropy(isc_entropy_t *ent, isc_uint32_t entropy) {
231 entropy += ent->pool.entropy;
233 ent->pool.entropy = ISC_MIN(entropy, RND_POOLBITS);
240 subtract_entropy(isc_entropy_t *ent, isc_uint32_t entropy) {
241 entropy = ISC_MIN(entropy, ent->pool.entropy);
242 ent->pool.entropy -= entropy;
250 add_pseudo(isc_entropy_t *ent, isc_uint32_t pseudo) {
254 pseudo += ent->pool.pseudo;
256 ent->pool.pseudo = ISC_MIN(pseudo, RND_POOLBITS * 8);
263 subtract_pseudo(isc_entropy_t *ent, isc_uint32_t pseudo) {
264 pseudo = ISC_MIN(pseudo, ent->pool.pseudo);
265 ent->pool.pseudo -= pseudo;
312 entropypool_adddata(isc_entropy_t *ent, void *p, unsigned int len,
336 entropypool_add_word(&ent->pool, val);
342 entropypool_add_word(&ent->pool, val);
357 entropypool_add_word(&ent->pool, val);
360 add_entropy(ent, entropy);
361 subtract_pseudo(ent, entropy);
365 reseed(isc_entropy_t *ent) {
369 if (ent->initcount == 0) {
371 entropypool_adddata(ent, &pid, sizeof(pid), 0);
373 entropypool_adddata(ent, &pid, sizeof(pid), 0);
381 if (ent->initcount > 100)
382 if ((ent->initcount % 50) != 0)
386 entropypool_adddata(ent, &t, sizeof(t), 0);
387 ent->initcount++;
438 crunchsamples(isc_entropy_t *ent, sample_queue_t *sq) {
460 entropypool_adddata(ent, sq->samples, sq->nsamples * 4, added);
461 entropypool_adddata(ent, sq->extra, sq->nsamples * 4, 0);
481 isc_entropy_t *ent = source->ent;
505 got = crunchsamples(ent, &cbs->samplequeue);
530 isc_entropy_getdata(isc_entropy_t *ent, void *data, unsigned int length,
540 REQUIRE(VALID_ENTROPY(ent));
550 LOCK(&ent->lock);
576 if (ent->pool.entropy >= THRESHOLD_BITS)
577 fillpool(ent, fillcount, ISC_FALSE);
579 fillpool(ent, fillcount, blocking);
585 if (ent->pool.entropy < THRESHOLD_BITS) {
596 if (ent->initialized < THRESHOLD_BITS)
597 fillpool(ent, THRESHOLD_BITS, blocking);
599 fillpool(ent, 0, ISC_FALSE);
605 if (ent->initialized < THRESHOLD_BITS)
606 reseed(ent);
610 isc_sha1_update(&hash, (void *)(ent->pool.pool),
617 entropypool_adddata(ent, digest, ISC_SHA1_DIGESTLENGTH, 0);
626 deltae = ISC_MIN(deltae, ent->pool.entropy);
628 subtract_entropy(ent, deltae);
629 add_pseudo(ent, count * 8);
638 UNLOCK(&ent->lock);
644 add_entropy(ent, total);
650 UNLOCK(&ent->lock);
676 isc_entropy_t *ent;
681 ent = isc_mem_get(mctx, sizeof(isc_entropy_t));
682 if (ent == NULL)
688 result = isc_mutex_init(&ent->lock);
695 ISC_LIST_INIT(ent->sources);
696 ent->nextsource = NULL;
697 ent->nsources = 0;
698 ent->mctx = NULL;
699 isc_mem_attach(mctx, &ent->mctx);
700 ent->refcnt = 1;
701 ent->initialized = 0;
702 ent->initcount = 0;
703 ent->magic = ENTROPY_MAGIC;
705 isc_entropypool_init(&ent->pool);
707 *entp = ent;
711 isc_mem_put(mctx, ent, sizeof(isc_entropy_t));
717 * Requires "ent" be locked.
722 isc_entropy_t *ent;
727 ent = source->ent;
729 ISC_LIST_UNLINK(ent->sources, source, link);
730 ent->nextsource = NULL;
731 REQUIRE(ent->nsources > 0);
732 ent->nsources--;
744 samplequeue_release(ent, &source->sources.sample.samplequeue);
752 samplequeue_release(ent, &cbs->samplequeue);
758 isc_mem_put(ent->mctx, source, sizeof(isc_entropysource_t));
762 destroy_check(isc_entropy_t *ent) {
765 if (ent->refcnt > 0)
768 source = ISC_LIST_HEAD(ent->sources);
785 isc_entropy_t *ent;
790 ent = *entp;
793 LOCK(&ent->lock);
795 REQUIRE(ent->refcnt == 0);
800 source = ISC_LIST_HEAD(ent->sources);
808 source = ISC_LIST_HEAD(ent->sources);
814 REQUIRE(ISC_LIST_EMPTY(ent->sources));
816 mctx = ent->mctx;
818 isc_entropypool_invalidate(&ent->pool);
820 UNLOCK(&ent->lock);
822 DESTROYLOCK(&ent->lock);
824 memset(ent, 0, sizeof(isc_entropy_t));
825 isc_mem_put(mctx, ent, sizeof(isc_entropy_t));
832 isc_entropy_t *ent;
841 ent = source->ent;
842 REQUIRE(VALID_ENTROPY(ent));
844 LOCK(&ent->lock);
848 killit = destroy_check(ent);
850 UNLOCK(&ent->lock);
853 destroy(&ent);
857 isc_entropy_createcallbacksource(isc_entropy_t *ent,
868 REQUIRE(VALID_ENTROPY(ent));
872 LOCK(&ent->lock);
874 source = isc_mem_get(ent->mctx, sizeof(isc_entropysource_t));
883 result = samplesource_allocate(ent, &cbs->samplequeue);
898 source->ent = ent;
906 ISC_LIST_APPEND(ent->sources, source, link);
907 ent->nsources++;
911 UNLOCK(&ent->lock);
916 isc_mem_put(ent->mctx, source, sizeof(isc_entropysource_t));
918 UNLOCK(&ent->lock);
924 isc_entropy_stopcallbacksources(isc_entropy_t *ent) {
928 REQUIRE(VALID_ENTROPY(ent));
930 LOCK(&ent->lock);
932 source = ISC_LIST_HEAD(ent->sources);
945 UNLOCK(&ent->lock);
949 isc_entropy_createsamplesource(isc_entropy_t *ent,
956 REQUIRE(VALID_ENTROPY(ent));
959 LOCK(&ent->lock);
961 source = isc_mem_get(ent->mctx, sizeof(isc_entropysource_t));
968 result = samplesource_allocate(ent, sq);
977 source->ent = ent;
985 ISC_LIST_APPEND(ent->sources, source, link);
986 ent->nsources++;
990 UNLOCK(&ent->lock);
995 isc_mem_put(ent->mctx, source, sizeof(isc_entropysource_t));
997 UNLOCK(&ent->lock);
1026 isc_entropy_t *ent;
1033 ent = source->ent;
1035 LOCK(&ent->lock);
1040 entropy = crunchsamples(ent, sq);
1041 add_entropy(ent, entropy);
1044 UNLOCK(&ent->lock);
1066 isc_entropy_putdata(isc_entropy_t *ent, void *data, unsigned int length,
1069 REQUIRE(VALID_ENTROPY(ent));
1071 LOCK(&ent->lock);
1073 entropypool_adddata(ent, data, length, entropy);
1075 if (ent->initialized < THRESHOLD_BITS)
1076 ent->initialized = THRESHOLD_BITS;
1078 UNLOCK(&ent->lock);
1082 dumpstats(isc_entropy_t *ent, FILE *out) {
1089 ent, ent->refcnt,
1090 ent->pool.cursor, ent->pool.rotate,
1091 ent->pool.entropy, ent->pool.pseudo,
1092 ent->nsources, ent->nextsource, ent->initialized,
1093 ent->initcount);
1100 isc_entropy_stats(isc_entropy_t *ent, FILE *out) {
1101 REQUIRE(VALID_ENTROPY(ent));
1103 LOCK(&ent->lock);
1104 dumpstats(ent, out);
1105 UNLOCK(&ent->lock);
1109 isc_entropy_status(isc_entropy_t *ent) {
1112 LOCK(&ent->lock);
1113 estimate = ent->pool.entropy;
1114 UNLOCK(&ent->lock);
1120 isc_entropy_attach(isc_entropy_t *ent, isc_entropy_t **entp) {
1121 REQUIRE(VALID_ENTROPY(ent));
1124 LOCK(&ent->lock);
1126 ent->refcnt++;
1127 *entp = ent;
1129 UNLOCK(&ent->lock);
1134 isc_entropy_t *ent;
1138 ent = *entp;
1141 LOCK(&ent->lock);
1143 REQUIRE(ent->refcnt > 0);
1144 ent->refcnt--;
1146 killit = destroy_check(ent);
1148 UNLOCK(&ent->lock);
1151 destroy(&ent);