|
iPXE
|
DRBG mechanism. More...
#include <stdint.h>#include <string.h>#include <errno.h>#include <assert.h>#include <ipxe/entropy.h>#include <ipxe/drbg.h>Go to the source code of this file.
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| int | drbg_instantiate (struct drbg_state *state, const void *personal, size_t personal_len) |
| Instantiate DRBG. More... | |
| int | drbg_reseed (struct drbg_state *state, const void *additional, size_t additional_len) |
| Reseed DRBG. More... | |
| int | drbg_generate (struct drbg_state *state, const void *additional, size_t additional_len, int prediction_resist, void *data, size_t len) |
| Generate pseudorandom bits using DRBG. More... | |
| void | drbg_uninstantiate (struct drbg_state *state) |
| Uninstantiate DRBG. More... | |
DRBG mechanism.
This mechanism is designed to comply with ANS X9.82 Part 3-2007 Section 9. This standard is not freely available, but most of the text appears to be shared with NIST SP 800-90, which can be downloaded from
http://csrc.nist.gov/publications/nistpubs/800-90/SP800-90revised_March2007.pdf
Where possible, references are given to both documents. In the case of any disagreement, ANS X9.82 takes priority over NIST SP 800-90. (In particular, note that some algorithms that are Approved by NIST SP 800-90 are not Approved by ANS X9.82.)
Definition in file drbg.c.
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
| int drbg_instantiate | ( | struct drbg_state * | state, |
| const void * | personal, | ||
| size_t | personal_len | ||
| ) |
Instantiate DRBG.
| state | Algorithm state to be initialised |
| personal | Personalisation string |
| personal_len | Length of personalisation string |
| rc | Return status code |
This is the Instantiate_function defined in ANS X9.82 Part 3-2007 Section 9.2 (NIST SP 800-90 Section 9.1).
Only a single security strength is supported, and prediction resistance is always enabled. The nonce is accounted for by increasing the entropy input, as per ANS X9.82 Part 3-2007 Section 8.4.2 (NIST SP 800-90 Section 8.6.7).
Definition at line 78 of file drbg.c.
References assert(), data, DBGC, drbg_instantiate_algorithm(), DRBG_MAX_ENTROPY_LEN_BYTES, DRBG_MAX_PERSONAL_LEN_BYTES, DRBG_MAX_SECURITY_STRENGTH, DRBG_MIN_ENTROPY_LEN_BYTES, DRBG_SECURITY_STRENGTH, ENOTSUP, ERANGE, get_entropy_input(), len, NULL, rc, state, and strerror().
Referenced by rbg_startup().
| int drbg_reseed | ( | struct drbg_state * | state, |
| const void * | additional, | ||
| size_t | additional_len | ||
| ) |
Reseed DRBG.
| state | Algorithm state |
| additional | Additional input |
| additional_len | Length of additional input |
| rc | Return status code |
This is the Reseed_function defined in ANS X9.82 Part 3-2007 Section 9.3 (NIST SP 800-90 Section 9.2).
Prediction resistance is always enabled.
Definition at line 190 of file drbg.c.
References additional, assert(), data, DBGC, DRBG_MAX_ADDITIONAL_LEN_BYTES, DRBG_MAX_ENTROPY_LEN_BYTES, DRBG_MIN_ENTROPY_LEN_BYTES, drbg_reseed_algorithm(), DRBG_SECURITY_STRENGTH, EINVAL, ERANGE, get_entropy_input(), len, NULL, rc, state, and strerror().
Referenced by drbg_generate().
| int drbg_generate | ( | struct drbg_state * | state, |
| const void * | additional, | ||
| size_t | additional_len, | ||
| int | prediction_resist, | ||
| void * | data, | ||
| size_t | len | ||
| ) |
Generate pseudorandom bits using DRBG.
| state | Algorithm state |
| additional | Additional input |
| additional_len | Length of additional input |
| prediction_resist | Prediction resistance is required |
| data | Output buffer |
| len | Length of output buffer |
| rc | Return status code |
This is the Generate_function defined in ANS X9.82 Part 3-2007 Section 9.4 (NIST SP 800-90 Section 9.3).
Requests must be for an integral number of bytes. Only a single security strength is supported. Prediction resistance is supported if requested.
Definition at line 283 of file drbg.c.
References additional, assert(), data, DBGC, drbg_generate_algorithm(), DRBG_MAX_ADDITIONAL_LEN_BYTES, DRBG_MAX_GENERATED_LEN_BYTES, drbg_reseed(), EINVAL, ERANGE, len, NULL, rc, state, and strerror().
Referenced by rbg_generate().
| void drbg_uninstantiate | ( | struct drbg_state * | state | ) |
Uninstantiate DRBG.
| state | Algorithm state |
This is the Uninstantiate_function defined in ANS X9.82 Part 3-2007 Section 9.5 (NIST SP 800-90 Section 9.4).
Definition at line 423 of file drbg.c.
References assert(), DBGC, memset(), NULL, and state.
Referenced by rbg_shutdown().
1.8.15