-
Notifications
You must be signed in to change notification settings - Fork 0
/
SAES.h
55 lines (42 loc) · 1.88 KB
/
SAES.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**********************************************************************
* SAES.h
*
* Simplified AES Header file
*
* Created on: Nov 18, 2023
*
* Author: Mostafa Mahmoud
**********************************************************************/
#ifndef _SAES_H_
#define _SAES_H_
#include "my_types.h"
/***********************************************************************************************
*************************************** Symbol definitions **************************************
************************************************************************************************/
#define GF_MUL_PRECOMPUTED_TERM 0x03
/***********************************************************************************************
*********************************** SAES Function Prototypes **********************************
************************************************************************************************/
/******************* SAES Encryption Functions Prototypes **********************/
uint16 SAES_Encryption(uint16 plaintext, uint16 Key);
void SAES_MixColumns();
void SAES_ShiftRow();
void SAES_SubstituteNibbles();
/******************* SAES Decryption Functions Prototypes **********************/
uint16 SAES_Decryption(uint16 plaintext, uint16 Key);
void SAES_InverseMixColumns();
void SAES_InverseShiftRow();
void SAES_InverseSubstituteNibbles();
/******************* SAES Common Functions Prototypes ***************************/
uint16 SAES_AddRoundKey(uint16 data, uint16 roundKey);
// Key Expansion
void SAES_ExpandKey(uint16 originalKey);
uint8 KE_SubNibble(uint8 value);
uint8 RotNibble(uint8 value);
// State Matrix
uint16 SAES_ConvertStateMatrixToData(uint8 State[][2]);
void SAES_UpdateStateMatrix(uint8 State[][2], uint16 data);
void printStateMatrix(uint8 state[][2]);
// GF(2^4) Multiplication
uint8 GF_MultiplyBy(uint8 data, uint8 mulValue);
#endif /* _SAES_H_ */