diff options
Diffstat (limited to 'src/lib/libcrypto/modes/xts128.c')
-rw-r--r-- | src/lib/libcrypto/modes/xts128.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/libcrypto/modes/xts128.c b/src/lib/libcrypto/modes/xts128.c index de23de457d..9dcd16885d 100644 --- a/src/lib/libcrypto/modes/xts128.c +++ b/src/lib/libcrypto/modes/xts128.c | |||
@@ -47,6 +47,7 @@ | |||
47 | * ==================================================================== | 47 | * ==================================================================== |
48 | */ | 48 | */ |
49 | 49 | ||
50 | #include <machine/endian.h> | ||
50 | #include <openssl/crypto.h> | 51 | #include <openssl/crypto.h> |
51 | #include "modes_lcl.h" | 52 | #include "modes_lcl.h" |
52 | #include <string.h> | 53 | #include <string.h> |
@@ -74,7 +75,7 @@ int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], | |||
74 | if (!enc && (len%16)) len-=16; | 75 | if (!enc && (len%16)) len-=16; |
75 | 76 | ||
76 | while (len>=16) { | 77 | while (len>=16) { |
77 | #if defined(STRICT_ALIGNMENT) | 78 | #ifdef __STRICT_ALIGNMENT |
78 | memcpy(scratch.c,inp,16); | 79 | memcpy(scratch.c,inp,16); |
79 | scratch.u[0] ^= tweak.u[0]; | 80 | scratch.u[0] ^= tweak.u[0]; |
80 | scratch.u[1] ^= tweak.u[1]; | 81 | scratch.u[1] ^= tweak.u[1]; |
@@ -83,7 +84,7 @@ int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], | |||
83 | scratch.u[1] = ((u64*)inp)[1]^tweak.u[1]; | 84 | scratch.u[1] = ((u64*)inp)[1]^tweak.u[1]; |
84 | #endif | 85 | #endif |
85 | (*ctx->block1)(scratch.c,scratch.c,ctx->key1); | 86 | (*ctx->block1)(scratch.c,scratch.c,ctx->key1); |
86 | #if defined(STRICT_ALIGNMENT) | 87 | #ifdef __STRICT_ALIGNMENT |
87 | scratch.u[0] ^= tweak.u[0]; | 88 | scratch.u[0] ^= tweak.u[0]; |
88 | scratch.u[1] ^= tweak.u[1]; | 89 | scratch.u[1] ^= tweak.u[1]; |
89 | memcpy(out,scratch.c,16); | 90 | memcpy(out,scratch.c,16); |
@@ -152,7 +153,7 @@ int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], | |||
152 | } | 153 | } |
153 | tweak1.c[0] ^= (u8)(0x87&(0-c)); | 154 | tweak1.c[0] ^= (u8)(0x87&(0-c)); |
154 | } | 155 | } |
155 | #if defined(STRICT_ALIGNMENT) | 156 | #ifdef __STRICT_ALIGNMENT |
156 | memcpy(scratch.c,inp,16); | 157 | memcpy(scratch.c,inp,16); |
157 | scratch.u[0] ^= tweak1.u[0]; | 158 | scratch.u[0] ^= tweak1.u[0]; |
158 | scratch.u[1] ^= tweak1.u[1]; | 159 | scratch.u[1] ^= tweak1.u[1]; |
@@ -172,7 +173,7 @@ int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], | |||
172 | scratch.u[0] ^= tweak.u[0]; | 173 | scratch.u[0] ^= tweak.u[0]; |
173 | scratch.u[1] ^= tweak.u[1]; | 174 | scratch.u[1] ^= tweak.u[1]; |
174 | (*ctx->block1)(scratch.c,scratch.c,ctx->key1); | 175 | (*ctx->block1)(scratch.c,scratch.c,ctx->key1); |
175 | #if defined(STRICT_ALIGNMENT) | 176 | #ifdef __STRICT_ALIGNMENT |
176 | scratch.u[0] ^= tweak.u[0]; | 177 | scratch.u[0] ^= tweak.u[0]; |
177 | scratch.u[1] ^= tweak.u[1]; | 178 | scratch.u[1] ^= tweak.u[1]; |
178 | memcpy (out,scratch.c,16); | 179 | memcpy (out,scratch.c,16); |