Mercurial > dropbear
comparison libtomcrypt/src/modes/ecb/ecb_decrypt.c @ 435:337c45621e81
merge of 'a9b0496634cdd25647b65e585cc3240f3fa699ee'
and 'c22be8b8f570b48e9662dac32c7b3e7148a42206'
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 22 Feb 2007 14:53:49 +0000 |
parents | 0cbe8f6dbf9e |
children | f849a5ca2efc |
comparison
equal
deleted
inserted
replaced
434:0aaaf68e97dc | 435:337c45621e81 |
---|---|
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 * | 8 * |
9 * Tom St Denis, [email protected], http://libtomcrypt.org | 9 * Tom St Denis, [email protected], http://libtomcrypt.com |
10 */ | 10 */ |
11 #include "tomcrypt.h" | 11 #include "tomcrypt.h" |
12 | 12 |
13 /** | 13 /** |
14 @file ecb_decrypt.c | 14 @file ecb_decrypt.c |
15 ECB implementation, decrypt a block, Tom St Denis | 15 ECB implementation, decrypt a block, Tom St Denis |
16 */ | 16 */ |
17 | 17 |
18 #ifdef ECB | 18 #ifdef LTC_ECB_MODE |
19 | 19 |
20 /** | 20 /** |
21 ECB decrypt | 21 ECB decrypt |
22 @param ct Ciphertext | 22 @param ct Ciphertext |
23 @param pt [out] Plaintext | 23 @param pt [out] Plaintext |
38 return CRYPT_INVALID_ARG; | 38 return CRYPT_INVALID_ARG; |
39 } | 39 } |
40 | 40 |
41 /* check for accel */ | 41 /* check for accel */ |
42 if (cipher_descriptor[ecb->cipher].accel_ecb_decrypt != NULL) { | 42 if (cipher_descriptor[ecb->cipher].accel_ecb_decrypt != NULL) { |
43 cipher_descriptor[ecb->cipher].accel_ecb_decrypt(ct, pt, len / cipher_descriptor[ecb->cipher].block_length, &ecb->key); | 43 return cipher_descriptor[ecb->cipher].accel_ecb_decrypt(ct, pt, len / cipher_descriptor[ecb->cipher].block_length, &ecb->key); |
44 } else { | 44 } else { |
45 while (len) { | 45 while (len) { |
46 cipher_descriptor[ecb->cipher].ecb_decrypt(ct, pt, &ecb->key); | 46 if ((err = cipher_descriptor[ecb->cipher].ecb_decrypt(ct, pt, &ecb->key)) != CRYPT_OK) { |
47 return err; | |
48 } | |
47 pt += cipher_descriptor[ecb->cipher].block_length; | 49 pt += cipher_descriptor[ecb->cipher].block_length; |
48 ct += cipher_descriptor[ecb->cipher].block_length; | 50 ct += cipher_descriptor[ecb->cipher].block_length; |
49 len -= cipher_descriptor[ecb->cipher].block_length; | 51 len -= cipher_descriptor[ecb->cipher].block_length; |
50 } | 52 } |
51 } | 53 } |
53 } | 55 } |
54 | 56 |
55 #endif | 57 #endif |
56 | 58 |
57 /* $Source: /cvs/libtom/libtomcrypt/src/modes/ecb/ecb_decrypt.c,v $ */ | 59 /* $Source: /cvs/libtom/libtomcrypt/src/modes/ecb/ecb_decrypt.c,v $ */ |
58 /* $Revision: 1.5 $ */ | 60 /* $Revision: 1.9 $ */ |
59 /* $Date: 2005/05/05 14:35:59 $ */ | 61 /* $Date: 2006/06/29 01:51:34 $ */ |