]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
docs: Fix and add documentation about AES-WRAP-PAD ciphers out parameter
authorJoshua Rogers <MegaManSec@users.noreply.github.com>
Tue, 31 Mar 2026 16:28:34 +0000 (00:28 +0800)
committerNikola Pajkovsky <nikolap@openssl.org>
Wed, 22 Apr 2026 08:13:27 +0000 (10:13 +0200)
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Apr 22 08:13:31 2026
(Merged from https://github.com/openssl/openssl/pull/30653)

crypto/modes/wrap128.c
doc/man3/EVP_EncryptInit.pod
doc/man7/EVP_CIPHER-AES.pod

index 9dbb6401296588d16bf55777680bfbe056848350..c06a5490febfe25892d99fa298e3bc14df2ce412 100644 (file)
@@ -178,7 +178,9 @@ size_t CRYPTO_128_unwrap(void *key, const unsigned char *iv,
  *
  *  @param[in]  key    Key value.
  *  @param[in]  icv    (Non-standard) IV, 4 bytes. NULL = use default_aiv.
- *  @param[out] out    Ciphertext. Minimal buffer length = (inlen + 15) bytes.
+ *  @param[out] out    Ciphertext. Minimal buffer length =
+ *                     (inlen rounded up to 8 + 8) bytes, i.e.
+ *                     ((inlen + 7) / 8) * 8 + 8.
  *                     Input and output buffers can overlap if block function
  *                     supports that.
  *  @param[in]  in     Plaintext as n 64-bit blocks, n >= 2.
index 8c57d756ce66f5375c8c312bb97121ebb9d5765a..ee438947aba05dec4b682f8b24f695aed988393d 100644 (file)
@@ -417,7 +417,8 @@ encrypted data.
 For most ciphers and modes, the amount of data written can be anything
 from zero bytes to (inl + cipher_block_size - 1) bytes.
 For wrap cipher modes, the amount of data written can be anything
-from zero bytes to (inl + cipher_block_size) bytes.
+from zero bytes to (inl rounded up to cipher_block_size + cipher_block_size)
+bytes.
 For stream ciphers, the amount of data written can be anything from zero
 bytes to inl bytes.
 Thus, the buffer pointed to by I<out> must contain sufficient room for the
index 7bd3746c9ba2787bb43ae93c1195b90c06289b1b..6da3f96a2da508a9ff6f07c61a9e303364c0c73a 100644 (file)
@@ -69,6 +69,10 @@ The AES-SIV and AES-WRAP mode implementations do not support streaming. That
 means to obtain correct results there can be only one L<EVP_EncryptUpdate(3)>
 or L<EVP_DecryptUpdate(3)> call after the initialization of the context.
 
+When wrapping with AES-WRAP-PAD ciphers, the output buffer must be at least
+I<inl> rounded up to the cipher block size (8 bytes) plus the block size.
+That is, the minimum output buffer size is C<((inl + 7) / 8) * 8 + 8> bytes.
+
 The AES-XTS implementations allow streaming to be performed, but each
 L<EVP_EncryptUpdate(3)> or L<EVP_DecryptUpdate(3)> call requires each input
 to be a multiple of the blocksize. Only the final EVP_EncryptUpdate() or