xilsecure
Vitis Drivers API Documentation
xsecure_lms.h File Reference

Overview

This file contains structures, constants and defines used in LMS and HSS provides interface to LMS operations.

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

Data Structures

struct  XSecure_LmsParam
 Structure for maintaining parameters for each LMS Type. More...
 
union  XSecure_LmsPublicKey_
 LMS Public key structure to access root value. More...
 
union  XSecure_LmsPubKeyTmp_
 Used to store data which is repeatedly sent to SHA engine, during LMS root value calculation. More...
 

Macros

#define XSECURE_LMS_TYPE_MAX_SUPPORTED   (9U)
 Max supported types, used for creating lookup table for parameters for types supported number should be max valid + 1 (as first slot will be for invalid parameters) XSecure_LmsType from 0 (unsupported) to XSECURE_LMS_SHAKE_M32_H20. More...
 

Typedefs

typedef union XSecure_LmsPublicKey_ XSecure_LmsPublicKey
 LMS Public key structure to access root value. More...
 
typedef union XSecure_LmsPubKeyTmp_ XSecure_LmsPubKeyTmp
 Used to store data which is repeatedly sent to SHA engine, during LMS root value calculation. More...
 

Enumerations

enum  XSecure_LmsType { ,
  XSECURE_LMS_SHA256_M32_H10 = 0x00000006U, XSECURE_LMS_SHA256_M32_H15 = 0x00000007U, XSECURE_LMS_SHA256_M32_H20 = 0x00000008U, XSECURE_LMS_SHAKE_M32_H5 = 0x0000000FU,
  XSECURE_LMS_SHAKE_M32_H10 = 0x00000010U, XSECURE_LMS_SHAKE_M32_H15 = 0x00000011U, XSECURE_LMS_SHAKE_M32_H20 = 0x00000012U, XSECURE_LMS_NOT_SUPPORTED
}
 Supported LMS Types from standard. More...
 
enum  XSecure_LmsTreeHeight
 Different Heights supported for Merkle Tree, 'h'=25 not supported. More...
 

Functions

int XSecure_LmsLookupParamSet (XSecure_LmsType Type, XSecure_LmsParam **Parameters)
 This function returns the parameters for the type of LMS type. More...
 

Variables

XSecure_LmsType LmsType
 LmsType XSecure_LmsType Size - 4 bytes, 0 to 3 in public key. More...
 
XSecure_LmsOtsType OtsType
 OtsType XSecure_LmsOtsType Size - 4 bytes, 4 to 7 bytes in public key. More...
 
u8 I [XSECURE_LMS_I_FIELD_SIZE]
 I - Merkle Tree's unique identifier (uniformly random 16-byte string) Size - 16 bytes, 8 to 23 bytes in public key. More...
 
u8 T [XSECURE_LMS_PUB_KEY_T_FIELD_SIZE]
 T[1] - H(I||u32str(r)||u16str(D_INTR)||T[2*r]||T[2*r+1]) More...
 
u32 half_node_number
 (node number/2), used to get unique hash o/p for same data for every node Size - 4 bytes, 16 to 20 bytes More...
 
u8 D [XSECURE_LMS_D_FIELD_SIZE]
 D - XSECURE_D_INTR or XSECURE_D_PLEAF Size - 2 bytes, 21st & 22nd byte. More...
 
u8 Tmp [XSECURE_LMS_M_BYTE_FIELD_SIZE+XSECURE_LMS_M_BYTE_FIELD_SIZE]
 Tmp - Used to store previous hash output and adjacent node value in right order to send to SHA engine Size - 32 * 2 = 64 bytes, 23 to 85 bytes. More...
 

Macro Definition Documentation

#define XSECURE_LMS_TYPE_MAX_SUPPORTED   (9U)

Max supported types, used for creating lookup table for parameters for types supported number should be max valid + 1 (as first slot will be for invalid parameters) XSecure_LmsType from 0 (unsupported) to XSECURE_LMS_SHAKE_M32_H20.

Referenced by XSecure_LmsLookupParamSet().

Typedef Documentation

Used to store data which is repeatedly sent to SHA engine, during LMS root value calculation.

Size = 16(I) + 4(node_number/2) + 2(D_INTR) + (32 * 2)

LMS Public key structure to access root value.

Size = 4 + 4 + 16 + H Len (32) = 56 Bytes

Enumeration Type Documentation

Different Heights supported for Merkle Tree, 'h'=25 not supported.

Supported LMS Types from standard.

Enumerator
XSECURE_LMS_SHA256_M32_H10 

'M' = 32, 'H' = SHA2-256, 'h' = 5

XSECURE_LMS_SHA256_M32_H15 

'M' = 32, 'H' = SHA2-256, 'h' = 10

XSECURE_LMS_SHA256_M32_H20 

'M' = 32, 'H' = SHA2-256, 'h' = 15

XSECURE_LMS_SHAKE_M32_H5 

'M' = 32, 'H' = SHA2-256, 'h' = 20

XSECURE_LMS_SHAKE_M32_H10 

'M' = 32, 'H' = SHAKE-256, 'h' = 5

XSECURE_LMS_SHAKE_M32_H15 

'M' = 32, 'H' = SHAKE-256, 'h' = 10

XSECURE_LMS_SHAKE_M32_H20 

'M' = 32, 'H' = SHAKE-256, 'h' = 15

XSECURE_LMS_NOT_SUPPORTED 

'M' = 32, 'H' = SHAKE-256, 'h' = 20

Function Documentation

int XSecure_LmsLookupParamSet ( XSecure_LmsType  Type,
XSecure_LmsParam **  Parameters 
)

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

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

160U

320U

480U

640U

160U

320U

480U

640U

References XSECURE_LMS_NOT_SUPPORTED, XSECURE_LMS_SHA256_M32_H10, XSECURE_LMS_SHA256_M32_H15, XSECURE_LMS_SHA256_M32_H20, XSECURE_LMS_SHAKE_M32_H10, XSECURE_LMS_SHAKE_M32_H15, XSECURE_LMS_SHAKE_M32_H20, XSECURE_LMS_SHAKE_M32_H5, XSECURE_LMS_TYPE_LOOKUP_GLITCH_ERROR, XSECURE_LMS_TYPE_MAX_SUPPORTED, XSECURE_LMS_TYPE_UNSUPPORTED_ERROR, XSECURE_SHA2_256_HASH_LEN, XSECURE_SHAKE_256, and XSECURE_SHAKE_256_HASH_LEN.

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

Variable Documentation

u8 D[XSECURE_LMS_D_FIELD_SIZE]

D - XSECURE_D_INTR or XSECURE_D_PLEAF Size - 2 bytes, 21st & 22nd byte.

Referenced by XSecure_EllipticGenerateKey_64Bit(), XSecure_EllipticGenerateSignature_64Bit(), XSecure_EllipticSignGenerateKat(), and XSecure_GetKatEccPrivateKey().

u32 half_node_number

(node number/2), used to get unique hash o/p for same data for every node Size - 4 bytes, 16 to 20 bytes

u8 I

I - Merkle Tree's unique identifier (uniformly random 16-byte string) Size - 16 bytes, 8 to 23 bytes in public key.

I - Merkle Tree's unique identifier (uniformly random 16-byte string) Size - 16 bytes, 1 to 16 bytes.

I - Merkle Tree's unique identifier (uniformly random 16-byte string) Size - 16 bytes, 0 to 15 bytes.

XSecure_LmsType LmsType

LmsType XSecure_LmsType Size - 4 bytes, 0 to 3 in public key.

OtsType XSecure_LmsOtsType Size - 4 bytes, 4 to 7 bytes in public key.

u8 T[XSECURE_LMS_PUB_KEY_T_FIELD_SIZE]

T[1] - H(I||u32str(r)||u16str(D_INTR)||T[2*r]||T[2*r+1])

'H' is a hash function, PLM supports only SHA2-256 and SHAKE-256 both are of 32Byte output len

'r' is the node number, same as 'q', goes from 0 on left most leaf to right most (2^h -1), in a single tree D_INTR is a constant XSECURE_D_INTR

u8 Tmp[XSECURE_LMS_M_BYTE_FIELD_SIZE+XSECURE_LMS_M_BYTE_FIELD_SIZE]

Tmp - Used to store previous hash output and adjacent node value in right order to send to SHA engine Size - 32 * 2 = 64 bytes, 23 to 85 bytes.