Merge branch 'kojo-mdk5'

This commit is contained in:
toddouska
2015-09-01 13:35:47 -07:00
17 changed files with 767 additions and 691 deletions

View File

@@ -106,8 +106,9 @@ static INLINE int blake2b_init0( blake2b_state *S )
int blake2b_init_param( blake2b_state *S, const blake2b_param *P )
{
word32 i;
byte *p ;
blake2b_init0( S );
byte *p = ( byte * )( P );
p = ( byte * )( P );
/* IV XOR ParamBlock */
for( i = 0; i < 8; ++i )

View File

@@ -217,33 +217,35 @@ void sc_muladd(byte* out, const byte* a, const byte* b, const byte* c)
* t is x*y.
*/
const ge_p3 ed25519_base = {
.X = {
{
0x1a, 0xd5, 0x25, 0x8f, 0x60, 0x2d, 0x56, 0xc9,
0xb2, 0xa7, 0x25, 0x95, 0x60, 0xc7, 0x2c, 0x69,
0x5c, 0xdc, 0xd6, 0xfd, 0x31, 0xe2, 0xa4, 0xc0,
0xfe, 0x53, 0x6e, 0xcd, 0xd3, 0x36, 0x69, 0x21
},
.Y = {
{
0x58, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66
},
.T = {
{1, 0},
{
0xa3, 0xdd, 0xb7, 0xa5, 0xb3, 0x8a, 0xde, 0x6d,
0xf5, 0x52, 0x51, 0x77, 0x80, 0x9f, 0xf0, 0x20,
0x7d, 0xe3, 0xab, 0x64, 0x8e, 0x4e, 0xea, 0x66,
0x65, 0x76, 0x8b, 0xd7, 0x0f, 0x5f, 0x87, 0x67
},
.Z = {1, 0}
};
const ge_p3 ed25519_neutral = {
.X = {0},
.Y = {1, 0},
.T = {0},
.Z = {1, 0}
{0},
{1, 0},
{1, 0},
{0},
};

View File

@@ -32,6 +32,7 @@
#ifdef HAVE_ED25519
#include <wolfssl/wolfcrypt/ge_operations.h>
#include <wolfssl/wolfcrypt/ed25519.h>
#include <wolfssl/wolfcrypt/error-crypt.h>
#ifdef NO_INLINE
#include <wolfssl/wolfcrypt/misc.h>
@@ -690,7 +691,7 @@ int ge_compress_key(byte* out, const byte* xIn, const byte* yIn, word32 keySz)
{
fe x,y,z;
ge_p3 g;
byte bArray[keySz];
byte bArray[ED25519_KEY_SIZE];
word32 i;
fe_0(x);

View File

@@ -743,42 +743,35 @@ static INLINE int GetHashSizeByType(int type)
#ifndef NO_MD5
case MD5:
return MD5_DIGEST_SIZE;
break;
#endif
#ifndef NO_SHA
case SHA:
return SHA_DIGEST_SIZE;
break;
#endif
#ifndef NO_SHA256
case SHA256:
return SHA256_DIGEST_SIZE;
break;
#endif
#ifdef WOLFSSL_SHA384
case SHA384:
return SHA384_DIGEST_SIZE;
break;
#endif
#ifdef WOLFSSL_SHA512
case SHA512:
return SHA512_DIGEST_SIZE;
break;
#endif
#ifdef HAVE_BLAKE2
case BLAKE2B_ID:
return BLAKE2B_OUTBYTES;
break;
#endif
default:
return BAD_FUNC_ARG;
break;
}
}

View File

@@ -430,14 +430,17 @@ int wc_PKCS7_EncodeSignedData(PKCS7* pkcs7, byte* output, word32 outputSz)
{ ASN_OBJECT_ID, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01,
0x09, 0x04 };
PKCS7Attrib cannedAttribs[2] =
{
{ contentTypeOid, sizeof(contentTypeOid),
contentType, sizeof(contentType) },
{ messageDigestOid, sizeof(messageDigestOid),
esd->contentDigest, sizeof(esd->contentDigest) }
};
PKCS7Attrib cannedAttribs[2] ;
word32 cannedAttribsCount = sizeof(cannedAttribs)/sizeof(PKCS7Attrib);
cannedAttribs[0].oid = contentTypeOid ;
cannedAttribs[0].oidSz = sizeof(contentTypeOid) ;
cannedAttribs[0].value = contentType ;
cannedAttribs[0].valueSz = sizeof(contentType) ;
cannedAttribs[1].oid = messageDigestOid ;
cannedAttribs[1].oidSz = sizeof(messageDigestOid) ;
cannedAttribs[1].value = esd->contentDigest ;
cannedAttribs[1].valueSz = sizeof(esd->contentDigest) ;
esd->signedAttribsCount += cannedAttribsCount;
esd->signedAttribsSz += EncodeAttributes(&esd->signedAttribs[0], 2,
@@ -881,14 +884,15 @@ int wc_PKCS7_VerifySignedData(PKCS7* pkcs7, byte* pkiMsg, word32 pkiMsgSz)
{
word32 scratch = 0;
int plainSz = 0;
int digestSz = MAX_SEQ_SZ + MAX_ALGO_SZ +
MAX_OCTET_STR_SZ + SHA_DIGEST_SIZE;
#define MAX_PKCS7_DIGEST_SZ (MAX_SEQ_SZ + MAX_ALGO_SZ +\
MAX_OCTET_STR_SZ + SHA_DIGEST_SIZE)
#ifdef WOLFSSL_SMALL_STACK
byte* digest;
RsaKey* key;
digest = (byte*)XMALLOC(digestSz, NULL, DYNAMIC_TYPE_TMP_BUFFER);
digest = (byte*)XMALLOC(MAX_PKCS7_DIGEST_SZ, NULL,
DYNAMIC_TYPE_TMP_BUFFER);
if (digest == NULL)
return MEMORY_E;
@@ -900,12 +904,12 @@ int wc_PKCS7_VerifySignedData(PKCS7* pkcs7, byte* pkiMsg, word32 pkiMsgSz)
return MEMORY_E;
}
#else
byte digest[digestSz];
byte digest[MAX_PKCS7_DIGEST_SZ];
RsaKey stack_key;
RsaKey* key = &stack_key;
#endif
XMEMSET(digest, 0, digestSz);
XMEMSET(digest, 0, MAX_PKCS7_DIGEST_SZ);
ret = wc_InitRsaKey(key, NULL);
if (ret != 0) {
@@ -925,7 +929,8 @@ int wc_PKCS7_VerifySignedData(PKCS7* pkcs7, byte* pkiMsg, word32 pkiMsgSz)
return PUBLIC_KEY_E;
}
plainSz = wc_RsaSSL_Verify(sig, sigSz, digest, digestSz, key);
plainSz = wc_RsaSSL_Verify(sig, sigSz, digest, MAX_PKCS7_DIGEST_SZ,
key);
wc_FreeRsaKey(key);
#ifdef WOLFSSL_SMALL_STACK

View File

@@ -876,7 +876,7 @@ static int wc_InitRng_IntelRD()
#if defined(HAVE_HASHDRBG) || defined(NO_RC4)
/* return 0 on success */
static inline int IntelRDseed32(unsigned int *seed)
static INLINE int IntelRDseed32(unsigned int *seed)
{
int rdseed; unsigned char ok ;
@@ -889,7 +889,7 @@ static inline int IntelRDseed32(unsigned int *seed)
}
/* return 0 on success */
static inline int IntelRDseed32_r(unsigned int *rnd)
static INLINE int IntelRDseed32_r(unsigned int *rnd)
{
int i ;
for(i=0; i<INTELRD_RETRY;i++) {
@@ -924,7 +924,7 @@ static int wc_GenerateSeed_IntelRD(OS_Seed* os, byte* output, word32 sz)
#else
/* return 0 on success */
static inline int IntelRDrand32(unsigned int *rnd)
static INLINE int IntelRDrand32(unsigned int *rnd)
{
int rdrand; unsigned char ok ;
__asm__ volatile("rdrand %0; setc %1":"=r"(rdrand), "=qm"(ok));
@@ -936,7 +936,7 @@ static inline int IntelRDrand32(unsigned int *rnd)
}
/* return 0 on success */
static inline int IntelRDrand32_r(unsigned int *rnd)
static INLINE int IntelRDrand32_r(unsigned int *rnd)
{
int i ;
for(i=0; i<INTELRD_RETRY;i++) {
@@ -1182,7 +1182,8 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
#elif defined(WOLFSSL_SAFERTOS) || defined(WOLFSSL_LEANPSK) \
|| defined(WOLFSSL_IAR_ARM) || defined(WOLFSSL_MDK_ARM) \
|| defined(WOLFSSL_uITRON4) || defined(WOLFSSL_uTKERNEL2)
|| defined(WOLFSSL_uITRON4) || defined(WOLFSSL_uTKERNEL2)\
|| defined(WOLFSSL_GENSEED_FORTEST)
#warning "write a real random seed!!!!, just for testing now"

View File

@@ -140,13 +140,13 @@ int InitSha512(Sha512* sha512) {
#if defined(HAVE_INTEL_AVX1)
XMM Instructions/inline asm Definitions
XMM Instructions/INLINE asm Definitions
#endif
#if defined(HAVE_INTEL_AVX2)
YMM Instructions/inline asm Definitions
YMM Instructions/INLINE asm Definitions
#endif
@@ -621,7 +621,7 @@ int wc_Sha512Final(Sha512* sha512, byte* hash)
#define Ry_3(i, w) h(i)+=S0(a(i))+Maj(a(i),b(i),c(i));
#endif
#if defined(HAVE_INTEL_AVX1) /* inline Assember for Intel AVX1 instructions */
#if defined(HAVE_INTEL_AVX1) /* INLINE Assember for Intel AVX1 instructions */
#if defined(DEBUG_XMM)
#define SAVE_REG(i) __asm__ volatile("vmovdqu %%xmm"#i", %0 \n\t":"=m"(reg[i][0])::XMM_REGs);
@@ -785,57 +785,57 @@ static word64 mBYTE_FLIP_MASK[] = { 0x0001020304050607, 0x08090a0b0c0d0e0f } ;
if((i)==0)\
MOVE_to_MEM(W_X,16, W_I) ;\
static inline void Block_0_1(word64 *W_X) { Block_xx_1(0) ; }
static inline void Block_0_2(word64 *W_X) { Block_xx_2(0) ; }
static inline void Block_0_3(void) { Block_xx_3(0) ; }
static inline void Block_0_4(void) { Block_xx_4(0) ; }
static inline void Block_0_5(void) { Block_xx_5(0) ; }
static inline void Block_0_6(word64 *W_X) { Block_xx_6(0) ; }
static inline void Block_0_7(word64 *W_X) { Block_xx_7(2) ; }
static inline void Block_0_8(word64 *W_X) { Block_xx_8(2) ; }
static inline void Block_0_9(void) { Block_xx_9(2) ; }
static inline void Block_0_10(void){ Block_xx_10(2) ; }
static inline void Block_0_11(void){ Block_xx_11(2) ; }
static inline void Block_0_12(word64 *W_X){ Block_xx_12(2) ; }
static INLINE void Block_0_1(word64 *W_X) { Block_xx_1(0) ; }
static INLINE void Block_0_2(word64 *W_X) { Block_xx_2(0) ; }
static INLINE void Block_0_3(void) { Block_xx_3(0) ; }
static INLINE void Block_0_4(void) { Block_xx_4(0) ; }
static INLINE void Block_0_5(void) { Block_xx_5(0) ; }
static INLINE void Block_0_6(word64 *W_X) { Block_xx_6(0) ; }
static INLINE void Block_0_7(word64 *W_X) { Block_xx_7(2) ; }
static INLINE void Block_0_8(word64 *W_X) { Block_xx_8(2) ; }
static INLINE void Block_0_9(void) { Block_xx_9(2) ; }
static INLINE void Block_0_10(void){ Block_xx_10(2) ; }
static INLINE void Block_0_11(void){ Block_xx_11(2) ; }
static INLINE void Block_0_12(word64 *W_X){ Block_xx_12(2) ; }
static inline void Block_4_1(word64 *W_X) { Block_xx_1(4) ; }
static inline void Block_4_2(word64 *W_X) { Block_xx_2(4) ; }
static inline void Block_4_3(void) { Block_xx_3(4) ; }
static inline void Block_4_4(void) { Block_xx_4(4) ; }
static inline void Block_4_5(void) { Block_xx_5(4) ; }
static inline void Block_4_6(word64 *W_X) { Block_xx_6(4) ; }
static inline void Block_4_7(word64 *W_X) { Block_xx_7(6) ; }
static inline void Block_4_8(word64 *W_X) { Block_xx_8(6) ; }
static inline void Block_4_9(void) { Block_xx_9(6) ; }
static inline void Block_4_10(void){ Block_xx_10(6) ; }
static inline void Block_4_11(void){ Block_xx_11(6) ; }
static inline void Block_4_12(word64 *W_X){ Block_xx_12(6) ; }
static INLINE void Block_4_1(word64 *W_X) { Block_xx_1(4) ; }
static INLINE void Block_4_2(word64 *W_X) { Block_xx_2(4) ; }
static INLINE void Block_4_3(void) { Block_xx_3(4) ; }
static INLINE void Block_4_4(void) { Block_xx_4(4) ; }
static INLINE void Block_4_5(void) { Block_xx_5(4) ; }
static INLINE void Block_4_6(word64 *W_X) { Block_xx_6(4) ; }
static INLINE void Block_4_7(word64 *W_X) { Block_xx_7(6) ; }
static INLINE void Block_4_8(word64 *W_X) { Block_xx_8(6) ; }
static INLINE void Block_4_9(void) { Block_xx_9(6) ; }
static INLINE void Block_4_10(void){ Block_xx_10(6) ; }
static INLINE void Block_4_11(void){ Block_xx_11(6) ; }
static INLINE void Block_4_12(word64 *W_X){ Block_xx_12(6) ; }
static inline void Block_8_1(word64 *W_X) { Block_xx_1(8) ; }
static inline void Block_8_2(word64 *W_X) { Block_xx_2(8) ; }
static inline void Block_8_3(void) { Block_xx_3(8) ; }
static inline void Block_8_4(void) { Block_xx_4(8) ; }
static inline void Block_8_5(void) { Block_xx_5(8) ; }
static inline void Block_8_6(word64 *W_X) { Block_xx_6(8) ; }
static inline void Block_8_7(word64 *W_X) { Block_xx_7(10) ; }
static inline void Block_8_8(word64 *W_X) { Block_xx_8(10) ; }
static inline void Block_8_9(void) { Block_xx_9(10) ; }
static inline void Block_8_10(void){ Block_xx_10(10) ; }
static inline void Block_8_11(void){ Block_xx_11(10) ; }
static inline void Block_8_12(word64 *W_X){ Block_xx_12(10) ; }
static INLINE void Block_8_1(word64 *W_X) { Block_xx_1(8) ; }
static INLINE void Block_8_2(word64 *W_X) { Block_xx_2(8) ; }
static INLINE void Block_8_3(void) { Block_xx_3(8) ; }
static INLINE void Block_8_4(void) { Block_xx_4(8) ; }
static INLINE void Block_8_5(void) { Block_xx_5(8) ; }
static INLINE void Block_8_6(word64 *W_X) { Block_xx_6(8) ; }
static INLINE void Block_8_7(word64 *W_X) { Block_xx_7(10) ; }
static INLINE void Block_8_8(word64 *W_X) { Block_xx_8(10) ; }
static INLINE void Block_8_9(void) { Block_xx_9(10) ; }
static INLINE void Block_8_10(void){ Block_xx_10(10) ; }
static INLINE void Block_8_11(void){ Block_xx_11(10) ; }
static INLINE void Block_8_12(word64 *W_X){ Block_xx_12(10) ; }
static inline void Block_12_1(word64 *W_X) { Block_xx_1(12) ; }
static inline void Block_12_2(word64 *W_X) { Block_xx_2(12) ; }
static inline void Block_12_3(void) { Block_xx_3(12) ; }
static inline void Block_12_4(void) { Block_xx_4(12) ; }
static inline void Block_12_5(void) { Block_xx_5(12) ; }
static inline void Block_12_6(word64 *W_X) { Block_xx_6(12) ; }
static inline void Block_12_7(word64 *W_X) { Block_xx_7(14) ; }
static inline void Block_12_8(word64 *W_X) { Block_xx_8(14) ; }
static inline void Block_12_9(void) { Block_xx_9(14) ; }
static inline void Block_12_10(void){ Block_xx_10(14) ; }
static inline void Block_12_11(void){ Block_xx_11(14) ; }
static inline void Block_12_12(word64 *W_X){ Block_xx_12(14) ; }
static INLINE void Block_12_1(word64 *W_X) { Block_xx_1(12) ; }
static INLINE void Block_12_2(word64 *W_X) { Block_xx_2(12) ; }
static INLINE void Block_12_3(void) { Block_xx_3(12) ; }
static INLINE void Block_12_4(void) { Block_xx_4(12) ; }
static INLINE void Block_12_5(void) { Block_xx_5(12) ; }
static INLINE void Block_12_6(word64 *W_X) { Block_xx_6(12) ; }
static INLINE void Block_12_7(word64 *W_X) { Block_xx_7(14) ; }
static INLINE void Block_12_8(word64 *W_X) { Block_xx_8(14) ; }
static INLINE void Block_12_9(void) { Block_xx_9(14) ; }
static INLINE void Block_12_10(void){ Block_xx_10(14) ; }
static INLINE void Block_12_11(void){ Block_xx_11(14) ; }
static INLINE void Block_12_12(word64 *W_X){ Block_xx_12(14) ; }
#endif
@@ -1165,57 +1165,57 @@ static int Transform_AVX1_RORX(Sha512* sha512)
MOVE_to_MEMy(w,0, w_4) ;\
static inline void Block_Y_0_1(void) { Block_Y_xx_1(0, W_0y, W_4y, W_8y, W_12y) ; }
static inline void Block_Y_0_2(void) { Block_Y_xx_2(0, W_0y, W_4y, W_8y, W_12y) ; }
static inline void Block_Y_0_3(void) { Block_Y_xx_3(0, W_0y, W_4y, W_8y, W_12y) ; }
static inline void Block_Y_0_4(void) { Block_Y_xx_4(0, W_0y, W_4y, W_8y, W_12y) ; }
static inline void Block_Y_0_5(void) { Block_Y_xx_5(0, W_0y, W_4y, W_8y, W_12y) ; }
static inline void Block_Y_0_6(void) { Block_Y_xx_6(0, W_0y, W_4y, W_8y, W_12y) ; }
static inline void Block_Y_0_7(void) { Block_Y_xx_7(0, W_0y, W_4y, W_8y, W_12y) ; }
static inline void Block_Y_0_8(void) { Block_Y_xx_8(0, W_0y, W_4y, W_8y, W_12y) ; }
static inline void Block_Y_0_9(void) { Block_Y_xx_9(0, W_0y, W_4y, W_8y, W_12y) ; }
static inline void Block_Y_0_10(void){ Block_Y_xx_10(0, W_0y, W_4y, W_8y, W_12y) ; }
static inline void Block_Y_0_11(void){ Block_Y_xx_11(0, W_0y, W_4y, W_8y, W_12y) ; }
static inline void Block_Y_0_12(word64 *w){ Block_Y_xx_12(0, W_0y, W_4y, W_8y, W_12y) ; }
static INLINE void Block_Y_0_1(void) { Block_Y_xx_1(0, W_0y, W_4y, W_8y, W_12y) ; }
static INLINE void Block_Y_0_2(void) { Block_Y_xx_2(0, W_0y, W_4y, W_8y, W_12y) ; }
static INLINE void Block_Y_0_3(void) { Block_Y_xx_3(0, W_0y, W_4y, W_8y, W_12y) ; }
static INLINE void Block_Y_0_4(void) { Block_Y_xx_4(0, W_0y, W_4y, W_8y, W_12y) ; }
static INLINE void Block_Y_0_5(void) { Block_Y_xx_5(0, W_0y, W_4y, W_8y, W_12y) ; }
static INLINE void Block_Y_0_6(void) { Block_Y_xx_6(0, W_0y, W_4y, W_8y, W_12y) ; }
static INLINE void Block_Y_0_7(void) { Block_Y_xx_7(0, W_0y, W_4y, W_8y, W_12y) ; }
static INLINE void Block_Y_0_8(void) { Block_Y_xx_8(0, W_0y, W_4y, W_8y, W_12y) ; }
static INLINE void Block_Y_0_9(void) { Block_Y_xx_9(0, W_0y, W_4y, W_8y, W_12y) ; }
static INLINE void Block_Y_0_10(void){ Block_Y_xx_10(0, W_0y, W_4y, W_8y, W_12y) ; }
static INLINE void Block_Y_0_11(void){ Block_Y_xx_11(0, W_0y, W_4y, W_8y, W_12y) ; }
static INLINE void Block_Y_0_12(word64 *w){ Block_Y_xx_12(0, W_0y, W_4y, W_8y, W_12y) ; }
static inline void Block_Y_4_1(void) { Block_Y_xx_1(4, W_4y, W_8y, W_12y, W_0y) ; }
static inline void Block_Y_4_2(void) { Block_Y_xx_2(4, W_4y, W_8y, W_12y, W_0y) ; }
static inline void Block_Y_4_3(void) { Block_Y_xx_3(4, W_4y, W_8y, W_12y, W_0y) ; }
static inline void Block_Y_4_4(void) { Block_Y_xx_4(4, W_4y, W_8y, W_12y, W_0y) ; }
static inline void Block_Y_4_5(void) { Block_Y_xx_5(4, W_4y, W_8y, W_12y, W_0y) ; }
static inline void Block_Y_4_6(void) { Block_Y_xx_6(4, W_4y, W_8y, W_12y, W_0y) ; }
static inline void Block_Y_4_7(void) { Block_Y_xx_7(4, W_4y, W_8y, W_12y, W_0y) ; }
static inline void Block_Y_4_8(void) { Block_Y_xx_8(4, W_4y, W_8y, W_12y, W_0y) ; }
static inline void Block_Y_4_9(void) { Block_Y_xx_9(4, W_4y, W_8y, W_12y, W_0y) ; }
static inline void Block_Y_4_10(void) { Block_Y_xx_10(4, W_4y, W_8y, W_12y, W_0y) ; }
static inline void Block_Y_4_11(void) { Block_Y_xx_11(4, W_4y, W_8y, W_12y, W_0y) ; }
static inline void Block_Y_4_12(word64 *w) { Block_Y_xx_12(4, W_4y, W_8y, W_12y, W_0y) ; }
static INLINE void Block_Y_4_1(void) { Block_Y_xx_1(4, W_4y, W_8y, W_12y, W_0y) ; }
static INLINE void Block_Y_4_2(void) { Block_Y_xx_2(4, W_4y, W_8y, W_12y, W_0y) ; }
static INLINE void Block_Y_4_3(void) { Block_Y_xx_3(4, W_4y, W_8y, W_12y, W_0y) ; }
static INLINE void Block_Y_4_4(void) { Block_Y_xx_4(4, W_4y, W_8y, W_12y, W_0y) ; }
static INLINE void Block_Y_4_5(void) { Block_Y_xx_5(4, W_4y, W_8y, W_12y, W_0y) ; }
static INLINE void Block_Y_4_6(void) { Block_Y_xx_6(4, W_4y, W_8y, W_12y, W_0y) ; }
static INLINE void Block_Y_4_7(void) { Block_Y_xx_7(4, W_4y, W_8y, W_12y, W_0y) ; }
static INLINE void Block_Y_4_8(void) { Block_Y_xx_8(4, W_4y, W_8y, W_12y, W_0y) ; }
static INLINE void Block_Y_4_9(void) { Block_Y_xx_9(4, W_4y, W_8y, W_12y, W_0y) ; }
static INLINE void Block_Y_4_10(void) { Block_Y_xx_10(4, W_4y, W_8y, W_12y, W_0y) ; }
static INLINE void Block_Y_4_11(void) { Block_Y_xx_11(4, W_4y, W_8y, W_12y, W_0y) ; }
static INLINE void Block_Y_4_12(word64 *w) { Block_Y_xx_12(4, W_4y, W_8y, W_12y, W_0y) ; }
static inline void Block_Y_8_1(void) { Block_Y_xx_1(8, W_8y, W_12y, W_0y, W_4y) ; }
static inline void Block_Y_8_2(void) { Block_Y_xx_2(8, W_8y, W_12y, W_0y, W_4y) ; }
static inline void Block_Y_8_3(void) { Block_Y_xx_3(8, W_8y, W_12y, W_0y, W_4y) ; }
static inline void Block_Y_8_4(void) { Block_Y_xx_4(8, W_8y, W_12y, W_0y, W_4y) ; }
static inline void Block_Y_8_5(void) { Block_Y_xx_5(8, W_8y, W_12y, W_0y, W_4y) ; }
static inline void Block_Y_8_6(void) { Block_Y_xx_6(8, W_8y, W_12y, W_0y, W_4y) ; }
static inline void Block_Y_8_7(void) { Block_Y_xx_7(8, W_8y, W_12y, W_0y, W_4y) ; }
static inline void Block_Y_8_8(void) { Block_Y_xx_8(8, W_8y, W_12y, W_0y, W_4y) ; }
static inline void Block_Y_8_9(void) { Block_Y_xx_9(8, W_8y, W_12y, W_0y, W_4y) ; }
static inline void Block_Y_8_10(void) { Block_Y_xx_10(8, W_8y, W_12y, W_0y, W_4y) ; }
static inline void Block_Y_8_11(void) { Block_Y_xx_11(8, W_8y, W_12y, W_0y, W_4y) ; }
static inline void Block_Y_8_12(word64 *w) { Block_Y_xx_12(8, W_8y, W_12y, W_0y, W_4y) ; }
static INLINE void Block_Y_8_1(void) { Block_Y_xx_1(8, W_8y, W_12y, W_0y, W_4y) ; }
static INLINE void Block_Y_8_2(void) { Block_Y_xx_2(8, W_8y, W_12y, W_0y, W_4y) ; }
static INLINE void Block_Y_8_3(void) { Block_Y_xx_3(8, W_8y, W_12y, W_0y, W_4y) ; }
static INLINE void Block_Y_8_4(void) { Block_Y_xx_4(8, W_8y, W_12y, W_0y, W_4y) ; }
static INLINE void Block_Y_8_5(void) { Block_Y_xx_5(8, W_8y, W_12y, W_0y, W_4y) ; }
static INLINE void Block_Y_8_6(void) { Block_Y_xx_6(8, W_8y, W_12y, W_0y, W_4y) ; }
static INLINE void Block_Y_8_7(void) { Block_Y_xx_7(8, W_8y, W_12y, W_0y, W_4y) ; }
static INLINE void Block_Y_8_8(void) { Block_Y_xx_8(8, W_8y, W_12y, W_0y, W_4y) ; }
static INLINE void Block_Y_8_9(void) { Block_Y_xx_9(8, W_8y, W_12y, W_0y, W_4y) ; }
static INLINE void Block_Y_8_10(void) { Block_Y_xx_10(8, W_8y, W_12y, W_0y, W_4y) ; }
static INLINE void Block_Y_8_11(void) { Block_Y_xx_11(8, W_8y, W_12y, W_0y, W_4y) ; }
static INLINE void Block_Y_8_12(word64 *w) { Block_Y_xx_12(8, W_8y, W_12y, W_0y, W_4y) ; }
static inline void Block_Y_12_1(void) { Block_Y_xx_1(12, W_12y, W_0y, W_4y, W_8y) ; }
static inline void Block_Y_12_2(void) { Block_Y_xx_2(12, W_12y, W_0y, W_4y, W_8y) ; }
static inline void Block_Y_12_3(void) { Block_Y_xx_3(12, W_12y, W_0y, W_4y, W_8y) ; }
static inline void Block_Y_12_4(void) { Block_Y_xx_4(12, W_12y, W_0y, W_4y, W_8y) ; }
static inline void Block_Y_12_5(void) { Block_Y_xx_5(12, W_12y, W_0y, W_4y, W_8y) ; }
static inline void Block_Y_12_6(void) { Block_Y_xx_6(12, W_12y, W_0y, W_4y, W_8y) ; }
static inline void Block_Y_12_7(void) { Block_Y_xx_7(12, W_12y, W_0y, W_4y, W_8y) ; }
static inline void Block_Y_12_8(void) { Block_Y_xx_8(12, W_12y, W_0y, W_4y, W_8y) ; }
static inline void Block_Y_12_9(void) { Block_Y_xx_9(12, W_12y, W_0y, W_4y, W_8y) ; }
static inline void Block_Y_12_10(void) { Block_Y_xx_10(12, W_12y, W_0y, W_4y, W_8y) ; }
static inline void Block_Y_12_11(void) { Block_Y_xx_11(12, W_12y, W_0y, W_4y, W_8y) ; }
static inline void Block_Y_12_12(word64 *w) { Block_Y_xx_12(12, W_12y, W_0y, W_4y, W_8y) ; }
static INLINE void Block_Y_12_1(void) { Block_Y_xx_1(12, W_12y, W_0y, W_4y, W_8y) ; }
static INLINE void Block_Y_12_2(void) { Block_Y_xx_2(12, W_12y, W_0y, W_4y, W_8y) ; }
static INLINE void Block_Y_12_3(void) { Block_Y_xx_3(12, W_12y, W_0y, W_4y, W_8y) ; }
static INLINE void Block_Y_12_4(void) { Block_Y_xx_4(12, W_12y, W_0y, W_4y, W_8y) ; }
static INLINE void Block_Y_12_5(void) { Block_Y_xx_5(12, W_12y, W_0y, W_4y, W_8y) ; }
static INLINE void Block_Y_12_6(void) { Block_Y_xx_6(12, W_12y, W_0y, W_4y, W_8y) ; }
static INLINE void Block_Y_12_7(void) { Block_Y_xx_7(12, W_12y, W_0y, W_4y, W_8y) ; }
static INLINE void Block_Y_12_8(void) { Block_Y_xx_8(12, W_12y, W_0y, W_4y, W_8y) ; }
static INLINE void Block_Y_12_9(void) { Block_Y_xx_9(12, W_12y, W_0y, W_4y, W_8y) ; }
static INLINE void Block_Y_12_10(void) { Block_Y_xx_10(12, W_12y, W_0y, W_4y, W_8y) ; }
static INLINE void Block_Y_12_11(void) { Block_Y_xx_11(12, W_12y, W_0y, W_4y, W_8y) ; }
static INLINE void Block_Y_12_12(word64 *w) { Block_Y_xx_12(12, W_12y, W_0y, W_4y, W_8y) ; }
static int Transform_AVX2(Sha512* sha512)

View File

@@ -26,7 +26,7 @@
*/
/**
* Edited by Moisés Guimarães (moisesguimaraesm@gmail.com)
* Edited by Moises Guimaraes (moisesguimaraesm@gmail.com)
* to fit CyaSSL's needs.
*/
@@ -1569,7 +1569,7 @@ void fp_montgomery_calc_normalization(fp_int *a, fp_int *b)
#endif
#ifdef HAVE_INTEL_MULX
static inline void innermul8_mulx(fp_digit *c_mulx, fp_digit *cy_mulx, fp_digit *tmpm, fp_digit mu)
static INLINE void innermul8_mulx(fp_digit *c_mulx, fp_digit *cy_mulx, fp_digit *tmpm, fp_digit mu)
{
fp_digit _c0, _c1, _c2, _c3, _c4, _c5, _c6, _c7, cy ;

View File

@@ -353,17 +353,20 @@ int UnLockMutex(wolfSSL_Mutex *m)
}
#elif defined (WOLFSSL_TIRTOS)
#include <xdc/runtime/Error.h>
int InitMutex(wolfSSL_Mutex* m)
{
Semaphore_Params params;
Error_Block eb;
Error_init(&eb);
Semaphore_Params_init(&params);
params.mode = Semaphore_Mode_BINARY;
*m = Semaphore_create(1, &params, NULL);
return 0;
*m = Semaphore_create(1, &params, &eb);
if( Error_check( &eb ) )
{
Error_raise( &eb, Error_E_generic, "Failed to Create the semaphore.",NULL);
} else return 0;
}
int FreeMutex(wolfSSL_Mutex* m)
@@ -388,6 +391,7 @@ int UnLockMutex(wolfSSL_Mutex *m)
}
#elif defined(WOLFSSL_uITRON4)
#include "stddef.h"
#include "kernel.h"
int InitMutex(wolfSSL_Mutex* m)
{
@@ -398,7 +402,7 @@ int UnLockMutex(wolfSSL_Mutex *m)
m->sem.name = NULL ;
m->id = acre_sem(&m->sem);
if( m->id != NULL )
if( m->id != E_OK )
iReturn = 0;
else
iReturn = BAD_MUTEX_E;

View File

@@ -5760,21 +5760,21 @@ int ed25519_test(void)
https://tools.ietf.org/html/draft-josefsson-eddsa-ed25519-02
*/
const byte sKey1[] = {
static const byte sKey1[] = {
0x9d,0x61,0xb1,0x9d,0xef,0xfd,0x5a,0x60,
0xba,0x84,0x4a,0xf4,0x92,0xec,0x2c,0xc4,
0x44,0x49,0xc5,0x69,0x7b,0x32,0x69,0x19,
0x70,0x3b,0xac,0x03,0x1c,0xae,0x7f,0x60
};
const byte sKey2[] = {
static const byte sKey2[] = {
0x4c,0xcd,0x08,0x9b,0x28,0xff,0x96,0xda,
0x9d,0xb6,0xc3,0x46,0xec,0x11,0x4e,0x0f,
0x5b,0x8a,0x31,0x9f,0x35,0xab,0xa6,0x24,
0xda,0x8c,0xf6,0xed,0x4f,0xb8,0xa6,0xfb
};
const byte sKey3[] = {
static const byte sKey3[] = {
0xc5,0xaa,0x8d,0xf4,0x3f,0x9f,0x83,0x7b,
0xed,0xb7,0x44,0x2f,0x31,0xdc,0xb7,0xb1,
0x66,0xd3,0x85,0x35,0x07,0x6f,0x09,0x4b,
@@ -5782,7 +5782,7 @@ int ed25519_test(void)
};
/* uncompressed test */
const byte sKey4[] = {
static const byte sKey4[] = {
0x9d,0x61,0xb1,0x9d,0xef,0xfd,0x5a,0x60,
0xba,0x84,0x4a,0xf4,0x92,0xec,0x2c,0xc4,
0x44,0x49,0xc5,0x69,0x7b,0x32,0x69,0x19,
@@ -5790,37 +5790,37 @@ int ed25519_test(void)
};
/* compressed prefix test */
const byte sKey5[] = {
static const byte sKey5[] = {
0x9d,0x61,0xb1,0x9d,0xef,0xfd,0x5a,0x60,
0xba,0x84,0x4a,0xf4,0x92,0xec,0x2c,0xc4,
0x44,0x49,0xc5,0x69,0x7b,0x32,0x69,0x19,
0x70,0x3b,0xac,0x03,0x1c,0xae,0x7f,0x60
};
const byte sKey6[] = {
static const byte sKey6[] = {
0xf5,0xe5,0x76,0x7c,0xf1,0x53,0x31,0x95,
0x17,0x63,0x0f,0x22,0x68,0x76,0xb8,0x6c,
0x81,0x60,0xcc,0x58,0x3b,0xc0,0x13,0x74,
0x4c,0x6b,0xf2,0x55,0xf5,0xcc,0x0e,0xe5
};
const byte* sKeys[] = {sKey1, sKey2, sKey3, sKey4, sKey5, sKey6};
static const byte* sKeys[] = {sKey1, sKey2, sKey3, sKey4, sKey5, sKey6};
const byte pKey1[] = {
static const byte pKey1[] = {
0xd7,0x5a,0x98,0x01,0x82,0xb1,0x0a,0xb7,
0xd5,0x4b,0xfe,0xd3,0xc9,0x64,0x07,0x3a,
0x0e,0xe1,0x72,0xf3,0xda,0xa6,0x23,0x25,
0xaf,0x02,0x1a,0x68,0xf7,0x07,0x51,0x1a
};
const byte pKey2[] = {
static const byte pKey2[] = {
0x3d,0x40,0x17,0xc3,0xe8,0x43,0x89,0x5a,
0x92,0xb7,0x0a,0xa7,0x4d,0x1b,0x7e,0xbc,
0x9c,0x98,0x2c,0xcf,0x2e,0xc4,0x96,0x8c,
0xc0,0xcd,0x55,0xf1,0x2a,0xf4,0x66,0x0c
};
const byte pKey3[] = {
static const byte pKey3[] = {
0xfc,0x51,0xcd,0x8e,0x62,0x18,0xa1,0xa3,
0x8d,0xa4,0x7e,0xd0,0x02,0x30,0xf0,0x58,
0x08,0x16,0xed,0x13,0xba,0x33,0x03,0xac,
@@ -5828,7 +5828,7 @@ int ed25519_test(void)
};
/* uncompressed test */
const byte pKey4[] = {
static const byte pKey4[] = {
0x04,0x55,0xd0,0xe0,0x9a,0x2b,0x9d,0x34,
0x29,0x22,0x97,0xe0,0x8d,0x60,0xd0,0xf6,
0x20,0xc5,0x13,0xd4,0x72,0x53,0x18,0x7c,
@@ -5841,25 +5841,25 @@ int ed25519_test(void)
};
/* compressed prefix */
const byte pKey5[] = {
static const byte pKey5[] = {
0x40,0xd7,0x5a,0x98,0x01,0x82,0xb1,0x0a,0xb7,
0xd5,0x4b,0xfe,0xd3,0xc9,0x64,0x07,0x3a,
0x0e,0xe1,0x72,0xf3,0xda,0xa6,0x23,0x25,
0xaf,0x02,0x1a,0x68,0xf7,0x07,0x51,0x1a
};
const byte pKey6[] = {
static const byte pKey6[] = {
0x27,0x81,0x17,0xfc,0x14,0x4c,0x72,0x34,
0x0f,0x67,0xd0,0xf2,0x31,0x6e,0x83,0x86,
0xce,0xff,0xbf,0x2b,0x24,0x28,0xc9,0xc5,
0x1f,0xef,0x7c,0x59,0x7f,0x1d,0x42,0x6e
};
const byte* pKeys[] = {pKey1, pKey2, pKey3, pKey4, pKey5, pKey6};
const byte pKeySz[] = {sizeof(pKey1), sizeof(pKey2), sizeof(pKey3),
static const byte* pKeys[] = {pKey1, pKey2, pKey3, pKey4, pKey5, pKey6};
static const byte pKeySz[] = {sizeof(pKey1), sizeof(pKey2), sizeof(pKey3),
sizeof(pKey4), sizeof(pKey5), sizeof(pKey6)};
const byte sig1[] = {
static const byte sig1[] = {
0xe5,0x56,0x43,0x00,0xc3,0x60,0xac,0x72,
0x90,0x86,0xe2,0xcc,0x80,0x6e,0x82,0x8a,
0x84,0x87,0x7f,0x1e,0xb8,0xe5,0xd9,0x74,
@@ -5870,7 +5870,7 @@ int ed25519_test(void)
0x65,0x51,0x41,0x43,0x8e,0x7a,0x10,0x0b
};
const byte sig2[] = {
static const byte sig2[] = {
0x92,0xa0,0x09,0xa9,0xf0,0xd4,0xca,0xb8,
0x72,0x0e,0x82,0x0b,0x5f,0x64,0x25,0x40,
0xa2,0xb2,0x7b,0x54,0x16,0x50,0x3f,0x8f,
@@ -5881,7 +5881,7 @@ int ed25519_test(void)
0xb0,0x0d,0x29,0x16,0x12,0xbb,0x0c,0x00
};
const byte sig3[] = {
static const byte sig3[] = {
0x62,0x91,0xd6,0x57,0xde,0xec,0x24,0x02,
0x48,0x27,0xe6,0x9c,0x3a,0xbe,0x01,0xa3,
0x0c,0xe5,0x48,0xa2,0x84,0x74,0x3a,0x44,
@@ -5893,7 +5893,7 @@ int ed25519_test(void)
};
/* uncompressed test */
const byte sig4[] = {
static const byte sig4[] = {
0xe5,0x56,0x43,0x00,0xc3,0x60,0xac,0x72,
0x90,0x86,0xe2,0xcc,0x80,0x6e,0x82,0x8a,
0x84,0x87,0x7f,0x1e,0xb8,0xe5,0xd9,0x74,
@@ -5905,7 +5905,7 @@ int ed25519_test(void)
};
/* compressed prefix */
const byte sig5[] = {
static const byte sig5[] = {
0xe5,0x56,0x43,0x00,0xc3,0x60,0xac,0x72,
0x90,0x86,0xe2,0xcc,0x80,0x6e,0x82,0x8a,
0x84,0x87,0x7f,0x1e,0xb8,0xe5,0xd9,0x74,
@@ -5916,7 +5916,7 @@ int ed25519_test(void)
0x65,0x51,0x41,0x43,0x8e,0x7a,0x10,0x0b
};
const byte sig6[] = {
static const byte sig6[] = {
0x0a,0xab,0x4c,0x90,0x05,0x01,0xb3,0xe2,
0x4d,0x7c,0xdf,0x46,0x63,0x32,0x6a,0x3a,
0x87,0xdf,0x5e,0x48,0x43,0xb2,0xcb,0xdb,
@@ -5927,14 +5927,14 @@ int ed25519_test(void)
0xac,0x00,0xa9,0x70,0x4a,0x18,0x8a,0x03
};
const byte* sigs[] = {sig1, sig2, sig3, sig4, sig5, sig6};
static const byte* sigs[] = {sig1, sig2, sig3, sig4, sig5, sig6};
const byte msg1[] = {};
const byte msg2[] = {0x72};
const byte msg3[] = {0xAF,0x82};
static const byte msg1[] = {0x0 };
static const byte msg2[] = {0x72};
static const byte msg3[] = {0xAF,0x82};
/* test of a 1024 byte long message */
const byte msg4[] = {
static const byte msg4[] = {
0x08,0xb8,0xb2,0xb7,0x33,0x42,0x42,0x43,
0x76,0x0f,0xe4,0x26,0xa4,0xb5,0x49,0x08,
0x63,0x21,0x10,0xa6,0x6c,0x2f,0x65,0x91,
@@ -6065,9 +6065,9 @@ int ed25519_test(void)
0x40,0xb9,0x4c,0x00,0xa0,0xb9,0xd0
};
const byte* msgs[] = {msg1, msg2, msg3, msg1, msg1, msg4};
const word16 msgSz[] = {sizeof(msg1), sizeof(msg2), sizeof(msg3),
sizeof(msg1), sizeof(msg1), sizeof(msg4)};
static const byte* msgs[] = { msg1, msg2, msg3, msg1, msg1, msg4};
static const word16 msgSz[] = {0 /*sizeof(msg1)*/, sizeof(msg2), sizeof(msg3),
0 /*sizeof(msg1)*/, 0 /*sizeof(msg1)*/, sizeof(msg4)};
/* create ed25519 keys */
wc_InitRng(&rng);
@@ -6397,18 +6397,18 @@ int pkcs7signed_test(void)
PKCS7 msg;
WC_RNG rng;
byte transIdOid[] =
static byte transIdOid[] =
{ 0x06, 0x0a, 0x60, 0x86, 0x48, 0x01, 0x86, 0xF8, 0x45, 0x01,
0x09, 0x07 };
byte messageTypeOid[] =
static byte messageTypeOid[] =
{ 0x06, 0x0a, 0x60, 0x86, 0x48, 0x01, 0x86, 0xF8, 0x45, 0x01,
0x09, 0x02 };
byte senderNonceOid[] =
static byte senderNonceOid[] =
{ 0x06, 0x0a, 0x60, 0x86, 0x48, 0x01, 0x86, 0xF8, 0x45, 0x01,
0x09, 0x05 };
byte transId[(SHA_DIGEST_SIZE + 1) * 2 + 1];
byte messageType[] = { 0x13, 2, '1', '9' };
byte senderNonce[PKCS7_NONCE_SZ + 2];
static byte transId[(SHA_DIGEST_SIZE + 1) * 2 + 1];
static byte messageType[] = { 0x13, 2, '1', '9' };
static byte senderNonce[PKCS7_NONCE_SZ + 2];
PKCS7Attrib attribs[] =
{

View File

@@ -117,12 +117,18 @@
/* do nothing */
#elif defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
/* do nothing */
#elif defined(WOLFSSL_uITRON4)
/* do nothing */
#elif defined(WOLFSSL_uTKERNEL2)
/* do nothing */
#elif defined(WOLFSSL_MDK_ARM)
#if defined(WOLFSSL_MDK5)
#include "cmsis_os.h"
#else
#include <rtl.h>
#endif
#elif defined(WOLFSSL_CMSIS_RTOS)
#include "cmsis_os.h"
#elif defined(MBED)
#elif defined(WOLFSSL_TIRTOS)
/* do nothing */

View File

@@ -37,7 +37,7 @@
#include <wolfssl/wolfcrypt/types.h>
static inline word32 load32( const void *src )
static INLINE word32 load32( const void *src )
{
#if defined(LITTLE_ENDIAN_ORDER)
return *( word32 * )( src );
@@ -51,7 +51,7 @@ static inline word32 load32( const void *src )
#endif
}
static inline word64 load64( const void *src )
static INLINE word64 load64( const void *src )
{
#if defined(LITTLE_ENDIAN_ORDER)
return *( word64 * )( src );
@@ -69,7 +69,7 @@ static inline word64 load64( const void *src )
#endif
}
static inline void store32( void *dst, word32 w )
static INLINE void store32( void *dst, word32 w )
{
#if defined(LITTLE_ENDIAN_ORDER)
*( word32 * )( dst ) = w;
@@ -82,7 +82,7 @@ static inline void store32( void *dst, word32 w )
#endif
}
static inline void store64( void *dst, word64 w )
static INLINE void store64( void *dst, word64 w )
{
#if defined(LITTLE_ENDIAN_ORDER)
*( word64 * )( dst ) = w;
@@ -99,7 +99,7 @@ static inline void store64( void *dst, word64 w )
#endif
}
static inline word64 load48( const void *src )
static INLINE word64 load48( const void *src )
{
const byte *p = ( const byte * )src;
word64 w = *p++;
@@ -111,7 +111,7 @@ static inline word64 load48( const void *src )
return w;
}
static inline void store48( void *dst, word64 w )
static INLINE void store48( void *dst, word64 w )
{
byte *p = ( byte * )dst;
*p++ = ( byte )w; w >>= 8;
@@ -122,28 +122,28 @@ static inline void store48( void *dst, word64 w )
*p++ = ( byte )w;
}
static inline word32 rotl32( const word32 w, const unsigned c )
static INLINE word32 rotl32( const word32 w, const unsigned c )
{
return ( w << c ) | ( w >> ( 32 - c ) );
}
static inline word64 rotl64( const word64 w, const unsigned c )
static INLINE word64 rotl64( const word64 w, const unsigned c )
{
return ( w << c ) | ( w >> ( 64 - c ) );
}
static inline word32 rotr32( const word32 w, const unsigned c )
static INLINE word32 rotr32( const word32 w, const unsigned c )
{
return ( w >> c ) | ( w << ( 32 - c ) );
}
static inline word64 rotr64( const word64 w, const unsigned c )
static INLINE word64 rotr64( const word64 w, const unsigned c )
{
return ( w >> c ) | ( w << ( 64 - c ) );
}
/* prevents compiler optimizing out memset() */
static inline void secure_zero_memory( void *v, word64 n )
static INLINE void secure_zero_memory( void *v, word64 n )
{
volatile byte *p = ( volatile byte * )v;

View File

@@ -168,7 +168,7 @@
int blake2sp( byte *out, const void *in, const void *key, const byte outlen, const word64 inlen, byte keylen );
int blake2bp( byte *out, const void *in, const void *key, const byte outlen, const word64 inlen, byte keylen );
static inline int blake2( byte *out, const void *in, const void *key, const byte outlen, const word64 inlen, byte keylen )
static INLINE int blake2( byte *out, const void *in, const void *key, const byte outlen, const word64 inlen, byte keylen )
{
return blake2b( out, in, key, outlen, inlen, keylen );
}

View File

@@ -307,6 +307,54 @@
#define USE_WINDOWS_API
#endif
#if defined(WOLFSSL_uITRON4)
#define XMALLOC_USER
#include <stddef.h>
#define ITRON_POOL_SIZE 1024*20
extern int uITRON4_minit(size_t poolsz) ;
extern void *uITRON4_malloc(size_t sz) ;
extern void *uITRON4_realloc(void *p, size_t sz) ;
extern void uITRON4_free(void *p) ;
#define XMALLOC(sz, heap, type) uITRON4_malloc(sz)
#define XREALLOC(p, sz, heap, type) uITRON4_realloc(p, sz)
#define XFREE(p, heap, type) uITRON4_free(p)
#endif
#if defined(WOLFSSL_uTKERNEL2)
#define WOLFSSL_CLOSESOCKET
#define XMALLOC_USER
int uTKernel_init_mpool(unsigned int sz) ; /* initializing malloc pool */
void *uTKernel_malloc(unsigned int sz) ;
void *uTKernel_realloc(void *p, unsigned int sz) ;
void uTKernel_free(void *p) ;
#define XMALLOC(s, h, type) uTKernel_malloc((s))
#define XREALLOC(p, n, h, t) uTKernel_realloc((p), (n))
#define XFREE(p, h, type) uTKernel_free((p))
#include <stdio.h>
#include "tm/tmonitor.h"
static char *fgets(char *buff, int sz, FILE *fp)
/*static char * gets(char *buff)*/
{
char * p = buff ;
*p = '\0' ;
while(1) {
*p = tm_getchar(-1) ;
tm_putchar(*p) ;
if(*p == '\r') {
tm_putchar('\n') ;
*p = '\0' ;
break ;
}
p ++ ;
}
return buff ;
}
#endif
#if defined(WOLFSSL_LEANPSK) && !defined(XMALLOC_USER)
#include <stdlib.h>

View File

@@ -161,7 +161,7 @@
#endif
/* idea to add global alloc override by Moisés Guimarães */
/* idea to add global alloc override by Moises Guimaraes */
/* default to libc stuff */
/* 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 */
@@ -180,7 +180,8 @@
#elif !defined(MICRIUM_MALLOC) && !defined(EBSNET) \
&& !defined(WOLFSSL_SAFERTOS) && !defined(FREESCALE_MQX) \
&& !defined(FREESCALE_KSDK_MQX) && !defined(WOLFSSL_LEANPSK) \
&& !defined(FREERTOS)
&& !defined(FREERTOS) && !defined(WOLFSSL_uITRON4) \
&& !defined(WOLFSSL_uTKERNEL2)
/* default C runtime, can install different routines at runtime via cbs */
#include <wolfssl/wolfcrypt/memory.h>
#define XMALLOC(s, h, t) ((void)h, (void)t, wolfSSL_Malloc((s)))

View File

@@ -55,6 +55,10 @@
/* do nothing */
#elif defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
/* do nothing */
#elif defined(WOLFSSL_uITRON4)
#include "kernel.h"
#elif defined(WOLFSSL_uTKERNEL2)
#include "tk/tkernel.h"
#elif defined(WOLFSSL_MDK_ARM)
#if defined(WOLFSSL_MDK5)
#include "cmsis_os.h"
@@ -100,6 +104,16 @@
typedef RTP_MUTEX wolfSSL_Mutex;
#elif defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
typedef MUTEX_STRUCT wolfSSL_Mutex;
#elif defined(WOLFSSL_uITRON4)
typedef struct wolfSSL_Mutex {
T_CSEM sem ;
ID id ;
} wolfSSL_Mutex;
#elif defined(WOLFSSL_uTKERNEL2)
typedef struct wolfSSL_Mutex {
T_CSEM sem ;
ID id ;
} wolfSSL_Mutex;
#elif defined(WOLFSSL_MDK_ARM)
#if defined(WOLFSSL_CMSIS_RTOS)
typedef osMutexId wolfSSL_Mutex;