Skip to content

Conversation

@gilles-peskine-arm
Copy link
Contributor

Follow-up of #2894.

Partial backport of ARMmbed/mbed-crypto#305.

mbedtls_hmac_drbg_seed() always set the entropy length to the default,
so a call to mbedtls_hmac_drbg_set_entropy_len() before seed() had no
effect. Change this to the more intuitive behavior that
set_entropy_len() sets the entropy length and seed() respects that and
only uses the default entropy length if there was no call to
set_entropy_len().
Move the definitions of mbedtls_ctr_drbg_seed_entropy_len() and
mbedtls_ctr_drbg_seed() to after they are used. This makes the code
easier to read and to maintain.
mbedtls_ctr_drbg_seed() always set the entropy length to the default,
so a call to mbedtls_ctr_drbg_set_entropy_len() before seed() had no
effect. Change this to the more intuitive behavior that
set_entropy_len() sets the entropy length and seed() respects that and
only uses the default entropy length if there was no call to
set_entropy_len().

The former test-only function mbedtls_ctr_drbg_seed_entropy_len() is
no longer used, but keep it for strict ABI compatibility.
Remove a comment that documented a now-removed restriction.
@gilles-peskine-arm gilles-peskine-arm added bug mbed TLS team needs-review Every commit must be reviewed by at least two team members, component-crypto Crypto primitives and low-level interfaces labels Oct 23, 2019
@gilles-peskine-arm
Copy link
Contributor Author

Oh, the original PR isn't merged yet. So I'll modify the original PR.

@gilles-peskine-arm gilles-peskine-arm deleted the drbg-set_entropy_len-doc_cleanup-2.16 branch October 23, 2019 15:51
@gilles-peskine-arm gilles-peskine-arm restored the drbg-set_entropy_len-doc_cleanup-2.16 branch October 23, 2019 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug component-crypto Crypto primitives and low-level interfaces needs-review Every commit must be reviewed by at least two team members,

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant