forked from wolfSSL/wolfssl
add wolfSSL_EVP_md4 function
This commit is contained in:
34
src/ssl.c
34
src/ssl.c
@@ -12856,7 +12856,9 @@ const WOLFSSL_EVP_MD *wolfSSL_EVP_get_digestbyname(const char *name)
|
||||
static const struct alias {
|
||||
const char *name;
|
||||
const char *alias;
|
||||
} alias_tbl[] = {
|
||||
} alias_tbl[] =
|
||||
{
|
||||
{"MD4", "ssl3-md4"},
|
||||
{"MD5", "ssl3-md5"},
|
||||
{"SHA", "ssl3-sha1"},
|
||||
{"SHA", "SHA1"},
|
||||
@@ -12904,6 +12906,18 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD *md)
|
||||
}
|
||||
|
||||
|
||||
#ifndef NO_MD4
|
||||
|
||||
/* return a pointer to MD4 EVP type */
|
||||
const WOLFSSL_EVP_MD* wolfSSL_EVP_md4(void)
|
||||
{
|
||||
WOLFSSL_ENTER("wolfSSL_EVP_md4");
|
||||
return EVP_get_digestbyname("MD4");
|
||||
}
|
||||
|
||||
#endif /* NO_MD4 */
|
||||
|
||||
|
||||
#ifndef NO_MD5
|
||||
|
||||
const WOLFSSL_EVP_MD* wolfSSL_EVP_md5(void)
|
||||
@@ -13861,6 +13875,12 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD *md)
|
||||
ret = wolfSSL_SHA512_Init(&(ctx->hash.digest.sha512));
|
||||
}
|
||||
#endif
|
||||
#ifndef NO_MD4
|
||||
else if (XSTRNCMP(type, "MD4", 3) == 0) {
|
||||
ctx->macType = MD4;
|
||||
wolfSSL_MD4_Init(&(ctx->hash.digest.md4));
|
||||
}
|
||||
#endif
|
||||
#ifndef NO_MD5
|
||||
else if (XSTRNCMP(type, "MD5", 3) == 0) {
|
||||
ctx->macType = WC_MD5;
|
||||
@@ -13888,6 +13908,12 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD *md)
|
||||
WOLFSSL_ENTER("EVP_DigestUpdate");
|
||||
|
||||
switch (ctx->macType) {
|
||||
#ifndef NO_MD4
|
||||
case MD4:
|
||||
wolfSSL_MD4_Update((MD4_CTX*)&ctx->hash, data,
|
||||
(unsigned long)sz);
|
||||
break;
|
||||
#endif
|
||||
#ifndef NO_MD5
|
||||
case WC_MD5:
|
||||
wolfSSL_MD5_Update((MD5_CTX*)&ctx->hash, data,
|
||||
@@ -13938,6 +13964,12 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD *md)
|
||||
{
|
||||
WOLFSSL_ENTER("EVP_DigestFinal");
|
||||
switch (ctx->macType) {
|
||||
#ifndef NO_MD4
|
||||
case MD4:
|
||||
wolfSSL_MD4_Final(md, (MD4_CTX*)&ctx->hash);
|
||||
if (s) *s = MD4_DIGEST_SIZE;
|
||||
break;
|
||||
#endif
|
||||
#ifndef NO_MD5
|
||||
case WC_MD5:
|
||||
wolfSSL_MD5_Final(md, (MD5_CTX*)&ctx->hash);
|
||||
|
||||
Reference in New Issue
Block a user