X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=lib%2Faes.c;h=9d7a0a1c11850ac76eda5e66715bbc18f534d87b;hb=fc01daee8b8dc1ea486fcbea887224c8d1aca33b;hp=9dadb22c3ad9b6bb4e738b3b1e91bfd7db6fa846;hpb=dc24bb6ddb416db52a60165931c0864fdba1f60b;p=u-boot diff --git a/lib/aes.c b/lib/aes.c index 9dadb22c3a..9d7a0a1c11 100644 --- a/lib/aes.c +++ b/lib/aes.c @@ -22,7 +22,11 @@ * REDISTRIBUTION OF THIS SOFTWARE. */ +#ifndef USE_HOSTCC #include +#else +#include +#endif #include "aes.h" /* forward s-box */ @@ -589,16 +593,7 @@ static void debug_print_vector(char *name, u32 num_bytes, u8 *data) #endif } -/** - * Apply chain data to the destination using EOR - * - * Each array is of length AES_KEY_LENGTH. - * - * @cbc_chain_data Chain data - * @src Source data - * @dst Destination data, which is modified here - */ -static void apply_cbc_chain_data(u8 *cbc_chain_data, u8 *src, u8 *dst) +void aes_apply_cbc_chain_data(u8 *cbc_chain_data, u8 *src, u8 *dst) { int i; @@ -619,7 +614,7 @@ void aes_cbc_encrypt_blocks(u8 *key_exp, u8 *src, u8 *dst, u32 num_aes_blocks) debug_print_vector("AES Src", AES_KEY_LENGTH, src); /* Apply the chain data */ - apply_cbc_chain_data(cbc_chain_data, src, tmp_data); + aes_apply_cbc_chain_data(cbc_chain_data, src, tmp_data); debug_print_vector("AES Xor", AES_KEY_LENGTH, tmp_data); /* Encrypt the AES block */ @@ -651,7 +646,7 @@ void aes_cbc_decrypt_blocks(u8 *key_exp, u8 *src, u8 *dst, u32 num_aes_blocks) debug_print_vector("AES Xor", AES_KEY_LENGTH, tmp_data); /* Apply the chain data */ - apply_cbc_chain_data(cbc_chain_data, tmp_data, dst); + aes_apply_cbc_chain_data(cbc_chain_data, tmp_data, dst); debug_print_vector("AES Dst", AES_KEY_LENGTH, dst); /* Update pointers for next loop. */