Always gather MBEDTLS_ENTROPY_BLOCK_SIZE bytes of entropy #293

Merged
gilles-peskine-arm merged 7 commits from entropy-min into development 2019-11-26 11:43:46 -06:00
gilles-peskine-arm commented 2019-10-09 06:57:50 -05:00 (Migrated from github.com)

Enforce that mbedtls_entropy_func gathers a total of MBEDTLS_ENTROPY_BLOCK_SIZE bytes or more from strong sources. In particular, in the default configuration, on a platform with a single entropy source, mbedtls_entropy_func will now grab 64 bytes from that source (due to the new lower bound of MBEDTLS_ENTROPY_BLOCK_SIZE), whereas it formerly only grabbed 32 bytes (due to the per-source threshold).

Backports: no — this is a security improvement but not a critical fix (32 bytes is enough if the entropy is of good quality) and it could be a problem on platforms where gathering more entropy would take an unacceptable amount of time.

Internal ref: IOTCRYPT-454

Enforce that `mbedtls_entropy_func` gathers a total of `MBEDTLS_ENTROPY_BLOCK_SIZE` bytes or more from strong sources. In particular, in the default configuration, on a platform with a single entropy source, `mbedtls_entropy_func` will now grab 64 bytes from that source (due to the new lower bound of `MBEDTLS_ENTROPY_BLOCK_SIZE`), whereas it formerly only grabbed 32 bytes (due to the per-source threshold). Backports: no — this is a security improvement but not a critical fix (32 bytes is enough if the entropy is of good quality) and it could be a problem on platforms where gathering more entropy would take an unacceptable amount of time. Internal ref: IOTCRYPT-454
k-stachowiak (Migrated from github.com) reviewed 2019-10-29 04:15:36 -05:00
AndrzejKurek (Migrated from github.com) reviewed 2019-11-25 07:49:02 -06:00
AndrzejKurek (Migrated from github.com) commented 2019-11-25 07:49:02 -06:00

Is it possible to reach ENTROPY_MAX_LOOP here if ctx->source[i].strong == MBEDTLS_ENTROPY_SOURCE_STRONG is false? There's no way to increase strong_size in such case.

Is it possible to reach `ENTROPY_MAX_LOOP` here if `ctx->source[i].strong == MBEDTLS_ENTROPY_SOURCE_STRONG ` is `false`? There's no way to increase `strong_size` in such case.
gilles-peskine-arm (Migrated from github.com) reviewed 2019-11-25 08:02:11 -06:00
gilles-peskine-arm (Migrated from github.com) commented 2019-11-25 08:02:10 -06:00

Yes, but only if there is no strong source. And in this case the call to entropy_gather_internal would have returned MBEDTLS_ERR_ENTROPY_NO_STRONG_SOURCE.

Yes, but only if there is no strong source. And in this case the call to `entropy_gather_internal` would have returned `MBEDTLS_ERR_ENTROPY_NO_STRONG_SOURCE`.
gilles-peskine-arm commented 2019-11-25 08:04:18 -06:00 (Migrated from github.com)

The CI failures are not just due to unrelated problems that plagued the CI for the past few months. I'm investigating.

The CI failures are not just due to unrelated problems that plagued the CI for the past few months. I'm investigating.
AndrzejKurek commented 2019-11-26 06:19:36 -06:00 (Migrated from github.com)

The CI seems to still be failing in strange ways. Are these fails related to the PR?

The CI seems to still be failing in strange ways. Are these fails related to the PR?
gilles-peskine-arm commented 2019-11-26 06:22:53 -06:00 (Migrated from github.com)

I think many jobs are failing on -head because it's an old branch that's broken on some boards and incompatible with the current version in mbedtls. Since -merge is passing, the CI is ok.

I think many jobs are failing on -head because it's an old branch that's broken on some boards and incompatible with the current version in mbedtls. Since -merge is passing, the CI is ok.
AndrzejKurek (Migrated from github.com) approved these changes 2019-11-26 07:36:53 -06:00
dgreen-arm (Migrated from github.com) approved these changes 2019-11-26 10:18:19 -06:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-ARMmbed/mbed-crypto!293
No description provided.