Skip to content

Commit 874f087

Browse files
committed
Fix inconsistent docs for mbedtls_sha3_finish and mbedtls_sha3 olen
Change the documentation of mbedtls_sha3_finish() and mbedtls_sha3() to state that olen must be at least the digest size (28, 32, 48, or 64 for SHA3-224/256/384/512) rather than must equal it. The implementation accepts olen larger than the digest size — it silently writes the digest and ignores the excess. The previous docs incorrectly suggested that olen larger than the digest size would be an error. Fixes #10844 Signed-off-by: AaryanCdry <AaryanCdry@users.noreply.github.com>
1 parent f4a1ace commit 874f087

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

include/mbedtls/sha3.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ int mbedtls_sha3_update(mbedtls_sha3_context *ctx,
118118
* \param output The SHA-3 checksum result.
119119
* This must be a writable buffer of length \c olen bytes.
120120
* \param olen Defines the length of output buffer (in bytes). For SHA-3 224, SHA-3 256,
121-
* SHA-3 384 and SHA-3 512 \c olen must equal to 28, 32, 48 and 64,
121+
* SHA-3 384 and SHA-3 512 \c olen must be at least 28, 32, 48 and 64,
122122
* respectively.
123123
*
124124
* \return \c 0 on success.
@@ -144,7 +144,7 @@ int mbedtls_sha3_finish(mbedtls_sha3_context *ctx,
144144
* \param output The SHA-3 checksum result.
145145
* This must be a writable buffer of length \c olen bytes.
146146
* \param olen Defines the length of output buffer (in bytes). For SHA-3 224, SHA-3 256,
147-
* SHA-3 384 and SHA-3 512 \c olen must equal to 28, 32, 48 and 64,
147+
* SHA-3 384 and SHA-3 512 \c olen must be at least 28, 32, 48 and 64,
148148
* respectively.
149149
*
150150
* \return \c 0 on success.

0 commit comments

Comments
 (0)