Browse Source

typographic cleanup: fix whitespace, remove unneeded UTF-8, convert C++ comment constructs to C.

Daniel Pouzzner 2 years ago
parent
commit
0b4f34d62a
89 changed files with 1487 additions and 1500 deletions
  1. 3 3
      examples/client/client.c
  2. 1 1
      examples/configs/user_settings_min_ecc.h
  3. 6 6
      examples/configs/user_settings_stm32.h
  4. 6 6
      examples/configs/user_settings_template.h
  5. 6 6
      examples/server/server.c
  6. 2 2
      mcapi/include.am
  7. 1 1
      resource.h
  8. 3 3
      src/bio.c
  9. 5 5
      src/crl.c
  10. 88 88
      src/internal.c
  11. 86 86
      src/sniffer.c
  12. 78 78
      src/ssl.c
  13. 24 24
      src/tls.c
  14. 16 16
      src/tls13.c
  15. 2 2
      src/wolfio.c
  16. 0 3
      sslSniffer/sslSnifferTest/snifftest.c
  17. 0 2
      support/include.am
  18. 1 1
      swig/wolfssl_adds.c
  19. 141 141
      tests/api.c
  20. 1 1
      tests/suites.c
  21. 1 1
      testsuite/testsuite.c
  22. 12 12
      wolfcrypt/benchmark/benchmark.c
  23. 5 5
      wolfcrypt/src/aes.c
  24. 1 1
      wolfcrypt/src/aes_asm.S
  25. 10 10
      wolfcrypt/src/asn.c
  26. 2 2
      wolfcrypt/src/blake2b.c
  27. 312 312
      wolfcrypt/src/camellia.c
  28. 2 4
      wolfcrypt/src/cmac.c
  29. 1 1
      wolfcrypt/src/cryptocb.c
  30. 1 1
      wolfcrypt/src/curve448.c
  31. 5 5
      wolfcrypt/src/des3.c
  32. 2 2
      wolfcrypt/src/dh.c
  33. 10 10
      wolfcrypt/src/ecc.c
  34. 1 1
      wolfcrypt/src/eccsi.c
  35. 61 61
      wolfcrypt/src/evp.c
  36. 377 377
      wolfcrypt/src/fe_low_mem.c
  37. 18 18
      wolfcrypt/src/fe_operations.c
  38. 1 1
      wolfcrypt/src/integer.c
  39. 1 1
      wolfcrypt/src/memory.c
  40. 8 8
      wolfcrypt/src/misc.c
  41. 1 1
      wolfcrypt/src/pkcs12.c
  42. 3 3
      wolfcrypt/src/port/Renesas/renesas_tsip_util.c
  43. 1 1
      wolfcrypt/src/port/af_alg/afalg_hash.c
  44. 12 12
      wolfcrypt/src/random.c
  45. 4 4
      wolfcrypt/src/rsa.c
  46. 1 3
      wolfcrypt/src/sha.c
  47. 5 7
      wolfcrypt/src/sha256.c
  48. 1 3
      wolfcrypt/src/sha3.c
  49. 2 4
      wolfcrypt/src/sha512.c
  50. 4 4
      wolfcrypt/src/signature.c
  51. 4 4
      wolfcrypt/src/tfm.c
  52. 14 14
      wolfcrypt/src/wc_port.c
  53. 1 1
      wolfcrypt/src/wolfmath.c
  54. 1 1
      wolfcrypt/user-crypto/src/rsa.c
  55. 5 5
      wolfssl/internal.h
  56. 1 1
      wolfssl/openssl/dh.h
  57. 1 1
      wolfssl/openssl/dsa.h
  58. 4 4
      wolfssl/openssl/evp.h
  59. 1 1
      wolfssl/openssl/opensslv.h
  60. 1 1
      wolfssl/openssl/pem.h
  61. 1 1
      wolfssl/openssl/ripemd.h
  62. 2 2
      wolfssl/openssl/rsa.h
  63. 10 10
      wolfssl/openssl/sha.h
  64. 2 2
      wolfssl/openssl/sha3.h
  65. 1 1
      wolfssl/openssl/ssl.h
  66. 14 14
      wolfssl/sniffer.h
  67. 13 13
      wolfssl/ssl.h
  68. 13 13
      wolfssl/test.h
  69. 2 2
      wolfssl/wolfcrypt/arc4.h
  70. 3 3
      wolfssl/wolfcrypt/chacha.h
  71. 6 6
      wolfssl/wolfcrypt/ecc.h
  72. 1 1
      wolfssl/wolfcrypt/error-crypt.h
  73. 3 3
      wolfssl/wolfcrypt/fe_operations.h
  74. 1 1
      wolfssl/wolfcrypt/hc128.h
  75. 3 3
      wolfssl/wolfcrypt/hmac.h
  76. 10 10
      wolfssl/wolfcrypt/mem_track.h
  77. 1 1
      wolfssl/wolfcrypt/pkcs11.h
  78. 2 2
      wolfssl/wolfcrypt/poly1305.h
  79. 2 2
      wolfssl/wolfcrypt/pwdbased.h
  80. 1 1
      wolfssl/wolfcrypt/rabbit.h
  81. 3 3
      wolfssl/wolfcrypt/rsa.h
  82. 7 7
      wolfssl/wolfcrypt/settings.h
  83. 2 2
      wolfssl/wolfcrypt/sha.h
  84. 2 2
      wolfssl/wolfcrypt/sha256.h
  85. 4 4
      wolfssl/wolfcrypt/sha512.h
  86. 1 1
      wolfssl/wolfcrypt/tfm.h
  87. 1 1
      wolfssl/wolfcrypt/visibility.h
  88. 2 2
      wolfssl/wolfcrypt/wc_encrypt.h
  89. 6 4
      wolfssl/wolfcrypt/wc_port.h

+ 3 - 3
examples/client/client.c

@@ -20,7 +20,7 @@
  */
 
 /* For simpler wolfSSL TLS client examples, visit
- * https://github.com/wolfSSL/wolfssl-examples/tree/master/tls 
+ * https://github.com/wolfSSL/wolfssl-examples/tree/master/tls
  */
 
 #ifdef HAVE_CONFIG_H
@@ -1708,7 +1708,7 @@ static void Usage(void)
     printf("%s", msg[++msgid]); /* --wolfsentry-config */
 #endif
     printf("%s", msg[++msgid]); /* -7 */
-    printf("%s", msg[++msgid]); /* Examples repo link */ 
+    printf("%s", msg[++msgid]); /* Examples repo link */
 #ifdef HAVE_LIBOQS
     printf("%s", msg[++msgid]);     /* --oqs */
     printf("%s", msg[++msgid]);     /* --oqs options */
