HMAC_DRBG pseudorandom number generator. More...
Go to the source code of this file.
Data Structures | |
| struct | HmacDrbgContext |
| HMAC_DRBG PRNG context. More... | |
Macros | |
| #define | HMAC_DRBG_MAX_RESEED_INTERVAL 281474976710656ULL |
| #define | HMAC_DRBG_PRNG_ALGO (&hmacDrbgPrngAlgo) |
Functions | |
| error_t | hmacDrbgInit (HmacDrbgContext *context, const HashAlgo *hashAlgo) |
| Initialize PRNG context. More... | |
| error_t | hmacDrbgSeed (HmacDrbgContext *context, const uint8_t *seed, size_t length) |
| Seed the PRNG state. More... | |
| error_t | hmacDrbgSeedEx (HmacDrbgContext *context, const uint8_t *entropyInput, size_t entropyInputLen, const uint8_t *nonce, size_t nonceLen, const uint8_t *personalizationString, size_t personalizationStringLen) |
| Seed the PRNG state (with nonce and personalization string) More... | |
| error_t | hmacDrbgReseed (HmacDrbgContext *context, const uint8_t *seed, size_t length) |
| Reseed the PRNG state. More... | |
| error_t | hmacDrbgReseedEx (HmacDrbgContext *context, const uint8_t *entropyInput, size_t entropyInputLen, const uint8_t *additionalInput, size_t additionalInputLen) |
| Reseed the PRNG state (with additional input) More... | |
| error_t | hmacDrbgGenerate (HmacDrbgContext *context, uint8_t *output, size_t length) |
| Generate pseudorandom data. More... | |
| error_t | hmacDrbgGenerateEx (HmacDrbgContext *context, const uint8_t *additionalInput, size_t additionalInputLen, uint8_t *output, size_t outputLen) |
| Generate pseudorandom data (with additional input) More... | |
| void | hmacDrbgDeinit (HmacDrbgContext *context) |
| Release PRNG context. More... | |
| void | hmacDrbgUpdate (HmacDrbgContext *context, const DataChunk *providedData, uint_t providedDataLen) |
| Update internal state. More... | |
Variables | |
| const PrngAlgo | hmacDrbgPrngAlgo |
Detailed Description
HMAC_DRBG pseudorandom number generator.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2025 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneCRYPTO Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.5.4
Definition in file hmac_drbg.h.
Macro Definition Documentation
◆ HMAC_DRBG_MAX_RESEED_INTERVAL
| #define HMAC_DRBG_MAX_RESEED_INTERVAL 281474976710656ULL |
Definition at line 39 of file hmac_drbg.h.
◆ HMAC_DRBG_PRNG_ALGO
| #define HMAC_DRBG_PRNG_ALGO (&hmacDrbgPrngAlgo) |
Definition at line 42 of file hmac_drbg.h.
Function Documentation
◆ hmacDrbgDeinit()
| void hmacDrbgDeinit | ( | HmacDrbgContext * | context | ) |
Release PRNG context.
- Parameters
-
[in] context Pointer to the HMAC_DRBG context
Definition at line 401 of file hmac_drbg.c.
◆ hmacDrbgGenerate()
| error_t hmacDrbgGenerate | ( | HmacDrbgContext * | context, |
| uint8_t * | output, | ||
| size_t | length | ||
| ) |
Generate pseudorandom data.
- Parameters
-
[in] context Pointer to the HMAC_DRBG context [out] output Buffer where to store the pseudorandom bytes [in] length Requested number of bytes
- Returns
- Error code
Definition at line 287 of file hmac_drbg.c.
◆ hmacDrbgGenerateEx()
| error_t hmacDrbgGenerateEx | ( | HmacDrbgContext * | context, |
| const uint8_t * | additionalInput, | ||
| size_t | additionalInputLen, | ||
| uint8_t * | output, | ||
| size_t | outputLen | ||
| ) |
Generate pseudorandom data (with additional input)
- Parameters
-
[in] context Pointer to the HMAC_DRBG context [in] additionalInput Additional input string received from the consuming application [in] additionalInputLen Length of the additional input string, in bytes [out] output Buffer where to store the pseudorandom bytes [in] outputLen Requested number of bytes
- Returns
- Error code
Definition at line 306 of file hmac_drbg.c.
◆ hmacDrbgInit()
| error_t hmacDrbgInit | ( | HmacDrbgContext * | context, |
| const HashAlgo * | hashAlgo | ||
| ) |
Initialize PRNG context.
- Parameters
-
[in] context Pointer to the HMAC_DRBG context to initialize [in] hashAlgo Approved hash function
- Returns
- Error code
Definition at line 62 of file hmac_drbg.c.
◆ hmacDrbgReseed()
| error_t hmacDrbgReseed | ( | HmacDrbgContext * | context, |
| const uint8_t * | seed, | ||
| size_t | length | ||
| ) |
Reseed the PRNG state.
- Parameters
-
[in] context Pointer to the HMAC_DRBG context [in] seed String of bits obtained from the randomness source [in] length Length of the string, in bytes
- Returns
- Error code
Definition at line 209 of file hmac_drbg.c.
◆ hmacDrbgReseedEx()
| error_t hmacDrbgReseedEx | ( | HmacDrbgContext * | context, |
| const uint8_t * | entropyInput, | ||
| size_t | entropyInputLen, | ||
| const uint8_t * | additionalInput, | ||
| size_t | additionalInputLen | ||
| ) |
Reseed the PRNG state (with additional input)
- Parameters
-
[in] context Pointer to the HMAC_DRBG context [in] entropyInput String of bits obtained from the randomness source [in] entropyInputLen Length of the string, in bytes [in] additionalInput Additional input string received from the consuming application [in] additionalInputLen Length of the additional input string, in bytes
- Returns
- Error code
Definition at line 228 of file hmac_drbg.c.
◆ hmacDrbgSeed()
| error_t hmacDrbgSeed | ( | HmacDrbgContext * | context, |
| const uint8_t * | seed, | ||
| size_t | length | ||
| ) |
Seed the PRNG state.
- Parameters
-
[in] context Pointer to the HMAC_DRBG context [in] seed String of bits obtained from the randomness source [in] length Length of the string, in bytes
- Returns
- Error code
Definition at line 109 of file hmac_drbg.c.
◆ hmacDrbgSeedEx()
| error_t hmacDrbgSeedEx | ( | HmacDrbgContext * | context, |
| const uint8_t * | entropyInput, | ||
| size_t | entropyInputLen, | ||
| const uint8_t * | nonce, | ||
| size_t | nonceLen, | ||
| const uint8_t * | personalizationString, | ||
| size_t | personalizationStringLen | ||
| ) |
Seed the PRNG state (with nonce and personalization string)
- Parameters
-
[in] context Pointer to the HMAC_DRBG context [in] entropyInput String of bits obtained from the randomness source [in] entropyInputLen Length of the string, in bytes [in] nonce Nonce [in] nonceLen Length of the nonce, in bytes [in] personalizationString Personalization string received from the consuming application [in] personalizationStringLen Length of the personalization string, in bytes
- Returns
- Error code
Definition at line 131 of file hmac_drbg.c.
◆ hmacDrbgUpdate()
| void hmacDrbgUpdate | ( | HmacDrbgContext * | context, |
| const DataChunk * | providedData, | ||
| uint_t | providedDataLen | ||
| ) |
Update internal state.
- Parameters
-
[in] context Pointer to the HMAC_DRBG context [in] providedData The data to be used [in] providedDataLen Number of data chunks representing the data
Definition at line 422 of file hmac_drbg.c.
Variable Documentation
◆ hmacDrbgPrngAlgo
|
extern |
Definition at line 43 of file hmac_drbg.c.
