|
iPXE
|
DRBG mechanism. More...
Go to the source code of this file.
Data Structures | |
| struct | drbg_state |
| A Deterministic Random Bit Generator. More... | |
Macros | |
| #define | HMAC_DRBG_ALGORITHM HMAC_DRBG_SHA256 |
| Choose HMAC_DRBG using SHA-256. | |
| #define | DRBG_MAX_SECURITY_STRENGTH HMAC_DRBG_MAX_SECURITY_STRENGTH ( HMAC_DRBG_ALGORITHM ) |
| Maximum security strength. | |
| #define | DRBG_SECURITY_STRENGTH 128 |
| Security strength. | |
| #define | DRBG_MIN_ENTROPY_LEN_BYTES HMAC_DRBG_MIN_ENTROPY_LEN_BYTES ( DRBG_SECURITY_STRENGTH ) |
| Minimum entropy input length. | |
| #define | DRBG_MAX_ENTROPY_LEN_BYTES HMAC_DRBG_MAX_ENTROPY_LEN_BYTES |
| Maximum entropy input length. | |
| #define | DRBG_MAX_PERSONAL_LEN_BYTES HMAC_DRBG_MAX_PERSONAL_LEN_BYTES |
| Maximum personalisation string length. | |
| #define | DRBG_MAX_ADDITIONAL_LEN_BYTES HMAC_DRBG_MAX_ADDITIONAL_LEN_BYTES |
| Maximum additional input length. | |
| #define | DRBG_MAX_GENERATED_LEN_BYTES HMAC_DRBG_MAX_GENERATED_LEN_BYTES |
| Maximum length of generated pseudorandom data per request. | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| FILE_SECBOOT (PERMITTED) | |
| static void | drbg_instantiate_algorithm (struct drbg_state *state, const void *entropy, size_t entropy_len, const void *personal, size_t personal_len) |
| Instantiate DRBG algorithm. | |
| static void | drbg_reseed_algorithm (struct drbg_state *state, const void *entropy, size_t entropy_len, const void *additional, size_t additional_len) |
| Reseed DRBG algorithm. | |
| static int | drbg_generate_algorithm (struct drbg_state *state, const void *additional, size_t additional_len, void *data, size_t len) |
| Generate pseudorandom bits using DRBG algorithm. | |
| int | drbg_instantiate (struct drbg_state *state, const void *personal, size_t personal_len) |
| Instantiate DRBG. | |
| int | drbg_reseed (struct drbg_state *state, const void *additional, size_t additional_len) |
| Reseed DRBG. | |
| 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. | |
| void | drbg_uninstantiate (struct drbg_state *state) |
| Uninstantiate DRBG. | |
DRBG mechanism.
Definition in file drbg.h.
| #define HMAC_DRBG_ALGORITHM HMAC_DRBG_SHA256 |
Choose HMAC_DRBG using SHA-256.
HMAC_DRBG using SHA-256 is an Approved algorithm in ANS X9.82.
Definition at line 21 of file drbg.h.
Referenced by drbg_generate_algorithm(), drbg_instantiate_algorithm(), and drbg_reseed_algorithm().
| #define DRBG_MAX_SECURITY_STRENGTH HMAC_DRBG_MAX_SECURITY_STRENGTH ( HMAC_DRBG_ALGORITHM ) |
Maximum security strength.
Definition at line 24 of file drbg.h.
Referenced by drbg_instantiate().
| #define DRBG_SECURITY_STRENGTH 128 |
Security strength.
We choose to operate at a strength of 128 bits.
Definition at line 31 of file drbg.h.
Referenced by drbg_instantiate(), drbg_reseed(), and rdrand_entropy_enable().
| #define DRBG_MIN_ENTROPY_LEN_BYTES HMAC_DRBG_MIN_ENTROPY_LEN_BYTES ( DRBG_SECURITY_STRENGTH ) |
Minimum entropy input length.
Definition at line 34 of file drbg.h.
Referenced by drbg_instantiate(), and drbg_reseed().
| #define DRBG_MAX_ENTROPY_LEN_BYTES HMAC_DRBG_MAX_ENTROPY_LEN_BYTES |
Maximum entropy input length.
Definition at line 38 of file drbg.h.
Referenced by drbg_instantiate(), and drbg_reseed().
| #define DRBG_MAX_PERSONAL_LEN_BYTES HMAC_DRBG_MAX_PERSONAL_LEN_BYTES |
Maximum personalisation string length.
Definition at line 41 of file drbg.h.
Referenced by drbg_instantiate().
| #define DRBG_MAX_ADDITIONAL_LEN_BYTES HMAC_DRBG_MAX_ADDITIONAL_LEN_BYTES |
Maximum additional input length.
Definition at line 44 of file drbg.h.
Referenced by drbg_generate(), and drbg_reseed().
| #define DRBG_MAX_GENERATED_LEN_BYTES HMAC_DRBG_MAX_GENERATED_LEN_BYTES |
Maximum length of generated pseudorandom data per request.
Definition at line 47 of file drbg.h.
Referenced by drbg_generate().
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
| FILE_SECBOOT | ( | PERMITTED | ) |
|
inlinestatic |
Instantiate DRBG algorithm.
| state | Algorithm state |
| entropy | Entropy input |
| entropy_len | Length of entropy input |
| personal | Personalisation string |
| personal_len | Length of personalisation string |
This is the Instantiate_algorithm function defined in ANS X9.82 Part 3-2007 Section 9.2 (NIST SP 800-90 Section 9.1).
Definition at line 71 of file drbg.h.
References HMAC_DRBG_ALGORITHM, HMAC_DRBG_HASH, hmac_drbg_instantiate(), and state.
Referenced by drbg_instantiate().
|
inlinestatic |
Reseed DRBG algorithm.
| state | Algorithm state |
| entropy | Entropy input |
| entropy_len | Length of entropy input |
| additional | Additional input |
| additional_len | Length of additional input |
This is the Reseed_algorithm function defined in ANS X9.82 Part 3-2007 Section 9.3 (NIST SP 800-90 Section 9.2).
Definition at line 93 of file drbg.h.
References additional, HMAC_DRBG_ALGORITHM, HMAC_DRBG_HASH, hmac_drbg_reseed(), and state.
Referenced by drbg_reseed().
|
inlinestatic |
Generate pseudorandom bits using DRBG algorithm.
| state | Algorithm state |
| additional | Additional input |
| additional_len | Length of additional input |
| data | Output buffer |
| len | Length of output buffer |
| rc | Return status code |
This is the Generate_algorithm function defined in ANS X9.82 Part 3-2007 Section 9.4 (NIST SP 800-90 Section 9.3).
Note that the only permitted error is "reseed required".
Definition at line 118 of file drbg.h.
References additional, data, HMAC_DRBG_ALGORITHM, hmac_drbg_generate(), HMAC_DRBG_HASH, len, and state.
Referenced by drbg_generate().
|
extern |
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 79 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().
|
extern |
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 191 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().
|
extern |
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 284 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().
|
extern |
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 424 of file drbg.c.
References assert, DBGC, memset(), NULL, and state.
Referenced by rbg_shutdown().