Rtos API example

Embed: (wiki syntax)

« Back to documentation index

shalib.h File Reference

shalib.h File Reference

SHA256 Library API. More...

Go to the source code of this file.

Data Structures

struct  prf_sec_param_t
 PRF 256 stucture This structure is used to configure PRF calc operation: secret, label, seed and buffer before call shalib_prf_calc(). More...

Functions

void SHALIB_init_HMAC (const uint8_t *secret, uint8_t sec_len)
 Init HMAC256 operation by given security material.
void SHALIB_push_data_HMAC (const void *data, uint16_t len)
 Push data for HMAC.
void SHALIB_finish_HMAC (void *buffer, uint8_t nwords)
 Finish HMAC256 operation and save result in given buffer.
prf_sec_param_tshalib_prf_param_get (void)
 PRF API.
void shalib_prf_calc (void *output, uint_fast16_t nwords)
 Finish PRF256 operation and save result in given buffer.

Detailed Description

SHA256 Library API.

HMAC256 process sequence:

1. SHALIB_init_HMAC(), Init HMAC IN process by given security signature material 2. SHALIB_push_data_HMAC(), Give data sectors(s) one by one 3. SHALIB_finish_HMAC(), Finish HMAC and save SHA256 hash to given buffer

PRF256 process sequence:

1. shalib_prf_param_get(), Init PRF and get configure structure 2. Set the following parameters to configure structure:

  • HMAC security signature pointer and length
  • Label text
  • Seed data and length 3. shalib_prf_calc(), Calc PRF256 HASH

Definition in file shalib.h.


Function Documentation

void SHALIB_finish_HMAC ( void *  buffer,
uint8_t  nwords 
)

Finish HMAC256 operation and save result in given buffer.

Parameters:
bufferA pointer to result buffer.
nwordsLength of 32-bit register to save to buffer (8= 256 bit and 4= 128-bit).
void SHALIB_init_HMAC ( const uint8_t *  secret,
uint8_t  sec_len 
)

Init HMAC256 operation by given security material.

Parameters:
secretA pointer to security material.
sec_lenLength of security material.
void shalib_prf_calc ( void *  output,
uint_fast16_t  nwords 
)

Finish PRF256 operation and save result in given buffer.

prf_sec_param_t* shalib_prf_param_get ( void   )

PRF API.

Init PRF library and SHA registers. This function returns configure structure where the user needs to set the following items: -Security material and length -Label text and length -Seed data and length

Returns:
A pointer to PRF configure structure.
void SHALIB_push_data_HMAC ( const void *  data,
uint16_t  len 
)

Push data for HMAC.

Parameters:
dataA pointer to data.
lenLength of data.