Fix pk_write with EC key to use a constant size for the private value #314

Merged
gilles-peskine-arm merged 2 commits from pkwrite_ECPrivateKey_size-crypto into development 2019-11-08 12:30:52 -06:00
gilles-peskine-arm commented 2019-11-05 08:39:55 -06:00 (Migrated from github.com)

When writing a private EC key, use a constant size for the private value, as specified in RFC 5915. Previously, the value was written as an ASN.1 INTEGER, which caused the size of the key to leak about 1 bit of information on average and could cause the value to be 1 byte too large for the output buffer.

These changes were previously applied to Mbed TLS 2.7, 2.16 and development (released in 2.19), but got lost during the split of Mbed TLS and Mbed Crypto. This is a straightforward side-port of https://github.com/ARMmbed/mbedtls-restricted/pull/503 and https://github.com/ARMmbed/mbedtls-restricted/pull/508 (private links: these were pull requests for a security fix which was quarantined until release).

Fix ARMmbed/mbedtls#1028

Internal ref: IOTCRYPT-969

When writing a private EC key, use a constant size for the private value, as specified in RFC 5915. Previously, the value was written as an ASN.1 INTEGER, which caused the size of the key to leak about 1 bit of information on average and could cause the value to be 1 byte too large for the output buffer. These changes were previously applied to Mbed TLS 2.7, 2.16 and development (released in 2.19), but got lost during the split of Mbed TLS and Mbed Crypto. This is a straightforward side-port of https://github.com/ARMmbed/mbedtls-restricted/pull/503 and https://github.com/ARMmbed/mbedtls-restricted/pull/508 (private links: these were pull requests for a security fix which was quarantined until release). Fix ARMmbed/mbedtls#1028 Internal ref: IOTCRYPT-969
dgreen-arm (Migrated from github.com) approved these changes 2019-11-07 10:25:53 -06:00
dgreen-arm (Migrated from github.com) left a comment

LGTM

LGTM
AndrzejKurek (Migrated from github.com) approved these changes 2019-11-08 05:00:46 -06:00
AndrzejKurek (Migrated from github.com) left a comment

This is consistent with PR 503.

This is consistent with PR 503.
gilles-peskine-arm commented 2019-11-08 10:45:18 -06:00 (Migrated from github.com)

New CI run with repaired CI: https://jenkins-internal.mbed.com/job/mbed-crypto-pr/job/PR-314-merge/2/ → passed. Good to merge.

New CI run with repaired CI: https://jenkins-internal.mbed.com/job/mbed-crypto-pr/job/PR-314-merge/2/ → passed. Good to merge.
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!314
No description provided.