mirror of https://github.com/wolfSSL/wolfssl.git
files cleaned
parent
527013ec1e
commit
d24c7f070c
|
@ -74,7 +74,8 @@ endif
|
||||||
src_libwolfssl_la_SOURCES += \
|
src_libwolfssl_la_SOURCES += \
|
||||||
wolfcrypt/src/logging.c \
|
wolfcrypt/src/logging.c \
|
||||||
wolfcrypt/src/wc_port.c \
|
wolfcrypt/src/wc_port.c \
|
||||||
wolfcrypt/src/error.c
|
wolfcrypt/src/error.c\
|
||||||
|
wolfcrypt/src/port/ti/ti-hash.c
|
||||||
|
|
||||||
if BUILD_MEMORY
|
if BUILD_MEMORY
|
||||||
src_libwolfssl_la_SOURCES += wolfcrypt/src/memory.c
|
src_libwolfssl_la_SOURCES += wolfcrypt/src/memory.c
|
||||||
|
@ -191,8 +192,6 @@ if BUILD_PKCS7
|
||||||
src_libwolfssl_la_SOURCES += wolfcrypt/src/pkcs7.c
|
src_libwolfssl_la_SOURCES += wolfcrypt/src/pkcs7.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
src_libwolfssl_la_SOURCES += wolfcrypt/src/port/ti/ti-hash.c
|
|
||||||
|
|
||||||
# ssl files
|
# ssl files
|
||||||
src_libwolfssl_la_SOURCES += \
|
src_libwolfssl_la_SOURCES += \
|
||||||
src/internal.c \
|
src/internal.c \
|
||||||
|
|
|
@ -180,12 +180,6 @@
|
||||||
|
|
||||||
#endif /* WOLFSSL_HAVE_MIN */
|
#endif /* WOLFSSL_HAVE_MIN */
|
||||||
|
|
||||||
#ifdef TI_HASH_TEST
|
|
||||||
void wc_InitMd5_ti(Md5* md5) ;
|
|
||||||
void wc_Md5Update_ti(Md5* md5, const byte* data, word32 len) ;
|
|
||||||
void wc_Md5Final_ti(Md5* md5, byte* hash) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void wc_InitMd5(Md5* md5)
|
void wc_InitMd5(Md5* md5)
|
||||||
{
|
{
|
||||||
md5->digest[0] = 0x67452301L;
|
md5->digest[0] = 0x67452301L;
|
||||||
|
@ -196,10 +190,6 @@ void wc_InitMd5(Md5* md5)
|
||||||
md5->buffLen = 0;
|
md5->buffLen = 0;
|
||||||
md5->loLen = 0;
|
md5->loLen = 0;
|
||||||
md5->hiLen = 0;
|
md5->hiLen = 0;
|
||||||
|
|
||||||
#ifdef TI_HASH_TEST
|
|
||||||
wc_InitMd5_ti(md5) ;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef FREESCALE_MMCAU
|
#ifndef FREESCALE_MMCAU
|
||||||
|
@ -328,10 +318,6 @@ void wc_Md5Update(Md5* md5, const byte* data, word32 len)
|
||||||
md5->buffLen = 0;
|
md5->buffLen = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef TI_HASH_TEST
|
|
||||||
wc_Md5Update_ti(md5, data, len) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -376,10 +362,6 @@ void wc_Md5Final(Md5* md5, byte* hash)
|
||||||
XMEMCPY(hash, md5->digest, MD5_DIGEST_SIZE);
|
XMEMCPY(hash, md5->digest, MD5_DIGEST_SIZE);
|
||||||
|
|
||||||
wc_InitMd5(md5); /* reset state */
|
wc_InitMd5(md5); /* reset state */
|
||||||
|
|
||||||
#ifdef TI_HASH_TEST
|
|
||||||
wc_Md5Final_ti(md5, hash) ;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* STM32F2_HASH */
|
#endif /* STM32F2_HASH */
|
||||||
|
@ -410,17 +392,10 @@ int wc_Md5Hash(const byte* data, word32 len, byte* hash)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(WOLFSSL_TI_HASH)||defined(TI_HASH_TEST)
|
|
||||||
#include "wolfssl/wolfcrypt/port/ti/ti-hash.h"
|
|
||||||
#endif
|
|
||||||
void wc_Md5GetHash(Md5* md5, byte* hash)
|
void wc_Md5GetHash(Md5* md5, byte* hash)
|
||||||
{
|
{
|
||||||
#if defined(WOLFSSL_TI_HASH) || defined(TI_HASH_TEST)
|
|
||||||
wc_Md5GetHash_ti(md5, hash) ;
|
|
||||||
#else
|
|
||||||
Md5 save = *md5 ;
|
Md5 save = *md5 ;
|
||||||
wc_Md5Final(md5, hash) ;
|
wc_Md5Final(md5, hash) ;
|
||||||
*md5 = save ;
|
*md5 = save ;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif /* NO_MD5 */
|
#endif /* NO_MD5 */
|
||||||
|
|
|
@ -452,20 +452,13 @@ int wc_ShaHash(const byte* data, word32 len, byte* hash)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WOLFSSL_TI_HASH
|
|
||||||
#include "wolfssl/wolfcrypt/port/ti/ti-hash.h"
|
|
||||||
#endif
|
|
||||||
int wc_ShaGetHash(Sha* sha, byte* hash)
|
int wc_ShaGetHash(Sha* sha, byte* hash)
|
||||||
{
|
{
|
||||||
#if defined(WOLFSS_TI_HASH)
|
|
||||||
wc_ShaGetHash_TI(sha, hash) ;
|
|
||||||
#else
|
|
||||||
int ret ;
|
int ret ;
|
||||||
Sha save = *sha ;
|
Sha save = *sha ;
|
||||||
ret = wc_ShaFinal(sha, hash) ;
|
ret = wc_ShaFinal(sha, hash) ;
|
||||||
*sha = save ;
|
*sha = save ;
|
||||||
return ret ;
|
return ret ;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_FIPS */
|
#endif /* HAVE_FIPS */
|
||||||
|
|
|
@ -576,20 +576,13 @@ int wc_Sha256Hash(const byte* data, word32 len, byte* hash)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WOLFSSL_TI_HASH
|
|
||||||
#include "wolfssl/wolfcrypt/port/ti/ti-hash.h"
|
|
||||||
#endif
|
|
||||||
int wc_Sha256GetHash(Sha256* sha256, byte* hash)
|
int wc_Sha256GetHash(Sha256* sha256, byte* hash)
|
||||||
{
|
{
|
||||||
#if defined(WOLFSS_TI_HASH)
|
|
||||||
return wc_Sha256GetHash_TI(sha256, hash) ;
|
|
||||||
#else
|
|
||||||
int ret ;
|
int ret ;
|
||||||
Sha256 save = *sha256 ;
|
Sha256 save = *sha256 ;
|
||||||
ret = wc_Sha256Final(sha256, hash) ;
|
ret = wc_Sha256Final(sha256, hash) ;
|
||||||
*sha256 = save ;
|
*sha256 = save ;
|
||||||
return ret ;
|
return ret ;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_INTEL_AVX1) || defined(HAVE_INTEL_AVX2)
|
#if defined(HAVE_INTEL_AVX1) || defined(HAVE_INTEL_AVX2)
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
/* port/ti/ti_ccm.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(WOLFSSL_TI_CRYPT) || defined(WOLFSSL_TI_HASH)
|
||||||
|
|
||||||
|
bool wolfSSL_TI_CCMInit(void) ;
|
||||||
|
|
||||||
|
#ifndef SINGLE_THREADED
|
||||||
|
void wolfSSL_TI_lockCCM() ;
|
||||||
|
void wolfSSL_TI_unlockCCM() ;
|
||||||
|
#else
|
||||||
|
#define wolfSSL_TI_lockCCM()
|
||||||
|
#define wolfSSL_TI_unlockCCM()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,64 @@
|
||||||
|
/* port/ti/ti-hash.h
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef WOLF_CRYPT_TI_HASH_H
|
||||||
|
#define WOLF_CRYPT_TI_HASH_H
|
||||||
|
|
||||||
|
#include <wolfssl/wolfcrypt/types.h>
|
||||||
|
|
||||||
|
#ifndef WOLFSSL_TI_INITBUFF
|
||||||
|
#define WOLFSSL_TI_INITBUFF 64
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define WOLFSSL_MAX_HASH_SIZE 64
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
byte *msg ;
|
||||||
|
word32 used ;
|
||||||
|
word32 len ;
|
||||||
|
byte hash[WOLFSSL_MAX_HASH_SIZE] ;
|
||||||
|
} wolfssl_TI_Hash ;
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef TI_HASH_TEST
|
||||||
|
#if !defined(NO_MD5)
|
||||||
|
typedef wolfssl_TI_Hash Md5 ;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#if !defined(NO_SHA)
|
||||||
|
typedef wolfssl_TI_Hash Sha ;
|
||||||
|
#endif
|
||||||
|
#if !defined(NO_SHA256)
|
||||||
|
typedef wolfssl_TI_Hash Sha256 ;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_SHA224)
|
||||||
|
typedef wolfssl_TI_Hash Sha224 ;
|
||||||
|
#define SHA224_DIGEST_SIZE 28
|
||||||
|
|
||||||
|
WOLFSSL_API int wc_InitSha224(Sha224* sha224) ;
|
||||||
|
WOLFSSL_API int wc_Sha224Update(Sha224* sha224, const byte* data, word32 len) ;
|
||||||
|
WOLFSSL_API int wc_Sha224Final(Sha224* sha224, byte* hash) ;
|
||||||
|
WOLFSSL_API int wc_Sha224Hash(const byte* data, word32 len, byte*hash) ;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif /* WOLF_CRYPT_TI_HASH_H */
|
Loading…
Reference in New Issue