1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
3 * LibTomCrypt is a library that provides various cryptographic
4 * algorithms in a highly modular and flexible manner.
6 * The library is free for all purposes without any express
12 Source donated by Elliptic Semiconductor Inc (www.ellipticsemi.com) to the LibTom Projects
18 @param cipher The index of the cipher to use
19 @param key1 The encrypt key
20 @param key2 The tweak encrypt key
21 @param keylen The length of the keys (each) in octets
22 @param num_rounds The number of rounds for the cipher (0 == default)
23 @param xts [out] XTS structure
24 Returns CRYPT_OK upon success.
26 int xts_start(int cipher, const unsigned char *key1, const unsigned char *key2, unsigned long keylen, int num_rounds,
32 LTC_ARGCHK(key1 != NULL);
33 LTC_ARGCHK(key2 != NULL);
34 LTC_ARGCHK(xts != NULL);
37 if ((err = cipher_is_valid(cipher)) != CRYPT_OK) {
41 if (cipher_descriptor[cipher].block_length != 16) {
42 return CRYPT_INVALID_ARG;
45 /* schedule the two ciphers */
46 if ((err = cipher_descriptor[cipher].setup(key1, keylen, num_rounds, &xts->key1)) != CRYPT_OK) {
49 if ((err = cipher_descriptor[cipher].setup(key2, keylen, num_rounds, &xts->key2)) != CRYPT_OK) {
59 /* ref: $Format:%D$ */
60 /* git commit: $Format:%H$ */
61 /* commit time: $Format:%ai$ */