Fix loading and saving Montgomery keys.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2023-08-24 16:01:39 +02:00
parent 7376817724
commit 1d3232df36
2 changed files with 2 additions and 2 deletions

View File

@@ -102,7 +102,7 @@ int cmd_decrypt_asym() {
free(kdata);
return SW_DATA_INVALID();
}
r = mbedtls_mpi_read_binary(&ctx.ctx.mbed_ecdh.d, kdata + 1, key_size - 1);
r = mbedtls_ecp_read_key(gid, (mbedtls_ecdsa_context *)&ctx.ctx.mbed_ecdh, kdata + 1, key_size - 1);
mbedtls_platform_zeroize(kdata, key_size);
free(kdata);
if (r != 0) {