Mercurial > dropbear
comparison libtomcrypt/src/encauth/eax/eax_encrypt_authenticate_memory.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 |
comparison
equal
deleted
inserted
replaced
1457:32f990cc96b1 | 1511:5916af64acd4 |
---|---|
3 * LibTomCrypt is a library that provides various cryptographic | 3 * LibTomCrypt is a library that provides various cryptographic |
4 * algorithms in a highly modular and flexible manner. | 4 * algorithms in a highly modular and flexible manner. |
5 * | 5 * |
6 * The library is free for all purposes without any express | 6 * The library is free for all purposes without any express |
7 * guarantee it works. | 7 * guarantee it works. |
8 * | |
9 * Tom St Denis, [email protected], http://libtom.org | |
10 */ | 8 */ |
11 | 9 |
12 /** | 10 /** |
13 @file eax_encrypt_authenticate_memory.c | 11 @file eax_encrypt_authenticate_memory.c |
14 EAX implementation, encrypt a block of memory, by Tom St Denis | 12 EAX implementation, encrypt a block of memory, by Tom St Denis |
51 LTC_ARGCHK(taglen != NULL); | 49 LTC_ARGCHK(taglen != NULL); |
52 | 50 |
53 eax = XMALLOC(sizeof(*eax)); | 51 eax = XMALLOC(sizeof(*eax)); |
54 | 52 |
55 if ((err = eax_init(eax, cipher, key, keylen, nonce, noncelen, header, headerlen)) != CRYPT_OK) { | 53 if ((err = eax_init(eax, cipher, key, keylen, nonce, noncelen, header, headerlen)) != CRYPT_OK) { |
56 goto LBL_ERR; | 54 goto LBL_ERR; |
57 } | 55 } |
58 | 56 |
59 if ((err = eax_encrypt(eax, pt, ct, ptlen)) != CRYPT_OK) { | 57 if ((err = eax_encrypt(eax, pt, ct, ptlen)) != CRYPT_OK) { |
60 goto LBL_ERR; | 58 goto LBL_ERR; |
61 } | 59 } |
62 | 60 |
63 if ((err = eax_done(eax, tag, taglen)) != CRYPT_OK) { | 61 if ((err = eax_done(eax, tag, taglen)) != CRYPT_OK) { |
64 goto LBL_ERR; | 62 goto LBL_ERR; |
65 } | 63 } |
66 | 64 |
67 err = CRYPT_OK; | 65 err = CRYPT_OK; |
68 LBL_ERR: | 66 LBL_ERR: |
69 #ifdef LTC_CLEAN_STACK | 67 #ifdef LTC_CLEAN_STACK |
70 zeromem(eax, sizeof(*eax)); | 68 zeromem(eax, sizeof(*eax)); |
71 #endif | 69 #endif |
72 | 70 |
73 XFREE(eax); | 71 XFREE(eax); |
74 | 72 |
75 return err; | 73 return err; |
76 } | 74 } |
77 | 75 |
78 #endif | 76 #endif |
79 | 77 |
80 /* $Source$ */ | 78 /* ref: $Format:%D$ */ |
81 /* $Revision$ */ | 79 /* git commit: $Format:%H$ */ |
82 /* $Date$ */ | 80 /* commit time: $Format:%ai$ */ |