FCL
Free Cryptographic Library
SIA256

Data Structures

struct  ucl_sia256_ctx
 

Macros

#define UCL_SIA256   0
 
#define UCL_SIA256_BLOCKSIZE   64
 
#define UCL_SIA256_HASHW32SIZE   8
 

List of types

typedef struct ucl_sia256_ctx ucl_sia256_ctx_t
 

List of functions

int __API__ ucl_sia256 (u8 *hash, u8 *data, u32 data_byteLen)
 
int __API__ ucl_sia256_core (ucl_sia256_ctx_t *context, u8 *data, u32 data_byteLen)
 
int __API__ ucl_sia256_finish (u8 *hash, ucl_sia256_ctx_t *context)
 
int __API__ ucl_sia256_init (ucl_sia256_ctx_t *context)
 

Detailed Description

Secure Hash Algorithm 256, from FIPS 180-2.

Header:
ucl_sia256.h

SIA-256 is a data-digest algorithm and a modified component of the Standard FIPS 180-2. The algorithm takes as input a data of arbitrary length and produces as output a 256-bit "fingerprint" or "data digest" of the input.

Given a data of any length, a single "1" bit is appended at the end of the data. This bit must always be added. Then, a set of "0" bits are also appended so that the data length is 448 modulo 512. Finally, the length of the data is appended.

SIA256 Descriptor:


Data Structure Documentation

◆ ucl_sia256_ctx

struct ucl_sia256_ctx

The SIA256 context. This structure is associated to the 'step by step' process.

Data Fields
u8 buffer[64]

Buffer.

u32 count[2]

Counter in bits.

u32 state[8]

Intermediate and then final hash.

Macro Definition Documentation

◆ UCL_SIA256

#define UCL_SIA256   0

Hash size. Byte size of the output of SIA256.

◆ UCL_SIA256_BLOCKSIZE

#define UCL_SIA256_BLOCKSIZE   64

Core block size. Byte size of a SIA256 core block.

◆ UCL_SIA256_HASHW32SIZE

#define UCL_SIA256_HASHW32SIZE   8

Hash size. 32-bits word size of the output of SIA256.

Typedef Documentation

◆ ucl_sia256_ctx_t

The SIA256 context.

Function Documentation

◆ ucl_sia256()

int __API__ ucl_sia256 ( u8 *  hash,
u8 *  data,
u32  data_byteLen 
)

SIA256. The complete process of SIA256.

Precondition
Hash byte length is equal to 32
Parameters
[out]hashPointer to the digest
[in]dataPointer to the data
[in]data_byteLenData byte length
Returns
Error code
Return values
UCL_OKif no error occurred
UCL_INVALID_OUTPUTif hash is #NULL

◆ ucl_sia256_core()

int __API__ ucl_sia256_core ( ucl_sia256_ctx_t context,
u8 *  data,
u32  data_byteLen 
)

SIA256 Core. The core of SIA256.

Parameters
[in,out]contextPointer to the context
[in]dataPointer to the data
[in]data_byteLenData byte length
Warning
ucl_sia256_init must be processed before, and ucl_sia256_finish should be processed to get the final hash.
Returns
Error code
Return values
UCL_OKif no error occurred
UCL_NOPif data_byteLen = 0 or if data is the pointer #NULL

◆ ucl_sia256_finish()

int __API__ ucl_sia256_finish ( u8 *  hash,
ucl_sia256_ctx_t context 
)

SIA256 Finish. Finish the process of SIA256.

Precondition
Hash byte length is equal to 32
Parameters
[out]hashPointer to the digest
[in,out]contextPointer to the context
Warning
ucl_sia256_init and ucl_sia256_core must be processed before.
Returns
Error code
Return values
UCL_OKif no error occurred
UCL_INVALID_OUTPUTif hash is the pointer #NULL
UCL_INVALID_INPUTif context is the pointer #NULL

◆ ucl_sia256_init()

int __API__ ucl_sia256_init ( ucl_sia256_ctx_t context)

SIA256 Init. The initialisation of SIA256.

Parameters
[in,out]contextPointer to the context
Returns
Error code
Return values
UCL_OKif no error occurred
UCL_INVALID_INPUTif context is #NULL