mbedtls/tests
Janos Follath 171a7efd02 Add mbedtls_ecp_read_key
The private keys used in ECDH differ in the case of Weierstrass and
Montgomery curves. They have different constraints, the former is based
on big endian, the latter little endian byte order. The fundamental
approach is different too:
- Weierstrass keys have to be in the right interval, otherwise they are
  rejected.
- Any byte array of the right size is a valid Montgomery key and it
  needs to be masked before interpreting it as a number.

Historically it was sufficient to use mbedtls_mpi_read_binary() to read
private keys, but as a preparation to improve support for Montgomery
curves we add mbedtls_ecp_read_key() to enable uniform treatment of EC
keys.

For the masking the `mbedtls_mpi_set_bit()` function is used. This is
suboptimal but seems to provide the best trade-off at this time.
Alternatives considered:
- Making a copy of the input buffer (less efficient)
- removing the `const` constraint from the input buffer (breaks the api
and makes it less user friendly)
- applying the mask directly to the limbs (violates the api between the
modules and creates and unwanted dependency)
2019-02-22 15:39:03 +00:00
..
.jenkins Add Jenkinsfile for PR job 2018-10-19 15:25:10 +01:00
data_files Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
git-scripts Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
scripts Test undefining MBEDTLS_ECDH_LEGACY_CONTEXT in all.sh 2019-02-22 13:04:23 +01:00
suites Add mbedtls_ecp_read_key 2019-02-22 15:39:03 +00:00
.gitignore
CMakeLists.txt Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
compat.sh Fix #2370, minor typos and spelling mistakes 2019-01-24 10:37:40 +01:00
Descriptions.txt
Makefile psa: Include PSA headers for tests and programs 2018-11-23 15:22:44 +00:00
ssl-opt.sh Merge development-psa commit 80b5662 into development-psa-merged branch 2019-02-05 06:02:51 -05:00