Lines Matching refs:source
23 * compiled via inclusion from the relevant OS source file, ie,
85 * pseudorandom data and they cannot provide a stronger random source,
144 isc_uint32_t total; /*%< entropy from this source */
158 #define ENTROPY_SOURCETYPE_SAMPLE 1 /*%< Type is a sample source */
159 #define ENTROPY_SOURCETYPE_FILE 2 /*%< Type is a file source */
160 #define ENTROPY_SOURCETYPE_CALLBACK 3 /*%< Type is a callback source */
161 #define ENTROPY_SOURCETYPE_USOCKET 4 /*%< Type is a Unix socket source */
186 destroyfilesource(isc_entropyfilesource_t *source);
189 destroyusocketsource(isc_entropyusocketsource_t *source);
478 get_from_callback(isc_entropysource_t *source, unsigned int desired,
481 isc_entropy_t *ent = source->ent;
482 isc_cbsource_t *cbs = &source->sources.callback;
490 if (source->bad)
494 result = cbs->startfunc(source, cbs->arg, blocking);
503 result = cbs->getfunc(source, cbs->arg, blocking);
511 source->bad = ISC_TRUE;
721 isc_entropysource_t *source;
725 source = *sourcep;
727 ent = source->ent;
729 ISC_LIST_UNLINK(ent->sources, source, link);
734 switch (source->type) {
736 if (! source->bad)
737 destroyfilesource(&source->sources.file);
740 if (! source->bad)
741 destroyusocketsource(&source->sources.usocket);
744 samplequeue_release(ent, &source->sources.sample.samplequeue);
747 cbs = &source->sources.callback;
749 cbs->stopfunc(source, cbs->arg);
756 memset(source, 0, sizeof(isc_entropysource_t));
758 isc_mem_put(ent->mctx, source, sizeof(isc_entropysource_t));
763 isc_entropysource_t *source;
768 source = ISC_LIST_HEAD(ent->sources);
769 while (source != NULL) {
770 switch (source->type) {
777 source = ISC_LIST_NEXT(source, link);
786 isc_entropysource_t *source;
800 source = ISC_LIST_HEAD(ent->sources);
801 while (source != NULL) {
802 switch(source->type) {
805 destroysource(&source);
808 source = ISC_LIST_HEAD(ent->sources);
831 isc_entropysource_t *source;
838 source = *sourcep;
841 ent = source->ent;
846 destroysource(&source);
865 isc_entropysource_t *source;
874 source = isc_mem_get(ent->mctx, sizeof(isc_entropysource_t));
875 if (source == NULL) {
879 source->bad = ISC_FALSE;
881 cbs = &source->sources.callback;
896 source->magic = SOURCE_MAGIC;
897 source->type = ENTROPY_SOURCETYPE_CALLBACK;
898 source->ent = ent;
899 source->total = 0;
900 memset(source->name, 0, sizeof(source->name));
901 ISC_LINK_INIT(source, link);
906 ISC_LIST_APPEND(ent->sources, source, link);
909 *sourcep = source;
915 if (source != NULL)
916 isc_mem_put(ent->mctx, source, sizeof(isc_entropysource_t));
925 isc_entropysource_t *source;
932 source = ISC_LIST_HEAD(ent->sources);
933 while (source != NULL) {
934 if (source->type == ENTROPY_SOURCETYPE_CALLBACK) {
935 cbs = &source->sources.callback;
937 cbs->stopfunc(source, cbs->arg);
942 source = ISC_LIST_NEXT(source, link);
953 isc_entropysource_t *source;
961 source = isc_mem_get(ent->mctx, sizeof(isc_entropysource_t));
962 if (source == NULL) {
967 sq = &source->sources.sample.samplequeue;
975 source->magic = SOURCE_MAGIC;
976 source->type = ENTROPY_SOURCETYPE_SAMPLE;
977 source->ent = ent;
978 source->total = 0;
979 memset(source->name, 0, sizeof(source->name));
980 ISC_LINK_INIT(source, link);
985 ISC_LIST_APPEND(ent->sources, source, link);
988 *sourcep = source;
994 if (source != NULL)
995 isc_mem_put(ent->mctx, source, sizeof(isc_entropysource_t));
1023 isc_entropy_addsample(isc_entropysource_t *source, isc_uint32_t sample,
1031 REQUIRE(VALID_SOURCE(source));
1033 ent = source->ent;
1037 sq = &source->sources.sample.samplequeue;
1050 isc_entropy_addcallbacksample(isc_entropysource_t *source, isc_uint32_t sample,
1056 REQUIRE(VALID_SOURCE(source));
1057 REQUIRE(source->type == ENTROPY_SOURCETYPE_CALLBACK);
1059 sq = &source->sources.callback.samplequeue;
1155 kbdstart(isc_entropysource_t *source, void *arg, isc_boolean_t blocking) {
1169 if (source->warn_keyboard)
1177 return (isc_keyboard_open(&source->kbd));
1181 kbdstop(isc_entropysource_t *source, void *arg) {
1185 if (! isc_keyboard_canceled(&source->kbd))
1188 (void)isc_keyboard_close(&source->kbd, 3);
1192 kbdget(isc_entropysource_t *source, void *arg, isc_boolean_t blocking) {
1204 result = isc_keyboard_getchar(&source->kbd, &c);
1213 result = isc_entropy_addcallbacksample(source, sample, extra);
1226 isc_entropy_usebestsource(isc_entropy_t *ectx, isc_entropysource_t **source,
1234 REQUIRE(source != NULL && *source == NULL);
1260 NULL, source);
1262 (*source)->warn_keyboard =
1271 * final_result is ISC_R_SUCCESS if at least one source of entropy