From 991f907d5bcb90643491184bc2ecd05a5b2f4e17 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 18 Feb 2009 21:25:14 +0000 Subject: [PATCH] [crypto] Rename aes_algorithm to aes_cbc_algorithm --- src/crypto/axtls_aes.c | 24 ++++++++++++------------ src/include/gpxe/aes.h | 2 +- src/net/tls.c | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/crypto/axtls_aes.c b/src/crypto/axtls_aes.c index ac7e921d..f36a230c 100644 --- a/src/crypto/axtls_aes.c +++ b/src/crypto/axtls_aes.c @@ -4,7 +4,7 @@ #include #include -static int aes_setkey ( void *ctx, const void *key, size_t keylen ) { +static int aes_cbc_setkey ( void *ctx, const void *key, size_t keylen ) { AES_CTX *aesctx = ctx; AES_MODE mode; @@ -23,32 +23,32 @@ static int aes_setkey ( void *ctx, const void *key, size_t keylen ) { return 0; } -static void aes_setiv ( void *ctx, const void *iv ) { +static void aes_cbc_setiv ( void *ctx, const void *iv ) { AES_CTX *aesctx = ctx; memcpy ( aesctx->iv, iv, sizeof ( aesctx->iv ) ); } -static void aes_encrypt ( void *ctx, const void *data, void *dst, - size_t len ) { +static void aes_cbc_encrypt ( void *ctx, const void *data, void *dst, + size_t len ) { AES_CTX *aesctx = ctx; AES_cbc_encrypt ( aesctx, data, dst, len ); } -static void aes_decrypt ( void *ctx, const void *data, void *dst, - size_t len ) { +static void aes_cbc_decrypt ( void *ctx, const void *data, void *dst, + size_t len ) { AES_CTX *aesctx = ctx; AES_cbc_decrypt ( aesctx, data, dst, len ); } -struct crypto_algorithm aes_algorithm = { - .name = "aes", +struct crypto_algorithm aes_cbc_algorithm = { + .name = "aes_cbc", .ctxsize = sizeof ( AES_CTX ), .blocksize = 16, - .setkey = aes_setkey, - .setiv = aes_setiv, - .encode = aes_encrypt, - .decode = aes_decrypt, + .setkey = aes_cbc_setkey, + .setiv = aes_cbc_setiv, + .encode = aes_cbc_encrypt, + .decode = aes_cbc_decrypt, }; diff --git a/src/include/gpxe/aes.h b/src/include/gpxe/aes.h index 75cb4c44..dd6e7734 100644 --- a/src/include/gpxe/aes.h +++ b/src/include/gpxe/aes.h @@ -3,6 +3,6 @@ struct crypto_algorithm; -extern struct crypto_algorithm aes_algorithm; +extern struct crypto_algorithm aes_cbc_algorithm; #endif /* _GPXE_AES_H */ diff --git a/src/net/tls.c b/src/net/tls.c index f5bff7a4..df872d42 100644 --- a/src/net/tls.c +++ b/src/net/tls.c @@ -486,12 +486,12 @@ static int tls_select_cipher ( struct tls_session *tls, switch ( cipher_suite ) { case htons ( TLS_RSA_WITH_AES_128_CBC_SHA ): key_len = ( 128 / 8 ); - cipher = &aes_algorithm; + cipher = &aes_cbc_algorithm; digest = &sha1_algorithm; break; case htons ( TLS_RSA_WITH_AES_256_CBC_SHA ): key_len = ( 256 / 8 ); - cipher = &aes_algorithm; + cipher = &aes_cbc_algorithm; digest = &sha1_algorithm; break; default: