PKCS#11 fix: Generate ECC key for decrypt/sign or derive

Add debugging information to PKCS#11.
This commit is contained in:
Sean Parkinson
2020-09-23 08:30:22 +10:00
parent 5afd313912
commit e539322a88
3 changed files with 665 additions and 65 deletions

View File

@ -4401,9 +4401,10 @@ int wc_ecc_make_pub_ex(ecc_key* key, ecc_point* pubOut, WC_RNG* rng)
} }
WOLFSSL_ABI int wc_ecc_make_key_ex2(WC_RNG* rng, int keysize, ecc_key* key, int curve_id,
int wc_ecc_make_key_ex(WC_RNG* rng, int keysize, ecc_key* key, int curve_id) int flags)
{ {
int err; int err;
#if !defined(WOLFSSL_ATECC508A) && !defined(WOLFSSL_ATECC608A) && \ #if !defined(WOLFSSL_ATECC508A) && !defined(WOLFSSL_ATECC608A) && \
!defined(WOLFSSL_CRYPTOCELL) !defined(WOLFSSL_CRYPTOCELL)
@ -4431,6 +4432,8 @@ int wc_ecc_make_key_ex(WC_RNG* rng, int keysize, ecc_key* key, int curve_id)
return err; return err;
} }
key->flags = flags;
#ifdef WOLF_CRYPTO_CB #ifdef WOLF_CRYPTO_CB
if (key->devId != INVALID_DEVID) { if (key->devId != INVALID_DEVID) {
err = wc_CryptoCb_MakeEccKey(rng, keysize, key, curve_id); err = wc_CryptoCb_MakeEccKey(rng, keysize, key, curve_id);
@ -4607,6 +4610,12 @@ int wc_ecc_make_key_ex(WC_RNG* rng, int keysize, ecc_key* key, int curve_id)
return err; return err;
} }
WOLFSSL_ABI
int wc_ecc_make_key_ex(WC_RNG* rng, int keysize, ecc_key* key, int curve_id)
{
return wc_ecc_make_key_ex2(rng, keysize, key, curve_id, WC_ECC_FLAG_NONE);
}
#ifdef ECC_DUMP_OID #ifdef ECC_DUMP_OID
/* Optional dump of encoded OID for adding new curves */ /* Optional dump of encoded OID for adding new curves */
static int mOidDumpDone; static int mOidDumpDone;

File diff suppressed because it is too large Load Diff

View File

@ -352,10 +352,11 @@ typedef struct {
/* ECC Flags */ /* ECC Flags */
enum { enum {
WC_ECC_FLAG_NONE = 0x00, WC_ECC_FLAG_NONE = 0x00,
#ifdef HAVE_ECC_CDH #ifdef HAVE_ECC_CDH
WC_ECC_FLAG_COFACTOR = 0x01, WC_ECC_FLAG_COFACTOR = 0x01,
#endif #endif
WC_ECC_FLAG_DEC_SIGN = 0x02,
}; };
/* ECC non-blocking */ /* ECC non-blocking */
@ -477,6 +478,9 @@ int wc_ecc_make_key(WC_RNG* rng, int keysize, ecc_key* key);
WOLFSSL_ABI WOLFSSL_API WOLFSSL_ABI WOLFSSL_API
int wc_ecc_make_key_ex(WC_RNG* rng, int keysize, ecc_key* key, int curve_id); int wc_ecc_make_key_ex(WC_RNG* rng, int keysize, ecc_key* key, int curve_id);
WOLFSSL_API WOLFSSL_API
int wc_ecc_make_key_ex2(WC_RNG* rng, int keysize, ecc_key* key, int curve_id,
int flags);
WOLFSSL_API
int wc_ecc_make_pub(ecc_key* key, ecc_point* pubOut); int wc_ecc_make_pub(ecc_key* key, ecc_point* pubOut);
WOLFSSL_API WOLFSSL_API
int wc_ecc_make_pub_ex(ecc_key* key, ecc_point* pubOut, WC_RNG* rng); int wc_ecc_make_pub_ex(ecc_key* key, ecc_point* pubOut, WC_RNG* rng);