summaryrefslogtreecommitdiffhomepage
path: root/libtomcrypt/src/modes/f8/f8_encrypt.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2018-02-09 21:44:05 +0800
committerMatt Johnston <matt@ucc.asn.au>2018-02-09 21:44:05 +0800
commit4f2eb1914bdac3ed3ee504ad86061281dbe0d074 (patch)
tree078293375c3f3ee2d485cf9559a08d65d460786a /libtomcrypt/src/modes/f8/f8_encrypt.c
parentd72f50ff3284e15124a0f233c26339229fe305ac (diff)
Update to libtomcrypt 1.18.1, merged with Dropbear changes
Diffstat (limited to 'libtomcrypt/src/modes/f8/f8_encrypt.c')
-rw-r--r--libtomcrypt/src/modes/f8/f8_encrypt.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/libtomcrypt/src/modes/f8/f8_encrypt.c b/libtomcrypt/src/modes/f8/f8_encrypt.c
index d1a96df..058f25a 100644
--- a/libtomcrypt/src/modes/f8/f8_encrypt.c
+++ b/libtomcrypt/src/modes/f8/f8_encrypt.c
@@ -5,8 +5,6 @@
*
* The library is free for all purposes without any express
* guarantee it works.
- *
- * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
*/
#include "tomcrypt.h"
@@ -35,13 +33,13 @@ int f8_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, sy
if ((err = cipher_is_valid(f8->cipher)) != CRYPT_OK) {
return err;
}
-
+
/* is blocklen/padlen valid? */
if (f8->blocklen < 0 || f8->blocklen > (int)sizeof(f8->IV) ||
f8->padlen < 0 || f8->padlen > (int)sizeof(f8->IV)) {
return CRYPT_INVALID_ARG;
}
-
+
zeromem(buf, sizeof(buf));
/* make sure the pad is empty */
@@ -64,8 +62,8 @@ int f8_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, sy
STORE32H(f8->blockcnt, (buf+(f8->blocklen-4)));
++(f8->blockcnt);
for (x = 0; x < f8->blocklen; x += sizeof(LTC_FAST_TYPE)) {
- *((LTC_FAST_TYPE*)(&ct[x])) = *((LTC_FAST_TYPE*)(&pt[x])) ^ *((LTC_FAST_TYPE*)(&f8->IV[x]));
- *((LTC_FAST_TYPE*)(&f8->IV[x])) ^= *((LTC_FAST_TYPE*)(&f8->MIV[x])) ^ *((LTC_FAST_TYPE*)(&buf[x]));
+ *(LTC_FAST_TYPE_PTR_CAST(&ct[x])) = *(LTC_FAST_TYPE_PTR_CAST(&pt[x])) ^ *(LTC_FAST_TYPE_PTR_CAST(&f8->IV[x]));
+ *(LTC_FAST_TYPE_PTR_CAST(&f8->IV[x])) ^= *(LTC_FAST_TYPE_PTR_CAST(&f8->MIV[x])) ^ *(LTC_FAST_TYPE_PTR_CAST(&buf[x]));
}
if ((err = cipher_descriptor[f8->cipher].ecb_encrypt(f8->IV, f8->IV, &f8->key)) != CRYPT_OK) {
return err;
@@ -75,7 +73,7 @@ int f8_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, sy
ct += x;
}
}
-#endif
+#endif
while (len > 0) {
if (f8->padlen == f8->blocklen) {
@@ -98,6 +96,6 @@ int f8_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, sy
#endif
-/* $Source$ */
-/* $Revision$ */
-/* $Date$ */
+/* ref: $Format:%D$ */
+/* git commit: $Format:%H$ */
+/* commit time: $Format:%ai$ */