Macros | Functions
HSMLPF3Utility.h File Reference

Detailed Description

Interface for helper functions for HSM-related operations.


#include <stdint.h>
Include dependency graph for HSMLPF3Utility.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...
 

Macro Definition Documentation

§ HSM_ASYM_DATA_VHEADER

#define HSM_ASYM_DATA_VHEADER   (4U)

Referenced by HSM_ASYM_DATA_SIZE_VWB().

§ HSM_WORD_LENGTH

#define HSM_WORD_LENGTH   (4U)

Referenced by HSM_ASYM_DATA_SIZE_B2WB().

§ HSM_SIGNATURE_VCOUNT

#define HSM_SIGNATURE_VCOUNT   (2U)

§ BITS_TO_BYTES

#define BITS_TO_BYTES (   bits)    (((size_t)(bits) + 7U) / 8U)

Function Documentation

§ HSM_ASYM_DATA_SIZE_B2W()

static uint32_t HSM_ASYM_DATA_SIZE_B2W ( const size_t  x)
inlinestatic

HSM_ASYM_DATA_SIZE_B2W

Converts a size in bits to the # of 32-bit words;

Referenced by HSM_ASYM_DATA_SIZE_B2WB().

§ HSM_ASYM_DATA_SIZE_B2WB()

static uint32_t HSM_ASYM_DATA_SIZE_B2WB ( const size_t  x)
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().

§ HSM_ASYM_DATA_SIZE_VWB()

static uint32_t HSM_ASYM_DATA_SIZE_VWB ( const size_t  x)
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.

§ HSMLPF3_getOutputBufferLength()

static uint32_t HSMLPF3_getOutputBufferLength ( const uint32_t  inputLength)
inlinestatic

Returns 32-bit aligned adjusted input length.

Parameters
[in]inputLengthOriginal input length

References HSMLPF3_asymDsaPriKeyToHW(), HSMLPF3_asymDsaPubKeyToHW(), HSMLPF3_asymDsaSignatureFromHW(), and HSMLPF3_asymDsaSignatureToHW().

§ HSMLPF3_asymDsaSignatureFromHW()

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.

Parameters
[in]inPointer to the input from HSM.
[in]modulusSizeBitssize of each sub-vector component in bits.
[out]outu_rBuffer to copy the R component of the signature to.
[out]outu_sBuffer to copy the S component of the signature to.

Referenced by HSMLPF3_getOutputBufferLength().

§ HSMLPF3_asymDsaSignatureToHW()

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.

Parameters
[in]Signature_rPointer to R component of the signature to copy from.
[in]Signature_sPointer to S component of the signature to copy from.
[out]modulusSizeBitssize of each sub-vector component in bits.
[out]blobBuffer to copy the output vector to.

Referenced by HSMLPF3_getOutputBufferLength().

§ HSMLPF3_asymDsaPubKeyToHW()

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.

Parameters
[in]pubKeyPointer to public key location to copy.
[in]modulusSizeBitssize of each sub-vector component in bits.
[out]domainIdThe domain to construct a vector header for (BrainPool or NIST).
[out]blobBuffer to copy the output vector to.

Referenced by HSMLPF3_getOutputBufferLength().

§ HSMLPF3_asymDsaPriKeyToHW()

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.

Parameters
[in]pubKeyPointer to private key location to copy.
[in]modulusSizeBitssize of each sub-vector component in bits.
[out]domainIdThe domain to construct a vector header for (BrainPool or NIST).
[out]blobBuffer to copy the output vector to.

Referenced by HSMLPF3_getOutputBufferLength().

© Copyright 1995-2024, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale