Fix for configurations without specific algorithms

This commit is contained in:
Sean Parkinson
2019-02-20 11:34:53 +10:00
parent 700e9896d4
commit cb830a088f
2 changed files with 12 additions and 2 deletions

View File

@ -17003,6 +17003,7 @@ int DecodePrivateKey(WOLFSSL *ssl, word16* length)
}
if (ssl->buffers.keyType == rsa_sa_algo) {
#ifndef NO_RSA
ret = wc_InitRsaKey_Id((RsaKey*)ssl->hsKey,
ssl->buffers.key->buffer, ssl->buffers.key->length,
ssl->heap, ssl->buffers.keyDevId);
@ -17015,8 +17016,10 @@ int DecodePrivateKey(WOLFSSL *ssl, word16* length)
/* Return the maximum signature length. */
*length = (word16)wc_ecc_sig_size_calc(ssl->buffers.keySz);
}
#endif
}
else if (ssl->buffers.keyType == ecc_dsa_sa_algo) {
#ifdef HAVE_ECC
ret = wc_ecc_init_id((ecc_key*)ssl->hsKey, ssl->buffers.key->buffer,
ssl->buffers.key->length, ssl->heap,
ssl->buffers.keyDevId);
@ -17029,6 +17032,7 @@ int DecodePrivateKey(WOLFSSL *ssl, word16* length)
/* Return the maximum signature length. */
*length = (word16)wc_ecc_sig_size_calc(ssl->buffers.keySz);
}
#endif
}
goto exit_dpk;
}

View File

@ -2441,6 +2441,7 @@ int wc_Pkcs11_CryptoDevCb(int devId, wc_CryptoInfo* info, void* ctx)
ret = Pkcs11OpenSession(token, &session, readWrite);
if (ret == 0) {
if (info->algo_type == WC_ALGO_TYPE_PK) {
#if !defined(NO_RSA) || defined(HAVE_ECC)
switch (info->pk.type) {
#ifndef NO_RSA
case WC_PK_TYPE_RSA:
@ -2474,10 +2475,13 @@ int wc_Pkcs11_CryptoDevCb(int devId, wc_CryptoInfo* info, void* ctx)
ret = NOT_COMPILED_IN;
break;
}
#else
ret = NOT_COMPILED_IN;
#endif /* !NO_RSA || HAVE_ECC */
}
else if (info->algo_type == WC_ALGO_TYPE_CIPHER) {
switch (info->cipher.type) {
#ifndef NO_AES
switch (info->cipher.type) {
#ifdef HAVE_AESGCM
case WC_CIPHER_AES_GCM:
if (info->cipher.enc)
@ -2494,8 +2498,10 @@ int wc_Pkcs11_CryptoDevCb(int devId, wc_CryptoInfo* info, void* ctx)
ret = Pkcs11AesCbcDecrypt(&session, info);
break;
#endif
#endif
}
#else
ret = NOT_COMPILED_IN;
#endif
}
else if (info->algo_type == WC_ALGO_TYPE_HMAC) {
#ifndef NO_HMAC