assh/assh_prng.h header reference
Description [link]
This header file contains descriptors for random number generator modules implemented in the library.
See also coremod.
Header inclusion [link]
Members [link]
Types [link]
- enum assh_prng_quality_e
- struct assh_prng_s
- typedef void (assh_prng_cleanup_t)(struct assh_context_s *c)
- typedef assh_status_t (assh_prng_get_t)(struct assh_context_s *c, uint8_t *rdata, size_t rdata_len, uint_fast8_t quality)
- typedef assh_status_t (assh_prng_init_t)(struct assh_context_s *c, const struct assh_buffer_s *seed)
Functions [link]
- const struct assh_prng_s * assh_default_prng(void )
- assh_status_t assh_prng_get(struct assh_context_s *c, uint8_t *rdata, size_t rdata_len, enum assh_prng_quality_e quality)
Macros [link]
Members detail [link]
const struct assh_prng_s * assh_default_prng(void ) [link]
This function is declared in assh/assh_prng.h source file, line 110.
This function returns the default prng. This depends on the platform and build configuration. This may return NULL.
assh_status_t assh_prng_get(struct assh_context_s *c, uint8_t *rdata, size_t rdata_len, enum assh_prng_quality_e quality) [link]
This function is declared in assh/assh_prng.h source file, line 105.
This function fills the buffer with random data.
enum assh_prng_quality_e [link]
This enum is declared in assh/assh_prng.h source file, line 42.
This enum specifies quality of randomly generated data.
Identifier | Value | Description |
---|---|---|
ASSH_PRNG_QUALITY_WEAK | 0 | weak random data for use in the testsuite |
ASSH_PRNG_QUALITY_PUBLIC | 1 | random data for use as public parameter |
ASSH_PRNG_QUALITY_PADDING | 2 | random data for use as ssh packet padding |
ASSH_PRNG_QUALITY_NONCE | 3 | random data for use as nonce in signature algorithms |
ASSH_PRNG_QUALITY_EPHEMERAL_KEY | 4 | random data for use in ephemeral key generation |
ASSH_PRNG_QUALITY_LONGTERM_KEY | 5 | random data for use in long term key generation |
struct assh_prng_s [link]
This struct is declared in assh/assh_prng.h source file, line 95.
This struct is the prng module interface descriptor structure.
See also coremod.
Field | Description |
---|---|
assh_prng_init_t * f_init; | |
assh_prng_get_t * f_get; | |
assh_prng_cleanup_t * f_cleanup; |
#define ASSH_PRNG_BIGNUM_FLAG 16 [link]
This macro is for internal use only.
This macro is declared in assh/assh_prng.h source file, line 62.
This macro is passed to the assh_prng_get_t function when the random data is used as a big number.
#define ASSH_PRNG_CLEANUP_FCN(n) [link]
This macro is for internal use only.
This macro is declared in assh/assh_prng.h source file, line 85.
This macro expands to:
void (n)(struct assh_context_s *c)
See also assh_prng_cleanup_t.
#define ASSH_PRNG_GET_FCN(n) [link]
This macro is for internal use only.
This macro is declared in assh/assh_prng.h source file, line 75.
This macro expands to:
ASSH_WARN_UNUSED_RESULT assh_status_t (n)(struct assh_context_s *c,
uint8_t *rdata, size_t rdata_len,
uint_fast8_t quality)
See also assh_prng_get_t.
#define ASSH_PRNG_INIT_FCN(n) [link]
This macro is for internal use only.
This macro is declared in assh/assh_prng.h source file, line 65.
This macro expands to:
ASSH_WARN_UNUSED_RESULT assh_status_t (n)(struct assh_context_s *c,
const struct assh_buffer_s *seed)
See also assh_prng_init_t.
#define ASSH_PRNG_QUALITY(n) [link]
This macro is for internal use only.
This macro is declared in assh/assh_prng.h source file, line 58.
This macro extracts the enum assh_prng_quality_e value from the argument passed to the assh_prng_get_t function.
This macro expands to:
(enum assh_prng_quality_e)((n) & 15)
typedef void (assh_prng_cleanup_t)(struct assh_context_s *c) [link]
This typedef is for internal use only.
This typedef is declared in assh/assh_prng.h source file, line 90.
This declaration involves expansion of the ASSH_PRNG_CLEANUP_FCN macro.
This typedef defines the function type for the cleanup operation of the prng module interface.
typedef assh_status_t (assh_prng_get_t)(struct assh_context_s *c, uint8_t *rdata, size_t rdata_len, uint_fast8_t quality) [link]
This typedef is for internal use only.
This typedef is declared in assh/assh_prng.h source file, line 83.
This declaration involves expansion of the ASSH_PRNG_GET_FCN macro.
This typedef defines the function type for the random generation operation of the prng module interface.
See also assh_prng_get and ASSH_PRNG_QUALITY.
typedef assh_status_t (assh_prng_init_t)(struct assh_context_s *c, const struct assh_buffer_s *seed) [link]
This typedef is for internal use only.
This typedef is declared in assh/assh_prng.h source file, line 73.
This declaration involves expansion of the ASSH_PRNG_INIT_FCN macro.
This typedef defines the function type for the initialization operation of the prng module interface. The prng can store its private data in assh_context_s::prng_pv.