condense to one switch statement for testing of message digests

This commit is contained in:
kaleb-himes
2015-12-16 11:40:58 -07:00
parent 46c4653f60
commit d395c5aba3

View File

@@ -13311,14 +13311,14 @@ int wolfSSL_RSA_sign(int type, const unsigned char* m,
}
switch (type) {
case NID_md2: break;
case NID_md5: break;
case NID_sha1: break;
case NID_sha256: break;
case NID_sha384: break;
case NID_sha512: break;
case NID_md2: type = MD2h; break;
case NID_md5: type = MD5h; break;
case NID_sha1: type = SHAh; break;
case NID_sha256: type = SHA256h; break;
case NID_sha384: type = SHA384h; break;
case NID_sha512: type = SHA512h; break;
default:
WOLFSSL_MSG("This NID_ is not yet implemented");
WOLFSSL_MSG("This NID (md type) is not yet implemented");
return 0;
}
@@ -13364,16 +13364,6 @@ int wolfSSL_RSA_sign(int type, const unsigned char* m,
if (rng) {
switch (type) {
case NID_md2: type = MD2h; break;
case NID_md5: type = MD5h; break;
case NID_sha1: type = SHAh; break;
case NID_sha256: type = SHA256h; break;
case NID_sha384: type = SHA384h; break;
case NID_sha512: type = SHA512h; break;
/* no default, already checked if NID is supported */
}
signSz = wc_EncodeSignature(encodedSig, m, mLen, type);
if (signSz == 0) {
WOLFSSL_MSG("Bad Encode Signature");