diff --git a/src/internal.c b/src/internal.c index 6a4357544..a7b557dcc 100644 --- a/src/internal.c +++ b/src/internal.c @@ -3818,7 +3818,6 @@ static INLINE int Encrypt(CYASSL* ssl, byte* out, const byte* input, word16 sz) #ifdef BUILD_AES case cyassl_aes: return AesCbcEncrypt(ssl->encrypt.aes, out, input, sz); - break; #endif #ifdef BUILD_AESGCM @@ -3914,7 +3913,6 @@ static INLINE int Encrypt(CYASSL* ssl, byte* out, const byte* input, word16 sz) #ifdef HAVE_HC128 case cyassl_hc128: return Hc128_Process(ssl->encrypt.hc128, out, input, sz); - break; #endif #ifdef BUILD_RABBIT @@ -3969,7 +3967,6 @@ static INLINE int Decrypt(CYASSL* ssl, byte* plain, const byte* input, #ifdef BUILD_AES case cyassl_aes: return AesCbcDecrypt(ssl->decrypt.aes, plain, input, sz); - break; #endif #ifdef BUILD_AESGCM @@ -4053,7 +4050,6 @@ static INLINE int Decrypt(CYASSL* ssl, byte* plain, const byte* input, #ifdef HAVE_HC128 case cyassl_hc128: return Hc128_Process(ssl->decrypt.hc128, plain, input, sz); - break; #endif #ifdef BUILD_RABBIT @@ -8316,22 +8312,16 @@ static void PickHashSigAlgo(CYASSL* ssl, switch(size) { case 20: return secp160r1; - break; case 24: return secp192r1; - break; case 28: return secp224r1; - break; case 32: return secp256r1; - break; case 48: return secp384r1; - break; case 66: return secp521r1; - break; default: return 0; } diff --git a/src/io.c b/src/io.c index 1b47a8340..c1daaf70e 100644 --- a/src/io.c +++ b/src/io.c @@ -56,7 +56,13 @@ #include #include #elif defined(CYASSL_MDK_ARM) + #if defined(CYASSL_MDK5) + #include "cmsis_os.h" + #include "rl_fs.h" + #include "rl_net.h" + #else #include + #endif #undef RNG #include "CYASSL_MDK_ARM.h" #undef RNG @@ -126,13 +132,23 @@ #define SOCKET_ECONNREFUSED RTCSERR_TCP_CONN_REFUSED #define SOCKET_ECONNABORTED RTCSERR_TCP_CONN_ABORTED #elif defined(CYASSL_MDK_ARM) - #define SOCKET_EWOULDBLOCK SCK_EWOULDBLOCK - #define SOCKET_EAGAIN SCK_ELOCKED - #define SOCKET_ECONNRESET SCK_ECLOSED - #define SOCKET_EINTR SCK_ERROR - #define SOCKET_EPIPE SCK_ERROR - #define SOCKET_ECONNREFUSED SCK_ERROR - #define SOCKET_ECONNABORTED SCK_ERROR + #if defined(CYASSL_MDK5) + #define SOCKET_EWOULDBLOCK BSD_ERROR_WOULDBLOCK + #define SOCKET_EAGAIN BSD_ERROR_LOCKED + #define SOCKET_ECONNRESET BSD_ERROR_CLOSED + #define SOCKET_EINTR BSD_ERROR + #define SOCKET_EPIPE BSD_ERROR + #define SOCKET_ECONNREFUSED BSD_ERROR + #define SOCKET_ECONNABORTED BSD_ERROR + #else + #define SOCKET_EWOULDBLOCK SCK_EWOULDBLOCK + #define SOCKET_EAGAIN SCK_ELOCKED + #define SOCKET_ECONNRESET SCK_ECLOSED + #define SOCKET_EINTR SCK_ERROR + #define SOCKET_EPIPE SCK_ERROR + #define SOCKET_ECONNREFUSED SCK_ERROR + #define SOCKET_ECONNABORTED SCK_ERROR + #endif #else #define SOCKET_EWOULDBLOCK EWOULDBLOCK #define SOCKET_EAGAIN EAGAIN diff --git a/src/ssl.c b/src/ssl.c index 3397c9f2c..3a6ab83e2 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -89,12 +89,12 @@ #endif /* min */ #ifndef max - +#ifdef CYASSL_DTLS static INLINE word32 max(word32 a, word32 b) { return a > b ? a : b; } - +#endif #endif /* min */ @@ -2095,7 +2095,12 @@ int CyaSSL_CertManagerVerifyBuffer(CYASSL_CERT_MANAGER* cm, const byte* buff, #else /* stdio, default case */ #define XFILE FILE* - #define XFOPEN fopen + #if defined(CYASSL_MDK_ARM) + extern FILE * CyaSSL_fopen(const char *name, const char *mode) ; + #define XFOPEN CyaSSL_fopen + #else + #define XFOPEN fopen + #endif #define XFSEEK fseek #define XFTELL ftell #define XREWIND rewind @@ -5756,6 +5761,7 @@ int CyaSSL_set_compression(CYASSL* ssl) #define CloseSocket(s) closesocket(s) #elif defined(CYASSL_MDK_ARM) #define CloseSocket(s) closesocket(s) + extern int closesocket(int) ; #else #define CloseSocket(s) close(s) #endif @@ -9889,7 +9895,6 @@ static int initGlobalRNG = 0; case ARC4_TYPE: CYASSL_MSG("returning arc4 state"); return (void*)&ctx->cipher.arc4.x; - break; default: CYASSL_MSG("bad x state type"); @@ -9910,7 +9915,6 @@ static int initGlobalRNG = 0; case ARC4_TYPE: CYASSL_MSG("returning arc4 state size"); return sizeof(Arc4); - break; default: CYASSL_MSG("bad x state type"); @@ -10013,7 +10017,6 @@ static int initGlobalRNG = 0; case AES_256_CBC_TYPE : CYASSL_MSG("AES CBC"); return AES_BLOCK_SIZE; - break; #ifdef CYASSL_AES_COUNTER case AES_128_CTR_TYPE : @@ -10021,28 +10024,23 @@ static int initGlobalRNG = 0; case AES_256_CTR_TYPE : CYASSL_MSG("AES CTR"); return AES_BLOCK_SIZE; - break; #endif case DES_CBC_TYPE : CYASSL_MSG("DES CBC"); return DES_BLOCK_SIZE; - break; case DES_EDE3_CBC_TYPE : CYASSL_MSG("DES EDE3 CBC"); return DES_BLOCK_SIZE; - break; case ARC4_TYPE : CYASSL_MSG("ARC4"); return 0; - break; case NULL_CIPHER_TYPE : CYASSL_MSG("NULL"); return 0; - break; default: { CYASSL_MSG("bad type");