Implemented MD5_Transform

This commit is contained in:
Hideki Miyazaki 2021-02-03 14:00:03 +09:00
parent 502e1458f9
commit 525d28f38f
No known key found for this signature in database
GPG Key ID: 7EB19ED9B9D5AC28
4 changed files with 35 additions and 3 deletions

View File

@ -16832,6 +16832,26 @@ size_t wolfSSL_get_client_random(const WOLFSSL* ssl, unsigned char* out,
return 0;
}
int wolfSSL_MD5_Transform(WOLFSSL_MD5_CTX* md5, const unsigned char* data)
{
int ret;
WOLFSSL_ENTER("MD5_Transform");
#if defined(LITTLE_ENDIAN_ORDER)
{
ByteReverseWords((word32*)data, (word32*)data, WC_MD5_BLOCK_SIZE);
}
#endif
ret = wc_Md5Transform((wc_Md5*)md5, data);
/* return 1 on success, 0 otherwise */
if (ret == 0)
return 1;
return ret;
}
#endif /* !NO_MD5 */

View File

@ -550,7 +550,12 @@ int wc_Md5Copy(wc_Md5* src, wc_Md5* dst)
return ret;
}
#ifdef OPENSSL_EXTRA
int wc_Md5Transform(wc_Md5* md5, const byte* data)
{
return Transform(md5, data);
}
#endif
#if defined(WOLFSSL_HASH_FLAGS) || defined(WOLF_CRYPTO_CB)
int wc_Md5SetFlags(wc_Md5* md5, word32 flags)
{

View File

@ -52,13 +52,14 @@ typedef struct WOLFSSL_MD5_CTX {
WOLFSSL_API int wolfSSL_MD5_Init(WOLFSSL_MD5_CTX*);
WOLFSSL_API int wolfSSL_MD5_Update(WOLFSSL_MD5_CTX*, const void*, unsigned long);
WOLFSSL_API int wolfSSL_MD5_Final(unsigned char*, WOLFSSL_MD5_CTX*);
WOLFSSL_API int wolfSSL_MD5_Transform(WOLFSSL_MD5_CTX*, const unsigned char*);
typedef WOLFSSL_MD5_CTX MD5_CTX;
#define MD5_Init wolfSSL_MD5_Init
#define MD5_Update wolfSSL_MD5_Update
#define MD5_Final wolfSSL_MD5_Final
#define MD5_Transform wolfSSL_MD5_Transform
#ifdef OPENSSL_EXTRA_BSD
#define MD5Init wolfSSL_MD5_Init

View File

@ -42,9 +42,12 @@
extern "C" {
#endif
#if !defined(NO_OLD_MD5_NAMES)
#define MD5 WC_MD5
#endif
#ifndef NO_OLD_WC_NAMES
#define Md5 wc_Md5
#define MD5 WC_MD5
#define MD5_BLOCK_SIZE WC_MD5_BLOCK_SIZE
#define MD5_DIGEST_SIZE WC_MD5_DIGEST_SIZE
#define WC_MD5_PAD_SIZE WC_MD5_PAD_SIZE
@ -109,6 +112,9 @@ WOLFSSL_API int wc_InitMd5_ex(wc_Md5*, void*, int);
WOLFSSL_API int wc_Md5Update(wc_Md5*, const byte*, word32);
WOLFSSL_API int wc_Md5Final(wc_Md5*, byte*);
WOLFSSL_API void wc_Md5Free(wc_Md5*);
#ifdef OPENSSL_EXTRA
WOLFSSL_API int wc_Md5Transform(wc_Md5*, const byte*);
#endif
WOLFSSL_API int wc_Md5GetHash(wc_Md5*, byte*);
WOLFSSL_API int wc_Md5Copy(wc_Md5*, wc_Md5*);