![]() |
![]() |
Interface for helper functions for HSM-related operations.
#include <stdint.h>
Go to the source code of this file.
Macros | |
#define | HSM_ASYM_DATA_VHEADER (4U) |
#define | HSM_WORD_LENGTH (4U) |
#define | HSM_SIGNATURE_VCOUNT (2U) |
#define | BITS_TO_BYTES(bits) (((size_t)(bits) + 7U) / 8U) |
Functions | |
static uint32_t | HSM_ASYM_DATA_SIZE_B2W (const size_t x) |
static uint32_t | HSM_ASYM_DATA_SIZE_B2WB (const size_t x) |
static uint32_t | HSM_ASYM_DATA_SIZE_VWB (const size_t x) |
static uint32_t | HSMLPF3_getOutputBufferLength (const uint32_t inputLength) |
Returns 32-bit aligned adjusted input length. More... | |
void | HSMLPF3_asymDsaSignatureFromHW (const uint8_t *const in, const size_t modulusSizeBits, uint8_t *out_r, uint8_t *out_s) |
Extracts the signature from HSM-formatted output. More... | |
void | HSMLPF3_asymDsaSignatureToHW (const uint8_t *const Signature_r, const uint8_t *const Signature_s, const size_t modulusSizeBits, uint8_t *const blob) |
Constructs a vector component consistent with HSM format to hold the signature. More... | |
void | HSMLPF3_asymDsaPubKeyToHW (const uint8_t *const pubKey, const size_t modulusSizeBits, const uint8_t domainId, uint8_t *const blob) |
Constructs a vector component consistent with HSM format to hold a verify operation's public key. More... | |
void | HSMLPF3_asymDsaPriKeyToHW (const uint8_t *const pubKey, const size_t modulusSizeBits, const uint8_t domainId, uint8_t *const blob) |
Constructs a vector component consistent with HSM format to hold a sign operation's private key. More... | |
#define HSM_ASYM_DATA_VHEADER (4U) |
Referenced by HSM_ASYM_DATA_SIZE_VWB().
#define HSM_WORD_LENGTH (4U) |
Referenced by HSM_ASYM_DATA_SIZE_B2WB().
#define HSM_SIGNATURE_VCOUNT (2U) |
#define BITS_TO_BYTES | ( | bits | ) | (((size_t)(bits) + 7U) / 8U) |
|
inlinestatic |
HSM_ASYM_DATA_SIZE_B2W
Converts a size in bits to the # of 32-bit words;
Referenced by HSM_ASYM_DATA_SIZE_B2WB().
|
inlinestatic |
HSM_ASYM_DATA_SIZE_B2WB
Converts a size in bits to a size in bytes aligned on a word boundary.
References HSM_ASYM_DATA_SIZE_B2W(), and HSM_WORD_LENGTH.
Referenced by HSM_ASYM_DATA_SIZE_VWB().
|
inlinestatic |
HSM_ASYM_DATA_SIZE_VWB
Converts a size in bits to a size in bytes aligned on a word boundary + Header size.
References HSM_ASYM_DATA_SIZE_B2WB(), and HSM_ASYM_DATA_VHEADER.
|
inlinestatic |
Returns 32-bit aligned adjusted input length.
[in] | inputLength | Original input length |
References HSMLPF3_asymDsaPriKeyToHW(), HSMLPF3_asymDsaPubKeyToHW(), HSMLPF3_asymDsaSignatureFromHW(), and HSMLPF3_asymDsaSignatureToHW().
void HSMLPF3_asymDsaSignatureFromHW | ( | const uint8_t *const | in, |
const size_t | modulusSizeBits, | ||
uint8_t * | out_r, | ||
uint8_t * | out_s | ||
) |
Extracts the signature from HSM-formatted output.
[in] | in | Pointer to the input from HSM. |
[in] | modulusSizeBits | size of each sub-vector component in bits. |
[out] | outu_r | Buffer to copy the R component of the signature to. |
[out] | outu_s | Buffer to copy the S component of the signature to. |
Referenced by HSMLPF3_getOutputBufferLength().
void HSMLPF3_asymDsaSignatureToHW | ( | const uint8_t *const | Signature_r, |
const uint8_t *const | Signature_s, | ||
const size_t | modulusSizeBits, | ||
uint8_t *const | blob | ||
) |
Constructs a vector component consistent with HSM format to hold the signature.
[in] | Signature_r | Pointer to R component of the signature to copy from. |
[in] | Signature_s | Pointer to S component of the signature to copy from. |
[out] | modulusSizeBits | size of each sub-vector component in bits. |
[out] | blob | Buffer to copy the output vector to. |
Referenced by HSMLPF3_getOutputBufferLength().
void HSMLPF3_asymDsaPubKeyToHW | ( | const uint8_t *const | pubKey, |
const size_t | modulusSizeBits, | ||
const uint8_t | domainId, | ||
uint8_t *const | blob | ||
) |
Constructs a vector component consistent with HSM format to hold a verify operation's public key.
[in] | pubKey | Pointer to public key location to copy. |
[in] | modulusSizeBits | size of each sub-vector component in bits. |
[out] | domainId | The domain to construct a vector header for (BrainPool or NIST). |
[out] | blob | Buffer to copy the output vector to. |
Referenced by HSMLPF3_getOutputBufferLength().
void HSMLPF3_asymDsaPriKeyToHW | ( | const uint8_t *const | pubKey, |
const size_t | modulusSizeBits, | ||
const uint8_t | domainId, | ||
uint8_t *const | blob | ||
) |
Constructs a vector component consistent with HSM format to hold a sign operation's private key.
[in] | pubKey | Pointer to private key location to copy. |
[in] | modulusSizeBits | size of each sub-vector component in bits. |
[out] | domainId | The domain to construct a vector header for (BrainPool or NIST). |
[out] | blob | Buffer to copy the output vector to. |
Referenced by HSMLPF3_getOutputBufferLength().