summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/modes/cbc128.c
diff options
context:
space:
mode:
authormiod <>2014-05-07 22:05:48 +0000
committermiod <>2014-05-07 22:05:48 +0000
commit55b870bc0442258199f29518a1c056569c6cff35 (patch)
treedeb34c5a4686fe5f3219b9c2cc98fdf18af20a2d /src/lib/libcrypto/modes/cbc128.c
parent6e694fdc39d16d30d31406ef82c6b069d9d005d9 (diff)
downloadopenbsd-55b870bc0442258199f29518a1c056569c6cff35.tar.gz
openbsd-55b870bc0442258199f29518a1c056569c6cff35.tar.bz2
openbsd-55b870bc0442258199f29518a1c056569c6cff35.zip
Get __STRICT_ALIGNMENT from <machine/endian.h> and decide upon it, rather
than defining it for not (i386 and amd64 (and sometimes s390)) only. Compile-time tests remain compile-time tests, and runtime-test remain runtime-test instead of being converted to compile-time tests, per matthew@'s explicit demand (rationale: this makes sure the compiler checks your code even if you won't run it). No functional change except on s390 (which we don't run on) and vax (which we run on, but noone cares about) ok matthew@
Diffstat (limited to 'src/lib/libcrypto/modes/cbc128.c')
-rw-r--r--src/lib/libcrypto/modes/cbc128.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lib/libcrypto/modes/cbc128.c b/src/lib/libcrypto/modes/cbc128.c
index 0e54f75470..e4920a93ac 100644
--- a/src/lib/libcrypto/modes/cbc128.c
+++ b/src/lib/libcrypto/modes/cbc128.c
@@ -59,8 +59,11 @@
59#endif 59#endif
60#include <assert.h> 60#include <assert.h>
61 61
62#ifndef STRICT_ALIGNMENT 62#undef STRICT_ALIGNMENT
63# define STRICT_ALIGNMENT 0 63#ifdef __STRICT_ALIGNMENT
64#define STRICT_ALIGNMENT 1
65#else
66#define STRICT_ALIGNMENT 0
64#endif 67#endif
65 68
66void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, 69void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out,
@@ -136,8 +139,7 @@ void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out,
136 in += 16; 139 in += 16;
137 out += 16; 140 out += 16;
138 } 141 }
139 } 142 } else if (16%sizeof(size_t) == 0) { /* always true */
140 else if (16%sizeof(size_t) == 0) { /* always true */
141 while (len>=16) { 143 while (len>=16) {
142 size_t *out_t=(size_t *)out, *iv_t=(size_t *)iv; 144 size_t *out_t=(size_t *)out, *iv_t=(size_t *)iv;
143 145
@@ -166,8 +168,7 @@ void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out,
166 in += 16; 168 in += 16;
167 out += 16; 169 out += 16;
168 } 170 }
169 } 171 } else if (16%sizeof(size_t) == 0) { /* always true */
170 else if (16%sizeof(size_t) == 0) { /* always true */
171 while (len>=16) { 172 while (len>=16) {
172 size_t c, *out_t=(size_t *)out, *ivec_t=(size_t *)ivec; 173 size_t c, *out_t=(size_t *)out, *ivec_t=(size_t *)ivec;
173 const size_t *in_t=(const size_t *)in; 174 const size_t *in_t=(const size_t *)in;