Browse Source

remove trailing spaces

Francois Perrad 9 years ago
parent
commit
58353f51e2
100 changed files with 1111 additions and 1111 deletions
  1. 1 1
      src/encauth/ccm/ccm_test.c
  2. 5 5
      src/encauth/eax/eax_addheader.c
  3. 4 4
      src/encauth/eax/eax_decrypt.c
  4. 2 2
      src/encauth/eax/eax_decrypt_verify_memory.c
  5. 2 2
      src/encauth/eax/eax_done.c
  6. 3 3
      src/encauth/eax/eax_encrypt.c
  7. 5 5
      src/encauth/eax/eax_encrypt_authenticate_memory.c
  8. 16 16
      src/encauth/eax/eax_init.c
  9. 13 13
      src/encauth/eax/eax_test.c
  10. 1 1
      src/encauth/gcm/gcm_done.c
  11. 9 9
      src/encauth/gcm/gcm_gf_mult.c
  12. 1 1
      src/encauth/gcm/gcm_init.c
  13. 4 4
      src/encauth/gcm/gcm_memory.c
  14. 1 1
      src/encauth/gcm/gcm_reset.c
  15. 98 98
      src/encauth/gcm/gcm_test.c
  16. 2 2
      src/encauth/ocb/ocb_decrypt.c
  17. 6 6
      src/encauth/ocb/ocb_decrypt_verify_memory.c
  18. 3 3
      src/encauth/ocb/ocb_done_decrypt.c
  19. 2 2
      src/encauth/ocb/ocb_done_encrypt.c
  20. 1 1
      src/encauth/ocb/ocb_encrypt.c
  21. 2 2
      src/encauth/ocb/ocb_encrypt_authenticate_memory.c
  22. 6 6
      src/encauth/ocb/ocb_init.c
  23. 2 2
      src/encauth/ocb/ocb_shift_xor.c
  24. 13 13
      src/encauth/ocb/ocb_test.c
  25. 8 8
      src/encauth/ocb/s_ocb_done.c
  26. 2 2
      src/hashes/helper/hash_file.c
  27. 3 3
      src/hashes/helper/hash_filehandle.c
  28. 9 9
      src/hashes/md2.c
  29. 68 68
      src/hashes/md4.c
  30. 15 15
      src/hashes/md5.c
  31. 11 11
      src/hashes/rmd128.c
  32. 9 9
      src/hashes/rmd160.c
  33. 9 9
      src/hashes/sha1.c
  34. 15 15
      src/hashes/sha2/sha256.c
  35. 26 26
      src/hashes/sha2/sha512.c
  36. 34 34
      src/hashes/tiger.c
  37. 1 1
      src/mac/f9/f9_done.c
  38. 2 2
      src/mac/f9/f9_file.c
  39. 2 2
      src/mac/f9/f9_init.c
  40. 2 2
      src/mac/f9/f9_memory.c
  41. 5 5
      src/mac/f9/f9_memory_multi.c
  42. 2 2
      src/mac/f9/f9_test.c
  43. 5 5
      src/mac/pelican/pelican_memory.c
  44. 9 9
      src/mac/pelican/pelican_test.c
  45. 2 2
      src/mac/pmac/pmac_done.c
  46. 5 5
      src/mac/pmac/pmac_file.c
  47. 5 5
      src/mac/pmac/pmac_memory.c
  48. 6 6
      src/mac/pmac/pmac_memory_multi.c
  49. 2 2
      src/mac/pmac/pmac_ntz.c
  50. 2 2
      src/mac/pmac/pmac_shift_xor.c
  51. 7 7
      src/mac/pmac/pmac_test.c
  52. 1 1
      src/mac/xcbc/xcbc_done.c
  53. 3 3
      src/mac/xcbc/xcbc_file.c
  54. 4 4
      src/mac/xcbc/xcbc_init.c
  55. 2 2
      src/mac/xcbc/xcbc_memory.c
  56. 5 5
      src/mac/xcbc/xcbc_memory_multi.c
  57. 16 16
      src/mac/xcbc/xcbc_test.c
  58. 515 515
      src/math/fp/ltc_ecc_fp_mulmod.c
  59. 6 6
      src/math/rand_prime.c
  60. 1 1
      src/misc/crypt/crypt_find_cipher_any.c
  61. 1 1
      src/misc/crypt/crypt_find_hash_any.c
  62. 3 3
      src/misc/crypt/crypt_fsa.c
  63. 1 1
      src/misc/crypt/crypt_hash_descriptor.c
  64. 1 1
      src/misc/crypt/crypt_hash_is_valid.c
  65. 1 1
      src/misc/crypt/crypt_prng_descriptor.c
  66. 1 1
      src/misc/crypt/crypt_register_prng.c
  67. 1 1
      src/misc/error_to_string.c
  68. 1 1
      src/modes/cbc/cbc_done.c
  69. 1 1
      src/modes/cbc/cbc_setiv.c
  70. 3 3
      src/modes/cbc/cbc_start.c
  71. 1 1
      src/modes/cfb/cfb_decrypt.c
  72. 1 1
      src/modes/cfb/cfb_done.c
  73. 1 1
      src/modes/cfb/cfb_encrypt.c
  74. 5 5
      src/modes/cfb/cfb_setiv.c
  75. 3 3
      src/modes/cfb/cfb_start.c
  76. 1 1
      src/modes/ctr/ctr_done.c
  77. 5 5
      src/modes/ctr/ctr_setiv.c
  78. 5 5
      src/modes/ctr/ctr_start.c
  79. 1 1
      src/modes/ctr/ctr_test.c
  80. 1 1
      src/modes/ecb/ecb_done.c
  81. 1 1
      src/modes/ecb/ecb_start.c
  82. 1 1
      src/modes/f8/f8_decrypt.c
  83. 1 1
      src/modes/f8/f8_done.c
  84. 1 1
      src/modes/f8/f8_setiv.c
  85. 9 9
      src/modes/f8/f8_start.c
  86. 14 14
      src/modes/f8/f8_test_mode.c
  87. 2 2
      src/modes/lrw/lrw_done.c
  88. 1 1
      src/modes/lrw/lrw_encrypt.c
  89. 3 3
      src/modes/lrw/lrw_start.c
  90. 1 1
      src/modes/lrw/lrw_test.c
  91. 1 1
      src/modes/ofb/ofb_decrypt.c
  92. 1 1
      src/modes/ofb/ofb_done.c
  93. 2 2
      src/modes/ofb/ofb_encrypt.c
  94. 1 1
      src/modes/ofb/ofb_setiv.c
  95. 2 2
      src/modes/ofb/ofb_start.c
  96. 1 1
      src/pk/asn1/der/bit/der_decode_bit_string.c
  97. 2 2
      src/pk/asn1/der/bit/der_length_bit_string.c
  98. 3 3
      src/pk/asn1/der/boolean/der_decode_boolean.c
  99. 4 4
      src/pk/asn1/der/boolean/der_encode_boolean.c
  100. 1 1
      src/pk/asn1/der/boolean/der_length_boolean.c

+ 1 - 1
src/encauth/ccm/ccm_test.c

@@ -118,7 +118,7 @@ int ccm_test(void)
   int           err, idx;
   int           err, idx;
   symmetric_key skey;
   symmetric_key skey;
   ccm_state ccm;
   ccm_state ccm;
-  
+
   zeromem(zero, 64);
   zeromem(zero, 64);
 
 
   idx = find_cipher("aes");
   idx = find_cipher("aes");

+ 5 - 5
src/encauth/eax/eax_addheader.c

@@ -8,22 +8,22 @@
  *
  *
  * Tom St Denis, [email protected], http://libtom.org
  * Tom St Denis, [email protected], http://libtom.org
  */
  */
-/** 
+/**
     @file eax_addheader.c
     @file eax_addheader.c
-    EAX implementation, add meta-data, by Tom St Denis 
+    EAX implementation, add meta-data, by Tom St Denis
 */
 */
 #include "tomcrypt.h"
 #include "tomcrypt.h"
 
 
 #ifdef LTC_EAX_MODE
 #ifdef LTC_EAX_MODE
 
 
-/** 
-    add header (metadata) to the stream 
+/**
+    add header (metadata) to the stream
     @param eax    The current EAX state
     @param eax    The current EAX state
     @param header The header (meta-data) data you wish to add to the state
     @param header The header (meta-data) data you wish to add to the state
     @param length The length of the header data
     @param length The length of the header data
     @return CRYPT_OK if successful
     @return CRYPT_OK if successful
 */
 */
-int eax_addheader(eax_state *eax, const unsigned char *header, 
+int eax_addheader(eax_state *eax, const unsigned char *header,
                   unsigned long length)
                   unsigned long length)
 {
 {
    LTC_ARGCHK(eax    != NULL);
    LTC_ARGCHK(eax    != NULL);

+ 4 - 4
src/encauth/eax/eax_decrypt.c

@@ -9,7 +9,7 @@
  * Tom St Denis, [email protected], http://libtom.org
  * Tom St Denis, [email protected], http://libtom.org
  */
  */
 
 
-/** 
+/**
     @file eax_decrypt.c
     @file eax_decrypt.c
     EAX implementation, decrypt block, by Tom St Denis
     EAX implementation, decrypt block, by Tom St Denis
 */
 */
@@ -17,7 +17,7 @@
 
 
 #ifdef LTC_EAX_MODE
 #ifdef LTC_EAX_MODE
 
 
-/**  
+/**
    Decrypt data with the EAX protocol
    Decrypt data with the EAX protocol
    @param eax     The EAX state
    @param eax     The EAX state
    @param ct      The ciphertext
    @param ct      The ciphertext
@@ -25,11 +25,11 @@
    @param length  The length (octets) of the ciphertext
    @param length  The length (octets) of the ciphertext
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-int eax_decrypt(eax_state *eax, const unsigned char *ct, unsigned char *pt, 
+int eax_decrypt(eax_state *eax, const unsigned char *ct, unsigned char *pt,
                 unsigned long length)
                 unsigned long length)
 {
 {
    int err;
    int err;
-   
+
    LTC_ARGCHK(eax != NULL);
    LTC_ARGCHK(eax != NULL);
    LTC_ARGCHK(pt  != NULL);
    LTC_ARGCHK(pt  != NULL);
    LTC_ARGCHK(ct  != NULL);
    LTC_ARGCHK(ct  != NULL);

+ 2 - 2
src/encauth/eax/eax_decrypt_verify_memory.c

@@ -77,7 +77,7 @@ int eax_decrypt_verify_memory(int cipher,
    if ((err = eax_decrypt(eax, ct, pt, ctlen)) != CRYPT_OK) {
    if ((err = eax_decrypt(eax, ct, pt, ctlen)) != CRYPT_OK) {
       goto LBL_ERR;
       goto LBL_ERR;
    }
    }
- 
+
    buflen = taglen;
    buflen = taglen;
    if ((err = eax_done(eax, buf, &buflen)) != CRYPT_OK) {
    if ((err = eax_done(eax, buf, &buflen)) != CRYPT_OK) {
       goto LBL_ERR;
       goto LBL_ERR;
@@ -87,7 +87,7 @@ int eax_decrypt_verify_memory(int cipher,
    if (buflen >= taglen && XMEMCMP(buf, tag, taglen) == 0) {
    if (buflen >= taglen && XMEMCMP(buf, tag, taglen) == 0) {
       *stat = 1;
       *stat = 1;
    }
    }
-   
+
    err = CRYPT_OK;
    err = CRYPT_OK;
 LBL_ERR:
 LBL_ERR:
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK

+ 2 - 2
src/encauth/eax/eax_done.c

@@ -51,7 +51,7 @@ int eax_done(eax_state *eax, unsigned char *tag, unsigned long *taglen)
    /* finish ctomac */
    /* finish ctomac */
    len = MAXBLOCKSIZE;
    len = MAXBLOCKSIZE;
    if ((err = omac_done(&eax->ctomac, ctmac, &len)) != CRYPT_OK) {
    if ((err = omac_done(&eax->ctomac, ctmac, &len)) != CRYPT_OK) {
-      goto LBL_ERR; 
+      goto LBL_ERR;
    }
    }
 
 
    /* finish headeromac */
    /* finish headeromac */
@@ -59,7 +59,7 @@ int eax_done(eax_state *eax, unsigned char *tag, unsigned long *taglen)
    /* note we specifically don't reset len so the two lens are minimal */
    /* note we specifically don't reset len so the two lens are minimal */
 
 
    if ((err = omac_done(&eax->headeromac, headermac, &len)) != CRYPT_OK) {
    if ((err = omac_done(&eax->headeromac, headermac, &len)) != CRYPT_OK) {
-      goto LBL_ERR; 
+      goto LBL_ERR;
    }
    }
 
 
    /* terminate the CTR chain */
    /* terminate the CTR chain */

+ 3 - 3
src/encauth/eax/eax_encrypt.c

@@ -11,7 +11,7 @@
 
 
 /**
 /**
    @file eax_encrypt.c
    @file eax_encrypt.c
-   EAX implementation, encrypt block by Tom St Denis 
+   EAX implementation, encrypt block by Tom St Denis
 */
 */
 #include "tomcrypt.h"
 #include "tomcrypt.h"
 
 
@@ -25,11 +25,11 @@
    @param length     The length of the plaintext (octets)
    @param length     The length of the plaintext (octets)
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-int eax_encrypt(eax_state *eax, const unsigned char *pt, unsigned char *ct, 
+int eax_encrypt(eax_state *eax, const unsigned char *pt, unsigned char *ct,
                 unsigned long length)
                 unsigned long length)
 {
 {
    int err;
    int err;
-   
+
    LTC_ARGCHK(eax != NULL);
    LTC_ARGCHK(eax != NULL);
    LTC_ARGCHK(pt  != NULL);
    LTC_ARGCHK(pt  != NULL);
    LTC_ARGCHK(ct  != NULL);
    LTC_ARGCHK(ct  != NULL);

+ 5 - 5
src/encauth/eax/eax_encrypt_authenticate_memory.c

@@ -53,15 +53,15 @@ int eax_encrypt_authenticate_memory(int cipher,
    eax = XMALLOC(sizeof(*eax));
    eax = XMALLOC(sizeof(*eax));
 
 
    if ((err = eax_init(eax, cipher, key, keylen, nonce, noncelen, header, headerlen)) != CRYPT_OK) {
    if ((err = eax_init(eax, cipher, key, keylen, nonce, noncelen, header, headerlen)) != CRYPT_OK) {
-      goto LBL_ERR; 
+      goto LBL_ERR;
    }
    }
 
 
    if ((err = eax_encrypt(eax, pt, ct, ptlen)) != CRYPT_OK) {
    if ((err = eax_encrypt(eax, pt, ct, ptlen)) != CRYPT_OK) {
-      goto LBL_ERR; 
+      goto LBL_ERR;
    }
    }
- 
+
    if ((err = eax_done(eax, tag, taglen)) != CRYPT_OK) {
    if ((err = eax_done(eax, tag, taglen)) != CRYPT_OK) {
-      goto LBL_ERR; 
+      goto LBL_ERR;
    }
    }
 
 
    err = CRYPT_OK;
    err = CRYPT_OK;
@@ -72,7 +72,7 @@ LBL_ERR:
 
 
    XFREE(eax);
    XFREE(eax);
 
 
-   return err;   
+   return err;
 }
 }
 
 
 #endif
 #endif

+ 16 - 16
src/encauth/eax/eax_init.c

@@ -9,15 +9,15 @@
  * Tom St Denis, [email protected], http://libtom.org
  * Tom St Denis, [email protected], http://libtom.org
  */
  */
 
 
-/** 
+/**
    @file eax_init.c
    @file eax_init.c
-   EAX implementation, initialized EAX state, by Tom St Denis 
+   EAX implementation, initialized EAX state, by Tom St Denis
 */
 */
 #include "tomcrypt.h"
 #include "tomcrypt.h"
 
 
 #ifdef LTC_EAX_MODE
 #ifdef LTC_EAX_MODE
 
 
-/** 
+/**
    Initialized an EAX state
    Initialized an EAX state
    @param eax       [out] The EAX state to initialize
    @param eax       [out] The EAX state to initialize
    @param cipher    The index of the desired cipher
    @param cipher    The index of the desired cipher
@@ -29,7 +29,7 @@
    @param headerlen The header length (octets)
    @param headerlen The header length (octets)
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-int eax_init(eax_state *eax, int cipher, 
+int eax_init(eax_state *eax, int cipher,
              const unsigned char *key,    unsigned long keylen,
              const unsigned char *key,    unsigned long keylen,
              const unsigned char *nonce,  unsigned long noncelen,
              const unsigned char *nonce,  unsigned long noncelen,
              const unsigned char *header, unsigned long headerlen)
              const unsigned char *header, unsigned long headerlen)
@@ -69,21 +69,21 @@ int eax_init(eax_state *eax, int cipher,
    /* N = LTC_OMAC_0K(nonce) */
    /* N = LTC_OMAC_0K(nonce) */
    zeromem(buf, MAXBLOCKSIZE);
    zeromem(buf, MAXBLOCKSIZE);
    if ((err = omac_init(omac, cipher, key, keylen)) != CRYPT_OK) {
    if ((err = omac_init(omac, cipher, key, keylen)) != CRYPT_OK) {
-      goto LBL_ERR; 
+      goto LBL_ERR;
    }
    }
 
 
    /* omac the [0]_n */
    /* omac the [0]_n */
    if ((err = omac_process(omac, buf, blklen)) != CRYPT_OK) {
    if ((err = omac_process(omac, buf, blklen)) != CRYPT_OK) {
-      goto LBL_ERR; 
+      goto LBL_ERR;
    }
    }
    /* omac the nonce */
    /* omac the nonce */
    if ((err = omac_process(omac, nonce, noncelen)) != CRYPT_OK) {
    if ((err = omac_process(omac, nonce, noncelen)) != CRYPT_OK) {
-      goto LBL_ERR; 
+      goto LBL_ERR;
    }
    }
    /* store result */
    /* store result */
    len = sizeof(eax->N);
    len = sizeof(eax->N);
    if ((err = omac_done(omac, eax->N, &len)) != CRYPT_OK) {
    if ((err = omac_done(omac, eax->N, &len)) != CRYPT_OK) {
-      goto LBL_ERR; 
+      goto LBL_ERR;
    }
    }
 
 
    /* H = LTC_OMAC_1K(header) */
    /* H = LTC_OMAC_1K(header) */
@@ -91,17 +91,17 @@ int eax_init(eax_state *eax, int cipher,
    buf[blklen - 1] = 1;
    buf[blklen - 1] = 1;
 
 
    if ((err = omac_init(&eax->headeromac, cipher, key, keylen)) != CRYPT_OK) {
    if ((err = omac_init(&eax->headeromac, cipher, key, keylen)) != CRYPT_OK) {
-      goto LBL_ERR; 
+      goto LBL_ERR;
    }
    }
 
 
    /* omac the [1]_n */
    /* omac the [1]_n */
    if ((err = omac_process(&eax->headeromac, buf, blklen)) != CRYPT_OK) {
    if ((err = omac_process(&eax->headeromac, buf, blklen)) != CRYPT_OK) {
-      goto LBL_ERR; 
+      goto LBL_ERR;
    }
    }
    /* omac the header */
    /* omac the header */
    if (headerlen != 0) {
    if (headerlen != 0) {
       if ((err = omac_process(&eax->headeromac, header, headerlen)) != CRYPT_OK) {
       if ((err = omac_process(&eax->headeromac, header, headerlen)) != CRYPT_OK) {
-          goto LBL_ERR; 
+          goto LBL_ERR;
       }
       }
    }
    }
 
 
@@ -109,19 +109,19 @@ int eax_init(eax_state *eax, int cipher,
 
 
    /* setup the CTR mode */
    /* setup the CTR mode */
    if ((err = ctr_start(cipher, eax->N, key, keylen, 0, CTR_COUNTER_BIG_ENDIAN, &eax->ctr)) != CRYPT_OK) {
    if ((err = ctr_start(cipher, eax->N, key, keylen, 0, CTR_COUNTER_BIG_ENDIAN, &eax->ctr)) != CRYPT_OK) {
-      goto LBL_ERR; 
+      goto LBL_ERR;
    }
    }
 
 
    /* setup the LTC_OMAC for the ciphertext */
    /* setup the LTC_OMAC for the ciphertext */
-   if ((err = omac_init(&eax->ctomac, cipher, key, keylen)) != CRYPT_OK) { 
-      goto LBL_ERR; 
+   if ((err = omac_init(&eax->ctomac, cipher, key, keylen)) != CRYPT_OK) {
+      goto LBL_ERR;
    }
    }
 
 
    /* omac [2]_n */
    /* omac [2]_n */
    zeromem(buf, MAXBLOCKSIZE);
    zeromem(buf, MAXBLOCKSIZE);
    buf[blklen-1] = 2;
    buf[blklen-1] = 2;
    if ((err = omac_process(&eax->ctomac, buf, blklen)) != CRYPT_OK) {
    if ((err = omac_process(&eax->ctomac, buf, blklen)) != CRYPT_OK) {
-      goto LBL_ERR; 
+      goto LBL_ERR;
    }
    }
 
 
    err = CRYPT_OK;
    err = CRYPT_OK;
@@ -137,7 +137,7 @@ LBL_ERR:
    return err;
    return err;
 }
 }
 
 
-#endif 
+#endif
 
 
 /* $Source$ */
 /* $Source$ */
 /* $Revision$ */
 /* $Revision$ */

+ 13 - 13
src/encauth/eax/eax_test.c

@@ -9,7 +9,7 @@
  * Tom St Denis, [email protected], http://libtom.org
  * Tom St Denis, [email protected], http://libtom.org
  */
  */
 
 
-/** 
+/**
     @file eax_test.c
     @file eax_test.c
     EAX implementation, self-test, by Tom St Denis
     EAX implementation, self-test, by Tom St Denis
 */
 */
@@ -27,16 +27,16 @@ int eax_test(void)
    return CRYPT_NOP;
    return CRYPT_NOP;
 #else
 #else
    static const struct {
    static const struct {
-       int               keylen, 
-                       noncelen, 
-                      headerlen, 
+       int               keylen,
+                       noncelen,
+                      headerlen,
                          msglen;
                          msglen;
 
 
-       unsigned char        key[MAXBLOCKSIZE], 
-                          nonce[MAXBLOCKSIZE], 
-                         header[MAXBLOCKSIZE], 
+       unsigned char        key[MAXBLOCKSIZE],
+                          nonce[MAXBLOCKSIZE],
+                         header[MAXBLOCKSIZE],
                       plaintext[MAXBLOCKSIZE],
                       plaintext[MAXBLOCKSIZE],
-                     ciphertext[MAXBLOCKSIZE], 
+                     ciphertext[MAXBLOCKSIZE],
                             tag[MAXBLOCKSIZE];
                             tag[MAXBLOCKSIZE];
    } tests[] = {
    } tests[] = {
 
 
@@ -107,7 +107,7 @@ int eax_test(void)
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
    /* nonce */
    /* nonce */
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-     0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },  
+     0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
    /* header */
    /* header */
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
@@ -134,7 +134,7 @@ int eax_test(void)
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
    /* nonce */
    /* nonce */
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-     0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e },  
+     0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e },
    /* header */
    /* header */
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d },
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d },
@@ -176,7 +176,7 @@ int eax_test(void)
 
 
 {
 {
    16, 16, 8, 2,
    16, 16, 8, 2,
-   /* key */ 
+   /* key */
    { 0x91, 0x94, 0x5d, 0x3f, 0x4d, 0xcb, 0xee, 0x0b,
    { 0x91, 0x94, 0x5d, 0x3f, 0x4d, 0xcb, 0xee, 0x0b,
      0xf4, 0x5e, 0xf5, 0x22, 0x55, 0xf0, 0x95, 0xa4 },
      0xf4, 0x5e, 0xf5, 0x22, 0x55, 0xf0, 0x95, 0xa4 },
    /* nonce */
    /* nonce */
@@ -210,14 +210,14 @@ int eax_test(void)
    /* Tag */
    /* Tag */
    { 0x3a, 0x59, 0xf2, 0x38, 0xa2, 0x3e, 0x39, 0x19,
    { 0x3a, 0x59, 0xf2, 0x38, 0xa2, 0x3e, 0x39, 0x19,
      0x9d, 0xc9, 0x26, 0x66, 0x26, 0xc4, 0x0f, 0x80 }
      0x9d, 0xc9, 0x26, 0x66, 0x26, 0xc4, 0x0f, 0x80 }
-}   
+}
 
 
 };
 };
    int err, x, idx, res;
    int err, x, idx, res;
    unsigned long len;
    unsigned long len;
    unsigned char outct[MAXBLOCKSIZE], outtag[MAXBLOCKSIZE];
    unsigned char outct[MAXBLOCKSIZE], outtag[MAXBLOCKSIZE];
 
 
-    /* AES can be under rijndael or aes... try to find it */ 
+    /* AES can be under rijndael or aes... try to find it */
     if ((idx = find_cipher("aes")) == -1) {
     if ((idx = find_cipher("aes")) == -1) {
        if ((idx = find_cipher("rijndael")) == -1) {
        if ((idx = find_cipher("rijndael")) == -1) {
           return CRYPT_NOP;
           return CRYPT_NOP;

+ 1 - 1
src/encauth/gcm/gcm_done.c

@@ -24,7 +24,7 @@
   @param taglen  [in/out]  The length of the MAC tag
   @param taglen  [in/out]  The length of the MAC tag
   @return CRYPT_OK on success
   @return CRYPT_OK on success
  */
  */
-int gcm_done(gcm_state *gcm, 
+int gcm_done(gcm_state *gcm,
                      unsigned char *tag,    unsigned long *taglen)
                      unsigned char *tag,    unsigned long *taglen)
 {
 {
    unsigned long x;
    unsigned long x;

+ 9 - 9
src/encauth/gcm/gcm_gf_mult.c

@@ -17,7 +17,7 @@
 
 
 #if defined(LTC_GCM_TABLES) || defined(LTC_LRW_TABLES) || ((defined(LTC_GCM_MODE) || defined(LTC_GCM_MODE)) && defined(LTC_FAST))
 #if defined(LTC_GCM_TABLES) || defined(LTC_LRW_TABLES) || ((defined(LTC_GCM_MODE) || defined(LTC_GCM_MODE)) && defined(LTC_FAST))
 
 
-/* this is x*2^128 mod p(x) ... the results are 16 bytes each stored in a packed format.  Since only the 
+/* this is x*2^128 mod p(x) ... the results are 16 bytes each stored in a packed format.  Since only the
  * lower 16 bits are not zero'ed I removed the upper 14 bytes */
  * lower 16 bits are not zero'ed I removed the upper 14 bytes */
 const unsigned char gcm_shift_table[256*2] = {
 const unsigned char gcm_shift_table[256*2] = {
 0x00, 0x00, 0x01, 0xc2, 0x03, 0x84, 0x02, 0x46, 0x07, 0x08, 0x06, 0xca, 0x04, 0x8c, 0x05, 0x4e,
 0x00, 0x00, 0x01, 0xc2, 0x03, 0x84, 0x02, 0x46, 0x07, 0x08, 0x06, 0xca, 0x04, 0x8c, 0x05, 0x4e,
@@ -73,13 +73,13 @@ static void gcm_rightshift(unsigned char *a)
 static const unsigned char mask[] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
 static const unsigned char mask[] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
 static const unsigned char poly[] = { 0x00, 0xE1 };
 static const unsigned char poly[] = { 0x00, 0xE1 };
 
 
-     
+
 /**
 /**
   GCM GF multiplier (internal use only)  bitserial
   GCM GF multiplier (internal use only)  bitserial
   @param a   First value
   @param a   First value
   @param b   Second value
   @param b   Second value
   @param c   Destination for a * b
   @param c   Destination for a * b
- */  
+ */
 void gcm_gf_mult(const unsigned char *a, const unsigned char *b, unsigned char *c)
 void gcm_gf_mult(const unsigned char *a, const unsigned char *b, unsigned char *c)
 {
 {
    unsigned char Z[16], V[16];
    unsigned char Z[16], V[16];
@@ -90,7 +90,7 @@ void gcm_gf_mult(const unsigned char *a, const unsigned char *b, unsigned char *
    for (x = 0; x < 128; x++) {
    for (x = 0; x < 128; x++) {
        if (b[x>>3] & mask[x&7]) {
        if (b[x>>3] & mask[x&7]) {
           for (y = 0; y < 16; y++) {
           for (y = 0; y < 16; y++) {
-              Z[y] ^= V[y]; 
+              Z[y] ^= V[y];
           }
           }
        }
        }
        z     = V[15] & 0x01;
        z     = V[15] & 0x01;
@@ -113,7 +113,7 @@ void gcm_gf_mult(const unsigned char *a, const unsigned char *b, unsigned char *
   @param a   First value
   @param a   First value
   @param b   Second value
   @param b   Second value
   @param c   Destination for a * b
   @param c   Destination for a * b
- */  
+ */
 void gcm_gf_mult(const unsigned char *a, const unsigned char *b, unsigned char *c)
 void gcm_gf_mult(const unsigned char *a, const unsigned char *b, unsigned char *c)
 {
 {
    int i, j, k, u;
    int i, j, k, u;
@@ -129,7 +129,7 @@ void gcm_gf_mult(const unsigned char *a, const unsigned char *b, unsigned char *
        LOAD32H(B[M(1)][i], a + (i<<2));
        LOAD32H(B[M(1)][i], a + (i<<2));
        LOAD32L(pB[i],      b + (i<<2));
        LOAD32L(pB[i],      b + (i<<2));
    }
    }
-#else 
+#else
    for (i = 0; i < 2; i++) {
    for (i = 0; i < 2; i++) {
        LOAD64H(B[M(1)][i], a + (i<<3));
        LOAD64H(B[M(1)][i], a + (i<<3));
        LOAD64L(pB[i],      b + (i<<3));
        LOAD64L(pB[i],      b + (i<<3));
@@ -154,7 +154,7 @@ void gcm_gf_mult(const unsigned char *a, const unsigned char *b, unsigned char *
       B[M(9)][i]  = B[M(1)][i] ^ B[M(8)][i];
       B[M(9)][i]  = B[M(1)][i] ^ B[M(8)][i];
       B[M(10)][i] = B[M(2)][i] ^ B[M(8)][i];
       B[M(10)][i] = B[M(2)][i] ^ B[M(8)][i];
       B[M(12)][i] = B[M(8)][i] ^ B[M(4)][i];
       B[M(12)][i] = B[M(8)][i] ^ B[M(4)][i];
-   
+
    /*  now all 3 bit values and the only 4 bit value: 7, 11, 13, 14, 15 */
    /*  now all 3 bit values and the only 4 bit value: 7, 11, 13, 14, 15 */
       B[M(7)][i]  = B[M(3)][i] ^ B[M(4)][i];
       B[M(7)][i]  = B[M(3)][i] ^ B[M(4)][i];
       B[M(11)][i] = B[M(3)][i] ^ B[M(8)][i];
       B[M(11)][i] = B[M(3)][i] ^ B[M(8)][i];
@@ -193,7 +193,7 @@ void gcm_gf_mult(const unsigned char *a, const unsigned char *b, unsigned char *
    for (i = 0; i < 8; i++) {
    for (i = 0; i < 8; i++) {
        STORE32H(tmp[i], pTmp + (i<<2));
        STORE32H(tmp[i], pTmp + (i<<2));
    }
    }
-#else 
+#else
    for (i = 0; i < 4; i++) {
    for (i = 0; i < 4; i++) {
        STORE64H(tmp[i], pTmp + (i<<3));
        STORE64H(tmp[i], pTmp + (i<<3));
    }
    }
@@ -218,4 +218,4 @@ void gcm_gf_mult(const unsigned char *a, const unsigned char *b, unsigned char *
 /* $Source$ */
 /* $Source$ */
 /* $Revision$ */
 /* $Revision$ */
 /* $Date$ */
 /* $Date$ */
- 
+

+ 1 - 1
src/encauth/gcm/gcm_init.c

@@ -25,7 +25,7 @@
   @param keylen  The length of the secret key
   @param keylen  The length of the secret key
   @return CRYPT_OK on success
   @return CRYPT_OK on success
  */
  */
-int gcm_init(gcm_state *gcm, int cipher, 
+int gcm_init(gcm_state *gcm, int cipher,
              const unsigned char *key,  int keylen)
              const unsigned char *key,  int keylen)
 {
 {
    int           err;
    int           err;

+ 4 - 4
src/encauth/gcm/gcm_memory.c

@@ -22,7 +22,7 @@
   @param cipher            Index of cipher to use
   @param cipher            Index of cipher to use
   @param key               The secret key
   @param key               The secret key
   @param keylen            The length of the secret key
   @param keylen            The length of the secret key
-  @param IV                The initial vector 
+  @param IV                The initial vector
   @param IVlen             The length of the initial vector
   @param IVlen             The length of the initial vector
   @param adata             The additional authentication data (header)
   @param adata             The additional authentication data (header)
   @param adatalen          The length of the adata
   @param adatalen          The length of the adata
@@ -39,7 +39,7 @@ int gcm_memory(      int           cipher,
                const unsigned char *IV,     unsigned long IVlen,
                const unsigned char *IV,     unsigned long IVlen,
                const unsigned char *adata,  unsigned long adatalen,
                const unsigned char *adata,  unsigned long adatalen,
                      unsigned char *pt,     unsigned long ptlen,
                      unsigned char *pt,     unsigned long ptlen,
-                     unsigned char *ct, 
+                     unsigned char *ct,
                      unsigned char *tag,    unsigned long *taglen,
                      unsigned char *tag,    unsigned long *taglen,
                                int direction)
                                int direction)
 {
 {
@@ -50,9 +50,9 @@ int gcm_memory(      int           cipher,
     if ((err = cipher_is_valid(cipher)) != CRYPT_OK) {
     if ((err = cipher_is_valid(cipher)) != CRYPT_OK) {
        return err;
        return err;
     }
     }
- 
+
     if (cipher_descriptor[cipher].accel_gcm_memory != NULL) {
     if (cipher_descriptor[cipher].accel_gcm_memory != NULL) {
-       return 
+       return
          cipher_descriptor[cipher].accel_gcm_memory
          cipher_descriptor[cipher].accel_gcm_memory
                                           (key,   keylen,
                                           (key,   keylen,
                                            IV,    IVlen,
                                            IV,    IVlen,

+ 1 - 1
src/encauth/gcm/gcm_reset.c

@@ -33,7 +33,7 @@ int gcm_reset(gcm_state *gcm)
    gcm->buflen   = 0;
    gcm->buflen   = 0;
    gcm->totlen   = 0;
    gcm->totlen   = 0;
    gcm->pttotlen = 0;
    gcm->pttotlen = 0;
-  
+
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 

+ 98 - 98
src/encauth/gcm/gcm_test.c

@@ -17,7 +17,7 @@
 
 
 #ifdef LTC_GCM_MODE
 #ifdef LTC_GCM_MODE
 
 
-/** 
+/**
   Test the GCM code
   Test the GCM code
   @return CRYPT_OK on success
   @return CRYPT_OK on success
  */
  */
@@ -100,18 +100,18 @@ int gcm_test(void)
 /* test case #3 */
 /* test case #3 */
 {
 {
    /* key */
    /* key */
-   { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 
+   { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
      0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, },
      0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, },
    16,
    16,
 
 
    /* PT */
    /* PT */
-   { 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 
-     0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 
-     0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 
-     0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 
-     0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 
-     0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 
-     0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 
+   { 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
+     0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
+     0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
+     0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72,
+     0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53,
+     0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25,
+     0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57,
      0xba, 0x63, 0x7b, 0x39, 0x1a, 0xaf, 0xd2, 0x55, },
      0xba, 0x63, 0x7b, 0x39, 0x1a, 0xaf, 0xd2, 0x55, },
   64,
   64,
 
 
@@ -120,66 +120,66 @@ int gcm_test(void)
   0,
   0,
 
 
   /* IV */
   /* IV */
-  { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, 
+  { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
     0xde, 0xca, 0xf8, 0x88,  },
     0xde, 0xca, 0xf8, 0x88,  },
   12,
   12,
- 
+
   /* CT */
   /* CT */
-  { 0x42, 0x83, 0x1e, 0xc2, 0x21, 0x77, 0x74, 0x24, 
-    0x4b, 0x72, 0x21, 0xb7, 0x84, 0xd0, 0xd4, 0x9c, 
-    0xe3, 0xaa, 0x21, 0x2f, 0x2c, 0x02, 0xa4, 0xe0, 
-    0x35, 0xc1, 0x7e, 0x23, 0x29, 0xac, 0xa1, 0x2e, 
-    0x21, 0xd5, 0x14, 0xb2, 0x54, 0x66, 0x93, 0x1c, 
-    0x7d, 0x8f, 0x6a, 0x5a, 0xac, 0x84, 0xaa, 0x05, 
-    0x1b, 0xa3, 0x0b, 0x39, 0x6a, 0x0a, 0xac, 0x97, 
+  { 0x42, 0x83, 0x1e, 0xc2, 0x21, 0x77, 0x74, 0x24,
+    0x4b, 0x72, 0x21, 0xb7, 0x84, 0xd0, 0xd4, 0x9c,
+    0xe3, 0xaa, 0x21, 0x2f, 0x2c, 0x02, 0xa4, 0xe0,
+    0x35, 0xc1, 0x7e, 0x23, 0x29, 0xac, 0xa1, 0x2e,
+    0x21, 0xd5, 0x14, 0xb2, 0x54, 0x66, 0x93, 0x1c,
+    0x7d, 0x8f, 0x6a, 0x5a, 0xac, 0x84, 0xaa, 0x05,
+    0x1b, 0xa3, 0x0b, 0x39, 0x6a, 0x0a, 0xac, 0x97,
     0x3d, 0x58, 0xe0, 0x91, 0x47, 0x3f, 0x59, 0x85, },
     0x3d, 0x58, 0xe0, 0x91, 0x47, 0x3f, 0x59, 0x85, },
 
 
   /* TAG */
   /* TAG */
-  { 0x4d, 0x5c, 0x2a, 0xf3, 0x27, 0xcd, 0x64, 0xa6, 
+  { 0x4d, 0x5c, 0x2a, 0xf3, 0x27, 0xcd, 0x64, 0xa6,
     0x2c, 0xf3, 0x5a, 0xbd, 0x2b, 0xa6, 0xfa, 0xb4, }
     0x2c, 0xf3, 0x5a, 0xbd, 0x2b, 0xa6, 0xfa, 0xb4, }
 },
 },
 
 
 /* test case #4 */
 /* test case #4 */
 {
 {
    /* key */
    /* key */
-   { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 
+   { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
      0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, },
      0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, },
    16,
    16,
 
 
    /* PT */
    /* PT */
-   { 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 
-     0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 
-     0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 
-     0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 
-     0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 
-     0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 
-     0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 
+   { 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
+     0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
+     0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
+     0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72,
+     0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53,
+     0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25,
+     0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57,
      0xba, 0x63, 0x7b, 0x39,  },
      0xba, 0x63, 0x7b, 0x39,  },
    60,
    60,
 
 
    /* ADATA */
    /* ADATA */
-   { 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
-     0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
+   { 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
+     0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
      0xab, 0xad, 0xda, 0xd2,  },
      0xab, 0xad, 0xda, 0xd2,  },
    20,
    20,
 
 
    /* IV */
    /* IV */
-   { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, 
+   { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
      0xde, 0xca, 0xf8, 0x88,  },
      0xde, 0xca, 0xf8, 0x88,  },
    12,
    12,
 
 
    /* CT */
    /* CT */
-   { 0x42, 0x83, 0x1e, 0xc2, 0x21, 0x77, 0x74, 0x24, 
-     0x4b, 0x72, 0x21, 0xb7, 0x84, 0xd0, 0xd4, 0x9c, 
-     0xe3, 0xaa, 0x21, 0x2f, 0x2c, 0x02, 0xa4, 0xe0, 
-     0x35, 0xc1, 0x7e, 0x23, 0x29, 0xac, 0xa1, 0x2e, 
-     0x21, 0xd5, 0x14, 0xb2, 0x54, 0x66, 0x93, 0x1c, 
-     0x7d, 0x8f, 0x6a, 0x5a, 0xac, 0x84, 0xaa, 0x05, 
-     0x1b, 0xa3, 0x0b, 0x39, 0x6a, 0x0a, 0xac, 0x97, 
+   { 0x42, 0x83, 0x1e, 0xc2, 0x21, 0x77, 0x74, 0x24,
+     0x4b, 0x72, 0x21, 0xb7, 0x84, 0xd0, 0xd4, 0x9c,
+     0xe3, 0xaa, 0x21, 0x2f, 0x2c, 0x02, 0xa4, 0xe0,
+     0x35, 0xc1, 0x7e, 0x23, 0x29, 0xac, 0xa1, 0x2e,
+     0x21, 0xd5, 0x14, 0xb2, 0x54, 0x66, 0x93, 0x1c,
+     0x7d, 0x8f, 0x6a, 0x5a, 0xac, 0x84, 0xaa, 0x05,
+     0x1b, 0xa3, 0x0b, 0x39, 0x6a, 0x0a, 0xac, 0x97,
      0x3d, 0x58, 0xe0, 0x91,  },
      0x3d, 0x58, 0xe0, 0x91,  },
 
 
    /* TAG */
    /* TAG */
-   { 0x5b, 0xc9, 0x4f, 0xbc, 0x32, 0x21, 0xa5, 0xdb, 
+   { 0x5b, 0xc9, 0x4f, 0xbc, 0x32, 0x21, 0xa5, 0xdb,
      0x94, 0xfa, 0xe9, 0x5a, 0xe7, 0x12, 0x1a, 0x47, }
      0x94, 0xfa, 0xe9, 0x5a, 0xe7, 0x12, 0x1a, 0x47, }
 
 
 },
 },
@@ -187,24 +187,24 @@ int gcm_test(void)
 /* test case #5 */
 /* test case #5 */
 {
 {
    /* key */
    /* key */
-   { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 
+   { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
      0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, },
      0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, },
    16,
    16,
 
 
    /* PT */
    /* PT */
-   { 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 
-     0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 
-     0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 
-     0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 
-     0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 
-     0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 
-     0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 
+   { 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
+     0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
+     0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
+     0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72,
+     0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53,
+     0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25,
+     0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57,
      0xba, 0x63, 0x7b, 0x39,  },
      0xba, 0x63, 0x7b, 0x39,  },
    60,
    60,
 
 
    /* ADATA */
    /* ADATA */
-   { 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
-     0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
+   { 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
+     0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
      0xab, 0xad, 0xda, 0xd2,  },
      0xab, 0xad, 0xda, 0xd2,  },
    20,
    20,
 
 
@@ -213,112 +213,112 @@ int gcm_test(void)
    8,
    8,
 
 
    /* CT */
    /* CT */
-   { 0x61, 0x35, 0x3b, 0x4c, 0x28, 0x06, 0x93, 0x4a, 
-     0x77, 0x7f, 0xf5, 0x1f, 0xa2, 0x2a, 0x47, 0x55, 
-     0x69, 0x9b, 0x2a, 0x71, 0x4f, 0xcd, 0xc6, 0xf8, 
-     0x37, 0x66, 0xe5, 0xf9, 0x7b, 0x6c, 0x74, 0x23, 
-     0x73, 0x80, 0x69, 0x00, 0xe4, 0x9f, 0x24, 0xb2, 
-     0x2b, 0x09, 0x75, 0x44, 0xd4, 0x89, 0x6b, 0x42, 
-     0x49, 0x89, 0xb5, 0xe1, 0xeb, 0xac, 0x0f, 0x07, 
+   { 0x61, 0x35, 0x3b, 0x4c, 0x28, 0x06, 0x93, 0x4a,
+     0x77, 0x7f, 0xf5, 0x1f, 0xa2, 0x2a, 0x47, 0x55,
+     0x69, 0x9b, 0x2a, 0x71, 0x4f, 0xcd, 0xc6, 0xf8,
+     0x37, 0x66, 0xe5, 0xf9, 0x7b, 0x6c, 0x74, 0x23,
+     0x73, 0x80, 0x69, 0x00, 0xe4, 0x9f, 0x24, 0xb2,
+     0x2b, 0x09, 0x75, 0x44, 0xd4, 0x89, 0x6b, 0x42,
+     0x49, 0x89, 0xb5, 0xe1, 0xeb, 0xac, 0x0f, 0x07,
      0xc2, 0x3f, 0x45, 0x98,  },
      0xc2, 0x3f, 0x45, 0x98,  },
 
 
    /* TAG */
    /* TAG */
-   { 0x36, 0x12, 0xd2, 0xe7, 0x9e, 0x3b, 0x07, 0x85, 
+   { 0x36, 0x12, 0xd2, 0xe7, 0x9e, 0x3b, 0x07, 0x85,
      0x56, 0x1b, 0xe1, 0x4a, 0xac, 0xa2, 0xfc, 0xcb, }
      0x56, 0x1b, 0xe1, 0x4a, 0xac, 0xa2, 0xfc, 0xcb, }
 },
 },
 
 
 /* test case #6 */
 /* test case #6 */
 {
 {
    /* key */
    /* key */
-   { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 
+   { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
      0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, },
      0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, },
    16,
    16,
 
 
    /* PT */
    /* PT */
-   { 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 
-     0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 
-     0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 
-     0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 
-     0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 
-     0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 
-     0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 
+   { 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
+     0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
+     0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
+     0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72,
+     0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53,
+     0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25,
+     0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57,
      0xba, 0x63, 0x7b, 0x39,  },
      0xba, 0x63, 0x7b, 0x39,  },
    60,
    60,
 
 
    /* ADATA */
    /* ADATA */
-   { 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
-     0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
+   { 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
+     0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
      0xab, 0xad, 0xda, 0xd2,  },
      0xab, 0xad, 0xda, 0xd2,  },
    20,
    20,
 
 
    /* IV */
    /* IV */
-   { 0x93, 0x13, 0x22, 0x5d, 0xf8, 0x84, 0x06, 0xe5, 
-     0x55, 0x90, 0x9c, 0x5a, 0xff, 0x52, 0x69, 0xaa, 
-     0x6a, 0x7a, 0x95, 0x38, 0x53, 0x4f, 0x7d, 0xa1, 
-     0xe4, 0xc3, 0x03, 0xd2, 0xa3, 0x18, 0xa7, 0x28, 
-     0xc3, 0xc0, 0xc9, 0x51, 0x56, 0x80, 0x95, 0x39, 
-     0xfc, 0xf0, 0xe2, 0x42, 0x9a, 0x6b, 0x52, 0x54, 
-     0x16, 0xae, 0xdb, 0xf5, 0xa0, 0xde, 0x6a, 0x57, 
+   { 0x93, 0x13, 0x22, 0x5d, 0xf8, 0x84, 0x06, 0xe5,
+     0x55, 0x90, 0x9c, 0x5a, 0xff, 0x52, 0x69, 0xaa,
+     0x6a, 0x7a, 0x95, 0x38, 0x53, 0x4f, 0x7d, 0xa1,
+     0xe4, 0xc3, 0x03, 0xd2, 0xa3, 0x18, 0xa7, 0x28,
+     0xc3, 0xc0, 0xc9, 0x51, 0x56, 0x80, 0x95, 0x39,
+     0xfc, 0xf0, 0xe2, 0x42, 0x9a, 0x6b, 0x52, 0x54,
+     0x16, 0xae, 0xdb, 0xf5, 0xa0, 0xde, 0x6a, 0x57,
      0xa6, 0x37, 0xb3, 0x9b,  },
      0xa6, 0x37, 0xb3, 0x9b,  },
    60,
    60,
 
 
    /* CT */
    /* CT */
-   { 0x8c, 0xe2, 0x49, 0x98, 0x62, 0x56, 0x15, 0xb6, 
-     0x03, 0xa0, 0x33, 0xac, 0xa1, 0x3f, 0xb8, 0x94, 
-     0xbe, 0x91, 0x12, 0xa5, 0xc3, 0xa2, 0x11, 0xa8, 
-     0xba, 0x26, 0x2a, 0x3c, 0xca, 0x7e, 0x2c, 0xa7, 
-     0x01, 0xe4, 0xa9, 0xa4, 0xfb, 0xa4, 0x3c, 0x90, 
-     0xcc, 0xdc, 0xb2, 0x81, 0xd4, 0x8c, 0x7c, 0x6f, 
-     0xd6, 0x28, 0x75, 0xd2, 0xac, 0xa4, 0x17, 0x03, 
+   { 0x8c, 0xe2, 0x49, 0x98, 0x62, 0x56, 0x15, 0xb6,
+     0x03, 0xa0, 0x33, 0xac, 0xa1, 0x3f, 0xb8, 0x94,
+     0xbe, 0x91, 0x12, 0xa5, 0xc3, 0xa2, 0x11, 0xa8,
+     0xba, 0x26, 0x2a, 0x3c, 0xca, 0x7e, 0x2c, 0xa7,
+     0x01, 0xe4, 0xa9, 0xa4, 0xfb, 0xa4, 0x3c, 0x90,
+     0xcc, 0xdc, 0xb2, 0x81, 0xd4, 0x8c, 0x7c, 0x6f,
+     0xd6, 0x28, 0x75, 0xd2, 0xac, 0xa4, 0x17, 0x03,
      0x4c, 0x34, 0xae, 0xe5,  },
      0x4c, 0x34, 0xae, 0xe5,  },
 
 
    /* TAG */
    /* TAG */
-   { 0x61, 0x9c, 0xc5, 0xae, 0xff, 0xfe, 0x0b, 0xfa, 
+   { 0x61, 0x9c, 0xc5, 0xae, 0xff, 0xfe, 0x0b, 0xfa,
      0x46, 0x2a, 0xf4, 0x3c, 0x16, 0x99, 0xd0, 0x50, }
      0x46, 0x2a, 0xf4, 0x3c, 0x16, 0x99, 0xd0, 0x50, }
 },
 },
 
 
 /* test case #46 from BG (catches the LTC bug of v1.15) */
 /* test case #46 from BG (catches the LTC bug of v1.15) */
 {
 {
    /* key */
    /* key */
-   { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+   { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
    16,
    16,
 
 
    /* PT */
    /* PT */
-   { 0xa2, 0xaa, 0xb3, 0xad, 0x8b, 0x17, 0xac, 0xdd, 
-     0xa2, 0x88, 0x42, 0x6c, 0xd7, 0xc4, 0x29, 0xb7, 
-     0xca, 0x86, 0xb7, 0xac, 0xa0, 0x58, 0x09, 0xc7, 
+   { 0xa2, 0xaa, 0xb3, 0xad, 0x8b, 0x17, 0xac, 0xdd,
+     0xa2, 0x88, 0x42, 0x6c, 0xd7, 0xc4, 0x29, 0xb7,
+     0xca, 0x86, 0xb7, 0xac, 0xa0, 0x58, 0x09, 0xc7,
      0x0c, 0xe8, 0x2d, 0xb2, 0x57, 0x11, 0xcb, 0x53,
      0x0c, 0xe8, 0x2d, 0xb2, 0x57, 0x11, 0xcb, 0x53,
-     0x02, 0xeb, 0x27, 0x43, 0xb0, 0x36, 0xf3, 0xd7, 
-     0x50, 0xd6, 0xcf, 0x0d, 0xc0, 0xac, 0xb9, 0x29, 
-     0x50, 0xd5, 0x46, 0xdb, 0x30, 0x8f, 0x93, 0xb4, 
+     0x02, 0xeb, 0x27, 0x43, 0xb0, 0x36, 0xf3, 0xd7,
+     0x50, 0xd6, 0xcf, 0x0d, 0xc0, 0xac, 0xb9, 0x29,
+     0x50, 0xd5, 0x46, 0xdb, 0x30, 0x8f, 0x93, 0xb4,
      0xff, 0x24, 0x4a, 0xfa, 0x9d, 0xc7, 0x2b, 0xcd,
      0xff, 0x24, 0x4a, 0xfa, 0x9d, 0xc7, 0x2b, 0xcd,
      0x75, 0x8d, 0x2c },
      0x75, 0x8d, 0x2c },
    67,
    67,
 
 
    /* ADATA */
    /* ADATA */
-   { 0x68, 0x8e, 0x1a, 0xa9, 0x84, 0xde, 0x92, 0x6d, 
+   { 0x68, 0x8e, 0x1a, 0xa9, 0x84, 0xde, 0x92, 0x6d,
      0xc7, 0xb4, 0xc4, 0x7f, 0x44 },
      0xc7, 0xb4, 0xc4, 0x7f, 0x44 },
-   13,   
+   13,
 
 
    /* IV */
    /* IV */
-   { 0xb7, 0x21, 0x38, 0xb5, 0xa0, 0x5f, 0xf5, 0x07, 
+   { 0xb7, 0x21, 0x38, 0xb5, 0xa0, 0x5f, 0xf5, 0x07,
      0x0e, 0x8c, 0xd9, 0x41, 0x83, 0xf7, 0x61, 0xd8 },
      0x0e, 0x8c, 0xd9, 0x41, 0x83, 0xf7, 0x61, 0xd8 },
    16,
    16,
 
 
    /* CT */
    /* CT */
-   { 0xcb, 0xc8, 0xd2, 0xf1, 0x54, 0x81, 0xa4, 0xcc, 
-     0x7d, 0xd1, 0xe1, 0x9a, 0xaa, 0x83, 0xde, 0x56, 
-     0x78, 0x48, 0x3e, 0xc3, 0x59, 0xae, 0x7d, 0xec, 
+   { 0xcb, 0xc8, 0xd2, 0xf1, 0x54, 0x81, 0xa4, 0xcc,
+     0x7d, 0xd1, 0xe1, 0x9a, 0xaa, 0x83, 0xde, 0x56,
+     0x78, 0x48, 0x3e, 0xc3, 0x59, 0xae, 0x7d, 0xec,
      0x2a, 0xb8, 0xd5, 0x34, 0xe0, 0x90, 0x6f, 0x4b,
      0x2a, 0xb8, 0xd5, 0x34, 0xe0, 0x90, 0x6f, 0x4b,
-     0x46, 0x63, 0xfa, 0xff, 0x58, 0xa8, 0xb2, 0xd7, 
-     0x33, 0xb8, 0x45, 0xee, 0xf7, 0xc9, 0xb3, 0x31, 
-     0xe9, 0xe1, 0x0e, 0xb2, 0x61, 0x2c, 0x99, 0x5f, 
+     0x46, 0x63, 0xfa, 0xff, 0x58, 0xa8, 0xb2, 0xd7,
+     0x33, 0xb8, 0x45, 0xee, 0xf7, 0xc9, 0xb3, 0x31,
+     0xe9, 0xe1, 0x0e, 0xb2, 0x61, 0x2c, 0x99, 0x5f,
      0xeb, 0x1a, 0xc1, 0x5a, 0x62, 0x86, 0xcc, 0xe8,
      0xeb, 0x1a, 0xc1, 0x5a, 0x62, 0x86, 0xcc, 0xe8,
      0xb2, 0x97, 0xa8 },
      0xb2, 0x97, 0xa8 },
 
 
    /* TAG */
    /* TAG */
-   { 0x8d, 0x2d, 0x2a, 0x93, 0x72, 0x62, 0x6f, 0x6b, 
+   { 0x8d, 0x2d, 0x2a, 0x93, 0x72, 0x62, 0x6f, 0x6b,
      0xee, 0x85, 0x80, 0x27, 0x6a, 0x63, 0x66, 0xbf }
      0xee, 0x85, 0x80, 0x27, 0x6a, 0x63, 0x66, 0xbf }
 }
 }
 
 

+ 2 - 2
src/encauth/ocb/ocb_decrypt.c

@@ -11,7 +11,7 @@
 
 
 /**
 /**
    @file ocb_decrypt.c
    @file ocb_decrypt.c
-   OCB implementation, decrypt data, by Tom St Denis 
+   OCB implementation, decrypt data, by Tom St Denis
 */
 */
 #include "tomcrypt.h"
 #include "tomcrypt.h"
 
 
@@ -38,7 +38,7 @@ int ocb_decrypt(ocb_state *ocb, const unsigned char *ct, unsigned char *pt)
       return err;
       return err;
    }
    }
    LTC_ARGCHK(cipher_descriptor[ocb->cipher].ecb_decrypt != NULL);
    LTC_ARGCHK(cipher_descriptor[ocb->cipher].ecb_decrypt != NULL);
-   
+
    /* check length */
    /* check length */
    if (ocb->block_len != cipher_descriptor[ocb->cipher].block_length) {
    if (ocb->block_len != cipher_descriptor[ocb->cipher].block_length) {
       return CRYPT_INVALID_ARG;
       return CRYPT_INVALID_ARG;

+ 6 - 6
src/encauth/ocb/ocb_decrypt_verify_memory.c

@@ -9,9 +9,9 @@
  * Tom St Denis, [email protected], http://libtom.org
  * Tom St Denis, [email protected], http://libtom.org
  */
  */
 
 
-/** 
+/**
   @file ocb_decrypt_verify_memory.c
   @file ocb_decrypt_verify_memory.c
-  OCB implementation, helper to decrypt block of memory, by Tom St Denis 
+  OCB implementation, helper to decrypt block of memory, by Tom St Denis
 */
 */
 #include "tomcrypt.h"
 #include "tomcrypt.h"
 
 
@@ -33,7 +33,7 @@
 */
 */
 int ocb_decrypt_verify_memory(int cipher,
 int ocb_decrypt_verify_memory(int cipher,
     const unsigned char *key,    unsigned long keylen,
     const unsigned char *key,    unsigned long keylen,
-    const unsigned char *nonce,  
+    const unsigned char *nonce,
     const unsigned char *ct,     unsigned long ctlen,
     const unsigned char *ct,     unsigned long ctlen,
           unsigned char *pt,
           unsigned char *pt,
     const unsigned char *tag,    unsigned long taglen,
     const unsigned char *tag,    unsigned long taglen,
@@ -56,12 +56,12 @@ int ocb_decrypt_verify_memory(int cipher,
    }
    }
 
 
    if ((err = ocb_init(ocb, cipher, key, keylen, nonce)) != CRYPT_OK) {
    if ((err = ocb_init(ocb, cipher, key, keylen, nonce)) != CRYPT_OK) {
-      goto LBL_ERR; 
+      goto LBL_ERR;
    }
    }
 
 
    while (ctlen > (unsigned long)ocb->block_len) {
    while (ctlen > (unsigned long)ocb->block_len) {
         if ((err = ocb_decrypt(ocb, ct, pt)) != CRYPT_OK) {
         if ((err = ocb_decrypt(ocb, ct, pt)) != CRYPT_OK) {
-            goto LBL_ERR; 
+            goto LBL_ERR;
         }
         }
         ctlen   -= ocb->block_len;
         ctlen   -= ocb->block_len;
         pt      += ocb->block_len;
         pt      += ocb->block_len;
@@ -73,7 +73,7 @@ LBL_ERR:
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
    zeromem(ocb, sizeof(ocb_state));
    zeromem(ocb, sizeof(ocb_state));
 #endif
 #endif
- 
+
    XFREE(ocb);
    XFREE(ocb);
 
 
    return err;
    return err;

+ 3 - 3
src/encauth/ocb/ocb_done_decrypt.c

@@ -9,7 +9,7 @@
  * Tom St Denis, [email protected], http://libtom.org
  * Tom St Denis, [email protected], http://libtom.org
  */
  */
 
 
-/** 
+/**
    @file ocb_done_decrypt.c
    @file ocb_done_decrypt.c
    OCB implementation, terminate decryption, by Tom St Denis
    OCB implementation, terminate decryption, by Tom St Denis
 */
 */
@@ -28,9 +28,9 @@
    @param stat    [out] The result of the tag comparison
    @param stat    [out] The result of the tag comparison
    @return CRYPT_OK if the process was successful regardless if the tag is valid
    @return CRYPT_OK if the process was successful regardless if the tag is valid
 */
 */
-int ocb_done_decrypt(ocb_state *ocb, 
+int ocb_done_decrypt(ocb_state *ocb,
                      const unsigned char *ct,  unsigned long ctlen,
                      const unsigned char *ct,  unsigned long ctlen,
-                           unsigned char *pt, 
+                           unsigned char *pt,
                      const unsigned char *tag, unsigned long taglen, int *stat)
                      const unsigned char *tag, unsigned long taglen, int *stat)
 {
 {
    int err;
    int err;

+ 2 - 2
src/encauth/ocb/ocb_done_encrypt.c

@@ -9,7 +9,7 @@
  * Tom St Denis, [email protected], http://libtom.org
  * Tom St Denis, [email protected], http://libtom.org
  */
  */
 
 
-/** 
+/**
    @file ocb_done_encrypt.c
    @file ocb_done_encrypt.c
    OCB implementation, terminate encryption, by Tom St Denis
    OCB implementation, terminate encryption, by Tom St Denis
 */
 */
@@ -17,7 +17,7 @@
 
 
 #ifdef LTC_OCB_MODE
 #ifdef LTC_OCB_MODE
 
 
-/** 
+/**
    Terminate an encryption OCB state
    Terminate an encryption OCB state
    @param ocb       The OCB state
    @param ocb       The OCB state
    @param pt        Remaining plaintext (if any)
    @param pt        Remaining plaintext (if any)

+ 1 - 1
src/encauth/ocb/ocb_encrypt.c

@@ -9,7 +9,7 @@
  * Tom St Denis, [email protected], http://libtom.org
  * Tom St Denis, [email protected], http://libtom.org
  */
  */
 
 
-/** 
+/**
    @file ocb_encrypt.c
    @file ocb_encrypt.c
    OCB implementation, encrypt data, by Tom St Denis
    OCB implementation, encrypt data, by Tom St Denis
 */
 */

+ 2 - 2
src/encauth/ocb/ocb_encrypt_authenticate_memory.c

@@ -9,7 +9,7 @@
  * Tom St Denis, [email protected], http://libtom.org
  * Tom St Denis, [email protected], http://libtom.org
  */
  */
 
 
-/** 
+/**
   @file ocb_encrypt_authenticate_memory.c
   @file ocb_encrypt_authenticate_memory.c
   OCB implementation, encrypt block of memory, by Tom St Denis
   OCB implementation, encrypt block of memory, by Tom St Denis
 */
 */
@@ -32,7 +32,7 @@
 */
 */
 int ocb_encrypt_authenticate_memory(int cipher,
 int ocb_encrypt_authenticate_memory(int cipher,
     const unsigned char *key,    unsigned long keylen,
     const unsigned char *key,    unsigned long keylen,
-    const unsigned char *nonce,  
+    const unsigned char *nonce,
     const unsigned char *pt,     unsigned long ptlen,
     const unsigned char *pt,     unsigned long ptlen,
           unsigned char *ct,
           unsigned char *ct,
           unsigned char *tag,    unsigned long *taglen)
           unsigned char *tag,    unsigned long *taglen)

+ 6 - 6
src/encauth/ocb/ocb_init.c

@@ -19,7 +19,7 @@
 
 
 static const struct {
 static const struct {
     int           len;
     int           len;
-    unsigned char poly_div[MAXBLOCKSIZE], 
+    unsigned char poly_div[MAXBLOCKSIZE],
                   poly_mul[MAXBLOCKSIZE];
                   poly_mul[MAXBLOCKSIZE];
 } polys[] = {
 } polys[] = {
 {
 {
@@ -27,7 +27,7 @@ static const struct {
     { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D },
     { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D },
     { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B }
     { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B }
 }, {
 }, {
-    16, 
+    16,
     { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43 },
       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43 },
     { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -44,7 +44,7 @@ static const struct {
   @param nonce   The session nonce (length of the block size of the cipher)
   @param nonce   The session nonce (length of the block size of the cipher)
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
-int ocb_init(ocb_state *ocb, int cipher, 
+int ocb_init(ocb_state *ocb, int cipher,
              const unsigned char *key, unsigned long keylen, const unsigned char *nonce)
              const unsigned char *key, unsigned long keylen, const unsigned char *nonce)
 {
 {
    int poly, x, y, m, err;
    int poly, x, y, m, err;
@@ -62,7 +62,7 @@ int ocb_init(ocb_state *ocb, int cipher,
    ocb->block_len = cipher_descriptor[cipher].block_length;
    ocb->block_len = cipher_descriptor[cipher].block_length;
    x = (int)(sizeof(polys)/sizeof(polys[0]));
    x = (int)(sizeof(polys)/sizeof(polys[0]));
    for (poly = 0; poly < x; poly++) {
    for (poly = 0; poly < x; poly++) {
-       if (polys[poly].len == ocb->block_len) { 
+       if (polys[poly].len == ocb->block_len) {
           break;
           break;
        }
        }
    }
    }
@@ -71,13 +71,13 @@ int ocb_init(ocb_state *ocb, int cipher,
    }
    }
    if (polys[poly].len != ocb->block_len) {
    if (polys[poly].len != ocb->block_len) {
       return CRYPT_INVALID_ARG;
       return CRYPT_INVALID_ARG;
-   }   
+   }
 
 
    /* schedule the key */
    /* schedule the key */
    if ((err = cipher_descriptor[cipher].setup(key, keylen, 0, &ocb->key)) != CRYPT_OK) {
    if ((err = cipher_descriptor[cipher].setup(key, keylen, 0, &ocb->key)) != CRYPT_OK) {
       return err;
       return err;
    }
    }
- 
+
    /* find L = E[0] */
    /* find L = E[0] */
    zeromem(ocb->L, ocb->block_len);
    zeromem(ocb->L, ocb->block_len);
    if ((err = cipher_descriptor[cipher].ecb_encrypt(ocb->L, ocb->L, &ocb->key)) != CRYPT_OK) {
    if ((err = cipher_descriptor[cipher].ecb_encrypt(ocb->L, ocb->L, &ocb->key)) != CRYPT_OK) {

+ 2 - 2
src/encauth/ocb/ocb_shift_xor.c

@@ -9,7 +9,7 @@
  * Tom St Denis, [email protected], http://libtom.org
  * Tom St Denis, [email protected], http://libtom.org
  */
  */
 
 
-/** 
+/**
    @file ocb_shift_xor.c
    @file ocb_shift_xor.c
    OCB implementation, internal function, by Tom St Denis
    OCB implementation, internal function, by Tom St Denis
 */
 */
@@ -19,7 +19,7 @@
 
 
 /**
 /**
    Compute the shift/xor for OCB (internal function)
    Compute the shift/xor for OCB (internal function)
-   @param ocb  The OCB state 
+   @param ocb  The OCB state
    @param Z    The destination of the shift
    @param Z    The destination of the shift
 */
 */
 void ocb_shift_xor(ocb_state *ocb, unsigned char *Z)
 void ocb_shift_xor(ocb_state *ocb, unsigned char *Z)

+ 13 - 13
src/encauth/ocb/ocb_test.c

@@ -9,7 +9,7 @@
  * Tom St Denis, [email protected], http://libtom.org
  * Tom St Denis, [email protected], http://libtom.org
  */
  */
 
 
-/** 
+/**
    @file ocb_test.c
    @file ocb_test.c
    OCB implementation, self-test by Tom St Denis
    OCB implementation, self-test by Tom St Denis
 */
 */
@@ -17,7 +17,7 @@
 
 
 #ifdef LTC_OCB_MODE
 #ifdef LTC_OCB_MODE
 
 
-/** 
+/**
   Test the OCB protocol
   Test the OCB protocol
   @return   CRYPT_OK if successful
   @return   CRYPT_OK if successful
 */
 */
@@ -52,7 +52,7 @@ int ocb_test(void)
 
 
    /* OCB-AES-128-3B */
    /* OCB-AES-128-3B */
 {
 {
-   3, 
+   3,
    /* key */
    /* key */
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
@@ -70,7 +70,7 @@ int ocb_test(void)
 
 
    /* OCB-AES-128-16B */
    /* OCB-AES-128-16B */
 {
 {
-   16, 
+   16,
    /* key */
    /* key */
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
@@ -90,7 +90,7 @@ int ocb_test(void)
 
 
    /* OCB-AES-128-20B  */
    /* OCB-AES-128-20B  */
 {
 {
-   20, 
+   20,
    /* key */
    /* key */
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
@@ -99,7 +99,7 @@ int ocb_test(void)
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
    /* pt */
    /* pt */
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-     0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 
+     0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
      0x10, 0x11, 0x12, 0x13 },
      0x10, 0x11, 0x12, 0x13 },
    /* ct */
    /* ct */
    { 0x01, 0xa0, 0x75, 0xf0, 0xd8, 0x15, 0xb1, 0xa4,
    { 0x01, 0xa0, 0x75, 0xf0, 0xd8, 0x15, 0xb1, 0xa4,
@@ -112,7 +112,7 @@ int ocb_test(void)
 
 
    /* OCB-AES-128-32B  */
    /* OCB-AES-128-32B  */
 {
 {
-   32, 
+   32,
    /* key */
    /* key */
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
@@ -121,7 +121,7 @@ int ocb_test(void)
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
    /* pt */
    /* pt */
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-     0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 
+     0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
      0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
      0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
      0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
      0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
    /* ct */
    /* ct */
@@ -137,7 +137,7 @@ int ocb_test(void)
 
 
    /* OCB-AES-128-34B  */
    /* OCB-AES-128-34B  */
 {
 {
-   34, 
+   34,
    /* key */
    /* key */
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
@@ -146,7 +146,7 @@ int ocb_test(void)
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
    /* pt */
    /* pt */
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-     0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 
+     0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
      0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
      0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
      0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
      0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
      0x20, 0x21 },
      0x20, 0x21 },
@@ -168,7 +168,7 @@ int ocb_test(void)
    unsigned long len;
    unsigned long len;
    unsigned char outct[MAXBLOCKSIZE], outtag[MAXBLOCKSIZE];
    unsigned char outct[MAXBLOCKSIZE], outtag[MAXBLOCKSIZE];
 
 
-    /* AES can be under rijndael or aes... try to find it */ 
+    /* AES can be under rijndael or aes... try to find it */
     if ((idx = find_cipher("aes")) == -1) {
     if ((idx = find_cipher("aes")) == -1) {
        if ((idx = find_cipher("rijndael")) == -1) {
        if ((idx = find_cipher("rijndael")) == -1) {
           return CRYPT_NOP;
           return CRYPT_NOP;
@@ -181,7 +181,7 @@ int ocb_test(void)
              tests[x].nonce, tests[x].pt, tests[x].ptlen, outct, outtag, &len)) != CRYPT_OK) {
              tests[x].nonce, tests[x].pt, tests[x].ptlen, outct, outtag, &len)) != CRYPT_OK) {
            return err;
            return err;
         }
         }
-        
+
         if (XMEMCMP(outtag, tests[x].tag, len) || XMEMCMP(outct, tests[x].ct, tests[x].ptlen)) {
         if (XMEMCMP(outtag, tests[x].tag, len) || XMEMCMP(outct, tests[x].ct, tests[x].ptlen)) {
 #if 0
 #if 0
            unsigned long y;
            unsigned long y;
@@ -200,7 +200,7 @@ int ocb_test(void)
 #endif
 #endif
            return CRYPT_FAIL_TESTVECTOR;
            return CRYPT_FAIL_TESTVECTOR;
         }
         }
-        
+
         if ((err = ocb_decrypt_verify_memory(idx, tests[x].key, 16, tests[x].nonce, outct, tests[x].ptlen,
         if ((err = ocb_decrypt_verify_memory(idx, tests[x].key, 16, tests[x].nonce, outct, tests[x].ptlen,
              outct, tests[x].tag, len, &res)) != CRYPT_OK) {
              outct, tests[x].tag, len, &res)) != CRYPT_OK) {
            return err;
            return err;

+ 8 - 8
src/encauth/ocb/s_ocb_done.c

@@ -9,7 +9,7 @@
  * Tom St Denis, [email protected], http://libtom.org
  * Tom St Denis, [email protected], http://libtom.org
  */
  */
 
 
-/** 
+/**
    @file s_ocb_done.c
    @file s_ocb_done.c
    OCB implementation, internal helper, by Tom St Denis
    OCB implementation, internal helper, by Tom St Denis
 */
 */
@@ -22,7 +22,7 @@
  * is we XOR the final ciphertext into the checksum so we have to xor it
  * is we XOR the final ciphertext into the checksum so we have to xor it
  * before we CTR [decrypt] or after [encrypt]
  * before we CTR [decrypt] or after [encrypt]
  *
  *
- * the names pt/ptlen/ct really just mean in/inlen/out but this is the way I wrote it... 
+ * the names pt/ptlen/ct really just mean in/inlen/out but this is the way I wrote it...
  */
  */
 
 
 /**
 /**
@@ -74,13 +74,13 @@ int s_ocb_done(ocb_state *ocb, const unsigned char *pt, unsigned long ptlen,
    }
    }
 
 
    /* compute X[m] = len(pt[m]) XOR Lr XOR Z[m] */
    /* compute X[m] = len(pt[m]) XOR Lr XOR Z[m] */
-   ocb_shift_xor(ocb, X); 
+   ocb_shift_xor(ocb, X);
    XMEMCPY(Z, X, ocb->block_len);
    XMEMCPY(Z, X, ocb->block_len);
 
 
    X[ocb->block_len-1] ^= (ptlen*8)&255;
    X[ocb->block_len-1] ^= (ptlen*8)&255;
    X[ocb->block_len-2] ^= ((ptlen*8)>>8)&255;
    X[ocb->block_len-2] ^= ((ptlen*8)>>8)&255;
    for (x = 0; x < ocb->block_len; x++) {
    for (x = 0; x < ocb->block_len; x++) {
-       X[x] ^= ocb->Lr[x]; 
+       X[x] ^= ocb->Lr[x];
    }
    }
 
 
    /* Y[m] = E(X[m])) */
    /* Y[m] = E(X[m])) */
@@ -93,7 +93,7 @@ int s_ocb_done(ocb_state *ocb, const unsigned char *pt, unsigned long ptlen,
       /* xor C[m] into checksum */
       /* xor C[m] into checksum */
       for (x = 0; x < (int)ptlen; x++) {
       for (x = 0; x < (int)ptlen; x++) {
          ocb->checksum[x] ^= ct[x];
          ocb->checksum[x] ^= ct[x];
-      }  
+      }
    }
    }
 
 
    /* C[m] = P[m] xor Y[m] */
    /* C[m] = P[m] xor Y[m] */
@@ -102,7 +102,7 @@ int s_ocb_done(ocb_state *ocb, const unsigned char *pt, unsigned long ptlen,
    }
    }
 
 
    if (mode == 0) {
    if (mode == 0) {
-      /* encrypt mode */    
+      /* encrypt mode */
       /* xor C[m] into checksum */
       /* xor C[m] into checksum */
       for (x = 0; x < (int)ptlen; x++) {
       for (x = 0; x < (int)ptlen; x++) {
           ocb->checksum[x] ^= ct[x];
           ocb->checksum[x] ^= ct[x];
@@ -113,7 +113,7 @@ int s_ocb_done(ocb_state *ocb, const unsigned char *pt, unsigned long ptlen,
    for (x = 0; x < ocb->block_len; x++) {
    for (x = 0; x < ocb->block_len; x++) {
        ocb->checksum[x] ^= Y[x] ^ Z[x];
        ocb->checksum[x] ^= Y[x] ^ Z[x];
    }
    }
-   
+
    /* encrypt checksum, er... tag!! */
    /* encrypt checksum, er... tag!! */
    if ((err = cipher_descriptor[ocb->cipher].ecb_encrypt(ocb->checksum, X, &ocb->key)) != CRYPT_OK) {
    if ((err = cipher_descriptor[ocb->cipher].ecb_encrypt(ocb->checksum, X, &ocb->key)) != CRYPT_OK) {
       goto error;
       goto error;
@@ -132,7 +132,7 @@ int s_ocb_done(ocb_state *ocb, const unsigned char *pt, unsigned long ptlen,
    zeromem(Z, MAXBLOCKSIZE);
    zeromem(Z, MAXBLOCKSIZE);
    zeromem(ocb, sizeof(*ocb));
    zeromem(ocb, sizeof(*ocb));
 #endif
 #endif
-error:   
+error:
    XFREE(X);
    XFREE(X);
    XFREE(Y);
    XFREE(Y);
    XFREE(Z);
    XFREE(Z);

+ 2 - 2
src/hashes/helper/hash_file.c

@@ -11,7 +11,7 @@
 #include "tomcrypt.h"
 #include "tomcrypt.h"
 
 
 #ifndef LTC_NO_FILE
 #ifndef LTC_NO_FILE
-/** 
+/**
   @file hash_file.c
   @file hash_file.c
   Hash a file, Tom St Denis
   Hash a file, Tom St Denis
 */
 */
@@ -36,7 +36,7 @@ int hash_file(int hash, const char *fname, unsigned char *out, unsigned long *ou
     }
     }
 
 
     in = fopen(fname, "rb");
     in = fopen(fname, "rb");
-    if (in == NULL) { 
+    if (in == NULL) {
        return CRYPT_FILE_NOTFOUND;
        return CRYPT_FILE_NOTFOUND;
     }
     }
 
 

+ 3 - 3
src/hashes/helper/hash_filehandle.c

@@ -16,13 +16,13 @@
    Hash open files, Tom St Denis
    Hash open files, Tom St Denis
 */
 */
 
 
-/** 
-  Hash data from an open file handle.  
+/**
+  Hash data from an open file handle.
   @param hash   The index of the hash you want to use
   @param hash   The index of the hash you want to use
   @param in     The FILE* handle of the file you want to hash
   @param in     The FILE* handle of the file you want to hash
   @param out    [out] The destination of the digest
   @param out    [out] The destination of the digest
   @param outlen [in/out] The max size and resulting size of the digest
   @param outlen [in/out] The max size and resulting size of the digest
-  @result CRYPT_OK if successful   
+  @result CRYPT_OK if successful
 */
 */
 int hash_filehandle(int hash, FILE *in, unsigned char *out, unsigned long *outlen)
 int hash_filehandle(int hash, FILE *in, unsigned char *out, unsigned long *outlen)
 {
 {

+ 9 - 9
src/hashes/md2.c

@@ -12,7 +12,7 @@
 
 
 /**
 /**
    @param md2.c
    @param md2.c
-   LTC_MD2 (RFC 1319) hash function implementation by Tom St Denis 
+   LTC_MD2 (RFC 1319) hash function implementation by Tom St Denis
 */
 */
 
 
 #ifdef LTC_MD2
 #ifdef LTC_MD2
@@ -64,7 +64,7 @@ static void md2_update_chksum(hash_state *md)
    L = md->md2.chksum[15];
    L = md->md2.chksum[15];
    for (j = 0; j < 16; j++) {
    for (j = 0; j < 16; j++) {
 
 
-/* caution, the RFC says its "C[j] = S[M[i*16+j] xor L]" but the reference source code [and test vectors] say 
+/* caution, the RFC says its "C[j] = S[M[i*16+j] xor L]" but the reference source code [and test vectors] say
    otherwise.
    otherwise.
 */
 */
        L = (md->md2.chksum[j] ^= PI_SUBST[(int)(md->md2.buf[j] ^ L)] & 255);
        L = (md->md2.chksum[j] ^= PI_SUBST[(int)(md->md2.buf[j] ^ L)] & 255);
@@ -75,7 +75,7 @@ static void md2_compress(hash_state *md)
 {
 {
    int j, k;
    int j, k;
    unsigned char t;
    unsigned char t;
-   
+
    /* copy block */
    /* copy block */
    for (j = 0; j < 16; j++) {
    for (j = 0; j < 16; j++) {
        md->md2.X[16+j] = md->md2.buf[j];
        md->md2.X[16+j] = md->md2.buf[j];
@@ -122,9 +122,9 @@ int md2_process(hash_state *md, const unsigned char *in, unsigned long inlen)
     unsigned long n;
     unsigned long n;
     LTC_ARGCHK(md != NULL);
     LTC_ARGCHK(md != NULL);
     LTC_ARGCHK(in != NULL);
     LTC_ARGCHK(in != NULL);
-    if (md-> md2 .curlen > sizeof(md-> md2 .buf)) {                            
-       return CRYPT_INVALID_ARG;                                                           
-    }                                                                                       
+    if (md-> md2 .curlen > sizeof(md-> md2 .buf)) {
+       return CRYPT_INVALID_ARG;
+    }
     while (inlen > 0) {
     while (inlen > 0) {
         n = MIN(inlen, (16 - md->md2.curlen));
         n = MIN(inlen, (16 - md->md2.curlen));
         XMEMCPY(md->md2.buf + md->md2.curlen, in, (size_t)n);
         XMEMCPY(md->md2.buf + md->md2.curlen, in, (size_t)n);
@@ -186,12 +186,12 @@ int md2_done(hash_state * md, unsigned char *out)
 /**
 /**
   Self-test the hash
   Self-test the hash
   @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled
   @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled
-*/  
+*/
 int md2_test(void)
 int md2_test(void)
 {
 {
  #ifndef LTC_TEST
  #ifndef LTC_TEST
     return CRYPT_NOP;
     return CRYPT_NOP;
- #else    
+ #else
    static const struct {
    static const struct {
         char *msg;
         char *msg;
         unsigned char md[16];
         unsigned char md[16];
@@ -239,7 +239,7 @@ int md2_test(void)
           return CRYPT_FAIL_TESTVECTOR;
           return CRYPT_FAIL_TESTVECTOR;
        }
        }
    }
    }
-   return CRYPT_OK;        
+   return CRYPT_OK;
   #endif
   #endif
 }
 }
 
 

+ 68 - 68
src/hashes/md4.c

@@ -12,7 +12,7 @@
 
 
 /**
 /**
    @param md4.c
    @param md4.c
-   Submitted by Dobes Vandermeer  ([email protected]) 
+   Submitted by Dobes Vandermeer  ([email protected])
 */
 */
 
 
 #ifdef LTC_MD4
 #ifdef LTC_MD4
@@ -23,7 +23,7 @@ const struct ltc_hash_descriptor md4_desc =
     6,
     6,
     16,
     16,
     64,
     64,
- 
+
     /* OID */
     /* OID */
    { 1, 2, 840, 113549, 2, 4,  },
    { 1, 2, 840, 113549, 2, 4,  },
    6,
    6,
@@ -56,8 +56,8 @@ const struct ltc_hash_descriptor md4_desc =
 /* ROTATE_LEFT rotates x left n bits. */
 /* ROTATE_LEFT rotates x left n bits. */
 #define ROTATE_LEFT(x, n) ROLc(x, n)
 #define ROTATE_LEFT(x, n) ROLc(x, n)
 
 
-/* FF, GG and HH are transformations for rounds 1, 2 and 3 */ 
-/* Rotation is separate from addition to prevent recomputation */ 
+/* FF, GG and HH are transformations for rounds 1, 2 and 3 */
+/* Rotation is separate from addition to prevent recomputation */
 
 
 #define FF(a, b, c, d, x, s) { \
 #define FF(a, b, c, d, x, s) { \
     (a) += F ((b), (c), (d)) + (x); \
     (a) += F ((b), (c), (d)) + (x); \
@@ -91,61 +91,61 @@ static int  md4_compress(hash_state *md, unsigned char *buf)
     for (i = 0; i < 16; i++) {
     for (i = 0; i < 16; i++) {
         LOAD32L(x[i], buf + (4*i));
         LOAD32L(x[i], buf + (4*i));
     }
     }
- 
-    /* Round 1 */ 
-    FF (a, b, c, d, x[ 0], S11); /* 1 */ 
-    FF (d, a, b, c, x[ 1], S12); /* 2 */ 
-    FF (c, d, a, b, x[ 2], S13); /* 3 */ 
-    FF (b, c, d, a, x[ 3], S14); /* 4 */ 
-    FF (a, b, c, d, x[ 4], S11); /* 5 */ 
-    FF (d, a, b, c, x[ 5], S12); /* 6 */ 
-    FF (c, d, a, b, x[ 6], S13); /* 7 */ 
-    FF (b, c, d, a, x[ 7], S14); /* 8 */ 
-    FF (a, b, c, d, x[ 8], S11); /* 9 */ 
+
+    /* Round 1 */
+    FF (a, b, c, d, x[ 0], S11); /* 1 */
+    FF (d, a, b, c, x[ 1], S12); /* 2 */
+    FF (c, d, a, b, x[ 2], S13); /* 3 */
+    FF (b, c, d, a, x[ 3], S14); /* 4 */
+    FF (a, b, c, d, x[ 4], S11); /* 5 */
+    FF (d, a, b, c, x[ 5], S12); /* 6 */
+    FF (c, d, a, b, x[ 6], S13); /* 7 */
+    FF (b, c, d, a, x[ 7], S14); /* 8 */
+    FF (a, b, c, d, x[ 8], S11); /* 9 */
     FF (d, a, b, c, x[ 9], S12); /* 10 */
     FF (d, a, b, c, x[ 9], S12); /* 10 */
-    FF (c, d, a, b, x[10], S13); /* 11 */ 
+    FF (c, d, a, b, x[10], S13); /* 11 */
     FF (b, c, d, a, x[11], S14); /* 12 */
     FF (b, c, d, a, x[11], S14); /* 12 */
     FF (a, b, c, d, x[12], S11); /* 13 */
     FF (a, b, c, d, x[12], S11); /* 13 */
-    FF (d, a, b, c, x[13], S12); /* 14 */ 
-    FF (c, d, a, b, x[14], S13); /* 15 */ 
-    FF (b, c, d, a, x[15], S14); /* 16 */ 
-    
-    /* Round 2 */ 
-    GG (a, b, c, d, x[ 0], S21); /* 17 */ 
-    GG (d, a, b, c, x[ 4], S22); /* 18 */ 
-    GG (c, d, a, b, x[ 8], S23); /* 19 */ 
-    GG (b, c, d, a, x[12], S24); /* 20 */ 
-    GG (a, b, c, d, x[ 1], S21); /* 21 */ 
-    GG (d, a, b, c, x[ 5], S22); /* 22 */ 
-    GG (c, d, a, b, x[ 9], S23); /* 23 */ 
-    GG (b, c, d, a, x[13], S24); /* 24 */ 
-    GG (a, b, c, d, x[ 2], S21); /* 25 */ 
-    GG (d, a, b, c, x[ 6], S22); /* 26 */ 
-    GG (c, d, a, b, x[10], S23); /* 27 */ 
-    GG (b, c, d, a, x[14], S24); /* 28 */ 
-    GG (a, b, c, d, x[ 3], S21); /* 29 */ 
-    GG (d, a, b, c, x[ 7], S22); /* 30 */ 
-    GG (c, d, a, b, x[11], S23); /* 31 */ 
-    GG (b, c, d, a, x[15], S24); /* 32 */ 
-    
+    FF (d, a, b, c, x[13], S12); /* 14 */
+    FF (c, d, a, b, x[14], S13); /* 15 */
+    FF (b, c, d, a, x[15], S14); /* 16 */
+
+    /* Round 2 */
+    GG (a, b, c, d, x[ 0], S21); /* 17 */
+    GG (d, a, b, c, x[ 4], S22); /* 18 */
+    GG (c, d, a, b, x[ 8], S23); /* 19 */
+    GG (b, c, d, a, x[12], S24); /* 20 */
+    GG (a, b, c, d, x[ 1], S21); /* 21 */
+    GG (d, a, b, c, x[ 5], S22); /* 22 */
+    GG (c, d, a, b, x[ 9], S23); /* 23 */
+    GG (b, c, d, a, x[13], S24); /* 24 */
+    GG (a, b, c, d, x[ 2], S21); /* 25 */
+    GG (d, a, b, c, x[ 6], S22); /* 26 */
+    GG (c, d, a, b, x[10], S23); /* 27 */
+    GG (b, c, d, a, x[14], S24); /* 28 */
+    GG (a, b, c, d, x[ 3], S21); /* 29 */
+    GG (d, a, b, c, x[ 7], S22); /* 30 */
+    GG (c, d, a, b, x[11], S23); /* 31 */
+    GG (b, c, d, a, x[15], S24); /* 32 */
+
     /* Round 3 */
     /* Round 3 */
-    HH (a, b, c, d, x[ 0], S31); /* 33 */ 
-    HH (d, a, b, c, x[ 8], S32); /* 34 */ 
-    HH (c, d, a, b, x[ 4], S33); /* 35 */ 
-    HH (b, c, d, a, x[12], S34); /* 36 */ 
-    HH (a, b, c, d, x[ 2], S31); /* 37 */ 
-    HH (d, a, b, c, x[10], S32); /* 38 */ 
-    HH (c, d, a, b, x[ 6], S33); /* 39 */ 
-    HH (b, c, d, a, x[14], S34); /* 40 */ 
-    HH (a, b, c, d, x[ 1], S31); /* 41 */ 
-    HH (d, a, b, c, x[ 9], S32); /* 42 */ 
-    HH (c, d, a, b, x[ 5], S33); /* 43 */ 
-    HH (b, c, d, a, x[13], S34); /* 44 */ 
-    HH (a, b, c, d, x[ 3], S31); /* 45 */ 
-    HH (d, a, b, c, x[11], S32); /* 46 */ 
-    HH (c, d, a, b, x[ 7], S33); /* 47 */ 
-    HH (b, c, d, a, x[15], S34); /* 48 */ 
-    
+    HH (a, b, c, d, x[ 0], S31); /* 33 */
+    HH (d, a, b, c, x[ 8], S32); /* 34 */
+    HH (c, d, a, b, x[ 4], S33); /* 35 */
+    HH (b, c, d, a, x[12], S34); /* 36 */
+    HH (a, b, c, d, x[ 2], S31); /* 37 */
+    HH (d, a, b, c, x[10], S32); /* 38 */
+    HH (c, d, a, b, x[ 6], S33); /* 39 */
+    HH (b, c, d, a, x[14], S34); /* 40 */
+    HH (a, b, c, d, x[ 1], S31); /* 41 */
+    HH (d, a, b, c, x[ 9], S32); /* 42 */
+    HH (c, d, a, b, x[ 5], S33); /* 43 */
+    HH (b, c, d, a, x[13], S34); /* 44 */
+    HH (a, b, c, d, x[ 3], S31); /* 45 */
+    HH (d, a, b, c, x[11], S32); /* 46 */
+    HH (c, d, a, b, x[ 7], S33); /* 47 */
+    HH (b, c, d, a, x[15], S34); /* 48 */
+
 
 
     /* Update our state */
     /* Update our state */
     md->md4.state[0] = md->md4.state[0] + a;
     md->md4.state[0] = md->md4.state[0] + a;
@@ -242,43 +242,43 @@ int md4_done(hash_state * md, unsigned char *out)
     }
     }
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
     zeromem(md, sizeof(hash_state));
     zeromem(md, sizeof(hash_state));
-#endif 
+#endif
     return CRYPT_OK;
     return CRYPT_OK;
 }
 }
 
 
 /**
 /**
   Self-test the hash
   Self-test the hash
   @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled
   @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled
-*/  
+*/
 int md4_test(void)
 int md4_test(void)
 {
 {
  #ifndef LTC_TEST
  #ifndef LTC_TEST
     return CRYPT_NOP;
     return CRYPT_NOP;
- #else    
+ #else
     static const struct md4_test_case {
     static const struct md4_test_case {
         char *input;
         char *input;
         unsigned char digest[16];
         unsigned char digest[16];
     } cases[] = {
     } cases[] = {
-        { "", 
+        { "",
           {0x31, 0xd6, 0xcf, 0xe0, 0xd1, 0x6a, 0xe9, 0x31,
           {0x31, 0xd6, 0xcf, 0xe0, 0xd1, 0x6a, 0xe9, 0x31,
            0xb7, 0x3c, 0x59, 0xd7, 0xe0, 0xc0, 0x89, 0xc0} },
            0xb7, 0x3c, 0x59, 0xd7, 0xe0, 0xc0, 0x89, 0xc0} },
         { "a",
         { "a",
           {0xbd, 0xe5, 0x2c, 0xb3, 0x1d, 0xe3, 0x3e, 0x46,
           {0xbd, 0xe5, 0x2c, 0xb3, 0x1d, 0xe3, 0x3e, 0x46,
            0x24, 0x5e, 0x05, 0xfb, 0xdb, 0xd6, 0xfb, 0x24} },
            0x24, 0x5e, 0x05, 0xfb, 0xdb, 0xd6, 0xfb, 0x24} },
         { "abc",
         { "abc",
-          {0xa4, 0x48, 0x01, 0x7a, 0xaf, 0x21, 0xd8, 0x52, 
+          {0xa4, 0x48, 0x01, 0x7a, 0xaf, 0x21, 0xd8, 0x52,
            0x5f, 0xc1, 0x0a, 0xe8, 0x7a, 0xa6, 0x72, 0x9d} },
            0x5f, 0xc1, 0x0a, 0xe8, 0x7a, 0xa6, 0x72, 0x9d} },
-        { "message digest", 
-          {0xd9, 0x13, 0x0a, 0x81, 0x64, 0x54, 0x9f, 0xe8, 
+        { "message digest",
+          {0xd9, 0x13, 0x0a, 0x81, 0x64, 0x54, 0x9f, 0xe8,
            0x18, 0x87, 0x48, 0x06, 0xe1, 0xc7, 0x01, 0x4b} },
            0x18, 0x87, 0x48, 0x06, 0xe1, 0xc7, 0x01, 0x4b} },
-        { "abcdefghijklmnopqrstuvwxyz", 
-          {0xd7, 0x9e, 0x1c, 0x30, 0x8a, 0xa5, 0xbb, 0xcd, 
+        { "abcdefghijklmnopqrstuvwxyz",
+          {0xd7, 0x9e, 0x1c, 0x30, 0x8a, 0xa5, 0xbb, 0xcd,
            0xee, 0xa8, 0xed, 0x63, 0xdf, 0x41, 0x2d, 0xa9} },
            0xee, 0xa8, 0xed, 0x63, 0xdf, 0x41, 0x2d, 0xa9} },
-        { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", 
-          {0x04, 0x3f, 0x85, 0x82, 0xf2, 0x41, 0xdb, 0x35, 
+        { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
+          {0x04, 0x3f, 0x85, 0x82, 0xf2, 0x41, 0xdb, 0x35,
            0x1c, 0xe6, 0x27, 0xe1, 0x53, 0xe7, 0xf0, 0xe4} },
            0x1c, 0xe6, 0x27, 0xe1, 0x53, 0xe7, 0xf0, 0xe4} },
-        { "12345678901234567890123456789012345678901234567890123456789012345678901234567890", 
-          {0xe3, 0x3b, 0x4d, 0xdc, 0x9c, 0x38, 0xf2, 0x19, 
+        { "12345678901234567890123456789012345678901234567890123456789012345678901234567890",
+          {0xe3, 0x3b, 0x4d, 0xdc, 0x9c, 0x38, 0xf2, 0x19,
            0x9c, 0x3e, 0x7b, 0x16, 0x4f, 0xcc, 0x05, 0x36} },
            0x9c, 0x3e, 0x7b, 0x16, 0x4f, 0xcc, 0x05, 0x36} },
     };
     };
     int i;
     int i;

+ 15 - 15
src/hashes/md5.c

@@ -13,7 +13,7 @@
 
 
 /**
 /**
   @file md5.c
   @file md5.c
-  LTC_MD5 hash function by Tom St Denis 
+  LTC_MD5 hash function by Tom St Denis
 */
 */
 
 
 #ifdef LTC_MD5
 #ifdef LTC_MD5
@@ -95,7 +95,7 @@ static const ulong32 Korder[64] = {
     a = (a + I(b,c,d) + M + t); a = ROLc(a, s) + b;
     a = (a + I(b,c,d) + M + t); a = ROLc(a, s) + b;
 
 
 
 
-#endif   
+#endif
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
 static int _md5_compress(hash_state *md, unsigned char *buf)
 static int _md5_compress(hash_state *md, unsigned char *buf)
@@ -112,7 +112,7 @@ static int  md5_compress(hash_state *md, unsigned char *buf)
     for (i = 0; i < 16; i++) {
     for (i = 0; i < 16; i++) {
         LOAD32L(W[i], buf + (4*i));
         LOAD32L(W[i], buf + (4*i));
     }
     }
- 
+
     /* copy state */
     /* copy state */
     a = md->md5.state[0];
     a = md->md5.state[0];
     b = md->md5.state[1];
     b = md->md5.state[1];
@@ -309,37 +309,37 @@ int md5_done(hash_state * md, unsigned char *out)
 /**
 /**
   Self-test the hash
   Self-test the hash
   @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled
   @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled
-*/  
+*/
 int  md5_test(void)
 int  md5_test(void)
 {
 {
  #ifndef LTC_TEST
  #ifndef LTC_TEST
     return CRYPT_NOP;
     return CRYPT_NOP;
- #else    
+ #else
   static const struct {
   static const struct {
       char *msg;
       char *msg;
       unsigned char hash[16];
       unsigned char hash[16];
   } tests[] = {
   } tests[] = {
     { "",
     { "",
-      { 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04, 
+      { 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04,
         0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e } },
         0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e } },
     { "a",
     { "a",
-      {0x0c, 0xc1, 0x75, 0xb9, 0xc0, 0xf1, 0xb6, 0xa8, 
+      {0x0c, 0xc1, 0x75, 0xb9, 0xc0, 0xf1, 0xb6, 0xa8,
        0x31, 0xc3, 0x99, 0xe2, 0x69, 0x77, 0x26, 0x61 } },
        0x31, 0xc3, 0x99, 0xe2, 0x69, 0x77, 0x26, 0x61 } },
     { "abc",
     { "abc",
-      { 0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0, 
+      { 0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0,
         0xd6, 0x96, 0x3f, 0x7d, 0x28, 0xe1, 0x7f, 0x72 } },
         0xd6, 0x96, 0x3f, 0x7d, 0x28, 0xe1, 0x7f, 0x72 } },
-    { "message digest", 
-      { 0xf9, 0x6b, 0x69, 0x7d, 0x7c, 0xb7, 0x93, 0x8d, 
-        0x52, 0x5a, 0x2f, 0x31, 0xaa, 0xf1, 0x61, 0xd0 } }, 
+    { "message digest",
+      { 0xf9, 0x6b, 0x69, 0x7d, 0x7c, 0xb7, 0x93, 0x8d,
+        0x52, 0x5a, 0x2f, 0x31, 0xaa, 0xf1, 0x61, 0xd0 } },
     { "abcdefghijklmnopqrstuvwxyz",
     { "abcdefghijklmnopqrstuvwxyz",
-      { 0xc3, 0xfc, 0xd3, 0xd7, 0x61, 0x92, 0xe4, 0x00, 
+      { 0xc3, 0xfc, 0xd3, 0xd7, 0x61, 0x92, 0xe4, 0x00,
         0x7d, 0xfb, 0x49, 0x6c, 0xca, 0x67, 0xe1, 0x3b } },
         0x7d, 0xfb, 0x49, 0x6c, 0xca, 0x67, 0xe1, 0x3b } },
     { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
     { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
-      { 0xd1, 0x74, 0xab, 0x98, 0xd2, 0x77, 0xd9, 0xf5, 
+      { 0xd1, 0x74, 0xab, 0x98, 0xd2, 0x77, 0xd9, 0xf5,
         0xa5, 0x61, 0x1c, 0x2c, 0x9f, 0x41, 0x9d, 0x9f } },
         0xa5, 0x61, 0x1c, 0x2c, 0x9f, 0x41, 0x9d, 0x9f } },
     { "12345678901234567890123456789012345678901234567890123456789012345678901234567890",
     { "12345678901234567890123456789012345678901234567890123456789012345678901234567890",
-      { 0x57, 0xed, 0xf4, 0xa2, 0x2b, 0xe3, 0xc9, 0x55, 
-        0xac, 0x49, 0xda, 0x2e, 0x21, 0x07, 0xb6, 0x7a } }, 
+      { 0x57, 0xed, 0xf4, 0xa2, 0x2b, 0xe3, 0xc9, 0x55,
+        0xac, 0x49, 0xda, 0x2e, 0x21, 0x07, 0xb6, 0x7a } },
     { NULL, { 0 } }
     { NULL, { 0 } }
   };
   };
 
 

+ 11 - 11
src/hashes/rmd128.c

@@ -13,7 +13,7 @@
 /**
 /**
    @param rmd128.c
    @param rmd128.c
    RMD128 Hash function
    RMD128 Hash function
-*/   
+*/
 
 
 /* Implementation of LTC_RIPEMD-128 based on the source by Antoon Bosselaers, ESAT-COSIC
 /* Implementation of LTC_RIPEMD-128 based on the source by Antoon Bosselaers, ESAT-COSIC
  *
  *
@@ -42,11 +42,11 @@ const struct ltc_hash_descriptor rmd128_desc =
 };
 };
 
 
 /* the four basic functions F(), G() and H() */
 /* the four basic functions F(), G() and H() */
-#define F(x, y, z)        ((x) ^ (y) ^ (z)) 
-#define G(x, y, z)        (((x) & (y)) | (~(x) & (z))) 
+#define F(x, y, z)        ((x) ^ (y) ^ (z))
+#define G(x, y, z)        (((x) & (y)) | (~(x) & (z)))
 #define H(x, y, z)        (((x) | ~(y)) ^ (z))
 #define H(x, y, z)        (((x) | ~(y)) ^ (z))
-#define I(x, y, z)        (((x) & (z)) | ((y) & ~(z))) 
-  
+#define I(x, y, z)        (((x) & (z)) | ((y) & ~(z)))
+
 /* the eight basic operations FF() through III() */
 /* the eight basic operations FF() through III() */
 #define FF(a, b, c, d, x, s)        \
 #define FF(a, b, c, d, x, s)        \
       (a) += F((b), (c), (d)) + (x);\
       (a) += F((b), (c), (d)) + (x);\
@@ -88,7 +88,7 @@ static int  rmd128_compress(hash_state *md, unsigned char *buf)
 {
 {
    ulong32 aa,bb,cc,dd,aaa,bbb,ccc,ddd,X[16];
    ulong32 aa,bb,cc,dd,aaa,bbb,ccc,ddd,X[16];
    int i;
    int i;
-   
+
    /* load words X */
    /* load words X */
    for (i = 0; i < 16; i++){
    for (i = 0; i < 16; i++){
       LOAD32L(X[i], buf + (4 * i));
       LOAD32L(X[i], buf + (4 * i));
@@ -117,7 +117,7 @@ static int  rmd128_compress(hash_state *md, unsigned char *buf)
    FF(dd, aa, bb, cc, X[13],  7);
    FF(dd, aa, bb, cc, X[13],  7);
    FF(cc, dd, aa, bb, X[14],  9);
    FF(cc, dd, aa, bb, X[14],  9);
    FF(bb, cc, dd, aa, X[15],  8);
    FF(bb, cc, dd, aa, X[15],  8);
-                             
+
    /* round 2 */
    /* round 2 */
    GG(aa, bb, cc, dd, X[ 7],  7);
    GG(aa, bb, cc, dd, X[ 7],  7);
    GG(dd, aa, bb, cc, X[ 4],  6);
    GG(dd, aa, bb, cc, X[ 4],  6);
@@ -173,7 +173,7 @@ static int  rmd128_compress(hash_state *md, unsigned char *buf)
    II(bb, cc, dd, aa, X[ 2], 12);
    II(bb, cc, dd, aa, X[ 2], 12);
 
 
    /* parallel round 1 */
    /* parallel round 1 */
-   III(aaa, bbb, ccc, ddd, X[ 5],  8); 
+   III(aaa, bbb, ccc, ddd, X[ 5],  8);
    III(ddd, aaa, bbb, ccc, X[14],  9);
    III(ddd, aaa, bbb, ccc, X[14],  9);
    III(ccc, ddd, aaa, bbb, X[ 7],  9);
    III(ccc, ddd, aaa, bbb, X[ 7],  9);
    III(bbb, ccc, ddd, aaa, X[ 0], 11);
    III(bbb, ccc, ddd, aaa, X[ 0], 11);
@@ -208,7 +208,7 @@ static int  rmd128_compress(hash_state *md, unsigned char *buf)
    HHH(ccc, ddd, aaa, bbb, X[ 1], 13);
    HHH(ccc, ddd, aaa, bbb, X[ 1], 13);
    HHH(bbb, ccc, ddd, aaa, X[ 2], 11);
    HHH(bbb, ccc, ddd, aaa, X[ 2], 11);
 
 
-   /* parallel round 3 */   
+   /* parallel round 3 */
    GGG(aaa, bbb, ccc, ddd, X[15],  9);
    GGG(aaa, bbb, ccc, ddd, X[15],  9);
    GGG(ddd, aaa, bbb, ccc, X[ 5],  7);
    GGG(ddd, aaa, bbb, ccc, X[ 5],  7);
    GGG(ccc, ddd, aaa, bbb, X[ 1], 15);
    GGG(ccc, ddd, aaa, bbb, X[ 1], 15);
@@ -342,13 +342,13 @@ int rmd128_done(hash_state * md, unsigned char *out)
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
     zeromem(md, sizeof(hash_state));
     zeromem(md, sizeof(hash_state));
 #endif
 #endif
-   return CRYPT_OK;  
+   return CRYPT_OK;
 }
 }
 
 
 /**
 /**
   Self-test the hash
   Self-test the hash
   @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled
   @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled
-*/  
+*/
 int rmd128_test(void)
 int rmd128_test(void)
 {
 {
 #ifndef LTC_TEST
 #ifndef LTC_TEST

+ 9 - 9
src/hashes/rmd160.c

@@ -13,7 +13,7 @@
 /**
 /**
    @file rmd160.c
    @file rmd160.c
    RMD160 hash function
    RMD160 hash function
-*/   
+*/
 
 
 /* Implementation of LTC_RIPEMD-160 based on the source by Antoon Bosselaers, ESAT-COSIC
 /* Implementation of LTC_RIPEMD-160 based on the source by Antoon Bosselaers, ESAT-COSIC
  *
  *
@@ -42,12 +42,12 @@ const struct ltc_hash_descriptor rmd160_desc =
 };
 };
 
 
 /* the five basic functions F(), G() and H() */
 /* the five basic functions F(), G() and H() */
-#define F(x, y, z)        ((x) ^ (y) ^ (z)) 
-#define G(x, y, z)        (((x) & (y)) | (~(x) & (z))) 
+#define F(x, y, z)        ((x) ^ (y) ^ (z))
+#define G(x, y, z)        (((x) & (y)) | (~(x) & (z)))
 #define H(x, y, z)        (((x) | ~(y)) ^ (z))
 #define H(x, y, z)        (((x) | ~(y)) ^ (z))
-#define I(x, y, z)        (((x) & (z)) | ((y) & ~(z))) 
+#define I(x, y, z)        (((x) & (z)) | ((y) & ~(z)))
 #define J(x, y, z)        ((x) ^ ((y) | ~(z)))
 #define J(x, y, z)        ((x) ^ ((y) | ~(z)))
-  
+
 /* the ten basic operations FF() through III() */
 /* the ten basic operations FF() through III() */
 #define FF(a, b, c, d, e, x, s)        \
 #define FF(a, b, c, d, e, x, s)        \
       (a) += F((b), (c), (d)) + (x);\
       (a) += F((b), (c), (d)) + (x);\
@@ -138,7 +138,7 @@ static int  rmd160_compress(hash_state *md, unsigned char *buf)
    FF(cc, dd, ee, aa, bb, X[13],  7);
    FF(cc, dd, ee, aa, bb, X[13],  7);
    FF(bb, cc, dd, ee, aa, X[14],  9);
    FF(bb, cc, dd, ee, aa, X[14],  9);
    FF(aa, bb, cc, dd, ee, X[15],  8);
    FF(aa, bb, cc, dd, ee, X[15],  8);
-                             
+
    /* round 2 */
    /* round 2 */
    GG(ee, aa, bb, cc, dd, X[ 7],  7);
    GG(ee, aa, bb, cc, dd, X[ 7],  7);
    GG(dd, ee, aa, bb, cc, X[ 4],  6);
    GG(dd, ee, aa, bb, cc, X[ 4],  6);
@@ -230,7 +230,7 @@ static int  rmd160_compress(hash_state *md, unsigned char *buf)
    JJJ(aaa, bbb, ccc, ddd, eee, X[12],  6);
    JJJ(aaa, bbb, ccc, ddd, eee, X[12],  6);
 
 
    /* parallel round 2 */
    /* parallel round 2 */
-   III(eee, aaa, bbb, ccc, ddd, X[ 6],  9); 
+   III(eee, aaa, bbb, ccc, ddd, X[ 6],  9);
    III(ddd, eee, aaa, bbb, ccc, X[11], 13);
    III(ddd, eee, aaa, bbb, ccc, X[11], 13);
    III(ccc, ddd, eee, aaa, bbb, X[ 3], 15);
    III(ccc, ddd, eee, aaa, bbb, X[ 3], 15);
    III(bbb, ccc, ddd, eee, aaa, X[ 7],  7);
    III(bbb, ccc, ddd, eee, aaa, X[ 7],  7);
@@ -265,7 +265,7 @@ static int  rmd160_compress(hash_state *md, unsigned char *buf)
    HHH(eee, aaa, bbb, ccc, ddd, X[ 4],  7);
    HHH(eee, aaa, bbb, ccc, ddd, X[ 4],  7);
    HHH(ddd, eee, aaa, bbb, ccc, X[13],  5);
    HHH(ddd, eee, aaa, bbb, ccc, X[13],  5);
 
 
-   /* parallel round 4 */   
+   /* parallel round 4 */
    GGG(ccc, ddd, eee, aaa, bbb, X[ 8], 15);
    GGG(ccc, ddd, eee, aaa, bbb, X[ 8], 15);
    GGG(bbb, ccc, ddd, eee, aaa, X[ 6],  5);
    GGG(bbb, ccc, ddd, eee, aaa, X[ 6],  5);
    GGG(aaa, bbb, ccc, ddd, eee, X[ 4],  8);
    GGG(aaa, bbb, ccc, ddd, eee, X[ 4],  8);
@@ -407,7 +407,7 @@ int rmd160_done(hash_state * md, unsigned char *out)
 /**
 /**
   Self-test the hash
   Self-test the hash
   @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled
   @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled
-*/  
+*/
 int rmd160_test(void)
 int rmd160_test(void)
 {
 {
 #ifndef LTC_TEST
 #ifndef LTC_TEST

+ 9 - 9
src/hashes/sha1.c

@@ -12,7 +12,7 @@
 
 
 /**
 /**
   @file sha1.c
   @file sha1.c
-  LTC_SHA1 code by Tom St Denis 
+  LTC_SHA1 code by Tom St Denis
 */
 */
 
 
 
 
@@ -66,7 +66,7 @@ static int  sha1_compress(hash_state *md, unsigned char *buf)
 
 
     /* expand it */
     /* expand it */
     for (i = 16; i < 80; i++) {
     for (i = 16; i < 80; i++) {
-        W[i] = ROL(W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16], 1); 
+        W[i] = ROL(W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16], 1);
     }
     }
 
 
     /* compress */
     /* compress */
@@ -75,9 +75,9 @@ static int  sha1_compress(hash_state *md, unsigned char *buf)
     #define FF1(a,b,c,d,e,i) e = (ROLc(a, 5) + F1(b,c,d) + e + W[i] + 0x6ed9eba1UL); b = ROLc(b, 30);
     #define FF1(a,b,c,d,e,i) e = (ROLc(a, 5) + F1(b,c,d) + e + W[i] + 0x6ed9eba1UL); b = ROLc(b, 30);
     #define FF2(a,b,c,d,e,i) e = (ROLc(a, 5) + F2(b,c,d) + e + W[i] + 0x8f1bbcdcUL); b = ROLc(b, 30);
     #define FF2(a,b,c,d,e,i) e = (ROLc(a, 5) + F2(b,c,d) + e + W[i] + 0x8f1bbcdcUL); b = ROLc(b, 30);
     #define FF3(a,b,c,d,e,i) e = (ROLc(a, 5) + F3(b,c,d) + e + W[i] + 0xca62c1d6UL); b = ROLc(b, 30);
     #define FF3(a,b,c,d,e,i) e = (ROLc(a, 5) + F3(b,c,d) + e + W[i] + 0xca62c1d6UL); b = ROLc(b, 30);
- 
+
 #ifdef LTC_SMALL_CODE
 #ifdef LTC_SMALL_CODE
- 
+
     for (i = 0; i < 20; ) {
     for (i = 0; i < 20; ) {
        FF0(a,b,c,d,e,i++); t = e; e = d; d = c; c = b; b = a; a = t;
        FF0(a,b,c,d,e,i++); t = e; e = d; d = c; c = b; b = a; a = t;
     }
     }
@@ -105,7 +105,7 @@ static int  sha1_compress(hash_state *md, unsigned char *buf)
     }
     }
 
 
     /* round two */
     /* round two */
-    for (; i < 40; )  { 
+    for (; i < 40; )  {
        FF1(a,b,c,d,e,i++);
        FF1(a,b,c,d,e,i++);
        FF1(e,a,b,c,d,i++);
        FF1(e,a,b,c,d,i++);
        FF1(d,e,a,b,c,i++);
        FF1(d,e,a,b,c,i++);
@@ -114,7 +114,7 @@ static int  sha1_compress(hash_state *md, unsigned char *buf)
     }
     }
 
 
     /* round three */
     /* round three */
-    for (; i < 60; )  { 
+    for (; i < 60; )  {
        FF2(a,b,c,d,e,i++);
        FF2(a,b,c,d,e,i++);
        FF2(e,a,b,c,d,i++);
        FF2(e,a,b,c,d,i++);
        FF2(d,e,a,b,c,i++);
        FF2(d,e,a,b,c,i++);
@@ -123,7 +123,7 @@ static int  sha1_compress(hash_state *md, unsigned char *buf)
     }
     }
 
 
     /* round four */
     /* round four */
-    for (; i < 80; )  { 
+    for (; i < 80; )  {
        FF3(a,b,c,d,e,i++);
        FF3(a,b,c,d,e,i++);
        FF3(e,a,b,c,d,i++);
        FF3(e,a,b,c,d,i++);
        FF3(d,e,a,b,c,i++);
        FF3(d,e,a,b,c,i++);
@@ -241,12 +241,12 @@ int sha1_done(hash_state * md, unsigned char *out)
 /**
 /**
   Self-test the hash
   Self-test the hash
   @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled
   @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled
-*/  
+*/
 int  sha1_test(void)
 int  sha1_test(void)
 {
 {
  #ifndef LTC_TEST
  #ifndef LTC_TEST
     return CRYPT_NOP;
     return CRYPT_NOP;
- #else    
+ #else
   static const struct {
   static const struct {
       char *msg;
       char *msg;
       unsigned char hash[20];
       unsigned char hash[20];

+ 15 - 15
src/hashes/sha2/sha256.c

@@ -12,10 +12,10 @@
 
 
 /**
 /**
   @file sha256.c
   @file sha256.c
-  LTC_SHA256 by Tom St Denis 
+  LTC_SHA256 by Tom St Denis
 */
 */
 
 
-#ifdef LTC_SHA256 
+#ifdef LTC_SHA256
 
 
 const struct ltc_hash_descriptor sha256_desc =
 const struct ltc_hash_descriptor sha256_desc =
 {
 {
@@ -56,7 +56,7 @@ static const ulong32 K[64] = {
 
 
 /* Various logical functions */
 /* Various logical functions */
 #define Ch(x,y,z)       (z ^ (x & (y ^ z)))
 #define Ch(x,y,z)       (z ^ (x & (y ^ z)))
-#define Maj(x,y,z)      (((x | y) & z) | (x & y)) 
+#define Maj(x,y,z)      (((x | y) & z) | (x & y))
 #define S(x, n)         RORc((x),(n))
 #define S(x, n)         RORc((x),(n))
 #define R(x, n)         (((x)&0xFFFFFFFFUL)>>(n))
 #define R(x, n)         (((x)&0xFFFFFFFFUL)>>(n))
 #define Sigma0(x)       (S(x, 2) ^ S(x, 13) ^ S(x, 22))
 #define Sigma0(x)       (S(x, 2) ^ S(x, 13) ^ S(x, 22))
@@ -90,10 +90,10 @@ static int  sha256_compress(hash_state * md, unsigned char *buf)
     /* fill W[16..63] */
     /* fill W[16..63] */
     for (i = 16; i < 64; i++) {
     for (i = 16; i < 64; i++) {
         W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16];
         W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16];
-    }        
+    }
 
 
     /* Compress */
     /* Compress */
-#ifdef LTC_SMALL_CODE   
+#ifdef LTC_SMALL_CODE
 #define RND(a,b,c,d,e,f,g,h,i)                         \
 #define RND(a,b,c,d,e,f,g,h,i)                         \
      t0 = h + Sigma1(e) + Ch(e, f, g) + K[i] + W[i];   \
      t0 = h + Sigma1(e) + Ch(e, f, g) + K[i] + W[i];   \
      t1 = Sigma0(a) + Maj(a, b, c);                    \
      t1 = Sigma0(a) + Maj(a, b, c);                    \
@@ -102,10 +102,10 @@ static int  sha256_compress(hash_state * md, unsigned char *buf)
 
 
      for (i = 0; i < 64; ++i) {
      for (i = 0; i < 64; ++i) {
          RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],i);
          RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],i);
-         t = S[7]; S[7] = S[6]; S[6] = S[5]; S[5] = S[4]; 
+         t = S[7]; S[7] = S[6]; S[6] = S[5]; S[5] = S[4];
          S[4] = S[3]; S[3] = S[2]; S[2] = S[1]; S[1] = S[0]; S[0] = t;
          S[4] = S[3]; S[3] = S[2]; S[2] = S[1]; S[1] = S[0]; S[0] = t;
-     }  
-#else 
+     }
+#else
 #define RND(a,b,c,d,e,f,g,h,i,ki)                    \
 #define RND(a,b,c,d,e,f,g,h,i,ki)                    \
      t0 = h + Sigma1(e) + Ch(e, f, g) + ki + W[i];   \
      t0 = h + Sigma1(e) + Ch(e, f, g) + ki + W[i];   \
      t1 = Sigma0(a) + Maj(a, b, c);                  \
      t1 = Sigma0(a) + Maj(a, b, c);                  \
@@ -177,9 +177,9 @@ static int  sha256_compress(hash_state * md, unsigned char *buf)
     RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],62,0xbef9a3f7);
     RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],62,0xbef9a3f7);
     RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],63,0xc67178f2);
     RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],63,0xc67178f2);
 
 
-#undef RND     
-    
-#endif     
+#undef RND
+
+#endif
 
 
     /* feedback */
     /* feedback */
     for (i = 0; i < 8; i++) {
     for (i = 0; i < 8; i++) {
@@ -287,12 +287,12 @@ int sha256_done(hash_state * md, unsigned char *out)
 /**
 /**
   Self-test the hash
   Self-test the hash
   @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled
   @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled
-*/  
+*/
 int  sha256_test(void)
 int  sha256_test(void)
 {
 {
  #ifndef LTC_TEST
  #ifndef LTC_TEST
     return CRYPT_NOP;
     return CRYPT_NOP;
- #else    
+ #else
   static const struct {
   static const struct {
       char *msg;
       char *msg;
       unsigned char hash[32];
       unsigned char hash[32];
@@ -304,9 +304,9 @@ int  sha256_test(void)
         0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad }
         0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad }
     },
     },
     { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
     { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
-      { 0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8, 
+      { 0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8,
         0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39,
         0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39,
-        0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67, 
+        0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67,
         0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1 }
         0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1 }
     },
     },
   };
   };

+ 26 - 26
src/hashes/sha2/sha512.c

@@ -12,7 +12,7 @@
 
 
 /**
 /**
    @param sha512.c
    @param sha512.c
-   LTC_SHA512 by Tom St Denis 
+   LTC_SHA512 by Tom St Denis
 */
 */
 
 
 #ifdef LTC_SHA512
 #ifdef LTC_SHA512
@@ -37,51 +37,51 @@ const struct ltc_hash_descriptor sha512_desc =
 
 
 /* the K array */
 /* the K array */
 static const ulong64 K[80] = {
 static const ulong64 K[80] = {
-CONST64(0x428a2f98d728ae22), CONST64(0x7137449123ef65cd), 
+CONST64(0x428a2f98d728ae22), CONST64(0x7137449123ef65cd),
 CONST64(0xb5c0fbcfec4d3b2f), CONST64(0xe9b5dba58189dbbc),
 CONST64(0xb5c0fbcfec4d3b2f), CONST64(0xe9b5dba58189dbbc),
-CONST64(0x3956c25bf348b538), CONST64(0x59f111f1b605d019), 
+CONST64(0x3956c25bf348b538), CONST64(0x59f111f1b605d019),
 CONST64(0x923f82a4af194f9b), CONST64(0xab1c5ed5da6d8118),
 CONST64(0x923f82a4af194f9b), CONST64(0xab1c5ed5da6d8118),
-CONST64(0xd807aa98a3030242), CONST64(0x12835b0145706fbe), 
+CONST64(0xd807aa98a3030242), CONST64(0x12835b0145706fbe),
 CONST64(0x243185be4ee4b28c), CONST64(0x550c7dc3d5ffb4e2),
 CONST64(0x243185be4ee4b28c), CONST64(0x550c7dc3d5ffb4e2),
-CONST64(0x72be5d74f27b896f), CONST64(0x80deb1fe3b1696b1), 
+CONST64(0x72be5d74f27b896f), CONST64(0x80deb1fe3b1696b1),
 CONST64(0x9bdc06a725c71235), CONST64(0xc19bf174cf692694),
 CONST64(0x9bdc06a725c71235), CONST64(0xc19bf174cf692694),
-CONST64(0xe49b69c19ef14ad2), CONST64(0xefbe4786384f25e3), 
+CONST64(0xe49b69c19ef14ad2), CONST64(0xefbe4786384f25e3),
 CONST64(0x0fc19dc68b8cd5b5), CONST64(0x240ca1cc77ac9c65),
 CONST64(0x0fc19dc68b8cd5b5), CONST64(0x240ca1cc77ac9c65),
-CONST64(0x2de92c6f592b0275), CONST64(0x4a7484aa6ea6e483), 
+CONST64(0x2de92c6f592b0275), CONST64(0x4a7484aa6ea6e483),
 CONST64(0x5cb0a9dcbd41fbd4), CONST64(0x76f988da831153b5),
 CONST64(0x5cb0a9dcbd41fbd4), CONST64(0x76f988da831153b5),
-CONST64(0x983e5152ee66dfab), CONST64(0xa831c66d2db43210), 
+CONST64(0x983e5152ee66dfab), CONST64(0xa831c66d2db43210),
 CONST64(0xb00327c898fb213f), CONST64(0xbf597fc7beef0ee4),
 CONST64(0xb00327c898fb213f), CONST64(0xbf597fc7beef0ee4),
-CONST64(0xc6e00bf33da88fc2), CONST64(0xd5a79147930aa725), 
+CONST64(0xc6e00bf33da88fc2), CONST64(0xd5a79147930aa725),
 CONST64(0x06ca6351e003826f), CONST64(0x142929670a0e6e70),
 CONST64(0x06ca6351e003826f), CONST64(0x142929670a0e6e70),
-CONST64(0x27b70a8546d22ffc), CONST64(0x2e1b21385c26c926), 
+CONST64(0x27b70a8546d22ffc), CONST64(0x2e1b21385c26c926),
 CONST64(0x4d2c6dfc5ac42aed), CONST64(0x53380d139d95b3df),
 CONST64(0x4d2c6dfc5ac42aed), CONST64(0x53380d139d95b3df),
-CONST64(0x650a73548baf63de), CONST64(0x766a0abb3c77b2a8), 
+CONST64(0x650a73548baf63de), CONST64(0x766a0abb3c77b2a8),
 CONST64(0x81c2c92e47edaee6), CONST64(0x92722c851482353b),
 CONST64(0x81c2c92e47edaee6), CONST64(0x92722c851482353b),
 CONST64(0xa2bfe8a14cf10364), CONST64(0xa81a664bbc423001),
 CONST64(0xa2bfe8a14cf10364), CONST64(0xa81a664bbc423001),
 CONST64(0xc24b8b70d0f89791), CONST64(0xc76c51a30654be30),
 CONST64(0xc24b8b70d0f89791), CONST64(0xc76c51a30654be30),
-CONST64(0xd192e819d6ef5218), CONST64(0xd69906245565a910), 
+CONST64(0xd192e819d6ef5218), CONST64(0xd69906245565a910),
 CONST64(0xf40e35855771202a), CONST64(0x106aa07032bbd1b8),
 CONST64(0xf40e35855771202a), CONST64(0x106aa07032bbd1b8),
-CONST64(0x19a4c116b8d2d0c8), CONST64(0x1e376c085141ab53), 
+CONST64(0x19a4c116b8d2d0c8), CONST64(0x1e376c085141ab53),
 CONST64(0x2748774cdf8eeb99), CONST64(0x34b0bcb5e19b48a8),
 CONST64(0x2748774cdf8eeb99), CONST64(0x34b0bcb5e19b48a8),
-CONST64(0x391c0cb3c5c95a63), CONST64(0x4ed8aa4ae3418acb), 
+CONST64(0x391c0cb3c5c95a63), CONST64(0x4ed8aa4ae3418acb),
 CONST64(0x5b9cca4f7763e373), CONST64(0x682e6ff3d6b2b8a3),
 CONST64(0x5b9cca4f7763e373), CONST64(0x682e6ff3d6b2b8a3),
-CONST64(0x748f82ee5defb2fc), CONST64(0x78a5636f43172f60), 
+CONST64(0x748f82ee5defb2fc), CONST64(0x78a5636f43172f60),
 CONST64(0x84c87814a1f0ab72), CONST64(0x8cc702081a6439ec),
 CONST64(0x84c87814a1f0ab72), CONST64(0x8cc702081a6439ec),
-CONST64(0x90befffa23631e28), CONST64(0xa4506cebde82bde9), 
+CONST64(0x90befffa23631e28), CONST64(0xa4506cebde82bde9),
 CONST64(0xbef9a3f7b2c67915), CONST64(0xc67178f2e372532b),
 CONST64(0xbef9a3f7b2c67915), CONST64(0xc67178f2e372532b),
-CONST64(0xca273eceea26619c), CONST64(0xd186b8c721c0c207), 
+CONST64(0xca273eceea26619c), CONST64(0xd186b8c721c0c207),
 CONST64(0xeada7dd6cde0eb1e), CONST64(0xf57d4f7fee6ed178),
 CONST64(0xeada7dd6cde0eb1e), CONST64(0xf57d4f7fee6ed178),
-CONST64(0x06f067aa72176fba), CONST64(0x0a637dc5a2c898a6), 
+CONST64(0x06f067aa72176fba), CONST64(0x0a637dc5a2c898a6),
 CONST64(0x113f9804bef90dae), CONST64(0x1b710b35131c471b),
 CONST64(0x113f9804bef90dae), CONST64(0x1b710b35131c471b),
-CONST64(0x28db77f523047d84), CONST64(0x32caab7b40c72493), 
+CONST64(0x28db77f523047d84), CONST64(0x32caab7b40c72493),
 CONST64(0x3c9ebe0a15c9bebc), CONST64(0x431d67c49c100d4c),
 CONST64(0x3c9ebe0a15c9bebc), CONST64(0x431d67c49c100d4c),
-CONST64(0x4cc5d4becb3e42b6), CONST64(0x597f299cfc657e2a), 
+CONST64(0x4cc5d4becb3e42b6), CONST64(0x597f299cfc657e2a),
 CONST64(0x5fcb6fab3ad6faec), CONST64(0x6c44198c4a475817)
 CONST64(0x5fcb6fab3ad6faec), CONST64(0x6c44198c4a475817)
 };
 };
 
 
 /* Various logical functions */
 /* Various logical functions */
 #define Ch(x,y,z)       (z ^ (x & (y ^ z)))
 #define Ch(x,y,z)       (z ^ (x & (y ^ z)))
-#define Maj(x,y,z)      (((x | y) & z) | (x & y)) 
+#define Maj(x,y,z)      (((x | y) & z) | (x & y))
 #define S(x, n)         ROR64c(x, n)
 #define S(x, n)         ROR64c(x, n)
 #define R(x, n)         (((x)&CONST64(0xFFFFFFFFFFFFFFFF))>>((ulong64)n))
 #define R(x, n)         (((x)&CONST64(0xFFFFFFFFFFFFFFFF))>>((ulong64)n))
 #define Sigma0(x)       (S(x, 28) ^ S(x, 34) ^ S(x, 39))
 #define Sigma0(x)       (S(x, 28) ^ S(x, 34) ^ S(x, 39))
@@ -112,7 +112,7 @@ static int  sha512_compress(hash_state * md, unsigned char *buf)
     /* fill W[16..79] */
     /* fill W[16..79] */
     for (i = 16; i < 80; i++) {
     for (i = 16; i < 80; i++) {
         W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16];
         W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16];
-    }        
+    }
 
 
     /* Compress */
     /* Compress */
 #ifdef LTC_SMALL_CODE
 #ifdef LTC_SMALL_CODE
@@ -145,7 +145,7 @@ static int  sha512_compress(hash_state * md, unsigned char *buf)
         RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],i+6);
         RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],i+6);
         RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],i+7);
         RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],i+7);
     }
     }
-#endif     
+#endif
 
 
 
 
     /* feedback */
     /* feedback */
@@ -232,7 +232,7 @@ int sha512_done(hash_state * md, unsigned char *out)
         md->sha512.curlen = 0;
         md->sha512.curlen = 0;
     }
     }
 
 
-    /* pad upto 120 bytes of zeroes 
+    /* pad upto 120 bytes of zeroes
      * note: that from 112 to 120 is the 64 MSB of the length.  We assume that you won't hash
      * note: that from 112 to 120 is the 64 MSB of the length.  We assume that you won't hash
      * > 2^64 bits of data... :-)
      * > 2^64 bits of data... :-)
      */
      */
@@ -257,12 +257,12 @@ int sha512_done(hash_state * md, unsigned char *out)
 /**
 /**
   Self-test the hash
   Self-test the hash
   @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled
   @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled
-*/  
+*/
 int  sha512_test(void)
 int  sha512_test(void)
 {
 {
  #ifndef LTC_TEST
  #ifndef LTC_TEST
     return CRYPT_NOP;
     return CRYPT_NOP;
- #else    
+ #else
   static const struct {
   static const struct {
       char *msg;
       char *msg;
       unsigned char hash[64];
       unsigned char hash[64];

+ 34 - 34
src/hashes/tiger.c

@@ -558,16 +558,16 @@ static const ulong64 table[4*256] = {
 #ifdef _MSC_VER
 #ifdef _MSC_VER
    #define INLINE __inline
    #define INLINE __inline
 #else
 #else
-   #define INLINE 
-#endif   
+   #define INLINE
+#endif
 
 
 /* one round of the hash function */
 /* one round of the hash function */
 INLINE static void tiger_round(ulong64 *a, ulong64 *b, ulong64 *c, ulong64 x, int mul)
 INLINE static void tiger_round(ulong64 *a, ulong64 *b, ulong64 *c, ulong64 x, int mul)
 {
 {
     ulong64 tmp;
     ulong64 tmp;
-    tmp = (*c ^= x); 
-           *a -= t1[byte(tmp, 0)] ^ t2[byte(tmp, 2)] ^ t3[byte(tmp, 4)] ^ t4[byte(tmp, 6)];      
-    tmp = (*b += t4[byte(tmp, 1)] ^ t3[byte(tmp, 3)] ^ t2[byte(tmp,5)] ^ t1[byte(tmp,7)]); 
+    tmp = (*c ^= x);
+           *a -= t1[byte(tmp, 0)] ^ t2[byte(tmp, 2)] ^ t3[byte(tmp, 4)] ^ t4[byte(tmp, 6)];
+    tmp = (*b += t4[byte(tmp, 1)] ^ t3[byte(tmp, 3)] ^ t2[byte(tmp,5)] ^ t1[byte(tmp,7)]);
     switch (mul) {
     switch (mul) {
         case 5:  *b = (tmp << 2) + tmp; break;
         case 5:  *b = (tmp << 2) + tmp; break;
         case 7:  *b = (tmp << 3) - tmp; break;
         case 7:  *b = (tmp << 3) - tmp; break;
@@ -578,36 +578,36 @@ INLINE static void tiger_round(ulong64 *a, ulong64 *b, ulong64 *c, ulong64 x, in
 /* one complete pass */
 /* one complete pass */
 static void pass(ulong64 *a, ulong64 *b, ulong64 *c, ulong64 *x, int mul)
 static void pass(ulong64 *a, ulong64 *b, ulong64 *c, ulong64 *x, int mul)
 {
 {
-   tiger_round(a,b,c,x[0],mul); 
-   tiger_round(b,c,a,x[1],mul); 
-   tiger_round(c,a,b,x[2],mul); 
-   tiger_round(a,b,c,x[3],mul); 
-   tiger_round(b,c,a,x[4],mul); 
-   tiger_round(c,a,b,x[5],mul); 
-   tiger_round(a,b,c,x[6],mul); 
-   tiger_round(b,c,a,x[7],mul);          
-}   
+   tiger_round(a,b,c,x[0],mul);
+   tiger_round(b,c,a,x[1],mul);
+   tiger_round(c,a,b,x[2],mul);
+   tiger_round(a,b,c,x[3],mul);
+   tiger_round(b,c,a,x[4],mul);
+   tiger_round(c,a,b,x[5],mul);
+   tiger_round(a,b,c,x[6],mul);
+   tiger_round(b,c,a,x[7],mul);
+}
 
 
 /* The key mixing schedule */
 /* The key mixing schedule */
-static void key_schedule(ulong64 *x) 
+static void key_schedule(ulong64 *x)
 {
 {
-    x[0] -= x[7] ^ CONST64(0xA5A5A5A5A5A5A5A5); 
-    x[1] ^= x[0];                               
-    x[2] += x[1];                               
-    x[3] -= x[2] ^ ((~x[1])<<19);               
-    x[4] ^= x[3];                               
-    x[5] += x[4];                               
-    x[6] -= x[5] ^ ((~x[4])>>23);               
-    x[7] ^= x[6];                               
-    x[0] += x[7];                               
-    x[1] -= x[0] ^ ((~x[7])<<19);               
-    x[2] ^= x[1];                               
-    x[3] += x[2];                               
-    x[4] -= x[3] ^ ((~x[2])>>23);               
-    x[5] ^= x[4];                               
-    x[6] += x[5];                               
+    x[0] -= x[7] ^ CONST64(0xA5A5A5A5A5A5A5A5);
+    x[1] ^= x[0];
+    x[2] += x[1];
+    x[3] -= x[2] ^ ((~x[1])<<19);
+    x[4] ^= x[3];
+    x[5] += x[4];
+    x[6] -= x[5] ^ ((~x[4])>>23);
+    x[7] ^= x[6];
+    x[0] += x[7];
+    x[1] -= x[0] ^ ((~x[7])<<19);
+    x[2] ^= x[1];
+    x[3] += x[2];
+    x[4] -= x[3] ^ ((~x[2])>>23);
+    x[5] ^= x[4];
+    x[6] += x[5];
     x[7] -= x[6] ^ CONST64(0x0123456789ABCDEF);
     x[7] -= x[6] ^ CONST64(0x0123456789ABCDEF);
-}    
+}
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
 static int _tiger_compress(hash_state *md, unsigned char *buf)
 static int _tiger_compress(hash_state *md, unsigned char *buf)
@@ -709,7 +709,7 @@ int tiger_done(hash_state * md, unsigned char *out)
 
 
     /* pad upto 56 bytes of zeroes */
     /* pad upto 56 bytes of zeroes */
     while (md->tiger.curlen < 56) {
     while (md->tiger.curlen < 56) {
-        md->tiger.buf[md->tiger.curlen++] = (unsigned char)0; 
+        md->tiger.buf[md->tiger.curlen++] = (unsigned char)0;
     }
     }
 
 
     /* store length */
     /* store length */
@@ -730,12 +730,12 @@ int tiger_done(hash_state * md, unsigned char *out)
 /**
 /**
   Self-test the hash
   Self-test the hash
   @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled
   @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled
-*/  
+*/
 int  tiger_test(void)
 int  tiger_test(void)
 {
 {
  #ifndef LTC_TEST
  #ifndef LTC_TEST
     return CRYPT_NOP;
     return CRYPT_NOP;
- #else    
+ #else
   static const struct {
   static const struct {
       char *msg;
       char *msg;
       unsigned char hash[24];
       unsigned char hash[24];

+ 1 - 1
src/mac/f9/f9_done.c

@@ -62,7 +62,7 @@ int f9_done(f9_state *f9, unsigned char *out, unsigned long *outlen)
       out[x] = f9->ACC[x];
       out[x] = f9->ACC[x];
    }
    }
    *outlen = x;
    *outlen = x;
-  
+
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
    zeromem(f9, sizeof(*f9));
    zeromem(f9, sizeof(*f9));
 #endif
 #endif

+ 2 - 2
src/mac/f9/f9_file.c

@@ -10,7 +10,7 @@
  */
  */
 #include "tomcrypt.h"
 #include "tomcrypt.h"
 
 
-/** 
+/**
   @file f9_file.c
   @file f9_file.c
   f9 support, process a file, Tom St Denis
   f9 support, process a file, Tom St Denis
 */
 */
@@ -29,7 +29,7 @@
 */
 */
 int f9_file(int cipher,
 int f9_file(int cipher,
               const unsigned char *key, unsigned long keylen,
               const unsigned char *key, unsigned long keylen,
-              const char *filename, 
+              const char *filename,
                     unsigned char *out, unsigned long *outlen)
                     unsigned char *out, unsigned long *outlen)
 {
 {
 #ifdef LTC_NO_FILE
 #ifdef LTC_NO_FILE

+ 2 - 2
src/mac/f9/f9_init.c

@@ -45,12 +45,12 @@ int f9_init(f9_state *f9, int cipher, const unsigned char *key, unsigned long ke
    if ((err = cipher_descriptor[cipher].setup(key, keylen, 0, &f9->key)) != CRYPT_OK) {
    if ((err = cipher_descriptor[cipher].setup(key, keylen, 0, &f9->key)) != CRYPT_OK) {
       goto done;
       goto done;
    }
    }
-   
+
    /* make the second key */
    /* make the second key */
    for (x = 0; (unsigned)x < keylen; x++) {
    for (x = 0; (unsigned)x < keylen; x++) {
       f9->akey[x] = key[x] ^ 0xAA;
       f9->akey[x] = key[x] ^ 0xAA;
    }
    }
- 
+
    /* setup struct */
    /* setup struct */
    zeromem(f9->IV,  cipher_descriptor[cipher].block_length);
    zeromem(f9->IV,  cipher_descriptor[cipher].block_length);
    zeromem(f9->ACC, cipher_descriptor[cipher].block_length);
    zeromem(f9->ACC, cipher_descriptor[cipher].block_length);

+ 2 - 2
src/mac/f9/f9_memory.c

@@ -17,7 +17,7 @@
 
 
 #ifdef LTC_F9_MODE
 #ifdef LTC_F9_MODE
 
 
-/** f9-MAC a block of memory 
+/** f9-MAC a block of memory
   @param cipher     Index of cipher to use
   @param cipher     Index of cipher to use
   @param key        [in]  Secret key
   @param key        [in]  Secret key
   @param keylen     Length of key in octets
   @param keylen     Length of key in octets
@@ -27,7 +27,7 @@
   @param outlen     [in/out] Output size and final tag size
   @param outlen     [in/out] Output size and final tag size
   Return CRYPT_OK on success.
   Return CRYPT_OK on success.
 */
 */
-int f9_memory(int cipher, 
+int f9_memory(int cipher,
                const unsigned char *key, unsigned long keylen,
                const unsigned char *key, unsigned long keylen,
                const unsigned char *in,  unsigned long inlen,
                const unsigned char *in,  unsigned long inlen,
                      unsigned char *out, unsigned long *outlen)
                      unsigned char *out, unsigned long *outlen)

+ 5 - 5
src/mac/f9/f9_memory_multi.c

@@ -11,7 +11,7 @@
 #include "tomcrypt.h"
 #include "tomcrypt.h"
 #include <stdarg.h>
 #include <stdarg.h>
 
 
-/** 
+/**
   @file f9_memory_multi.c
   @file f9_memory_multi.c
   f9 support, process multiple blocks of memory, Tom St Denis
   f9 support, process multiple blocks of memory, Tom St Denis
 */
 */
@@ -19,7 +19,7 @@
 #ifdef LTC_F9_MODE
 #ifdef LTC_F9_MODE
 
 
 /**
 /**
-   f9 multiple blocks of memory 
+   f9 multiple blocks of memory
    @param cipher    The index of the desired cipher
    @param cipher    The index of the desired cipher
    @param key       The secret key
    @param key       The secret key
    @param keylen    The length of the secret key (octets)
    @param keylen    The length of the secret key (octets)
@@ -30,7 +30,7 @@
    @param ...       tuples of (data,len) pairs to f9, terminated with a (NULL,x) (x=don't care)
    @param ...       tuples of (data,len) pairs to f9, terminated with a (NULL,x) (x=don't care)
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-int f9_memory_multi(int cipher, 
+int f9_memory_multi(int cipher,
                 const unsigned char *key, unsigned long keylen,
                 const unsigned char *key, unsigned long keylen,
                       unsigned char *out, unsigned long *outlen,
                       unsigned char *out, unsigned long *outlen,
                 const unsigned char *in,  unsigned long inlen, ...)
                 const unsigned char *in,  unsigned long inlen, ...)
@@ -57,7 +57,7 @@ int f9_memory_multi(int cipher,
       goto LBL_ERR;
       goto LBL_ERR;
    }
    }
    va_start(args, inlen);
    va_start(args, inlen);
-   curptr = in; 
+   curptr = in;
    curlen = inlen;
    curlen = inlen;
    for (;;) {
    for (;;) {
       /* process buf */
       /* process buf */
@@ -80,7 +80,7 @@ LBL_ERR:
 #endif
 #endif
    XFREE(f9);
    XFREE(f9);
    va_end(args);
    va_end(args);
-   return err;   
+   return err;
 }
 }
 
 
 #endif
 #endif

+ 2 - 2
src/mac/f9/f9_test.c

@@ -12,7 +12,7 @@
 
 
 /**
 /**
   @file f9_test.c
   @file f9_test.c
-  f9 Support, Test F9 mode 
+  f9 Support, Test F9 mode
 */
 */
 
 
 #ifdef LTC_F9_MODE
 #ifdef LTC_F9_MODE
@@ -39,7 +39,7 @@ int f9_test(void)
 {
 {
    105,
    105,
    { 0x83, 0xFD, 0x23, 0xA2, 0x44, 0xA7, 0x4C, 0xF3, 0x58, 0xDA, 0x30, 0x19, 0xF1, 0x72, 0x26, 0x35 },
    { 0x83, 0xFD, 0x23, 0xA2, 0x44, 0xA7, 0x4C, 0xF3, 0x58, 0xDA, 0x30, 0x19, 0xF1, 0x72, 0x26, 0x35 },
-   { 0x36, 0xAF, 0x61, 0x44, 0x4F, 0x30, 0x2A, 0xD2, 
+   { 0x36, 0xAF, 0x61, 0x44, 0x4F, 0x30, 0x2A, 0xD2,
      0x35, 0xC6, 0x87, 0x16, 0x63, 0x3C, 0x66, 0xFB, 0x75, 0x0C, 0x26, 0x68, 0x65, 0xD5, 0x3C, 0x11, 0xEA, 0x05, 0xB1, 0xE9, 0xFA, 0x49, 0xC8, 0x39, 0x8D, 0x48, 0xE1, 0xEF, 0xA5, 0x90, 0x9D, 0x39,
      0x35, 0xC6, 0x87, 0x16, 0x63, 0x3C, 0x66, 0xFB, 0x75, 0x0C, 0x26, 0x68, 0x65, 0xD5, 0x3C, 0x11, 0xEA, 0x05, 0xB1, 0xE9, 0xFA, 0x49, 0xC8, 0x39, 0x8D, 0x48, 0xE1, 0xEF, 0xA5, 0x90, 0x9D, 0x39,
      0x47, 0x90, 0x28, 0x37, 0xF5, 0xAE, 0x96, 0xD5, 0xA0, 0x5B, 0xC8, 0xD6, 0x1C, 0xA8, 0xDB, 0xEF, 0x1B, 0x13, 0xA4, 0xB4, 0xAB, 0xFE, 0x4F, 0xB1, 0x00, 0x60, 0x45, 0xB6, 0x74, 0xBB, 0x54, 0x72,
      0x47, 0x90, 0x28, 0x37, 0xF5, 0xAE, 0x96, 0xD5, 0xA0, 0x5B, 0xC8, 0xD6, 0x1C, 0xA8, 0xDB, 0xEF, 0x1B, 0x13, 0xA4, 0xB4, 0xAB, 0xFE, 0x4F, 0xB1, 0x00, 0x60, 0x45, 0xB6, 0x74, 0xBB, 0x54, 0x72,
      0x93, 0x04, 0xC3, 0x82, 0xBE, 0x53, 0xA5, 0xAF, 0x05, 0x55, 0x61, 0x76, 0xF6, 0xEA, 0xA2, 0xEF, 0x1D, 0x05, 0xE4, 0xB0, 0x83, 0x18, 0x1E, 0xE6, 0x74, 0xCD, 0xA5, 0xA4, 0x85, 0xF7, 0x4D, 0x7A,
      0x93, 0x04, 0xC3, 0x82, 0xBE, 0x53, 0xA5, 0xAF, 0x05, 0x55, 0x61, 0x76, 0xF6, 0xEA, 0xA2, 0xEF, 0x1D, 0x05, 0xE4, 0xB0, 0x83, 0x18, 0x1E, 0xE6, 0x74, 0xCD, 0xA5, 0xA4, 0x85, 0xF7, 0x4D, 0x7A,

+ 5 - 5
src/mac/pelican/pelican_memory.c

@@ -10,9 +10,9 @@
  */
  */
 #include "tomcrypt.h"
 #include "tomcrypt.h"
 
 
-/** 
+/**
    @file pelican_memory.c
    @file pelican_memory.c
-   Pelican MAC, MAC a block of memory, by Tom St Denis 
+   Pelican MAC, MAC a block of memory, by Tom St Denis
 */
 */
 
 
 #ifdef LTC_PELICAN
 #ifdef LTC_PELICAN
@@ -23,7 +23,7 @@
   @param keylen   The length of the key (octets)
   @param keylen   The length of the key (octets)
   @param in       The input to MAC
   @param in       The input to MAC
   @param inlen    The length of the input (octets)
   @param inlen    The length of the input (octets)
-  @param out      [out] The output TAG 
+  @param out      [out] The output TAG
   @return CRYPT_OK on success
   @return CRYPT_OK on success
 */
 */
 int pelican_memory(const unsigned char *key, unsigned long keylen,
 int pelican_memory(const unsigned char *key, unsigned long keylen,
@@ -34,7 +34,7 @@ int pelican_memory(const unsigned char *key, unsigned long keylen,
    int err;
    int err;
 
 
    pel = XMALLOC(sizeof(*pel));
    pel = XMALLOC(sizeof(*pel));
-   if (pel == NULL) { 
+   if (pel == NULL) {
       return CRYPT_MEM;
       return CRYPT_MEM;
    }
    }
 
 
@@ -47,7 +47,7 @@ int pelican_memory(const unsigned char *key, unsigned long keylen,
       return err;
       return err;
    }
    }
    err = pelican_done(pel, out);
    err = pelican_done(pel, out);
-   XFREE(pel); 
+   XFREE(pel);
    return err;
    return err;
 }
 }
 
 

+ 9 - 9
src/mac/pelican/pelican_test.c

@@ -10,9 +10,9 @@
  */
  */
 #include "tomcrypt.h"
 #include "tomcrypt.h"
 
 
-/** 
+/**
    @file pelican_test.c
    @file pelican_test.c
-   Pelican MAC, test, by Tom St Denis 
+   Pelican MAC, test, by Tom St Denis
 */
 */
 
 
 #ifdef LTC_PELICAN
 #ifdef LTC_PELICAN
@@ -31,7 +31,7 @@ int pelican_test(void)
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
      0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F },
      0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F },
    { 0 },
    { 0 },
-   { 0xeb, 0x58, 0x37, 0x15, 0xf8, 0x34, 0xde, 0xe5, 
+   { 0xeb, 0x58, 0x37, 0x15, 0xf8, 0x34, 0xde, 0xe5,
      0xa4, 0xd1, 0x6e, 0xe4, 0xb9, 0xd7, 0x76, 0x0e, },
      0xa4, 0xd1, 0x6e, 0xe4, 0xb9, 0xd7, 0x76, 0x0e, },
    16, 0
    16, 0
 },
 },
@@ -41,7 +41,7 @@ int pelican_test(void)
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
      0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F },
      0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F },
    { 0x00, 0x01, 0x02 },
    { 0x00, 0x01, 0x02 },
-   { 0x1c, 0x97, 0x40, 0x60, 0x6c, 0x58, 0x17, 0x2d, 
+   { 0x1c, 0x97, 0x40, 0x60, 0x6c, 0x58, 0x17, 0x2d,
      0x03, 0x94, 0x19, 0x70, 0x81, 0xc4, 0x38, 0x54, },
      0x03, 0x94, 0x19, 0x70, 0x81, 0xc4, 0x38, 0x54, },
    16, 3
    16, 3
 },
 },
@@ -52,7 +52,7 @@ int pelican_test(void)
      0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F },
      0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F },
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
    { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
      0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F },
      0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F },
-   { 0x03, 0xcc, 0x46, 0xb8, 0xac, 0xa7, 0x9c, 0x36, 
+   { 0x03, 0xcc, 0x46, 0xb8, 0xac, 0xa7, 0x9c, 0x36,
      0x1e, 0x8c, 0x6e, 0xa6, 0x7b, 0x89, 0x32, 0x49, },
      0x1e, 0x8c, 0x6e, 0xa6, 0x7b, 0x89, 0x32, 0x49, },
    16, 16
    16, 16
 },
 },
@@ -65,7 +65,7 @@ int pelican_test(void)
      0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
      0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
      0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
      0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
      0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F },
      0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F },
-   { 0x89, 0xcc, 0x36, 0x58, 0x1b, 0xdd, 0x4d, 0xb5, 
+   { 0x89, 0xcc, 0x36, 0x58, 0x1b, 0xdd, 0x4d, 0xb5,
      0x78, 0xbb, 0xac, 0xf0, 0xff, 0x8b, 0x08, 0x15, },
      0x78, 0xbb, 0xac, 0xf0, 0xff, 0x8b, 0x08, 0x15, },
    16, 32
    16, 32
 },
 },
@@ -79,7 +79,7 @@ int pelican_test(void)
      0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
      0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
      0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
      0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
      0x20, 0x21, 0x23 },
      0x20, 0x21, 0x23 },
-   { 0x4a, 0x7d, 0x45, 0x4d, 0xcd, 0xb5, 0xda, 0x8d, 
+   { 0x4a, 0x7d, 0x45, 0x4d, 0xcd, 0xb5, 0xda, 0x8d,
      0x48, 0x78, 0x16, 0x48, 0x5d, 0x45, 0x95, 0x99, },
      0x48, 0x78, 0x16, 0x48, 0x5d, 0x45, 0x95, 0x99, },
    16, 35
    16, 35
 },
 },
@@ -87,8 +87,8 @@ int pelican_test(void)
    int x, err;
    int x, err;
    unsigned char out[16];
    unsigned char out[16];
    pelican_state pel;
    pelican_state pel;
-   
-   for (x = 0; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) { 
+
+   for (x = 0; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) {
        if ((err = pelican_init(&pel, tests[x].K, tests[x].keylen)) != CRYPT_OK) {
        if ((err = pelican_init(&pel, tests[x].K, tests[x].keylen)) != CRYPT_OK) {
           return err;
           return err;
        }
        }

+ 2 - 2
src/mac/pmac/pmac_done.c

@@ -10,9 +10,9 @@
  */
  */
 #include "tomcrypt.h"
 #include "tomcrypt.h"
 
 
-/** 
+/**
   @file pmac_done.c
   @file pmac_done.c
-  PMAC implementation, terminate a session, by Tom St Denis 
+  PMAC implementation, terminate a session, by Tom St Denis
 */
 */
 
 
 #ifdef LTC_PMAC
 #ifdef LTC_PMAC

+ 5 - 5
src/mac/pmac/pmac_file.c

@@ -10,15 +10,15 @@
  */
  */
 #include "tomcrypt.h"
 #include "tomcrypt.h"
 
 
-/** 
+/**
    @file pmac_file.c
    @file pmac_file.c
-   PMAC implementation, process a file, by Tom St Denis 
+   PMAC implementation, process a file, by Tom St Denis
 */
 */
 
 
 #ifdef LTC_PMAC
 #ifdef LTC_PMAC
 
 
 /**
 /**
-   PMAC a file 
+   PMAC a file
    @param cipher       The index of the cipher desired
    @param cipher       The index of the cipher desired
    @param key          The secret key
    @param key          The secret key
    @param keylen       The length of the secret key (octets)
    @param keylen       The length of the secret key (octets)
@@ -27,9 +27,9 @@
    @param outlen       [in/out] Max size and resulting size of the authentication tag
    @param outlen       [in/out] Max size and resulting size of the authentication tag
    @return CRYPT_OK if successful, CRYPT_NOP if file support has been disabled
    @return CRYPT_OK if successful, CRYPT_NOP if file support has been disabled
 */
 */
-int pmac_file(int cipher, 
+int pmac_file(int cipher,
               const unsigned char *key, unsigned long keylen,
               const unsigned char *key, unsigned long keylen,
-              const char *filename, 
+              const char *filename,
                     unsigned char *out, unsigned long *outlen)
                     unsigned char *out, unsigned long *outlen)
 {
 {
 #ifdef LTC_NO_FILE
 #ifdef LTC_NO_FILE

+ 5 - 5
src/mac/pmac/pmac_memory.c

@@ -10,9 +10,9 @@
  */
  */
 #include "tomcrypt.h"
 #include "tomcrypt.h"
 
 
-/** 
+/**
    @file pmac_memory.c
    @file pmac_memory.c
-   PMAC implementation, process a block of memory, by Tom St Denis 
+   PMAC implementation, process a block of memory, by Tom St Denis
 */
 */
 
 
 #ifdef LTC_PMAC
 #ifdef LTC_PMAC
@@ -28,7 +28,7 @@
    @param outlen   [in/out] The max size and resulting size of the authentication tag
    @param outlen   [in/out] The max size and resulting size of the authentication tag
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-int pmac_memory(int cipher, 
+int pmac_memory(int cipher,
                 const unsigned char *key, unsigned long keylen,
                 const unsigned char *key, unsigned long keylen,
                 const unsigned char *in, unsigned long inlen,
                 const unsigned char *in, unsigned long inlen,
                       unsigned char *out, unsigned long *outlen)
                       unsigned char *out, unsigned long *outlen)
@@ -46,7 +46,7 @@ int pmac_memory(int cipher,
    if (pmac == NULL) {
    if (pmac == NULL) {
       return CRYPT_MEM;
       return CRYPT_MEM;
    }
    }
-   
+
    if ((err = pmac_init(pmac, cipher, key, keylen)) != CRYPT_OK) {
    if ((err = pmac_init(pmac, cipher, key, keylen)) != CRYPT_OK) {
       goto LBL_ERR;
       goto LBL_ERR;
    }
    }
@@ -64,7 +64,7 @@ LBL_ERR:
 #endif
 #endif
 
 
    XFREE(pmac);
    XFREE(pmac);
-   return err;   
+   return err;
 }
 }
 
 
 #endif
 #endif

+ 6 - 6
src/mac/pmac/pmac_memory_multi.c

@@ -11,9 +11,9 @@
 #include "tomcrypt.h"
 #include "tomcrypt.h"
 #include <stdarg.h>
 #include <stdarg.h>
 
 
-/** 
+/**
    @file pmac_memory_multi.c
    @file pmac_memory_multi.c
-   PMAC implementation, process multiple blocks of memory, by Tom St Denis 
+   PMAC implementation, process multiple blocks of memory, by Tom St Denis
 */
 */
 
 
 #ifdef LTC_PMAC
 #ifdef LTC_PMAC
@@ -30,7 +30,7 @@
    @param ...      tuples of (data,len) pairs to PMAC, terminated with a (NULL,x) (x=don't care)
    @param ...      tuples of (data,len) pairs to PMAC, terminated with a (NULL,x) (x=don't care)
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-int pmac_memory_multi(int cipher, 
+int pmac_memory_multi(int cipher,
                 const unsigned char *key, unsigned long  keylen,
                 const unsigned char *key, unsigned long  keylen,
                       unsigned char *out, unsigned long *outlen,
                       unsigned char *out, unsigned long *outlen,
                 const unsigned char *in,  unsigned long  inlen, ...)
                 const unsigned char *in,  unsigned long  inlen, ...)
@@ -51,12 +51,12 @@ int pmac_memory_multi(int cipher,
    if (pmac == NULL) {
    if (pmac == NULL) {
       return CRYPT_MEM;
       return CRYPT_MEM;
    }
    }
-   
+
    if ((err = pmac_init(pmac, cipher, key, keylen)) != CRYPT_OK) {
    if ((err = pmac_init(pmac, cipher, key, keylen)) != CRYPT_OK) {
       goto LBL_ERR;
       goto LBL_ERR;
    }
    }
    va_start(args, inlen);
    va_start(args, inlen);
-   curptr = in; 
+   curptr = in;
    curlen = inlen;
    curlen = inlen;
    for (;;) {
    for (;;) {
       /* process buf */
       /* process buf */
@@ -79,7 +79,7 @@ LBL_ERR:
 #endif
 #endif
    XFREE(pmac);
    XFREE(pmac);
    va_end(args);
    va_end(args);
-   return err;   
+   return err;
 }
 }
 
 
 #endif
 #endif

+ 2 - 2
src/mac/pmac/pmac_ntz.c

@@ -10,9 +10,9 @@
  */
  */
 #include "tomcrypt.h"
 #include "tomcrypt.h"
 
 
-/** 
+/**
    @file pmac_ntz.c
    @file pmac_ntz.c
-   PMAC implementation, internal function, by Tom St Denis 
+   PMAC implementation, internal function, by Tom St Denis
 */
 */
 
 
 #ifdef LTC_PMAC
 #ifdef LTC_PMAC

+ 2 - 2
src/mac/pmac/pmac_shift_xor.c

@@ -10,9 +10,9 @@
  */
  */
 #include "tomcrypt.h"
 #include "tomcrypt.h"
 
 
-/** 
+/**
    @file pmac_shift_xor.c
    @file pmac_shift_xor.c
-   PMAC implementation, internal function, by Tom St Denis 
+   PMAC implementation, internal function, by Tom St Denis
 */
 */
 
 
 #ifdef LTC_PMAC
 #ifdef LTC_PMAC

+ 7 - 7
src/mac/pmac/pmac_test.c

@@ -10,15 +10,15 @@
  */
  */
 #include "tomcrypt.h"
 #include "tomcrypt.h"
 
 
-/** 
+/**
    @file pmac_test.c
    @file pmac_test.c
-   PMAC implementation, self-test, by Tom St Denis 
+   PMAC implementation, self-test, by Tom St Denis
 */
 */
 
 
 
 
 #ifdef LTC_PMAC
 #ifdef LTC_PMAC
 
 
-/** 
+/**
    Test the LTC_OMAC implementation
    Test the LTC_OMAC implementation
    @return CRYPT_OK if successful, CRYPT_NOP if testing has been disabled
    @return CRYPT_OK if successful, CRYPT_NOP if testing has been disabled
 */
 */
@@ -27,7 +27,7 @@ int pmac_test(void)
 #if !defined(LTC_TEST)
 #if !defined(LTC_TEST)
     return CRYPT_NOP;
     return CRYPT_NOP;
 #else
 #else
-    static const struct { 
+    static const struct {
         int msglen;
         int msglen;
         unsigned char key[16], msg[34], tag[16];
         unsigned char key[16], msg[34], tag[16];
     } tests[] = {
     } tests[] = {
@@ -125,7 +125,7 @@ int pmac_test(void)
    unsigned long len;
    unsigned long len;
    unsigned char outtag[MAXBLOCKSIZE];
    unsigned char outtag[MAXBLOCKSIZE];
 
 
-    /* AES can be under rijndael or aes... try to find it */ 
+    /* AES can be under rijndael or aes... try to find it */
     if ((idx = find_cipher("aes")) == -1) {
     if ((idx = find_cipher("aes")) == -1) {
        if ((idx = find_cipher("rijndael")) == -1) {
        if ((idx = find_cipher("rijndael")) == -1) {
           return CRYPT_NOP;
           return CRYPT_NOP;
@@ -137,7 +137,7 @@ int pmac_test(void)
         if ((err = pmac_memory(idx, tests[x].key, 16, tests[x].msg, tests[x].msglen, outtag, &len)) != CRYPT_OK) {
         if ((err = pmac_memory(idx, tests[x].key, 16, tests[x].msg, tests[x].msglen, outtag, &len)) != CRYPT_OK) {
            return err;
            return err;
         }
         }
-        
+
         if (XMEMCMP(outtag, tests[x].tag, len)) {
         if (XMEMCMP(outtag, tests[x].tag, len)) {
 #if 0
 #if 0
            unsigned long y;
            unsigned long y;
@@ -158,7 +158,7 @@ int pmac_test(void)
 #endif /* PMAC_MODE */
 #endif /* PMAC_MODE */
 
 
 
 
- 
+
 
 
 /* $Source$ */
 /* $Source$ */
 /* $Revision$ */
 /* $Revision$ */

+ 1 - 1
src/mac/xcbc/xcbc_done.c

@@ -62,7 +62,7 @@ int xcbc_done(xcbc_state *xcbc, unsigned char *out, unsigned long *outlen)
       out[x] = xcbc->IV[x];
       out[x] = xcbc->IV[x];
    }
    }
    *outlen = x;
    *outlen = x;
-  
+
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
    zeromem(xcbc, sizeof(*xcbc));
    zeromem(xcbc, sizeof(*xcbc));
 #endif
 #endif

+ 3 - 3
src/mac/xcbc/xcbc_file.c

@@ -10,7 +10,7 @@
  */
  */
 #include "tomcrypt.h"
 #include "tomcrypt.h"
 
 
-/** 
+/**
   @file xcbc_file.c
   @file xcbc_file.c
   XCBC support, process a file, Tom St Denis
   XCBC support, process a file, Tom St Denis
 */
 */
@@ -27,9 +27,9 @@
    @param outlen   [in/out] The max size and resulting size of the authentication tag
    @param outlen   [in/out] The max size and resulting size of the authentication tag
    @return CRYPT_OK if successful, CRYPT_NOP if file support has been disabled
    @return CRYPT_OK if successful, CRYPT_NOP if file support has been disabled
 */
 */
-int xcbc_file(int cipher, 
+int xcbc_file(int cipher,
               const unsigned char *key, unsigned long keylen,
               const unsigned char *key, unsigned long keylen,
-              const char *filename, 
+              const char *filename,
                     unsigned char *out, unsigned long *outlen)
                     unsigned char *out, unsigned long *outlen)
 {
 {
 #ifdef LTC_NO_FILE
 #ifdef LTC_NO_FILE

+ 4 - 4
src/mac/xcbc/xcbc_init.c

@@ -71,7 +71,7 @@ int xcbc_init(xcbc_state *xcbc, int cipher, const unsigned char *key, unsigned l
       if ((err = cipher_descriptor[cipher].setup(key, keylen, 0, skey)) != CRYPT_OK) {
       if ((err = cipher_descriptor[cipher].setup(key, keylen, 0, skey)) != CRYPT_OK) {
          goto done;
          goto done;
       }
       }
-   
+
       /* make the three keys */
       /* make the three keys */
       for (y = 0; y < 3; y++) {
       for (y = 0; y < 3; y++) {
         for (x = 0; x < cipher_descriptor[cipher].block_length; x++) {
         for (x = 0; x < cipher_descriptor[cipher].block_length; x++) {
@@ -80,10 +80,10 @@ int xcbc_init(xcbc_state *xcbc, int cipher, const unsigned char *key, unsigned l
         cipher_descriptor[cipher].ecb_encrypt(xcbc->K[y], xcbc->K[y], skey);
         cipher_descriptor[cipher].ecb_encrypt(xcbc->K[y], xcbc->K[y], skey);
       }
       }
    }
    }
-     
+
    /* setup K1 */
    /* setup K1 */
    err = cipher_descriptor[cipher].setup(xcbc->K[0], k1, 0, &xcbc->key);
    err = cipher_descriptor[cipher].setup(xcbc->K[0], k1, 0, &xcbc->key);
- 
+
    /* setup struct */
    /* setup struct */
    zeromem(xcbc->IV, cipher_descriptor[cipher].block_length);
    zeromem(xcbc->IV, cipher_descriptor[cipher].block_length);
    xcbc->blocksize = cipher_descriptor[cipher].block_length;
    xcbc->blocksize = cipher_descriptor[cipher].block_length;
@@ -91,7 +91,7 @@ int xcbc_init(xcbc_state *xcbc, int cipher, const unsigned char *key, unsigned l
    xcbc->buflen    = 0;
    xcbc->buflen    = 0;
 done:
 done:
    cipher_descriptor[cipher].done(skey);
    cipher_descriptor[cipher].done(skey);
-   if (skey != NULL) { 
+   if (skey != NULL) {
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
       zeromem(skey, sizeof(*skey));
       zeromem(skey, sizeof(*skey));
 #endif
 #endif

+ 2 - 2
src/mac/xcbc/xcbc_memory.c

@@ -17,7 +17,7 @@
 
 
 #ifdef LTC_XCBC
 #ifdef LTC_XCBC
 
 
-/** XCBC-MAC a block of memory 
+/** XCBC-MAC a block of memory
   @param cipher     Index of cipher to use
   @param cipher     Index of cipher to use
   @param key        [in]  Secret key
   @param key        [in]  Secret key
   @param keylen     Length of key in octets
   @param keylen     Length of key in octets
@@ -27,7 +27,7 @@
   @param outlen     [in/out] Output size and final tag size
   @param outlen     [in/out] Output size and final tag size
   Return CRYPT_OK on success.
   Return CRYPT_OK on success.
 */
 */
-int xcbc_memory(int cipher, 
+int xcbc_memory(int cipher,
                const unsigned char *key, unsigned long keylen,
                const unsigned char *key, unsigned long keylen,
                const unsigned char *in,  unsigned long inlen,
                const unsigned char *in,  unsigned long inlen,
                      unsigned char *out, unsigned long *outlen)
                      unsigned char *out, unsigned long *outlen)

+ 5 - 5
src/mac/xcbc/xcbc_memory_multi.c

@@ -11,7 +11,7 @@
 #include "tomcrypt.h"
 #include "tomcrypt.h"
 #include <stdarg.h>
 #include <stdarg.h>
 
 
-/** 
+/**
   @file xcbc_memory_multi.c
   @file xcbc_memory_multi.c
   XCBC support, process multiple blocks of memory, Tom St Denis
   XCBC support, process multiple blocks of memory, Tom St Denis
 */
 */
@@ -19,7 +19,7 @@
 #ifdef LTC_XCBC
 #ifdef LTC_XCBC
 
 
 /**
 /**
-   XCBC multiple blocks of memory 
+   XCBC multiple blocks of memory
    @param cipher    The index of the desired cipher
    @param cipher    The index of the desired cipher
    @param key       The secret key
    @param key       The secret key
    @param keylen    The length of the secret key (octets)
    @param keylen    The length of the secret key (octets)
@@ -30,7 +30,7 @@
    @param ...       tuples of (data,len) pairs to XCBC, terminated with a (NULL,x) (x=don't care)
    @param ...       tuples of (data,len) pairs to XCBC, terminated with a (NULL,x) (x=don't care)
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-int xcbc_memory_multi(int cipher, 
+int xcbc_memory_multi(int cipher,
                 const unsigned char *key, unsigned long keylen,
                 const unsigned char *key, unsigned long keylen,
                       unsigned char *out, unsigned long *outlen,
                       unsigned char *out, unsigned long *outlen,
                 const unsigned char *in,  unsigned long inlen, ...)
                 const unsigned char *in,  unsigned long inlen, ...)
@@ -57,7 +57,7 @@ int xcbc_memory_multi(int cipher,
       goto LBL_ERR;
       goto LBL_ERR;
    }
    }
    va_start(args, inlen);
    va_start(args, inlen);
-   curptr = in; 
+   curptr = in;
    curlen = inlen;
    curlen = inlen;
    for (;;) {
    for (;;) {
       /* process buf */
       /* process buf */
@@ -80,7 +80,7 @@ LBL_ERR:
 #endif
 #endif
    XFREE(xcbc);
    XFREE(xcbc);
    va_end(args);
    va_end(args);
-   return err;   
+   return err;
 }
 }
 
 
 #endif
 #endif

+ 16 - 16
src/mac/xcbc/xcbc_test.c

@@ -31,64 +31,64 @@ int xcbc_test(void)
    } tests[] = {
    } tests[] = {
 {
 {
    0,
    0,
-   { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 
+   { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
 
 
    { 0 },
    { 0 },
 
 
-   { 0x75, 0xf0, 0x25, 0x1d, 0x52, 0x8a, 0xc0, 0x1c, 
+   { 0x75, 0xf0, 0x25, 0x1d, 0x52, 0x8a, 0xc0, 0x1c,
      0x45, 0x73, 0xdf, 0xd5, 0x84, 0xd7, 0x9f, 0x29 }
      0x45, 0x73, 0xdf, 0xd5, 0x84, 0xd7, 0x9f, 0x29 }
 },
 },
 
 
 {
 {
    3,
    3,
-   { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 
+   { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
 
 
    { 0x00, 0x01, 0x02 },
    { 0x00, 0x01, 0x02 },
 
 
-   { 0x5b, 0x37, 0x65, 0x80, 0xae, 0x2f, 0x19, 0xaf, 
+   { 0x5b, 0x37, 0x65, 0x80, 0xae, 0x2f, 0x19, 0xaf,
      0xe7, 0x21, 0x9c, 0xee, 0xf1, 0x72, 0x75, 0x6f }
      0xe7, 0x21, 0x9c, 0xee, 0xf1, 0x72, 0x75, 0x6f }
 },
 },
 
 
 {
 {
    16,
    16,
-   { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 
+   { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
 
 
-   { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 
+   { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
 
 
-   { 0xd2, 0xa2, 0x46, 0xfa, 0x34, 0x9b, 0x68, 0xa7, 
+   { 0xd2, 0xa2, 0x46, 0xfa, 0x34, 0x9b, 0x68, 0xa7,
      0x99, 0x98, 0xa4, 0x39, 0x4f, 0xf7, 0xa2, 0x63 }
      0x99, 0x98, 0xa4, 0x39, 0x4f, 0xf7, 0xa2, 0x63 }
 },
 },
 
 
 {
 {
    32,
    32,
-   { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 
+   { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
 
 
-   { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 
-     0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 
+   { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+     0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
      0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
      0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
      0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
      0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
 
 
-   { 0xf5, 0x4f, 0x0e, 0xc8, 0xd2, 0xb9, 0xf3, 0xd3, 
+   { 0xf5, 0x4f, 0x0e, 0xc8, 0xd2, 0xb9, 0xf3, 0xd3,
      0x68, 0x07, 0x73, 0x4b, 0xd5, 0x28, 0x3f, 0xd4 }
      0x68, 0x07, 0x73, 0x4b, 0xd5, 0x28, 0x3f, 0xd4 }
 },
 },
 
 
 {
 {
    34,
    34,
-   { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 
+   { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
 
 
-   { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 
-     0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 
+   { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+     0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
      0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
      0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
      0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
      0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
      0x20, 0x21 },
      0x20, 0x21 },
 
 
-   { 0xbe, 0xcb, 0xb3, 0xbc, 0xcd, 0xb5, 0x18, 0xa3, 
+   { 0xbe, 0xcb, 0xb3, 0xbc, 0xcd, 0xb5, 0x18, 0xa3,
      0x06, 0x77, 0xd5, 0x48, 0x1f, 0xb6, 0xb4, 0xd8 },
      0x06, 0x77, 0xd5, 0x48, 0x1f, 0xb6, 0xb4, 0xd8 },
 },
 },
 
 
@@ -99,7 +99,7 @@ int xcbc_test(void)
   unsigned long taglen;
   unsigned long taglen;
   int err, x, idx;
   int err, x, idx;
 
 
-  /* AES can be under rijndael or aes... try to find it */ 
+  /* AES can be under rijndael or aes... try to find it */
   if ((idx = find_cipher("aes")) == -1) {
   if ((idx = find_cipher("aes")) == -1) {
      if ((idx = find_cipher("rijndael")) == -1) {
      if ((idx = find_cipher("rijndael")) == -1) {
         return CRYPT_NOP;
         return CRYPT_NOP;

File diff suppressed because it is too large
+ 515 - 515
src/math/fp/ltc_ecc_fp_mulmod.c


+ 6 - 6
src/math/rand_prime.c

@@ -15,7 +15,7 @@
 /**
 /**
   @file rand_prime.c
   @file rand_prime.c
   Generate a random prime, Tom St Denis
   Generate a random prime, Tom St Denis
-*/  
+*/
 
 
 #define USE_BBS 1
 #define USE_BBS 1
 
 
@@ -35,13 +35,13 @@ int rand_prime(void *N, long len, prng_state *prng, int wprng)
    }
    }
 
 
    /* allow sizes between 2 and 512 bytes for a prime size */
    /* allow sizes between 2 and 512 bytes for a prime size */
-   if (len < 2 || len > 512) { 
+   if (len < 2 || len > 512) {
       return CRYPT_INVALID_PRIME_SIZE;
       return CRYPT_INVALID_PRIME_SIZE;
    }
    }
-   
+
    /* valid PRNG? Better be! */
    /* valid PRNG? Better be! */
    if ((err = prng_is_valid(wprng)) != CRYPT_OK) {
    if ((err = prng_is_valid(wprng)) != CRYPT_OK) {
-      return err; 
+      return err;
    }
    }
 
 
    /* allocate buffer to work with */
    /* allocate buffer to work with */
@@ -60,7 +60,7 @@ int rand_prime(void *N, long len, prng_state *prng, int wprng)
       /* munge bits */
       /* munge bits */
       buf[0]     |= 0x80 | 0x40;
       buf[0]     |= 0x80 | 0x40;
       buf[len-1] |= 0x01 | ((type & USE_BBS) ? 0x02 : 0x00);
       buf[len-1] |= 0x01 | ((type & USE_BBS) ? 0x02 : 0x00);
- 
+
       /* load value */
       /* load value */
       if ((err = mp_read_unsigned_bin(N, buf, len)) != CRYPT_OK) {
       if ((err = mp_read_unsigned_bin(N, buf, len)) != CRYPT_OK) {
          XFREE(buf);
          XFREE(buf);
@@ -81,7 +81,7 @@ int rand_prime(void *N, long len, prng_state *prng, int wprng)
    XFREE(buf);
    XFREE(buf);
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
-      
+
 #endif /* LTC_NO_MATH */
 #endif /* LTC_NO_MATH */
 
 
 
 

+ 1 - 1
src/misc/crypt/crypt_find_cipher_any.c

@@ -16,7 +16,7 @@
 */
 */
 
 
 /**
 /**
-   Find a cipher flexibly.  First by name then if not present by block and key size 
+   Find a cipher flexibly.  First by name then if not present by block and key size
    @param name        The name of the cipher desired
    @param name        The name of the cipher desired
    @param blocklen    The minimum length of the block cipher desired (octets)
    @param blocklen    The minimum length of the block cipher desired (octets)
    @param keylen      The minimum length of the key size desired (octets)
    @param keylen      The minimum length of the key size desired (octets)

+ 1 - 1
src/misc/crypt/crypt_find_hash_any.c

@@ -16,7 +16,7 @@
 */
 */
 
 
 /**
 /**
-   Find a hash flexibly.  First by name then if not present by digest size 
+   Find a hash flexibly.  First by name then if not present by digest size
    @param name        The name of the hash desired
    @param name        The name of the hash desired
    @param digestlen   The minimum length of the digest size (octets)
    @param digestlen   The minimum length of the digest size (octets)
    @return >= 0 if found, -1 if not present
    @return >= 0 if found, -1 if not present

+ 3 - 3
src/misc/crypt/crypt_fsa.c

@@ -14,7 +14,7 @@
 /**
 /**
   @file crypt_fsa.c
   @file crypt_fsa.c
   LibTomCrypt FULL SPEED AHEAD!, Tom St Denis
   LibTomCrypt FULL SPEED AHEAD!, Tom St Denis
-*/  
+*/
 
 
 /* format is ltc_mp, cipher_desc, [cipher_desc], NULL, hash_desc, [hash_desc], NULL, prng_desc, [prng_desc], NULL */
 /* format is ltc_mp, cipher_desc, [cipher_desc], NULL, hash_desc, [hash_desc], NULL, prng_desc, [prng_desc], NULL */
 int crypt_fsa(void *mp, ...)
 int crypt_fsa(void *mp, ...)
@@ -26,7 +26,7 @@ int crypt_fsa(void *mp, ...)
    if (mp != NULL) {
    if (mp != NULL) {
       XMEMCPY(&ltc_mp, mp, sizeof(ltc_mp));
       XMEMCPY(&ltc_mp, mp, sizeof(ltc_mp));
    }
    }
-   
+
    while ((p = va_arg(args, void*)) != NULL) {
    while ((p = va_arg(args, void*)) != NULL) {
       if (register_cipher(p) == -1) {
       if (register_cipher(p) == -1) {
          va_end(args);
          va_end(args);
@@ -49,7 +49,7 @@ int crypt_fsa(void *mp, ...)
    }
    }
 
 
    va_end(args);
    va_end(args);
-   return CRYPT_OK;   
+   return CRYPT_OK;
 }
 }
 
 
 
 

+ 1 - 1
src/misc/crypt/crypt_hash_descriptor.c

@@ -12,7 +12,7 @@
 
 
 /**
 /**
   @file crypt_hash_descriptor.c
   @file crypt_hash_descriptor.c
-  Stores the hash descriptor table, Tom St Denis  
+  Stores the hash descriptor table, Tom St Denis
 */
 */
 
 
 struct ltc_hash_descriptor hash_descriptor[TAB_SIZE] = {
 struct ltc_hash_descriptor hash_descriptor[TAB_SIZE] = {

+ 1 - 1
src/misc/crypt/crypt_hash_is_valid.c

@@ -13,7 +13,7 @@
 /**
 /**
   @file crypt_hash_is_valid.c
   @file crypt_hash_is_valid.c
   Determine if hash is valid, Tom St Denis
   Determine if hash is valid, Tom St Denis
-*/  
+*/
 
 
 /*
 /*
    Test if a hash index is valid
    Test if a hash index is valid

+ 1 - 1
src/misc/crypt/crypt_prng_descriptor.c

@@ -13,7 +13,7 @@
 /**
 /**
   @file crypt_prng_descriptor.c
   @file crypt_prng_descriptor.c
   Stores the PRNG descriptors, Tom St Denis
   Stores the PRNG descriptors, Tom St Denis
-*/  
+*/
 struct ltc_prng_descriptor prng_descriptor[TAB_SIZE] = {
 struct ltc_prng_descriptor prng_descriptor[TAB_SIZE] = {
 { NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
 { NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
 };
 };

+ 1 - 1
src/misc/crypt/crypt_register_prng.c

@@ -14,7 +14,7 @@
   @file crypt_register_prng.c
   @file crypt_register_prng.c
   Register a PRNG, Tom St Denis
   Register a PRNG, Tom St Denis
 */
 */
-  
+
 /**
 /**
    Register a PRNG with the descriptor table
    Register a PRNG with the descriptor table
    @param prng   The PRNG you wish to register
    @param prng   The PRNG you wish to register

+ 1 - 1
src/misc/error_to_string.c

@@ -68,7 +68,7 @@ const char *error_to_string(int err)
       return "Invalid error code.";
       return "Invalid error code.";
    } else {
    } else {
       return err_2_str[err];
       return err_2_str[err];
-   }   
+   }
 }
 }
 
 
 
 

+ 1 - 1
src/modes/cbc/cbc_done.c

@@ -33,7 +33,7 @@ int cbc_done(symmetric_CBC *cbc)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
-   
+
 
 
 #endif
 #endif
 
 

+ 1 - 1
src/modes/cbc/cbc_setiv.c

@@ -36,7 +36,7 @@ int cbc_setiv(const unsigned char *IV, unsigned long len, symmetric_CBC *cbc)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
-#endif 
+#endif
 
 
 
 
 /* $Source$ */
 /* $Source$ */

+ 3 - 3
src/modes/cbc/cbc_start.c

@@ -21,17 +21,17 @@
    Initialize a CBC context
    Initialize a CBC context
    @param cipher      The index of the cipher desired
    @param cipher      The index of the cipher desired
    @param IV          The initial vector
    @param IV          The initial vector
-   @param key         The secret key 
+   @param key         The secret key
    @param keylen      The length of the secret key (octets)
    @param keylen      The length of the secret key (octets)
    @param num_rounds  Number of rounds in the cipher desired (0 for default)
    @param num_rounds  Number of rounds in the cipher desired (0 for default)
    @param cbc         The CBC state to initialize
    @param cbc         The CBC state to initialize
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-int cbc_start(int cipher, const unsigned char *IV, const unsigned char *key, 
+int cbc_start(int cipher, const unsigned char *IV, const unsigned char *key,
               int keylen, int num_rounds, symmetric_CBC *cbc)
               int keylen, int num_rounds, symmetric_CBC *cbc)
 {
 {
    int x, err;
    int x, err;
- 
+
    LTC_ARGCHK(IV != NULL);
    LTC_ARGCHK(IV != NULL);
    LTC_ARGCHK(key != NULL);
    LTC_ARGCHK(key != NULL);
    LTC_ARGCHK(cbc != NULL);
    LTC_ARGCHK(cbc != NULL);

+ 1 - 1
src/modes/cfb/cfb_decrypt.c

@@ -52,7 +52,7 @@ int cfb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, s
        }
        }
        cfb->pad[cfb->padlen] = *ct;
        cfb->pad[cfb->padlen] = *ct;
        *pt = *ct ^ cfb->IV[cfb->padlen];
        *pt = *ct ^ cfb->IV[cfb->padlen];
-       ++pt; 
+       ++pt;
        ++ct;
        ++ct;
        ++(cfb->padlen);
        ++(cfb->padlen);
    }
    }

+ 1 - 1
src/modes/cfb/cfb_done.c

@@ -33,7 +33,7 @@ int cfb_done(symmetric_CFB *cfb)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
-   
+
 
 
 #endif
 #endif
 
 

+ 1 - 1
src/modes/cfb/cfb_encrypt.c

@@ -51,7 +51,7 @@ int cfb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s
           cfb->padlen = 0;
           cfb->padlen = 0;
        }
        }
        cfb->pad[cfb->padlen] = (*ct = *pt ^ cfb->IV[cfb->padlen]);
        cfb->pad[cfb->padlen] = (*ct = *pt ^ cfb->IV[cfb->padlen]);
-       ++pt; 
+       ++pt;
        ++ct;
        ++ct;
        ++(cfb->padlen);
        ++(cfb->padlen);
    }
    }

+ 5 - 5
src/modes/cfb/cfb_setiv.c

@@ -13,7 +13,7 @@
 /**
 /**
   @file cfb_setiv.c
   @file cfb_setiv.c
   CFB implementation, set IV, Tom St Denis
   CFB implementation, set IV, Tom St Denis
-*/  
+*/
 
 
 #ifdef LTC_CFB_MODE
 #ifdef LTC_CFB_MODE
 
 
@@ -27,24 +27,24 @@
 int cfb_setiv(const unsigned char *IV, unsigned long len, symmetric_CFB *cfb)
 int cfb_setiv(const unsigned char *IV, unsigned long len, symmetric_CFB *cfb)
 {
 {
    int err;
    int err;
-   
+
    LTC_ARGCHK(IV  != NULL);
    LTC_ARGCHK(IV  != NULL);
    LTC_ARGCHK(cfb != NULL);
    LTC_ARGCHK(cfb != NULL);
 
 
    if ((err = cipher_is_valid(cfb->cipher)) != CRYPT_OK) {
    if ((err = cipher_is_valid(cfb->cipher)) != CRYPT_OK) {
        return err;
        return err;
    }
    }
-   
+
    if (len != (unsigned long)cfb->blocklen) {
    if (len != (unsigned long)cfb->blocklen) {
       return CRYPT_INVALID_ARG;
       return CRYPT_INVALID_ARG;
    }
    }
-      
+
    /* force next block */
    /* force next block */
    cfb->padlen = 0;
    cfb->padlen = 0;
    return cipher_descriptor[cfb->cipher].ecb_encrypt(IV, cfb->IV, &cfb->key);
    return cipher_descriptor[cfb->cipher].ecb_encrypt(IV, cfb->IV, &cfb->key);
 }
 }
 
 
-#endif 
+#endif
 
 
 
 
 /* $Source$ */
 /* $Source$ */

+ 3 - 3
src/modes/cfb/cfb_start.c

@@ -22,13 +22,13 @@
    Initialize a CFB context
    Initialize a CFB context
    @param cipher      The index of the cipher desired
    @param cipher      The index of the cipher desired
    @param IV          The initial vector
    @param IV          The initial vector
-   @param key         The secret key 
+   @param key         The secret key
    @param keylen      The length of the secret key (octets)
    @param keylen      The length of the secret key (octets)
    @param num_rounds  Number of rounds in the cipher desired (0 for default)
    @param num_rounds  Number of rounds in the cipher desired (0 for default)
    @param cfb         The CFB state to initialize
    @param cfb         The CFB state to initialize
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-int cfb_start(int cipher, const unsigned char *IV, const unsigned char *key, 
+int cfb_start(int cipher, const unsigned char *IV, const unsigned char *key,
               int keylen, int num_rounds, symmetric_CFB *cfb)
               int keylen, int num_rounds, symmetric_CFB *cfb)
 {
 {
    int x, err;
    int x, err;
@@ -40,7 +40,7 @@ int cfb_start(int cipher, const unsigned char *IV, const unsigned char *key,
    if ((err = cipher_is_valid(cipher)) != CRYPT_OK) {
    if ((err = cipher_is_valid(cipher)) != CRYPT_OK) {
       return err;
       return err;
    }
    }
-   
+
 
 
    /* copy data */
    /* copy data */
    cfb->cipher = cipher;
    cfb->cipher = cipher;

+ 1 - 1
src/modes/ctr/ctr_done.c

@@ -33,7 +33,7 @@ int ctr_done(symmetric_CTR *ctr)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
-   
+
 
 
 #endif
 #endif
 
 

+ 5 - 5
src/modes/ctr/ctr_setiv.c

@@ -14,7 +14,7 @@
   @file ctr_setiv.c
   @file ctr_setiv.c
   CTR implementation, set IV, Tom St Denis
   CTR implementation, set IV, Tom St Denis
 */
 */
-  
+
 #ifdef LTC_CTR_MODE
 #ifdef LTC_CTR_MODE
 
 
 /**
 /**
@@ -27,7 +27,7 @@
 int ctr_setiv(const unsigned char *IV, unsigned long len, symmetric_CTR *ctr)
 int ctr_setiv(const unsigned char *IV, unsigned long len, symmetric_CTR *ctr)
 {
 {
    int err;
    int err;
-   
+
    LTC_ARGCHK(IV  != NULL);
    LTC_ARGCHK(IV  != NULL);
    LTC_ARGCHK(ctr != NULL);
    LTC_ARGCHK(ctr != NULL);
 
 
@@ -35,20 +35,20 @@ int ctr_setiv(const unsigned char *IV, unsigned long len, symmetric_CTR *ctr)
    if ((err = cipher_is_valid(ctr->cipher)) != CRYPT_OK) {
    if ((err = cipher_is_valid(ctr->cipher)) != CRYPT_OK) {
       return err;
       return err;
    }
    }
-   
+
    if (len != (unsigned long)ctr->blocklen) {
    if (len != (unsigned long)ctr->blocklen) {
       return CRYPT_INVALID_ARG;
       return CRYPT_INVALID_ARG;
    }
    }
 
 
    /* set IV */
    /* set IV */
    XMEMCPY(ctr->ctr, IV, len);
    XMEMCPY(ctr->ctr, IV, len);
-   
+
    /* force next block */
    /* force next block */
    ctr->padlen = 0;
    ctr->padlen = 0;
    return cipher_descriptor[ctr->cipher].ecb_encrypt(IV, ctr->pad, &ctr->key);
    return cipher_descriptor[ctr->cipher].ecb_encrypt(IV, ctr->pad, &ctr->key);
 }
 }
 
 
-#endif 
+#endif
 
 
 
 
 /* $Source$ */
 /* $Source$ */

+ 5 - 5
src/modes/ctr/ctr_start.c

@@ -22,16 +22,16 @@
    Initialize a CTR context
    Initialize a CTR context
    @param cipher      The index of the cipher desired
    @param cipher      The index of the cipher desired
    @param IV          The initial vector
    @param IV          The initial vector
-   @param key         The secret key 
+   @param key         The secret key
    @param keylen      The length of the secret key (octets)
    @param keylen      The length of the secret key (octets)
    @param num_rounds  Number of rounds in the cipher desired (0 for default)
    @param num_rounds  Number of rounds in the cipher desired (0 for default)
    @param ctr_mode    The counter mode (CTR_COUNTER_LITTLE_ENDIAN or CTR_COUNTER_BIG_ENDIAN)
    @param ctr_mode    The counter mode (CTR_COUNTER_LITTLE_ENDIAN or CTR_COUNTER_BIG_ENDIAN)
    @param ctr         The CTR state to initialize
    @param ctr         The CTR state to initialize
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-int ctr_start(               int   cipher, 
-              const unsigned char *IV, 
-              const unsigned char *key,       int keylen, 
+int ctr_start(               int   cipher,
+              const unsigned char *IV,
+              const unsigned char *key,       int keylen,
                              int  num_rounds, int ctr_mode,
                              int  num_rounds, int ctr_mode,
                    symmetric_CTR *ctr)
                    symmetric_CTR *ctr)
 {
 {
@@ -91,7 +91,7 @@ int ctr_start(               int   cipher,
       }
       }
    }
    }
 
 
-   return cipher_descriptor[ctr->cipher].ecb_encrypt(ctr->ctr, ctr->pad, &ctr->key); 
+   return cipher_descriptor[ctr->cipher].ecb_encrypt(ctr->ctr, ctr->pad, &ctr->key);
 }
 }
 
 
 #endif
 #endif

+ 1 - 1
src/modes/ctr/ctr_test.c

@@ -52,7 +52,7 @@ int ctr_test(void)
   unsigned char buf[64];
   unsigned char buf[64];
   symmetric_CTR ctr;
   symmetric_CTR ctr;
 
 
-  /* AES can be under rijndael or aes... try to find it */ 
+  /* AES can be under rijndael or aes... try to find it */
   if ((idx = find_cipher("aes")) == -1) {
   if ((idx = find_cipher("aes")) == -1) {
      if ((idx = find_cipher("rijndael")) == -1) {
      if ((idx = find_cipher("rijndael")) == -1) {
         return CRYPT_NOP;
         return CRYPT_NOP;

+ 1 - 1
src/modes/ecb/ecb_done.c

@@ -33,7 +33,7 @@ int ecb_done(symmetric_ECB *ecb)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
-   
+
 
 
 #endif
 #endif
 
 

+ 1 - 1
src/modes/ecb/ecb_start.c

@@ -21,7 +21,7 @@
 /**
 /**
    Initialize a ECB context
    Initialize a ECB context
    @param cipher      The index of the cipher desired
    @param cipher      The index of the cipher desired
-   @param key         The secret key 
+   @param key         The secret key
    @param keylen      The length of the secret key (octets)
    @param keylen      The length of the secret key (octets)
    @param num_rounds  Number of rounds in the cipher desired (0 for default)
    @param num_rounds  Number of rounds in the cipher desired (0 for default)
    @param ecb         The ECB state to initialize
    @param ecb         The ECB state to initialize

+ 1 - 1
src/modes/f8/f8_decrypt.c

@@ -36,7 +36,7 @@ int f8_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, sy
 
 
 #endif
 #endif
 
 
- 
+
 
 
 /* $Source$ */
 /* $Source$ */
 /* $Revision$ */
 /* $Revision$ */

+ 1 - 1
src/modes/f8/f8_done.c

@@ -33,7 +33,7 @@ int f8_done(symmetric_F8 *f8)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
-   
+
 
 
 #endif
 #endif
 
 

+ 1 - 1
src/modes/f8/f8_setiv.c

@@ -44,7 +44,7 @@ int f8_setiv(const unsigned char *IV, unsigned long len, symmetric_F8 *f8)
    return cipher_descriptor[f8->cipher].ecb_encrypt(IV, f8->IV, &f8->key);
    return cipher_descriptor[f8->cipher].ecb_encrypt(IV, f8->IV, &f8->key);
 }
 }
 
 
-#endif 
+#endif
 
 
 
 
 /* $Source$ */
 /* $Source$ */

+ 9 - 9
src/modes/f8/f8_start.c

@@ -22,7 +22,7 @@
    Initialize an F8 context
    Initialize an F8 context
    @param cipher      The index of the cipher desired
    @param cipher      The index of the cipher desired
    @param IV          The initial vector
    @param IV          The initial vector
-   @param key         The secret key 
+   @param key         The secret key
    @param keylen      The length of the secret key (octets)
    @param keylen      The length of the secret key (octets)
    @param salt_key    The salting key for the IV
    @param salt_key    The salting key for the IV
    @param skeylen     The length of the salting key (octets)
    @param skeylen     The length of the salting key (octets)
@@ -30,8 +30,8 @@
    @param f8          The F8 state to initialize
    @param f8          The F8 state to initialize
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-int f8_start(                int  cipher, const unsigned char *IV, 
-             const unsigned char *key,                    int  keylen, 
+int f8_start(                int  cipher, const unsigned char *IV,
+             const unsigned char *key,                    int  keylen,
              const unsigned char *salt_key,               int  skeylen,
              const unsigned char *salt_key,               int  skeylen,
                              int  num_rounds,   symmetric_F8  *f8)
                              int  num_rounds,   symmetric_F8  *f8)
 {
 {
@@ -58,7 +58,7 @@ int f8_start(                int  cipher, const unsigned char *IV,
    f8->cipher   = cipher;
    f8->cipher   = cipher;
    f8->blocklen = cipher_descriptor[cipher].block_length;
    f8->blocklen = cipher_descriptor[cipher].block_length;
    f8->padlen   = f8->blocklen;
    f8->padlen   = f8->blocklen;
-   
+
    /* now get key ^ salt_key [extend salt_ket with 0x55 as required to match length] */
    /* now get key ^ salt_key [extend salt_ket with 0x55 as required to match length] */
    zeromem(tkey, sizeof(tkey));
    zeromem(tkey, sizeof(tkey));
    for (x = 0; x < keylen && x < (int)sizeof(tkey); x++) {
    for (x = 0; x < keylen && x < (int)sizeof(tkey); x++) {
@@ -66,16 +66,16 @@ int f8_start(                int  cipher, const unsigned char *IV,
    }
    }
    for (x = 0; x < skeylen && x < (int)sizeof(tkey); x++) {
    for (x = 0; x < skeylen && x < (int)sizeof(tkey); x++) {
        tkey[x] ^= salt_key[x];
        tkey[x] ^= salt_key[x];
-   }       
+   }
    for (; x < keylen && x < (int)sizeof(tkey); x++) {
    for (; x < keylen && x < (int)sizeof(tkey); x++) {
        tkey[x] ^= 0x55;
        tkey[x] ^= 0x55;
    }
    }
-   
+
    /* now encrypt with tkey[0..keylen-1] the IV and use that as the IV */
    /* now encrypt with tkey[0..keylen-1] the IV and use that as the IV */
    if ((err = cipher_descriptor[cipher].setup(tkey, keylen, num_rounds, &f8->key)) != CRYPT_OK) {
    if ((err = cipher_descriptor[cipher].setup(tkey, keylen, num_rounds, &f8->key)) != CRYPT_OK) {
       return err;
       return err;
    }
    }
-   
+
    /* encrypt IV */
    /* encrypt IV */
    if ((err = cipher_descriptor[f8->cipher].ecb_encrypt(IV, f8->MIV, &f8->key)) != CRYPT_OK) {
    if ((err = cipher_descriptor[f8->cipher].ecb_encrypt(IV, f8->MIV, &f8->key)) != CRYPT_OK) {
       cipher_descriptor[f8->cipher].done(&f8->key);
       cipher_descriptor[f8->cipher].done(&f8->key);
@@ -83,10 +83,10 @@ int f8_start(                int  cipher, const unsigned char *IV,
    }
    }
    zeromem(tkey, sizeof(tkey));
    zeromem(tkey, sizeof(tkey));
    zeromem(f8->IV, sizeof(f8->IV));
    zeromem(f8->IV, sizeof(f8->IV));
-   
+
    /* terminate this cipher */
    /* terminate this cipher */
    cipher_descriptor[f8->cipher].done(&f8->key);
    cipher_descriptor[f8->cipher].done(&f8->key);
-   
+
    /* init the cipher */
    /* init the cipher */
    return cipher_descriptor[cipher].setup(key, keylen, num_rounds, &f8->key);
    return cipher_descriptor[cipher].setup(key, keylen, num_rounds, &f8->key);
 }
 }

+ 14 - 14
src/modes/f8/f8_test_mode.c

@@ -23,36 +23,36 @@ int f8_test_mode(void)
 #ifndef LTC_TEST
 #ifndef LTC_TEST
    return CRYPT_NOP;
    return CRYPT_NOP;
 #else
 #else
-   static const unsigned char key[16] = { 0x23, 0x48, 0x29, 0x00, 0x84, 0x67, 0xbe, 0x18, 
+   static const unsigned char key[16] = { 0x23, 0x48, 0x29, 0x00, 0x84, 0x67, 0xbe, 0x18,
                                           0x6c, 0x3d, 0xe1, 0x4a, 0xae, 0x72, 0xd6, 0x2c };
                                           0x6c, 0x3d, 0xe1, 0x4a, 0xae, 0x72, 0xd6, 0x2c };
    static const unsigned char salt[4] = { 0x32, 0xf2, 0x87, 0x0d };
    static const unsigned char salt[4] = { 0x32, 0xf2, 0x87, 0x0d };
-   static const unsigned char IV[16]  = { 0x00, 0x6e, 0x5c, 0xba, 0x50, 0x68, 0x1d, 0xe5, 
+   static const unsigned char IV[16]  = { 0x00, 0x6e, 0x5c, 0xba, 0x50, 0x68, 0x1d, 0xe5,
                                           0x5c, 0x62, 0x15, 0x99, 0xd4, 0x62, 0x56, 0x4a };
                                           0x5c, 0x62, 0x15, 0x99, 0xd4, 0x62, 0x56, 0x4a };
-   static const unsigned char pt[39]  = { 0x70, 0x73, 0x65, 0x75, 0x64, 0x6f, 0x72, 0x61, 
+   static const unsigned char pt[39]  = { 0x70, 0x73, 0x65, 0x75, 0x64, 0x6f, 0x72, 0x61,
                                           0x6e, 0x64, 0x6f, 0x6d, 0x6e, 0x65, 0x73, 0x73,
                                           0x6e, 0x64, 0x6f, 0x6d, 0x6e, 0x65, 0x73, 0x73,
-                                          0x20, 0x69, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 
+                                          0x20, 0x69, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20,
                                           0x6e, 0x65, 0x78, 0x74, 0x20, 0x62, 0x65, 0x73,
                                           0x6e, 0x65, 0x78, 0x74, 0x20, 0x62, 0x65, 0x73,
                                           0x74, 0x20, 0x74, 0x68, 0x69, 0x6e, 0x67       };
                                           0x74, 0x20, 0x74, 0x68, 0x69, 0x6e, 0x67       };
-   static const unsigned char ct[39]  = { 0x01, 0x9c, 0xe7, 0xa2, 0x6e, 0x78, 0x54, 0x01, 
+   static const unsigned char ct[39]  = { 0x01, 0x9c, 0xe7, 0xa2, 0x6e, 0x78, 0x54, 0x01,
                                           0x4a, 0x63, 0x66, 0xaa, 0x95, 0xd4, 0xee, 0xfd,
                                           0x4a, 0x63, 0x66, 0xaa, 0x95, 0xd4, 0xee, 0xfd,
-                                          0x1a, 0xd4, 0x17, 0x2a, 0x14, 0xf9, 0xfa, 0xf4, 
+                                          0x1a, 0xd4, 0x17, 0x2a, 0x14, 0xf9, 0xfa, 0xf4,
                                           0x55, 0xb7, 0xf1, 0xd4, 0xb6, 0x2b, 0xd0, 0x8f,
                                           0x55, 0xb7, 0xf1, 0xd4, 0xb6, 0x2b, 0xd0, 0x8f,
                                           0x56, 0x2c, 0x0e, 0xef, 0x7c, 0x48, 0x02       };
                                           0x56, 0x2c, 0x0e, 0xef, 0x7c, 0x48, 0x02       };
    unsigned char buf[39];
    unsigned char buf[39];
    symmetric_F8  f8;
    symmetric_F8  f8;
    int           err, idx;
    int           err, idx;
-   
+
    idx = find_cipher("aes");
    idx = find_cipher("aes");
    if (idx == -1) {
    if (idx == -1) {
       idx = find_cipher("rijndael");
       idx = find_cipher("rijndael");
       if (idx == -1) return CRYPT_NOP;
       if (idx == -1) return CRYPT_NOP;
-   }      
-   
+   }
+
    /* initialize the context */
    /* initialize the context */
    if ((err = f8_start(idx, IV, key, sizeof(key), salt, sizeof(salt), 0, &f8)) != CRYPT_OK) {
    if ((err = f8_start(idx, IV, key, sizeof(key), salt, sizeof(salt), 0, &f8)) != CRYPT_OK) {
       return err;
       return err;
    }
    }
-   
+
    /* encrypt block */
    /* encrypt block */
    if ((err = f8_encrypt(pt, buf, sizeof(pt), &f8)) != CRYPT_OK) {
    if ((err = f8_encrypt(pt, buf, sizeof(pt), &f8)) != CRYPT_OK) {
       f8_done(&f8);
       f8_done(&f8);
@@ -63,11 +63,11 @@ int f8_test_mode(void)
    /* compare */
    /* compare */
    if (XMEMCMP(buf, ct, sizeof(ct))) {
    if (XMEMCMP(buf, ct, sizeof(ct))) {
       return CRYPT_FAIL_TESTVECTOR;
       return CRYPT_FAIL_TESTVECTOR;
-   }      
-   
+   }
+
    return CRYPT_OK;
    return CRYPT_OK;
-#endif   
-}   
+#endif
+}
 
 
 #endif
 #endif
 
 

+ 2 - 2
src/modes/lrw/lrw_done.c

@@ -22,12 +22,12 @@
   @param lrw   The state to terminate
   @param lrw   The state to terminate
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
-int lrw_done(symmetric_LRW *lrw) 
+int lrw_done(symmetric_LRW *lrw)
 {
 {
    int err;
    int err;
 
 
    LTC_ARGCHK(lrw != NULL);
    LTC_ARGCHK(lrw != NULL);
- 
+
    if ((err = cipher_is_valid(lrw->cipher)) != CRYPT_OK) {
    if ((err = cipher_is_valid(lrw->cipher)) != CRYPT_OK) {
       return err;
       return err;
    }
    }

+ 1 - 1
src/modes/lrw/lrw_encrypt.c

@@ -16,7 +16,7 @@
 */
 */
 
 
 #ifdef LTC_LRW_MODE
 #ifdef LTC_LRW_MODE
- 
+
 /**
 /**
   LRW encrypt blocks
   LRW encrypt blocks
   @param pt     The plaintext
   @param pt     The plaintext

+ 3 - 3
src/modes/lrw/lrw_start.c

@@ -19,9 +19,9 @@
 
 
 /**
 /**
   Initialize the LRW context
   Initialize the LRW context
-  @param cipher        The cipher desired, must be a 128-bit block cipher 
+  @param cipher        The cipher desired, must be a 128-bit block cipher
   @param IV            The index value, must be 128-bits
   @param IV            The index value, must be 128-bits
-  @param key           The cipher key 
+  @param key           The cipher key
   @param keylen        The length of the cipher key in octets
   @param keylen        The length of the cipher key in octets
   @param tweak         The tweak value (second key), must be 128-bits
   @param tweak         The tweak value (second key), must be 128-bits
   @param num_rounds    The number of rounds for the cipher (0 == default)
   @param num_rounds    The number of rounds for the cipher (0 == default)
@@ -32,7 +32,7 @@ int lrw_start(               int   cipher,
               const unsigned char *IV,
               const unsigned char *IV,
               const unsigned char *key,       int keylen,
               const unsigned char *key,       int keylen,
               const unsigned char *tweak,
               const unsigned char *tweak,
-                             int  num_rounds, 
+                             int  num_rounds,
                    symmetric_LRW *lrw)
                    symmetric_LRW *lrw)
 {
 {
    int           err;
    int           err;

+ 1 - 1
src/modes/lrw/lrw_test.c

@@ -105,7 +105,7 @@ int lrw_test(void)
      }
      }
 
 
      /* process block */
      /* process block */
-     if ((err = lrw_setiv(tests[x].IV, 16, &lrw)) != CRYPT_OK) { 
+     if ((err = lrw_setiv(tests[x].IV, 16, &lrw)) != CRYPT_OK) {
         lrw_done(&lrw);
         lrw_done(&lrw);
         return err;
         return err;
      }
      }

+ 1 - 1
src/modes/ofb/ofb_decrypt.c

@@ -36,7 +36,7 @@ int ofb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, s
 
 
 #endif
 #endif
 
 
- 
+
 
 
 /* $Source$ */
 /* $Source$ */
 /* $Revision$ */
 /* $Revision$ */

+ 1 - 1
src/modes/ofb/ofb_done.c

@@ -33,7 +33,7 @@ int ofb_done(symmetric_OFB *ofb)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
-   
+
 
 
 #endif
 #endif
 
 

+ 2 - 2
src/modes/ofb/ofb_encrypt.c

@@ -34,13 +34,13 @@ int ofb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s
    if ((err = cipher_is_valid(ofb->cipher)) != CRYPT_OK) {
    if ((err = cipher_is_valid(ofb->cipher)) != CRYPT_OK) {
        return err;
        return err;
    }
    }
-   
+
    /* is blocklen/padlen valid? */
    /* is blocklen/padlen valid? */
    if (ofb->blocklen < 0 || ofb->blocklen > (int)sizeof(ofb->IV) ||
    if (ofb->blocklen < 0 || ofb->blocklen > (int)sizeof(ofb->IV) ||
        ofb->padlen   < 0 || ofb->padlen   > (int)sizeof(ofb->IV)) {
        ofb->padlen   < 0 || ofb->padlen   > (int)sizeof(ofb->IV)) {
       return CRYPT_INVALID_ARG;
       return CRYPT_INVALID_ARG;
    }
    }
-   
+
    while (len-- > 0) {
    while (len-- > 0) {
        if (ofb->padlen == ofb->blocklen) {
        if (ofb->padlen == ofb->blocklen) {
           if ((err = cipher_descriptor[ofb->cipher].ecb_encrypt(ofb->IV, ofb->IV, &ofb->key)) != CRYPT_OK) {
           if ((err = cipher_descriptor[ofb->cipher].ecb_encrypt(ofb->IV, ofb->IV, &ofb->key)) != CRYPT_OK) {

+ 1 - 1
src/modes/ofb/ofb_setiv.c

@@ -44,7 +44,7 @@ int ofb_setiv(const unsigned char *IV, unsigned long len, symmetric_OFB *ofb)
    return cipher_descriptor[ofb->cipher].ecb_encrypt(IV, ofb->IV, &ofb->key);
    return cipher_descriptor[ofb->cipher].ecb_encrypt(IV, ofb->IV, &ofb->key);
 }
 }
 
 
-#endif 
+#endif
 
 
 
 
 /* $Source$ */
 /* $Source$ */

+ 2 - 2
src/modes/ofb/ofb_start.c

@@ -22,13 +22,13 @@
    Initialize a OFB context
    Initialize a OFB context
    @param cipher      The index of the cipher desired
    @param cipher      The index of the cipher desired
    @param IV          The initial vector
    @param IV          The initial vector
-   @param key         The secret key 
+   @param key         The secret key
    @param keylen      The length of the secret key (octets)
    @param keylen      The length of the secret key (octets)
    @param num_rounds  Number of rounds in the cipher desired (0 for default)
    @param num_rounds  Number of rounds in the cipher desired (0 for default)
    @param ofb         The OFB state to initialize
    @param ofb         The OFB state to initialize
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-int ofb_start(int cipher, const unsigned char *IV, const unsigned char *key, 
+int ofb_start(int cipher, const unsigned char *IV, const unsigned char *key,
               int keylen, int num_rounds, symmetric_OFB *ofb)
               int keylen, int num_rounds, symmetric_OFB *ofb)
 {
 {
    int x, err;
    int x, err;

+ 1 - 1
src/pk/asn1/der/bit/der_decode_bit_string.c

@@ -67,7 +67,7 @@ int der_decode_bit_string(const unsigned char *in,  unsigned long inlen,
       /* short format */
       /* short format */
       dlen = in[x++] & 0x7F;
       dlen = in[x++] & 0x7F;
    }
    }
-  
+
    /* is the data len too long or too short? */
    /* is the data len too long or too short? */
    if ((dlen == 0) || (dlen + x > inlen)) {
    if ((dlen == 0) || (dlen + x > inlen)) {
        return CRYPT_INVALID_PACKET;
        return CRYPT_INVALID_PACKET;

+ 2 - 2
src/pk/asn1/der/bit/der_length_bit_string.c

@@ -17,7 +17,7 @@
 
 
 #ifdef LTC_DER
 #ifdef LTC_DER
 /**
 /**
-  Gets length of DER encoding of BIT STRING 
+  Gets length of DER encoding of BIT STRING
   @param nbits  The number of bits in the string to encode
   @param nbits  The number of bits in the string to encode
   @param outlen [out] The length of the DER encoding for the given string
   @param outlen [out] The length of the DER encoding for the given string
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
@@ -29,7 +29,7 @@ int der_length_bit_string(unsigned long nbits, unsigned long *outlen)
 
 
    /* get the number of the bytes */
    /* get the number of the bytes */
    nbytes = (nbits >> 3) + ((nbits & 7) ? 1 : 0) + 1;
    nbytes = (nbits >> 3) + ((nbits & 7) ? 1 : 0) + 1;
- 
+
    if (nbytes < 128) {
    if (nbytes < 128) {
       /* 03 LL PP DD DD DD ... */
       /* 03 LL PP DD DD DD ... */
       *outlen = 2 + nbytes;
       *outlen = 2 + nbytes;

+ 3 - 3
src/pk/asn1/der/boolean/der_decode_boolean.c

@@ -30,13 +30,13 @@ int der_decode_boolean(const unsigned char *in, unsigned long inlen,
 {
 {
    LTC_ARGCHK(in  != NULL);
    LTC_ARGCHK(in  != NULL);
    LTC_ARGCHK(out != NULL);
    LTC_ARGCHK(out != NULL);
-   
+
    if (inlen < 3 || in[0] != 0x01 || in[1] != 0x01 || (in[2] != 0x00 && in[2] != 0xFF)) {
    if (inlen < 3 || in[0] != 0x01 || in[1] != 0x01 || (in[2] != 0x00 && in[2] != 0xFF)) {
       return CRYPT_INVALID_ARG;
       return CRYPT_INVALID_ARG;
    }
    }
-   
+
    *out = (in[2]==0xFF) ? 1 : 0;
    *out = (in[2]==0xFF) ? 1 : 0;
-   
+
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 

+ 4 - 4
src/pk/asn1/der/boolean/der_encode_boolean.c

@@ -25,22 +25,22 @@
   @param outlen   [in/out] The max size and resulting size of the DER BOOLEAN
   @param outlen   [in/out] The max size and resulting size of the DER BOOLEAN
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
-int der_encode_boolean(int in, 
+int der_encode_boolean(int in,
                        unsigned char *out, unsigned long *outlen)
                        unsigned char *out, unsigned long *outlen)
 {
 {
    LTC_ARGCHK(outlen != NULL);
    LTC_ARGCHK(outlen != NULL);
    LTC_ARGCHK(out    != NULL);
    LTC_ARGCHK(out    != NULL);
-   
+
    if (*outlen < 3) {
    if (*outlen < 3) {
        *outlen = 3;
        *outlen = 3;
        return CRYPT_BUFFER_OVERFLOW;
        return CRYPT_BUFFER_OVERFLOW;
    }
    }
-   
+
    *outlen = 3;
    *outlen = 3;
    out[0] = 0x01;
    out[0] = 0x01;
    out[1] = 0x01;
    out[1] = 0x01;
    out[2] = in ? 0xFF : 0x00;
    out[2] = in ? 0xFF : 0x00;
-   
+
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 

+ 1 - 1
src/pk/asn1/der/boolean/der_length_boolean.c

@@ -17,7 +17,7 @@
 
 
 #ifdef LTC_DER
 #ifdef LTC_DER
 /**
 /**
-  Gets length of DER encoding of a BOOLEAN 
+  Gets length of DER encoding of a BOOLEAN
   @param outlen [out] The length of the DER encoding
   @param outlen [out] The length of the DER encoding
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */

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