]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[crypto] Add confidentiality flag for cipher algorithms master
authorMichael Brown <mcb30@ipxe.org>
Wed, 29 Jul 2026 16:41:45 +0000 (17:41 +0100)
committerMichael Brown <mcb30@ipxe.org>
Wed, 29 Jul 2026 16:45:43 +0000 (17:45 +0100)
Add a flag that indicates whether or not a cipher is capable of
providing confidentiality.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/crypto/aes.c
src/crypto/arc4.c
src/crypto/crypto_null.c
src/crypto/des.c
src/include/ipxe/cbc.h
src/include/ipxe/crypto.h
src/include/ipxe/ecb.h
src/include/ipxe/gcm.h
src/tests/cipher_test.c

index c9836147426234f42ffab806457ead1c86ebeedc..c68ed34d017e3cf7abf54c4eff47c49f0f81476f 100644 (file)
@@ -793,6 +793,7 @@ struct cipher_algorithm aes_algorithm = {
        .blocksize = AES_BLOCKSIZE,
        .alignsize = 0,
        .authsize = 0,
+       .confidential = 1,
        .setkey = aes_setkey,
        .setiv = cipher_null_setiv,
        .encrypt = aes_encrypt,
index 2866688eb8d10e1551b379c6c284657688ed34ae..384fd4b5b37dd1417a27682a3ee327b6b66f500f 100644 (file)
@@ -126,6 +126,7 @@ struct cipher_algorithm arc4_algorithm = {
        .blocksize = 1,
        .alignsize = 1,
        .authsize = 0,
+       .confidential = 1,
        .setkey = arc4_setkey,
        .setiv = cipher_null_setiv,
        .encrypt = arc4_xor,
index d0f6a1a99ce964c94a3dfce102930d2d5f2d8aeb..c3a1edd99975b79b39c2dcb1b237c747175848c4 100644 (file)
@@ -97,6 +97,7 @@ struct cipher_algorithm cipher_null = {
        .blocksize = 1,
        .alignsize = 1,
        .authsize = 0,
+       .confidential = 0,
        .setkey = cipher_null_setkey,
        .setiv = cipher_null_setiv,
        .encrypt = cipher_null_encrypt,
index 938643e1becbbc7e654e2c06cae07bc068fcac9a..685c417bb0841cab72204c7a78492e98f56dbab9 100644 (file)
@@ -687,6 +687,7 @@ struct cipher_algorithm des_algorithm = {
        .blocksize = DES_BLOCKSIZE,
        .alignsize = 0,
        .authsize = 0,
+       .confidential = 1,
        .setkey = des_setkey,
        .setiv = cipher_null_setiv,
        .encrypt = des_encrypt,
index ddc9c5986f19c03d6766e7251dceb262679aa76d..b980169cdc0cf59d96bdfc9b737917113b476a4e 100644 (file)
@@ -45,6 +45,7 @@ struct cipher_algorithm _cbc_cipher = {                                       \
        .blocksize      = _blocksize,                                   \
        .alignsize      = _blocksize,                                   \
        .authsize       = 0,                                            \
+       .confidential   = 1,                                            \
        .setkey         = cbc_setkey,                                   \
        .setiv          = cbc_setiv,                                    \
        .encrypt        = cbc_encrypt,                                  \
index 72f4b73763adf853d8c092de0e06a31770638fbe..d9d75864308d175332253af694b866cb77db9f4e 100644 (file)
@@ -80,6 +80,8 @@ struct cipher_algorithm {
        size_t alignsize;
        /** Authentication tag size */
        size_t authsize;
+       /** Cipher is capable of providing confidentiality */
+       int confidential;
        /** Set key
         *
         * @v cipher    Cipher algorithm
index 791ab067c65db69c71d3f926220f077d7dd576f0..20090bd68167e014574dd91740800e8c36492a47 100644 (file)
@@ -36,6 +36,7 @@ struct cipher_algorithm _ecb_cipher = {                                       \
        .blocksize      = _blocksize,                                   \
        .alignsize      = _blocksize,                                   \
        .authsize       = 0,                                            \
+       .confidential   = 1,                                            \
        .setkey         = ecb_setkey,                                   \
        .setiv          = cipher_null_setiv,                            \
        .encrypt        = ecb_encrypt,                                  \
index 9976a4d82bb06c925e7dc9e39dff4b86ff7b1a81..ac60deb53c96ce0fbed4bd6d27b8dd03f299d54e 100644 (file)
@@ -95,6 +95,7 @@ struct cipher_algorithm _gcm_cipher = {                                       \
        .blocksize      = 1,                                            \
        .alignsize      = sizeof ( union gcm_block ),                   \
        .authsize       = sizeof ( union gcm_block ),                   \
+       .confidential   = 1,                                            \
        .setkey         = gcm_setkey,                                   \
        .setiv          = gcm_setiv,                                    \
        .encrypt        = gcm_encrypt,                                  \
index 68108cef6188286626457d05c771b0f1668ab484..f875032148b6e0b0782c58c44067eb11345e59a0 100644 (file)
@@ -182,6 +182,7 @@ void cipher_okx ( struct cipher_test *test, const char *file,
        okx ( cipher->blocksize != 0, file, line );
        okx ( ( len % cipher->blocksize ) == 0, file, line );
        okx ( ( cipher->alignsize % cipher->blocksize ) == 0, file, line );
+       okx ( cipher->confidential, file, line );
 
        /* Report encryption test result */
        cipher_encrypt_okx ( test, file, line );