diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2011-04-12 23:21:33 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2011-04-12 23:21:33 +0000 |
commit | 32a2d8ddfebdde06bfdf4fdac54d487c5d03cbea (patch) | |
tree | 65c2b96de034be57560a3cc7943890ce62d6b2ce /crypto/modes/xts128.c | |
parent | 4bd1e895faa35a8d4810402fe3ba9d07c1166908 (diff) |
Provisional AES XTS support.
Diffstat (limited to 'crypto/modes/xts128.c')
-rw-r--r-- | crypto/modes/xts128.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/crypto/modes/xts128.c b/crypto/modes/xts128.c index de1f5a11fa..aaa44e05f0 100644 --- a/crypto/modes/xts128.c +++ b/crypto/modes/xts128.c @@ -58,12 +58,7 @@ #endif #include <assert.h> -typedef struct { - void *key1, *key2; - block128_f block1,block2; -} XTS128_CONTEXT; - -int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, u64 secno, +int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char *iv, const unsigned char *inp, unsigned char *out, size_t len, int enc) { @@ -73,15 +68,7 @@ int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, u64 secno, if (len<16) return -1; - if (is_endian.little) { - tweak.u[0] = secno; - tweak.u[1] = 0; - } - else { - PUTU32(tweak.c,secno); - PUTU32(tweak.c+4,secno>>32); - tweak.u[1] = 0; - } + memcpy(tweak.c, iv, 16); (*ctx->block2)(tweak.c,tweak.c,ctx->key2); |