forked from wolfSSL/wolfssl
moving xxxGetHash to hash.c
This commit is contained in:
@@ -1846,9 +1846,8 @@ void bench_ed25519KeySign(void)
|
||||
return ( ns / CLOCK * 2.0);
|
||||
}
|
||||
|
||||
#elif defined(WOLFSSL_IAR_ARM_TIME) || defined (WOLFSSL_MDK_ARM)
|
||||
#elif defined(WOLFSSL_IAR_ARM_TIME) || defined (WOLFSSL_MDK_ARM) || defined(WOLFSSL_USER_TIME)
|
||||
extern double current_time(int reset);
|
||||
|
||||
|
||||
#elif defined FREERTOS
|
||||
|
||||
|
66
wolfcrypt/src/hash.c
Normal file
66
wolfcrypt/src/hash.c
Normal file
@@ -0,0 +1,66 @@
|
||||
/* hash.c
|
||||
*
|
||||
* Copyright (C) 2006-2015 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
|
||||
#if !defined(NO_MD5) && !defined(WOLFSSL_TI_HASH)
|
||||
|
||||
#include <wolfssl/wolfcrypt/md5.h>
|
||||
void wc_Md5GetHash(Md5* md5, byte* hash)
|
||||
{
|
||||
Md5 save = *md5 ;
|
||||
wc_Md5Final(md5, hash) ;
|
||||
*md5 = save ;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(NO_SHA) && !defined(WOLFSSL_TI_HASH)
|
||||
|
||||
#include <wolfssl/wolfcrypt/sha.h>
|
||||
|
||||
int wc_ShaGetHash(Sha* sha, byte* hash)
|
||||
{
|
||||
int ret ;
|
||||
Sha save = *sha ;
|
||||
ret = wc_ShaFinal(sha, hash) ;
|
||||
*sha = save ;
|
||||
return ret ;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(NO_SHA256) && !defined(WOLFSSL_TI_HASH)
|
||||
|
||||
#include <wolfssl/wolfcrypt/sha256.h>
|
||||
|
||||
int wc_Sha256GetHash(Sha256* sha256, byte* hash)
|
||||
{
|
||||
int ret ;
|
||||
Sha256 save = *sha256 ;
|
||||
ret = wc_Sha256Final(sha256, hash) ;
|
||||
*sha256 = save ;
|
||||
return ret ;
|
||||
}
|
||||
|
||||
#endif
|
@@ -392,10 +392,4 @@ int wc_Md5Hash(const byte* data, word32 len, byte* hash)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wc_Md5GetHash(Md5* md5, byte* hash)
|
||||
{
|
||||
Md5 save = *md5 ;
|
||||
wc_Md5Final(md5, hash) ;
|
||||
*md5 = save ;
|
||||
}
|
||||
#endif /* NO_MD5 */
|
||||
|
@@ -452,15 +452,6 @@ int wc_ShaHash(const byte* data, word32 len, byte* hash)
|
||||
|
||||
}
|
||||
|
||||
int wc_ShaGetHash(Sha* sha, byte* hash)
|
||||
{
|
||||
int ret ;
|
||||
Sha save = *sha ;
|
||||
ret = wc_ShaFinal(sha, hash) ;
|
||||
*sha = save ;
|
||||
return ret ;
|
||||
}
|
||||
|
||||
#endif /* HAVE_FIPS */
|
||||
#endif /* NO_SHA */
|
||||
|
||||
|
@@ -576,15 +576,6 @@ int wc_Sha256Hash(const byte* data, word32 len, byte* hash)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int wc_Sha256GetHash(Sha256* sha256, byte* hash)
|
||||
{
|
||||
int ret ;
|
||||
Sha256 save = *sha256 ;
|
||||
ret = wc_Sha256Final(sha256, hash) ;
|
||||
*sha256 = save ;
|
||||
return ret ;
|
||||
}
|
||||
|
||||
#if defined(HAVE_INTEL_AVX1) || defined(HAVE_INTEL_AVX2)
|
||||
|
||||
#define _DigestToReg(S_0, S_1, S_2, S_3, S_4, S_5, S_6, S_7 )\
|
||||
|
Reference in New Issue
Block a user