Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/random/randomdev.h
Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Random Algorithm is a processor of randomness for the kernel | * Random Algorithm is a processor of randomness for the kernel | ||||
* and for userland. | * and for userland. | ||||
*/ | */ | ||||
struct random_algorithm { | struct random_algorithm { | ||||
const char *ra_ident; | const char *ra_ident; | ||||
u_int ra_poolcount; | u_int ra_poolcount; | ||||
void (*ra_init_alg)(void *); | |||||
void (*ra_deinit_alg)(void *); | |||||
random_alg_pre_read_t *ra_pre_read; | random_alg_pre_read_t *ra_pre_read; | ||||
random_alg_read_t *ra_read; | random_alg_read_t *ra_read; | ||||
random_alg_seeded_t *ra_seeded; | random_alg_seeded_t *ra_seeded; | ||||
random_alg_eventprocessor_t *ra_event_processor; | random_alg_eventprocessor_t *ra_event_processor; | ||||
}; | }; | ||||
extern struct random_algorithm random_alg_context, *p_random_alg_context; | #if defined(RANDOM_LOADABLE) | ||||
extern const struct random_algorithm *p_random_alg_context; | |||||
#else | |||||
extern const struct random_algorithm random_alg_context; | |||||
#define p_random_alg_context (&random_alg_context) | |||||
#endif | |||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
/* | /* | ||||
* Random Source is a source of entropy that can provide | * Random Source is a source of entropy that can provide | ||||
* specified or approximate amount of entropy immediately | * specified or approximate amount of entropy immediately | ||||
* upon request. | * upon request. | ||||
*/ | */ | ||||
struct random_source { | struct random_source { | ||||
const char *rs_ident; | const char *rs_ident; | ||||
enum random_entropy_source rs_source; | enum random_entropy_source rs_source; | ||||
random_source_read_t *rs_read; | random_source_read_t *rs_read; | ||||
}; | }; | ||||
void random_source_register(struct random_source *); | void random_source_register(struct random_source *); | ||||
void random_source_deregister(struct random_source *); | void random_source_deregister(struct random_source *); | ||||
#if defined(RANDOM_LOADABLE) | |||||
extern struct sx randomdev_config_lock; | |||||
#define RANDOM_CONFIG_INIT_LOCK(x) sx_init(&randomdev_config_lock, "configuration change lock") | |||||
#define RANDOM_CONFIG_X_LOCK(x) sx_xlock(&randomdev_config_lock) | |||||
#define RANDOM_CONFIG_X_UNLOCK(x) sx_xunlock(&randomdev_config_lock) | |||||
#define RANDOM_CONFIG_S_LOCK(x) sx_slock(&randomdev_config_lock) | |||||
#define RANDOM_CONFIG_S_UNLOCK(x) sx_sunlock(&randomdev_config_lock) | |||||
#define RANDOM_CONFIG_DEINIT_LOCK(x) sx_destroy(&randomdev_config_lock) | |||||
void random_infra_init(int (*)(struct uio *, bool), void (*)(void *, u_int), | |||||
bool (*)(void)); | |||||
void random_infra_uninit(void); | |||||
#endif | |||||
markm: More joy! | |||||
#endif /* _KERNEL */ | #endif /* _KERNEL */ | ||||
void randomdev_unblock(void); | void randomdev_unblock(void); | ||||
#endif /* SYS_DEV_RANDOM_RANDOMDEV_H_INCLUDED */ | #endif /* SYS_DEV_RANDOM_RANDOMDEV_H_INCLUDED */ |
More joy!