forked from wolfSSL/wolfssl
Cleanup of the signature wrapper error cases to be more explicit.
This commit is contained in:
@@ -110,8 +110,6 @@ int wc_SignatureVerify(
|
|||||||
/* Perform hash of data */
|
/* Perform hash of data */
|
||||||
ret = wc_Hash(hash_type, data, data_len, hash_data, hash_len);
|
ret = wc_Hash(hash_type, data, data_len, hash_data, hash_len);
|
||||||
if(ret == 0) {
|
if(ret == 0) {
|
||||||
/* Default to bad argument */
|
|
||||||
ret = BAD_FUNC_ARG;
|
|
||||||
|
|
||||||
/* Verify signature using hash as data */
|
/* Verify signature using hash as data */
|
||||||
switch(sig_type) {
|
switch(sig_type) {
|
||||||
@@ -150,6 +148,7 @@ int wc_SignatureVerify(
|
|||||||
|
|
||||||
case WC_SIGNATURE_TYPE_NONE:
|
case WC_SIGNATURE_TYPE_NONE:
|
||||||
default:
|
default:
|
||||||
|
ret = BAD_FUNC_ARG;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -198,9 +197,6 @@ int wc_SignatureGenerate(
|
|||||||
/* Perform hash of data */
|
/* Perform hash of data */
|
||||||
ret = wc_Hash(hash_type, data, data_len, hash_data, hash_len);
|
ret = wc_Hash(hash_type, data, data_len, hash_data, hash_len);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
/* Default to bad argument */
|
|
||||||
ret = BAD_FUNC_ARG;
|
|
||||||
|
|
||||||
/* Create signature using hash as data */
|
/* Create signature using hash as data */
|
||||||
switch(sig_type) {
|
switch(sig_type) {
|
||||||
#ifdef HAVE_ECC
|
#ifdef HAVE_ECC
|
||||||
@@ -223,6 +219,7 @@ int wc_SignatureGenerate(
|
|||||||
|
|
||||||
case WC_SIGNATURE_TYPE_NONE:
|
case WC_SIGNATURE_TYPE_NONE:
|
||||||
default:
|
default:
|
||||||
|
ret = BAD_FUNC_ARG;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user