xilsecure
Vitis Drivers API Documentation
xsecure_lms_ots.c File Reference

Overview

This file consists definitions for LMS OTS operations.

MODIFICATION HISTORY:
Ver   Who  Date        Changes
----- ---- -------- ----------------------------------------------------------
5.4   kal  07/24/24  Initial release
Note

Functions

u32 XSecure_LmsOtsCoeff (u8 const *const Arr, const u32 ArrayIndex, const u32 w)
 This function extracts the digits from the array for bytes. More...
 
int XSecure_LmsOtsComputeChecksum (const u8 *const Array, const u32 ArrayLen, const u32 w, const u32 ls, u32 *const Checksum)
 This function calculates the checksum for a given array. More...
 
int XSecure_LmsOtsLookupParamSet (XSecure_LmsOtsType Type, XSecure_LmsOtsParam **Parameters)
 This function returns the parameters for the type of LMS OTS type. More...
 

Function Documentation

u32 XSecure_LmsOtsCoeff ( u8 const *const  Arr,
const u32  ArrayIndex,
const u32  w 
)

This function extracts the digits from the array for bytes.

Note
S (represented in bits) = 0x1234 [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0] ^ | coef(S, 7, 1)

[1, 2, 3, 4] ^ | coef(S, 0, 4)

If i is larger than the number of w-bit values in S, then coef(S, i, w) is undefined, this cant be checked here

Parameters
Array- Byte array from where the digit needs to be picked
ArrayIndex- When array is divided into array of digits, i represents the index of digit
w - Width in bits, for each digit allowed values
Returns
- digit value.

Referenced by XSecure_LmsOtsComputeChecksum().

int XSecure_LmsOtsComputeChecksum ( const u8 *const  Array,
const u32  ArrayLen,
const u32  w,
const u32  ls,
u32 *const  Checksum 
)

This function calculates the checksum for a given array.

Parameters
Array- Byte array ffor which checksum needs to be calculated
ArrayLen-Length of input array
w- Width in bits, for each digit allowed values
ls- Number of bits to left-shift the calculated checksum
Checksum-Pointer to address, where computed checksum needs to be copied
Returns
  • XST_SUCCESS - Valid type is passed, and parameters are assigned
  • XST_FAILURE - If not a valid type is passed

References XSECURE_LMS_OTS_CHECKSUM_BUFF_INVALID_LEN_ERROR, and XSecure_LmsOtsCoeff().

int XSecure_LmsOtsLookupParamSet ( XSecure_LmsOtsType  Type,
XSecure_LmsOtsParam **  Parameters 
)

This function returns the parameters for the type of LMS OTS type.

Parameters
TypeXSecure_LmsOtsType, type of OTS algorithm selected
ParametersPointer to array location where all predefined parameter values are present XSecure_LmsOtsParam
Returns
  • XST_SUCCESS - Valid type is passed, and parameters are assigned
  • XST_FAILURE - If not a valid type is passed

lookup table for 'n', 'w', 'p', 'ls' & Signature lengths

References XSECURE_LMS_OTS_LS_NOT_SUPPORTED, XSECURE_LMS_OTS_NOT_SUPPORTED, XSECURE_LMS_OTS_SHA256_N32_W4, XSECURE_LMS_OTS_SHA256_N32_W8, XSECURE_LMS_OTS_SHAKE_N32_W2, XSECURE_LMS_OTS_SHAKE_N32_W4, XSECURE_LMS_OTS_SHAKE_N32_W8, XSECURE_LMS_OTS_TYPE_LOOKUP_GLITCH_ERROR, XSECURE_LMS_OTS_TYPE_MAX_SUPPORTED, XSECURE_LMS_OTS_TYPE_UNSUPPORTED_ERROR, XSECURE_LMS_OTS_W4, XSECURE_LMS_OTS_W4_LS, XSECURE_LMS_OTS_W4_P, XSECURE_LMS_OTS_W4_U, XSECURE_LMS_OTS_W4_V, XSECURE_LMS_OTS_W8, XSECURE_LMS_OTS_W8_LS, XSECURE_LMS_OTS_W8_P, XSECURE_LMS_OTS_W8_U, XSECURE_LMS_OTS_W8_V, XSECURE_SHA2_256_HASH_LEN, XSECURE_SHAKE_256, and XSECURE_SHAKE_256_HASH_LEN.

Referenced by XSecure_HssFinish(), XSecure_HssInit(), and XSecure_LmsSignatureVerification().