Mercurial > dropbear
diff libtomcrypt/src/modes/f8/f8_encrypt.c @ 1511:5916af64acd4 fuzz
merge from main
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 17 Feb 2018 19:29:51 +0800 |
parents | 6dba84798cd5 |
children |
line wrap: on
line diff
--- a/libtomcrypt/src/modes/f8/f8_encrypt.c Tue Jan 23 23:27:40 2018 +0800 +++ b/libtomcrypt/src/modes/f8/f8_encrypt.c Sat Feb 17 19:29:51 2018 +0800 @@ -5,8 +5,6 @@ * * The library is free for all purposes without any express * guarantee it works. - * - * Tom St Denis, [email protected], http://libtom.org */ #include "tomcrypt.h" @@ -35,13 +33,13 @@ 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 @@ 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 @@ ct += x; } } -#endif +#endif while (len > 0) { if (f8->padlen == f8->blocklen) { @@ -98,6 +96,6 @@ #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */