Public point is calculated everytime a private key is loaded.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2023-03-13 18:01:56 +01:00
parent 2a3b9b7474
commit 132054c9b9

View File

@@ -26,6 +26,7 @@
#include "asn1.h"
#include "hsm.h"
#include "usb.h"
#include "random.h"
const uint8_t sc_hsm_aid[] = {
11,
@@ -637,6 +638,11 @@ int load_private_key_ecdsa(mbedtls_ecdsa_context *ctx, file_t *fkey) {
return CCID_EXEC_ERROR;
}
mbedtls_platform_zeroize(kdata, sizeof(kdata));
r = mbedtls_ecp_mul(&ctx->grp, &ctx->Q, &ctx->d, &ctx->grp.G, random_gen, NULL);
if (r != 0) {
mbedtls_ecdsa_free(ctx);
return CCID_EXEC_ERROR;
}
return CCID_OK;
}