-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathNIST.h
41 lines (31 loc) · 1.08 KB
/
NIST.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef NIST_H
#define NIST_H
#include "Arduino.h"
#include "inttypes.h"
#include "HMAC_type.h"
#define DEBUG 0
#define MEMORY_TEST 0
#define TIMING_TEST 0
class NIST
{
private:
HMAC_type hmac_algorithm;
int prfOutputSizeBit; // = h for NIST specifics
void (NIST::*init_prf) (uint8_t key[], int key_length);
uint8_t* (NIST::*prf) (uint8_t data[], int data_length);
//init PRF function
void init_prf_function (void);
//sha-1 functions
void init_hmacSha1PRF (uint8_t key[], int key_length);
uint8_t* hmacSha1PRF (uint8_t data[], int data_length);
//sha-256 functions
void init_hmacSha256PRF (uint8_t key[], int key_length);
uint8_t* hmacSha256PRF (uint8_t data[], int data_length);
//utilities
uint8_t* updateDataInput (uint8_t ctr, uint8_t* fixedInput, int fixedInput_length);
void printBits (uint8_t* hash, int bitsNumber);
public:
void initialize (HMAC_type algorithm_name);
uint8_t* KDFCounterMode (uint8_t* keyDerivationKey, int outputSizeBit, uint8_t* fixedInput, int keyDerivationKey_length, int fixedInput_length);
};
#endif