Mercurial > dropbear
diff libtomcrypt/src/encauth/ocb/s_ocb_done.c @ 1471:6dba84798cd5
Update to libtomcrypt 1.18.1, merged with Dropbear changes
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 09 Feb 2018 21:44:05 +0800 |
parents | f849a5ca2efc |
children |
line wrap: on
line diff
--- a/libtomcrypt/src/encauth/ocb/s_ocb_done.c Thu Feb 08 23:11:40 2018 +0800 +++ b/libtomcrypt/src/encauth/ocb/s_ocb_done.c Fri Feb 09 21:44:05 2018 +0800 @@ -5,11 +5,9 @@ * * The library is free for all purposes without any express * guarantee it works. - * - * Tom St Denis, [email protected], http://libtom.org */ -/** +/** @file s_ocb_done.c OCB implementation, internal helper, by Tom St Denis */ @@ -22,7 +20,7 @@ * is we XOR the final ciphertext into the checksum so we have to xor it * 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 +72,13 @@ } /* 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); X[ocb->block_len-1] ^= (ptlen*8)&255; X[ocb->block_len-2] ^= ((ptlen*8)>>8)&255; for (x = 0; x < ocb->block_len; x++) { - X[x] ^= ocb->Lr[x]; + X[x] ^= ocb->Lr[x]; } /* Y[m] = E(X[m])) */ @@ -93,7 +91,7 @@ /* xor C[m] into checksum */ for (x = 0; x < (int)ptlen; x++) { ocb->checksum[x] ^= ct[x]; - } + } } /* C[m] = P[m] xor Y[m] */ @@ -102,7 +100,7 @@ } if (mode == 0) { - /* encrypt mode */ + /* encrypt mode */ /* xor C[m] into checksum */ for (x = 0; x < (int)ptlen; x++) { ocb->checksum[x] ^= ct[x]; @@ -113,7 +111,7 @@ for (x = 0; x < ocb->block_len; x++) { ocb->checksum[x] ^= Y[x] ^ Z[x]; } - + /* encrypt checksum, er... tag!! */ if ((err = cipher_descriptor[ocb->cipher].ecb_encrypt(ocb->checksum, X, &ocb->key)) != CRYPT_OK) { goto error; @@ -132,7 +130,7 @@ zeromem(Z, MAXBLOCKSIZE); zeromem(ocb, sizeof(*ocb)); #endif -error: +error: XFREE(X); XFREE(Y); XFREE(Z); @@ -143,6 +141,6 @@ #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */