files cleaned

pull/73/head
Takashi Kojo 2015-05-21 18:12:43 +09:00
parent 527013ec1e
commit d24c7f070c
6 changed files with 106 additions and 42 deletions

View File

@ -74,7 +74,8 @@ endif
src_libwolfssl_la_SOURCES += \
wolfcrypt/src/logging.c \
wolfcrypt/src/wc_port.c \
wolfcrypt/src/error.c
wolfcrypt/src/error.c\
wolfcrypt/src/port/ti/ti-hash.c
if BUILD_MEMORY
src_libwolfssl_la_SOURCES += wolfcrypt/src/memory.c
@ -191,8 +192,6 @@ if BUILD_PKCS7
src_libwolfssl_la_SOURCES += wolfcrypt/src/pkcs7.c
endif
src_libwolfssl_la_SOURCES += wolfcrypt/src/port/ti/ti-hash.c
# ssl files
src_libwolfssl_la_SOURCES += \
src/internal.c \

View File

@ -180,12 +180,6 @@
#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)
{
md5->digest[0] = 0x67452301L;
@ -196,10 +190,6 @@ void wc_InitMd5(Md5* md5)
md5->buffLen = 0;
md5->loLen = 0;
md5->hiLen = 0;
#ifdef TI_HASH_TEST
wc_InitMd5_ti(md5) ;
#endif
}
#ifndef FREESCALE_MMCAU
@ -328,10 +318,6 @@ void wc_Md5Update(Md5* md5, const byte* data, word32 len)
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);
wc_InitMd5(md5); /* reset state */
#ifdef TI_HASH_TEST
wc_Md5Final_ti(md5, hash) ;
#endif
}
#endif /* STM32F2_HASH */
@ -410,17 +392,10 @@ int wc_Md5Hash(const byte* data, word32 len, byte* hash)
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)
{
#if defined(WOLFSSL_TI_HASH) || defined(TI_HASH_TEST)
wc_Md5GetHash_ti(md5, hash) ;
#else
Md5 save = *md5 ;
wc_Md5Final(md5, hash) ;
*md5 = save ;
#endif
}
#endif /* NO_MD5 */

View File

@ -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)
{
#if defined(WOLFSS_TI_HASH)
wc_ShaGetHash_TI(sha, hash) ;
#else
int ret ;
Sha save = *sha ;
ret = wc_ShaFinal(sha, hash) ;
*sha = save ;
return ret ;
#endif
}
#endif /* HAVE_FIPS */

View File

@ -576,20 +576,13 @@ int wc_Sha256Hash(const byte* data, word32 len, byte* hash)
return ret;
}
#ifdef WOLFSSL_TI_HASH
#include "wolfssl/wolfcrypt/port/ti/ti-hash.h"
#endif
int wc_Sha256GetHash(Sha256* sha256, byte* hash)
{
#if defined(WOLFSS_TI_HASH)
return wc_Sha256GetHash_TI(sha256, hash) ;
#else
int ret ;
Sha256 save = *sha256 ;
ret = wc_Sha256Final(sha256, hash) ;
*sha256 = save ;
return ret ;
#endif
}
#if defined(HAVE_INTEL_AVX1) || defined(HAVE_INTEL_AVX2)

View File

@ -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

View File

@ -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 */