1 // Copyright 2020 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 #pragma once 15 16 /* padlock.c and aesni.c rely on these values! */ 17 #define ESP_AES_ENCRYPT 1 18 #define ESP_AES_DECRYPT 0 19 20 21 /* DMA AES working modes*/ 22 typedef enum { 23 ESP_AES_BLOCK_MODE_ECB = 0, 24 ESP_AES_BLOCK_MODE_CBC, 25 ESP_AES_BLOCK_MODE_OFB, 26 ESP_AES_BLOCK_MODE_CTR, 27 ESP_AES_BLOCK_MODE_CFB8, 28 ESP_AES_BLOCK_MODE_CFB128, 29 ESP_AES_BLOCK_MODE_GCM, 30 ESP_AES_BLOCK_MODE_MAX, 31 } esp_aes_mode_t; 32 33 /* Number of bytes in an AES block */ 34 #define AES_BLOCK_BYTES (16) 35 /* Number of words in an AES block */ 36 #define AES_BLOCK_WORDS (4) 37 /* Number of bytes in an IV */ 38 #define IV_BYTES (16) 39 /* Number of words in an IV */ 40 #define IV_WORDS (4) 41 /* Number of bytes in a GCM tag block */ 42 #define TAG_BYTES (16) 43 /* Number of words in a GCM tag block */ 44 #define TAG_WORDS (4) 45 46 #define AES_128_KEY_BYTES (128/8) 47 #define AES_192_KEY_BYTES (192/8) 48 #define AES_256_KEY_BYTES (256/8) 49