Fix DecodePrivateKey to return NOT_COMPILED_IN with PKCS#11

This commit is contained in:
Sean Parkinson
2019-02-26 08:48:12 +10:00
parent cb830a088f
commit a2f8747652
2 changed files with 5 additions and 1 deletions

View File

@@ -17016,6 +17016,8 @@ int DecodePrivateKey(WOLFSSL *ssl, word16* length)
/* Return the maximum signature length. */ /* Return the maximum signature length. */
*length = (word16)wc_ecc_sig_size_calc(ssl->buffers.keySz); *length = (word16)wc_ecc_sig_size_calc(ssl->buffers.keySz);
} }
#else
ret = NOT_COMPILED_IN;
#endif #endif
} }
else if (ssl->buffers.keyType == ecc_dsa_sa_algo) { else if (ssl->buffers.keyType == ecc_dsa_sa_algo) {
@@ -17032,6 +17034,8 @@ int DecodePrivateKey(WOLFSSL *ssl, word16* length)
/* Return the maximum signature length. */ /* Return the maximum signature length. */
*length = (word16)wc_ecc_sig_size_calc(ssl->buffers.keySz); *length = (word16)wc_ecc_sig_size_calc(ssl->buffers.keySz);
} }
#else
ret = NOT_COMPILED_IN;
#endif #endif
} }
goto exit_dpk; goto exit_dpk;

View File

@@ -11168,7 +11168,7 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
FreeDer(&ctx->privateKey); FreeDer(&ctx->privateKey);
if (AllocDer(&ctx->privateKey, (word32)sz, PRIVATEKEY_TYPE, if (AllocDer(&ctx->privateKey, (word32)sz, PRIVATEKEY_TYPE,
ctx->heap) == 0) { ctx->heap) == 0) {
XMEMCPY(ctx->privateKey->buffer, id, sz); XMEMCPY(ctx->privateKey->buffer, id, sz);
ctx->privateKeyId = 1; ctx->privateKeyId = 1;
ctx->privateKeySz = (word32)keySz; ctx->privateKeySz = (word32)keySz;