diff options
author | miod <> | 2015-07-19 18:27:26 +0000 |
---|---|---|
committer | miod <> | 2015-07-19 18:27:26 +0000 |
commit | 7adb4eeffce8c01c0c9ae40701483cf6eb71d9de (patch) | |
tree | d55c86f5a63ca13d484e6ac1a4a772ea274b186c /src/lib/libcrypto/modes | |
parent | e5955381f2756ed7dfa9d95684f7bce72885cbd0 (diff) | |
download | openbsd-7adb4eeffce8c01c0c9ae40701483cf6eb71d9de.tar.gz openbsd-7adb4eeffce8c01c0c9ae40701483cf6eb71d9de.tar.bz2 openbsd-7adb4eeffce8c01c0c9ae40701483cf6eb71d9de.zip |
unifdef -UCBC_HANDLES_TRUNCATED_IO
ok bcook@ doug@
Diffstat (limited to 'src/lib/libcrypto/modes')
-rw-r--r-- | src/lib/libcrypto/modes/cts128.c | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/src/lib/libcrypto/modes/cts128.c b/src/lib/libcrypto/modes/cts128.c index 192dfb7c14..802aa77cd5 100644 --- a/src/lib/libcrypto/modes/cts128.c +++ b/src/lib/libcrypto/modes/cts128.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cts128.c,v 1.4 2015/02/10 09:46:30 miod Exp $ */ | 1 | /* $OpenBSD: cts128.c,v 1.5 2015/07/19 18:27:26 miod Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 2008 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2008 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -97,16 +97,10 @@ size_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out, | |||
97 | in += len; | 97 | in += len; |
98 | out += len; | 98 | out += len; |
99 | 99 | ||
100 | #if defined(CBC_HANDLES_TRUNCATED_IO) | ||
101 | memcpy(tmp.c,out-16,16); | ||
102 | (*cbc)(in,out-16,residue,key,ivec,1); | ||
103 | memcpy(out,tmp.c,residue); | ||
104 | #else | ||
105 | memset(tmp.c,0,sizeof(tmp)); | 100 | memset(tmp.c,0,sizeof(tmp)); |
106 | memcpy(tmp.c,in,residue); | 101 | memcpy(tmp.c,in,residue); |
107 | memcpy(out,out-16,residue); | 102 | memcpy(out,out-16,residue); |
108 | (*cbc)(tmp.c,out-16,16,key,ivec,1); | 103 | (*cbc)(tmp.c,out-16,16,key,ivec,1); |
109 | #endif | ||
110 | return len+residue; | 104 | return len+residue; |
111 | } | 105 | } |
112 | 106 | ||
@@ -129,13 +123,9 @@ size_t CRYPTO_nistcts128_encrypt(const unsigned char *in, unsigned char *out, | |||
129 | in += len; | 123 | in += len; |
130 | out += len; | 124 | out += len; |
131 | 125 | ||
132 | #if defined(CBC_HANDLES_TRUNCATED_IO) | ||
133 | (*cbc)(in,out-16+residue,residue,key,ivec,1); | ||
134 | #else | ||
135 | memset(tmp.c,0,sizeof(tmp)); | 126 | memset(tmp.c,0,sizeof(tmp)); |
136 | memcpy(tmp.c,in,residue); | 127 | memcpy(tmp.c,in,residue); |
137 | (*cbc)(tmp.c,out-16+residue,16,key,ivec,1); | 128 | (*cbc)(tmp.c,out-16+residue,16,key,ivec,1); |
138 | #endif | ||
139 | return len+residue; | 129 | return len+residue; |
140 | } | 130 | } |
141 | 131 | ||
@@ -238,12 +228,8 @@ size_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out, | |||
238 | (*cbc)(in,tmp.c,16,key,tmp.c+16,0); | 228 | (*cbc)(in,tmp.c,16,key,tmp.c+16,0); |
239 | 229 | ||
240 | memcpy(tmp.c,in+16,residue); | 230 | memcpy(tmp.c,in+16,residue); |
241 | #if defined(CBC_HANDLES_TRUNCATED_IO) | ||
242 | (*cbc)(tmp.c,out,16+residue,key,ivec,0); | ||
243 | #else | ||
244 | (*cbc)(tmp.c,tmp.c,32,key,ivec,0); | 231 | (*cbc)(tmp.c,tmp.c,32,key,ivec,0); |
245 | memcpy(out,tmp.c,16+residue); | 232 | memcpy(out,tmp.c,16+residue); |
246 | #endif | ||
247 | return 16+len+residue; | 233 | return 16+len+residue; |
248 | } | 234 | } |
249 | 235 | ||
@@ -275,11 +261,7 @@ size_t CRYPTO_nistcts128_decrypt(const unsigned char *in, unsigned char *out, | |||
275 | (*cbc)(in+residue,tmp.c,16,key,tmp.c+16,0); | 261 | (*cbc)(in+residue,tmp.c,16,key,tmp.c+16,0); |
276 | 262 | ||
277 | memcpy(tmp.c,in,residue); | 263 | memcpy(tmp.c,in,residue); |
278 | #if defined(CBC_HANDLES_TRUNCATED_IO) | ||
279 | (*cbc)(tmp.c,out,16+residue,key,ivec,0); | ||
280 | #else | ||
281 | (*cbc)(tmp.c,tmp.c,32,key,ivec,0); | 264 | (*cbc)(tmp.c,tmp.c,32,key,ivec,0); |
282 | memcpy(out,tmp.c,16+residue); | 265 | memcpy(out,tmp.c,16+residue); |
283 | #endif | ||
284 | return 16+len+residue; | 266 | return 16+len+residue; |
285 | } | 267 | } |