1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2019, Softathome
12 DECLARE_GLOBAL_DATA_PTR;
13 #endif /* !USE_HOSTCC*/
15 #include <uboot_aes.h>
16 #include <u-boot/aes.h>
18 struct cipher_algo cipher_algos[] = {
21 .key_len = AES128_KEY_LENGTH,
22 .iv_len = AES_BLOCK_LENGTH,
23 #if IMAGE_ENABLE_ENCRYPT
24 .calculate_type = EVP_aes_128_cbc,
26 .encrypt = image_aes_encrypt,
27 .add_cipher_data = image_aes_add_cipher_data
31 .key_len = AES192_KEY_LENGTH,
32 .iv_len = AES_BLOCK_LENGTH,
33 #if IMAGE_ENABLE_ENCRYPT
34 .calculate_type = EVP_aes_192_cbc,
36 .encrypt = image_aes_encrypt,
37 .add_cipher_data = image_aes_add_cipher_data
41 .key_len = AES256_KEY_LENGTH,
42 .iv_len = AES_BLOCK_LENGTH,
43 #if IMAGE_ENABLE_ENCRYPT
44 .calculate_type = EVP_aes_256_cbc,
46 .encrypt = image_aes_encrypt,
47 .add_cipher_data = image_aes_add_cipher_data
51 struct cipher_algo *image_get_cipher_algo(const char *full_name)
56 for (i = 0; i < ARRAY_SIZE(cipher_algos); i++) {
57 name = cipher_algos[i].name;
58 if (!strncmp(name, full_name, strlen(name)))
59 return &cipher_algos[i];