Skip to content

mbedtls_sha3_finish documentation inconsistent with implementation #10844

Description

@ZaixingLaw

Summary

The documentation of mbedtls_sha3_finish() states that for SHA3-224/256/384/512,
the parameter olen must equal 28/32/48/64 respectively, otherwise the function
should return an error.

However, the current implementation only returns an error if olen is smaller
than the digest size. If olen is larger, it silently adjusts olen to the
digest size and continues, instead of returning an error.

This behavior is inconsistent with the header file description. Either the
documentation should be updated to reflect the actual behavior, or the
implementation should be fixed to match the documented contract.

System information

Mbed TLS version (3.6.5):

Metadata

Metadata

Assignees

No one assigned

    Labels

    component-cryptoCrypto primitives and low-level interfacesenhancementgood-first-issueGood for newcomersresolved-after-3.6The issue is resolved in 4.1 onwards, but still present in 3.6 LTS.size-xsEstimated task size: extra small (a few hours at most)

    Type

    No type

    Projects

    Status
    Incoming

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions