diff options
author | Michael Brown <mcb30@ipxe.org> | 2022-10-28 13:06:11 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2022-11-07 11:19:48 +0000 |
commit | d1bc872a2e3b682169da4dd708dfe143d539eaaf (patch) | |
tree | 95d62a5594b24d3f337df1c9eccf4fa40b1de1fc /src/include/ipxe/tls.h | |
parent | f8565a655eacc53319962c002a38cfd0340d0b81 (diff) | |
download | ipxe-d1bc872a2e3b682169da4dd708dfe143d539eaaf.tar.gz |
[tls] Formalise notions of fixed and record initialisation vectors
TLS block ciphers always use CBC (as per RFC 5246 section 6.2.3.2)
with a record initialisation vector length that is equal to the cipher
block size, and no fixed initialisation vector.
The initialisation vector for AEAD ciphers such as GCM is less
straightforward, and requires both a fixed and per-record component.
Extend the definition of a cipher suite to include fixed and record
initialisation vector lengths, and generate the fixed portion (if any)
as part of key expansion.
Do not add explicit calls to cipher_setiv() in tls_assemble_block()
and tls_split_block(), since the constraints imposed by RFC 5246 are
specifically chosen to allow implementations to avoid doing so.
(Instead, add a sanity check that the record initialisation vector
length is equal to the cipher block size.)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/tls.h')
-rw-r--r-- | src/include/ipxe/tls.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/include/ipxe/tls.h b/src/include/ipxe/tls.h index 0b34dee7c..8bb1ccceb 100644 --- a/src/include/ipxe/tls.h +++ b/src/include/ipxe/tls.h @@ -169,10 +169,14 @@ struct tls_cipher_suite { struct cipher_algorithm *cipher; /** MAC digest algorithm */ struct digest_algorithm *digest; - /** Key length */ - uint16_t key_len; /** Numeric code (in network-endian order) */ uint16_t code; + /** Key length */ + uint8_t key_len; + /** Fixed initialisation vector length */ + uint8_t fixed_iv_len; + /** Record initialisation vector length */ + uint8_t record_iv_len; }; /** TLS cipher suite table */ @@ -195,6 +199,8 @@ struct tls_cipherspec { void *cipher_ctx; /** MAC secret */ void *mac_secret; + /** Fixed initialisation vector */ + void *fixed_iv; }; /** A TLS signature and hash algorithm identifier */ |