test and debug of poly-chacha suites

This commit is contained in:
Jacob Barthelmeh 2014-12-30 10:30:54 -07:00
parent da2c78026c
commit 5eef118ff5
13 changed files with 406 additions and 377 deletions

View File

@ -23,9 +23,12 @@
#ifndef CTAO_CRYPT_MISC_H #ifndef CTAO_CRYPT_MISC_H
#define CTAO_CRYPT_MISC_H #define CTAO_CRYPT_MISC_H
#include <cyassl/ctaocrypt/types.h> #include <cyassl/ctaocrypt/types.h>
#ifndef HAVE_FIPS
#include <wolfssl/wolfcrypt/misc.h>
#else
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -68,5 +71,6 @@ void ByteReverseWords64(word64*, const word64*, word32);
#endif #endif
#endif /* HAVE_FIPS */
#endif /* CTAO_CRYPT_MISC_H */ #endif /* CTAO_CRYPT_MISC_H */

View File

@ -27,6 +27,11 @@
#include <wolfssl/wolfcrypt/poly1305.h> #include <wolfssl/wolfcrypt/poly1305.h>
/* for poly1305 reverse compatibility */
#define Poly1305SetKey wc_Poly1305SetKey
#define Poly1305Update wc_Poly1305Update
#define Poly1305Final wc_Poly1305Final
#endif /* CTAO_CRYPT_POLY1305_H */ #endif /* CTAO_CRYPT_POLY1305_H */
#endif /* HAVE_POLY1305 */ #endif /* HAVE_POLY1305 */

View File

@ -23,6 +23,16 @@
#ifndef CTAO_CRYPT_TYPES_H #ifndef CTAO_CRYPT_TYPES_H
#define CTAO_CRYPT_TYPES_H #define CTAO_CRYPT_TYPES_H
#ifndef HAVE_FIPS
#include <wolfssl/wolfcrypt/types.h>
/* compatibility macros */
#define CYASSL_WORD_SIZE WOLFSSL_WORD_SIZE
#define CYASSL_BIT_SIZE WOLFSSL_BIT_SIZE
#define CYASSL_MAX_16BIT WOLFSSL_MAX_16BIT
#define cyassl_word wolfssl_word
#else
#include <cyassl/ctaocrypt/settings.h> #include <cyassl/ctaocrypt/settings.h>
#include <cyassl/ctaocrypt/wc_port.h> #include <cyassl/ctaocrypt/wc_port.h>
@ -324,5 +334,6 @@ CYASSL_API word32 CheckRunTimeSettings(void);
#endif #endif
#endif /* HAVE_FIPS */
#endif /* CTAO_CRYPT_TYPES_H */ #endif /* CTAO_CRYPT_TYPES_H */

View File

@ -26,9 +26,13 @@
/* fips compatibility @wc_fips */ /* fips compatibility @wc_fips */
#ifndef HAVE_FIPS #ifndef HAVE_FIPS
#include <wolfssl/wolfcrypt/visibility.h> #ifndef CYASSL_API
#define CYASSL_API WOLFSSL_API #define CYASSL_API WOLFSSL_API
#endif
#ifndef CYASSL_LOCAL
#define CYASSL_LOCAL WOLFSSL_LOCAL #define CYASSL_LOCAL WOLFSSL_LOCAL
#endif
#include <wolfssl/wolfcrypt/visibility.h>
#else #else
#define BUILDING_CYASSL #define BUILDING_CYASSL
/* CYASSL_API is used for the public API symbols. /* CYASSL_API is used for the public API symbols.

View File

@ -84,8 +84,9 @@
#define CYASSL_THREAD WOLFSSL_THREAD #define CYASSL_THREAD WOLFSSL_THREAD
#endif #endif
/* wolfcrypt/src/error.c */ #ifndef CYASSL_MAX_ERROR_SZ
#define WOLFSSL_MAX_ERROR_SZ CYASSL_MAX_ERROR_SZ #define CYASSL_MAX_ERROR_SZ WOLFSSL_MAX_ERROR_SZ
#endif
/* src/ssl.c */ /* src/ssl.c */
#define CYASSL_CRL WOLFSSL_CRL #define CYASSL_CRL WOLFSSL_CRL
@ -121,6 +122,8 @@
#define CyaSSL_get_current_cipher_suite wolfSSL_get_current_cipher_suite #define CyaSSL_get_current_cipher_suite wolfSSL_get_current_cipher_suite
#define CyaSSL_CTX_load_verify_locations wolfSSL_CTX_load_verify_locations #define CyaSSL_CTX_load_verify_locations wolfSSL_CTX_load_verify_locations
#define CyaSSL_use_old_poly wolfSSL_use_old_poly
/* io.c */ /* io.c */
#define CYASSL_CBIO_ERR_ISR WOLFSSL_CBIO_ERR_ISR #define CYASSL_CBIO_ERR_ISR WOLFSSL_CBIO_ERR_ISR
#define CYASSL_CBIO_ERR_TIMEOUT WOLFSSL_CBIO_ERR_TIMEOUT #define CYASSL_CBIO_ERR_TIMEOUT WOLFSSL_CBIO_ERR_TIMEOUT
@ -153,7 +156,7 @@
#define cyassl_chacha wolfssl_chacha #define cyassl_chacha wolfssl_chacha
#define CyaSSL_ERR_reason_error_string wolfSSL_ERR_reason_error_string #define CyaSSL_ERR_reason_error_string wolfSSL_ERR_reason_error_string
#define wolfcrypt_test ctaocrypt_test //#define wolfcrypt_test ctaocrypt_test
/* src/eys.c */ /* src/eys.c */
#define cyassl_triple_des wolfssl_triple_des #define cyassl_triple_des wolfssl_triple_des
@ -367,12 +370,8 @@
#undef WOLFSSL_API #undef WOLFSSL_API
#define WOLFSSL_API CYASSL_API #define WOLFSSL_API CYASSL_API
#endif #endif
#define WOLFSSL_BIT_SIZE CYASSL_BIT_SIZE /* @TODO*/
/* wrapper around macros until they are changed in cyassl code /* wrapper around macros until they are changed in cyassl code
* needs investigation in regards to macros in fips */ * needs investigation in regards to macros in fips */
#define WOLFSSL_MAX_16BIT CYASSL_MAX_16BIT
#define NO_WOLFSSL_ALLOC_ALIGN NO_CYASSL_ALLOC_ALIGN /* @TODO*/ #define NO_WOLFSSL_ALLOC_ALIGN NO_CYASSL_ALLOC_ALIGN /* @TODO*/
/* for pwdbased reverse compatibility */ /* for pwdbased reverse compatibility */

View File

@ -5318,16 +5318,16 @@ static int Poly1305Tag(WOLFSSL* ssl, byte* additional, const byte* out,
XMEMSET(padding, 0, sizeof(padding)); XMEMSET(padding, 0, sizeof(padding));
if ((ret = Poly1305SetKey(ssl->auth.poly1305, cipher, keySz)) != 0) if ((ret = wc_Poly1305SetKey(ssl->auth.poly1305, cipher, keySz)) != 0)
return ret; return ret;
/* additional input to poly1305 */ /* additional input to poly1305 */
if ((ret = Poly1305Update(ssl->auth.poly1305, additional, if ((ret = wc_Poly1305Update(ssl->auth.poly1305, additional,
CHACHA20_BLOCK_SIZE)) != 0) CHACHA20_BLOCK_SIZE)) != 0)
return ret; return ret;
/* cipher input */ /* cipher input */
if ((ret = Poly1305Update(ssl->auth.poly1305, out, msglen)) != 0) if ((ret = wc_Poly1305Update(ssl->auth.poly1305, out, msglen)) != 0)
return ret; return ret;
/* handle padding for cipher input to make it 16 bytes long */ /* handle padding for cipher input to make it 16 bytes long */
@ -5336,7 +5336,7 @@ static int Poly1305Tag(WOLFSSL* ssl, byte* additional, const byte* out,
if (paddingSz < 0) if (paddingSz < 0)
return INPUT_CASE_ERROR; return INPUT_CASE_ERROR;
if ((ret = Poly1305Update(ssl->auth.poly1305, padding, paddingSz)) if ((ret = wc_Poly1305Update(ssl->auth.poly1305, padding, paddingSz))
!= 0) != 0)
return ret; return ret;
} }
@ -5350,12 +5350,12 @@ static int Poly1305Tag(WOLFSSL* ssl, byte* additional, const byte* out,
padding[9] = (msglen >> 8) & 0xff; padding[9] = (msglen >> 8) & 0xff;
padding[10] = (msglen >>16) & 0xff; padding[10] = (msglen >>16) & 0xff;
padding[11] = (msglen >>24) & 0xff; padding[11] = (msglen >>24) & 0xff;
if ((ret = Poly1305Update(ssl->auth.poly1305, padding, sizeof(padding))) if ((ret = wc_Poly1305Update(ssl->auth.poly1305, padding, sizeof(padding)))
!= 0) != 0)
return ret; return ret;
/* generate tag */ /* generate tag */
if ((ret = Poly1305Final(ssl->auth.poly1305, tag)) != 0) if ((ret = wc_Poly1305Final(ssl->auth.poly1305, tag)) != 0)
return ret; return ret;
return ret; return ret;
@ -5378,27 +5378,27 @@ static int Poly1305TagOld(WOLFSSL* ssl, byte* additional, const byte* out,
if (msglen < 0) if (msglen < 0)
return INPUT_CASE_ERROR; return INPUT_CASE_ERROR;
if ((ret = Poly1305SetKey(ssl->auth.poly1305, cipher, keySz)) != 0) if ((ret = wc_Poly1305SetKey(ssl->auth.poly1305, cipher, keySz)) != 0)
return ret; return ret;
/* add TLS compressed length and additional input to poly1305 */ /* add TLS compressed length and additional input to poly1305 */
additional[AEAD_AUTH_DATA_SZ - 2] = (msglen >> 8) & 0xff; additional[AEAD_AUTH_DATA_SZ - 2] = (msglen >> 8) & 0xff;
additional[AEAD_AUTH_DATA_SZ - 1] = msglen & 0xff; additional[AEAD_AUTH_DATA_SZ - 1] = msglen & 0xff;
if ((ret = Poly1305Update(ssl->auth.poly1305, additional, if ((ret = wc_Poly1305Update(ssl->auth.poly1305, additional,
AEAD_AUTH_DATA_SZ)) != 0) AEAD_AUTH_DATA_SZ)) != 0)
return ret; return ret;
/* length of additional input plus padding */ /* length of additional input plus padding */
XMEMSET(padding, 0, sizeof(padding)); XMEMSET(padding, 0, sizeof(padding));
padding[0] = AEAD_AUTH_DATA_SZ; padding[0] = AEAD_AUTH_DATA_SZ;
if ((ret = Poly1305Update(ssl->auth.poly1305, padding, if ((ret = wc_Poly1305Update(ssl->auth.poly1305, padding,
sizeof(padding))) != 0) sizeof(padding))) != 0)
return ret; return ret;
/* add cipher info and then its length */ /* add cipher info and then its length */
XMEMSET(padding, 0, sizeof(padding)); XMEMSET(padding, 0, sizeof(padding));
if ((ret = Poly1305Update(ssl->auth.poly1305, out, msglen)) != 0) if ((ret = wc_Poly1305Update(ssl->auth.poly1305, out, msglen)) != 0)
return ret; return ret;
/* 32 bit size of cipher to 64 bit endian */ /* 32 bit size of cipher to 64 bit endian */
@ -5406,12 +5406,12 @@ static int Poly1305TagOld(WOLFSSL* ssl, byte* additional, const byte* out,
padding[1] = (msglen >> 8) & 0xff; padding[1] = (msglen >> 8) & 0xff;
padding[2] = (msglen >> 16) & 0xff; padding[2] = (msglen >> 16) & 0xff;
padding[3] = (msglen >> 24) & 0xff; padding[3] = (msglen >> 24) & 0xff;
if ((ret = Poly1305Update(ssl->auth.poly1305, padding, sizeof(padding))) if ((ret = wc_Poly1305Update(ssl->auth.poly1305, padding, sizeof(padding)))
!= 0) != 0)
return ret; return ret;
/* generate tag */ /* generate tag */
if ((ret = Poly1305Final(ssl->auth.poly1305, tag)) != 0) if ((ret = wc_Poly1305Final(ssl->auth.poly1305, tag)) != 0)
return ret; return ret;
return ret; return ret;
@ -5472,15 +5472,15 @@ static int ChachaAEADEncrypt(WOLFSSL* ssl, byte* out, const byte* input,
#endif #endif
/* set the nonce for chacha and get poly1305 key */ /* set the nonce for chacha and get poly1305 key */
if ((ret = Chacha_SetIV(ssl->encrypt.chacha, nonce, 0)) != 0) if ((ret = wc_Chacha_SetIV(ssl->encrypt.chacha, nonce, 0)) != 0)
return ret; return ret;
if ((ret = Chacha_Process(ssl->encrypt.chacha, cipher, if ((ret = wc_Chacha_Process(ssl->encrypt.chacha, cipher,
cipher, sizeof(cipher))) != 0) cipher, sizeof(cipher))) != 0)
return ret; return ret;
/* encrypt the plain text */ /* encrypt the plain text */
if ((ret = Chacha_Process(ssl->encrypt.chacha, out, input, if ((ret = wc_Chacha_Process(ssl->encrypt.chacha, out, input,
sz - ssl->specs.aead_mac_size)) != 0) sz - ssl->specs.aead_mac_size)) != 0)
return ret; return ret;
@ -5576,10 +5576,10 @@ static int ChachaAEADDecrypt(WOLFSSL* ssl, byte* plain, const byte* input,
#endif #endif
/* set nonce and get poly1305 key */ /* set nonce and get poly1305 key */
if ((ret = Chacha_SetIV(ssl->decrypt.chacha, nonce, 0)) != 0) if ((ret = wc_Chacha_SetIV(ssl->decrypt.chacha, nonce, 0)) != 0)
return ret; return ret;
if ((ret = Chacha_Process(ssl->decrypt.chacha, cipher, if ((ret = wc_Chacha_Process(ssl->decrypt.chacha, cipher,
cipher, sizeof(cipher))) != 0) cipher, sizeof(cipher))) != 0)
return ret; return ret;
@ -5612,7 +5612,7 @@ static int ChachaAEADDecrypt(WOLFSSL* ssl, byte* plain, const byte* input,
} }
/* if mac was good decrypt message */ /* if mac was good decrypt message */
if ((ret = Chacha_Process(ssl->decrypt.chacha, plain, input, if ((ret = wc_Chacha_Process(ssl->decrypt.chacha, plain, input,
sz - ssl->specs.aead_mac_size)) != 0) sz - ssl->specs.aead_mac_size)) != 0)
return ret; return ret;

View File

@ -1885,14 +1885,14 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
return MEMORY_E; return MEMORY_E;
if (side == WOLFSSL_CLIENT_END) { if (side == WOLFSSL_CLIENT_END) {
if (enc) { if (enc) {
chachaRet = Chacha_SetKey(enc->chacha, keys->client_write_key, chachaRet = wc_Chacha_SetKey(enc->chacha, keys->client_write_key,
specs->key_size); specs->key_size);
XMEMCPY(keys->aead_enc_imp_IV, keys->client_write_IV, XMEMCPY(keys->aead_enc_imp_IV, keys->client_write_IV,
AEAD_IMP_IV_SZ); AEAD_IMP_IV_SZ);
if (chachaRet != 0) return chachaRet; if (chachaRet != 0) return chachaRet;
} }
if (dec) { if (dec) {
chachaRet = Chacha_SetKey(dec->chacha, keys->server_write_key, chachaRet = wc_Chacha_SetKey(dec->chacha, keys->server_write_key,
specs->key_size); specs->key_size);
XMEMCPY(keys->aead_dec_imp_IV, keys->server_write_IV, XMEMCPY(keys->aead_dec_imp_IV, keys->server_write_IV,
AEAD_IMP_IV_SZ); AEAD_IMP_IV_SZ);
@ -1901,14 +1901,14 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
} }
else { else {
if (enc) { if (enc) {
chachaRet = Chacha_SetKey(enc->chacha, keys->server_write_key, chachaRet = wc_Chacha_SetKey(enc->chacha, keys->server_write_key,
specs->key_size); specs->key_size);
XMEMCPY(keys->aead_enc_imp_IV, keys->server_write_IV, XMEMCPY(keys->aead_enc_imp_IV, keys->server_write_IV,
AEAD_IMP_IV_SZ); AEAD_IMP_IV_SZ);
if (chachaRet != 0) return chachaRet; if (chachaRet != 0) return chachaRet;
} }
if (dec) { if (dec) {
chachaRet = Chacha_SetKey(dec->chacha, keys->client_write_key, chachaRet = wc_Chacha_SetKey(dec->chacha, keys->client_write_key,
specs->key_size); specs->key_size);
XMEMCPY(keys->aead_dec_imp_IV, keys->client_write_IV, XMEMCPY(keys->aead_dec_imp_IV, keys->client_write_IV,
AEAD_IMP_IV_SZ); AEAD_IMP_IV_SZ);

View File

@ -1647,13 +1647,13 @@ int wc_ecc_sign_hash(const byte* in, word32 inlen, byte* out, word32 *outlen,
word32 orderBits = mp_count_bits(&p); word32 orderBits = mp_count_bits(&p);
/* truncate down to byte size, may be all that's needed */ /* truncate down to byte size, may be all that's needed */
if ( (WOLFSSLF_BIT_SIZE * inlen) > orderBits) if ( (WOLFSSL_BIT_SIZE * inlen) > orderBits)
inlen = (orderBits + WOLFSSLF_BIT_SIZE - 1)/WOLFSSL_BIT_SIZE; inlen = (orderBits + WOLFSSL_BIT_SIZE - 1)/WOLFSSL_BIT_SIZE;
err = mp_read_unsigned_bin(&e, (byte*)in, inlen); err = mp_read_unsigned_bin(&e, (byte*)in, inlen);
/* may still need bit truncation too */ /* may still need bit truncation too */
if (err == MP_OKAY && (WOLFSSLF_BIT_SIZE * inlen) > orderBits) if (err == MP_OKAY && (WOLFSSL_BIT_SIZE * inlen) > orderBits)
mp_rshb(&e, WOLFSSLF_BIT_SIZE - (orderBits & 0x7)); mp_rshb(&e, WOLFSSL_BIT_SIZE - (orderBits & 0x7));
} }
/* make up a key and export the public copy */ /* make up a key and export the public copy */
@ -2059,13 +2059,13 @@ int wc_ecc_verify_hash(const byte* sig, word32 siglen, const byte* hash,
unsigned int orderBits = mp_count_bits(&p); unsigned int orderBits = mp_count_bits(&p);
/* truncate down to byte size, may be all that's needed */ /* truncate down to byte size, may be all that's needed */
if ( (WOLFSSLF_BIT_SIZE * hashlen) > orderBits) if ( (WOLFSSL_BIT_SIZE * hashlen) > orderBits)
hashlen = (orderBits + WOLFSSLF_BIT_SIZE - 1)/WOLFSSL_BIT_SIZE; hashlen = (orderBits + WOLFSSL_BIT_SIZE - 1)/WOLFSSL_BIT_SIZE;
err = mp_read_unsigned_bin(&e, hash, hashlen); err = mp_read_unsigned_bin(&e, hash, hashlen);
/* may still need bit truncation too */ /* may still need bit truncation too */
if (err == MP_OKAY && (WOLFSSLF_BIT_SIZE * hashlen) > orderBits) if (err == MP_OKAY && (WOLFSSL_BIT_SIZE * hashlen) > orderBits)
mp_rshb(&e, WOLFSSLF_BIT_SIZE - (orderBits & 0x7)); mp_rshb(&e, WOLFSSL_BIT_SIZE - (orderBits & 0x7));
} }
/* w = s^-1 mod n */ /* w = s^-1 mod n */

View File

@ -100,7 +100,7 @@ int UnLockMutex(wolfSSL_Mutex *m)
return 0; return 0;
} }
#elif defined(CYASSL_SAFERTOS) #elif defined(WOLFSSL_SAFERTOS)
int InitMutex(wolfSSL_Mutex* m) int InitMutex(wolfSSL_Mutex* m)
{ {
@ -160,7 +160,7 @@ int UnLockMutex(wolfSSL_Mutex *m)
return 0; return 0;
} }
#elif defined(CYASSL_PTHREADS) #elif defined(WOLFSSL_PTHREADS)
int InitMutex(wolfSSL_Mutex* m) int InitMutex(wolfSSL_Mutex* m)
{ {
@ -292,7 +292,7 @@ int UnLockMutex(wolfSSL_Mutex *m)
int InitMutex(wolfSSL_Mutex* m) int InitMutex(wolfSSL_Mutex* m)
{ {
if (rtp_sig_mutex_alloc(m, "CyaSSL Mutex") == -1) if (rtp_sig_mutex_alloc(m, "wolfSSL Mutex") == -1)
return BAD_MUTEX_E; return BAD_MUTEX_E;
else else
return 0; return 0;
@ -352,7 +352,7 @@ int UnLockMutex(wolfSSL_Mutex *m)
return BAD_MUTEX_E; return BAD_MUTEX_E;
} }
#elif defined (CYASSL_TIRTOS) #elif defined (WOLFSSL_TIRTOS)
int InitMutex(wolfSSL_Mutex* m) int InitMutex(wolfSSL_Mutex* m)
{ {
@ -387,20 +387,20 @@ int UnLockMutex(wolfSSL_Mutex *m)
return 0; return 0;
} }
#elif defined(CYASSL_MDK_ARM)|| defined(CYASSL_CMSIS_RTOS) #elif defined(WOLFSSL_MDK_ARM)|| defined(WOLFSSL_CMSIS_RTOS)
#if defined(CYASSL_CMSIS_RTOS) #if defined(WOLFSSL_CMSIS_RTOS)
#include "cmsis_os.h" #include "cmsis_os.h"
#define CMSIS_NMUTEX 10 #define CMSIS_NMUTEX 10
osMutexDef(CyaSSL_mt0) ; osMutexDef(CyaSSL_mt1) ; osMutexDef(CyaSSL_mt2) ; osMutexDef(wolfSSL_mt0) ; osMutexDef(wolfSSL_mt1) ; osMutexDef(wolfSSL_mt2) ;
osMutexDef(CyaSSL_mt3) ; osMutexDef(CyaSSL_mt4) ; osMutexDef(CyaSSL_mt5) ; osMutexDef(wolfSSL_mt3) ; osMutexDef(wolfSSL_mt4) ; osMutexDef(wolfSSL_mt5) ;
osMutexDef(CyaSSL_mt6) ; osMutexDef(CyaSSL_mt7) ; osMutexDef(CyaSSL_mt8) ; osMutexDef(wolfSSL_mt6) ; osMutexDef(wolfSSL_mt7) ; osMutexDef(wolfSSL_mt8) ;
osMutexDef(CyaSSL_mt9) ; osMutexDef(wolfSSL_mt9) ;
static const osMutexDef_t *CMSIS_mutex[] = { osMutex(CyaSSL_mt0), static const osMutexDef_t *CMSIS_mutex[] = { osMutex(wolfSSL_mt0),
osMutex(CyaSSL_mt1), osMutex(CyaSSL_mt2), osMutex(CyaSSL_mt3), osMutex(wolfSSL_mt1), osMutex(wolfSSL_mt2), osMutex(wolfSSL_mt3),
osMutex(CyaSSL_mt4), osMutex(CyaSSL_mt5), osMutex(CyaSSL_mt6), osMutex(wolfSSL_mt4), osMutex(wolfSSL_mt5), osMutex(wolfSSL_mt6),
osMutex(CyaSSL_mt7), osMutex(CyaSSL_mt8), osMutex(CyaSSL_mt9) } ; osMutex(wolfSSL_mt7), osMutex(wolfSSL_mt8), osMutex(wolfSSL_mt9) } ;
static osMutexId CMSIS_mutexID[CMSIS_NMUTEX] = {0} ; static osMutexId CMSIS_mutexID[CMSIS_NMUTEX] = {0} ;

View File

@ -25,7 +25,7 @@
extern "C" { extern "C" {
#endif #endif
int ctaocrypt_test(void* args); int wolfcrypt_test(void* args);
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */

View File

@ -27,11 +27,6 @@
#include <wolfssl/wolfcrypt/types.h> #include <wolfssl/wolfcrypt/types.h>
/* for poly1305 reverse compatibility */
#define Poly1305SetKey wc_Poly1305SetKey
#define Poly1305Update wc_Poly1305Update
#define Poly1305Final wc_Poly1305Final
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -20,311 +20,322 @@
*/ */
/* Name change compatibility layer */ /* Name change compatibility layer */
#include <cyassl/ssl.h> //#include <cyassl/ssl.h>
#include <cyassl/ctaocrypt/types.h>
#ifndef WOLF_CRYPT_TYPES_H #ifndef WOLF_CRYPT_TYPES_H
#define WOLF_CRYPT_TYPES_H #define WOLF_CRYPT_TYPES_H
/* for fips compatiblity @wc_fips */
#ifdef HAVE_FIPS
#include <cyassl/ctaocrypt/types.h>
#else
/* set old macros since this is often called for visibility also */
#ifndef CYASSL_API
#define CYASSL_API WOLFSSL_API
#endif
#ifndef CYASSL_LOCAL
#define CYASSL_LOCAL WOLFSSL_LOCAL
#endif
#include <wolfssl/wolfcrypt/settings.h> #include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/wolfcrypt/wc_port.h> #include <wolfssl/wolfcrypt/wc_port.h>
// #ifdef __cplusplus #ifdef __cplusplus
// extern "C" { extern "C" {
// #endif #endif
// #if defined(WORDS_BIGENDIAN) #if defined(WORDS_BIGENDIAN)
// #define BIG_ENDIAN_ORDER #define BIG_ENDIAN_ORDER
// #endif #endif
// #ifndef BIG_ENDIAN_ORDER #ifndef BIG_ENDIAN_ORDER
// #define LITTLE_ENDIAN_ORDER #define LITTLE_ENDIAN_ORDER
// #endif #endif
// #ifndef WOLFSSL_TYPES #ifndef WOLFSSL_TYPES
// #ifndef byte #ifndef byte
// typedef unsigned char byte; typedef unsigned char byte;
// #endif #endif
// typedef unsigned short word16; typedef unsigned short word16;
// typedef unsigned int word32; typedef unsigned int word32;
// #endif #endif
// /* try to set SIZEOF_LONG or LONG_LONG if user didn't */ /* try to set SIZEOF_LONG or LONG_LONG if user didn't */
// #if !defined(_MSC_VER) && !defined(__BCPLUSPLUS__) #if !defined(_MSC_VER) && !defined(__BCPLUSPLUS__)
// #if !defined(SIZEOF_LONG_LONG) && !defined(SIZEOF_LONG) #if !defined(SIZEOF_LONG_LONG) && !defined(SIZEOF_LONG)
// #if (defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) \ #if (defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) \
// || defined(__mips64) || defined(__x86_64__)) || defined(__mips64) || defined(__x86_64__))
// /* long should be 64bit */ /* long should be 64bit */
// #define SIZEOF_LONG 8 #define SIZEOF_LONG 8
// #elif defined(__i386__) || defined(__CORTEX_M3__) #elif defined(__i386__) || defined(__CORTEX_M3__)
// /* long long should be 64bit */ /* long long should be 64bit */
// #define SIZEOF_LONG_LONG 8 #define SIZEOF_LONG_LONG 8
// #endif #endif
// #endif #endif
// #endif #endif
// #if defined(_MSC_VER) || defined(__BCPLUSPLUS__) #if defined(_MSC_VER) || defined(__BCPLUSPLUS__)
// #define WORD64_AVAILABLE #define WORD64_AVAILABLE
// #define W64LIT(x) x##ui64 #define W64LIT(x) x##ui64
// typedef unsigned __int64 word64; typedef unsigned __int64 word64;
// #elif defined(SIZEOF_LONG) && SIZEOF_LONG == 8 #elif defined(SIZEOF_LONG) && SIZEOF_LONG == 8
// #define WORD64_AVAILABLE #define WORD64_AVAILABLE
// #define W64LIT(x) x##LL #define W64LIT(x) x##LL
// typedef unsigned long word64; typedef unsigned long word64;
// #elif defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG == 8 #elif defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG == 8
// #define WORD64_AVAILABLE #define WORD64_AVAILABLE
// #define W64LIT(x) x##LL #define W64LIT(x) x##LL
// typedef unsigned long long word64; typedef unsigned long long word64;
// #elif defined(__SIZEOF_LONG_LONG__) && __SIZEOF_LONG_LONG__ == 8 #elif defined(__SIZEOF_LONG_LONG__) && __SIZEOF_LONG_LONG__ == 8
// #define WORD64_AVAILABLE #define WORD64_AVAILABLE
// #define W64LIT(x) x##LL #define W64LIT(x) x##LL
// typedef unsigned long long word64; typedef unsigned long long word64;
// #else #else
// #define MP_16BIT /* for mp_int, mp_word needs to be twice as big as #define MP_16BIT /* for mp_int, mp_word needs to be twice as big as
// mp_digit, no 64 bit type so make mp_digit 16 bit */ mp_digit, no 64 bit type so make mp_digit 16 bit */
// #endif #endif
// /* These platforms have 64-bit CPU registers. */ /* These platforms have 64-bit CPU registers. */
// #if (defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || \ #if (defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || \
// defined(__mips64) || defined(__x86_64__) || defined(_M_X64)) defined(__mips64) || defined(__x86_64__) || defined(_M_X64))
// typedef word64 wolfssl_word; typedef word64 wolfssl_word;
// #else #else
// typedef word32 wolfssl_word; typedef word32 wolfssl_word;
// #ifdef WORD64_AVAILABLE #ifdef WORD64_AVAILABLE
// #define WOLFCRYPT_SLOW_WORD64 #define WOLFCRYPT_SLOW_WORD64
// #endif #endif
// #endif #endif
// enum { enum {
// WOLFSSL_WORD_SIZE = sizeof(wolfssl_word), WOLFSSL_WORD_SIZE = sizeof(wolfssl_word),
// WOLFSSL_BIT_SIZE = 8, WOLFSSL_BIT_SIZE = 8,
// WOLFSSL_WORD_BITS = WOLFSSL_WORD_SIZE * WOLFSSL_BIT_SIZE WOLFSSL_WORD_BITS = WOLFSSL_WORD_SIZE * WOLFSSL_BIT_SIZE
// }; };
// #define WOLFSSL_MAX_16BIT 0xffffU #define WOLFSSL_MAX_16BIT 0xffffU
// /* use inlining if compiler allows */ /* use inlining if compiler allows */
// #ifndef INLINE #ifndef INLINE
// #ifndef NO_INLINE #ifndef NO_INLINE
// #ifdef _MSC_VER #ifdef _MSC_VER
// #define INLINE __inline #define INLINE __inline
// #elif defined(__GNUC__) #elif defined(__GNUC__)
// #define INLINE inline #define INLINE inline
// #elif defined(__IAR_SYSTEMS_ICC__) #elif defined(__IAR_SYSTEMS_ICC__)
// #define INLINE inline #define INLINE inline
// #elif defined(THREADX) #elif defined(THREADX)
// #define INLINE _Inline #define INLINE _Inline
// #else #else
// #define INLINE #define INLINE
// #endif #endif
// #else #else
// #define INLINE #define INLINE
// #endif #endif
// #endif #endif
// /* set up rotate style */ /* set up rotate style */
// #if defined(_MSC_VER) || defined(__BCPLUSPLUS__) #if defined(_MSC_VER) || defined(__BCPLUSPLUS__)
// #define INTEL_INTRINSICS #define INTEL_INTRINSICS
// #define FAST_ROTATE #define FAST_ROTATE
// #elif defined(__MWERKS__) && TARGET_CPU_PPC #elif defined(__MWERKS__) && TARGET_CPU_PPC
// #define PPC_INTRINSICS #define PPC_INTRINSICS
// #define FAST_ROTATE #define FAST_ROTATE
// #elif defined(__GNUC__) && defined(__i386__) #elif defined(__GNUC__) && defined(__i386__)
// /* GCC does peephole optimizations which should result in using rotate /* GCC does peephole optimizations which should result in using rotate
// instructions */ instructions */
// #define FAST_ROTATE #define FAST_ROTATE
// #endif #endif
// /* set up thread local storage if available */ /* set up thread local storage if available */
// #ifdef HAVE_THREAD_LS #ifdef HAVE_THREAD_LS
// #if defined(_MSC_VER) #if defined(_MSC_VER)
// #define THREAD_LS_T __declspec(thread) #define THREAD_LS_T __declspec(thread)
// #else #else
// #define THREAD_LS_T __thread #define THREAD_LS_T __thread
// #endif #endif
// #else #else
// #define THREAD_LS_T #define THREAD_LS_T
// #endif #endif
// /* Micrium will use Visual Studio for compilation but not the Win32 API */ /* Micrium will use Visual Studio for compilation but not the Win32 API */
// #if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) \ #if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) \
// && !defined(EBSNET) && !defined(EBSNET)
// #define USE_WINDOWS_API #define USE_WINDOWS_API
// #endif #endif
// /* idea to add global alloc override by Moisés Guimarães */ /* idea to add global alloc override by Moisés Guimarães */
// /* default to libc stuff */ /* default to libc stuff */
// /* XREALLOC is used once in normal math lib, not in fast math lib */ /* XREALLOC is used once in normal math lib, not in fast math lib */
// /* XFREE on some embeded systems doesn't like free(0) so test */ /* XFREE on some embeded systems doesn't like free(0) so test */
// #if defined(XMALLOC_USER) #if defined(XMALLOC_USER)
// /* prototypes for user heap override functions */ /* prototypes for user heap override functions */
// #include <stddef.h> /* for size_t */ #include <stddef.h> /* for size_t */
// extern void *XMALLOC(size_t n, void* heap, int type); extern void *XMALLOC(size_t n, void* heap, int type);
// extern void *XREALLOC(void *p, size_t n, void* heap, int type); extern void *XREALLOC(void *p, size_t n, void* heap, int type);
// extern void XFREE(void *p, void* heap, int type); extern void XFREE(void *p, void* heap, int type);
// #elif defined(NO_WOLFSSL_MEMORY) #elif defined(NO_WOLFSSL_MEMORY)
// /* just use plain C stdlib stuff if desired */ /* just use plain C stdlib stuff if desired */
// #include <stdlib.h> #include <stdlib.h>
// #define XMALLOC(s, h, t) ((void)h, (void)t, malloc((s))) #define XMALLOC(s, h, t) ((void)h, (void)t, malloc((s)))
// #define XFREE(p, h, t) {void* xp = (p); if((xp)) free((xp));} #define XFREE(p, h, t) {void* xp = (p); if((xp)) free((xp));}
// #define XREALLOC(p, n, h, t) realloc((p), (n)) #define XREALLOC(p, n, h, t) realloc((p), (n))
// #elif !defined(MICRIUM_MALLOC) && !defined(EBSNET) \ #elif !defined(MICRIUM_MALLOC) && !defined(EBSNET) \
// && !defined(WOLFSSL_SAFERTOS) && !defined(FREESCALE_MQX) \ && !defined(WOLFSSL_SAFERTOS) && !defined(FREESCALE_MQX) \
// && !defined(WOLFSSL_LEANPSK) && !defined(WOLFSSL_LEANPSK)
// /* default C runtime, can install different routines at runtime via cbs */ /* default C runtime, can install different routines at runtime via cbs */
// #include <wolfssl/wolfcrypt/memory.h> #include <wolfssl/wolfcrypt/memory.h>
// #define XMALLOC(s, h, t) ((void)h, (void)t, wolfSSL_Malloc((s))) #define XMALLOC(s, h, t) ((void)h, (void)t, wolfSSL_Malloc((s)))
// #define XFREE(p, h, t) {void* xp = (p); if((xp)) wolfSSL_Free((xp));} #define XFREE(p, h, t) {void* xp = (p); if((xp)) wolfSSL_Free((xp));}
// #define XREALLOC(p, n, h, t) wolfSSL_Realloc((p), (n)) #define XREALLOC(p, n, h, t) wolfSSL_Realloc((p), (n))
// #endif #endif
// #ifndef STRING_USER #ifndef STRING_USER
// #include <string.h> #include <string.h>
// char* mystrnstr(const char* s1, const char* s2, unsigned int n); char* mystrnstr(const char* s1, const char* s2, unsigned int n);
// #define XMEMCPY(d,s,l) memcpy((d),(s),(l)) #define XMEMCPY(d,s,l) memcpy((d),(s),(l))
// #define XMEMSET(b,c,l) memset((b),(c),(l)) #define XMEMSET(b,c,l) memset((b),(c),(l))
// #define XMEMCMP(s1,s2,n) memcmp((s1),(s2),(n)) #define XMEMCMP(s1,s2,n) memcmp((s1),(s2),(n))
// #define XMEMMOVE(d,s,l) memmove((d),(s),(l)) #define XMEMMOVE(d,s,l) memmove((d),(s),(l))
// #define XSTRLEN(s1) strlen((s1)) #define XSTRLEN(s1) strlen((s1))
// #define XSTRNCPY(s1,s2,n) strncpy((s1),(s2),(n)) #define XSTRNCPY(s1,s2,n) strncpy((s1),(s2),(n))
// /* strstr, strncmp, and strncat only used by wolfSSL proper, not required for /* strstr, strncmp, and strncat only used by wolfSSL proper, not required for
// CTaoCrypt only */ CTaoCrypt only */
// #define XSTRSTR(s1,s2) strstr((s1),(s2)) #define XSTRSTR(s1,s2) strstr((s1),(s2))
// #define XSTRNSTR(s1,s2,n) mystrnstr((s1),(s2),(n)) #define XSTRNSTR(s1,s2,n) mystrnstr((s1),(s2),(n))
// #define XSTRNCMP(s1,s2,n) strncmp((s1),(s2),(n)) #define XSTRNCMP(s1,s2,n) strncmp((s1),(s2),(n))
// #define XSTRNCAT(s1,s2,n) strncat((s1),(s2),(n)) #define XSTRNCAT(s1,s2,n) strncat((s1),(s2),(n))
// #ifndef USE_WINDOWS_API #ifndef USE_WINDOWS_API
// #define XSTRNCASECMP(s1,s2,n) strncasecmp((s1),(s2),(n)) #define XSTRNCASECMP(s1,s2,n) strncasecmp((s1),(s2),(n))
// #define XSNPRINTF snprintf #define XSNPRINTF snprintf
// #else #else
// #define XSTRNCASECMP(s1,s2,n) _strnicmp((s1),(s2),(n)) #define XSTRNCASECMP(s1,s2,n) _strnicmp((s1),(s2),(n))
// #define XSNPRINTF _snprintf #define XSNPRINTF _snprintf
// #endif #endif
// #endif #endif
// #ifndef CTYPE_USER #ifndef CTYPE_USER
// #include <ctype.h> #include <ctype.h>
// #if defined(HAVE_ECC) || defined(HAVE_OCSP) #if defined(HAVE_ECC) || defined(HAVE_OCSP)
// #define XTOUPPER(c) toupper((c)) #define XTOUPPER(c) toupper((c))
// #define XISALPHA(c) isalpha((c)) #define XISALPHA(c) isalpha((c))
// #endif #endif
// /* needed by wolfSSL_check_domain_name() */ /* needed by wolfSSL_check_domain_name() */
// #ifdef __CYGWIN__ #ifdef __CYGWIN__
// /* Cygwin uses a macro version of tolower() by default, use the /* Cygwin uses a macro version of tolower() by default, use the
// * function version. */ * function version. */
// #undef tolower #undef tolower
// #endif #endif
// #define XTOLOWER(c) tolower((c)) #define XTOLOWER(c) tolower((c))
// #endif #endif
// /* memory allocation types for user hints */ /* memory allocation types for user hints */
// enum { enum {
// DYNAMIC_TYPE_CA = 1, DYNAMIC_TYPE_CA = 1,
// DYNAMIC_TYPE_CERT = 2, DYNAMIC_TYPE_CERT = 2,
// DYNAMIC_TYPE_KEY = 3, DYNAMIC_TYPE_KEY = 3,
// DYNAMIC_TYPE_FILE = 4, DYNAMIC_TYPE_FILE = 4,
// DYNAMIC_TYPE_SUBJECT_CN = 5, DYNAMIC_TYPE_SUBJECT_CN = 5,
// DYNAMIC_TYPE_PUBLIC_KEY = 6, DYNAMIC_TYPE_PUBLIC_KEY = 6,
// DYNAMIC_TYPE_SIGNER = 7, DYNAMIC_TYPE_SIGNER = 7,
// DYNAMIC_TYPE_NONE = 8, DYNAMIC_TYPE_NONE = 8,
// DYNAMIC_TYPE_BIGINT = 9, DYNAMIC_TYPE_BIGINT = 9,
// DYNAMIC_TYPE_RSA = 10, DYNAMIC_TYPE_RSA = 10,
// DYNAMIC_TYPE_METHOD = 11, DYNAMIC_TYPE_METHOD = 11,
// DYNAMIC_TYPE_OUT_BUFFER = 12, DYNAMIC_TYPE_OUT_BUFFER = 12,
// DYNAMIC_TYPE_IN_BUFFER = 13, DYNAMIC_TYPE_IN_BUFFER = 13,
// DYNAMIC_TYPE_INFO = 14, DYNAMIC_TYPE_INFO = 14,
// DYNAMIC_TYPE_DH = 15, DYNAMIC_TYPE_DH = 15,
// DYNAMIC_TYPE_DOMAIN = 16, DYNAMIC_TYPE_DOMAIN = 16,
// DYNAMIC_TYPE_SSL = 17, DYNAMIC_TYPE_SSL = 17,
// DYNAMIC_TYPE_CTX = 18, DYNAMIC_TYPE_CTX = 18,
// DYNAMIC_TYPE_WRITEV = 19, DYNAMIC_TYPE_WRITEV = 19,
// DYNAMIC_TYPE_OPENSSL = 20, DYNAMIC_TYPE_OPENSSL = 20,
// DYNAMIC_TYPE_DSA = 21, DYNAMIC_TYPE_DSA = 21,
// DYNAMIC_TYPE_CRL = 22, DYNAMIC_TYPE_CRL = 22,
// DYNAMIC_TYPE_REVOKED = 23, DYNAMIC_TYPE_REVOKED = 23,
// DYNAMIC_TYPE_CRL_ENTRY = 24, DYNAMIC_TYPE_CRL_ENTRY = 24,
// DYNAMIC_TYPE_CERT_MANAGER = 25, DYNAMIC_TYPE_CERT_MANAGER = 25,
// DYNAMIC_TYPE_CRL_MONITOR = 26, DYNAMIC_TYPE_CRL_MONITOR = 26,
// DYNAMIC_TYPE_OCSP_STATUS = 27, DYNAMIC_TYPE_OCSP_STATUS = 27,
// DYNAMIC_TYPE_OCSP_ENTRY = 28, DYNAMIC_TYPE_OCSP_ENTRY = 28,
// DYNAMIC_TYPE_ALTNAME = 29, DYNAMIC_TYPE_ALTNAME = 29,
// DYNAMIC_TYPE_SUITES = 30, DYNAMIC_TYPE_SUITES = 30,
// DYNAMIC_TYPE_CIPHER = 31, DYNAMIC_TYPE_CIPHER = 31,
// DYNAMIC_TYPE_RNG = 32, DYNAMIC_TYPE_RNG = 32,
// DYNAMIC_TYPE_ARRAYS = 33, DYNAMIC_TYPE_ARRAYS = 33,
// DYNAMIC_TYPE_DTLS_POOL = 34, DYNAMIC_TYPE_DTLS_POOL = 34,
// DYNAMIC_TYPE_SOCKADDR = 35, DYNAMIC_TYPE_SOCKADDR = 35,
// DYNAMIC_TYPE_LIBZ = 36, DYNAMIC_TYPE_LIBZ = 36,
// DYNAMIC_TYPE_ECC = 37, DYNAMIC_TYPE_ECC = 37,
// DYNAMIC_TYPE_TMP_BUFFER = 38, DYNAMIC_TYPE_TMP_BUFFER = 38,
// DYNAMIC_TYPE_DTLS_MSG = 39, DYNAMIC_TYPE_DTLS_MSG = 39,
// DYNAMIC_TYPE_CAVIUM_TMP = 40, DYNAMIC_TYPE_CAVIUM_TMP = 40,
// DYNAMIC_TYPE_CAVIUM_RSA = 41, DYNAMIC_TYPE_CAVIUM_RSA = 41,
// DYNAMIC_TYPE_X509 = 42, DYNAMIC_TYPE_X509 = 42,
// DYNAMIC_TYPE_TLSX = 43, DYNAMIC_TYPE_TLSX = 43,
// DYNAMIC_TYPE_OCSP = 44, DYNAMIC_TYPE_OCSP = 44,
// DYNAMIC_TYPE_SIGNATURE = 45 DYNAMIC_TYPE_SIGNATURE = 45
// }; };
// /* max error buffer string size */ /* max error buffer string size */
// enum { enum {
// WOLFSSL_MAX_ERROR_SZ = 80 WOLFSSL_MAX_ERROR_SZ = 80
// }; };
// /* stack protection */ /* stack protection */
// enum { enum {
// MIN_STACK_BUFFER = 8 MIN_STACK_BUFFER = 8
// }; };
// /* settings detection for compile vs runtime math incombatibilities */ /* settings detection for compile vs runtime math incombatibilities */
// enum { enum {
// #if !defined(USE_FAST_MATH) && !defined(SIZEOF_LONG) && !defined(SIZEOF_LONG_LONG) #if !defined(USE_FAST_MATH) && !defined(SIZEOF_LONG) && !defined(SIZEOF_LONG_LONG)
// CTC_SETTINGS = 0x0 CTC_SETTINGS = 0x0
// #elif !defined(USE_FAST_MATH) && defined(SIZEOF_LONG) && (SIZEOF_LONG == 8) #elif !defined(USE_FAST_MATH) && defined(SIZEOF_LONG) && (SIZEOF_LONG == 8)
// CTC_SETTINGS = 0x1 CTC_SETTINGS = 0x1
// #elif !defined(USE_FAST_MATH) && defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 8) #elif !defined(USE_FAST_MATH) && defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 8)
// CTC_SETTINGS = 0x2 CTC_SETTINGS = 0x2
// #elif !defined(USE_FAST_MATH) && defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 4) #elif !defined(USE_FAST_MATH) && defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 4)
// CTC_SETTINGS = 0x4 CTC_SETTINGS = 0x4
// #elif defined(USE_FAST_MATH) && !defined(SIZEOF_LONG) && !defined(SIZEOF_LONG_LONG) #elif defined(USE_FAST_MATH) && !defined(SIZEOF_LONG) && !defined(SIZEOF_LONG_LONG)
// CTC_SETTINGS = 0x8 CTC_SETTINGS = 0x8
// #elif defined(USE_FAST_MATH) && defined(SIZEOF_LONG) && (SIZEOF_LONG == 8) #elif defined(USE_FAST_MATH) && defined(SIZEOF_LONG) && (SIZEOF_LONG == 8)
// CTC_SETTINGS = 0x10 CTC_SETTINGS = 0x10
// #elif defined(USE_FAST_MATH) && defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 8) #elif defined(USE_FAST_MATH) && defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 8)
// CTC_SETTINGS = 0x20 CTC_SETTINGS = 0x20
// #elif defined(USE_FAST_MATH) && defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 4) #elif defined(USE_FAST_MATH) && defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 4)
// CTC_SETTINGS = 0x40 CTC_SETTINGS = 0x40
// #else #else
// #error "bad math long / long long settings" #error "bad math long / long long settings"
// #endif #endif
// }; };
// WOLFSSL_API word32 CheckRunTimeSettings(void); WOLFSSL_API word32 CheckRunTimeSettings(void);
// /* If user uses RSA, DH, DSA, or ECC math lib directly then fast math and long /* If user uses RSA, DH, DSA, or ECC math lib directly then fast math and long
// types need to match at compile time and run time, CheckCtcSettings will types need to match at compile time and run time, CheckCtcSettings will
// return 1 if a match otherwise 0 */ return 1 if a match otherwise 0 */
// #define CheckCtcSettings() (CTC_SETTINGS == CheckRunTimeSettings()) #define CheckCtcSettings() (CTC_SETTINGS == CheckRunTimeSettings())
// #ifdef __cplusplus #ifdef __cplusplus
// } /* extern "C" */ } /* extern "C" */
// #endif #endif
#endif /* HAVE_FIPS */
#endif /* WOLF_CRYPT_TYPES_H */ #endif /* WOLF_CRYPT_TYPES_H */

View File

@ -31,7 +31,7 @@
WOLFSSL_LOCAL is used for non-API symbols (private). WOLFSSL_LOCAL is used for non-API symbols (private).
*/ */
//#if defined(BUILDING_WOLFSSL) #if defined(BUILDING_WOLFSSL)
#if defined(HAVE_VISIBILITY) && HAVE_VISIBILITY #if defined(HAVE_VISIBILITY) && HAVE_VISIBILITY
#define WOLFSSL_API __attribute__ ((visibility("default"))) #define WOLFSSL_API __attribute__ ((visibility("default")))
#define WOLFSSL_LOCAL __attribute__ ((visibility("hidden"))) #define WOLFSSL_LOCAL __attribute__ ((visibility("hidden")))
@ -49,19 +49,19 @@
#define WOLFSSL_API #define WOLFSSL_API
#define WOLFSSL_LOCAL #define WOLFSSL_LOCAL
#endif /* HAVE_VISIBILITY */ #endif /* HAVE_VISIBILITY */
//#else /* BUILDING_WOLFSSL */ #else /* BUILDING_WOLFSSL */
// #if defined(_MSC_VER) #if defined(_MSC_VER)
// #ifdef WOLFSSL_DLL #ifdef WOLFSSL_DLL
// #define WOLFSSL_API extern __declspec(dllimport) #define WOLFSSL_API extern __declspec(dllimport)
// #else #else
// #define WOLFSSL_API #define WOLFSSL_API
// #endif #endif
// #define WOLFSSL_LOCAL #define WOLFSSL_LOCAL
// #else #else
// #define WOLFSSL_API #define WOLFSSL_API
// #define WOLFSSL_LOCAL #define WOLFSSL_LOCAL
// #endif #endif
//#endif /* BUILDING_WOLFSSL */ #endif /* BUILDING_WOLFSSL */
#endif /* WOLF_CRYPT_VISIBILITY_H */ #endif /* WOLF_CRYPT_VISIBILITY_H */