HMAC_DRBG pseudorandom number generator. More...
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL CRYPTO_TRACE_LEVEL |
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.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL CRYPTO_TRACE_LEVEL |
Definition at line 32 of file hmac_drbg.c.
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
const PrngAlgo hmacDrbgPrngAlgo |
Definition at line 43 of file hmac_drbg.c.