@@ -2987,7 +2987,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
         if (useCertFolder) {
             WOLFSSL_X509_STORE      *store;
             WOLFSSL_X509_LOOKUP     *lookup;
-            
+
             store = wolfSSL_CTX_get_cert_store(ctx);
             if (store == NULL) {
                 wolfSSL_CTX_free(ctx); ctx = NULL;

+ 1 - 1
examples/configs/user_settings_min_ecc.h

@@ -70,7 +70,7 @@ extern "C" {
 
 /* Optional Feature Disables */
 #define NO_SIG_WRAPPER
-//#define NO_ECC_KEY_EXPORT 
+//#define NO_ECC_KEY_EXPORT
 //#define NO_ECC_DHE
 //#define NO_ECC_SIGN
 //#define NO_ECC_VERIFY

+ 6 - 6
examples/configs/user_settings_stm32.h

@@ -19,10 +19,10 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
  */
 
-/* STM32 Cube Sample Configuration File 
+/* STM32 Cube Sample Configuration File
  * Generated automatically using `default_conf.ftl` template
  *
- * Included automatically when USE_HAL_DRIVER is defined 
+ * Included automatically when USE_HAL_DRIVER is defined
  * (and not WOLFSSL_USER_SETTINGS or HAVE_CONF_H).
  */
 
@@ -476,12 +476,12 @@
 /* Sha3 */
 #undef WOLFSSL_SHA3
 #if defined(WOLF_CONF_SHA3) && WOLF_CONF_SHA3 == 1
-	#define WOLFSSL_SHA3
+    #define WOLFSSL_SHA3
 #endif
 
 /* MD5 */
 #if defined(WOLF_CONF_MD5) && WOLF_CONF_MD5 == 1
-	/* enabled */
+    /* enabled */
 #else
     #define NO_MD5
 #endif
@@ -504,8 +504,8 @@
     #if 0
         #define USE_WOLFSSL_MEMORY
         #define WOLFSSL_TRACK_MEMORY
-  		  #define WOLFSSL_DEBUG_MEMORY
-	  	  #define WOLFSSL_DEBUG_MEMORY_PRINT
+        #define WOLFSSL_DEBUG_MEMORY
+        #define WOLFSSL_DEBUG_MEMORY_PRINT
     #endif
 #else
     //#define NO_WOLFSSL_MEMORY

+ 6 - 6
examples/configs/user_settings_template.h

@@ -52,8 +52,8 @@ extern "C" {
     /* reduce stack use. For variables over 100 bytes allocate from heap */
     #define WOLFSSL_SMALL_STACK
 
-    /* disable the built-in socket support and use the IO callbacks. 
-     * Set with wolfSSL_CTX_SetIORecv/wolfSSL_CTX_SetIOSend 
+    /* disable the built-in socket support and use the IO callbacks.
+     * Set with wolfSSL_CTX_SetIORecv/wolfSSL_CTX_SetIOSend
      */
     #define WOLFSSL_USER_IO
 #endif
@@ -78,14 +78,14 @@ extern "C" {
     #define WOLFSSL_HAVE_SP_ECC
     //#define WOLFSSL_SP_4096 /* Enable RSA/RH 4096-bit support */
     //#define WOLFSSL_SP_384 /* Enable ECC 384-bit SECP384R1 support */
-    
+
     //#define WOLFSSL_SP_CACHE_RESISTANT
     #define WOLFSSL_SP_MATH     /* only SP math - disables integer.c/tfm.c */
     #define WOLFSSL_SP_MATH_ALL /* use SP math for all key sizes and curves */
 
     //#define WOLFSSL_SP_NO_MALLOC
     //#define WOLFSSL_SP_DIV_32 /* do not use 64-bit divides */
- 
+
     #ifdef TARGET_EMBEDDED
         /* use smaller version of code */
         #define WOLFSSL_SP_SMALL
@@ -117,7 +117,7 @@ extern "C" {
 
     /* Enables blinding mode, to prevent timing attacks */
     #define WC_RSA_BLINDING
-    
+
     /* RSA PSS Support */
     #define WC_RSA_PSS
 #else
@@ -199,7 +199,7 @@ extern "C" {
 /* AES */
 #undef NO_AES
 #if 1
-	#define HAVE_AES_CBC
+    #define HAVE_AES_CBC
 
     /* GCM Method: GCM_TABLE_4BIT, GCM_SMALL, GCM_WORD32 or GCM_TABLE */
     #define HAVE_AESGCM

+ 6 - 6
examples/server/server.c

@@ -20,7 +20,7 @@
  */
 
 /* For simpler wolfSSL TLS server examples, visit
- * https://github.com/wolfSSL/wolfssl-examples/tree/master/tls 
+ * https://github.com/wolfSSL/wolfssl-examples/tree/master/tls
  */
 
 #ifdef HAVE_CONFIG_H
@@ -1411,8 +1411,8 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
 #endif
 
 #ifdef WOLFSSL_STATIC_MEMORY
-    /* Note: Actual memory used is much less, this is the entire buffer buckets, 
-     * which is partitioned into pools of common sizes. To adjust the buckets 
+    /* Note: Actual memory used is much less, this is the entire buffer buckets,
+     * which is partitioned into pools of common sizes. To adjust the buckets
      * sizes see WOLFMEM_BUCKETS in memory.h */
     #if (defined(HAVE_ECC) && !defined(ALT_ECC_SIZE)) \
         || defined(SESSION_CERTS)
@@ -2181,7 +2181,7 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
 #endif /* WOLFSSL_STATIC_MEMORY */
     if (ctx == NULL)
         err_sys_ex(catastrophic, "unable to get ctx");
-    
+
     if (minVersion != SERVER_INVALID_VERSION) {
         wolfSSL_CTX_SetMinVersion(ctx, minVersion);
     }
@@ -2221,7 +2221,7 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
 #endif
 
 #if defined(WOLFSSL_SNIFFER) && defined(WOLFSSL_STATIC_EPHEMERAL)
-    /* used for testing only to set a static/fixed ephemeral key 
+    /* used for testing only to set a static/fixed ephemeral key
         for use with the sniffer */
 #if defined(HAVE_ECC) && !defined(NO_ECC_SECP) && \
         (!defined(NO_ECC256) || defined(HAVE_ALL_CURVES))
@@ -2443,7 +2443,7 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
         if (useCertFolder) {
             WOLFSSL_X509_STORE      *store;
             WOLFSSL_X509_LOOKUP     *lookup;
-            
+
             store = wolfSSL_CTX_get_cert_store(ctx);
             if (store == NULL) {
                 wolfSSL_CTX_free(ctx); ctx = NULL;

+ 2 - 2
mcapi/include.am

@@ -4,10 +4,10 @@
 
 if BUILD_MCAPI
 check_PROGRAMS += mcapi/test
-noinst_PROGRAMS += mcapi/test 
+noinst_PROGRAMS += mcapi/test
 mcapi_test_SOURCES = mcapi/crypto.c \
                      mcapi/mcapi_test.c
-mcapi_test_LDADD        = src/libwolfssl.la 
+mcapi_test_LDADD        = src/libwolfssl.la
 mcapi_test_DEPENDENCIES = src/libwolfssl.la
 endif
 

+ 1 - 1
resource.h

@@ -3,7 +3,7 @@
 // Used by wolfssl.rc
 
 // Next default values for new objects
-// 
+//
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NEXT_RESOURCE_VALUE        101

+ 3 - 3
src/bio.c

@@ -277,7 +277,7 @@ int wolfSSL_BIO_read(WOLFSSL_BIO* bio, void* buf, int len)
                 break;
             case WOLFSSL_BIO_SOCKET:
             #ifdef USE_WOLFSSL_IO
-                /* BIO requires built-in socket support 
+                /* BIO requires built-in socket support
                  *  (cannot be used with WOLFSSL_USER_IO) */
                 ret = wolfIO_Recv(bio->num, (char*)buf, len, 0);
             #else
@@ -659,12 +659,12 @@ int wolfSSL_BIO_write(WOLFSSL_BIO* bio, const void* data, int len)
                 break;
             case WOLFSSL_BIO_SOCKET:
             #ifdef USE_WOLFSSL_IO
-                /* BIO requires built-in socket support 
+                /* BIO requires built-in socket support
                  *  (cannot be used with WOLFSSL_USER_IO) */
                 ret = wolfIO_Send(bio->num, (char*)data, len, 0);
             #else
                 ret = NOT_COMPILED_IN;
-            #endif                
+            #endif
                 break;
             } /* switch */
         }

+ 5 - 5
src/crl.c

@@ -381,7 +381,7 @@ int CheckCertCRL(WOLFSSL_CRL* crl, DecodedCert* cert)
     /* When not set the folder or not use hash_dir, do nothing.             */
     if ((foundEntry == 0) && (ret != OCSP_WANT_READ)) {
         if (crl->cm->x509_store_p != NULL) {
-            ret = LoadCertByIssuer(crl->cm->x509_store_p, 
+            ret = LoadCertByIssuer(crl->cm->x509_store_p,
                           (WOLFSSL_X509_NAME*)cert->issuerName, X509_LU_CRL);
             if (ret == WOLFSSL_SUCCESS) {
                 /* try again */
@@ -1350,10 +1350,10 @@ int LoadCRL(WOLFSSL_CRL* crl, const char* path, int type, int monitor)
 #else
 int LoadCRL(WOLFSSL_CRL* crl, const char* path, int type, int monitor)
 {
-	(void)crl;
-	(void)path;
-	(void)type;
-	(void)monitor;
+    (void)crl;
+    (void)path;
+    (void)type;
+    (void)monitor;
 
     /* stub for scenario where file system is not supported */
     return NOT_COMPILED_IN;

+ 88 - 88
src/internal.c

@@ -2179,7 +2179,7 @@ int InitSSL_Ctx(WOLFSSL_CTX* ctx, WOLFSSL_METHOD* method, void* heap)
     }
     XMEMSET(ctx->param, 0, sizeof(WOLFSSL_X509_VERIFY_PARAM));
     /* WOLFSSL_X509_LOOKUP */
-    if ((ctx->x509_store.lookup.dirs = 
+    if ((ctx->x509_store.lookup.dirs =
                             (WOLFSSL_BY_DIR*)XMALLOC(sizeof(WOLFSSL_BY_DIR),
                             heap, DYNAMIC_TYPE_OPENSSL)) == NULL) {
         WOLFSSL_MSG("ctx-x509_store.lookup.dir memory allocation error");
@@ -2236,7 +2236,7 @@ int InitSSL_Ctx(WOLFSSL_CTX* ctx, WOLFSSL_METHOD* method, void* heap)
 #endif
 
 #if defined(WOLFSSL_QT) && !defined(NO_PSK)
-    /* Qt retrieves supported cipher list at initialization 
+    /* Qt retrieves supported cipher list at initialization
      * from get_cipher_compat().
      * Qt doesn't allow to use a cipher if it is not in the supported list.
      * Therefore, we need to enable PSK cipher at the beginning.
@@ -2268,9 +2268,9 @@ void wolfSSL_CRYPTO_cleanup_ex_data(WOLFSSL_CRYPTO_EX_DATA* ex_data)
 /* In case contexts are held in array and don't want to free actual ctx. */
 
 /* The allocations done in InitSSL_Ctx must be free'd with ctx->onHeapHint
- * logic. A WOLFSSL_CTX can be assigned a static memory heap hint using 
- * wolfSSL_CTX_load_static_memory after CTX creation, which means variables 
- * allocated in InitSSL_Ctx were allocated from heap and should be free'd with 
+ * logic. A WOLFSSL_CTX can be assigned a static memory heap hint using
+ * wolfSSL_CTX_load_static_memory after CTX creation, which means variables
+ * allocated in InitSSL_Ctx were allocated from heap and should be free'd with
  * a NULL heap hint. */
 void SSL_CtxResourceFree(WOLFSSL_CTX* ctx)
 {
@@ -2392,7 +2392,7 @@ void SSL_CtxResourceFree(WOLFSSL_CTX* ctx)
         if (ctx->x509_store.lookup.dirs->dir_entry) {
             wolfSSL_sk_BY_DIR_entry_free(ctx->x509_store.lookup.dirs->dir_entry);
         }
-        
+
 #endif
         wc_FreeMutex(&ctx->x509_store.lookup.dirs->lock);
         XFREE(ctx->x509_store.lookup.dirs, heapAtCTXInit, DYNAMIC_TYPE_OPENSSL);
@@ -6425,7 +6425,7 @@ int InitSSL(WOLFSSL* ssl, WOLFSSL_CTX* ctx, int writeDup)
     #endif
     #if !defined(NO_BIO) && defined(OPENSSL_EXTRA)
         if (ctx->alpn_cli_protos != NULL && ctx->alpn_cli_protos_len > 0) {
-            ret = wolfSSL_set_alpn_protos(ssl, ctx->alpn_cli_protos, 
+            ret = wolfSSL_set_alpn_protos(ssl, ctx->alpn_cli_protos,
                                             ctx->alpn_cli_protos_len);
         #if defined(WOLFSSL_ERROR_CODE_OPENSSL)
             if (ret) {
@@ -6436,7 +6436,7 @@ int InitSSL(WOLFSSL* ssl, WOLFSSL_CTX* ctx, int writeDup)
                 return ret;
             }
         }
-    #endif 
+    #endif
 #endif
 #ifdef HAVE_SUPPORTED_CURVES
     ssl->options.userCurves = ctx->userCurves;
@@ -11461,7 +11461,7 @@ int LoadCertByIssuer(WOLFSSL_X509_STORE* store, X509_NAME* issuer, int type)
     byte    suffix = 0;
     int retHash = NOT_COMPILED_IN;
     byte dgt[WC_MAX_DIGEST_SIZE];
-    
+
     WOLFSSL_ENTER("LoadCertByIssuer");
 
     /* sanity check */
@@ -11472,7 +11472,7 @@ int LoadCertByIssuer(WOLFSSL_X509_STORE* store, X509_NAME* issuer, int type)
     if (lookup->dirs == NULL || lookup->type != 1) {
         return WOLFSSL_FAILURE;
     }
-    
+
     len = wolfSSL_i2d_X509_NAME_canon(issuer, &pbuf);
     if (len > 0) {
         #ifndef NO_SHA
@@ -11480,7 +11480,7 @@ int LoadCertByIssuer(WOLFSSL_X509_STORE* store, X509_NAME* issuer, int type)
         #endif
         if (retHash == 0) {
             /* 4 bytes in little endian as unsigned long */
-            hash = (((unsigned long)dgt[3] << 24) | 
+            hash = (((unsigned long)dgt[3] << 24) |
                     ((unsigned long)dgt[2] << 16) |
                     ((unsigned long)dgt[1] <<  8) |
                     ((unsigned long)dgt[0]));
@@ -11490,28 +11490,28 @@ int LoadCertByIssuer(WOLFSSL_X509_STORE* store, X509_NAME* issuer, int type)
         }
         wolfSSL_OPENSSL_free(pbuf);
     }
-    
+
     /* try to load each hashed name file in path */
 #if !defined(NO_FILESYSTEM) && !defined(NO_WOLFSSL_DIR)
-    
+
     if (type == X509_LU_CRL) {
         post = "r";
     }
-    
+
     num = wolfSSL_sk_BY_DIR_entry_num(lookup->dirs->dir_entry);
-    
+
     for (i=0; i<num; i++) {
-        
+
         entry = wolfSSL_sk_BY_DIR_entry_value(lookup->dirs->dir_entry, i);
-        
-        if (type == X509_LU_CRL && entry->hashes != NULL && 
+
+        if (type == X509_LU_CRL && entry->hashes != NULL &&
             wolfSSL_sk_BY_DIR_HASH_num(entry->hashes) > 0) {
             /* lock the list */
             if (wc_LockMutex(&lookup->dirs->lock) != 0) {
                 WOLFSSL_MSG("wc_LockMutex cdir Lock error");
                 return BAD_MUTEX_E;
             }
-            
+
             hash_tmp.hash_value = hash;
             index = wolfSSL_sk_BY_DIR_HASH_find(entry->hashes, &hash_tmp);
             if (index >= 0) {
@@ -11522,10 +11522,10 @@ int LoadCertByIssuer(WOLFSSL_X509_STORE* store, X509_NAME* issuer, int type)
                 ph = NULL;
                 suffix = 0;
             }
-            
+
             wc_UnLockMutex(&lookup->dirs->lock);
         }
-        
+
         /* Additional buffer length for file name memory allocation :   */
         /* / <hashvalue>.(r)N\0                                         */
         /*|1|     8    |1|1|1|1|           => 13                        */
@@ -11533,25 +11533,25 @@ int LoadCertByIssuer(WOLFSSL_X509_STORE* store, X509_NAME* issuer, int type)
         if (filename != NULL) {
             XFREE(filename, NULL, DYNAMIC_TYPE_OPENSSL);
         }
-        
+
         filename = (char*)XMALLOC(len, NULL, DYNAMIC_TYPE_OPENSSL);
         if (filename == NULL) {
             WOLFSSL_MSG("memory allocation error");
             return MEMORY_E;
         }
-        
+
         /* set as FAILURE, if successfuly loading cert of CRL, this becomes */
         /* WOLFSSL_SUCCESS                                                  */
         ret = WOLFSSL_FAILURE;
-        
+
         for (; suffix < MAX_SUFFIX; suffix++) {
             /* /folder-path/<hash>.(r)N[0..9] */
-            XSNPRINTF(filename, len, "%s/%08lx.%s%d", entry->dir_name, 
+            XSNPRINTF(filename, len, "%s/%08lx.%s%d", entry->dir_name,
                                                        hash, post, suffix);
             if(wc_FileExists(filename) == 0/*0 file exists */) {
-                
+
                 if (type == X509_LU_X509) {
-                    x509 = wolfSSL_X509_load_certificate_file(filename, 
+                    x509 = wolfSSL_X509_load_certificate_file(filename,
                                                         WOLFSSL_FILETYPE_PEM);
                     if (x509 != NULL) {
                        ret = wolfSSL_X509_STORE_add_cert(store, x509);
@@ -11561,7 +11561,7 @@ int LoadCertByIssuer(WOLFSSL_X509_STORE* store, X509_NAME* issuer, int type)
                        ret = WOLFSSL_FAILURE;
                        break;
                     }
-                } 
+                }
 #if defined(HAVE_CRL) && !defined(NO_BIO)
                 else if (type == X509_LU_CRL) {
                     ret = wolfSSL_X509_load_crl_file(&store->lookup, filename,
@@ -11581,7 +11581,7 @@ int LoadCertByIssuer(WOLFSSL_X509_STORE* store, X509_NAME* issuer, int type)
             } else
                 break;
         }
-        
+
         if (ret != WOLFSSL_SUCCESS) {
             WOLFSSL_MSG("not found file");
             ret = WOLFSSL_FAILURE;
@@ -11600,14 +11600,14 @@ int LoadCertByIssuer(WOLFSSL_X509_STORE* store, X509_NAME* issuer, int type)
                     } else {
                         ph->hash_value = hash;
                         ph->last_suffix = suffix;
-                        
+
                         ret = wolfSSL_sk_BY_DIR_HASH_push(entry->hashes, ph);
                     }
                 }
                 wc_UnLockMutex(&lookup->dirs->lock);
             }
         }
-        
+
         XFREE(filename, NULL, DYNAMIC_TYPE_OPENSSL);
     }
 #else
@@ -12521,7 +12521,7 @@ int ProcessPeerCerts(WOLFSSL* ssl, byte* input, word32* inOutIdx,
         {
             if (args->count > 0) {
             #if defined(HAVE_OCSP) || defined(HAVE_CRL)
-                /* only attempt to check OCSP or CRL if not previous error such 
+                /* only attempt to check OCSP or CRL if not previous error such
                  * as ASN_BEFORE_DATE_E or ASN_AFTER_DATE_E */
                 if (args->fatal == 0 && ret == 0) {
                     int doLookup = 1;
@@ -19421,35 +19421,35 @@ int SendCertificateStatus(WOLFSSL* ssl)
                 }
 
                 if (chain && chain->buffer) {
-		    while (idx + OPAQUE24_LEN < chain->length) {
-			c24to32(chain->buffer + idx, &der.length);
-			idx += OPAQUE24_LEN;
+                    while (idx + OPAQUE24_LEN < chain->length) {
+                        c24to32(chain->buffer + idx, &der.length);
+                        idx += OPAQUE24_LEN;
 
-			der.buffer = chain->buffer + idx;
-			idx += der.length;
+                        der.buffer = chain->buffer + idx;
+                        idx += der.length;
 
-			if (idx > chain->length)
-			    break;
+                        if (idx > chain->length)
+                            break;
 
-			ret = CreateOcspRequest(ssl, request, cert, der.buffer,
-						der.length);
-			if (ret == 0) {
-			    request->ssl = ssl;
+                        ret = CreateOcspRequest(ssl, request, cert, der.buffer,
+                                                der.length);
+                        if (ret == 0) {
+                            request->ssl = ssl;
                         ret = CheckOcspRequest(SSL_CM(ssl)->ocsp_stapling,
                                                     request, &responses[i + 1]);
 
-			    /* Suppressing, not critical */
-			    if (ret == OCSP_CERT_REVOKED ||
-				ret == OCSP_CERT_UNKNOWN ||
-				ret == OCSP_LOOKUP_FAIL) {
-				ret = 0;
-			    }
+                            /* Suppressing, not critical */
+                            if (ret == OCSP_CERT_REVOKED ||
+                                ret == OCSP_CERT_UNKNOWN ||
+                                ret == OCSP_LOOKUP_FAIL) {
+                                ret = 0;
+                            }
 
 
-			    i++;
-			    FreeOcspRequest(request);
-			}
-		    }
+                            i++;
+                            FreeOcspRequest(request);
+                        }
+                    }
                 }
 
                 XFREE(request, ssl->heap, DYNAMIC_TYPE_OCSP_REQUEST);
@@ -20538,13 +20538,13 @@ const char* wolfSSL_ERR_func_error_string(unsigned long e)
 
 /* return library name
  * @param e error code
- * @return text library name, 
+ * @return text library name,
  *    if there is no suitable library found, returns empty string
  */
 const char* wolfSSL_ERR_lib_error_string(unsigned long e)
 {
     int libe = 0;
-    
+
     (void)libe;
     (void)e;
 
@@ -20798,7 +20798,7 @@ static const CipherSuiteInfo cipher_names[] =
 #endif
 
 #ifdef BUILD_TLS_ECDHE_ECDSA_WITH_AES_128_CCM
-	SUITE_INFO("ECDHE-ECDSA-AES128-CCM","TLS_ECDHE_ECDSA_WITH_AES_128_CCM",ECC_BYTE,TLS_ECDHE_ECDSA_WITH_AES_128_CCM, TLSv1_2_MINOR, SSLv3_MAJOR),
+    SUITE_INFO("ECDHE-ECDSA-AES128-CCM","TLS_ECDHE_ECDSA_WITH_AES_128_CCM",ECC_BYTE,TLS_ECDHE_ECDSA_WITH_AES_128_CCM, TLSv1_2_MINOR, SSLv3_MAJOR),
 #endif
 
 #ifdef BUILD_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8
@@ -21125,18 +21125,18 @@ const char* GetCipherSegment(const WOLFSSL_CIPHER* cipher, char n[][MAX_SEGMENT_
     int strLen;
     unsigned long offset;
     const char* name;
-    
+
     /* sanity check */
     if (cipher == NULL || n == NULL)
         return NULL;
-    
+
     offset = cipher->offset;
-    
+
     if (offset >= (unsigned long)GetCipherNamesSize())
         return NULL;
-    
+
     name = cipher_names[offset].name;
-    
+
     if (name == NULL)
         return NULL;
 
@@ -21149,11 +21149,11 @@ const char* GetCipherSegment(const WOLFSSL_CIPHER* cipher, char n[][MAX_SEGMENT_
      * and n = [n0,n1,n2,n3,0]
      */
     strLen = (int)XSTRLEN(name);
-    
+
     for (i = 0, j = 0, k = 0; i <= strLen; i++) {
         if (k >= MAX_SEGMENTS || j >= MAX_SEGMENT_SZ)
             break;
-        
+
         if (name[i] != '-' && name[i] != '\0') {
             n[k][j] = name[i]; /* Fill kth segment string until '-' */
             j++;
@@ -21164,7 +21164,7 @@ const char* GetCipherSegment(const WOLFSSL_CIPHER* cipher, char n[][MAX_SEGMENT_
             k++;
         }
     }
-    
+
     return name;
 }
 
@@ -21312,14 +21312,14 @@ int IsCipherAEAD(char n[][MAX_SEGMENT_SZ])
     n1 = n[1];
     n2 = n[2];
     n3 = n[3];
-    
+
     WOLFSSL_ENTER("IsCipherAEAD");
 
     if (n == NULL) {
         WOLFSSL_MSG("bad function argumet. n is NULL.");
         return 0;
     }
-    
+
     if ((XSTRNCMP(n2,"GCM",3) == 0) || (XSTRNCMP(n3,"GCM",3) == 0) ||
         (XSTRNCMP(n1,"CCM",3) == 0) ||
         (XSTRNCMP(n2,"CCM",3) == 0) || (XSTRNCMP(n3,"CCM",3) == 0) ||
@@ -29127,11 +29127,11 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
 #ifndef WOLFSSL_NO_TLS12
 
     /**
-     *  Handles session resumption. 
+     *  Handles session resumption.
      *  Session tickets are checked for validity based on the time each ticket
      *  was created, timeout value and the current time. If the tickets are
-     *  judged expired, falls back to full-handshake. If you want disable this 
-     *  session ticket validation check in TLS1.2 and below, define
+     *  judged expired, falls back to full-handshake. If you want disable this
+     *  sessin ticket validation check in TLS1.2 and below, define
      *  WOLFSSL_NO_TICKET_EXPRE.
      */
     int HandleTlsResumption(WOLFSSL* ssl, int bogusID, Suites* clSuites)
@@ -30928,7 +30928,7 @@ static int TicketEncDec(byte* key, int keyLen, byte* iv, byte* aad, int aadSz,
  * Generate a new key if the current ones are expired.
  * If the secondary key has not been used and the primary key has expired then
  * generate a new primary key.
- * 
+ *
  * @param [in]   Ticket encryption callback context.
  * @param [in]   Session ticket lifetime.
  * @param [out]  Index of key to use for encryption.
@@ -32760,9 +32760,9 @@ int wolfSSL_set_iotsafe_ctx(WOLFSSL *ssl, IOTSAFE *iotsafe)
 WOLFSSL_BY_DIR_HASH* wolfSSL_BY_DIR_HASH_new(void)
 {
     WOLFSSL_BY_DIR_HASH* dir_hash;
-    
+
     WOLFSSL_ENTER("wolfSSL_BY_DIR_HASH_new");
-    
+
     dir_hash = (WOLFSSL_BY_DIR_HASH*)XMALLOC(sizeof(WOLFSSL_BY_DIR_HASH), NULL,
         DYNAMIC_TYPE_OPENSSL);
     if (dir_hash) {
@@ -32782,9 +32782,9 @@ void wolfSSL_BY_DIR_HASH_free(WOLFSSL_BY_DIR_HASH* dir_hash)
 WOLFSSL_STACK* wolfSSL_sk_BY_DIR_HASH_new_null(void)
 {
     WOLFSSL_STACK* sk = wolfSSL_sk_new_node(NULL);
-    
+
     WOLFSSL_ENTER("wolfSSL_sk_BY_DIR_HASH_new_null");
-    
+
     if (sk) {
         sk->type = STACK_TYPE_BY_DIR_hash;
     }
@@ -32801,7 +32801,7 @@ int wolfSSL_sk_BY_DIR_HASH_find(
     int i, sz;
 
     WOLFSSL_ENTER("wolfSSL_sk_BY_DIR_HASH_find");
-    
+
     if (sk == NULL || toFind == NULL) {
         return WOLFSSL_FAILURE;
     }
@@ -32820,7 +32820,7 @@ int wolfSSL_sk_BY_DIR_HASH_find(
 int wolfSSL_sk_BY_DIR_HASH_num(const WOLF_STACK_OF(WOLFSSL_BY_DIR_HASH) *sk)
 {
     WOLFSSL_ENTER("wolfSSL_sk_BY_DIR_HASH_num");
-    
+
     if (sk == NULL)
         return -1;
     return (int)sk->num;
@@ -32844,9 +32844,9 @@ WOLFSSL_BY_DIR_HASH* wolfSSL_sk_BY_DIR_HASH_pop(
 {
     WOLFSSL_STACK* node;
     WOLFSSL_BY_DIR_HASH* hash;
-    
+
     WOLFSSL_ENTER("wolfSSL_sk_BY_DIR_HASH_pop");
-    
+
     if (sk == NULL) {
         return NULL;
     }
@@ -32925,7 +32925,7 @@ int wolfSSL_sk_BY_DIR_HASH_push(WOLF_STACK_OF(WOLFSSL_BY_DIR_HASH)* sk,
     WOLFSSL_STACK* node;
 
     WOLFSSL_ENTER("wolfSSL_sk_BY_DIR_HASH_push");
-    
+
     if (sk == NULL || in == NULL) {
         return WOLFSSL_FAILURE;
     }
@@ -32960,12 +32960,12 @@ int wolfSSL_sk_BY_DIR_HASH_push(WOLF_STACK_OF(WOLFSSL_BY_DIR_HASH)* sk,
 WOLFSSL_BY_DIR_entry* wolfSSL_BY_DIR_entry_new(void)
 {
     WOLFSSL_BY_DIR_entry* entry;
-    
+
     WOLFSSL_ENTER("wolfSSL_BY_DIR_entry_new");
-    
+
     entry = (WOLFSSL_BY_DIR_entry*)XMALLOC(sizeof(WOLFSSL_BY_DIR_entry), NULL,
         DYNAMIC_TYPE_OPENSSL);
-        
+
     if (entry) {
         XMEMSET(entry, 0, sizeof(WOLFSSL_BY_DIR_entry));
     }
@@ -32975,7 +32975,7 @@ WOLFSSL_BY_DIR_entry* wolfSSL_BY_DIR_entry_new(void)
 void wolfSSL_BY_DIR_entry_free(WOLFSSL_BY_DIR_entry* entry)
 {
     WOLFSSL_ENTER("wolfSSL_BY_DIR_entry_free");
-    
+
     if (entry == NULL)
         return;
 
@@ -32986,16 +32986,16 @@ void wolfSSL_BY_DIR_entry_free(WOLFSSL_BY_DIR_entry* entry)
     if (entry->dir_name != NULL) {
         XFREE(entry->dir_name, NULL, DYNAMIC_TYPE_OPENSSL);
     }
-    
+
     XFREE(entry, NULL, DYNAMIC_TYPE_OPENSSL);
 }
 
 WOLFSSL_STACK* wolfSSL_sk_BY_DIR_entry_new_null(void)
 {
     WOLFSSL_STACK* sk = wolfSSL_sk_new_node(NULL);
-    
+
     WOLFSSL_ENTER("wolfSSL_sk_BY_DIR_entry_new_null");
-    
+
     if (sk) {
         sk->type = STACK_TYPE_BY_DIR_entry;
     }
@@ -33005,7 +33005,7 @@ WOLFSSL_STACK* wolfSSL_sk_BY_DIR_entry_new_null(void)
 int wolfSSL_sk_BY_DIR_entry_num(const WOLF_STACK_OF(WOLFSSL_BY_DIR_entry) *sk)
 {
     WOLFSSL_ENTER("wolfSSL_sk_BY_DIR_entry_num");
-    
+
     if (sk == NULL)
         return -1;
     return (int)sk->num;
@@ -33031,7 +33031,7 @@ WOLFSSL_BY_DIR_entry* wolfSSL_sk_BY_DIR_entry_pop(
     WOLFSSL_BY_DIR_entry* entry;
 
     WOLFSSL_ENTER("wolfSSL_sk_BY_DIR_entry_pop");
-    
+
     if (sk == NULL) {
         return NULL;
     }

+ 86 - 86
src/sniffer.c

@@ -148,7 +148,7 @@ enum {
     PSEUDO_HDR_SZ      = 12,  /* TCP Pseudo Header size in bytes */
     FATAL_ERROR_STATE  = 1,   /* SnifferSession fatal error state */
     TICKET_HINT_LEN    = 4,   /* Session Ticket Hint length */
-    TICKET_HINT_AGE_LEN= 4,   /* Session Ticket Age add length */        
+    TICKET_HINT_AGE_LEN= 4,   /* Session Ticket Age add length */
     EXT_TYPE_SZ        = 2,   /* Extension type length */
     MAX_INPUT_SZ       = MAX_RECORD_SIZE + COMP_EXTRA + MAX_MSG_EXTRA +
                          MTU_EXTRA,  /* Max input sz of reassembly */
@@ -188,26 +188,26 @@ BOOL APIENTRY DllMain( HMODULE hModule,
                        LPVOID lpReserved
                      )
 {
-	static int didInit = 0;
+    static int didInit = 0;
 
     switch (ul_reason_for_call)
     {
     case DLL_PROCESS_ATTACH:
-		if (didInit == 0) {
+        if (didInit == 0) {
             dllModule = hModule;
-			ssl_InitSniffer();
-			didInit = 1;
-		}
+            ssl_InitSniffer();
+            didInit = 1;
+        }
         break;
     case DLL_THREAD_ATTACH:
         break;
     case DLL_THREAD_DETACH:
         break;
     case DLL_PROCESS_DETACH:
-		if (didInit) {
-			ssl_FreeSniffer();
-			didInit = 0;
-		}
+        if (didInit) {
+            ssl_FreeSniffer();
+            didInit = 0;
+        }
         break;
     }
     return TRUE;
@@ -363,7 +363,7 @@ static const char* const msgTable[] =
 /* *nix version uses table above */
 static void GetError(int idx, char* str)
 {
-    if (str == NULL || 
+    if (str == NULL ||
             idx < 0 || idx > (int)(sizeof(msgTable)/sizeof(const char* const)))
         return;
     XSTRNCPY(str, msgTable[idx - 1], MAX_ERROR_LEN-1);
@@ -769,7 +769,7 @@ void ssl_FreeSniffer(void)
         srv = srv->next;
         FreeSnifferServer(removeServer);
     }
-    ServerList = NULL;    
+    ServerList = NULL;
 
     wc_UnLockMutex(&SessionMutex);
     wc_UnLockMutex(&ServerListMutex);
@@ -1074,10 +1074,10 @@ static void TraceSetNamedServer(const char* name,
     if (TraceOn) {
         XFPRINTF(TraceFile, "\tTrying to install a new Sniffer Server with\n");
         XFPRINTF(TraceFile, "\tname: %s, server: %s, port: %d, keyFile: %s\n",
-		name ? name : "",
-		srv ? srv : "",
-		port,
-		keyFile ? keyFile : "");
+                 name ? name : "",
+                 srv ? srv : "",
+                 port,
+                 keyFile ? keyFile : "");
     }
 }
 
@@ -1543,7 +1543,7 @@ static int LoadKeyFile(byte** keyBuf, word32* keyBufSz,
             return -1;
         }
         fileSz = keySz;
-        XMEMCPY(loadBuf, keyFile, fileSz);        
+        XMEMCPY(loadBuf, keyFile, fileSz);
     }
 
     if (typeKey == WOLFSSL_FILETYPE_PEM) {
@@ -1607,7 +1607,7 @@ static int CreateWatchSnifferServer(char* error)
     }
 #ifdef WOLF_CRYPTO_CB
     if (CryptoDeviceId != INVALID_DEVID)
-	    wolfSSL_CTX_SetDevId(sniffer->ctx, CryptoDeviceId);
+        wolfSSL_CTX_SetDevId(sniffer->ctx, CryptoDeviceId);
 #endif
 
     /* add to server list */
@@ -1725,7 +1725,7 @@ static int SetNamedPrivateKey(const char* name, const char* address, int port,
         if (isEphemeralKey) {
             /* auto detect key type with WC_PK_TYPE_NONE */
             /* keySz == 0 mean load file */
-            ret = wolfSSL_CTX_set_ephemeral_key(sniffer->ctx, WC_PK_TYPE_NONE, 
+            ret = wolfSSL_CTX_set_ephemeral_key(sniffer->ctx, WC_PK_TYPE_NONE,
                 keyFile, keySz, type);
             if (ret == 0)
                 ret = WOLFSSL_SUCCESS;
@@ -1747,9 +1747,9 @@ static int SetNamedPrivateKey(const char* name, const char* address, int port,
                 FreeSnifferServer(sniffer);
             return -1;
         }
-	#ifdef WOLF_CRYPTO_CB
-		wolfSSL_CTX_SetDevId(sniffer->ctx, CryptoDeviceId);
-	#endif
+    #ifdef WOLF_CRYPTO_CB
+        wolfSSL_CTX_SetDevId(sniffer->ctx, CryptoDeviceId);
+    #endif
     }
 #ifdef HAVE_SNI
     else {
@@ -1795,7 +1795,7 @@ int ssl_SetNamedPrivateKey(const char* name,
 
 int ssl_SetNamedPrivateKeyBuffer(const char* name,
                                  const char* address, int port,
-                                 const char* keyBuf, int keySz, int typeKey, 
+                                 const char* keyBuf, int keySz, int typeKey,
                                  const char* password, char* error)
 {
     int ret;
@@ -1817,8 +1817,8 @@ int ssl_SetNamedPrivateKeyBuffer(const char* name,
 
 /* Sets the private key for a specific server and port  */
 /* returns 0 on success, -1 on error */
-int ssl_SetPrivateKey(const char* address, int port, 
-                      const char* keyFile, int typeKey, 
+int ssl_SetPrivateKey(const char* address, int port,
+                      const char* keyFile, int typeKey,
                       const char* password, char* error)
 {
     int ret;
@@ -1838,7 +1838,7 @@ int ssl_SetPrivateKey(const char* address, int port,
 }
 
 int ssl_SetPrivateKeyBuffer(const char* address, int port,
-                            const char* keyBuf, int keySz, int typeKey, 
+                            const char* keyBuf, int keySz, int typeKey,
                             const char* password, char* error)
 {
     int ret;
@@ -1867,82 +1867,82 @@ int ssl_SetNamedEphemeralKey(const char* name,
                              const char* password, char* error)
 {
     int ret;
-    
+
     TraceHeader();
     TraceSetNamedServer(name, address, port, keyFile);
-    
+
     wc_LockMutex(&ServerListMutex);
     ret = SetNamedPrivateKey(name, address, port, keyFile, 0,
                              typeKey, password, error, 1);
     wc_UnLockMutex(&ServerListMutex);
-    
+
     if (ret == 0)
         Trace(NEW_SERVER_STR);
-    
+
     return ret;
 }
 
 int ssl_SetNamedEphemeralKeyBuffer(const char* name,
                                    const char* address, int port,
-                                   const char* keyBuf, int keySz, int typeKey, 
+                                   const char* keyBuf, int keySz, int typeKey,
                                    const char* password, char* error)
 {
     int ret;
-    
+
     TraceHeader();
     TraceSetNamedServer(name, address, port, NULL);
-    
+
     wc_LockMutex(&ServerListMutex);
     ret = SetNamedPrivateKey(name, address, port, keyBuf, keySz,
                              typeKey, password, error, 1);
     wc_UnLockMutex(&ServerListMutex);
-    
+
     if (ret == 0)
         Trace(NEW_SERVER_STR);
-    
+
     return ret;
 }
 #endif /* HAVE_SNI */
 
 /* Sets the ephemeral key for a specific server and port  */
 /* returns 0 on success, -1 on error */
-int ssl_SetEphemeralKey(const char* address, int port, 
-                        const char* keyFile, int typeKey, 
+int ssl_SetEphemeralKey(const char* address, int port,
+                        const char* keyFile, int typeKey,
                         const char* password, char* error)
 {
     int ret;
-    
+
     TraceHeader();
     TraceSetServer(address, port, keyFile);
-    
+
     wc_LockMutex(&ServerListMutex);
     ret = SetNamedPrivateKey(NULL, address, port, keyFile, 0,
                              typeKey, password, error, 1);
     wc_UnLockMutex(&ServerListMutex);
-    
+
     if (ret == 0)
         Trace(NEW_SERVER_STR);
-    
+
     return ret;
 }
 
-int ssl_SetEphemeralKeyBuffer(const char* address, int port, 
-                              const char* keyBuf, int keySz, int typeKey, 
+int ssl_SetEphemeralKeyBuffer(const char* address, int port,
+                              const char* keyBuf, int keySz, int typeKey,
                               const char* password, char* error)
 {
     int ret;
-    
+
     TraceHeader();
     TraceSetServer(address, port, "from buffer");
-    
+
     wc_LockMutex(&ServerListMutex);
     ret = SetNamedPrivateKey(NULL, address, port, keyBuf, keySz,
                              typeKey, password, error, 1);
     wc_UnLockMutex(&ServerListMutex);
-    
+
     if (ret == 0)
         Trace(NEW_SERVER_STR);
-    
+
     return ret;
 }
 #endif /* WOLFSSL_STATIC_EPHEMERAL */
@@ -2174,7 +2174,7 @@ typedef struct {
 #endif
 } KeyBuffers_t;
 
-static int SetupKeys(const byte* input, int* sslBytes, SnifferSession* session, 
+static int SetupKeys(const byte* input, int* sslBytes, SnifferSession* session,
     char* error, KeyShareInfo* ksInfo, KeyBuffers_t* keys)
 {
     word32 idx = 0;
@@ -2353,7 +2353,7 @@ static int SetupKeys(const byte* input, int* sslBytes, SnifferSession* session,
             ret = wc_DhSetNamedKey(&dhKey, ksInfo->named_group);
 #endif
             if (ret == 0) {
-                ret = wc_DhKeyDecode(keyBuf->buffer, &idx, &dhKey, 
+                ret = wc_DhKeyDecode(keyBuf->buffer, &idx, &dhKey,
                     keyBuf->length);
             }
 #ifndef HAVE_PUBLIC_FFDHE
@@ -2364,7 +2364,7 @@ static int SetupKeys(const byte* input, int* sslBytes, SnifferSession* session,
             }
 #endif
             if (ret == 0) {
-                ret = wc_DhExportKeyPair(&dhKey, privKey, &privKeySz, NULL, 
+                ret = wc_DhExportKeyPair(&dhKey, privKey, &privKeySz, NULL,
                     NULL);
             }
 
@@ -2406,7 +2406,7 @@ static int SetupKeys(const byte* input, int* sslBytes, SnifferSession* session,
             if (ret == 0 && p_len > session->sslServer->arrays->preMasterSz) {
                 word32 diff = p_len - session->sslServer->arrays->preMasterSz;
                 XMEMMOVE(session->sslServer->arrays->preMasterSecret + diff,
-                        session->sslServer->arrays->preMasterSecret, 
+                        session->sslServer->arrays->preMasterSecret,
                         session->sslServer->arrays->preMasterSz);
                 XMEMSET(session->sslServer->arrays->preMasterSecret, 0, diff);
                 session->sslServer->arrays->preMasterSz = p_len;
@@ -2420,7 +2420,7 @@ static int SetupKeys(const byte* input, int* sslBytes, SnifferSession* session,
     /* Static ECC Key */
     if (useCurveId >= 0 && keys->ecKey
     #ifdef HAVE_CURVE25519
-        && useCurveId != ECC_X25519 
+        && useCurveId != ECC_X25519
     #endif
     ) {
         ecc_key key;
@@ -2609,8 +2609,8 @@ static int SetupKeys(const byte* input, int* sslBytes, SnifferSession* session,
         session->sslServer->arrays->preMasterSz;
 
 #ifdef SHOW_SECRETS
-    PrintSecret("pre master secret", 
-                session->sslServer->arrays->preMasterSecret, 
+    PrintSecret("pre master secret",
+                session->sslServer->arrays->preMasterSecret,
                 session->sslServer->arrays->preMasterSz);
 #endif
 
@@ -2802,7 +2802,7 @@ static int ProcessServerKeyShare(SnifferSession* session, const byte* input, int
     int ret;
 
     if (session->cliKeyShare == NULL || session->cliKeyShareSz == 0) {
-        /* session->cliKeyShareSz could not be provided yet if the client_hello 
+        /* session->cliKeyShareSz could not be provided yet if the client_hello
             did not send a key share to force a hello_retry_request */
         return 0;
     }
@@ -2820,7 +2820,7 @@ static int ProcessServerKeyShare(SnifferSession* session, const byte* input, int
     }
 
     return ret;
-} 
+}
 #endif /* WOLFSSL_TLS13 */
 
 /* Process Session Ticket */
@@ -2929,7 +2929,7 @@ static int ProcessSessionTicket(const byte* input, int* sslBytes,
         /* store session with macID as sessionID */
         session->sslServer->options.haveSessionId = 1;
         if (session->sslServer->arrays) {
-            XMEMCPY(session->sslServer->arrays->sessionID, 
+            XMEMCPY(session->sslServer->arrays->sessionID,
                 input + len - ID_LEN, ID_LEN);
         }
     }
@@ -2944,7 +2944,7 @@ static int DoResume(SnifferSession* session, char* error)
 
 #ifdef WOLFSSL_TLS13
     if (IsAtLeastTLSv1_3(session->sslServer->version)) {
-        resume = GetSession(session->sslServer, 
+        resume = GetSession(session->sslServer,
                             session->sslServer->session.masterSecret, 0);
         if (resume == NULL) {
             /* TLS v1.3 with hello_retry uses session_id even for new session,
@@ -3001,11 +3001,11 @@ static int DoResume(SnifferSession* session, char* error)
         session->sslServer->arrays->psk_keySz = session->sslServer->specs.hash_size;
         session->sslClient->arrays->psk_keySz = session->sslClient->specs.hash_size;
         ret  = DeriveResumptionPSK(session->sslServer,
-            session->sslServer->session.ticketNonce.data, 
+            session->sslServer->session.ticketNonce.data,
             session->sslServer->session.ticketNonce.len,
             session->sslServer->arrays->psk_key);
         /* Copy resumption PSK to client */
-        XMEMCPY(session->sslClient->arrays->psk_key, 
+        XMEMCPY(session->sslClient->arrays->psk_key,
             session->sslServer->arrays->psk_key,
             session->sslServer->arrays->psk_keySz);
     #endif
@@ -3179,7 +3179,7 @@ static int ProcessServerHello(int msgSz, const byte* input, int* sslBytes,
             case EXT_KEY_SHARE:
                 ret = ProcessServerKeyShare(session, input, extLen, error);
                 if (ret != 0) {
-                    SetError(SERVER_HELLO_INPUT_STR, error, session, 
+                    SetError(SERVER_HELLO_INPUT_STR, error, session,
                         FATAL_ERROR_STATE);
                     return -1;
                 }
@@ -3254,8 +3254,8 @@ static int ProcessServerHello(int msgSz, const byte* input, int* sslBytes,
         if (XMEMCMP(session->sslServer->arrays->sessionID,
                 session->sslClient->arrays->sessionID, ID_LEN) == 0) {
             doResume = 1;
-        }    
-    }        
+        }
+    }
     else if (session->sslClient->options.haveSessionId == 0 &&
              session->sslServer->options.haveSessionId == 0 &&
              session->ticketID) {
@@ -3290,9 +3290,9 @@ static int ProcessServerHello(int msgSz, const byte* input, int* sslBytes,
 #endif
 
     /* hash server_hello */
-    HashRaw(session->sslServer, inputHello - HANDSHAKE_HEADER_SZ, 
+    HashRaw(session->sslServer, inputHello - HANDSHAKE_HEADER_SZ,
         initialBytes + HANDSHAKE_HEADER_SZ);
-    HashRaw(session->sslClient, inputHello - HANDSHAKE_HEADER_SZ, 
+    HashRaw(session->sslClient, inputHello - HANDSHAKE_HEADER_SZ,
         initialBytes + HANDSHAKE_HEADER_SZ);
 
     if (doResume) {
@@ -3332,7 +3332,7 @@ static int ProcessServerHello(int msgSz, const byte* input, int* sslBytes,
         #endif
     #endif
 
-        ret = SetupKeys(session->cliKs.key, &session->cliKs.key_len, 
+        ret = SetupKeys(session->cliKs.key, &session->cliKs.key_len,
             session, error, &session->cliKs, &keys);
         if (ret != 0) {
             SetError(SERVER_HELLO_INPUT_STR, error, session, FATAL_ERROR_STATE);
@@ -3365,15 +3365,15 @@ static int LoadNamedKey(SnifferSession* session, const byte* name, word16 nameSz
         #ifdef WOLFSSL_STATIC_EPHEMERAL
             if (namedKey->isEphemeralKey) {
                 /* auto detect key type with WC_PK_TYPE_NONE */
-                ret = wolfSSL_set_ephemeral_key(ssl, 
-                    WC_PK_TYPE_NONE, (const char*)namedKey->key, 
+                ret = wolfSSL_set_ephemeral_key(ssl,
+                    WC_PK_TYPE_NONE, (const char*)namedKey->key,
                     namedKey->keySz, WOLFSSL_FILETYPE_ASN1);
             }
             else
         #endif
             {
                 ret = wolfSSL_use_PrivateKey_buffer(ssl,
-                    namedKey->key, namedKey->keySz, 
+                    namedKey->key, namedKey->keySz,
                     WOLFSSL_FILETYPE_ASN1);
                 /* translate return code */
                 ret = (ret == WOLFSSL_SUCCESS) ? 0 : -1;
@@ -3598,7 +3598,7 @@ static int ProcessClientHello(const byte* input, int* sslBytes,
             idx += idLen;
 
             /* Obfuscated Ticket Age 32-bits */
-            ticketAge = (word32)((input[idx] << 24) | (input[idx+1] << 16) | 
+            ticketAge = (word32)((input[idx] << 24) | (input[idx+1] << 16) |
                                  (input[idx+2] << 8) | input[idx+3]);
             (void)ticketAge; /* not used */
             idx += OPAQUE32_LEN;
@@ -3615,9 +3615,9 @@ static int ProcessClientHello(const byte* input, int* sslBytes,
             (void)binders; /* not used */
 
             /* Hash data up to binders for deriving binders in PSK extension. */
-            HashRaw(session->sslServer, inputHello - HANDSHAKE_HEADER_SZ, 
+            HashRaw(session->sslServer, inputHello - HANDSHAKE_HEADER_SZ,
                 inputHelloSz - bindersLen + HANDSHAKE_HEADER_SZ);
-            HashRaw(session->sslClient, inputHello - HANDSHAKE_HEADER_SZ, 
+            HashRaw(session->sslClient, inputHello - HANDSHAKE_HEADER_SZ,
                 inputHelloSz - bindersLen + HANDSHAKE_HEADER_SZ);
 
             /* call to decrypt session ticket */
@@ -3668,9 +3668,9 @@ static int ProcessClientHello(const byte* input, int* sslBytes,
     }
 
     if (!didHash) {
-        HashRaw(session->sslServer, inputHello - HANDSHAKE_HEADER_SZ, 
+        HashRaw(session->sslServer, inputHello - HANDSHAKE_HEADER_SZ,
             inputHelloSz + HANDSHAKE_HEADER_SZ);
-        HashRaw(session->sslClient, inputHello - HANDSHAKE_HEADER_SZ, 
+        HashRaw(session->sslClient, inputHello - HANDSHAKE_HEADER_SZ,
             inputHelloSz + HANDSHAKE_HEADER_SZ);
     }
 
@@ -3785,7 +3785,7 @@ static int ProcessFinished(const byte* input, int size, int* sslBytes,
 
 #ifdef WOLFSSL_TLS13
     if (IsAtLeastTLSv1_3(ssl->version)) {
-        ret = DoTls13Finished(ssl, input, &inOutIdx, (word32)size, 
+        ret = DoTls13Finished(ssl, input, &inOutIdx, (word32)size,
             (word32)*sslBytes, SNIFF);
 
         ssl->options.handShakeState = HANDSHAKE_DONE;
@@ -3794,7 +3794,7 @@ static int ProcessFinished(const byte* input, int size, int* sslBytes,
     else
 #endif
     {
-        ret = DoFinished(ssl, input, &inOutIdx, (word32)size, 
+        ret = DoFinished(ssl, input, &inOutIdx, (word32)size,
             (word32)*sslBytes, SNIFF);
     }
     *sslBytes -= (int)inOutIdx;
@@ -3841,7 +3841,7 @@ static int ProcessFinished(const byte* input, int size, int* sslBytes,
 
             session->flags.gotFinished = 1;
         #ifdef SHOW_SECRETS
-            ShowTlsSecrets(session);    
+            ShowTlsSecrets(session);
         #endif
         }
 
@@ -3971,7 +3971,7 @@ static int DoHandShake(const byte* input, int* sslBytes,
         /* For resumption the hash is before / after client_hello PSK binder */
         /* hash the packet including header */
         /* TLS v1.3 requires the hash for the handshake and transfer key derivation */
-        /* we hash even for non TLS v1.3, since we don't know if its actually 
+        /* we hash even for non TLS v1.3, since we don't know if its actually
             TLS v1.3 till later at EXT_SUPPORTED_VERSIONS in server_hello */
         /* hello retry request restarts hash prior to server_hello hash calc */
         HashRaw(session->sslServer, input - HANDSHAKE_HEADER_SZ, size + HANDSHAKE_HEADER_SZ);
@@ -4215,7 +4215,7 @@ static const byte* DecryptMessage(WOLFSSL* ssl, const byte* input, word32 sz,
 {
     int ivExtra = 0;
     int ret;
-    
+
 #ifdef WOLFSSL_TLS13
     if (IsAtLeastTLSv1_3(ssl->version)) {
         ret = DecryptTls13(ssl, output, input, sz, (byte*)rh, RECORD_HEADER_SZ);
@@ -4574,7 +4574,7 @@ static int CheckHeaders(IpInfo* ipInfo, TcpInfo* tcpInfo, const byte* packet,
         SetError(PACKET_HDR_SHORT_STR, error, NULL, 0);
         return -1;
     }
-    
+
     /* We only care about the data in the TCP/IP record. There may be extra
      * data after the IP record for the FCS for Ethernet. */
     *sslBytes = (int)(packet + ipInfo->total - *sslFrame);
@@ -4861,7 +4861,7 @@ static int AdjustSequence(TcpInfo* tcpInfo, SnifferSession* session,
                 /* adjust to expected, remove duplicate */
                 *sslFrame += overlap;
                 *sslBytes -= overlap;
-                
+
                 newEnd = *expected + *sslBytes;
                 if (newEnd > reassemblyList->begin) {
                     Trace(OVERLAP_REASSEMBLY_BEGIN_STR);
@@ -4891,7 +4891,7 @@ static int AdjustSequence(TcpInfo* tcpInfo, SnifferSession* session,
             /* This can happen with unseen acks, out of order packets, or
              * possible spurious retransmission. */
             if (*sslBytes > 0) {
-                /* If packet has data attempt to process packet, if hasn't 
+                /* If packet has data attempt to process packet, if hasn't
                  * already been ack'd during handshake */
                 if (FindPrevAck(session, real)) {
                     Trace(DUPLICATE_STR);
@@ -5025,7 +5025,7 @@ static int FindNextRecordInAssembly(SnifferSession* session,
             return 0;
         }
         else if (ssl->specs.cipher_type == block) {
-            int ivPos = (int)(curr->end - curr->begin - 
+            int ivPos = (int)(curr->end - curr->begin -
                                                      ssl->specs.block_size + 1);
             if (ssl->specs.bulk_cipher_algorithm == wolfssl_aes) {
 #ifdef BUILD_AES
@@ -5071,7 +5071,7 @@ static int FixSequence(TcpInfo* tcpInfo, SnifferSession* session)
                                 &session->flags.cliSkipPartial;
 
     *skipPartial = 1;
-    
+
     if (list != NULL)
         *expected = list->begin;
     else
@@ -5417,7 +5417,7 @@ doMessage:
     recordEnd = sslFrame + rhSize;   /* may have more than one record */
     inRecordEnd = recordEnd;
 
-    /* Make sure cipher is on for client, if we get an application data packet 
+    /* Make sure cipher is on for client, if we get an application data packet
      * and handhsake is done for server. This workaround is required if client
      * handshake packets were missed, retransmitted or sent out of order. */
     if ((enum ContentType)rh.type == application_data &&
@@ -6075,7 +6075,7 @@ int ssl_SetWatchKey_buffer(void* vSniffer, const byte* key, word32 keySz,
 #ifdef WOLFSSL_STATIC_EPHEMERAL
     /* try setting static ephemeral first */
     /* auto detect key type with WC_PK_TYPE_NONE */
-    ret = wolfSSL_set_ephemeral_key(sniffer->sslServer, 
+    ret = wolfSSL_set_ephemeral_key(sniffer->sslServer,
         WC_PK_TYPE_NONE, (const char*)key, keySz,
             WOLFSSL_FILETYPE_ASN1);
     if (ret != 0) {

+ 78 - 78
src/ssl.c

@@ -1964,8 +1964,8 @@ int wolfSSL_SetTmpDH(WOLFSSL* ssl, const unsigned char* p, int pSz,
         keySz = ssl->buffers.keySz;
     #endif
         InitSuites(ssl->suites, ssl->version, keySz, haveRSA, havePSK,
-                   ssl->options.haveDH, ssl->options.haveECDSAsig, 
-                   ssl->options.haveECC, ssl->options.haveStaticECC, 
+                   ssl->options.haveDH, ssl->options.haveECDSAsig,
+                   ssl->options.haveECC, ssl->options.haveStaticECC,
                    ssl->options.haveFalconSig, ssl->options.haveAnon,
                    ssl->options.side);
     }
@@ -4420,8 +4420,8 @@ int wolfSSL_SetVersion(WOLFSSL* ssl, int version)
     #endif
 
     InitSuites(ssl->suites, ssl->version, keySz, haveRSA, havePSK,
-               ssl->options.haveDH, ssl->options.haveECDSAsig, 
-               ssl->options.haveECC, ssl->options.haveStaticECC, 
+               ssl->options.haveDH, ssl->options.haveECDSAsig,
+               ssl->options.haveECC, ssl->options.haveStaticECC,
                ssl->options.haveFalconSig, ssl->options.haveAnon,
                ssl->options.side);
 
@@ -5586,7 +5586,7 @@ static int ProcessBufferTryDecode(WOLFSSL_CTX* ctx, WOLFSSL* ssl, DerBuffer* der
 
                     *keyFormat = ED25519k;
                     if (ssl != NULL) {
-                        /* ED25519 requires caching enabled for tracking message 
+                        /* ED25519 requires caching enabled for tracking message
                          * hash used in EdDSA_Update for signing */
                         ssl->options.cacheMessages = 1;
                         if (ssl->options.side == WOLFSSL_SERVER_END) {
@@ -5648,7 +5648,7 @@ static int ProcessBufferTryDecode(WOLFSSL_CTX* ctx, WOLFSSL* ssl, DerBuffer* der
 
                 *keyFormat = ED448k;
                 if (ssl != NULL) {
-                    /* ED448 requires caching enabled for tracking message 
+                    /* ED448 requires caching enabled for tracking message
                      * hash used in EdDSA_Update for signing */
                     ssl->options.cacheMessages = 1;
                     if (ssl->options.side == WOLFSSL_SERVER_END) {
@@ -6325,7 +6325,7 @@ int ProcessBuffer(WOLFSSL_CTX* ctx, const unsigned char* buff,
         /* let's reset suites */
         InitSuites(ssl->suites, ssl->version, keySz, haveRSA,
                    havePSK, ssl->options.haveDH, ssl->options.haveECDSAsig,
-                   ssl->options.haveECC, ssl->options.haveStaticECC, 
+                   ssl->options.haveECC, ssl->options.haveStaticECC,
                    ssl->options.haveFalconSig, ssl->options.haveAnon,
                    ssl->options.side);
     }
@@ -8062,7 +8062,7 @@ WOLFSSL_PKCS8_PRIV_KEY_INFO* wolfSSL_d2i_PKCS8_PKEY(
     if (ret == 0) {
         pkcs8->pkey.ptr = (char*)XMALLOC(der->length, NULL,
             DYNAMIC_TYPE_PUBLIC_KEY);
-        if (pkcs8->pkey.ptr == NULL) 
+        if (pkcs8->pkey.ptr == NULL)
             ret = MEMORY_E;
     }
     if (ret == 0) {
@@ -8813,7 +8813,7 @@ WOLFSSL_EVP_PKEY* wolfSSL_d2i_PrivateKey_id(int type, WOLFSSL_EVP_PKEY** out,
             key = (ecc_key*)local->ecc->internal;
             key->devId = devId;
             key->type = ECC_PRIVATEKEY;
-            /* key is required to have a key size / curve set, although 
+            /* key is required to have a key size / curve set, although
              * actual one used is determined by devId callback function */
             wc_ecc_set_curve(key, ECDHE_SIZE, ECC_CURVE_DEF);
 
@@ -9134,7 +9134,7 @@ WOLFSSL_X509_EXTENSION* wolfSSL_X509_EXTENSION_dup(WOLFSSL_X509_EXTENSION* src)
     }
     if (err == 0) {
         ret->crit = src->crit;
-        if (wolfSSL_ASN1_STRING_copy(&ret->value, &src->value) != 
+        if (wolfSSL_ASN1_STRING_copy(&ret->value, &src->value) !=
                 WOLFSSL_SUCCESS) {
             err = 1;
         }
@@ -15570,7 +15570,7 @@ int wolfSSL_GetSessionAtIndex(int idx, WOLFSSL_SESSION* session)
     row = idx >> SESSIDX_ROW_SHIFT;
     col = idx & SESSIDX_IDX_MASK;
 
-    if (session == NULL || 
+    if (session == NULL ||
             row < 0 || row >= SESSION_ROWS || col >= SESSIONS_PER_ROW) {
         return WOLFSSL_FAILURE;
     }
@@ -16126,8 +16126,8 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
             keySz = ssl->buffers.keySz;
         #endif
         InitSuites(ssl->suites, ssl->version, keySz, haveRSA, TRUE,
-                   ssl->options.haveDH, ssl->options.haveECDSAsig, 
-                   ssl->options.haveECC, ssl->options.haveStaticECC, 
+                   ssl->options.haveDH, ssl->options.haveECDSAsig,
+                   ssl->options.haveECC, ssl->options.haveStaticECC,
                    ssl->options.haveFalconSig, ssl->options.haveAnon,
                    ssl->options.side);
     }
@@ -16179,8 +16179,8 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
             keySz = ssl->buffers.keySz;
         #endif
         InitSuites(ssl->suites, ssl->version, keySz, haveRSA, TRUE,
-                   ssl->options.haveDH, ssl->options.haveECDSAsig, 
-                   ssl->options.haveECC, ssl->options.haveStaticECC, 
+                   ssl->options.haveDH, ssl->options.haveECDSAsig,
+                   ssl->options.haveECC, ssl->options.haveStaticECC,
                    ssl->options.haveFalconSig, ssl->options.haveAnon,
                    ssl->options.side);
     }
@@ -18170,7 +18170,7 @@ int wolfSSL_CTX_set_max_proto_version(WOLFSSL_CTX* ctx, int version)
     }
 
     /* when 0 is specified as version, try to find out the min version from
-     * the bottom to top of the protoverTbl. 
+     * the bottom to top of the protoverTbl.
      */
     for (i = NUMBER_OF_PROTOCOLS -1; i >= 0; i--) {
         ret = Set_CTX_max_proto_version(ctx, protoVerTbl[i]);
@@ -18350,7 +18350,7 @@ int wolfSSL_set_max_proto_version(WOLFSSL* ssl, int version)
     }
 
     /* when 0 is specified as version, try to find out the min version from
-     * the bottom to top of the protoverTbl. 
+     * the bottom to top of the protoverTbl.
      */
     for (i = NUMBER_OF_PROTOCOLS -1; i >= 0; i--) {
         ret = Set_SSL_max_proto_version(ssl, protoVerTbl[i]);
@@ -21841,7 +21841,7 @@ void wolfSSL_GENERAL_NAMES_free(WOLFSSL_GENERAL_NAMES *gens)
 }
 
 #if defined(OPENSSL_ALL) && !defined(NO_BIO)
-/* Outputs name string of the given WOLFSSL_GENERAL_NAME_OBJECT to WOLFSSL_BIO. 
+/* Outputs name string of the given WOLFSSL_GENERAL_NAME_OBJECT to WOLFSSL_BIO.
  * Can handle following GENERAL_NAME_OBJECT types:
  *  - GEN_OTHERNAME #
  *  - GEN_EMAIL
@@ -21853,13 +21853,13 @@ void wolfSSL_GENERAL_NAMES_free(WOLFSSL_GENERAL_NAMES *gens)
  *  - GEN_RID
  * The each name string to be output has "typename:namestring" format.
  * For instance, email name string will be output as "email:info@wolfssl.com".
- * However,some types above marked with "#" will be output with 
+ * However,some types above marked with "#" will be output with
  * "typename:<unsupported>".
- * 
+ *
  * Parameters:
  *  - out: WOLFSSL_BIO object which is the output destination
  *  - gen: WOLFSSL_GENERAL_NAME object to be output its name
- * 
+ *
  * Returns WOLFSSL_SUCCESS on success, WOLFSSL_FAILURE on failure.
  */
 int wolfSSL_GENERAL_NAME_print(WOLFSSL_BIO* out, WOLFSSL_GENERAL_NAME* gen)
@@ -21913,7 +21913,7 @@ int wolfSSL_GENERAL_NAME_print(WOLFSSL_BIO* out, WOLFSSL_GENERAL_NAME* gen)
                                                          XN_FLAG_ONELINE);
         }
         break;
-        
+
     case GEN_EDIPARTY:
         ret = wolfSSL_BIO_printf(out, "EdiPartyName:<unsupported>");
         ret = (ret > 0) ? WOLFSSL_SUCCESS : WOLFSSL_FAILURE;
@@ -21940,14 +21940,14 @@ int wolfSSL_GENERAL_NAME_print(WOLFSSL_BIO* out, WOLFSSL_GENERAL_NAME* gen)
             p = (unsigned char*)gen->d.iPAddress->strData;
 
             if (gen->d.iPAddress->length == 4) {
-                ret = wolfSSL_BIO_printf(out, ":%d.%d.%d.%d", 
+                ret = wolfSSL_BIO_printf(out, ":%d.%d.%d.%d",
                                   p[0],p[1],p[2],p[3]);
             }
             else if (gen->d.iPAddress->length == 16) {
 
                 for (i = 0; i < 16 && ret == WOLFSSL_SUCCESS;) {
                     wd = p[i] << 8 | p[i+1];
-                  
+
                     i += 2;
                     ret = wolfSSL_BIO_printf(out, ":%X", wd);
                     ret = (ret > 0) ? WOLFSSL_SUCCESS : WOLFSSL_FAILURE;
@@ -25307,20 +25307,20 @@ int wolfSSL_CIPHER_get_cipher_nid(const WOLFSSL_CIPHER* cipher)
         {"HC128",                   NID_undef},
         {NULL,                      NID_undef}
     };
-    
+
     const struct ciphernid* c;
     const char* encStr;
     char n[MAX_SEGMENTS][MAX_SEGMENT_SZ] = {{0}};
-    
+
     WOLFSSL_ENTER("wolfSSL_CIPHER_get_cipher_nid");
-    
+
     if (GetCipherSegment(cipher, n) == NULL) {
         WOLFSSL_MSG("no suitable cipher name found");
         return NID_undef;
     }
 
     encStr = GetCipherEncStr(n);
-    
+
     if (encStr != NULL) {
         for(c = ciphernid_tbl; c->alg_name != NULL; c++) {
             if (XSTRNCMP(c->alg_name, encStr, XSTRLEN(c->alg_name)) == 0) {
@@ -25328,7 +25328,7 @@ int wolfSSL_CIPHER_get_cipher_nid(const WOLFSSL_CIPHER* cipher)
             }
         }
     }
-    
+
     return NID_undef;
 }
 /* return digest NID corresponding to cipher suite
@@ -25346,27 +25346,27 @@ int wolfSSL_CIPHER_get_digest_nid(const WOLFSSL_CIPHER* cipher)
         {"SHA384",  NID_sha384},
         {NULL,      NID_undef}
     };
-    
+
     const struct macnid* mc;
     const char* name;
     const char* macStr;
     char n[MAX_SEGMENTS][MAX_SEGMENT_SZ] = {{0}};
     (void)name;
-    
+
     WOLFSSL_ENTER("wolfSSL_CIPHER_get_digest_nid");
-    
+
     if ((name = GetCipherSegment(cipher, n)) == NULL) {
         WOLFSSL_MSG("no suitable cipher name found");
         return NID_undef;
     }
-    
+
     /* in MD5 case, NID will be NID_md5 */
     if (XSTRSTR(name, "MD5") != NULL) {
         return NID_md5;
     }
-    
+
     macStr = GetCipherMacStr(n);
-    
+
     if (macStr != NULL) {
         for(mc = macnid_tbl; mc->alg_name != NULL; mc++) {
             if (XSTRNCMP(mc->alg_name, macStr, XSTRLEN(mc->alg_name)) == 0) {
@@ -25374,7 +25374,7 @@ int wolfSSL_CIPHER_get_digest_nid(const WOLFSSL_CIPHER* cipher)
             }
         }
     }
-    
+
     return NID_undef;
 }
 /* return key exchange NID corresponding to cipher suite
@@ -25397,27 +25397,27 @@ static const struct kxnid {
         {"RSA",       NID_kx_rsa},
         {NULL,        NID_undef}
     };
-    
+
     const struct kxnid* k;
     const char* name;
     const char* keaStr;
     char n[MAX_SEGMENTS][MAX_SEGMENT_SZ] = {{0}};
     (void)name;
-    
+
     WOLFSSL_ENTER("wolfSSL_CIPHER_get_kx_nid");
-    
+
     if ((name = GetCipherSegment(cipher, n)) == NULL) {
         WOLFSSL_MSG("no suitable cipher name found");
         return NID_undef;
     }
-    
+
     /* in TLS 1.3 case, NID will be NID_kx_any */
     if (XSTRNCMP(name, "TLS13", 5) == 0) {
         return NID_kx_any;
     }
-    
+
     keaStr = GetCipherKeaStr(n);
-    
+
     if (keaStr != NULL) {
         for(k = kxnid_table; k->name != NULL; k++) {
             if (XSTRNCMP(k->name, keaStr, XSTRLEN(k->name)) == 0) {
@@ -25426,7 +25426,7 @@ static const struct kxnid {
             }
         }
     }
-    
+
     return NID_undef;
 }
 /* check if cipher suite is AEAD
@@ -25443,7 +25443,7 @@ int wolfSSL_CIPHER_is_aead(const WOLFSSL_CIPHER* cipher)
         WOLFSSL_MSG("no suitable cipher name found");
         return NID_undef;
     }
-    
+
     return IsCipherAEAD(n);
 }
 /* Creates cipher->description based on cipher->offset
@@ -25480,7 +25480,7 @@ int wolfSSL_sk_CIPHER_description(WOLFSSL_CIPHER* cipher)
     pv.major = cipher_names[offset].major;
     pv.minor = cipher_names[offset].minor;
     protocol = wolfSSL_internal_get_version(&pv);
-    
+
     if ((name = GetCipherSegment(cipher, n)) == NULL) {
         WOLFSSL_MSG("no suitable cipher name found");
         return WOLFSSL_FAILURE;
@@ -27246,7 +27246,7 @@ int wolfSSL_X509_VERIFY_PARAM_set1_ip_asc(WOLFSSL_X509_VERIFY_PARAM *param,
 
     return ret;
 }
-/* Sets the expected IP address to ip(asc) 
+/* Sets the expected IP address to ip(asc)
  *          by re-constructing IP address in ascii
  * @param  param is a pointer to the X509_VERIFY_PARAM structure
  * @param  ip    in binary format of ip address
@@ -27288,26 +27288,26 @@ int wolfSSL_X509_VERIFY_PARAM_set1_ip(WOLFSSL_X509_VERIFY_PARAM* param,
         /* ipv6 normal address scheme
         *   y1:y2:y3:y4:y5:y6:y7:y8, len(yx):4, len(y1-y8):32. len(":"):7
         *   Max len is 32 + 7 + 1(Termination) = 40 bytes
-        *  
+        *
         *   ipv6 dual address
         *   Or y1:y2:y3:y4:y:y6:x.x.x.x yx is 4, y1-y6 is 24, ":" is 6
         *   x.x.x.x is 15.
         *   Max len is 24 + 6 + 15 + 1(Termination) = 46 bytes
-        * 
+        *
         *   Expect data in ip[16]
         *   e.g (aaaa):(bbbb):(cccc):....(hhhh)
         *   (aaaa) = (ip[0<<8)|ip[1]
         *   ......
         *   (hhhh) = (ip[14]<<8)|(ip[15])
-        * 
+        *
         *   e.g ::(gggg):(hhhh)
         *   ip[0]-[11] = 0
         *   (gggg) = (ip[12]<<8) |(ip[13])
         *   (hhhh) = (ip[14]<<8) |(ip[15])
-        * 
+        *
         *   Because it is not able to know which ivp6 scheme uses from data to
-        *   reconstruct IP address, this function assumes 
-        *   ivp6 normal address scheme, not dual adress scheme, 
+        *   reconstruct IP address, this function assumes
+        *   ivp6 normal address scheme, not dual adress scheme,
         *   to re-construct IP address in ascii.
         */
         buf = (char*)XMALLOC(max_ipv6_len, NULL, DYNAMIC_TYPE_TMP_BUFFER);
@@ -27349,7 +27349,7 @@ int wolfSSL_X509_VERIFY_PARAM_set1_ip(WOLFSSL_X509_VERIFY_PARAM* param,
             if ((*p) == ':') {
             /* when the last character is :, the followig segments are zero
              * Therefore, adding : and null termination
-             */ 
+             */
                  p++;
                  *p++ = ':';
                 *p = '\0';
@@ -27371,7 +27371,7 @@ int wolfSSL_X509_VERIFY_PARAM_set1_ip(WOLFSSL_X509_VERIFY_PARAM* param,
     (void)ip;
     (void)iplen;
 #endif
-    
+
     return ret;
 }
 
@@ -28645,8 +28645,8 @@ long wolfSSL_set_options(WOLFSSL* ssl, long op)
 
     if (ssl->suites != NULL && ssl->options.side != WOLFSSL_NEITHER_END)
         InitSuites(ssl->suites, ssl->version, keySz, haveRSA, havePSK,
-                   ssl->options.haveDH, ssl->options.haveECDSAsig, 
-                   ssl->options.haveECC, ssl->options.haveStaticECC, 
+                   ssl->options.haveDH, ssl->options.haveECDSAsig,
+                   ssl->options.haveECC, ssl->options.haveStaticECC,
                    ssl->options.haveFalconSig, ssl->options.haveAnon,
                    ssl->options.side);
 
@@ -29247,16 +29247,16 @@ WOLFSSL_API WOLFSSL_EVP_PKEY *wolfSSL_get_privatekey(const WOLFSSL *ssl)
 
 /**
  * Get a textual representation of given WOLFSSL_ASN1_OBJECT then write it to
- * buf at most buf_len bytes. 
- * 
+ * buf at most buf_len bytes.
+ *
  * params
  * - buf: buffer where the textual representation is to be written to
  * - buf_len: buffer size in bytes
  * - a: WOLFSSL_ASN1_OBJECT
- * 
+ *
  * return the string length written on success, WOLFSSL_FAILURE on failure.
  */
-WOLFSSL_API int wolfSSL_i2t_ASN1_OBJECT(char *buf, int buf_len, 
+WOLFSSL_API int wolfSSL_i2t_ASN1_OBJECT(char *buf, int buf_len,
                                                 WOLFSSL_ASN1_OBJECT *a)
 {
     WOLFSSL_ENTER("wolfSSL_i2t_ASN1_OBJECT");
@@ -29488,7 +29488,7 @@ WOLFSSL_API size_t wolfSSL_get_peer_finished(const WOLFSSL *ssl, void *buf, size
 {
     byte len = 0;
     WOLFSSL_ENTER("SSL_get_peer_finished");
-    
+
     if (!ssl || !buf || count < TLS_FINISHED_SZ) {
         WOLFSSL_MSG("Bad parameter");
         return WOLFSSL_FAILURE;
@@ -29579,21 +29579,21 @@ WOLFSSL_API long wolfSSL_set_tlsext_status_ocsp_resp(WOLFSSL *s, unsigned char *
  * @param mode maximum fragment length mode
  * @return 1 on success, otherwise 0 or negative error code
  */
-WOLFSSL_API int wolfSSL_CTX_set_tlsext_max_fragment_length(WOLFSSL_CTX *c, 
+WOLFSSL_API int wolfSSL_CTX_set_tlsext_max_fragment_length(WOLFSSL_CTX *c,
                                                             unsigned char mode)
-{  
+{
     if (c == NULL || (mode < WOLFSSL_MFL_2_9 || mode > WOLFSSL_MFL_2_12 ))
         return BAD_FUNC_ARG;
 
     return wolfSSL_CTX_UseMaxFragment(c, mode);
 }
 /**
- * Set max fragment tls extension 
+ * Set max fragment tls extension
  * @param c a pointer to WOLFSSL object
  * @param mode maximum fragment length mode
  * @return 1 on success, otherwise 0 or negative error code
  */
-WOLFSSL_API int wolfSSL_set_tlsext_max_fragment_length(WOLFSSL *s, 
+WOLFSSL_API int wolfSSL_set_tlsext_max_fragment_length(WOLFSSL *s,
                                                             unsigned char mode)
 {
     if (s == NULL || (mode < WOLFSSL_MFL_2_9 || mode > WOLFSSL_MFL_2_12 ))
@@ -33332,7 +33332,7 @@ int wolfSSL_DH_set0_pqg(WOLFSSL_DH *dh, WOLFSSL_BIGNUM *p,
     return WOLFSSL_SUCCESS;
 }
 #endif /* v1.1.0 or later */
-#endif /* !HAVE_FIPS || (HAVE_FIPS && !WOLFSSL_DH_EXTRA) || 
+#endif /* !HAVE_FIPS || (HAVE_FIPS && !WOLFSSL_DH_EXTRA) ||
         * HAVE_FIPS_VERSION > 2 */
 
 void wolfSSL_DH_get0_key(const WOLFSSL_DH *dh,
@@ -33697,7 +33697,7 @@ static int wolfSSL_RSA_generate_key_native(WOLFSSL_RSA* rsa, int bits, WOLFSSL_B
             WOLFSSL_MSG("SetRsaExternal failed");
         else {
             rsa->inSet = 1;
-	    ret = WOLFSSL_ERROR_NONE;
+            ret = WOLFSSL_ERROR_NONE;
         }
 
         wc_FreeRng(rng);
@@ -35692,8 +35692,8 @@ int wolfSSL_CMAC_Init(WOLFSSL_CMAC_CTX* ctx, const void *key, size_t keyLen,
     WOLFSSL_ENTER("wolfSSL_CMAC_Init");
 
     if (ctx == NULL || cipher == NULL || (
-            cipher != EVP_AES_128_CBC && 
-            cipher != EVP_AES_192_CBC && 
+            cipher != EVP_AES_128_CBC &&
+            cipher != EVP_AES_192_CBC &&
             cipher != EVP_AES_256_CBC)) {
         ret = WOLFSSL_FAILURE;
     }
@@ -37515,7 +37515,7 @@ int wolfSSL_ECDSA_sign(int type,
     return ret;
 }
 
-int wolfSSL_ECDSA_verify(int type, 
+int wolfSSL_ECDSA_verify(int type,
     const unsigned char *digest, int digestSz,
     const unsigned char *sig, int sigSz, WOLFSSL_EC_KEY *key)
 {
@@ -42771,7 +42771,7 @@ cleanup:
         }
 
     out:
-	if (der)
+        if (der)
             XFREE(der, NULL, DYNAMIC_TYPE_TMP_BUFFER);
 
         return ret;
@@ -43519,7 +43519,7 @@ err:
         /* unused */
         (void)cb;
         (void)u;
-	    (void)derSz;
+        (void)derSz;
 
         return NULL;
     }
@@ -44048,11 +44048,11 @@ err:
 
         (*info)->x509 = x509;
 
-        //@TODO info->num
-        //@TODO info->enc_cipher
-        //@TODO info->enc_len
-        //@TODO info->enc_data
-        //@TODO info->crl
+        /* @TODO info->num */
+        /* @TODO info->enc_cipher */
+        /* @TODO info->enc_len */
+        /* @TODO info->enc_data */
+        /* @TODO info->crl */
 
         (*info)->x_pkey = wolfSSL_X509_PKEY_new(x509->heap);
         return wolfSSL_X509_PKEY_set((*info)->x_pkey, x509);
@@ -55711,7 +55711,7 @@ static int SetStaticEphemeralKey(StaticKeyExchangeInfo_t* staticKE, int keyAlgo,
     }
 #endif
 #ifdef HAVE_CURVE25519
-    if (keyAlgo == WC_PK_TYPE_CURVE25519 && staticKE->x25519Key && 
+    if (keyAlgo == WC_PK_TYPE_CURVE25519 && staticKE->x25519Key &&
                                                         staticKE->weOwnX25519) {
         FreeDer(&staticKE->x25519Key);
     }

+ 24 - 24
src/tls.c

@@ -119,7 +119,7 @@ static int TLSX_PopulateSupportedGroups(WOLFSSL* ssl, TLSX** extensions);
 #endif
 
 #ifdef WOLFSSL_RENESAS_TSIP_TLS
-    
+
     #if (WOLFSSL_RENESAS_TSIP_VER >=109)
 
     int tsip_generateMasterSecretEx(
@@ -131,14 +131,14 @@ static int TLSX_PopulateSupportedGroups(WOLFSSL* ssl, TLSX** extensions);
             byte*       ms);
 
     #elif (WOLFSSL_RENESAS_TSIP_VER >=106)
-    
+
     int tsip_generateMasterSecret(
             const byte* pre,
             const byte* cr,
             const byte* sr,
             byte*       ms);
-    
-    #endif     
+
+    #endif
 
     int tsip_useable(const WOLFSSL *ssl);
     int tsip_generateSeesionKey(WOLFSSL *ssl);
@@ -551,17 +551,17 @@ int MakeTlsMasterSecret(WOLFSSL* ssl)
 #if defined(WOLFSSL_RENESAS_TSIP_TLS) && \
     !defined(NO_WOLFSSL_RENESAS_TSIP_TLS_SESSION)
         if (tsip_useable(ssl)) {
-            
+
             #if (WOLFSSL_RENESAS_TSIP_VER>=109)
 
             ret = tsip_generateMasterSecretEx(
                             ssl->options.cipherSuite0,
-                            ssl->options.cipherSuite,                
+                            ssl->options.cipherSuite,
                             &ssl->arrays->preMasterSecret[VERSION_SZ],
                             ssl->arrays->clientRandom,
                             ssl->arrays->serverRandom,
                             ssl->arrays->tsip_masterSecret);
-            
+
             #elif (WOLFSSL_RENESAS_TSIP_VER>=106)
 
             ret = tsip_generateMasterSecret(
@@ -3015,7 +3015,7 @@ static int TLSX_CSR_Parse(WOLFSSL* ssl, const byte* input, word16 length,
 #endif
 
 #if !defined(NO_WOLFSSL_CLIENT) && defined(WOLFSSL_TLS13) \
- || !defined(NO_WOLFSSL_SERVER) 
+ || !defined(NO_WOLFSSL_SERVER)
     word32 offset = 0;
 #endif
 
@@ -3050,7 +3050,7 @@ static int TLSX_CSR_Parse(WOLFSSL* ssl, const byte* input, word16 length,
                 case WOLFSSL_CSR_OCSP:
                     /* propagate nonce */
                     if (csr->request.ocsp.nonceSz) {
-                        request = 
+                        request =
                             (OcspRequest*)TLSX_CSR_GetRequest(ssl->extensions);
 
                         if (request) {
@@ -5519,7 +5519,7 @@ static int TLSX_SupportedVersions_Write(void* data, byte* output,
             }
     #ifdef WOLFSSL_ALLOW_TLSV10
         #if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER)
-            if ((ssl->options.mask & SSL_OP_NO_TLSv1) == 0 && 
+            if ((ssl->options.mask & SSL_OP_NO_TLSv1) == 0 &&
                 (ssl->options.minDowngrade <= TLSv1_MINOR))
         #endif
             {
@@ -6214,7 +6214,7 @@ static int TLSX_KeyShare_GenDhKey(WOLFSSL *ssl, KeyShareEntry* kse)
             if (kse->privKey == NULL)
                 ret = MEMORY_E;
         }
-    
+
         if (ret == 0) {
         #if defined(WOLFSSL_STATIC_EPHEMERAL) && defined(WOLFSSL_DH_EXTRA)
             if (ssl->staticKE.dhKey) {
@@ -6224,7 +6224,7 @@ static int TLSX_KeyShare_GenDhKey(WOLFSSL *ssl, KeyShareEntry* kse)
                 ret = wc_DhKeyDecode(keyDer->buffer, &idx,
                         dhKey, keyDer->length);
                 if (ret == 0) {
-                    ret = wc_DhExportKeyPair(dhKey, 
+                    ret = wc_DhExportKeyPair(dhKey,
                         (byte*)kse->privKey, &kse->keyLen, /* private */
                         kse->pubKey, &kse->pubKeyLen /* public */
                     );
@@ -6234,7 +6234,7 @@ static int TLSX_KeyShare_GenDhKey(WOLFSSL *ssl, KeyShareEntry* kse)
         #endif
             {
                 /* Generate a new key pair */
-                /* For async this is called once and when event is done, the 
+                /* For async this is called once and when event is done, the
                  *   provided buffers will be populated.
                  * Final processing is zero pad below. */
                 ret = DhGenKeyPair(ssl, dhKey,
@@ -6273,7 +6273,7 @@ static int TLSX_KeyShare_GenDhKey(WOLFSSL *ssl, KeyShareEntry* kse)
     #endif
     }
 
-    /* Always release the DH key to free up memory. 
+    /* Always release the DH key to free up memory.
      * The DhKey will be setup again in TLSX_KeyShare_ProcessDh */
     if (dhKey != NULL)
         wc_FreeDhKey(dhKey);
@@ -6445,7 +6445,7 @@ static int TLSX_KeyShare_GenX448Key(WOLFSSL *ssl, KeyShareEntry* kse)
         }
         kse->pubKeyLen = CURVE448_KEY_SIZE; /* always CURVE448_KEY_SIZE */
     }
-        
+
 #ifdef WOLFSSL_DEBUG_TLS
     if (ret == 0) {
         WOLFSSL_MSG("Public Curve448 Key");
@@ -6553,7 +6553,7 @@ static int TLSX_KeyShare_GenEccKey(WOLFSSL *ssl, KeyShareEntry* kse)
                 ret = wc_ecc_set_curve(eccKey, kse->keyLen, curveId);
                 if (ret == 0) {
                     /* Generate ephemeral ECC key */
-                    /* For async this is called once and when event is done, the 
+                    /* For async this is called once and when event is done, the
                     *   provided buffers in key be populated.
                     * Final processing is x963 key export below. */
                     ret = EccMakeKey(ssl, eccKey, eccKey);
@@ -7307,7 +7307,7 @@ static int TLSX_KeyShare_ProcessEcc(WOLFSSL* ssl, KeyShareEntry* keyShareEntry)
             /* unsupported curve */
             return ECC_PEERKEY_ERROR;
     }
-    
+
 #ifdef WOLFSSL_ASYNC_CRYPT
     if (keyShareEntry->lastRet == 0) /* don't enter here if WC_PENDING_E */
 #endif
@@ -7782,7 +7782,7 @@ static int TLSX_KeyShare_Parse(WOLFSSL* ssl, const byte* input, word16 length,
             return BUFFER_ERROR;
 
         /* Not in list sent if there isn't a private key. */
-        if (keyShareEntry == NULL || (keyShareEntry->key == NULL 
+        if (keyShareEntry == NULL || (keyShareEntry->key == NULL
         #if !defined(NO_DH) || defined(HAVE_LIBOQS)
             && keyShareEntry->privKey == NULL
         #endif
@@ -8536,7 +8536,7 @@ int TLSX_KeyShare_Establish(WOLFSSL *ssl, int* doHelloRetry)
     if (clientKSE == NULL) {
         /* Set KEY_SHARE_ERROR to indicate HelloRetryRequest required. */
         *doHelloRetry = 1;
-        return TLSX_KeyShare_SetSupported(ssl);        
+        return TLSX_KeyShare_SetSupported(ssl);
     }
 
     list = NULL;
@@ -8565,7 +8565,7 @@ int TLSX_KeyShare_Establish(WOLFSSL *ssl, int* doHelloRetry)
         }
 
         /* for async do setup of serverKSE below, but return WC_PENDING_E */
-        if (ret != 0 
+        if (ret != 0
         #ifdef WOLFSSL_ASYNC_CRYPT
             && ret != WC_PENDING_E
         #endif
@@ -9444,16 +9444,16 @@ static int TLSX_EarlyData_Parse(WOLFSSL* ssl, const byte* input, word16 length,
             return BUFFER_E;
 
         if (ssl->earlyData == expecting_early_data) {
-            
+
             if (ssl->options.maxEarlyDataSz != 0)
                 ssl->earlyDataStatus = WOLFSSL_EARLY_DATA_ACCEPTED;
             else
                 ssl->earlyDataStatus = WOLFSSL_EARLY_DATA_REJECTED;
-            
+
             return TLSX_EarlyData_Use(ssl, 0);
         }
         ssl->earlyData = early_data_ext;
-        
+
         return 0;
     }
     if (msgType == encrypted_extensions) {
@@ -10404,7 +10404,7 @@ int TLSX_PopulateExtensions(WOLFSSL* ssl, byte isServer)
             ret = 0;
         }
     #endif /* !(HAVE_ECC || CURVE25519 || CURVE448) && HAVE_SUPPORTED_CURVES */
- 
+
         #if !defined(NO_CERTS) && !defined(WOLFSSL_NO_SIGALG)
             if (ssl->certHashSigAlgoSz > 0) {
                 WOLFSSL_MSG("Adding signature algorithms cert extension");

+ 16 - 16
src/tls13.c

@@ -3313,7 +3313,7 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
     args->idx += OPAQUE16_LEN;
 
 #ifndef WOLFSSL_NO_TLS12
-    if (args->pv.major == ssl->version.major && 
+    if (args->pv.major == ssl->version.major &&
         args->pv.minor < TLSv1_2_MINOR &&
         ssl->options.downgrade)
     {
@@ -3323,7 +3323,7 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
         return DoServerHello(ssl, input, inOutIdx, helloSz);
     }
 #endif
-    if (args->pv.major != ssl->version.major || 
+    if (args->pv.major != ssl->version.major ||
         args->pv.minor != TLSv1_2_MINOR) {
         return VERSION_ERROR;
     }
@@ -3409,7 +3409,7 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
             return BUFFER_ERROR;
 
         /* Need to negotiate version first. */
-        if ((ret = TLSX_ParseVersion(ssl, input + args->idx, 
+        if ((ret = TLSX_ParseVersion(ssl, input + args->idx,
             args->totalExtSz, *extMsgType, &foundVersion))) {
             return ret;
         }
@@ -3434,7 +3434,7 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
             ssl->version.minor = args->pv.minor;
         }
     }
-    
+
     /* Advance state and proceed */
     ssl->options.asyncState = TLS_ASYNC_BUILD;
     } /* case TLS_ASYNC_BEGIN */
@@ -3448,7 +3448,7 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
 
     if (args->totalExtSz > 0) {
         /* Parse and handle extensions. */
-        ret = TLSX_Parse(ssl, input + args->idx, args->totalExtSz, 
+        ret = TLSX_Parse(ssl, input + args->idx, args->totalExtSz,
             *extMsgType, NULL);
         if (ret != 0) {
         #ifdef WOLFSSL_ASYNC_CRYPT
@@ -3496,7 +3496,7 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
             return BUFFER_ERROR;
         }
         else if (ssl->arrays->sessionIDSz) {
-            XMEMCPY(ssl->arrays->sessionID, args->sessId, 
+            XMEMCPY(ssl->arrays->sessionID, args->sessId,
                 ssl->arrays->sessionIDSz);
             ssl->options.haveSessionId = 1;
         }
@@ -3527,18 +3527,18 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
         return INVALID_PARAMETER;
     if (ssl->session.sessionIDSz != 0) {
         if (ssl->session.sessionIDSz != args->sessIdSz ||
-            XMEMCMP(ssl->session.sessionID, args->sessId, 
+            XMEMCMP(ssl->session.sessionID, args->sessId,
                 args->sessIdSz) != 0) {
             return INVALID_PARAMETER;
         }
     }
-    else if (XMEMCMP(ssl->arrays->clientRandom, args->sessId, 
+    else if (XMEMCMP(ssl->arrays->clientRandom, args->sessId,
             args->sessIdSz) != 0) {
         return INVALID_PARAMETER;
     }
 #else
     if (args->sessIdSz != ssl->session.sessionIDSz || (args->sessIdSz > 0 &&
-        XMEMCMP(ssl->session.sessionID, args->sessId, args->sessIdSz) != 0)) 
+        XMEMCMP(ssl->session.sessionID, args->sessId, args->sessIdSz) != 0))
     {
         WOLFSSL_MSG("Server sent different session id");
         return INVALID_PARAMETER;
@@ -4226,7 +4226,7 @@ static int CheckPreSharedKeys(WOLFSSL* ssl, const byte* input, word32 helloSz,
                                                                   ext != NULL) {
             /* Only use named group used in last session. */
             ssl->namedGroup = ssl->session.namedGroup;
-            
+
             *usingPSK = 2; /* generate new ephemeral key */
         }
         else
@@ -4236,7 +4236,7 @@ static int CheckPreSharedKeys(WOLFSSL* ssl, const byte* input, word32 helloSz,
                 return PSK_KEY_ERROR;
             ssl->options.noPskDheKe = 1;
             ssl->arrays->preMasterSz = 0;
-            
+
             *usingPSK = 1;
         }
     }
@@ -4515,7 +4515,7 @@ typedef struct Dch13Args {
     word32          begin;
     int             usingPSK;
 } Dch13Args;
-    
+
 static void FreeDch13Args(WOLFSSL* ssl, void* pArgs)
 {
     Dch13Args* args = (Dch13Args*)pArgs;
@@ -4612,7 +4612,7 @@ int DoTls13ClientHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
         ssl->version.minor = args->pv.minor;
     }
     else {
-        ret = DoTls13SupportedVersions(ssl, input + args->begin, 
+        ret = DoTls13SupportedVersions(ssl, input + args->begin,
             args->idx - args->begin, helloSz, &wantDowngrade);
         if (ret < 0)
             goto exit_dch;
@@ -4745,7 +4745,7 @@ int DoTls13ClientHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
 
         if ((ext = TLSX_Find(ssl->extensions, TLSX_COOKIE)) == NULL)
             ERROR_OUT(HRR_COOKIE_ERROR, exit_dch);
-            
+
         /* Ensure the cookie came from client and isn't the one in the
         * response - HelloRetryRequest.
         */
@@ -4812,7 +4812,7 @@ int DoTls13ClientHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
             goto exit_dch;
         }
     }
-    else 
+    else
 #endif
 #ifdef HAVE_SUPPORTED_CURVES
     if (args->usingPSK == 2) {
@@ -4840,7 +4840,7 @@ int DoTls13ClientHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
     ssl->options.clientState = CLIENT_HELLO_COMPLETE;
 
     if (!args->usingPSK) {
-#ifndef NO_CERTS   
+#ifndef NO_CERTS
     #ifdef HAVE_NULL_CIPHER
         if (ssl->options.cipherSuite0 == ECC_BYTE &&
                               (ssl->options.cipherSuite == TLS_SHA256_SHA256 ||

+ 2 - 2
src/wolfio.c

@@ -368,7 +368,7 @@ int EmbedReceiveFrom(WOLFSSL *ssl, char *buf, int sz, void *ctx)
     if (recvd < 0) {
         WOLFSSL_MSG("Embed Receive From error");
         recvd = TranslateIoError(recvd);
-        if (recvd == WOLFSSL_CBIO_ERR_WANT_READ && 
+        if (recvd == WOLFSSL_CBIO_ERR_WANT_READ &&
             !wolfSSL_dtls_get_using_nonblock(ssl)) {
             recvd = WOLFSSL_CBIO_ERR_TIMEOUT;
         }
@@ -436,7 +436,7 @@ int EmbedReceiveFromMcast(WOLFSSL *ssl, char *buf, int sz, void *ctx)
     if (recvd < 0) {
         WOLFSSL_MSG("Embed Receive From error");
         recvd = TranslateIoError(recvd);
-        if (recvd == WOLFSSL_CBIO_ERR_WANT_READ && 
+        if (recvd == WOLFSSL_CBIO_ERR_WANT_READ &&
             !wolfSSL_dtls_get_using_nonblock(ssl)) {
             recvd = WOLFSSL_CBIO_ERR_TIMEOUT;
         }

+ 0 - 3
sslSniffer/sslSnifferTest/snifftest.c

@@ -410,9 +410,6 @@ int main(int argc, char** argv)
 
 #ifndef _WIN32
     ssl_InitSniffer();   /* dll load on Windows */
-#endif
-#ifdef DEBUG_WOLFSSL
-    //wolfSSL_Debugging_ON();
 #endif
     ssl_Trace("./tracefile.txt", err);
     ssl_EnableRecovery(1, -1, err);

+ 0 - 2
support/include.am

@@ -6,5 +6,3 @@ EXTRA_DIST += support/wolfssl.pc
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = support/wolfssl.pc
-	     
-

+ 1 - 1
swig/wolfssl_adds.c

@@ -43,7 +43,7 @@
     #include <winsock2.h>
     #include <process.h>
     #ifdef TEST_IPV6            /* don't require newer SDK for IPV4 */
-	    #include <ws2tcpip.h>
+        #include <ws2tcpip.h>
         #include <wspiapi.h>
     #endif
     #define SOCKET_T int

File diff suppressed because it is too large
+ 141 - 141
tests/api.c


+ 1 - 1
tests/suites.c

@@ -544,7 +544,7 @@ static int execute_test_case(int svr_argc, char** svr_argv,
     /* verify results */
     if ((cliArgs.return_code != 0 && cliTestShouldFail == 0) ||
         (cliArgs.return_code == 0 && cliTestShouldFail != 0)) {
-        printf("client_test failed %d %s\n", cliArgs.return_code, 
+        printf("client_test failed %d %s\n", cliArgs.return_code,
             cliTestShouldFail ? "(should fail)" : "");
         XEXIT(EXIT_FAILURE);
     }

+ 1 - 1
testsuite/testsuite.c

@@ -153,7 +153,7 @@ int testsuite_test(int argc, char** argv)
     #ifdef HAVE_STACK_SIZE
         StackSizeCheck(&server_args, wolfcrypt_test);
     #else
-	wolfcrypt_test(&server_args);
+        wolfcrypt_test(&server_args);
     #endif
     if (server_args.return_code != 0) return server_args.return_code;
 #endif

+ 12 - 12
wolfcrypt/benchmark/benchmark.c

@@ -2509,12 +2509,12 @@ exit:
 void bench_aesgcm(int doAsync)
 {
 #if defined(WOLFSSL_AES_128) && !defined(WOLFSSL_AFALG_XILINX_AES) \
-	&& !defined(WOLFSSL_XILINX_CRYPT)
+        && !defined(WOLFSSL_XILINX_CRYPT)
     bench_aesgcm_internal(doAsync, bench_key, 16, bench_iv, 12,
                           "AES-128-GCM-enc", "AES-128-GCM-dec");
 #endif
 #if defined(WOLFSSL_AES_192) && !defined(WOLFSSL_AFALG_XILINX_AES) \
-	&& !defined(WOLFSSL_XILINX_CRYPT)
+        && !defined(WOLFSSL_XILINX_CRYPT)
     bench_aesgcm_internal(doAsync, bench_key, 24, bench_iv, 12,
                           "AES-192-GCM-enc", "AES-192-GCM-dec");
 #endif
@@ -2551,17 +2551,17 @@ void bench_gmac(void)
     XMEMSET(&gmac, 0, sizeof(Gmac)); /* clear context */
     (void)wc_AesInit((Aes*)&gmac, HEAP_HINT, INVALID_DEVID);
     wc_GmacSetKey(&gmac, bench_key, 16);
-    
+
     bench_stats_start(&count, &start);
-    do {                        
-        ret = wc_GmacUpdate(&gmac, bench_iv, 12, bench_plain, bench_size, 
+    do {
+        ret = wc_GmacUpdate(&gmac, bench_iv, 12, bench_plain, bench_size,
             tag, sizeof(tag));
 
         count++;
     } while (bench_stats_sym_check(start));
     wc_AesFree((Aes*)&gmac);
 
-    bench_stats_sym_finish(gmacStr, 0, count, bench_size, start, ret);    
+    bench_stats_sym_finish(gmacStr, 0, count, bench_size, start, ret);
 }
 
 #endif /* HAVE_AESGCM */
@@ -4307,10 +4307,10 @@ static void bench_hmac(int doAsync, int type, int digestSz,
 #ifdef WOLFSSL_ASYNC_CRYPT
     DECLARE_ARRAY(digest, byte, BENCH_MAX_PENDING, WC_MAX_DIGEST_SIZE, HEAP_HINT);
 #else
-	byte digest[BENCH_MAX_PENDING][WC_MAX_DIGEST_SIZE];
+    byte digest[BENCH_MAX_PENDING][WC_MAX_DIGEST_SIZE];
 #endif
 
-	(void)digestSz;
+    (void)digestSz;
 
     /* clear for done cleanup */
     XMEMSET(hmac, 0, sizeof(hmac));
@@ -4916,8 +4916,8 @@ void bench_rsa(int doAsync)
     /* init keys */
     for (i = 0; i < BENCH_MAX_PENDING; i++) {
         /* setup an async context for each key */
-	ret = wc_InitRsaKey_ex(&rsaKey[i], HEAP_HINT,
-			       doAsync ? devId : INVALID_DEVID);
+        ret = wc_InitRsaKey_ex(&rsaKey[i], HEAP_HINT,
+                               doAsync ? devId : INVALID_DEVID);
         if (ret < 0) {
             goto exit_bench_rsa;
         }
@@ -5704,7 +5704,7 @@ void bench_curve25519KeyAgree(void)
     double start;
     int    ret, i, count;
     byte   shared[32];
-	const char**desc = bench_desc_words[lng_index];
+    const char**desc = bench_desc_words[lng_index];
     word32 x = 0;
 
     wc_curve25519_init(&genKey);
@@ -5861,7 +5861,7 @@ void bench_curve448KeyAgree(void)
     double start;
     int    ret, i, count;
     byte   shared[56];
-	const char**desc = bench_desc_words[lng_index];
+    const char**desc = bench_desc_words[lng_index];
     word32 x = 0;
 
     wc_curve448_init(&genKey);

+ 5 - 5
wolfcrypt/src/aes.c

@@ -2601,9 +2601,9 @@ static void wc_AesDecrypt(Aes* aes, const byte* inBlock, byte* outBlock)
 #elif defined(WOLFSSL_SE050) && defined(WOLFSSL_SE050_CRYPT)
     int wc_AesSetKey(Aes* aes, const byte* userKey, word32 keylen, const byte* iv,
                   int dir)
-    {   
+    {
         int ret;
-        
+
         if (aes == NULL || (keylen != 16 && keylen != 24 && keylen != 32)) {
             return BAD_FUNC_ARG;
         }
@@ -4734,13 +4734,13 @@ static const __m128i MOD2_128 =
         M128_INIT(0x1, (long long int)0xc200000000000000UL);
 
 
-/* See Intel® Carry-Less Multiplication Instruction
+/* See Intel Carry-Less Multiplication Instruction
  * and its Usage for Computing the GCM Mode White Paper
  * by Shay Gueron, Intel Mobility Group, Israel Development Center;
  * and Michael E. Kounavis, Intel Labs, Circuits and Systems Research */
 
 
-/* Figure 9. AES-GCM  Encrypt With Single Block Ghash at a Time */
+/* Figure 9. AES-GCM - Encrypt With Single Block Ghash at a Time */
 
 static const __m128i ONE   = M128_INIT(0x0, 0x1);
 #ifndef AES_GCM_AESNI_NO_UNROLL
@@ -7796,7 +7796,7 @@ static int wc_AesGcmDecrypt_STM32(Aes* aes, byte* out,
 
     /* for cases where hardware cannot be used for authTag calculate it */
     /* if IV is not 12 calculate GHASH using software */
-    if (ivSz != GCM_NONCE_MID_SZ 
+    if (ivSz != GCM_NONCE_MID_SZ
     #ifndef CRYP_HEADERWIDTHUNIT_BYTE
         /* or harware that does not support partial block */
         || sz == 0 || partial != 0

+ 1 - 1
wolfcrypt/src/aes_asm.S

@@ -23,7 +23,7 @@
 
 /* This file is in at&t asm syntax, see .asm for intel syntax */
 
-/* See Intel® Advanced Encryption Standard (AES) Instructions Set White Paper
+/* See Intel Advanced Encryption Standard (AES) Instructions Set White Paper
  * by Intel Mobility Group, Israel Development Center, Israel Shay Gueron
  */
 

+ 10 - 10
wolfcrypt/src/asn.c

@@ -136,7 +136,7 @@ ASN Options:
 #endif
 
 #ifdef WOLFSSL_QNX_CAAM
-	#include <wolfssl/wolfcrypt/port/caam/wolfcaam.h>
+    #include <wolfssl/wolfcrypt/port/caam/wolfcaam.h>
 #endif
 
 #ifndef NO_RSA
@@ -2701,7 +2701,7 @@ const char* GetSigName(int oid) {
  * When output is NULL, calculate the header length only.
  *
  * @param [in]  len        Length of INTEGER data in bytes.
- * @param [in]  firstByte  First byte of data, most significant byte of integer, 
+ * @param [in]  firstByte  First byte of data, most significant byte of integer,
  *                         to encode.
  * @param [out] output     Buffer to write into.
  * @return  Number of bytes added to the buffer.
@@ -14130,7 +14130,7 @@ static int DecodeGeneralName(const byte* input, word32* inOutIdx, byte tag,
             }
 
             /* test if no ':' char was found and test that the next two
-             * chars are // to match the pattern "://" */
+             * chars are "//" to match the pattern "://" */
             if (i >= len - 2 || (input[idx + i + 1] != '/' ||
                                  input[idx + i + 2] != '/')) {
                 WOLFSSL_MSG("\tAlt Name must be absolute URI");
@@ -14399,7 +14399,7 @@ static int DecodeAltNames(const byte* input, int sz, DecodedCert* cert)
                 }
 
                 /* test if no ':' char was found and test that the next two
-                 * chars are // to match the pattern "://" */
+                 * chars are "//" to match the pattern "://" */
                 if (i >= strLen - 2 || (input[idx + i + 1] != '/' ||
                                         input[idx + i + 2] != '/')) {
                     WOLFSSL_MSG("\tAlt Name must be absolute URI");
@@ -27557,7 +27557,7 @@ static int DecodeAsymKey(const byte* input, word32* inOutIdx, word32 inSz,
     const byte* pub;
 #else
     DECL_ASNGETDATA(dataASN, edKeyASN_Length);
-#endif    
+#endif
 
     if (input == NULL || inOutIdx == NULL || inSz == 0 ||
         privKey == NULL || privKeyLen == NULL) {
@@ -27699,7 +27699,7 @@ static int DecodeAsymKeyPublic(const byte* input, word32* inOutIdx, word32 inSz,
     DECL_ASNGETDATA(dataASN, edPubKeyASN_Length);
 #endif
 
-    if (input == NULL || inSz == 0 || inOutIdx == NULL || 
+    if (input == NULL || inSz == 0 || inOutIdx == NULL ||
         pubKey == NULL || pubKeyLen == NULL) {
         return BAD_FUNC_ARG;
     }
@@ -27784,7 +27784,7 @@ int wc_Ed25519PrivateKeyDecode(const byte* input, word32* inOutIdx,
         return BAD_FUNC_ARG;
     }
 
-    ret = DecodeAsymKey(input, inOutIdx, inSz, privKey, &privKeyLen, 
+    ret = DecodeAsymKey(input, inOutIdx, inSz, privKey, &privKeyLen,
         pubKey, &pubKeyLen, ED25519k);
     if (ret == 0) {
         if (pubKeyLen == 0) {
@@ -27830,7 +27830,7 @@ int wc_Curve25519PrivateKeyDecode(const byte* input, word32* inOutIdx,
         return BAD_FUNC_ARG;
     }
 
-    ret = DecodeAsymKey(input, inOutIdx, inSz, privKey, &privKeyLen, 
+    ret = DecodeAsymKey(input, inOutIdx, inSz, privKey, &privKeyLen,
         NULL, NULL, X25519k);
     if (ret == 0) {
         ret = wc_curve25519_import_private(privKey, privKeyLen, key);
@@ -28068,7 +28068,7 @@ int wc_Ed448PrivateKeyDecode(const byte* input, word32* inOutIdx,
         return BAD_FUNC_ARG;
     }
 
-    ret = DecodeAsymKey(input, inOutIdx, inSz, privKey, &privKeyLen, 
+    ret = DecodeAsymKey(input, inOutIdx, inSz, privKey, &privKeyLen,
         pubKey, &pubKeyLen, ED448k);
     if (ret == 0) {
         if (pubKeyLen == 0) {
@@ -28184,7 +28184,7 @@ int wc_Curve448PrivateKeyDecode(const byte* input, word32* inOutIdx,
         return BAD_FUNC_ARG;
     }
 
-    ret = DecodeAsymKey(input, inOutIdx, inSz, privKey, &privKeyLen, 
+    ret = DecodeAsymKey(input, inOutIdx, inSz, privKey, &privKeyLen,
         NULL, NULL, X448k);
     if (ret == 0) {
         ret = wc_curve448_import_private(privKey, privKeyLen, key);

+ 2 - 2
wolfcrypt/src/blake2b.c

@@ -302,8 +302,8 @@ int blake2b_update( blake2b_state *S, const byte *in, word64 inlen )
       blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES );
 
       {
-	ret = blake2b_compress( S, S->buf, m, v );
-	if (ret < 0) break;
+          ret = blake2b_compress( S, S->buf, m, v );
+          if (ret < 0) break;
       }
 
       XMEMCPY( S->buf, S->buf + BLAKE2B_BLOCKBYTES, BLAKE2B_BLOCKBYTES );

+ 312 - 312
wolfcrypt/src/camellia.c

@@ -103,17 +103,17 @@ typedef unsigned char u8;
 
 #else /* not MS-VC */
 
-# define GETU32(pt)				\
-    (((u32)(pt)[0] << 24)			\
-     ^ ((u32)(pt)[1] << 16)			\
-     ^ ((u32)(pt)[2] <<  8)			\
+# define GETU32(pt)                             \
+    (((u32)(pt)[0] << 24)                       \
+     ^ ((u32)(pt)[1] << 16)                     \
+     ^ ((u32)(pt)[2] <<  8)                     \
      ^ ((u32)(pt)[3]))
 
-# define PUTU32(ct, st)  {			\
-	(ct)[0] = (u8)((st) >> 24);		\
-	(ct)[1] = (u8)((st) >> 16);		\
-	(ct)[2] = (u8)((st) >>  8);		\
-	(ct)[3] = (u8)(st); }
+# define PUTU32(ct, st)  {                      \
+        (ct)[0] = (u8)((st) >> 24);             \
+        (ct)[1] = (u8)((st) >> 16);             \
+        (ct)[2] = (u8)((st) >>  8);             \
+        (ct)[3] = (u8)(st); }
 
 #endif
 
@@ -127,23 +127,23 @@ typedef unsigned char u8;
 /* rotation left shift 1byte */
 #define CAMELLIA_RL8(x) (((x) << 8) + ((x) >> 24))
 
-#define CAMELLIA_ROLDQ(ll, lr, rl, rr, w0, w1, bits)	\
-    do {						\
-	w0 = ll;					\
-	ll = (ll << bits) + (lr >> (32 - bits));	\
-	lr = (lr << bits) + (rl >> (32 - bits));	\
-	rl = (rl << bits) + (rr >> (32 - bits));	\
-	rr = (rr << bits) + (w0 >> (32 - bits));	\
+#define CAMELLIA_ROLDQ(ll, lr, rl, rr, w0, w1, bits)    \
+    do {                                                \
+        w0 = ll;                                        \
+        ll = (ll << bits) + (lr >> (32 - bits));        \
+        lr = (lr << bits) + (rl >> (32 - bits));        \
+        rl = (rl << bits) + (rr >> (32 - bits));        \
+        rr = (rr << bits) + (w0 >> (32 - bits));        \
     } while(0)
 
-#define CAMELLIA_ROLDQo32(ll, lr, rl, rr, w0, w1, bits)	\
-    do {						\
-	w0 = ll;					\
-	w1 = lr;					\
-	ll = (lr << (bits - 32)) + (rl >> (64 - bits));	\
-	lr = (rl << (bits - 32)) + (rr >> (64 - bits));	\
-	rl = (rr << (bits - 32)) + (w0 >> (64 - bits));	\
-	rr = (w0 << (bits - 32)) + (w1 >> (64 - bits));	\
+#define CAMELLIA_ROLDQo32(ll, lr, rl, rr, w0, w1, bits) \
+    do {                                                \
+        w0 = ll;                                        \
+        w1 = lr;                                        \
+        ll = (lr << (bits - 32)) + (rl >> (64 - bits)); \
+        lr = (rl << (bits - 32)) + (rr >> (64 - bits)); \
+        rl = (rr << (bits - 32)) + (w0 >> (64 - bits)); \
+        rr = (w0 << (bits - 32)) + (w1 >> (64 - bits)); \
     } while(0)
 
 #define CAMELLIA_SP1110(INDEX) (camellia_sp1110[(INDEX)])
@@ -151,23 +151,23 @@ typedef unsigned char u8;
 #define CAMELLIA_SP3033(INDEX) (camellia_sp3033[(INDEX)])
 #define CAMELLIA_SP4404(INDEX) (camellia_sp4404[(INDEX)])
 
-#define CAMELLIA_F(xl, xr, kl, kr, yl, yr, il, ir, t0, t1)	\
-    do {							\
-	il = xl ^ kl;						\
-	ir = xr ^ kr;						\
-	t0 = il >> 16;						\
-	t1 = ir >> 16;						\
-	yl = CAMELLIA_SP1110(ir & 0xff)				\
-	    ^ CAMELLIA_SP0222((t1 >> 8) & 0xff)			\
-	    ^ CAMELLIA_SP3033(t1 & 0xff)			\
-	    ^ CAMELLIA_SP4404((ir >> 8) & 0xff);		\
-	yr = CAMELLIA_SP1110((t0 >> 8) & 0xff)			\
-	    ^ CAMELLIA_SP0222(t0 & 0xff)			\
-	    ^ CAMELLIA_SP3033((il >> 8) & 0xff)			\
-	    ^ CAMELLIA_SP4404(il & 0xff);			\
-	yl ^= yr;						\
-	yr = CAMELLIA_RR8(yr);					\
-	yr ^= yl;						\
+#define CAMELLIA_F(xl, xr, kl, kr, yl, yr, il, ir, t0, t1)      \
+    do {                                                        \
+        il = xl ^ kl;                                           \
+        ir = xr ^ kr;                                           \
+        t0 = il >> 16;                                          \
+        t1 = ir >> 16;                                          \
+        yl = CAMELLIA_SP1110(ir & 0xff)                         \
+            ^ CAMELLIA_SP0222((t1 >> 8) & 0xff)                 \
+            ^ CAMELLIA_SP3033(t1 & 0xff)                        \
+            ^ CAMELLIA_SP4404((ir >> 8) & 0xff);                \
+        yr = CAMELLIA_SP1110((t0 >> 8) & 0xff)                  \
+            ^ CAMELLIA_SP0222(t0 & 0xff)                        \
+            ^ CAMELLIA_SP3033((il >> 8) & 0xff)                 \
+            ^ CAMELLIA_SP4404(il & 0xff);                       \
+        yl ^= yr;                                               \
+        yr = CAMELLIA_RR8(yr);                                  \
+        yr ^= yl;                                               \
     } while(0)
 
 
@@ -176,39 +176,39 @@ typedef unsigned char u8;
  *
  */
 #define CAMELLIA_FLS(ll, lr, rl, rr, kll, klr, krl, krr, t0, t1, t2, t3) \
-    do {								\
-	t0 = kll;							\
-	t0 &= ll;							\
-	lr ^= CAMELLIA_RL1(t0);						\
-	t1 = klr;							\
-	t1 |= lr;							\
-	ll ^= t1;							\
-									\
-	t2 = krr;							\
-	t2 |= rr;							\
-	rl ^= t2;							\
-	t3 = krl;							\
-	t3 &= rl;							\
-	rr ^= CAMELLIA_RL1(t3);						\
+    do {                                                                \
+        t0 = kll;                                                       \
+        t0 &= ll;                                                       \
+        lr ^= CAMELLIA_RL1(t0);                                         \
+        t1 = klr;                                                       \
+        t1 |= lr;                                                       \
+        ll ^= t1;                                                       \
+                                                                        \
+        t2 = krr;                                                       \
+        t2 |= rr;                                                       \
+        rl ^= t2;                                                       \
+        t3 = krl;                                                       \
+        t3 &= rl;                                                       \
+        rr ^= CAMELLIA_RL1(t3);                                         \
     } while(0)
 
-#define CAMELLIA_ROUNDSM(xl, xr, kl, kr, yl, yr, il, ir, t0, t1)	\
-    do {								\
-	ir = CAMELLIA_SP1110(xr & 0xff)					\
-	    ^ CAMELLIA_SP0222((xr >> 24) & 0xff)			\
-	    ^ CAMELLIA_SP3033((xr >> 16) & 0xff)			\
-	    ^ CAMELLIA_SP4404((xr >> 8) & 0xff);			\
-	il = CAMELLIA_SP1110((xl >> 24) & 0xff)				\
-	    ^ CAMELLIA_SP0222((xl >> 16) & 0xff)			\
-	    ^ CAMELLIA_SP3033((xl >> 8) & 0xff)				\
-	    ^ CAMELLIA_SP4404(xl & 0xff);				\
-	il ^= kl;							\
-	ir ^= kr;							\
-	ir ^= il;							\
-	il = CAMELLIA_RR8(il);						\
-	il ^= ir;							\
-	yl ^= ir;							\
-	yr ^= il;							\
+#define CAMELLIA_ROUNDSM(xl, xr, kl, kr, yl, yr, il, ir, t0, t1)        \
+    do {                                                                \
+        ir = CAMELLIA_SP1110(xr & 0xff)                                 \
+            ^ CAMELLIA_SP0222((xr >> 24) & 0xff)                        \
+            ^ CAMELLIA_SP3033((xr >> 16) & 0xff)                        \
+            ^ CAMELLIA_SP4404((xr >> 8) & 0xff);                        \
+        il = CAMELLIA_SP1110((xl >> 24) & 0xff)                         \
+            ^ CAMELLIA_SP0222((xl >> 16) & 0xff)                        \
+            ^ CAMELLIA_SP3033((xl >> 8) & 0xff)                         \
+            ^ CAMELLIA_SP4404(xl & 0xff);                               \
+        il ^= kl;                                                       \
+        ir ^= kr;                                                       \
+        ir ^= il;                                                       \
+        il = CAMELLIA_RR8(il);                                          \
+        il ^= ir;                                                       \
+        yl ^= ir;                                                       \
+        yr ^= il;                                                       \
     } while(0)
 
 
@@ -545,19 +545,19 @@ static int camellia_setup128(const unsigned char *key, u32 *subkey)
     kll = subl(0); klr = subr(0);
     krl = subl(1); krr = subr(1);
     CAMELLIA_F(kll, klr,
-	       CAMELLIA_SIGMA1L, CAMELLIA_SIGMA1R,
-	       w0, w1, il, ir, t0, t1);
+               CAMELLIA_SIGMA1L, CAMELLIA_SIGMA1R,
+               w0, w1, il, ir, t0, t1);
     krl ^= w0; krr ^= w1;
     CAMELLIA_F(krl, krr,
-	       CAMELLIA_SIGMA2L, CAMELLIA_SIGMA2R,
-	       kll, klr, il, ir, t0, t1);
+               CAMELLIA_SIGMA2L, CAMELLIA_SIGMA2R,
+               kll, klr, il, ir, t0, t1);
     CAMELLIA_F(kll, klr,
-	       CAMELLIA_SIGMA3L, CAMELLIA_SIGMA3R,
-	       krl, krr, il, ir, t0, t1);
+               CAMELLIA_SIGMA3L, CAMELLIA_SIGMA3R,
+               krl, krr, il, ir, t0, t1);
     krl ^= w0; krr ^= w1;
     CAMELLIA_F(krl, krr,
-	       CAMELLIA_SIGMA4L, CAMELLIA_SIGMA4R,
-	       w0, w1, il, ir, t0, t1);
+               CAMELLIA_SIGMA4L, CAMELLIA_SIGMA4R,
+               w0, w1, il, ir, t0, t1);
     kll ^= w0; klr ^= w1;
 
     /* generate KA dependent subkeys */
@@ -649,7 +649,7 @@ static int camellia_setup128(const unsigned char *key, u32 *subkey)
     CamelliaSubkeyL(14) = subl(13) ^ subl(15);
     CamelliaSubkeyR(14) = subr(13) ^ subr(15);
     tl = subl(18) ^ (subr(18) & ~subr(16));
-    dw = tl & subl(16),	tr = subr(18) ^ CAMELLIA_RL1(dw);
+    dw = tl & subl(16), tr = subr(18) ^ CAMELLIA_RL1(dw);
     CamelliaSubkeyL(15) = subl(14) ^ tl;
     CamelliaSubkeyR(15) = subr(14) ^ tr;
     CamelliaSubkeyL(16) = subl(16);
@@ -657,7 +657,7 @@ static int camellia_setup128(const unsigned char *key, u32 *subkey)
     CamelliaSubkeyL(17) = subl(17);
     CamelliaSubkeyR(17) = subr(17);
     tl = subl(15) ^ (subr(15) & ~subr(17));
-    dw = tl & subl(17),	tr = subr(15) ^ CAMELLIA_RL1(dw);
+    dw = tl & subl(17), tr = subr(15) ^ CAMELLIA_RL1(dw);
     CamelliaSubkeyL(18) = tl ^ subl(19);
     CamelliaSubkeyR(18) = tr ^ subr(19);
     CamelliaSubkeyL(19) = subl(18) ^ subl(20);
@@ -793,32 +793,32 @@ static int camellia_setup256(const unsigned char *key, u32 *subkey)
     kll = subl(0) ^ krll; klr = subr(0) ^ krlr;
     krl = subl(1) ^ krrl; krr = subr(1) ^ krrr;
     CAMELLIA_F(kll, klr,
-	       CAMELLIA_SIGMA1L, CAMELLIA_SIGMA1R,
-	       w0, w1, il, ir, t0, t1);
+               CAMELLIA_SIGMA1L, CAMELLIA_SIGMA1R,
+               w0, w1, il, ir, t0, t1);
     krl ^= w0; krr ^= w1;
     CAMELLIA_F(krl, krr,
-	       CAMELLIA_SIGMA2L, CAMELLIA_SIGMA2R,
-	       kll, klr, il, ir, t0, t1);
+               CAMELLIA_SIGMA2L, CAMELLIA_SIGMA2R,
+               kll, klr, il, ir, t0, t1);
     kll ^= krll; klr ^= krlr;
     CAMELLIA_F(kll, klr,
-	       CAMELLIA_SIGMA3L, CAMELLIA_SIGMA3R,
-	       krl, krr, il, ir, t0, t1);
+               CAMELLIA_SIGMA3L, CAMELLIA_SIGMA3R,
+               krl, krr, il, ir, t0, t1);
     krl ^= w0 ^ krrl; krr ^= w1 ^ krrr;
     CAMELLIA_F(krl, krr,
-	       CAMELLIA_SIGMA4L, CAMELLIA_SIGMA4R,
-	       w0, w1, il, ir, t0, t1);
+               CAMELLIA_SIGMA4L, CAMELLIA_SIGMA4R,
+               w0, w1, il, ir, t0, t1);
     kll ^= w0; klr ^= w1;
 
     /* generate KB */
     krll ^= kll; krlr ^= klr;
     krrl ^= krl; krrr ^= krr;
     CAMELLIA_F(krll, krlr,
-	       CAMELLIA_SIGMA5L, CAMELLIA_SIGMA5R,
-	       w0, w1, il, ir, t0, t1);
+               CAMELLIA_SIGMA5L, CAMELLIA_SIGMA5R,
+               w0, w1, il, ir, t0, t1);
     krrl ^= w0; krrr ^= w1;
     CAMELLIA_F(krrl, krrr,
-	       CAMELLIA_SIGMA6L, CAMELLIA_SIGMA6R,
-	       w0, w1, il, ir, t0, t1);
+               CAMELLIA_SIGMA6L, CAMELLIA_SIGMA6R,
+               w0, w1, il, ir, t0, t1);
     krll ^= w0; krlr ^= w1;
 
     /* generate KA dependent subkeys */
@@ -1058,71 +1058,71 @@ static void camellia_encrypt128(const u32 *subkey, u32 *io)
     /* main iteration */
 
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(2),CamelliaSubkeyR(2),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(2),CamelliaSubkeyR(2),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(3),CamelliaSubkeyR(3),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(3),CamelliaSubkeyR(3),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(4),CamelliaSubkeyR(4),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(4),CamelliaSubkeyR(4),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(5),CamelliaSubkeyR(5),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(5),CamelliaSubkeyR(5),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(6),CamelliaSubkeyR(6),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(6),CamelliaSubkeyR(6),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(7),CamelliaSubkeyR(7),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(7),CamelliaSubkeyR(7),
+                     io[0],io[1],il,ir,t0,t1);
 
     CAMELLIA_FLS(io[0],io[1],io[2],io[3],
-		 CamelliaSubkeyL(8),CamelliaSubkeyR(8),
-		 CamelliaSubkeyL(9),CamelliaSubkeyR(9),
-		 t0,t1,il,ir);
+                 CamelliaSubkeyL(8),CamelliaSubkeyR(8),
+                 CamelliaSubkeyL(9),CamelliaSubkeyR(9),
+                 t0,t1,il,ir);
 
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(10),CamelliaSubkeyR(10),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(10),CamelliaSubkeyR(10),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(11),CamelliaSubkeyR(11),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(11),CamelliaSubkeyR(11),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(12),CamelliaSubkeyR(12),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(12),CamelliaSubkeyR(12),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(13),CamelliaSubkeyR(13),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(13),CamelliaSubkeyR(13),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(14),CamelliaSubkeyR(14),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(14),CamelliaSubkeyR(14),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(15),CamelliaSubkeyR(15),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(15),CamelliaSubkeyR(15),
+                     io[0],io[1],il,ir,t0,t1);
 
     CAMELLIA_FLS(io[0],io[1],io[2],io[3],
-		 CamelliaSubkeyL(16),CamelliaSubkeyR(16),
-		 CamelliaSubkeyL(17),CamelliaSubkeyR(17),
-		 t0,t1,il,ir);
+                 CamelliaSubkeyL(16),CamelliaSubkeyR(16),
+                 CamelliaSubkeyL(17),CamelliaSubkeyR(17),
+                 t0,t1,il,ir);
 
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(18),CamelliaSubkeyR(18),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(18),CamelliaSubkeyR(18),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(19),CamelliaSubkeyR(19),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(19),CamelliaSubkeyR(19),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(20),CamelliaSubkeyR(20),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(20),CamelliaSubkeyR(20),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(21),CamelliaSubkeyR(21),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(21),CamelliaSubkeyR(21),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(22),CamelliaSubkeyR(22),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(22),CamelliaSubkeyR(22),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(23),CamelliaSubkeyR(23),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(23),CamelliaSubkeyR(23),
+                     io[0],io[1],il,ir,t0,t1);
 
     /* post whitening but kw4 */
     io[2] ^= CamelliaSubkeyL(24);
@@ -1148,71 +1148,71 @@ static void camellia_decrypt128(const u32 *subkey, u32 *io)
 
     /* main iteration */
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(23),CamelliaSubkeyR(23),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(23),CamelliaSubkeyR(23),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(22),CamelliaSubkeyR(22),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(22),CamelliaSubkeyR(22),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(21),CamelliaSubkeyR(21),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(21),CamelliaSubkeyR(21),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(20),CamelliaSubkeyR(20),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(20),CamelliaSubkeyR(20),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(19),CamelliaSubkeyR(19),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(19),CamelliaSubkeyR(19),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(18),CamelliaSubkeyR(18),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(18),CamelliaSubkeyR(18),
+                     io[0],io[1],il,ir,t0,t1);
 
     CAMELLIA_FLS(io[0],io[1],io[2],io[3],
-		 CamelliaSubkeyL(17),CamelliaSubkeyR(17),
-		 CamelliaSubkeyL(16),CamelliaSubkeyR(16),
-		 t0,t1,il,ir);
+                 CamelliaSubkeyL(17),CamelliaSubkeyR(17),
+                 CamelliaSubkeyL(16),CamelliaSubkeyR(16),
+                 t0,t1,il,ir);
 
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(15),CamelliaSubkeyR(15),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(15),CamelliaSubkeyR(15),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(14),CamelliaSubkeyR(14),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(14),CamelliaSubkeyR(14),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(13),CamelliaSubkeyR(13),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(13),CamelliaSubkeyR(13),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(12),CamelliaSubkeyR(12),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(12),CamelliaSubkeyR(12),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(11),CamelliaSubkeyR(11),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(11),CamelliaSubkeyR(11),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(10),CamelliaSubkeyR(10),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(10),CamelliaSubkeyR(10),
+                     io[0],io[1],il,ir,t0,t1);
 
     CAMELLIA_FLS(io[0],io[1],io[2],io[3],
-		 CamelliaSubkeyL(9),CamelliaSubkeyR(9),
-		 CamelliaSubkeyL(8),CamelliaSubkeyR(8),
-		 t0,t1,il,ir);
+                 CamelliaSubkeyL(9),CamelliaSubkeyR(9),
+                 CamelliaSubkeyL(8),CamelliaSubkeyR(8),
+                 t0,t1,il,ir);
 
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(7),CamelliaSubkeyR(7),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(7),CamelliaSubkeyR(7),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(6),CamelliaSubkeyR(6),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(6),CamelliaSubkeyR(6),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(5),CamelliaSubkeyR(5),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(5),CamelliaSubkeyR(5),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(4),CamelliaSubkeyR(4),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(4),CamelliaSubkeyR(4),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(3),CamelliaSubkeyR(3),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(3),CamelliaSubkeyR(3),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(2),CamelliaSubkeyR(2),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(2),CamelliaSubkeyR(2),
+                     io[0],io[1],il,ir,t0,t1);
 
     /* post whitening but kw4 */
     io[2] ^= CamelliaSubkeyL(0);
@@ -1241,95 +1241,95 @@ static void camellia_encrypt256(const u32 *subkey, u32 *io)
 
     /* main iteration */
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(2),CamelliaSubkeyR(2),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(2),CamelliaSubkeyR(2),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(3),CamelliaSubkeyR(3),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(3),CamelliaSubkeyR(3),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(4),CamelliaSubkeyR(4),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(4),CamelliaSubkeyR(4),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(5),CamelliaSubkeyR(5),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(5),CamelliaSubkeyR(5),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(6),CamelliaSubkeyR(6),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(6),CamelliaSubkeyR(6),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(7),CamelliaSubkeyR(7),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(7),CamelliaSubkeyR(7),
+                     io[0],io[1],il,ir,t0,t1);
 
     CAMELLIA_FLS(io[0],io[1],io[2],io[3],
-		 CamelliaSubkeyL(8),CamelliaSubkeyR(8),
-		 CamelliaSubkeyL(9),CamelliaSubkeyR(9),
-		 t0,t1,il,ir);
+                 CamelliaSubkeyL(8),CamelliaSubkeyR(8),
+                 CamelliaSubkeyL(9),CamelliaSubkeyR(9),
+                 t0,t1,il,ir);
 
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(10),CamelliaSubkeyR(10),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(10),CamelliaSubkeyR(10),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(11),CamelliaSubkeyR(11),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(11),CamelliaSubkeyR(11),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(12),CamelliaSubkeyR(12),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(12),CamelliaSubkeyR(12),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(13),CamelliaSubkeyR(13),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(13),CamelliaSubkeyR(13),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(14),CamelliaSubkeyR(14),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(14),CamelliaSubkeyR(14),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(15),CamelliaSubkeyR(15),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(15),CamelliaSubkeyR(15),
+                     io[0],io[1],il,ir,t0,t1);
 
     CAMELLIA_FLS(io[0],io[1],io[2],io[3],
-		 CamelliaSubkeyL(16),CamelliaSubkeyR(16),
-		 CamelliaSubkeyL(17),CamelliaSubkeyR(17),
-		 t0,t1,il,ir);
+                 CamelliaSubkeyL(16),CamelliaSubkeyR(16),
+                 CamelliaSubkeyL(17),CamelliaSubkeyR(17),
+                 t0,t1,il,ir);
 
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(18),CamelliaSubkeyR(18),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(18),CamelliaSubkeyR(18),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(19),CamelliaSubkeyR(19),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(19),CamelliaSubkeyR(19),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(20),CamelliaSubkeyR(20),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(20),CamelliaSubkeyR(20),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(21),CamelliaSubkeyR(21),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(21),CamelliaSubkeyR(21),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(22),CamelliaSubkeyR(22),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(22),CamelliaSubkeyR(22),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(23),CamelliaSubkeyR(23),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(23),CamelliaSubkeyR(23),
+                     io[0],io[1],il,ir,t0,t1);
 
     CAMELLIA_FLS(io[0],io[1],io[2],io[3],
-		 CamelliaSubkeyL(24),CamelliaSubkeyR(24),
-		 CamelliaSubkeyL(25),CamelliaSubkeyR(25),
-		 t0,t1,il,ir);
+                 CamelliaSubkeyL(24),CamelliaSubkeyR(24),
+                 CamelliaSubkeyL(25),CamelliaSubkeyR(25),
+                 t0,t1,il,ir);
 
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(26),CamelliaSubkeyR(26),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(26),CamelliaSubkeyR(26),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(27),CamelliaSubkeyR(27),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(27),CamelliaSubkeyR(27),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(28),CamelliaSubkeyR(28),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(28),CamelliaSubkeyR(28),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(29),CamelliaSubkeyR(29),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(29),CamelliaSubkeyR(29),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(30),CamelliaSubkeyR(30),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(30),CamelliaSubkeyR(30),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(31),CamelliaSubkeyR(31),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(31),CamelliaSubkeyR(31),
+                     io[0],io[1],il,ir,t0,t1);
 
     /* post whitening but kw4 */
     io[2] ^= CamelliaSubkeyL(32);
@@ -1355,95 +1355,95 @@ static void camellia_decrypt256(const u32 *subkey, u32 *io)
 
     /* main iteration */
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(31),CamelliaSubkeyR(31),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(31),CamelliaSubkeyR(31),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(30),CamelliaSubkeyR(30),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(30),CamelliaSubkeyR(30),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(29),CamelliaSubkeyR(29),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(29),CamelliaSubkeyR(29),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(28),CamelliaSubkeyR(28),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(28),CamelliaSubkeyR(28),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(27),CamelliaSubkeyR(27),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(27),CamelliaSubkeyR(27),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(26),CamelliaSubkeyR(26),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(26),CamelliaSubkeyR(26),
+                     io[0],io[1],il,ir,t0,t1);
 
     CAMELLIA_FLS(io[0],io[1],io[2],io[3],
-		 CamelliaSubkeyL(25),CamelliaSubkeyR(25),
-		 CamelliaSubkeyL(24),CamelliaSubkeyR(24),
-		 t0,t1,il,ir);
+                 CamelliaSubkeyL(25),CamelliaSubkeyR(25),
+                 CamelliaSubkeyL(24),CamelliaSubkeyR(24),
+                 t0,t1,il,ir);
 
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(23),CamelliaSubkeyR(23),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(23),CamelliaSubkeyR(23),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(22),CamelliaSubkeyR(22),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(22),CamelliaSubkeyR(22),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(21),CamelliaSubkeyR(21),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(21),CamelliaSubkeyR(21),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(20),CamelliaSubkeyR(20),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(20),CamelliaSubkeyR(20),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(19),CamelliaSubkeyR(19),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(19),CamelliaSubkeyR(19),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(18),CamelliaSubkeyR(18),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(18),CamelliaSubkeyR(18),
+                     io[0],io[1],il,ir,t0,t1);
 
     CAMELLIA_FLS(io[0],io[1],io[2],io[3],
-		 CamelliaSubkeyL(17),CamelliaSubkeyR(17),
-		 CamelliaSubkeyL(16),CamelliaSubkeyR(16),
-		 t0,t1,il,ir);
+                 CamelliaSubkeyL(17),CamelliaSubkeyR(17),
+                 CamelliaSubkeyL(16),CamelliaSubkeyR(16),
+                 t0,t1,il,ir);
 
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(15),CamelliaSubkeyR(15),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(15),CamelliaSubkeyR(15),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(14),CamelliaSubkeyR(14),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(14),CamelliaSubkeyR(14),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(13),CamelliaSubkeyR(13),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(13),CamelliaSubkeyR(13),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(12),CamelliaSubkeyR(12),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(12),CamelliaSubkeyR(12),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(11),CamelliaSubkeyR(11),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(11),CamelliaSubkeyR(11),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(10),CamelliaSubkeyR(10),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(10),CamelliaSubkeyR(10),
+                     io[0],io[1],il,ir,t0,t1);
 
     CAMELLIA_FLS(io[0],io[1],io[2],io[3],
-		 CamelliaSubkeyL(9),CamelliaSubkeyR(9),
-		 CamelliaSubkeyL(8),CamelliaSubkeyR(8),
-		 t0,t1,il,ir);
+                 CamelliaSubkeyL(9),CamelliaSubkeyR(9),
+                 CamelliaSubkeyL(8),CamelliaSubkeyR(8),
+                 t0,t1,il,ir);
 
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(7),CamelliaSubkeyR(7),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(7),CamelliaSubkeyR(7),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(6),CamelliaSubkeyR(6),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(6),CamelliaSubkeyR(6),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(5),CamelliaSubkeyR(5),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(5),CamelliaSubkeyR(5),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(4),CamelliaSubkeyR(4),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(4),CamelliaSubkeyR(4),
+                     io[0],io[1],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[0],io[1],
-		     CamelliaSubkeyL(3),CamelliaSubkeyR(3),
-		     io[2],io[3],il,ir,t0,t1);
+                     CamelliaSubkeyL(3),CamelliaSubkeyR(3),
+                     io[2],io[3],il,ir,t0,t1);
     CAMELLIA_ROUNDSM(io[2],io[3],
-		     CamelliaSubkeyL(2),CamelliaSubkeyR(2),
-		     io[0],io[1],il,ir,t0,t1);
+                     CamelliaSubkeyL(2),CamelliaSubkeyR(2),
+                     io[0],io[1],il,ir,t0,t1);
 
     /* post whitening but kw4 */
     io[2] ^= CamelliaSubkeyL(0);
@@ -1465,9 +1465,9 @@ static void camellia_decrypt256(const u32 *subkey, u32 *io)
  */
 
 static void Camellia_EncryptBlock(const int keyBitLength,
-			   const unsigned char *plaintext,
-			   const KEY_TABLE_TYPE keyTable,
-			   unsigned char *ciphertext)
+                           const unsigned char *plaintext,
+                           const KEY_TABLE_TYPE keyTable,
+                           unsigned char *ciphertext)
 {
     u32 tmp[4];
 
@@ -1478,15 +1478,15 @@ static void Camellia_EncryptBlock(const int keyBitLength,
 
     switch (keyBitLength) {
     case 128:
-	camellia_encrypt128(keyTable, tmp);
-	break;
+        camellia_encrypt128(keyTable, tmp);
+        break;
     case 192:
-	/* fall through */
+        /* fall through */
     case 256:
-	camellia_encrypt256(keyTable, tmp);
-	break;
+        camellia_encrypt256(keyTable, tmp);
+        break;
     default:
-	break;
+        break;
     }
 
     PUTU32(ciphertext, tmp[0]);
@@ -1496,9 +1496,9 @@ static void Camellia_EncryptBlock(const int keyBitLength,
 }
 
 static void Camellia_DecryptBlock(const int keyBitLength,
-			   const unsigned char *ciphertext,
-			   const KEY_TABLE_TYPE keyTable,
-			   unsigned char *plaintext)
+                           const unsigned char *ciphertext,
+                           const KEY_TABLE_TYPE keyTable,
+                           unsigned char *plaintext)
 {
     u32 tmp[4];
 
@@ -1509,15 +1509,15 @@ static void Camellia_DecryptBlock(const int keyBitLength,
 
     switch (keyBitLength) {
     case 128:
-	camellia_decrypt128(keyTable, tmp);
-	break;
+        camellia_decrypt128(keyTable, tmp);
+        break;
     case 192:
-	/* fall through */
+        /* fall through */
     case 256:
-	camellia_decrypt256(keyTable, tmp);
-	break;
+        camellia_decrypt256(keyTable, tmp);
+        break;
     default:
-	break;
+        break;
     }
     PUTU32(plaintext, tmp[0]);
     PUTU32(plaintext + 4, tmp[1]);
@@ -1539,10 +1539,10 @@ int wc_CamelliaSetKey(Camellia* cam, const byte* key, word32 len, const byte* iv
 
     switch (len) {
         case 16:
-        	ret = camellia_setup128(key, cam->key);
+                ret = camellia_setup128(key, cam->key);
             break;
         case 24:
-        	ret = camellia_setup192(key, cam->key);
+                ret = camellia_setup192(key, cam->key);
             break;
         case 32:
             ret = camellia_setup256(key, cam->key);

+ 2 - 4
wolfcrypt/src/cmac.c

@@ -31,9 +31,7 @@
 
 #if defined(WOLFSSL_CMAC) && !defined(NO_AES) && defined(WOLFSSL_AES_DIRECT)
 
-#if defined(HAVE_FIPS) && \
-	defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)
-
+#if defined(HAVE_FIPS) && defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)
     /* set NO_WRAPPERS before headers, use direct internal f()s not wrappers */
     #define FIPS_NO_WRAPPERS
 
@@ -144,7 +142,7 @@ int wc_InitCmac(Cmac* cmac, const byte* key, word32 keySz,
     int devId = WOLFSSL_CAAM_DEVID;
 #else
     int devId = INVALID_DEVID;
-#endif    
+#endif
     return wc_InitCmac_ex(cmac, key, keySz, type, unused, NULL, devId);
 }
 

+ 1 - 1
wolfcrypt/src/cryptocb.c

@@ -396,7 +396,7 @@ int wc_CryptoCb_Curve25519(curve25519_key* private_key,
         ret = dev->cb(dev->devId, &cryptoInfo, dev->ctx);
     }
 
-    return wc_CryptoCb_TranslateErrorCode(ret);   
+    return wc_CryptoCb_TranslateErrorCode(ret);
 }
 #endif /* HAVE_CURVE25519 */
 

+ 1 - 1
wolfcrypt/src/curve448.c

@@ -97,7 +97,7 @@ int wc_curve448_make_key(WC_RNG* rng, int keysize, curve448_key* key)
         /* clamp private */
         key->k[0] &= 0xfc;
         key->k[CURVE448_KEY_SIZE-1] |= 0x80;
-        
+
         /* compute public */
         ret = wc_curve448_make_pub((int)sizeof(key->p), key->p,
                                    (int)sizeof(key->k), key->k);

+ 5 - 5
wolfcrypt/src/des3.c

@@ -512,7 +512,7 @@
     {
         #ifdef DEBUG_WOLFSSL
         int ret;  int stat1,stat2;
-    	  #endif
+        #endif
         int size;
         volatile int v;
 
@@ -604,14 +604,14 @@
     int wc_Des3_CbcEncrypt(Des3* des3, byte* out, const byte* in, word32 sz)
     {
         wc_Des_Cbc(out, in, sz,  (byte *)des3->key,  (byte *)des3->reg, SEC_DESC_DES3_CBC_ENCRYPT);
-    	  return 0;
+        return 0;
     }
 
 
     int wc_Des3_CbcDecrypt(Des3* des3, byte* out, const byte* in, word32 sz)
     {
         wc_Des_Cbc(out, in, sz,   (byte *)des3->key,  (byte *)des3->reg, SEC_DESC_DES3_CBC_DECRYPT);
-    	  return 0;
+        return 0;
     }
 
     static void setParity(byte *buf, int len)
@@ -637,7 +637,7 @@
     {
         if(desBuffIn == NULL) {
         #if defined (HAVE_THREADX)
-    			  int s1, s2, s3, s4, s5;
+            int s1, s2, s3, s4, s5;
             s5 = tx_byte_allocate(&mp_ncached,(void *)&secDesc,
                                                          sizeof(SECdescriptorType), TX_NO_WAIT);
             s1 = tx_byte_allocate(&mp_ncached,(void *)&desBuffIn,  DES_BUFFER_SIZE, TX_NO_WAIT);
@@ -660,7 +660,7 @@
         }   else {
             XMEMSET(des->reg, 0x0, DES_IVLEN);
         }
-    		return 0;
+        return 0;
     }
 
     int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir)

+ 2 - 2
wolfcrypt/src/dh.c

@@ -2302,9 +2302,9 @@ int wc_DhImportKeyPair(DhKey* key, const byte* priv, word32 privSz,
     return 0;
 }
 
-/* Can be used with WOLFSSL_DH_EXTRA when key is loaded with 
+/* Can be used with WOLFSSL_DH_EXTRA when key is loaded with
     wc_DhKeyDecode or wc_DhImportKeyPair */
-int wc_DhExportKeyPair(DhKey* key, byte* priv, word32* pPrivSz, 
+int wc_DhExportKeyPair(DhKey* key, byte* priv, word32* pPrivSz,
     byte* pub, word32* pPubSz)
 {
     int ret = 0;

+ 10 - 10
wolfcrypt/src/ecc.c

@@ -48,9 +48,9 @@ Possible ECC enable options:
  * ECC_CACHE_CURVE:     Enables cache of curve info to improve performance
  *                                                              default: off
  * FP_ECC:              ECC Fixed Point Cache                   default: off
- *                      FP cache is not supported for SECP160R1, SECP160R2, 
+ *                      FP cache is not supported for SECP160R1, SECP160R2,
  *                      SECP160K1 and SECP224K1. These do not work with scalars
- *                      that are the length of the order when the order is 
+ *                      that are the length of the order when the order is
  *                      longer than the prime.
  * USE_ECC_B_PARAM:     Enable ECC curve B param                default: off
  *                      (on for HAVE_COMP_KEY)
@@ -112,10 +112,10 @@ ECC Curve Sizes:
     /* set NO_WRAPPERS before headers, use direct internal f()s not wrappers */
     #define FIPS_NO_WRAPPERS
 
-	#ifdef USE_WINDOWS_API
-		#pragma code_seg(".fipsA$f")
-		#pragma const_seg(".fipsB$f")
-	#endif
+    #ifdef USE_WINDOWS_API
+        #pragma code_seg(".fipsA$f")
+        #pragma const_seg(".fipsB$f")
+    #endif
 #endif
 
 /* public ASN interface */
@@ -615,7 +615,7 @@ enum {
             static const ecc_oid_t ecc_oid_secp384r1[] = CODED_SECP384R1;
             #define CODED_SECP384R1_OID ecc_oid_secp384r1
         #else
-			#define ecc_oid_secp384r1 CODED_SECP384R1
+            #define ecc_oid_secp384r1 CODED_SECP384R1
         #endif
         #define ecc_oid_secp384r1_sz CODED_SECP384R1_SZ
     #endif /* !NO_ECC_SECP */
@@ -6346,7 +6346,7 @@ int wc_ecc_free(ecc_key* key)
 #ifdef WOLFSSL_QNX_CAAM
     /* free secure memory */
     if (key->blackKey > 0) {
-       caamFreePart(key->partNum); 
+       caamFreePart(key->partNum);
     }
 #endif
 
@@ -8465,7 +8465,7 @@ static int _ecc_validate_public_key(ecc_key* key, int partial, int priv)
         #endif
         DECLARE_CURVE_SPECS(curve, 3);
     #endif /* USE_ECC_B_PARAM */
-#endif /* !WOLFSSL_ATECC508A && !WOLFSSL_ATECC608A && 
+#endif /* !WOLFSSL_ATECC508A && !WOLFSSL_ATECC608A &&
           !WOLFSSL_CRYPTOCELL && !WOLFSSL_SILABS_SE_ACCEL && !WOLFSSL_SE050 */
 #endif /* !WOLFSSL_SP_MATH */
 
@@ -8500,7 +8500,7 @@ static int _ecc_validate_public_key(ecc_key* key, int partial, int priv)
     defined(WOLFSSL_CRYPTOCELL) || defined(WOLFSSL_SILABS_SE_ACCEL) || \
     defined(WOLFSSL_SE050)
 
-    /* consider key check success on HW crypto 
+    /* consider key check success on HW crypto
      * ex: ATECC508/608A, CryptoCell and Silabs */
     err = MP_OKAY;
 

+ 1 - 1
wolfcrypt/src/eccsi.c

@@ -2045,7 +2045,7 @@ static int eccsi_decode_sig_r_pvt(const EccsiKey* key, const byte* sig,
         err = mp_read_unsigned_bin(r, sig, sz);
     }
     if (err == 0) {
-        /* must free previous public point otherwise wc_ecc_import_point_der 
+        /* must free previous public point otherwise wc_ecc_import_point_der
          * could leak memory */
         mp_clear(pvt->x);
         mp_clear(pvt->y);

+ 61 - 61
wolfcrypt/src/evp.c

@@ -682,7 +682,7 @@ int wolfSSL_EVP_CipherUpdate(WOLFSSL_EVP_CIPHER_CTX *ctx,
         return WOLFSSL_FAILURE;
     }
 
-    /* if(inl == 0)wolfSSL_EVP_CipherUpdate_GCM to get tag */ 
+    /* if(inl == 0)wolfSSL_EVP_CipherUpdate_GCM to get tag */
     if (inl == 0) {
         return WOLFSSL_SUCCESS;
     }
@@ -2195,29 +2195,29 @@ static int DH_param_check(WOLFSSL_DH* dh_key)
     WOLFSSL_BN_CTX* ctx = NULL;
     WOLFSSL_BIGNUM *num1 = NULL;
     WOLFSSL_BIGNUM *num2 = NULL;
-    
+
     WOLFSSL_ENTER("DH_param_check");
-    
+
     ctx = wolfSSL_BN_CTX_new();
     if (ctx == NULL) {
         WOLFSSL_MSG("failed to allocate memory");
         return WOLFSSL_FAILURE;
     }
-    
+
     num1 = wolfSSL_BN_new();
     num2 = wolfSSL_BN_new();
     if (num1 == NULL || num2 == NULL) {
         WOLFSSL_MSG("failed to assign big number");
         ret = WOLFSSL_FAILURE;
     }
-    
+
     /* prime check */
     if (ret == WOLFSSL_SUCCESS &&
         wolfSSL_BN_is_odd(dh_key->p) == 0){
         WOLFSSL_MSG("dh_key->p is not prime");
         ret = WOLFSSL_FAILURE;
     } /* TODO safe prime check. need BN_rshift1 */
-    
+
     /* generator check */
     if (ret == WOLFSSL_SUCCESS &&
        (wolfSSL_BN_is_one(dh_key->g) ||
@@ -2226,13 +2226,13 @@ static int DH_param_check(WOLFSSL_DH* dh_key)
         WOLFSSL_MSG("dh_key->g is not suitable generator");
         ret = WOLFSSL_FAILURE;
     }
-    
+
     if (ret == WOLFSSL_SUCCESS &&
         wolfSSL_BN_cmp(dh_key->p, dh_key->g) <= 0) {
         WOLFSSL_MSG("dh_key->g is not suitable generator");
         ret = WOLFSSL_FAILURE;
     }
-    
+
     if (ret == WOLFSSL_SUCCESS &&
         dh_key->q != NULL)
     {
@@ -2257,12 +2257,12 @@ static int DH_param_check(WOLFSSL_DH* dh_key)
         } /* else TODO check q div q - 1. need BN_div */
 #endif
     }
-    
+
     /* clean up */
     wolfSSL_BN_CTX_free(ctx);
     wolfSSL_BN_free(num1);
     wolfSSL_BN_free(num2);
-    
+
     WOLFSSL_LEAVE("DH_param_check", WOLFSSL_SUCCESS);
     return ret;
 }
@@ -2276,12 +2276,12 @@ int wolfSSL_EVP_PKEY_param_check(WOLFSSL_EVP_PKEY_CTX* ctx)
     int type;
     int ret;
     WOLFSSL_DH* dh_key = NULL;
-    
+
     /* sanity check */
     if (ctx == NULL) {
         return WOLFSSL_FAILURE;
     }
-    
+
     type = wolfSSL_EVP_PKEY_type(wolfSSL_EVP_PKEY_base_id(ctx->pkey));
     switch (type) {
         #if !defined(NO_RSA)
@@ -3222,28 +3222,28 @@ int wolfSSL_PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
 #if defined(HAVE_SCRYPT) && defined(HAVE_PBKDF2) && !defined(NO_PWDBASED) && \
                                                     !defined(NO_SHA256)
 /**
- * Derives a key from the specified password and the salt using SCRYPT 
+ * Derives a key from the specified password and the salt using SCRYPT
  * algorithm.
- * 
+ *
  * Parameters:
  * - pass      :password data. no need to be null-terminated. NULL is accepted.
  * - passlen   :length of the password. Must be 0 when pass is NULL.
  * - salt      :salt. NULL is accepted.
  * - saltlen   :length of the salt. Must be 0 when salt is NULL.
- * - N         :cost parameter. Must be grater or equal to 2 and be a power of 2.     
+ * - N         :cost parameter. Must be grater or equal to 2 and be a power of 2.
  * - r         :block size. Must 1 or greater.
- * - p         :parallelism 
+ * - p         :parallelism
  * - maxmem    :maximum size of buffer used for calculation in definition,
  *              Not referred in this implementation.
  * - key       :derived key.
  * - keylen    :length of the derived key
- * 
+ *
  * Returns:
  *   1 on success, otherwise 0.
  */
 int wolfSSL_EVP_PBE_scrypt(const char *pass, size_t passlen,
                             const unsigned char *salt, size_t saltlen,
-                            word64 N, word64 r, word64 p, 
+                            word64 N, word64 r, word64 p,
                             word64 maxmem, unsigned char *key, size_t keylen)
 {
     (void)maxmem;
@@ -3256,7 +3256,7 @@ int wolfSSL_EVP_PBE_scrypt(const char *pass, size_t passlen,
         WOLFSSL_MSG("Doesn't support greater than 32 bit values of r and p");
         return WOLFSSL_FAILURE;
     }
-    /* N must be a power of 2 and > 2. 
+    /* N must be a power of 2 and > 2.
        if (N & (N-1)) is zero, it means N is a power of 2.
      */
     if (N < 2 || (N & (N-1)) || r <= 0 || p <= 0)
@@ -3265,7 +3265,7 @@ int wolfSSL_EVP_PBE_scrypt(const char *pass, size_t passlen,
     if (key == NULL)
         return WOLFSSL_SUCCESS;
 
-    /* get exponent of power of 2. Confirmed N is power of 2. */    
+    /* get exponent of power of 2. Confirmed N is power of 2. */
     while (N != 1) {
         N >>= 1;
         exp++;
@@ -3772,7 +3772,7 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD* type)
         WOLFSSL_ENTER("EVP_blake2b512");
         return EVP_get_digestbyname("BLAKE2b512");
     }
-    
+
 #endif
 
 #ifdef HAVE_BLAKE2S
@@ -3853,19 +3853,19 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD* type)
     const WOLFSSL_EVP_MD* wolfSSL_EVP_sha512_224(void)
     {
         WOLFSSL_ENTER("EVP_sha512_224");
-        return EVP_get_digestbyname("SHA512_224");       
+        return EVP_get_digestbyname("SHA512_224");
     }
 
-#endif /* !WOLFSSL_NOSHA512_224 */ 
+#endif /* !WOLFSSL_NOSHA512_224 */
 
 #ifndef WOLFSSL_NOSHA512_224
     const WOLFSSL_EVP_MD* wolfSSL_EVP_sha512_256(void)
     {
         WOLFSSL_ENTER("EVP_sha512_256");
-        return EVP_get_digestbyname("SHA512_256");       
+        return EVP_get_digestbyname("SHA512_256");
     }
 
-#endif /* !WOLFSSL_NOSHA512_224 */ 
+#endif /* !WOLFSSL_NOSHA512_224 */
 
 #endif /* WOLFSSL_SHA512 */
 
@@ -4152,33 +4152,33 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD* type)
         }
         return (WOLFSSL_EVP_MD *)NULL;
     }
-    
+
     /* return alias name if has
      * @param n message digest type name
      * @return alias name, otherwise NULL
      */
-    static const char* hasAliasName(const char* n) 
+    static const char* hasAliasName(const char* n)
     {
-        
+
         const char* aliasnm = NULL;
         const struct alias  *al;
-        
+
         for (al = alias_tbl; al->name != NULL; al++)
             if(XSTRNCMP(n, al->name, XSTRLEN(al->name)+1) == 0) {
                 aliasnm = al->alias;
                 break;
             }
-        
+
         return aliasnm;
     }
-    
-    
+
+
     struct do_all_md {
         void *arg;
-        void (*fn) (const WOLFSSL_EVP_MD *m, 
+        void (*fn) (const WOLFSSL_EVP_MD *m,
                     const char* from, const char* to, void *arg);
     };
-    
+
     /* do all md algorithm
      * @param nm a pointer to WOLFSSL_OBJ_NAME
      * @param arg arguments to pass to the callback
@@ -4187,14 +4187,14 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD* type)
     static void md_do_all_func(const WOLFSSL_OBJ_NAME* nm, void* arg)
     {
         struct do_all_md *md = (struct do_all_md*)arg;
-        
+
         const struct s_ent *ent;
-        
+
         /* sanity check */
         if (md == NULL || nm == NULL || md->fn == NULL ||
             nm->type != WOLFSSL_OBJ_NAME_TYPE_MD_METH)
             return;
-        
+
         /* loop all md */
         for (ent = md_tbl; ent->name != NULL; ent++){
             /* check if the md has alias */
@@ -4206,7 +4206,7 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD* type)
             }
         }
     }
-    
+
     /* call md_do_all function to do all md algorithm via a callback function
      * @param fn a callback function to be called with all 'md'
      * @param args arguments to pass to the callback
@@ -4216,31 +4216,31 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD* type)
                  const char* from, const char* to, void* xx), void* args)
     {
         struct do_all_md md;
-        
+
         md.fn = fn;
         md.arg = args;
-        
+
         wolfSSL_OBJ_NAME_do_all(WOLFSSL_OBJ_NAME_TYPE_MD_METH,
                         md_do_all_func, &md);
     }
-    
+
     /* call "fn" based on OBJ_NAME type
      * @param type OBJ_NAME type
      * @param fn a callback function
      * @param args arguments to pass to the callback
      * @return none
      */
-    void wolfSSL_OBJ_NAME_do_all(int type, 
+    void wolfSSL_OBJ_NAME_do_all(int type,
                 void (*fn)(const WOLFSSL_OBJ_NAME*, void* arg), void* arg)
     {
         WOLFSSL_OBJ_NAME objnm;
-        
+
         /* sanity check */
         if (!fn)
             return;
-        
+
         objnm.type = type;
-        
+
         switch(type) {
             case WOLFSSL_OBJ_NAME_TYPE_MD_METH:
                 fn(&objnm, arg);
@@ -4256,7 +4256,7 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD* type)
                 break;
         }
     }
-    
+
     #ifndef NO_AES
 
     #if defined(HAVE_AES_CBC) || defined(WOLFSSL_AES_DIRECT)
@@ -7916,8 +7916,8 @@ static int Indent(WOLFSSL_BIO* out, int indents)
 }
 /* PrintHexWithColon dump byte-data specified by "input" to the "out".
  * Each line has leading white spaces( "indent" gives the number ) plus
- * four spaces, then hex coded 15 byte data with separator ":" follow.   
- * Each line looks like: 
+ * four spaces, then hex coded 15 byte data with separator ":" follow.
+ * Each line looks like:
  * "    00:e6:ab: --- 9f:ef:"
  * Parmeters:
  * out     bio to output dump data
@@ -7966,15 +7966,15 @@ static int PrintHexWithColon(WOLFSSL_BIO* out, const byte* input,
     /* print pub element */
     idx = 0;
 
-    for (in = 0; in < (word32)inlen && ret == WOLFSSL_SUCCESS; in += 
+    for (in = 0; in < (word32)inlen && ret == WOLFSSL_SUCCESS; in +=
                                         EVP_PKEY_PRINT_DIGITS_PER_LINE ) {
         Indent(out, indent);
-        for (i = 0; (i < EVP_PKEY_PRINT_DIGITS_PER_LINE) && 
+        for (i = 0; (i < EVP_PKEY_PRINT_DIGITS_PER_LINE) &&
                                         (in + i < (word32)inlen); i++) {
-            
+
             if (ret == WOLFSSL_SUCCESS) {
                 outSz = sizeof(outHex);
-                ret = Base16_Encode((const byte*)&data[in + i], 1, 
+                ret = Base16_Encode((const byte*)&data[in + i], 1,
                                                     outHex, &outSz) == 0;
             }
             if (ret == WOLFSSL_SUCCESS) {
@@ -8043,7 +8043,7 @@ static int PrintPubKeyRSA(WOLFSSL_BIO* out, const byte* pkey, int pkeySz,
         indent = EVP_PKEY_PRINT_INDENT_MAX;
     }
     /* parse key to get modulus and exponent */
-    if (wc_RsaPublicKeyDecode_ex(pkey, &inOutIdx, pkeySz, 
+    if (wc_RsaPublicKeyDecode_ex(pkey, &inOutIdx, pkeySz,
                                             &n, &nSz, &e, &eSz) != 0) {
         return WOLFSSL_FAILURE;
     }
@@ -8078,7 +8078,7 @@ static int PrintPubKeyRSA(WOLFSSL_BIO* out, const byte* pkey, int pkeySz,
         return WOLFSSL_FAILURE;
     }
 
-    /* print modulus with leading zero if exists */    
+    /* print modulus with leading zero if exists */
     if (*n & 0x80 && *(n-1) == 0) {
         n--;
         nSz++;
@@ -8272,7 +8272,7 @@ static int PrintPubKeyEC(WOLFSSL_BIO* out, const byte* pkey, int pkeySz,
     if (res == WOLFSSL_SUCCESS) {
         res = wolfSSL_BIO_write(out, "\n", 1) > 0;
     }
- 
+
     if (pub != NULL) {
         XFREE(pub, NULL, DYNAMIC_TYPE_ECC_BUFFER);
         pub = NULL;
@@ -8291,7 +8291,7 @@ static int PrintPubKeyEC(WOLFSSL_BIO* out, const byte* pkey, int pkeySz,
  * pkeySz  public key data size
  * indent  the number of spaces for indent
  * bitlen  bit size of the given key
- * pctx    context(not used) 
+ * pctx    context(not used)
  * Returns 1 on success, 0 on failure.
 */
 static int PrintPubKeyDSA(WOLFSSL_BIO* out, const byte* pkey, int pkeySz,
@@ -8671,7 +8671,7 @@ static int PrintPubKeyDH(WOLFSSL_BIO* out, const byte* pkey, int pkeySz,
 }
 #endif /* WOLFSSL_DH_EXTRA */
 
-/* wolfSSL_EVP_PKEY_print_public parses the specified key then 
+/* wolfSSL_EVP_PKEY_print_public parses the specified key then
  * outputs public key info in human readable format to the specified BIO.
  * White spaces of the same number which 'indent" gives, will be added to
  * each line to output and ignores pctx parameter.
@@ -8680,7 +8680,7 @@ static int PrintPubKeyDH(WOLFSSL_BIO* out, const byte* pkey, int pkeySz,
  * pkey    buffer holding public key data
  * indent  the number of spaces for indent
  * pctx    context(not used)
- * Returns 1 on success, 0 or negative on error, -2 means specified key 
+ * Returns 1 on success, 0 or negative on error, -2 means specified key
  * algo is not supported.
  * Can handle RSA, ECC, DSA and DH public keys.
  */
@@ -8878,7 +8878,7 @@ int wolfSSL_EVP_get_hashinfo(const WOLFSSL_EVP_MD* evp,
     return WOLFSSL_SUCCESS;
 }
 
-/* Base64 encoding APIs */
+/* Base64 encoding APIs */
 #if defined(WOLFSSL_BASE64_ENCODE) || defined(WOLFSSL_BASE64_DECODE)
 
 /*  wolfSSL_EVP_ENCODE_CTX_new allocates WOLFSSL_EVP_ENCODE_CTX
@@ -8956,7 +8956,7 @@ int  wolfSSL_EVP_EncodeUpdate(WOLFSSL_EVP_ENCODE_CTX* ctx,
         if (ctx->remaining >= BASE64_ENCODE_BLOCK_SIZE) {
             /* Base64_Encode asks the out buff size via the 4th param*/
             outsz = BASE64_ENCODE_RESULT_BLOCK_SIZE + 1;
-            res = Base64_Encode(ctx->data, BASE64_ENCODE_BLOCK_SIZE, out, 
+            res = Base64_Encode(ctx->data, BASE64_ENCODE_BLOCK_SIZE, out,
             &outsz);
             if (res == 0) {
                 ctx->remaining = 0;
@@ -8971,7 +8971,7 @@ int  wolfSSL_EVP_EncodeUpdate(WOLFSSL_EVP_ENCODE_CTX* ctx,
             return  1;
         }
     }
-    /* Here, there is no data left in ctx, so try processing the data of 
+    /* Here, there is no data left in ctx, so try processing the data of
      * the specified input data.
      */
 

+ 377 - 377
wolfcrypt/src/fe_low_mem.c

@@ -69,119 +69,119 @@ void fe_init(void)
 
 /* Double an X-coordinate */
 static void xc_double(byte *x3, byte *z3,
-		      const byte *x1, const byte *z1)
+                      const byte *x1, const byte *z1)
 {
-	/* Explicit formulas database: dbl-1987-m
-	 *
-	 * source 1987 Montgomery "Speeding the Pollard and elliptic
-	 *   curve methods of factorization", page 261, fourth display
-	 * compute X3 = (X1^2-Z1^2)^2
-	 * compute Z3 = 4 X1 Z1 (X1^2 + a X1 Z1 + Z1^2)
-	 */
-	byte x1sq[F25519_SIZE];
-	byte z1sq[F25519_SIZE];
-	byte x1z1[F25519_SIZE];
-	byte a[F25519_SIZE];
-
-	fe_mul__distinct(x1sq, x1, x1);
-	fe_mul__distinct(z1sq, z1, z1);
-	fe_mul__distinct(x1z1, x1, z1);
-
-	lm_sub(a, x1sq, z1sq);
-	fe_mul__distinct(x3, a, a);
-
-	fe_mul_c(a, x1z1, 486662);
-	lm_add(a, x1sq, a);
-	lm_add(a, z1sq, a);
-	fe_mul__distinct(x1sq, x1z1, a);
-	fe_mul_c(z3, x1sq, 4);
+    /* Explicit formulas database: dbl-1987-m
+     *
+     * source 1987 Montgomery "Speeding the Pollard and elliptic
+     *   curve methods of factorization", page 261, fourth display
+     * compute X3 = (X1^2-Z1^2)^2
+     * compute Z3 = 4 X1 Z1 (X1^2 + a X1 Z1 + Z1^2)
+     */
+    byte x1sq[F25519_SIZE];
+    byte z1sq[F25519_SIZE];
+    byte x1z1[F25519_SIZE];
+    byte a[F25519_SIZE];
+
+    fe_mul__distinct(x1sq, x1, x1);
+    fe_mul__distinct(z1sq, z1, z1);
+    fe_mul__distinct(x1z1, x1, z1);
+
+    lm_sub(a, x1sq, z1sq);
+    fe_mul__distinct(x3, a, a);
+
+    fe_mul_c(a, x1z1, 486662);
+    lm_add(a, x1sq, a);
+    lm_add(a, z1sq, a);
+    fe_mul__distinct(x1sq, x1z1, a);
+    fe_mul_c(z3, x1sq, 4);
 }
 
 
 /* Differential addition */
 static void xc_diffadd(byte *x5, byte *z5,
-		       const byte *x1, const byte *z1,
-		       const byte *x2, const byte *z2,
-		       const byte *x3, const byte *z3)
+                       const byte *x1, const byte *z1,
+                       const byte *x2, const byte *z2,
+                       const byte *x3, const byte *z3)
 {
-	/* Explicit formulas database: dbl-1987-m3
-	 *
-	 * source 1987 Montgomery "Speeding the Pollard and elliptic curve
-	 *   methods of factorization", page 261, fifth display, plus
-	 *   common-subexpression elimination
-	 * compute A = X2+Z2
-	 * compute B = X2-Z2
-	 * compute C = X3+Z3
-	 * compute D = X3-Z3
-	 * compute DA = D A
-	 * compute CB = C B
-	 * compute X5 = Z1(DA+CB)^2
-	 * compute Z5 = X1(DA-CB)^2
-	 */
-	byte da[F25519_SIZE];
-	byte cb[F25519_SIZE];
-	byte a[F25519_SIZE];
-	byte b[F25519_SIZE];
-
-	lm_add(a, x2, z2);
-	lm_sub(b, x3, z3); /* D */
-	fe_mul__distinct(da, a, b);
-
-	lm_sub(b, x2, z2);
-	lm_add(a, x3, z3); /* C */
-	fe_mul__distinct(cb, a, b);
-
-	lm_add(a, da, cb);
-	fe_mul__distinct(b, a, a);
-	fe_mul__distinct(x5, z1, b);
-
-	lm_sub(a, da, cb);
-	fe_mul__distinct(b, a, a);
-	fe_mul__distinct(z5, x1, b);
+    /* Explicit formulas database: dbl-1987-m3
+     *
+     * source 1987 Montgomery "Speeding the Pollard and elliptic curve
+     *   methods of factorization", page 261, fifth display, plus
+     *   common-subexpression elimination
+     * compute A = X2+Z2
+     * compute B = X2-Z2
+     * compute C = X3+Z3
+     * compute D = X3-Z3
+     * compute DA = D A
+     * compute CB = C B
+     * compute X5 = Z1(DA+CB)^2
+     * compute Z5 = X1(DA-CB)^2
+     */
+    byte da[F25519_SIZE];
+    byte cb[F25519_SIZE];
+    byte a[F25519_SIZE];
+    byte b[F25519_SIZE];
+
+    lm_add(a, x2, z2);
+    lm_sub(b, x3, z3); /* D */
+    fe_mul__distinct(da, a, b);
+
+    lm_sub(b, x2, z2);
+    lm_add(a, x3, z3); /* C */
+    fe_mul__distinct(cb, a, b);
+
+    lm_add(a, da, cb);
+    fe_mul__distinct(b, a, a);
+    fe_mul__distinct(x5, z1, b);
+
+    lm_sub(a, da, cb);
+    fe_mul__distinct(b, a, a);
+    fe_mul__distinct(z5, x1, b);
 }
 
 #ifndef FREESCALE_LTC_ECC
 int curve25519(byte *result, const byte *e, const byte *q)
 {
-	/* Current point: P_m */
-	byte xm[F25519_SIZE];
-	byte zm[F25519_SIZE] = {1};
-
-	/* Predecessor: P_(m-1) */
-	byte xm1[F25519_SIZE] = {1};
-	byte zm1[F25519_SIZE] = {0};
-
-	int i;
-
-	/* Note: bit 254 is assumed to be 1 */
-	lm_copy(xm, q);
-
-	for (i = 253; i >= 0; i--) {
-		const int bit = (e[i >> 3] >> (i & 7)) & 1;
-		byte xms[F25519_SIZE];
-		byte zms[F25519_SIZE];
-
-		/* From P_m and P_(m-1), compute P_(2m) and P_(2m-1) */
-		xc_diffadd(xm1, zm1, q, f25519_one, xm, zm, xm1, zm1);
-		xc_double(xm, zm, xm, zm);
-
-		/* Compute P_(2m+1) */
-		xc_diffadd(xms, zms, xm1, zm1, xm, zm, q, f25519_one);
-
-		/* Select:
-		 *   bit = 1 --> (P_(2m+1), P_(2m))
-		 *   bit = 0 --> (P_(2m), P_(2m-1))
-		 */
-		fe_select(xm1, xm1, xm, bit);
-		fe_select(zm1, zm1, zm, bit);
-		fe_select(xm, xm, xms, bit);
-		fe_select(zm, zm, zms, bit);
-	}
-
-	/* Freeze out of projective coordinates */
-	fe_inv__distinct(zm1, zm);
-	fe_mul__distinct(result, zm1, xm);
-	fe_normalize(result);
+    /* Current point: P_m */
+    byte xm[F25519_SIZE];
+    byte zm[F25519_SIZE] = {1};
+
+    /* Predecessor: P_(m-1) */
+    byte xm1[F25519_SIZE] = {1};
+    byte zm1[F25519_SIZE] = {0};
+
+    int i;
+
+    /* Note: bit 254 is assumed to be 1 */
+    lm_copy(xm, q);
+
+    for (i = 253; i >= 0; i--) {
+        const int bit = (e[i >> 3] >> (i & 7)) & 1;
+        byte xms[F25519_SIZE];
+        byte zms[F25519_SIZE];
+
+        /* From P_m and P_(m-1), compute P_(2m) and P_(2m-1) */
+        xc_diffadd(xm1, zm1, q, f25519_one, xm, zm, xm1, zm1);
+        xc_double(xm, zm, xm, zm);
+
+        /* Compute P_(2m+1) */
+        xc_diffadd(xms, zms, xm1, zm1, xm, zm, q, f25519_one);
+
+        /* Select:
+         *   bit = 1 --> (P_(2m+1), P_(2m))
+         *   bit = 0 --> (P_(2m), P_(2m-1))
+         */
+        fe_select(xm1, xm1, xm, bit);
+        fe_select(zm1, zm1, zm, bit);
+        fe_select(xm, xm, xms, bit);
+        fe_select(zm, zm, zms, bit);
+    }
+
+    /* Freeze out of projective coordinates */
+    fe_inv__distinct(zm1, zm);
+    fe_mul__distinct(result, zm1, xm);
+    fe_normalize(result);
     return 0;
 }
 #endif /* !FREESCALE_LTC_ECC */
@@ -190,30 +190,30 @@ int curve25519(byte *result, const byte *e, const byte *q)
 
 static void raw_add(byte *x, const byte *p)
 {
-	word16 c = 0;
-	int i;
-
-	for (i = 0; i < F25519_SIZE; i++) {
-		c += ((word16)x[i]) + ((word16)p[i]);
-		x[i] = (byte)c;
-		c >>= 8;
-	}
+    word16 c = 0;
+    int i;
+
+    for (i = 0; i < F25519_SIZE; i++) {
+        c += ((word16)x[i]) + ((word16)p[i]);
+        x[i] = (byte)c;
+        c >>= 8;
+    }
 }
 
 
 static void raw_try_sub(byte *x, const byte *p)
 {
-	byte minusp[F25519_SIZE];
-	word16 c = 0;
-	int i;
+    byte minusp[F25519_SIZE];
+    word16 c = 0;
+    int i;
 
-	for (i = 0; i < F25519_SIZE; i++) {
-		c = ((word16)x[i]) - ((word16)p[i]) - c;
-		minusp[i] = (byte)c;
-		c = (c >> 8) & 1;
-	}
+    for (i = 0; i < F25519_SIZE; i++) {
+        c = ((word16)x[i]) - ((word16)p[i]) - c;
+        minusp[i] = (byte)c;
+        c = (c >> 8) & 1;
+    }
 
-	fprime_select(x, minusp, x, (byte)c);
+    fprime_select(x, minusp, x, (byte)c);
 }
 
 
@@ -224,333 +224,333 @@ static int prime_msb(const byte *p)
     int shift = 1;
     int z     = F25519_SIZE - 1;
 
-   /*
+    /*
        Test for any hot bits.
        As soon as one instance is encountered set shift to 0.
     */
-	for (i = F25519_SIZE - 1; i >= 0; i--) {
+    for (i = F25519_SIZE - 1; i >= 0; i--) {
         shift &= ((shift ^ ((-p[i] | p[i]) >> 7)) & 1);
         z -= shift;
     }
-	x = p[z];
-	z <<= 3;
+    x = p[z];
+    z <<= 3;
     shift = 1;
     for (i = 0; i < 8; i++) {
         shift &= ((-(x >> i) | (x >> i)) >> (7 - i) & 1);
         z += shift;
     }
 
-	return z - 1;
+    return z - 1;
 }
 
 
 void fprime_select(byte *dst, const byte *zero, const byte *one, byte condition)
 {
-	const byte mask = -condition;
-	int i;
+    const byte mask = -condition;
+    int i;
 
-	for (i = 0; i < F25519_SIZE; i++)
-		dst[i] = zero[i] ^ (mask & (one[i] ^ zero[i]));
+    for (i = 0; i < F25519_SIZE; i++)
+        dst[i] = zero[i] ^ (mask & (one[i] ^ zero[i]));
 }
 
 
 void fprime_add(byte *r, const byte *a, const byte *modulus)
 {
-	raw_add(r, a);
-	raw_try_sub(r, modulus);
+    raw_add(r, a);
+    raw_try_sub(r, modulus);
 }
 
 
 void fprime_sub(byte *r, const byte *a, const byte *modulus)
 {
-	raw_add(r, modulus);
-	raw_try_sub(r, a);
-	raw_try_sub(r, modulus);
+    raw_add(r, modulus);
+    raw_try_sub(r, a);
+    raw_try_sub(r, modulus);
 }
 
 
 void fprime_mul(byte *r, const byte *a, const byte *b,
-		const byte *modulus)
+                const byte *modulus)
 {
-	word16 c = 0;
-	int i,j;
+    word16 c = 0;
+    int i,j;
 
-	XMEMSET(r, 0, F25519_SIZE);
+    XMEMSET(r, 0, F25519_SIZE);
 
-	for (i = prime_msb(modulus); i >= 0; i--) {
-		const byte bit = (b[i >> 3] >> (i & 7)) & 1;
-		byte plusa[F25519_SIZE];
+    for (i = prime_msb(modulus); i >= 0; i--) {
+        const byte bit = (b[i >> 3] >> (i & 7)) & 1;
+        byte plusa[F25519_SIZE];
 
-	    for (j = 0; j < F25519_SIZE; j++) {
-		    c |= ((word16)r[j]) << 1;
-		    r[j] = (byte)c;
-		    c >>= 8;
-	    }
-		raw_try_sub(r, modulus);
+        for (j = 0; j < F25519_SIZE; j++) {
+            c |= ((word16)r[j]) << 1;
+            r[j] = (byte)c;
+            c >>= 8;
+        }
+        raw_try_sub(r, modulus);
 
-		fprime_copy(plusa, r);
-		fprime_add(plusa, a, modulus);
+        fprime_copy(plusa, r);
+        fprime_add(plusa, a, modulus);
 
-		fprime_select(r, r, plusa, bit);
-	}
+        fprime_select(r, r, plusa, bit);
+    }
 }
 
 
 void fe_load(byte *x, word32 c)
 {
-	word32 i;
+    word32 i;
 
-	for (i = 0; i < sizeof(c); i++) {
-		x[i] = c;
-		c >>= 8;
-	}
+    for (i = 0; i < sizeof(c); i++) {
+        x[i] = c;
+        c >>= 8;
+    }
 
-	for (; i < F25519_SIZE; i++)
-		x[i] = 0;
+    for (; i < F25519_SIZE; i++)
+        x[i] = 0;
 }
 
 
 void fe_normalize(byte *x)
 {
-	byte minusp[F25519_SIZE];
-	word16 c;
-	int i;
-
-	/* Reduce using 2^255 = 19 mod p */
-	c = (x[31] >> 7) * 19;
-	x[31] &= 127;
-
-	for (i = 0; i < F25519_SIZE; i++) {
-		c += x[i];
-		x[i] = (byte)c;
-		c >>= 8;
-	}
-
-	/* The number is now less than 2^255 + 18, and therefore less than
-	 * 2p. Try subtracting p, and conditionally load the subtracted
-	 * value if underflow did not occur.
-	 */
-	c = 19;
-
-	for (i = 0; i + 1 < F25519_SIZE; i++) {
-		c += x[i];
-		minusp[i] = (byte)c;
-		c >>= 8;
-	}
-
-	c += ((word16)x[i]) - 128;
-	minusp[31] = (byte)c;
-
-	/* Load x-p if no underflow */
-	fe_select(x, minusp, x, (c >> 15) & 1);
+    byte minusp[F25519_SIZE];
+    word16 c;
+    int i;
+
+    /* Reduce using 2^255 = 19 mod p */
+    c = (x[31] >> 7) * 19;
+    x[31] &= 127;
+
+    for (i = 0; i < F25519_SIZE; i++) {
+        c += x[i];
+        x[i] = (byte)c;
+        c >>= 8;
+    }
+
+    /* The number is now less than 2^255 + 18, and therefore less than
+     * 2p. Try subtracting p, and conditionally load the subtracted
+     * value if underflow did not occur.
+     */
+    c = 19;
+
+    for (i = 0; i + 1 < F25519_SIZE; i++) {
+        c += x[i];
+        minusp[i] = (byte)c;
+        c >>= 8;
+    }
+
+    c += ((word16)x[i]) - 128;
+    minusp[31] = (byte)c;
+
+    /* Load x-p if no underflow */
+    fe_select(x, minusp, x, (c >> 15) & 1);
 }
 
 
 void fe_select(byte *dst,
-		   const byte *zero, const byte *one,
-		   byte condition)
+               const byte *zero, const byte *one,
+               byte condition)
 {
-	const byte mask = -condition;
-	int i;
+    const byte mask = -condition;
+    int i;
 
-	for (i = 0; i < F25519_SIZE; i++)
-		dst[i] = zero[i] ^ (mask & (one[i] ^ zero[i]));
+    for (i = 0; i < F25519_SIZE; i++)
+        dst[i] = zero[i] ^ (mask & (one[i] ^ zero[i]));
 }
 
 
 void lm_add(byte* r, const byte* a, const byte* b)
 {
-	word16 c = 0;
-	int i;
-
-	/* Add */
-	for (i = 0; i < F25519_SIZE; i++) {
-		c >>= 8;
-		c += ((word16)a[i]) + ((word16)b[i]);
-		r[i] = (byte)c;
-	}
-
-	/* Reduce with 2^255 = 19 mod p */
-	r[31] &= 127;
-	c = (c >> 7) * 19;
-
-	for (i = 0; i < F25519_SIZE; i++) {
-		c += r[i];
-		r[i] = (byte)c;
-		c >>= 8;
-	}
+    word16 c = 0;
+    int i;
+
+    /* Add */
+    for (i = 0; i < F25519_SIZE; i++) {
+        c >>= 8;
+        c += ((word16)a[i]) + ((word16)b[i]);
+        r[i] = (byte)c;
+    }
+
+    /* Reduce with 2^255 = 19 mod p */
+    r[31] &= 127;
+    c = (c >> 7) * 19;
+
+    for (i = 0; i < F25519_SIZE; i++) {
+        c += r[i];
+        r[i] = (byte)c;
+        c >>= 8;
+    }
 }
 
 
 void lm_sub(byte* r, const byte* a, const byte* b)
 {
-	word32 c = 0;
-	int i;
-
-	/* Calculate a + 2p - b, to avoid underflow */
-	c = 218;
-	for (i = 0; i + 1 < F25519_SIZE; i++) {
-		c += 65280 + ((word32)a[i]) - ((word32)b[i]);
-		r[i] = c;
-		c >>= 8;
-	}
-
-	c += ((word32)a[31]) - ((word32)b[31]);
-	r[31] = c & 127;
-	c = (c >> 7) * 19;
-
-	for (i = 0; i < F25519_SIZE; i++) {
-		c += r[i];
-		r[i] = c;
-		c >>= 8;
-	}
+    word32 c = 0;
+    int i;
+
+    /* Calculate a + 2p - b, to avoid underflow */
+    c = 218;
+    for (i = 0; i + 1 < F25519_SIZE; i++) {
+        c += 65280 + ((word32)a[i]) - ((word32)b[i]);
+        r[i] = c;
+        c >>= 8;
+    }
+
+    c += ((word32)a[31]) - ((word32)b[31]);
+    r[31] = c & 127;
+    c = (c >> 7) * 19;
+
+    for (i = 0; i < F25519_SIZE; i++) {
+        c += r[i];
+        r[i] = c;
+        c >>= 8;
+    }
 }
 
 
 void lm_neg(byte* r, const byte* a)
 {
-	word32 c = 0;
-	int i;
-
-	/* Calculate 2p - a, to avoid underflow */
-	c = 218;
-	for (i = 0; i + 1 < F25519_SIZE; i++) {
-		c += 65280 - ((word32)a[i]);
-		r[i] = c;
-		c >>= 8;
-	}
-
-	c -= ((word32)a[31]);
-	r[31] = c & 127;
-	c = (c >> 7) * 19;
-
-	for (i = 0; i < F25519_SIZE; i++) {
-		c += r[i];
-		r[i] = c;
-		c >>= 8;
-	}
+    word32 c = 0;
+    int i;
+
+    /* Calculate 2p - a, to avoid underflow */
+    c = 218;
+    for (i = 0; i + 1 < F25519_SIZE; i++) {
+        c += 65280 - ((word32)a[i]);
+        r[i] = c;
+        c >>= 8;
+    }
+
+    c -= ((word32)a[31]);
+    r[31] = c & 127;
+    c = (c >> 7) * 19;
+
+    for (i = 0; i < F25519_SIZE; i++) {
+        c += r[i];
+        r[i] = c;
+        c >>= 8;
+    }
 }
 
 
 void fe_mul__distinct(byte *r, const byte *a, const byte *b)
 {
-	word32 c = 0;
-	int i;
+    word32 c = 0;
+    int i;
 
-	for (i = 0; i < F25519_SIZE; i++) {
-		int j;
+    for (i = 0; i < F25519_SIZE; i++) {
+        int j;
 
-		c >>= 8;
-		for (j = 0; j <= i; j++)
-			c += ((word32)a[j]) * ((word32)b[i - j]);
+        c >>= 8;
+        for (j = 0; j <= i; j++)
+            c += ((word32)a[j]) * ((word32)b[i - j]);
 
-		for (; j < F25519_SIZE; j++)
-			c += ((word32)a[j]) *
-			     ((word32)b[i + F25519_SIZE - j]) * 38;
+        for (; j < F25519_SIZE; j++)
+            c += ((word32)a[j]) *
+                ((word32)b[i + F25519_SIZE - j]) * 38;
 
-		r[i] = c;
-	}
+        r[i] = c;
+    }
 
-	r[31] &= 127;
-	c = (c >> 7) * 19;
+    r[31] &= 127;
+    c = (c >> 7) * 19;
 
-	for (i = 0; i < F25519_SIZE; i++) {
-		c += r[i];
-		r[i] = c;
-		c >>= 8;
-	}
+    for (i = 0; i < F25519_SIZE; i++) {
+        c += r[i];
+        r[i] = c;
+        c >>= 8;
+    }
 }
 
 
 void lm_mul(byte *r, const byte* a, const byte *b)
 {
-	byte tmp[F25519_SIZE];
+    byte tmp[F25519_SIZE];
 
-	fe_mul__distinct(tmp, a, b);
-	lm_copy(r, tmp);
+    fe_mul__distinct(tmp, a, b);
+    lm_copy(r, tmp);
 }
 
 
 void fe_mul_c(byte *r, const byte *a, word32 b)
 {
-	word32 c = 0;
-	int i;
-
-	for (i = 0; i < F25519_SIZE; i++) {
-		c >>= 8;
-		c += b * ((word32)a[i]);
-		r[i] = c;
-	}
-
-	r[31] &= 127;
-	c >>= 7;
-	c *= 19;
-
-	for (i = 0; i < F25519_SIZE; i++) {
-		c += r[i];
-		r[i] = c;
-		c >>= 8;
-	}
+    word32 c = 0;
+    int i;
+
+    for (i = 0; i < F25519_SIZE; i++) {
+        c >>= 8;
+        c += b * ((word32)a[i]);
+        r[i] = c;
+    }
+
+    r[31] &= 127;
+    c >>= 7;
+    c *= 19;
+
+    for (i = 0; i < F25519_SIZE; i++) {
+        c += r[i];
+        r[i] = c;
+        c >>= 8;
+    }
 }
 
 
 void fe_inv__distinct(byte *r, const byte *x)
 {
-	byte s[F25519_SIZE];
-	int i;
-
-	/* This is a prime field, so by Fermat's little theorem:
-	 *
-	 *     x^(p-1) = 1 mod p
-	 *
-	 * Therefore, raise to (p-2) = 2^255-21 to get a multiplicative
-	 * inverse.
-	 *
-	 * This is a 255-bit binary number with the digits:
-	 *
-	 *     11111111... 01011
-	 *
-	 * We compute the result by the usual binary chain, but
-	 * alternate between keeping the accumulator in r and s, so as
-	 * to avoid copying temporaries.
-	 */
-
-	/* 1 1 */
-	fe_mul__distinct(s, x, x);
-	fe_mul__distinct(r, s, x);
-
-	/* 1 x 248 */
-	for (i = 0; i < 248; i++) {
-		fe_mul__distinct(s, r, r);
-		fe_mul__distinct(r, s, x);
-	}
-
-	/* 0 */
-	fe_mul__distinct(s, r, r);
-
-	/* 1 */
-	fe_mul__distinct(r, s, s);
-	fe_mul__distinct(s, r, x);
-
-	/* 0 */
-	fe_mul__distinct(r, s, s);
-
-	/* 1 */
-	fe_mul__distinct(s, r, r);
-	fe_mul__distinct(r, s, x);
-
-	/* 1 */
-	fe_mul__distinct(s, r, r);
-	fe_mul__distinct(r, s, x);
+    byte s[F25519_SIZE];
+    int i;
+
+    /* This is a prime field, so by Fermat's little theorem:
+     *
+     *     x^(p-1) = 1 mod p
+     *
+     * Therefore, raise to (p-2) = 2^255-21 to get a multiplicative
+     * inverse.
+     *
+     * This is a 255-bit binary number with the digits:
+     *
+     *     11111111... 01011
+     *
+     * We compute the result by the usual binary chain, but
+     * alternate between keeping the accumulator in r and s, so as
+     * to avoid copying temporaries.
+     */
+
+    /* 1 1 */
+    fe_mul__distinct(s, x, x);
+    fe_mul__distinct(r, s, x);
+
+    /* 1 x 248 */
+    for (i = 0; i < 248; i++) {
+        fe_mul__distinct(s, r, r);
+        fe_mul__distinct(r, s, x);
+    }
+
+    /* 0 */
+    fe_mul__distinct(s, r, r);
+
+    /* 1 */
+    fe_mul__distinct(r, s, s);
+    fe_mul__distinct(s, r, x);
+
+    /* 0 */
+    fe_mul__distinct(r, s, s);
+
+    /* 1 */
+    fe_mul__distinct(s, r, r);
+    fe_mul__distinct(r, s, x);
+
+    /* 1 */
+    fe_mul__distinct(s, r, r);
+    fe_mul__distinct(r, s, x);
 }
 
 
 void lm_invert(byte *r, const byte *x)
 {
-	byte tmp[F25519_SIZE];
+    byte tmp[F25519_SIZE];
 
-	fe_inv__distinct(tmp, x);
-	lm_copy(r, tmp);
+    fe_inv__distinct(tmp, x);
+    lm_copy(r, tmp);
 }
 
 
@@ -559,52 +559,52 @@ void lm_invert(byte *r, const byte *x)
  */
 static void exp2523(byte *r, const byte *x, byte *s)
 {
-	int i;
+    int i;
 
-	/* This number is a 252-bit number with the binary expansion:
-	 *
-	 *     111111... 01
-	 */
+    /* This number is a 252-bit number with the binary expansion:
+     *
+     *     111111... 01
+     */
 
-	/* 1 1 */
-	fe_mul__distinct(r, x, x);
-	fe_mul__distinct(s, r, x);
+    /* 1 1 */
+    fe_mul__distinct(r, x, x);
+    fe_mul__distinct(s, r, x);
 
-	/* 1 x 248 */
-	for (i = 0; i < 248; i++) {
-		fe_mul__distinct(r, s, s);
-		fe_mul__distinct(s, r, x);
-	}
+    /* 1 x 248 */
+    for (i = 0; i < 248; i++) {
+        fe_mul__distinct(r, s, s);
+        fe_mul__distinct(s, r, x);
+    }
 
-	/* 0 */
-	fe_mul__distinct(r, s, s);
+    /* 0 */
+    fe_mul__distinct(r, s, s);
 
-	/* 1 */
-	fe_mul__distinct(s, r, r);
-	fe_mul__distinct(r, s, x);
+    /* 1 */
+    fe_mul__distinct(s, r, r);
+    fe_mul__distinct(r, s, x);
 }
 
 
 void fe_sqrt(byte *r, const byte *a)
 {
-	byte v[F25519_SIZE];
-	byte i[F25519_SIZE];
-	byte x[F25519_SIZE];
-	byte y[F25519_SIZE];
-
-	/* v = (2a)^((p-5)/8) [x = 2a] */
-	fe_mul_c(x, a, 2);
-	exp2523(v, x, y);
-
-	/* i = 2av^2 - 1 */
-	fe_mul__distinct(y, v, v);
-	fe_mul__distinct(i, x, y);
-	fe_load(y, 1);
-	lm_sub(i, i, y);
-
-	/* r = avi */
-	fe_mul__distinct(x, v, a);
-	fe_mul__distinct(r, x, i);
+    byte v[F25519_SIZE];
+    byte i[F25519_SIZE];
+    byte x[F25519_SIZE];
+    byte y[F25519_SIZE];
+
+    /* v = (2a)^((p-5)/8) [x = 2a] */
+    fe_mul_c(x, a, 2);
+    exp2523(v, x, y);
+
+    /* i = 2av^2 - 1 */
+    fe_mul__distinct(y, v, v);
+    fe_mul__distinct(i, x, y);
+    fe_load(y, 1);
+    lm_sub(i, i, y);
+
+    /* r = avi */
+    fe_mul__distinct(x, v, a);
+    fe_mul__distinct(r, x, i);
 }
 
 #endif /* CURVE25519_SMALL || ED25519_SMALL */

+ 18 - 18
wolfcrypt/src/fe_operations.c

@@ -175,24 +175,24 @@ int curve25519(byte* q, const byte* n, const byte* p)
     swap = b;
 
     /* montgomery */
-	fe_sub(tmp0,x3,z3);
-	fe_sub(tmp1,x2,z2);
-	fe_add(x2,x2,z2);
-	fe_add(z2,x3,z3);
-	fe_mul(z3,tmp0,x2);
-	fe_mul(z2,z2,tmp1);
-	fe_sq(tmp0,tmp1);
-	fe_sq(tmp1,x2);
-	fe_add(x3,z3,z2);
-	fe_sub(z2,z3,z2);
-	fe_mul(x2,tmp1,tmp0);
-	fe_sub(tmp1,tmp1,tmp0);
-	fe_sq(z2,z2);
-	fe_mul121666(z3,tmp1);
-	fe_sq(x3,x3);
-	fe_add(tmp0,tmp0,z3);
-	fe_mul(z3,x1,z2);
-	fe_mul(z2,tmp1,tmp0);
+    fe_sub(tmp0,x3,z3);
+    fe_sub(tmp1,x2,z2);
+    fe_add(x2,x2,z2);
+    fe_add(z2,x3,z3);
+    fe_mul(z3,tmp0,x2);
+    fe_mul(z2,z2,tmp1);
+    fe_sq(tmp0,tmp1);
+    fe_sq(tmp1,x2);
+    fe_add(x3,z3,z2);
+    fe_sub(z2,z3,z2);
+    fe_mul(x2,tmp1,tmp0);
+    fe_sub(tmp1,tmp1,tmp0);
+    fe_sq(z2,z2);
+    fe_mul121666(z3,tmp1);
+    fe_sq(x3,x3);
+    fe_add(tmp0,tmp0,z3);
+    fe_mul(z3,x1,z2);
+    fe_mul(z2,tmp1,tmp0);
   }
   fe_cswap(x2,x3,swap);
   fe_cswap(z2,z3,swap);

+ 1 - 1
wolfcrypt/src/integer.c

@@ -4614,7 +4614,7 @@ static int mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d)
      if (w >= b) {
 #ifdef WOLFSSL_LINUXKM
         t = (mp_digit)w;
-	/* Linux kernel macro for in-place 64 bit integer division. */
+        /* Linux kernel macro for in-place 64 bit integer division. */
         do_div(t, b);
 #else
         t = (mp_digit)(w / b);

+ 1 - 1
wolfcrypt/src/memory.c

@@ -143,7 +143,7 @@ void* wolfSSL_Malloc(size_t size)
             return NULL;
         }
         #endif
-    
+
         res = malloc(size);
     #else
         WOLFSSL_MSG("No malloc available");

+ 8 - 8
wolfcrypt/src/misc.c

@@ -139,7 +139,7 @@ WC_STATIC WC_INLINE word16 rotrFixed16(word16 x, word16 y)
 #endif /* WC_RC2 */
 
 /* This routine performs a byte swap of 32-bit word value. */
-#if defined(__CCRX__) && !defined(NO_INLINE) // shortest version for CC-RX
+#if defined(__CCRX__) && !defined(NO_INLINE) /* shortest version for CC-RX */
     #define ByteReverseWord32(value) _builtin_revl(value)
 #else
 WC_STATIC WC_INLINE word32 ByteReverseWord32(word32 value)
@@ -214,14 +214,14 @@ WC_STATIC WC_INLINE word64 ByteReverseWord64(word64 value)
 #if defined(WOLF_ALLOW_BUILTIN) && defined(__GNUC_PREREQ) && __GNUC_PREREQ(4, 3)
     return (word64)__builtin_bswap64(value);
 #elif defined(WOLFCRYPT_SLOW_WORD64)
-	return (word64)((word64)ByteReverseWord32((word32) value)) << 32 |
-                    (word64)ByteReverseWord32((word32)(value   >> 32));
+    return (word64)((word64)ByteReverseWord32((word32) value)) << 32 |
+        (word64)ByteReverseWord32((word32)(value   >> 32));
 #else
-	value = ((value & W64LIT(0xFF00FF00FF00FF00)) >> 8) |
-            ((value & W64LIT(0x00FF00FF00FF00FF)) << 8);
-	value = ((value & W64LIT(0xFFFF0000FFFF0000)) >> 16) |
-            ((value & W64LIT(0x0000FFFF0000FFFF)) << 16);
-	return rotlFixed64(value, 32U);
+    value = ((value & W64LIT(0xFF00FF00FF00FF00)) >> 8) |
+        ((value & W64LIT(0x00FF00FF00FF00FF)) << 8);
+    value = ((value & W64LIT(0xFFFF0000FFFF0000)) >> 16) |
+        ((value & W64LIT(0x0000FFFF0000FFFF)) << 16);
+    return rotlFixed64(value, 32U);
 #endif
 }
 

+ 1 - 1
wolfcrypt/src/pkcs12.c

@@ -170,7 +170,7 @@ void wc_PKCS12_free(WC_PKCS12* pkcs12)
 
     heap = pkcs12->heap;
     if (pkcs12->safe != NULL) {
-    	freeSafe(pkcs12->safe, heap);
+        freeSafe(pkcs12->safe, heap);
     }
 
     /* free mac data */

+ 3 - 3
wolfcrypt/src/port/Renesas/renesas_tsip_util.c

@@ -104,10 +104,10 @@ static uint32_t GetTsipCipherSuite(
             default:
                 tsipCipher = (uint32_t)WOLFSSL_TSIP_ILLEGAL_CIPHERSUITE;
                 break;
-		}
+        }
         WOLFSSL_MSG( "<< GetTsipCipherSuite");
         return tsipCipher;
-	}
+    }
     else if( cipherSuiteFirst == ECC_BYTE )
     {
         tsipCipher = (uint32_t)WOLFSSL_TSIP_ILLEGAL_CIPHERSUITE;
@@ -135,7 +135,7 @@ static uint32_t GetTsipCipherSuite(
                 break;
         } */
     }
-	else{
+    else{
         tsipCipher = (uint32_t)WOLFSSL_TSIP_ILLEGAL_CIPHERSUITE;
     }
 

+ 1 - 1
wolfcrypt/src/port/af_alg/afalg_hash.c

@@ -113,7 +113,7 @@ static int AfalgHashUpdate(wolfssl_AFALG_Hash* hash, const byte* in, word32 sz)
                     DYNAMIC_TYPE_TMP_BUFFER);
             if (pt == NULL) {
                 return MEMORY_E;
-	    }
+            }
             hash->msg = pt;
         }
         if (hash->msg == NULL) {

+ 12 - 12
wolfcrypt/src/random.c

@@ -1008,10 +1008,10 @@ int wc_RNG_GenerateBlock(WC_RNG* rng, byte* output, word32 sz)
                 ret = wc_RNG_TestSeed(newSeed, SEED_SZ + SEED_BLOCK_SZ);
 
             if (ret == DRBG_SUCCESS)
-	      ret = Hash_DRBG_Reseed((DRBG_internal *)rng->drbg, newSeed + SEED_BLOCK_SZ,
+                ret = Hash_DRBG_Reseed((DRBG_internal *)rng->drbg, newSeed + SEED_BLOCK_SZ,
                                        SEED_SZ);
             if (ret == DRBG_SUCCESS)
-	      ret = Hash_DRBG_Generate((DRBG_internal *)rng->drbg, output, sz);
+                ret = Hash_DRBG_Generate((DRBG_internal *)rng->drbg, output, sz);
 
             ForceZero(newSeed, sizeof(newSeed));
         }
@@ -1657,14 +1657,14 @@ static int wc_GenerateRand_IntelRD(OS_Seed* os, byte* output, word32 sz)
 int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
 {
     int ret = !SGX_SUCCESS;
-	int i, read_max = 10;
+    int i, read_max = 10;
 
-	for (i = 0; i < read_max && ret != SGX_SUCCESS; i++) {
-		ret = sgx_read_rand(output, sz);
-	}
+    for (i = 0; i < read_max && ret != SGX_SUCCESS; i++) {
+        ret = sgx_read_rand(output, sz);
+    }
 
-	(void)os;
-	return (ret == SGX_SUCCESS) ? 0 : 1;
+    (void)os;
+    return (ret == SGX_SUCCESS) ? 0 : 1;
 }
 
 #elif defined(USE_WINDOWS_API)
@@ -1777,7 +1777,7 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
             RNGPOLY2 = _CP0_GET_COUNT();
             RNGNUMGEN2 = _CP0_GET_COUNT();
 #else
-            // All others can be seeded from the TRNG
+            /* All others can be seeded from the TRNG */
             RNGCONbits.TRNGMODE = 1;
             RNGCONbits.TRNGEN = 1;
             while (RNGCNT < 64);
@@ -2602,12 +2602,12 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
         }
 #elif defined(WOLFSSL_SE050)
      #include <wolfssl/wolfcrypt/port/nxp/se050_port.h>
-    
+
     int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz){
         int ret = 0;
-        
+
         (void)os;
-        
+
         if (output == NULL) {
             return BUFFER_E;
         }

+ 4 - 4
wolfcrypt/src/rsa.c

@@ -4369,10 +4369,10 @@ int wc_MakeRsaKey(RsaKey* key, int size, long e, WC_RNG* rng)
     tmp3 = (mp_int *)XMALLOC(sizeof *tmp3, key->heap, DYNAMIC_TYPE_RSA);
 
     if ((p == NULL) ||
-	(q == NULL) ||
-	(tmp1 == NULL) ||
-	(tmp2 == NULL) ||
-	(tmp3 == NULL)) {
+        (q == NULL) ||
+        (tmp1 == NULL) ||
+        (tmp2 == NULL) ||
+        (tmp3 == NULL)) {
       err = MEMORY_E;
       goto out;
     }

+ 1 - 3
wolfcrypt/src/sha.c

@@ -28,9 +28,7 @@
 
 #if !defined(NO_SHA)
 
-#if defined(HAVE_FIPS) && \
-	defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)
-
+#if defined(HAVE_FIPS) && defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)
     /* set NO_WRAPPERS before headers, use direct internal f()s not wrappers */
     #define FIPS_NO_WRAPPERS
 

+ 5 - 7
wolfcrypt/src/sha256.c

@@ -55,9 +55,7 @@ where 0 <= L < 2^64.
 
 #if !defined(NO_SHA256) && !defined(WOLFSSL_ARMASM)
 
-#if defined(HAVE_FIPS) && \
-	defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)
-
+#if defined(HAVE_FIPS) && defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)
     /* set NO_WRAPPERS before headers, use direct internal f()s not wrappers */
     #define FIPS_NO_WRAPPERS
 
@@ -604,7 +602,7 @@ static int InitSha256(wc_Sha256* sha256)
     }
 
     int wc_Sha256Final(wc_Sha256* sha256, byte* hash)
-    {      
+    {
         int ret = 0;
         ret = se050_hash_final(&sha256->se050Ctx, hash, WC_SHA256_DIGEST_SIZE,
                                kAlgorithm_SSS_SHA256);
@@ -614,7 +612,7 @@ static int InitSha256(wc_Sha256* sha256)
     int wc_Sha256FinalRaw(wc_Sha256* sha256, byte* hash)
     {
         int ret = 0;
-        ret = se050_hash_final(&sha256->se050Ctx, hash, WC_SHA256_DIGEST_SIZE, 
+        ret = se050_hash_final(&sha256->se050Ctx, hash, WC_SHA256_DIGEST_SIZE,
                                kAlgorithm_SSS_SHA256);
         (void)wc_InitSha256(sha256);
         return ret;
@@ -1420,7 +1418,7 @@ static int InitSha256(wc_Sha256* sha256)
             return BAD_FUNC_ARG;
         }
         (void)devId;
-        
+
         return se050_hash_init(&sha224->se050Ctx, heap);
     }
 
@@ -1431,7 +1429,7 @@ static int InitSha256(wc_Sha256* sha256)
 
     int wc_Sha224Final(wc_Sha224* sha224, byte* hash)
     {
-        int ret = 0;   
+        int ret = 0;
         ret = se050_hash_final(&sha224->se050Ctx, hash, WC_SHA224_DIGEST_SIZE,
                                kAlgorithm_SSS_SHA224);
         (void)wc_InitSha224(sha224);

+ 1 - 3
wolfcrypt/src/sha3.c

@@ -29,9 +29,7 @@
 #if defined(WOLFSSL_SHA3) && !defined(WOLFSSL_XILINX_CRYPT) && \
    !defined(WOLFSSL_AFALG_XILINX_SHA3)
 
-#if defined(HAVE_FIPS) && \
-	defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)
-
+#if defined(HAVE_FIPS) && defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)
     /* set NO_WRAPPERS before headers, use direct internal f()s not wrappers */
     #define FIPS_NO_WRAPPERS
 

+ 2 - 4
wolfcrypt/src/sha512.c

@@ -28,9 +28,7 @@
 
 #if (defined(WOLFSSL_SHA512) || defined(WOLFSSL_SHA384)) && !defined(WOLFSSL_ARMASM) && !defined(WOLFSSL_PSOC6_CRYPTO)
 
-#if defined(HAVE_FIPS) && \
-	defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)
-
+#if defined(HAVE_FIPS) && defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)
     /* set NO_WRAPPERS before headers, use direct internal f()s not wrappers */
     #define FIPS_NO_WRAPPERS
 
@@ -1240,7 +1238,7 @@ int wc_Sha512Transform(wc_Sha512* sha, const unsigned char* data)
     int wc_Sha384Update(wc_Sha384* sha384, const byte* data, word32 len)
     {
         return se050_hash_update(&sha384->se050Ctx, data, len);
-    
+
     }
     int wc_Sha384Final(wc_Sha384* sha384, byte* hash)
     {

+ 4 - 4
wolfcrypt/src/signature.c

@@ -212,9 +212,9 @@ int wc_SignatureVerifyHash(
             if (plain_len <= sizeof(plain_data))
         #endif
             {
-            	byte* plain_ptr = NULL;
-            	XMEMSET(plain_data, 0, plain_len);
-            	XMEMCPY(plain_data, sig, sig_len);
+                byte* plain_ptr = NULL;
+                XMEMSET(plain_data, 0, plain_len);
+                XMEMCPY(plain_data, sig, sig_len);
                 /* Perform verification of signature using provided RSA key */
                 do {
                 #ifdef WOLFSSL_ASYNC_CRYPT
@@ -222,7 +222,7 @@ int wc_SignatureVerifyHash(
                         WC_ASYNC_FLAG_CALL_AGAIN);
                 #endif
                 if (ret >= 0)
-                	ret = wc_RsaSSL_VerifyInline(plain_data, sig_len, &plain_ptr, (RsaKey*)key);
+                        ret = wc_RsaSSL_VerifyInline(plain_data, sig_len, &plain_ptr, (RsaKey*)key);
                 } while (ret == WC_PENDING_E);
                 if (ret >= 0 && plain_ptr) {
                     if ((word32)ret == hash_len &&

+ 4 - 4
wolfcrypt/src/tfm.c

@@ -497,7 +497,7 @@ WC_INLINE static int fp_mul_comba_mulx(fp_int *A, fp_int *B, fp_int *C)
 #else
    fp_int    *tmp;
 #endif
- 
+
    /* Variables used but not seen by cppcheck. */
    (void)ix; (void)iy; (void)iz;
 
@@ -604,7 +604,7 @@ int fp_mul_comba(fp_int *A, fp_int *B, fp_int *C)
   dst->sign = A->sign ^ B->sign;
   fp_clamp(dst);
   fp_copy(dst, C);
-  
+
   /* Variables used but not seen by cppcheck. */
   (void)c0; (void)c1; (void)c2;
 
@@ -3230,7 +3230,7 @@ int fp_sqr_comba(fp_int *A, fp_int *B)
 #ifdef TFM_ISO
   (void)tt;
 #endif
-   
+
 #ifdef WOLFSSL_SMALL_STACK
   XFREE(tmp, NULL, DYNAMIC_TYPE_BIGINT);
 #endif
@@ -4746,7 +4746,7 @@ static int fp_div_d(fp_int *a, fp_digit b, fp_int *c, fp_digit *d)
      if (w >= b) {
 #ifdef WOLFSSL_LINUXKM
         t = (fp_digit)w;
-	/* Linux kernel macro for in-place 64 bit integer division. */
+        /* Linux kernel macro for in-place 64 bit integer division. */
         do_div(t, b);
 #else
         t = (fp_digit)(w / b);

+ 14 - 14
wolfcrypt/src/wc_port.c

@@ -243,7 +243,7 @@ int wolfCrypt_Init(void)
     #endif
 
     #ifdef WOLFSSL_AFALG
-	WOLFSSL_MSG("Using AF_ALG for crypto acceleration");
+        WOLFSSL_MSG("Using AF_ALG for crypto acceleration");
     #endif
 
     #if !defined(WOLFCRYPT_ONLY) && defined(OPENSSL_EXTRA)
@@ -296,7 +296,7 @@ int wolfCrypt_Init(void)
 #endif
 
 #if defined(WOLFSSL_DSP) && !defined(WOLFSSL_DSP_BUILD)
-	if ((ret = wolfSSL_InitHandle()) != 0) {
+        if ((ret = wolfSSL_InitHandle()) != 0) {
             return ret;
         }
         rpcmem_init();
@@ -384,7 +384,7 @@ int wolfCrypt_Cleanup(void)
 #ifndef NO_FILESYSTEM
 
 /* Helpful function to load file into allocated buffer */
-int wc_FileLoad(const char* fname, unsigned char** buf, size_t* bufLen, 
+int wc_FileLoad(const char* fname, unsigned char** buf, size_t* bufLen,
     void* heap)
 {
     int ret;
@@ -834,7 +834,7 @@ int z_fs_close(XFILE file)
 
 #endif /* !NO_FILESYSTEM && !WOLFSSL_ZEPHYR */
 
-#if !defined(WOLFSSL_USER_MUTEX) 
+#if !defined(WOLFSSL_USER_MUTEX)
 wolfSSL_Mutex* wc_InitAndAllocMutex(void)
 {
     wolfSSL_Mutex* m = (wolfSSL_Mutex*) XMALLOC(sizeof(wolfSSL_Mutex), NULL,
@@ -1918,8 +1918,8 @@ int wolfSSL_CryptHwMutexUnLock(void)
         del = DeleteRtSemaphore(
             *m                      /* handle for RT semaphore */
         );
-    	if (del != TRUE)
-    		ret = BAD_MUTEX_E;
+        if (del != TRUE)
+            ret = BAD_MUTEX_E;
 
         return ret;
     }
@@ -1957,8 +1957,8 @@ int wolfSSL_CryptHwMutexUnLock(void)
             *m,                     /* handle for RT semaphore */
             1                       /* number of units to release to semaphore */
         );
-    	if (rel != TRUE)
-    		ret = BAD_MUTEX_E;
+        if (rel != TRUE)
+            ret = BAD_MUTEX_E;
 
         return ret;
     }
@@ -2107,7 +2107,7 @@ int wolfSSL_CryptHwMutexUnLock(void)
 #elif defined(WOLFSSL_USER_MUTEX)
 
     /* Use user own mutex */
-    
+
     /*
     int wc_InitMutex(wolfSSL_Mutex* m) { ... }
     int wc_FreeMutex(wolfSSL_Mutex *m) { ... }
@@ -2595,15 +2595,15 @@ char* mystrnstr(const char* s1, const char* s2, unsigned int n)
                     return ptr;
             }
 #endif /* ! __PIE__ */
-	}
+        }
 
-	nptr = kvmalloc_node(newsize, GFP_KERNEL, NUMA_NO_NODE);
-	if (nptr != NULL) {
+        nptr = kvmalloc_node(newsize, GFP_KERNEL, NUMA_NO_NODE);
+        if (nptr != NULL) {
             memcpy(nptr, ptr, oldsize);
             kvfree(ptr);
-	}
+        }
 
-	return nptr;
+        return nptr;
     }
 #endif /* WOLFSSL_LINUXKM && HAVE_KVMALLOC */
 

+ 1 - 1
wolfcrypt/src/wolfmath.c

@@ -227,7 +227,7 @@ int wc_export_int(mp_int* mp, byte* buf, word32* len, word32 keySz,
             }
             *len = (word32)size;
             err = mp_tohex(mp, (char*)buf);
-        }        
+        }
     #else
         err = NOT_COMPILED_IN;
     #endif

+ 1 - 1
wolfcrypt/user-crypto/src/rsa.c

@@ -2769,7 +2769,7 @@ int wc_RsaKeyToPublicDer(RsaKey* key, byte* output, word32 inLen)
     return SetRsaPublicKey(output, key, inLen, 1);
 }
 
-/* Returns public DER version of the RSA key. If with_header is 0 then only a 
+/* Returns public DER version of the RSA key. If with_header is 0 then only a
  * seq + n + e is returned in ASN.1 DER format */
 int wc_RsaKeyToPublicDer_ex(RsaKey* key, byte* output, word32 inLen,
     int with_header)

+ 5 - 5
wolfssl/internal.h

@@ -1359,7 +1359,7 @@ enum Misc {
                                     /* max size of buffer for exporting state */
     FINISHED_LABEL_SZ   = 15,  /* TLS finished label size */
     TLS_FINISHED_SZ     = 12,  /* TLS has a shorter size  */
-    TLS_FINISHED_SZ_MAX = WC_MAX_DIGEST_SIZE,  
+    TLS_FINISHED_SZ_MAX = WC_MAX_DIGEST_SIZE,
                             /* longest message digest size is SHA512, 64 */
     EXT_MASTER_LABEL_SZ = 22,  /* TLS extended master secret label sz */
     MASTER_LABEL_SZ     = 13,  /* TLS master secret label sz */
@@ -1658,13 +1658,13 @@ enum states {
     SERVER_CERT_VERIFY_COMPLETE,
     SERVER_KEYEXCHANGE_COMPLETE,
     SERVER_HELLODONE_COMPLETE,
-	SERVER_CHANGECIPHERSPEC_COMPLETE,
+    SERVER_CHANGECIPHERSPEC_COMPLETE,
     SERVER_FINISHED_COMPLETE,
 
     CLIENT_HELLO_RETRY,
     CLIENT_HELLO_COMPLETE,
     CLIENT_KEYEXCHANGE_COMPLETE,
-	CLIENT_CHANGECIPHERSPEC_COMPLETE,
+    CLIENT_CHANGECIPHERSPEC_COMPLETE,
     CLIENT_FINISHED_COMPLETE,
 
     HANDSHAKE_DONE
@@ -4902,7 +4902,7 @@ WOLFSSL_LOCAL const char* GetCipherNameInternal(const byte cipherSuite0, const b
 #define MAX_SEGMENTS    5
 #define MAX_SEGMENT_SZ 20
 WOLFSSL_LOCAL int wolfSSL_sk_CIPHER_description(WOLFSSL_CIPHER*);
-WOLFSSL_LOCAL const char* GetCipherSegment(const WOLFSSL_CIPHER* cipher, 
+WOLFSSL_LOCAL const char* GetCipherSegment(const WOLFSSL_CIPHER* cipher,
                                            char n[][MAX_SEGMENT_SZ]);
 WOLFSSL_LOCAL const char* GetCipherProtocol(const byte minor);
 WOLFSSL_LOCAL const char* GetCipherKeaStr(char n[][MAX_SEGMENT_SZ]);
@@ -4990,7 +4990,7 @@ WOLFSSL_LOCAL void FreeKey(WOLFSSL* ssl, int type, void** pKey);
 #if defined(OPENSSL_ALL) && defined(WOLFSSL_CERT_GEN) && \
     (defined(WOLFSSL_CERT_REQ) || defined(WOLFSSL_CERT_EXT)) && \
     !defined(NO_FILESYSTEM) && !defined(NO_WOLFSSL_DIR)
-WOLFSSL_LOCAL int LoadCertByIssuer(WOLFSSL_X509_STORE* store, 
+WOLFSSL_LOCAL int LoadCertByIssuer(WOLFSSL_X509_STORE* store,
                                            X509_NAME* issuer, int Type);
 #endif
 #if defined(OPENSSL_ALL) && !defined(NO_FILESYSTEM) && !defined(NO_WOLFSSL_DIR)

+ 1 - 1
wolfssl/openssl/dh.h

@@ -70,7 +70,7 @@ WOLFSSL_API int wolfSSL_DH_LoadDer(WOLFSSL_DH*, const unsigned char*, int sz);
 WOLFSSL_API int wolfSSL_DH_set_length(WOLFSSL_DH*, long);
 WOLFSSL_API int wolfSSL_DH_set0_pqg(WOLFSSL_DH*, WOLFSSL_BIGNUM*,
     WOLFSSL_BIGNUM*, WOLFSSL_BIGNUM*);
-                  
+
 #define DH_new  wolfSSL_DH_new
 #define DH_free wolfSSL_DH_free
 

+ 1 - 1
wolfssl/openssl/dsa.h

@@ -146,7 +146,7 @@ WOLFSSL_API WOLFSSL_DSA* wolfSSL_d2i_DSAparams(WOLFSSL_DSA**,
 #define DSA_SIG                    WOLFSSL_DSA_SIG
 
 #ifdef __cplusplus
-    }  /* extern "C" */ 
+    }  /* extern "C" */
 #endif
 
 #endif /* header */

+ 4 - 4
wolfssl/openssl/evp.h

@@ -351,7 +351,7 @@ enum {
     NID_kx_srp    = 1044,
     NID_kx_gost   = 1045,
     NID_kx_any    = 1063,
-    
+
     /* server authentication */
     NID_auth_rsa = 1046,
     NID_auth_ecdsa = 1047,
@@ -360,7 +360,7 @@ enum {
     NID_auth_srp = 1052,
     NID_auth_null = 1054,
     NID_auth_any = 1055
-    
+
 };
 
 #define NID_X9_62_id_ecPublicKey EVP_PKEY_EC
@@ -724,7 +724,7 @@ WOLFSSL_API int wolfSSL_PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
                                                     !defined(NO_SHA)
 WOLFSSL_API int wolfSSL_EVP_PBE_scrypt(const char *pass, size_t passlen,
                             const unsigned char *salt, size_t saltlen,
-                            word64 N, word64 r, word64 p, 
+                            word64 N, word64 r, word64 p,
                             word64 maxmem, unsigned char *key, size_t keylen);
 #endif /* HAVE_SCRYPT && HAVE_PBKDF2 && !NO_PWDBASED && !NO_SHA */
 
@@ -734,7 +734,7 @@ WOLFSSL_LOCAL int wolfSSL_EVP_get_hashinfo(const WOLFSSL_EVP_MD* evp,
 WOLFSSL_API void wolfSSL_EVP_MD_do_all(void (*fn) (const WOLFSSL_EVP_MD *md,
                                                    const char* from, const char* to,
                                                    void* xx), void* args);
-                                                   
+
 #define EVP_CIPH_STREAM_CIPHER WOLFSSL_EVP_CIPH_STREAM_CIPHER
 #define EVP_CIPH_ECB_MODE WOLFSSL_EVP_CIPH_ECB_MODE
 #define EVP_CIPH_CBC_MODE WOLFSSL_EVP_CIPH_CBC_MODE

+ 1 - 1
wolfssl/openssl/opensslv.h

@@ -28,7 +28,7 @@
 /* api version compatibility */
 #if defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER == 0x0090810fL) ||\
     defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER == 0x10100000L) ||\
-    defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER == 0x10001040L)  
+    defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER == 0x10001040L)
      /* valid version */
 #elif defined(WOLFSSL_APACHE_HTTPD) || defined(HAVE_LIBEST) || \
       defined(WOLFSSL_BIND) || defined(WOLFSSL_NGINX) || \

+ 1 - 1
wolfssl/openssl/pem.h

@@ -259,7 +259,7 @@ int wolfSSL_PEM_write_DHparams(XFILE fp, WOLFSSL_DH* dh);
 #define PEM_write_bio_PUBKEY            wolfSSL_PEM_write_bio_PUBKEY
 
 #ifdef __cplusplus
-    }  /* extern "C" */ 
+    }  /* extern "C" */
 #endif
 
 #endif /* WOLFSSL_PEM_H_ */

+ 1 - 1
wolfssl/openssl/ripemd.h

@@ -50,7 +50,7 @@ typedef WOLFSSL_RIPEMD_CTX RIPEMD_CTX;
 
 
 #ifdef __cplusplus
-    }  /* extern "C" */ 
+    }  /* extern "C" */
 #endif
 
 

+ 2 - 2
wolfssl/openssl/rsa.h

@@ -111,9 +111,9 @@ WOLFSSL_API int wolfSSL_RSA_generate_key_ex(WOLFSSL_RSA*, int bits, WOLFSSL_BIGN
 WOLFSSL_API int wolfSSL_RSA_blinding_on(WOLFSSL_RSA*, WOLFSSL_BN_CTX*);
 WOLFSSL_API int wolfSSL_RSA_check_key(const WOLFSSL_RSA*);
 WOLFSSL_API int wolfSSL_RSA_public_encrypt(int len, const unsigned char* fr,
-	                               unsigned char* to, WOLFSSL_RSA*, int padding);
+                                       unsigned char* to, WOLFSSL_RSA*, int padding);
 WOLFSSL_API int wolfSSL_RSA_private_decrypt(int len, const unsigned char* fr,
-	                               unsigned char* to, WOLFSSL_RSA*, int padding);
+                                       unsigned char* to, WOLFSSL_RSA*, int padding);
 WOLFSSL_API int wolfSSL_RSA_private_encrypt(int len, const unsigned char* in,
                             unsigned char* out, WOLFSSL_RSA* rsa, int padding);
 

+ 10 - 10
wolfssl/openssl/sha.h

@@ -52,13 +52,13 @@ typedef struct WOLFSSL_SHA_CTX {
 WOLFSSL_API int wolfSSL_SHA_Init(WOLFSSL_SHA_CTX*);
 WOLFSSL_API int wolfSSL_SHA_Update(WOLFSSL_SHA_CTX*, const void*, unsigned long);
 WOLFSSL_API int wolfSSL_SHA_Final(unsigned char*, WOLFSSL_SHA_CTX*);
-WOLFSSL_API int wolfSSL_SHA_Transform(WOLFSSL_SHA_CTX*, 
+WOLFSSL_API int wolfSSL_SHA_Transform(WOLFSSL_SHA_CTX*,
                                           const unsigned char *data);
 /* SHA1 points to above, shouldn't use SHA0 ever */
 WOLFSSL_API int wolfSSL_SHA1_Init(WOLFSSL_SHA_CTX*);
 WOLFSSL_API int wolfSSL_SHA1_Update(WOLFSSL_SHA_CTX*, const void*, unsigned long);
 WOLFSSL_API int wolfSSL_SHA1_Final(unsigned char*, WOLFSSL_SHA_CTX*);
-WOLFSSL_API int wolfSSL_SHA1_Transform(WOLFSSL_SHA_CTX*, 
+WOLFSSL_API int wolfSSL_SHA1_Transform(WOLFSSL_SHA_CTX*,
                                           const unsigned char *data);
 enum {
     SHA_DIGEST_LENGTH = 20
@@ -75,7 +75,7 @@ typedef WOLFSSL_SHA_CTX SHA_CTX;
 #if defined(NO_OLD_SHA_NAMES) && !defined(HAVE_SELFTEST) && \
     (!defined(HAVE_FIPS) || \
     (defined(HAVE_FIPS_VERSION) && HAVE_FIPS_VERSION > 2))
-    /* SHA is only available in non-fips mode or fips version > 2 mode 
+    /* SHA is only available in non-fips mode or fips version > 2 mode
      * because of SHA enum in FIPS build. */
     #define SHA wolfSSL_SHA1
 #endif
@@ -97,7 +97,7 @@ typedef struct WOLFSSL_SHA224_CTX {
 
 WOLFSSL_API int wolfSSL_SHA224_Init(WOLFSSL_SHA224_CTX*);
 WOLFSSL_API int wolfSSL_SHA224_Update(WOLFSSL_SHA224_CTX*, const void*,
-	                                 unsigned long);
+                                         unsigned long);
 WOLFSSL_API int wolfSSL_SHA224_Final(unsigned char*, WOLFSSL_SHA224_CTX*);
 
 enum {
@@ -113,7 +113,7 @@ typedef WOLFSSL_SHA224_CTX SHA224_CTX;
 #if defined(NO_OLD_SHA_NAMES) && !defined(HAVE_SELFTEST) && \
     (!defined(HAVE_FIPS) || \
     (defined(HAVE_FIPS_VERSION) && HAVE_FIPS_VERSION > 2))
-    /* SHA224 is only available in non-fips mode or fips version > 2 mode 
+    /* SHA224 is only available in non-fips mode or fips version > 2 mode
      * because of SHA224 enum in FIPS build. */
     #define SHA224 wolfSSL_SHA224
 #endif
@@ -133,7 +133,7 @@ WOLFSSL_API int wolfSSL_SHA256_Init(WOLFSSL_SHA256_CTX*);
 WOLFSSL_API int wolfSSL_SHA256_Update(WOLFSSL_SHA256_CTX*, const void*,
                                  unsigned long);
 WOLFSSL_API int wolfSSL_SHA256_Final(unsigned char*, WOLFSSL_SHA256_CTX*);
-WOLFSSL_API int wolfSSL_SHA256_Transform(WOLFSSL_SHA256_CTX*, 
+WOLFSSL_API int wolfSSL_SHA256_Transform(WOLFSSL_SHA256_CTX*,
                                                 const unsigned char *data);
 enum {
     SHA256_DIGEST_LENGTH = 32
@@ -174,7 +174,7 @@ typedef struct WOLFSSL_SHA384_CTX {
 
 WOLFSSL_API int wolfSSL_SHA384_Init(WOLFSSL_SHA384_CTX*);
 WOLFSSL_API int wolfSSL_SHA384_Update(WOLFSSL_SHA384_CTX*, const void*,
-	                                 unsigned long);
+                                         unsigned long);
 WOLFSSL_API int wolfSSL_SHA384_Final(unsigned char*, WOLFSSL_SHA384_CTX*);
 
 enum {
@@ -205,7 +205,7 @@ WOLFSSL_API int wolfSSL_SHA512_Init(WOLFSSL_SHA512_CTX*);
 WOLFSSL_API int wolfSSL_SHA512_Update(WOLFSSL_SHA512_CTX*, const void*,
                                      unsigned long);
 WOLFSSL_API int wolfSSL_SHA512_Final(unsigned char*, WOLFSSL_SHA512_CTX*);
-WOLFSSL_API int wolfSSL_SHA512_Transform(WOLFSSL_SHA512_CTX*, 
+WOLFSSL_API int wolfSSL_SHA512_Transform(WOLFSSL_SHA512_CTX*,
                                         const unsigned char*);
 enum {
     SHA512_DIGEST_LENGTH = 64
@@ -232,7 +232,7 @@ WOLFSSL_API int wolfSSL_SHA512_224_Init(WOLFSSL_SHA512_CTX*);
 WOLFSSL_API int wolfSSL_SHA512_224_Update(WOLFSSL_SHA512_CTX*, const void*,
                                      unsigned long);
 WOLFSSL_API int wolfSSL_SHA512_224_Final(unsigned char*, WOLFSSL_SHA512_CTX*);
-WOLFSSL_API int wolfSSL_SHA512_224_Transform(WOLFSSL_SHA512_CTX*, 
+WOLFSSL_API int wolfSSL_SHA512_224_Transform(WOLFSSL_SHA512_CTX*,
                                         const unsigned char*);
 
 
@@ -254,7 +254,7 @@ WOLFSSL_API int wolfSSL_SHA512_256_Init(WOLFSSL_SHA512_CTX*);
 WOLFSSL_API int wolfSSL_SHA512_256_Update(WOLFSSL_SHA512_CTX*, const void*,
                                      unsigned long);
 WOLFSSL_API int wolfSSL_SHA512_256_Final(unsigned char*, WOLFSSL_SHA512_CTX*);
-WOLFSSL_API int wolfSSL_SHA512_256_Transform(WOLFSSL_SHA512_CTX*, 
+WOLFSSL_API int wolfSSL_SHA512_256_Transform(WOLFSSL_SHA512_CTX*,
                                         const unsigned char*);
 
 #define SHA512_256_Init   wolfSSL_SHA512_256_Init

+ 2 - 2
wolfssl/openssl/sha3.h

@@ -96,7 +96,7 @@ typedef struct WOLFSSL_SHA3_CTX WOLFSSL_SHA3_384_CTX;
 
 WOLFSSL_API int wolfSSL_SHA3_384_Init(WOLFSSL_SHA3_384_CTX*);
 WOLFSSL_API int wolfSSL_SHA3_384_Update(WOLFSSL_SHA3_384_CTX*, const void*,
-	                                 unsigned long);
+                                         unsigned long);
 WOLFSSL_API int wolfSSL_SHA3_384_Final(unsigned char*, WOLFSSL_SHA3_384_CTX*);
 
 enum {
@@ -119,7 +119,7 @@ typedef struct WOLFSSL_SHA3_CTX WOLFSSL_SHA3_512_CTX;
 
 WOLFSSL_API int wolfSSL_SHA3_512_Init(WOLFSSL_SHA3_512_CTX*);
 WOLFSSL_API int wolfSSL_SHA3_512_Update(WOLFSSL_SHA3_512_CTX*, const void*,
-	                                 unsigned long);
+                                         unsigned long);
 WOLFSSL_API int wolfSSL_SHA3_512_Final(unsigned char*, WOLFSSL_SHA3_512_CTX*);
 
 enum {

+ 1 - 1
wolfssl/openssl/ssl.h

@@ -1465,7 +1465,7 @@ wolfSSL_X509_STORE_set_verify_cb((WOLFSSL_X509_STORE *)(s), (WOLFSSL_X509_STORE_
 #define SSL_OP_SINGLE_ECDH_USE          WOLFSSL_OP_SINGLE_ECDH_USE
 #define SSL_OP_CIPHER_SERVER_PREFERENCE WOLFSSL_OP_CIPHER_SERVER_PREFERENCE
 
-#define OPENSSL_config	                wolfSSL_OPENSSL_config
+#define OPENSSL_config                  wolfSSL_OPENSSL_config
 #define OPENSSL_memdup                  wolfSSL_OPENSSL_memdup
 #define OPENSSL_cleanse                 wolfSSL_OPENSSL_cleanse
 #define SSL_CTX_get_timeout             wolfSSL_SSL_CTX_get_timeout

+ 14 - 14
wolfssl/sniffer.h

@@ -52,8 +52,8 @@ SSL_SNIFFER_API int ssl_SetPrivateKey(const char* address, int port,
 
 WOLFSSL_API
 SSL_SNIFFER_API int ssl_SetPrivateKeyBuffer(const char* address, int port,
-                                            const char* keyBuf, int keySz, 
-                                            int typeK, const char* password, 
+                                            const char* keyBuf, int keySz,
+                                            int typeK, const char* password,
                                             char* error);
 
 
@@ -66,31 +66,31 @@ SSL_SNIFFER_API int ssl_SetNamedPrivateKey(const char* name,
 WOLFSSL_API
 SSL_SNIFFER_API int ssl_SetNamedPrivateKeyBuffer(const char* name,
                                                  const char* address, int port,
-                                                 const char* keyBuf, int keySz, 
-                                                 int typeK, const char* password, 
+                                                 const char* keyBuf, int keySz,
+                                                 int typeK, const char* password,
                                                  char* error);
 
-WOLFSSL_API 
-SSL_SNIFFER_API int ssl_SetEphemeralKey(const char* address, int port, 
-                                        const char* keyFile, int typeKey, 
+WOLFSSL_API
+SSL_SNIFFER_API int ssl_SetEphemeralKey(const char* address, int port,
+                                        const char* keyFile, int typeKey,
                                         const char* password, char* error);
 
-WOLFSSL_API 
-SSL_SNIFFER_API int ssl_SetEphemeralKeyBuffer(const char* address, int port, 
-                                              const char* keyBuf, int keySz, int typeKey, 
+WOLFSSL_API
+SSL_SNIFFER_API int ssl_SetEphemeralKeyBuffer(const char* address, int port,
+                                              const char* keyBuf, int keySz, int typeKey,
                                               const char* password, char* error);
 
 
-WOLFSSL_API 
+WOLFSSL_API
 SSL_SNIFFER_API int ssl_SetNamedEphemeralKey(const char* name,
                                              const char* address, int port,
                                              const char* keyFile, int typeKey,
                                              const char* password, char* error);
 
-WOLFSSL_API 
+WOLFSSL_API
 SSL_SNIFFER_API int ssl_SetNamedEphemeralKeyBuffer(const char* name,
                                                    const char* address, int port,
-                                                   const char* keyBuf, int keySz, int typeKey, 
+                                                   const char* keyBuf, int keySz, int typeKey,
                                                    const char* password, char* error);
 
 WOLFSSL_API
@@ -206,7 +206,7 @@ typedef int (*SSLKeyCb)(void* vSniffer, int namedGroup,
     const unsigned char* cliPub, unsigned int cliPubSz,
     DerBuffer* privKey, void* cbCtx, char* error);
 
-WOLFSSL_API 
+WOLFSSL_API
 SSL_SNIFFER_API int ssl_SetKeyCallback(SSLKeyCb cb, void* cbCtx);
 #endif
 

+ 13 - 13
wolfssl/ssl.h

@@ -770,7 +770,7 @@ enum SNICbReturn {
 
 /* WS_RETURN_CODE macro
  * Some OpenSSL APIs specify "0" as the return value when an error occurs.
- * However, some corresponding wolfSSL APIs return negative values. Such
+ * However, some corresponding wolfSSL APIs return negative values. Such
  * functions should use this macro to fill this gap. Users who want them
  * to return the same return value as OpenSSL can define
  * WOLFSSL_ERR_CODE_OPENSSL.
@@ -1365,7 +1365,7 @@ WOLFSSL_API void wolfSSL_sk_GENERAL_NAME_pop_free(WOLFSSL_STACK* sk,
                                        void (*f) (WOLFSSL_GENERAL_NAME*));
 WOLFSSL_API void wolfSSL_sk_GENERAL_NAME_free(WOLFSSL_STACK* sk);
 WOLFSSL_API void wolfSSL_GENERAL_NAMES_free(WOLFSSL_GENERAL_NAMES* name);
-WOLFSSL_API int wolfSSL_GENERAL_NAME_print(WOLFSSL_BIO* out, 
+WOLFSSL_API int wolfSSL_GENERAL_NAME_print(WOLFSSL_BIO* out,
                                            WOLFSSL_GENERAL_NAME* name);
 
 WOLFSSL_API WOLFSSL_DIST_POINT* wolfSSL_DIST_POINT_new(void);
@@ -1431,7 +1431,7 @@ WOLFSSL_API int wolfSSL_SESSION_up_ref(WOLFSSL_SESSION* session);
 WOLFSSL_API WOLFSSL_SESSION* wolfSSL_SESSION_dup(WOLFSSL_SESSION* session);
 WOLFSSL_API WOLFSSL_SESSION* wolfSSL_SESSION_new(void);
 WOLFSSL_API void wolfSSL_SESSION_free(WOLFSSL_SESSION* session);
-WOLFSSL_API int wolfSSL_SESSION_set_cipher(WOLFSSL_SESSION* session, 
+WOLFSSL_API int wolfSSL_SESSION_set_cipher(WOLFSSL_SESSION* session,
                                         const WOLFSSL_CIPHER* cipher);
 WOLFSSL_API int  wolfSSL_is_init_finished(WOLFSSL*);
 
@@ -1624,7 +1624,7 @@ WOLFSSL_API void wolfSSL_X509_STORE_set_verify_cb(WOLFSSL_X509_STORE *st,
                                  WOLFSSL_X509_STORE_CTX_verify_cb verify_cb);
 WOLFSSL_API int wolfSSL_i2d_X509_NAME(WOLFSSL_X509_NAME* n,
                                                            unsigned char** out);
-WOLFSSL_API int wolfSSL_i2d_X509_NAME_canon(WOLFSSL_X509_NAME* name, 
+WOLFSSL_API int wolfSSL_i2d_X509_NAME_canon(WOLFSSL_X509_NAME* name,
                                                     unsigned char** out);
 WOLFSSL_API WOLFSSL_X509_NAME *wolfSSL_d2i_X509_NAME(WOLFSSL_X509_NAME **name,
                                               unsigned char **in, long length);
@@ -1715,7 +1715,7 @@ WOLFSSL_API unsigned char* wolfSSL_ASN1_STRING_data(WOLFSSL_ASN1_STRING*);
 WOLFSSL_API const unsigned char* wolfSSL_ASN1_STRING_get0_data(
                                             const WOLFSSL_ASN1_STRING*);
 WOLFSSL_API int wolfSSL_ASN1_STRING_length(WOLFSSL_ASN1_STRING*);
-WOLFSSL_API int wolfSSL_ASN1_STRING_copy(WOLFSSL_ASN1_STRING* dst, 
+WOLFSSL_API int wolfSSL_ASN1_STRING_copy(WOLFSSL_ASN1_STRING* dst,
                                                 const WOLFSSL_ASN1_STRING* src);
 WOLFSSL_API int         wolfSSL_X509_verify_cert(WOLFSSL_X509_STORE_CTX*);
 WOLFSSL_API const char* wolfSSL_X509_verify_cert_error_string(long);
@@ -1825,7 +1825,7 @@ WOLFSSL_API int wolfSSL_X509_VERIFY_PARAM_set1_ip(
        WOLFSSL_X509_VERIFY_PARAM* param, const unsigned char* ip, size_t iplen);
 WOLFSSL_API int wolfSSL_X509_VERIFY_PARAM_set1(WOLFSSL_X509_VERIFY_PARAM* to,
                                     const WOLFSSL_X509_VERIFY_PARAM* from);
-WOLFSSL_API int wolfSSL_X509_load_crl_file(WOLFSSL_X509_LOOKUP *ctx, 
+WOLFSSL_API int wolfSSL_X509_load_crl_file(WOLFSSL_X509_LOOKUP *ctx,
                                               const char *file, int type);
 WOLFSSL_API int wolfSSL_X509_load_cert_crl_file(WOLFSSL_X509_LOOKUP *ctx,
                                               const char *file, int type);
@@ -2359,10 +2359,10 @@ enum { /* ssl Constants */
     WOLFSSL_API void wolfSSL_set_psk_client_callback(WOLFSSL*,
                                                         wc_psk_client_callback);
     #ifdef OPENSSL_EXTRA
-    typedef int (*wc_psk_use_session_cb_func)(WOLFSSL* ssl, 
+    typedef int (*wc_psk_use_session_cb_func)(WOLFSSL* ssl,
                             const WOLFSSL_EVP_MD* md, const unsigned char **id,
                                         size_t* idlen,  WOLFSSL_SESSION **sess);
-    WOLFSSL_API void wolfSSL_set_psk_use_session_callback(WOLFSSL* ssl, 
+    WOLFSSL_API void wolfSSL_set_psk_use_session_callback(WOLFSSL* ssl,
                                                wc_psk_use_session_cb_func cb);
     #endif
 #ifdef WOLFSSL_TLS13
@@ -2636,7 +2636,7 @@ WOLFSSL_API WOLFSSL_X509*
 WOLFSSL_API int wolfSSL_i2d_X509(WOLFSSL_X509* x509, unsigned char** out);
 WOLFSSL_API WOLFSSL_X509_CRL *wolfSSL_d2i_X509_CRL(WOLFSSL_X509_CRL **crl,
                                                    const unsigned char *in, int len);
-WOLFSSL_API WOLFSSL_X509_CRL *wolfSSL_d2i_X509_CRL_bio(WOLFSSL_BIO *bp, 
+WOLFSSL_API WOLFSSL_X509_CRL *wolfSSL_d2i_X509_CRL_bio(WOLFSSL_BIO *bp,
                                                     WOLFSSL_X509_CRL **crl);
 #if !defined(NO_FILESYSTEM) && !defined(NO_STDIO_FILESYSTEM)
 WOLFSSL_API WOLFSSL_X509_CRL *wolfSSL_d2i_X509_CRL_fp(XFILE file, WOLFSSL_X509_CRL **crl);
@@ -3583,7 +3583,7 @@ enum {
      * algorithms have LEVEL2 and LEVEL4 because none of these submissions
      * included them. */
 
-    WOLFSSL_OQS_MIN               = 532, 
+    WOLFSSL_OQS_MIN               = 532,
     WOLFSSL_OQS_SIMPLE_MIN        = 532,
     WOLFSSL_NTRU_HPS_LEVEL1       = 532, /* NTRU_HPS2048509 */
     WOLFSSL_NTRU_HPS_LEVEL3       = 533, /* NTRU_HPS2048677 */
@@ -3859,7 +3859,7 @@ WOLFSSL_LOCAL int NIDToEccEnum(int n);
 #define WOLFSSL_OBJ_NAME_TYPE_NUM           0x05
 #define WOLFSSL_OBJ_NAME_ALIAS              0x8000
 
-WOLFSSL_API void wolfSSL_OBJ_NAME_do_all(int type, 
+WOLFSSL_API void wolfSSL_OBJ_NAME_do_all(int type,
                            void (*fn) (const WOLFSSL_OBJ_NAME* , void *arg),
                            void* arg);
 /* end of object functions */
@@ -4716,9 +4716,9 @@ WOLFSSL_API int wolfSSL_set_ephemeral_key(WOLFSSL* ssl, int keyAlgo,
     const char* key, unsigned int keySz, int format);
 
 /* returns pointer to loaded key as ASN.1/DER */
-WOLFSSL_API int wolfSSL_CTX_get_ephemeral_key(WOLFSSL_CTX* ctx, int keyAlgo, 
+WOLFSSL_API int wolfSSL_CTX_get_ephemeral_key(WOLFSSL_CTX* ctx, int keyAlgo,
     const unsigned char** key, unsigned int* keySz);
-WOLFSSL_API int wolfSSL_get_ephemeral_key(WOLFSSL* ssl, int keyAlgo, 
+WOLFSSL_API int wolfSSL_get_ephemeral_key(WOLFSSL* ssl, int keyAlgo,
     const unsigned char** key, unsigned int* keySz);
 #endif
 

+ 13 - 13
wolfssl/test.h

@@ -2255,7 +2255,7 @@ static WC_INLINE unsigned int my_psk_server_tls13_cb(WOLFSSL* ssl,
        !defined(NO_FILESYSTEM)
 static unsigned char local_psk[32];
 #endif
-static WC_INLINE int my_psk_use_session_cb(WOLFSSL* ssl, 
+static WC_INLINE int my_psk_use_session_cb(WOLFSSL* ssl,
             const WOLFSSL_EVP_MD* md, const unsigned char **id,
             size_t* idlen,  WOLFSSL_SESSION **sess)
 {
@@ -2271,9 +2271,9 @@ static WC_INLINE int my_psk_use_session_cb(WOLFSSL* ssl,
     int numCiphers = 0;
     (void)ssl;
     (void)md;
-    
+
     printf("use psk session callback \n");
-    
+
     lsess = wolfSSL_SESSION_new();
     if (lsess == NULL) {
         return 0;
@@ -2282,16 +2282,16 @@ static WC_INLINE int my_psk_use_session_cb(WOLFSSL* ssl,
     numCiphers = sk_num(supportedCiphers);
 
     for (i = 0; i < numCiphers; ++i) {
-        
+
         if ((cipher = (const WOLFSSL_CIPHER*)sk_value(supportedCiphers, i))) {
             SSL_CIPHER_description(cipher, buf, sizeof(buf));
         }
-        
+
         if (XMEMCMP(cipher_id, buf, XSTRLEN(cipher_id)) == 0) {
             break;
         }
     }
-    
+
     if (i != numCiphers) {
         SSL_SESSION_set_cipher(lsess, cipher);
             for (i = 0; i < 32; i++, b += 0x22) {
@@ -2299,11 +2299,11 @@ static WC_INLINE int my_psk_use_session_cb(WOLFSSL* ssl,
                 b = 0x01;
             local_psk[i] = b;
         }
-        
+
         *id = local_psk;
         *idlen = 32;
         *sess = lsess;
-        
+
         return 1;
     }
     else {
@@ -2318,7 +2318,7 @@ static WC_INLINE int my_psk_use_session_cb(WOLFSSL* ssl,
     (void)id;
     (void)idlen;
     (void)sess;
-    
+
     return 0;
 #endif
 }
@@ -2706,7 +2706,7 @@ static WC_INLINE int myVerify(int preverify, WOLFSSL_X509_STORE_CTX* store)
         return 0; /* test failure case */
     }
 
-    if (myVerifyAction == VERIFY_OVERRIDE_DATE_ERR && 
+    if (myVerifyAction == VERIFY_OVERRIDE_DATE_ERR &&
         (store->error == ASN_BEFORE_DATE_E || store->error == ASN_AFTER_DATE_E)) {
         printf("Overriding cert date error as example for bad clock testing\n");
         return 1;
@@ -4901,7 +4901,7 @@ static WC_INLINE const char* mymktemp(char *tempfn, int len, int num)
             }
             wc_AesFree(&aes);
         #endif
-            
+
             if (ret != 0) return WOLFSSL_TICKET_RET_REJECT;
             *outLen = inLen;  /* no padding in this mode */
         }
@@ -4975,9 +4975,9 @@ static WC_INLINE void EarlyDataStatus(WOLFSSL* ssl)
     earlyData_status = wolfSSL_get_early_data_status(ssl);
 #endif
     if (earlyData_status < 0) return;
-    
+
     printf("Early Data was ");
-    
+
     switch(earlyData_status) {
         case WOLFSSL_EARLY_DATA_NOT_SENT:
                 printf("not sent.\n");

+ 2 - 2
wolfssl/wolfcrypt/arc4.h

@@ -37,9 +37,9 @@
 #endif
 
 enum {
-	ARC4_ENC_TYPE   = 4,    /* cipher unique type */
+    ARC4_ENC_TYPE   = 4,    /* cipher unique type */
     ARC4_STATE_SIZE = 256,
-    RC4_KEY_SIZE    = 16,   /* always 128bit           */
+    RC4_KEY_SIZE    = 16,   /* always 128bit */
 };
 
 /* ARC4 encryption and decryption */

+ 3 - 3
wolfssl/wolfcrypt/chacha.h

@@ -71,7 +71,7 @@ Block counter is located at index 12.
 #endif
 
 enum {
-	CHACHA_ENC_TYPE = WC_CIPHER_CHACHA,    /* cipher unique type */
+    CHACHA_ENC_TYPE = WC_CIPHER_CHACHA,    /* cipher unique type */
     CHACHA_MAX_KEY_SZ = 32,
 };
 
@@ -102,8 +102,8 @@ WOLFSSL_API int wc_Chacha_SetKey(ChaCha* ctx, const byte* key, word32 keySz);
 
 #ifdef HAVE_XCHACHA
 WOLFSSL_API int wc_XChacha_SetKey(ChaCha *ctx, const byte *key, word32 keySz,
-				  const byte *nonce, word32 nonceSz,
-				  word32 counter);
+                                  const byte *nonce, word32 nonceSz,
+                                  word32 counter);
 #endif
 
 #ifdef __cplusplus

+ 6 - 6
wolfssl/wolfcrypt/ecc.h

@@ -329,12 +329,12 @@ typedef struct ecc_set_type {
  * mp_ints for the components of the point. With ALT_ECC_SIZE, the components
  * of the point are pointers that are set to each of a three item array of
  * alt_fp_ints. While an mp_int will have 4096 bits of digit inside the
- * structure, the alt_fp_int will only have 512 bits for ECC 256-bit and 
- * 1056-bits for ECC 521-bit. A size value was added in the ALT case, as well, 
- * and is set by mp_init() and alt_fp_init(). The functions fp_zero() and 
- * fp_copy() use the size parameter. An int needs to be initialized before 
- * using it instead of just fp_zeroing it, the init will call zero. The 
- * FP_MAX_BITS_ECC defaults to calculating based on MAX_ECC_BITS, but 
+ * structure, the alt_fp_int will only have 512 bits for ECC 256-bit and
+ * 1056-bits for ECC 521-bit. A size value was added in the ALT case, as well,
+ * and is set by mp_init() and alt_fp_init(). The functions fp_zero() and
+ * fp_copy() use the size parameter. An int needs to be initialized before
+ * using it instead of just fp_zeroing it, the init will call zero. The
+ * FP_MAX_BITS_ECC defaults to calculating based on MAX_ECC_BITS, but
  * can be set to change the number of bits used in the alternate FP_INT.
  *
  * The ALT_ECC_SIZE option only applies to stack based fast math USE_FAST_MATH.

+ 1 - 1
wolfssl/wolfcrypt/error-crypt.h

@@ -35,7 +35,7 @@ the error status.
 
 #if defined(HAVE_FIPS) && \
     (!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2))
-	#include <cyassl/ctaocrypt/error-crypt.h>
+    #include <cyassl/ctaocrypt/error-crypt.h>
 #endif /* HAVE_FIPS V1 */
 
 #ifdef __cplusplus

+ 3 - 3
wolfssl/wolfcrypt/fe_operations.h

@@ -164,7 +164,7 @@ WOLFSSL_LOCAL void fe_inv__distinct(byte *r, const byte *x);
  * undefined behavior.
  */
 WOLFSSL_LOCAL void fe_select(byte *dst, const byte *zero, const byte *one,
-		   byte condition);
+                   byte condition);
 
 /* Multiply a point by a small constant. The two pointers are not
  * required to be distinct.
@@ -188,11 +188,11 @@ WOLFSSL_LOCAL void fe_sqrt(byte *r, const byte *x);
  * undefined behavior.
  */
 WOLFSSL_LOCAL void fprime_select(byte *dst, const byte *zero, const byte *one,
-		                         byte condition);
+                                         byte condition);
 WOLFSSL_LOCAL void fprime_add(byte *r, const byte *a, const byte *modulus);
 WOLFSSL_LOCAL void fprime_sub(byte *r, const byte *a, const byte *modulus);
 WOLFSSL_LOCAL void fprime_mul(byte *r, const byte *a, const byte *b,
-		                      const byte *modulus);
+                                      const byte *modulus);
 WOLFSSL_LOCAL void fprime_copy(byte *x, const byte *a);
 
 #endif /* CURVE25519_SMALL || ED25519_SMALL */

+ 1 - 1
wolfssl/wolfcrypt/hc128.h

@@ -36,7 +36,7 @@
 #endif
 
 enum {
-	HC128_ENC_TYPE =  WC_CIPHER_HC128,     /* cipher unique type */
+    HC128_ENC_TYPE =  WC_CIPHER_HC128,     /* cipher unique type */
 };
 
 /* HC-128 stream cipher */

+ 3 - 3
wolfssl/wolfcrypt/hmac.h

@@ -31,7 +31,7 @@
 #include <wolfssl/wolfcrypt/hash.h>
 
 #if defined(HAVE_FIPS) && \
-	(!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2))
+        (!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2))
 /* for fips @wc_fips */
     #include <cyassl/ctaocrypt/hmac.h>
     #define WC_HMAC_BLOCK_SIZE HMAC_BLOCK_SIZE
@@ -39,8 +39,8 @@
 
 
 #if defined(HAVE_FIPS) && \
-	defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)
-	#include <wolfssl/wolfcrypt/fips.h>
+        defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)
+    #include <wolfssl/wolfcrypt/fips.h>
 #endif
 
 #ifdef __cplusplus

+ 10 - 10
wolfssl/wolfcrypt/mem_track.h

@@ -131,15 +131,15 @@
     /* if defined to not using inline then declare function prototypes */
     #ifdef NO_INLINE
         #define WC_STATIC
-		#ifdef WOLFSSL_DEBUG_MEMORY
-			WOLFSSL_LOCAL void* TrackMalloc(size_t sz, const char* func, unsigned int line);
-			WOLFSSL_LOCAL void TrackFree(void* ptr, const char* func, unsigned int line);
-			WOLFSSL_LOCAL void* TrackRealloc(void* ptr, size_t sz, const char* func, unsigned int line);
-		#else
-			WOLFSSL_LOCAL void* TrackMalloc(size_t sz);
-			WOLFSSL_LOCAL void TrackFree(void* ptr);
-			WOLFSSL_LOCAL void* TrackRealloc(void* ptr, size_t sz);
-		#endif
+        #ifdef WOLFSSL_DEBUG_MEMORY
+             WOLFSSL_LOCAL void* TrackMalloc(size_t sz, const char* func, unsigned int line);
+             WOLFSSL_LOCAL void TrackFree(void* ptr, const char* func, unsigned int line);
+             WOLFSSL_LOCAL void* TrackRealloc(void* ptr, size_t sz, const char* func, unsigned int line);
+        #else
+             WOLFSSL_LOCAL void* TrackMalloc(size_t sz);
+             WOLFSSL_LOCAL void TrackFree(void* ptr);
+             WOLFSSL_LOCAL void* TrackRealloc(void* ptr, size_t sz);
+        #endif
         WOLFSSL_LOCAL int InitMemoryTracker(void);
         WOLFSSL_LOCAL void ShowMemoryTracker(void);
     #else
@@ -238,7 +238,7 @@
         sz = header->thisSize;
 
     #ifdef DO_MEM_LIST
-        if (pthread_mutex_lock(&memLock) == 0) 
+        if (pthread_mutex_lock(&memLock) == 0)
         {
     #endif
 

+ 1 - 1
wolfssl/wolfcrypt/pkcs11.h

@@ -368,7 +368,7 @@ struct CK_FUNCTION_LIST {
                                 CK_MECHANISM_INFO_PTR pInfo);
     CK_RV (*C_InitToken)(CK_SLOT_ID slotID, CK_UTF8CHAR_PTR pPin,
                          CK_ULONG ulPinLen, CK_UTF8CHAR_PTR pLabel);
-    CK_RV (*C_InitPIN)(CK_SESSION_HANDLE hSession, CK_UTF8CHAR_PTR pPin, 
+    CK_RV (*C_InitPIN)(CK_SESSION_HANDLE hSession, CK_UTF8CHAR_PTR pPin,
                        CK_ULONG ulPinLen);
     CK_RV (*C_SetPIN)(CK_SESSION_HANDLE hSession, CK_UTF8CHAR_PTR pOldPin,
                       CK_ULONG ulOldLen, CK_UTF8CHAR_PTR pNewPin,

+ 2 - 2
wolfssl/wolfcrypt/poly1305.h

@@ -84,8 +84,8 @@ typedef struct Poly1305 {
 #else
 #if defined(WOLFSSL_ARMASM) && defined(__aarch64__)
     ALIGN128 word32 r[5];
-    ALIGN128 word32 r_2[5]; // r^2
-    ALIGN128 word32 r_4[5]; // r^4
+    ALIGN128 word32 r_2[5]; /* r^2 */
+    ALIGN128 word32 r_4[5]; /* r^4 */
     ALIGN128 word32 h[5];
     word32 pad[4];
     word64 leftover;

+ 2 - 2
wolfssl/wolfcrypt/pwdbased.h

@@ -40,8 +40,8 @@
  * wolfssl/wolfcrypt/asn.h line 173 in enum Oid_Types
  */
 WOLFSSL_API int wc_PBKDF1_ex(byte* key, int keyLen, byte* iv, int ivLen,
-                      const byte* passwd, int passwdLen, 
-                      const byte* salt, int saltLen, int iterations, 
+                      const byte* passwd, int passwdLen,
+                      const byte* salt, int saltLen, int iterations,
                       int hashType, void* heap);
 WOLFSSL_API int wc_PBKDF1(byte* output, const byte* passwd, int pLen,
                       const byte* salt, int sLen, int iterations, int kLen,

+ 1 - 1
wolfssl/wolfcrypt/rabbit.h

@@ -37,7 +37,7 @@
 
 
 enum {
-	RABBIT_ENC_TYPE  = 5     /* cipher unique type */
+    RABBIT_ENC_TYPE  = 5     /* cipher unique type */
 };
 
 

+ 3 - 3
wolfssl/wolfcrypt/rsa.h

@@ -64,7 +64,7 @@ RSA keys can be used to encrypt, decrypt, sign and verify data.
 #else
 
 #if defined(HAVE_FIPS) && \
-	(!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2))
+        (!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2))
 /* for fips @wc_fips */
 #include <cyassl/ctaocrypt/rsa.h>
 #if defined(CYASSL_KEY_GEN) && !defined(WOLFSSL_KEY_GEN)
@@ -75,7 +75,7 @@ RSA keys can be used to encrypt, decrypt, sign and verify data.
     #include <wolfssl/wolfcrypt/random.h>
 #endif /* HAVE_FIPS && HAVE_FIPS_VERION 1 */
 #if defined(HAVE_FIPS) && \
-	defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)
+        defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)
 #include <wolfssl/wolfcrypt/fips.h>
 #endif
 
@@ -300,7 +300,7 @@ WOLFSSL_API int  wc_RsaPSS_VerifyCheck(byte* in, word32 inLen,
 WOLFSSL_API int  wc_RsaEncryptSize(const RsaKey* key);
 
 #if !defined(HAVE_FIPS) || \
-	(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2))
+        (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2))
 /* to avoid asn duplicate symbols @wc_fips */
 WOLFSSL_API int  wc_RsaPrivateKeyDecode(const byte* input, word32* inOutIdx,
                                                                RsaKey*, word32);

+ 7 - 7
wolfssl/wolfcrypt/settings.h

@@ -1044,7 +1044,7 @@ extern void uITRON4_free(void *p) ;
         #define XFREE(p, h, type)    vPortFree((p))
     #endif
 
-    //#define USER_TICKS
+    /* #define USER_TICKS */
     /* Allows use of DH with fixed points if uncommented and NO_DH is removed */
     /* WOLFSSL_DH_CONST */
     #define WOLFSSL_LWIP
@@ -1370,8 +1370,8 @@ extern void uITRON4_free(void *p) ;
             #include "stm32f1xx.h"
         #endif
     #endif /* WOLFSSL_STM32_CUBEMX */
-#endif /* WOLFSSL_STM32F2 || WOLFSSL_STM32F4 || WOLFSSL_STM32L4 || 
-          WOLFSSL_STM32L5 || WOLFSSL_STM32F7 || WOLFSSL_STMWB || 
+#endif /* WOLFSSL_STM32F2 || WOLFSSL_STM32F4 || WOLFSSL_STM32L4 ||
+          WOLFSSL_STM32L5 || WOLFSSL_STM32F7 || WOLFSSL_STMWB ||
           WOLFSSL_STM32H7 || WOLFSSL_STM32G0 */
 #ifdef WOLFSSL_DEOS
     #include <deos.h>
@@ -1692,7 +1692,7 @@ extern void uITRON4_free(void *p) ;
     #undef HAVE_AES_ECB
     #define HAVE_AES_ECB
 
-    //@TODO used for now until plugging in caam aes use with qnx
+    /* @TODO used for now until plugging in caam aes use with qnx */
     #undef WOLFSSL_AES_DIRECT
     #define WOLFSSL_AES_DIRECT
 #endif
@@ -2541,15 +2541,15 @@ extern void uITRON4_free(void *p) ;
     #endif
 
     /* Note: "--enable-renegotiation-indication" ("HAVE_RENEGOTIATION_INDICATION")
-     * only sends the secure renegotiation extension, but is not actually supported. 
-     * This was added because some TLS peers required it even if not used, so we call 
+     * only sends the secure renegotiation extension, but is not actually supported.
+     * This was added because some TLS peers required it even if not used, so we call
      * this "(FAKE Secure Renegotiation)"
      */
 #endif
 
 /* Crypto callbacks should enable hash flag support */
 #if defined(WOLF_CRYPTO_CB) && !defined(WOLFSSL_HASH_FLAGS)
-    /* FIPS v1 and v2 do not support hash flags, so do not allow it with 
+    /* FIPS v1 and v2 do not support hash flags, so do not allow it with
      * crypto callbacks */
     #if !defined(HAVE_FIPS) || (defined(HAVE_FIPS) && \
             defined(HAVE_FIPS_VERSION) && HAVE_FIPS_VERSION >= 3)

+ 2 - 2
wolfssl/wolfcrypt/sha.h

@@ -37,7 +37,7 @@
 #endif /* HAVE_FIPS_VERSION >= 2 */
 
 #if defined(HAVE_FIPS) && \
-	(!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2))
+        (!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2))
 #define wc_Sha             Sha
 #define WC_SHA             SHA
 #define WC_SHA_BLOCK_SIZE  SHA_BLOCK_SIZE
@@ -53,7 +53,7 @@
 #endif
 
 #ifdef WOLFSSL_IMXRT_DCP
-	#include "fsl_dcp.h"
+    #include "fsl_dcp.h"
 #endif
 
 #ifdef __cplusplus

+ 2 - 2
wolfssl/wolfcrypt/sha256.h

@@ -38,7 +38,7 @@
 #endif /* HAVE_FIPS_VERSION >= 2 */
 
 #if defined(HAVE_FIPS) && \
-	(!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2))
+        (!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2))
     #define wc_Sha256             Sha256
     #define WC_SHA256             SHA256
     #define WC_SHA256_BLOCK_SIZE  SHA256_BLOCK_SIZE
@@ -62,7 +62,7 @@
 #endif
 
 #ifdef WOLFSSL_IMXRT_DCP
-	#include "fsl_dcp.h"
+    #include "fsl_dcp.h"
 #endif
 
 #if defined(WOLFSSL_PSOC6_CRYPTO)

+ 4 - 4
wolfssl/wolfcrypt/sha512.h

@@ -38,7 +38,7 @@
 #endif /* HAVE_FIPS_VERSION >= 2 */
 
 #if defined(HAVE_FIPS) && \
-	(!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2))
+        (!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2))
     #ifdef WOLFSSL_SHA512
         #define wc_Sha512             Sha512
         #define WC_SHA512             SHA512
@@ -60,7 +60,7 @@
     #if defined(WOLFSSL_SHA384)
         #define CYASSL_SHA384
     #endif
-	/* for fips @wc_fips */
+    /* for fips @wc_fips */
     #include <cyassl/ctaocrypt/sha512.h>
 #endif
 
@@ -239,7 +239,7 @@ WOLFSSL_API int wc_Sha512_224Copy(wc_Sha512* src, wc_Sha512* dst);
 #endif
 
 #if defined(OPENSSL_EXTRA)
-WOLFSSL_API int wc_Sha512_224Transform(wc_Sha512* sha, 
+WOLFSSL_API int wc_Sha512_224Transform(wc_Sha512* sha,
                                                 const unsigned char* data);
 #endif
 #endif /* !WOLFSSL_NOSHA512_224 */
@@ -259,7 +259,7 @@ WOLFSSL_API int wc_Sha512_256Copy(wc_Sha512* src, wc_Sha512* dst);
 #endif
 
 #if defined(OPENSSL_EXTRA)
-WOLFSSL_API int wc_Sha512_256Transform(wc_Sha512* sha, 
+WOLFSSL_API int wc_Sha512_256Transform(wc_Sha512* sha,
                                                 const unsigned char* data);
 #endif
 #endif /* !WOLFSSL_NOSHA512_256 */

+ 1 - 1
wolfssl/wolfcrypt/tfm.h

@@ -302,7 +302,7 @@
 #define FP_OKAY      0
 #define FP_VAL      -1
 #define FP_MEM      -2
-#define FP_NOT_INF	-3
+#define FP_NOT_INF  -3
 #define FP_WOULDBLOCK -4
 
 /* equalities */

+ 1 - 1
wolfssl/wolfcrypt/visibility.h

@@ -33,7 +33,7 @@
     (!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2))
     #include <cyassl/ctaocrypt/visibility.h>
     #define WOLFSSL_API   CYASSL_API
-	#define WOLFSSL_LOCAL CYASSL_LOCAL
+    #define WOLFSSL_LOCAL CYASSL_LOCAL
 #else
 
 /* WOLFSSL_API is used for the public API symbols.

+ 2 - 2
wolfssl/wolfcrypt/wc_encrypt.h

@@ -64,7 +64,7 @@
      (HAVE_FIPS_VERSION <= 2)) || (defined(HAVE_SELFTEST) && \
      (!defined(HAVE_SELFTEST_VERSION) || (HAVE_SELFTEST_VERSION < 2)))
     /* In FIPS cert 3389 and CAVP selftest v1 build, these enums are
-     * not in aes.h. Define them here outside the fips boundary. 
+     * not in aes.h. Define them here outside the fips boundary.
      */
     #ifndef GCM_NONCE_MID_SZ
         /* The usual default nonce size for AES-GCM. */
@@ -113,7 +113,7 @@ WOLFSSL_API int wc_Des3_CbcDecryptWithKey(byte* out,
 #endif /* WOLFSSL_ENCRYPTED_KEYS */
 
 #ifndef NO_PWDBASED
-    WOLFSSL_LOCAL int wc_CryptKey(const char* password, int passwordSz, 
+    WOLFSSL_LOCAL int wc_CryptKey(const char* password, int passwordSz,
         byte* salt, int saltSz, int iterations, int id, byte* input, int length,
         int version, byte* cbcIv, int enc, int shaOid);
 #endif

+ 6 - 4
wolfssl/wolfcrypt/wc_port.h

@@ -541,7 +541,9 @@
     /* remove this multifariously conflicting macro, picked up from
      * Linux arch/<arch>/include/asm/current.h.
      */
-    #undef current
+    #ifndef WOLFSSL_NEED_LINUX_CURRENT
+        #undef current
+    #endif
 
     /* prevent gcc's mm_malloc.h from being included, since it unconditionally
      * includes stdlib.h, which is kernel-incompatible.
@@ -741,7 +743,7 @@
     #elif defined(FREERTOS_TCP)
         #include "FreeRTOS.h"
         #include "semphr.h"
-		typedef SemaphoreHandle_t  wolfSSL_Mutex;
+        typedef SemaphoreHandle_t  wolfSSL_Mutex;
     #elif defined (RTTHREAD)
         #include "rtthread.h"
         typedef rt_mutex_t wolfSSL_Mutex;
@@ -1053,7 +1055,7 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
     #define opendir   FCL_OPENDIR
     #define closedir  FCL_CLOSEDIR
     #define readdir   FCL_READDIR
-    #define dirent    fclDirent 
+    #define dirent    fclDirent
     #define strncasecmp FCL_STRNCASECMP
 
     /* FUSION SPECIFIC ERROR CODE */
@@ -1130,7 +1132,7 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
         #define MAX_PATH 256
     #endif
 
-    WOLFSSL_LOCAL int wc_FileLoad(const char* fname, unsigned char** buf, 
+    WOLFSSL_LOCAL int wc_FileLoad(const char* fname, unsigned char** buf,
         size_t* bufLen, void* heap);
 
 #if !defined(NO_WOLFSSL_DIR) && !defined(WOLFSSL_NUCLEUS) && \

Some files were not shown because too many files changed in this diff