forked from wolfSSL/wolfssl
Merge pull request #2530 from SparkiDev/pkcs11_tls_client
Use the public key type as private key type with PKCS #11
This commit is contained in:
24
src/ssl.c
24
src/ssl.c
@@ -5472,6 +5472,14 @@ int ProcessBuffer(WOLFSSL_CTX* ctx, const unsigned char* buff,
|
|||||||
case RSAk:
|
case RSAk:
|
||||||
#ifdef HAVE_PK_CALLBACKS
|
#ifdef HAVE_PK_CALLBACKS
|
||||||
keyType = rsa_sa_algo;
|
keyType = rsa_sa_algo;
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_PKCS11
|
||||||
|
if (ctx) {
|
||||||
|
ctx->privateKeyType = rsa_sa_algo;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ssl->buffers.keyType = rsa_sa_algo;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Determine RSA key size by parsing public key */
|
/* Determine RSA key size by parsing public key */
|
||||||
idx = 0;
|
idx = 0;
|
||||||
@@ -5500,6 +5508,14 @@ int ProcessBuffer(WOLFSSL_CTX* ctx, const unsigned char* buff,
|
|||||||
case ECDSAk:
|
case ECDSAk:
|
||||||
#ifdef HAVE_PK_CALLBACKS
|
#ifdef HAVE_PK_CALLBACKS
|
||||||
keyType = ecc_dsa_sa_algo;
|
keyType = ecc_dsa_sa_algo;
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_PKCS11
|
||||||
|
if (ctx) {
|
||||||
|
ctx->privateKeyType = ecc_dsa_sa_algo;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ssl->buffers.keyType = ecc_dsa_sa_algo;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Determine ECC key size based on curve */
|
/* Determine ECC key size based on curve */
|
||||||
keySz = wc_ecc_get_curve_size_from_id(
|
keySz = wc_ecc_get_curve_size_from_id(
|
||||||
@@ -5525,6 +5541,14 @@ int ProcessBuffer(WOLFSSL_CTX* ctx, const unsigned char* buff,
|
|||||||
case ED25519k:
|
case ED25519k:
|
||||||
#ifdef HAVE_PK_CALLBACKS
|
#ifdef HAVE_PK_CALLBACKS
|
||||||
keyType = ed25519_sa_algo;
|
keyType = ed25519_sa_algo;
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_PKCS11
|
||||||
|
if (ctx) {
|
||||||
|
ctx->privateKeyType = ed25519_sa_algo;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ssl->buffers.keyType = ed25519_sa_algo;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
/* ED25519 is fixed key size */
|
/* ED25519 is fixed key size */
|
||||||
keySz = ED25519_KEY_SIZE;
|
keySz = ED25519_KEY_SIZE;
|
||||||
|
Reference in New Issue
Block a user