Mercurial > dropbear
comparison libtomcrypt/src/modes/ctr/ctr_start.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 #include "tomcrypt.h" | 9 #include "tomcrypt.h" |
12 | 10 |
13 /** | 11 /** |
14 @file ctr_start.c | 12 @file ctr_start.c |
19 #ifdef LTC_CTR_MODE | 17 #ifdef LTC_CTR_MODE |
20 | 18 |
21 /** | 19 /** |
22 Initialize a CTR context | 20 Initialize a CTR context |
23 @param cipher The index of the cipher desired | 21 @param cipher The index of the cipher desired |
24 @param IV The initial vector | 22 @param IV The initialization vector |
25 @param key The secret key | 23 @param key The secret key |
26 @param keylen The length of the secret key (octets) | 24 @param keylen The length of the secret key (octets) |
27 @param num_rounds Number of rounds in the cipher desired (0 for default) | 25 @param num_rounds Number of rounds in the cipher desired (0 for default) |
28 @param ctr_mode The counter mode (CTR_COUNTER_LITTLE_ENDIAN or CTR_COUNTER_BIG_ENDIAN) | 26 @param ctr_mode The counter mode (CTR_COUNTER_LITTLE_ENDIAN or CTR_COUNTER_BIG_ENDIAN) |
29 @param ctr The CTR state to initialize | 27 @param ctr The CTR state to initialize |
30 @return CRYPT_OK if successful | 28 @return CRYPT_OK if successful |
31 */ | 29 */ |
32 int ctr_start( int cipher, | 30 int ctr_start( int cipher, |
33 const unsigned char *IV, | 31 const unsigned char *IV, |
34 const unsigned char *key, int keylen, | 32 const unsigned char *key, int keylen, |
35 int num_rounds, int ctr_mode, | 33 int num_rounds, int ctr_mode, |
36 symmetric_CTR *ctr) | 34 symmetric_CTR *ctr) |
37 { | 35 { |
38 int x, err; | 36 int x, err; |
39 | 37 |
89 } | 87 } |
90 } | 88 } |
91 } | 89 } |
92 } | 90 } |
93 | 91 |
94 return cipher_descriptor[ctr->cipher].ecb_encrypt(ctr->ctr, ctr->pad, &ctr->key); | 92 return cipher_descriptor[ctr->cipher].ecb_encrypt(ctr->ctr, ctr->pad, &ctr->key); |
95 } | 93 } |
96 | 94 |
97 #endif | 95 #endif |
98 | 96 |
99 /* $Source$ */ | 97 /* ref: $Format:%D$ */ |
100 /* $Revision$ */ | 98 /* git commit: $Format:%H$ */ |
101 /* $Date$ */ | 99 /* commit time: $Format:%ai$ */ |