Mercurial > dropbear
comparison libtomcrypt/src/modes/xts/xts_init.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 Source donated by Elliptic Semiconductor Inc (www.ellipticsemi.com) to the LibTom Projects | 12 Source donated by Elliptic Semiconductor Inc (www.ellipticsemi.com) to the LibTom Projects |
15 */ | 13 */ |
16 | 14 |
17 #ifdef LTC_XTS_MODE | 15 #ifdef LTC_XTS_MODE |
18 | |
19 | 16 |
20 /** Start XTS mode | 17 /** Start XTS mode |
21 @param cipher The index of the cipher to use | 18 @param cipher The index of the cipher to use |
22 @param key1 The encrypt key | 19 @param key1 The encrypt key |
23 @param key2 The tweak encrypt key | 20 @param key2 The tweak encrypt key |
24 @param keylen The length of the keys (each) in octets | 21 @param keylen The length of the keys (each) in octets |
25 @param num_rounds The number of rounds for the cipher (0 == default) | 22 @param num_rounds The number of rounds for the cipher (0 == default) |
26 @param xts [out] XTS structure | 23 @param xts [out] XTS structure |
27 Returns CRYPT_OK upon success. | 24 Returns CRYPT_OK upon success. |
28 */ | 25 */ |
29 int xts_start( int cipher, | 26 int xts_start(int cipher, const unsigned char *key1, const unsigned char *key2, unsigned long keylen, int num_rounds, |
30 const unsigned char *key1, | 27 symmetric_xts *xts) |
31 const unsigned char *key2, | |
32 unsigned long keylen, | |
33 int num_rounds, | |
34 symmetric_xts *xts) | |
35 { | 28 { |
36 int err; | 29 int err; |
37 | 30 |
38 /* check inputs */ | 31 /* check inputs */ |
39 LTC_ARGCHK(key1 != NULL); | 32 LTC_ARGCHK(key1 != NULL); |
40 LTC_ARGCHK(key2 != NULL); | 33 LTC_ARGCHK(key2 != NULL); |
41 LTC_ARGCHK(xts != NULL); | 34 LTC_ARGCHK(xts != NULL); |
42 | 35 |
43 /* check if valid */ | 36 /* check if valid */ |
44 if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { | 37 if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { |
45 return err; | 38 return err; |
46 } | 39 } |
61 return err; | 54 return err; |
62 } | 55 } |
63 | 56 |
64 #endif | 57 #endif |
65 | 58 |
66 /* $Source$ */ | 59 /* ref: $Format:%D$ */ |
67 /* $Revision$ */ | 60 /* git commit: $Format:%H$ */ |
68 /* $Date$ */ | 61 /* commit time: $Format:%ai$ */ |
69 |