* [U-Boot] [PATCH] aes: make apply_cbc_chain_data non-static
@ 2014-04-18 16:28 Stephen Warren
2014-04-18 17:11 ` Simon Glass
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Stephen Warren @ 2014-04-18 16:28 UTC (permalink / raw)
To: u-boot
From: Stephen Warren <swarren@nvidia.com>
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>
---
arch/arm/cpu/tegra20-common/crypto.c | 4 ++--
include/aes.h | 11 +++++++++++
lib/aes.c | 15 +++------------
3 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/arch/arm/cpu/tegra20-common/crypto.c b/arch/arm/cpu/tegra20-common/crypto.c
index 13824256874f..ec95d7ceb15d 100644
--- a/arch/arm/cpu/tegra20-common/crypto.c
+++ b/arch/arm/cpu/tegra20-common/crypto.c
@@ -71,11 +71,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 */
- 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)
- 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);
diff --git a/include/aes.h b/include/aes.h
index ee0e6c275f13..6315c02aa93d 100644
--- a/include/aes.h
+++ b/include/aes.h
@@ -61,6 +61,17 @@ void aes_encrypt(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.
*
* @key_exp Expanded key to use
diff --git a/lib/aes.c b/lib/aes.c
index 05c97cd74098..9d7a0a1c1185 100644
--- 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
}
-/**
- * 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;
@@ -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 */
- 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 */
@@ -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 */
- 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. */
--
1.8.1.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] aes: make apply_cbc_chain_data non-static
2014-04-18 16:28 [U-Boot] [PATCH] aes: make apply_cbc_chain_data non-static Stephen Warren
@ 2014-04-18 17:11 ` Simon Glass
2014-04-18 17:27 ` Marek Vasut
2014-04-18 21:00 ` [U-Boot] " Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2014-04-18 17:11 UTC (permalink / raw)
To: u-boot
On 18 April 2014 10:28, Stephen Warren <swarren@wwwdotorg.org> wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> 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>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] aes: make apply_cbc_chain_data non-static
2014-04-18 16:28 [U-Boot] [PATCH] aes: make apply_cbc_chain_data non-static Stephen Warren
2014-04-18 17:11 ` Simon Glass
@ 2014-04-18 17:27 ` Marek Vasut
2014-04-18 21:00 ` [U-Boot] " Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2014-04-18 17:27 UTC (permalink / raw)
To: u-boot
On Friday, April 18, 2014 at 06:28:58 PM, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> 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>
Acked-by: Marek Vasut <marex@denx.de>
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] aes: make apply_cbc_chain_data non-static
2014-04-18 16:28 [U-Boot] [PATCH] aes: make apply_cbc_chain_data non-static Stephen Warren
2014-04-18 17:11 ` Simon Glass
2014-04-18 17:27 ` Marek Vasut
@ 2014-04-18 21:00 ` Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2014-04-18 21:00 UTC (permalink / raw)
To: u-boot
On Fri, Apr 18, 2014 at 10:28:58AM -0600, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> 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>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140418/09a5324f/attachment.pgp>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-04-18 21:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-18 16:28 [U-Boot] [PATCH] aes: make apply_cbc_chain_data non-static Stephen Warren
2014-04-18 17:11 ` Simon Glass
2014-04-18 17:27 ` Marek Vasut
2014-04-18 21:00 ` [U-Boot] " Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox