]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
aes: make apply_cbc_chain_data non-static
authorStephen Warren <swarren@nvidia.com>
Fri, 18 Apr 2014 16:28:58 +0000 (10:28 -0600)
committerTom Rini <trini@ti.com>
Fri, 18 Apr 2014 20:14:17 +0000 (16:14 -0400)
Tegra's crypto.c uses apply_cbc_chain_data() to sign the warm restart
code. This function was recently moved into the core aes.c and made
static, which prevents the Tegra code from compiling. Make it public
again to avoid the compile errors:

arch/arm/cpu/tegra20-common/crypto.c: In function ‘sign_object’:
arch/arm/cpu/tegra20-common/crypto.c:74:3: warning: implicit declaration of function ‘apply_cbc_chain_data’ [-Wimplicit-function-declaration]
arch/arm/cpu/built-in.o: In function `sign_object':
.../arch/arm/cpu/tegra20-common/crypto.c:74: undefined reference to `apply_cbc_chain_data'
.../arch/arm/cpu/tegra20-common/crypto.c:78: undefined reference to `apply_cbc_chain_data'

Fixes: 6e7b9f4fa0ae ("aes: Move the AES-128-CBC encryption function to common code")
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Marek Vasut <marex@denx.de>
arch/arm/cpu/tegra20-common/crypto.c
include/aes.h
lib/aes.c

index b18e67c3463e0a3989b8e55d864b0b0bda96be01..0967f3ed040e7855fbda87cc007e8864b648cb56 100644 (file)
@@ -74,11 +74,11 @@ static void sign_object(u8 *key, u8 *key_schedule, u8 *src, u8 *dst,
        /* compute the AES-CMAC value */
        for (i = 0; i < num_aes_blocks; i++) {
                /* Apply the chain data */
        /* compute the AES-CMAC value */
        for (i = 0; i < num_aes_blocks; i++) {
                /* 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);
 
                /* for the final block, XOR K1 into the IV */
                if (i == num_aes_blocks - 1)
 
                /* for the final block, XOR K1 into the IV */
                if (i == num_aes_blocks - 1)
-                       apply_cbc_chain_data(tmp_data, k1, tmp_data);
+                       aes_apply_cbc_chain_data(tmp_data, k1, tmp_data);
 
                /* encrypt the AES block */
                aes_encrypt(tmp_data, key_schedule, dst);
 
                /* encrypt the AES block */
                aes_encrypt(tmp_data, key_schedule, dst);
index ee0e6c275f13d4f6e2e79417f2dd08706d048773..6315c02aa93d9fc6a4cda3f52f4912c8ebe2e5a0 100644 (file)
@@ -60,6 +60,17 @@ void aes_encrypt(u8 *in, u8 *expkey, u8 *out);
  */
 void aes_decrypt(u8 *in, u8 *expkey, u8 *out);
 
  */
 void aes_decrypt(u8 *in, u8 *expkey, u8 *out);
 
+/**
+ * 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
+ */
+void aes_apply_cbc_chain_data(u8 *cbc_chain_data, u8 *src, u8 *dst);
+
 /**
  * aes_cbc_encrypt_blocks() - Encrypt multiple blocks of data with AES CBC.
  *
 /**
  * aes_cbc_encrypt_blocks() - Encrypt multiple blocks of data with AES CBC.
  *
index 05c97cd740982f38a57a069507494372adf28e96..9d7a0a1c11850ac76eda5e66715bbc18f534d87b 100644 (file)
--- a/lib/aes.c
+++ b/lib/aes.c
@@ -593,16 +593,7 @@ static void debug_print_vector(char *name, u32 num_bytes, u8 *data)
 #endif
 }
 
 #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;
 
 {
        int i;
 
@@ -623,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 */
                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 */
                debug_print_vector("AES Xor", AES_KEY_LENGTH, tmp_data);
 
                /* Encrypt the AES block */
@@ -655,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 */
                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. */
                debug_print_vector("AES Dst", AES_KEY_LENGTH, dst);
 
                /* Update pointers for next loop. */