]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[crypto] Fix stray references to AES
authorMichael Brown <mcb30@ipxe.org>
Fri, 2 Feb 2024 17:09:06 +0000 (17:09 +0000)
committerMichael Brown <mcb30@ipxe.org>
Fri, 2 Feb 2024 17:09:06 +0000 (17:09 +0000)
The CBC_CIPHER() macro contains some accidentally hardcoded references
to an underlying AES cipher, instead of using the cipher specified in
the macro parameters.

Fix by using the macro parameter as required.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/include/ipxe/cbc.h

index 382fc9036c1631b77c26bda64cfe311f3d2108ca..f02e51937718762d68c0a1f11a6c1d49a981131d 100644 (file)
@@ -77,19 +77,19 @@ static void _cbc_name ## _setiv ( void *ctx, const void *iv,                \
                                   size_t ivlen ) {                     \
        struct _cbc_name ## _context * _cbc_name ## _ctx = ctx;         \
        cbc_setiv ( &_cbc_name ## _ctx->raw_ctx, iv, ivlen,             \
-                   &_raw_cipher, &aes_cbc_ctx->cbc_ctx );              \
+                   &_raw_cipher, &_cbc_name ## _ctx->cbc_ctx );        \
 }                                                                      \
 static void _cbc_name ## _encrypt ( void *ctx, const void *src,                \
                                    void *dst, size_t len ) {           \
        struct _cbc_name ## _context * _cbc_name ## _ctx = ctx;         \
        cbc_encrypt ( &_cbc_name ## _ctx->raw_ctx, src, dst, len,       \
-                     &_raw_cipher, &aes_cbc_ctx->cbc_ctx );            \
+                     &_raw_cipher, &_cbc_name ## _ctx->cbc_ctx );      \
 }                                                                      \
 static void _cbc_name ## _decrypt ( void *ctx, const void *src,                \
                                    void *dst, size_t len ) {           \
        struct _cbc_name ## _context * _cbc_name ## _ctx = ctx;         \
        cbc_decrypt ( &_cbc_name ## _ctx->raw_ctx, src, dst, len,       \
-                     &_raw_cipher, &aes_cbc_ctx->cbc_ctx );            \
+                     &_raw_cipher, &_cbc_name ## _ctx->cbc_ctx );      \
 }                                                                      \
 struct cipher_algorithm _cbc_cipher = {                                        \
        .name           = #_cbc_name,                                   \