| Rev | Line | |
|---|
| [1] | 1 | #ifndef _AES_H_
|
|---|
| 2 | #define _AES_H_
|
|---|
| 3 |
|
|---|
| 4 | #include <stdint.h>
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 | // #define the macros below to 1/0 to enable/disable the mode of operation.
|
|---|
| 8 | //
|
|---|
| 9 | // CBC enables AES128 encryption in CBC-mode of operation and handles 0-padding.
|
|---|
| 10 | // ECB enables the basic ECB 16-byte block algorithm. Both can be enabled simultaneously.
|
|---|
| 11 |
|
|---|
| 12 | // The #ifndef-guard allows it to be configured before #include'ing or at compile time.
|
|---|
| 13 | #ifndef CBC
|
|---|
| 14 | #define CBC 1
|
|---|
| 15 | #endif
|
|---|
| 16 |
|
|---|
| 17 | #ifndef ECB
|
|---|
| 18 | #define ECB 1
|
|---|
| 19 | #endif
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 | #if defined(ECB) && ECB
|
|---|
| 24 |
|
|---|
| 25 | void AES128_ECB_encrypt(uint8_t* input, const uint8_t* key, uint8_t *output);
|
|---|
| 26 | void AES128_ECB_decrypt(uint8_t* input, const uint8_t* key, uint8_t *output);
|
|---|
| 27 |
|
|---|
| 28 | #endif // #if defined(ECB) && ECB
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 | #if defined(CBC) && CBC
|
|---|
| 32 |
|
|---|
| 33 | void AES128_CBC_encrypt_buffer(uint8_t* output, uint8_t* input, uint32_t length, const uint8_t* key, const uint8_t* iv);
|
|---|
| 34 | void AES128_CBC_decrypt_buffer(uint8_t* output, uint8_t* input, uint32_t length, const uint8_t* key, const uint8_t* iv);
|
|---|
| 35 |
|
|---|
| 36 | #endif // #if defined(CBC) && CBC
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 | #endif //_AES_H_
|
|---|
| 41 | void phex(uint8_t* str, int num);
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.