align compatibility layer sha256 and sha224 structs

This commit is contained in:
Jacob Barthelmeh
2017-02-02 11:57:29 -07:00
parent 895bf8dfbc
commit e722459df3
2 changed files with 14 additions and 8 deletions

View File

@@ -11703,37 +11703,37 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD *md)
if (XSTRNCMP(type, "SHA256", 6) == 0) {
ctx->macType = SHA256;
wolfSSL_SHA256_Init((SHA256_CTX*)&ctx->hash);
wolfSSL_SHA256_Init(&(ctx->hash.sha256));
}
#ifdef WOLFSSL_SHA224
else if (XSTRNCMP(type, "SHA224", 6) == 0) {
ctx->macType = SHA224;
wolfSSL_SHA224_Init((SHA224_CTX*)&ctx->hash);
wolfSSL_SHA224_Init(&(ctx->hash.sha224));
}
#endif
#ifdef WOLFSSL_SHA384
else if (XSTRNCMP(type, "SHA384", 6) == 0) {
ctx->macType = SHA384;
wolfSSL_SHA384_Init((SHA384_CTX*)&ctx->hash);
wolfSSL_SHA384_Init(&(ctx->hash.sha384));
}
#endif
#ifdef WOLFSSL_SHA512
else if (XSTRNCMP(type, "SHA512", 6) == 0) {
ctx->macType = SHA512;
wolfSSL_SHA512_Init((SHA512_CTX*)&ctx->hash);
wolfSSL_SHA512_Init(&(ctx->hash.sha512));
}
#endif
#ifndef NO_MD5
else if (XSTRNCMP(type, "MD5", 3) == 0) {
ctx->macType = MD5;
wolfSSL_MD5_Init((MD5_CTX*)&ctx->hash);
wolfSSL_MD5_Init(&(ctx->hash.md5));
}
#endif
#ifndef NO_SHA
/* has to be last since would pick or 224, 256, 384, or 512 too */
else if (XSTRNCMP(type, "SHA", 3) == 0) {
ctx->macType = SHA;
wolfSSL_SHA_Init((SHA_CTX*)&ctx->hash);
wolfSSL_SHA_Init(&(ctx->hash.sha));
}
#endif /* NO_SHA */
else