MeterLogger
aes.h
Go to the documentation of this file.
1 #ifndef _AES_H_
2 #define _AES_H_
3 
4 #include <esp8266.h>
5 #include <stdint.h>
6 
7 
8 // #define the macros below to 1/0 to enable/disable the mode of operation.
9 //
10 // CBC enables AES128 encryption in CBC-mode of operation and handles 0-padding.
11 // ECB enables the basic ECB 16-byte block algorithm. Both can be enabled simultaneously.
12 
13 // The #ifndef-guard allows it to be configured before #include'ing or at compile time.
14 #ifndef CBC
15  #define CBC 1
16 #endif
17 
18 #ifndef ECB
19  #define ECB 1
20 #endif
21 
22 
23 
24 #if defined(ECB) && ECB
25 
26 ICACHE_FLASH_ATTR void AES128_ECB_encrypt(const uint8_t* input, const uint8_t* key, uint8_t *output);
27 ICACHE_FLASH_ATTR void AES128_ECB_decrypt(const uint8_t* input, const uint8_t* key, uint8_t *output);
28 
29 #endif // #if defined(ECB) && ECB
30 
31 
32 #if defined(CBC) && CBC
33 
34 ICACHE_FLASH_ATTR void AES128_CBC_encrypt_buffer(uint8_t* output, uint8_t* input, uint32_t length, const uint8_t* key, uint8_t* iv);
35 ICACHE_FLASH_ATTR void AES128_CBC_decrypt_buffer(uint8_t* output, uint8_t* input, uint32_t length, const uint8_t* key, uint8_t* iv);
36 
37 #endif // #if defined(CBC) && CBC
38 
39 
40 
41 #endif //_AES_H_
#define ICACHE_FLASH_ATTR
Definition: c_types.h:99
ICACHE_FLASH_ATTR void AES128_CBC_decrypt_buffer(uint8_t *output, uint8_t *input, uint32_t length, const uint8_t *key, uint8_t *iv)
ICACHE_FLASH_ATTR void AES128_ECB_encrypt(const uint8_t *input, const uint8_t *key, uint8_t *output)
ICACHE_FLASH_ATTR void AES128_ECB_decrypt(const uint8_t *input, const uint8_t *key, uint8_t *output)
ICACHE_FLASH_ATTR void AES128_CBC_encrypt_buffer(uint8_t *output, uint8_t *input, uint32_t length, const uint8_t *key, uint8_t *iv)
static const char key[]
Definition: config.h:42