From c51c607e9665499395d6b4ca5b90617687dc5864 Mon Sep 17 00:00:00 2001 From: David Garske Date: Fri, 7 Sep 2018 16:46:42 -0700 Subject: [PATCH] Fix to use `inLen` for raw public key copy. No need to throw an error for other curve types as this function may be used for software only import/export. In the TLS case with only SECP256R1 there are other places where an error will be thrown. --- wolfcrypt/src/ecc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index cc1d28a14..1e4527404 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -6314,7 +6314,7 @@ int wc_ecc_import_x963_ex(const byte* in, word32 inLen, ecc_key* key, /* For SECP256R1 only save raw public key for hardware */ if (curve_id == ECC_SECP256R1 && !compressed && inLen <= sizeof(key->pubkey_raw)) { - XMEMCPY(key->pubkey_raw, (byte*)in, sizeof(key->pubkey_raw)); + XMEMCPY(key->pubkey_raw, (byte*)in, inLen); } #endif