diff options
author | miod <> | 2015-02-10 09:46:30 +0000 |
---|---|---|
committer | miod <> | 2015-02-10 09:46:30 +0000 |
commit | c54f1e6efb3beda80d415ba75614cbc695f799be (patch) | |
tree | 8bb4657eb5417a2a0ea6710585ef13aa7b25433c /src/lib/libcrypto/modes | |
parent | bedef42af36243e74221aa77e809718c15fae035 (diff) | |
download | openbsd-c54f1e6efb3beda80d415ba75614cbc695f799be.tar.gz openbsd-c54f1e6efb3beda80d415ba75614cbc695f799be.tar.bz2 openbsd-c54f1e6efb3beda80d415ba75614cbc695f799be.zip |
Remove assert() or OPENSSL_assert() of pointers being non-NULL. The policy
for libraries in OpenBSD is to deliberately let NULL pointers cause a SIGSEGV.
ok doug@ jsing@
Diffstat (limited to 'src/lib/libcrypto/modes')
-rw-r--r-- | src/lib/libcrypto/modes/cbc128.c | 7 | ||||
-rw-r--r-- | src/lib/libcrypto/modes/ccm128.c | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/modes/cfb128.c | 11 | ||||
-rw-r--r-- | src/lib/libcrypto/modes/ctr128.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/modes/cts128.c | 19 | ||||
-rw-r--r-- | src/lib/libcrypto/modes/gcm128.c | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/modes/ofb128.c | 5 | ||||
-rw-r--r-- | src/lib/libcrypto/modes/xts128.c | 3 |
8 files changed, 8 insertions, 47 deletions
diff --git a/src/lib/libcrypto/modes/cbc128.c b/src/lib/libcrypto/modes/cbc128.c index 74fcdbe6e3..fe45103b0c 100644 --- a/src/lib/libcrypto/modes/cbc128.c +++ b/src/lib/libcrypto/modes/cbc128.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cbc128.c,v 1.3 2014/06/12 15:49:30 deraadt Exp $ */ | 1 | /* $OpenBSD: cbc128.c,v 1.4 2015/02/10 09:46:30 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 | * |
@@ -58,7 +58,6 @@ | |||
58 | # define NDEBUG | 58 | # define NDEBUG |
59 | # endif | 59 | # endif |
60 | #endif | 60 | #endif |
61 | #include <assert.h> | ||
62 | 61 | ||
63 | #undef STRICT_ALIGNMENT | 62 | #undef STRICT_ALIGNMENT |
64 | #ifdef __STRICT_ALIGNMENT | 63 | #ifdef __STRICT_ALIGNMENT |
@@ -74,8 +73,6 @@ void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, | |||
74 | size_t n; | 73 | size_t n; |
75 | const unsigned char *iv = ivec; | 74 | const unsigned char *iv = ivec; |
76 | 75 | ||
77 | assert(in && out && key && ivec); | ||
78 | |||
79 | #if !defined(OPENSSL_SMALL_FOOTPRINT) | 76 | #if !defined(OPENSSL_SMALL_FOOTPRINT) |
80 | if (STRICT_ALIGNMENT && | 77 | if (STRICT_ALIGNMENT && |
81 | ((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) != 0) { | 78 | ((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) != 0) { |
@@ -123,8 +120,6 @@ void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, | |||
123 | size_t n; | 120 | size_t n; |
124 | union { size_t t[16/sizeof(size_t)]; unsigned char c[16]; } tmp; | 121 | union { size_t t[16/sizeof(size_t)]; unsigned char c[16]; } tmp; |
125 | 122 | ||
126 | assert(in && out && key && ivec); | ||
127 | |||
128 | #if !defined(OPENSSL_SMALL_FOOTPRINT) | 123 | #if !defined(OPENSSL_SMALL_FOOTPRINT) |
129 | if (in != out) { | 124 | if (in != out) { |
130 | const unsigned char *iv = ivec; | 125 | const unsigned char *iv = ivec; |
diff --git a/src/lib/libcrypto/modes/ccm128.c b/src/lib/libcrypto/modes/ccm128.c index 241e3a9708..58cc4f44c6 100644 --- a/src/lib/libcrypto/modes/ccm128.c +++ b/src/lib/libcrypto/modes/ccm128.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ccm128.c,v 1.3 2014/06/12 15:49:30 deraadt Exp $ */ | 1 | /* $OpenBSD: ccm128.c,v 1.4 2015/02/10 09:46:30 miod Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2011 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -57,7 +57,6 @@ | |||
57 | # define NDEBUG | 57 | # define NDEBUG |
58 | # endif | 58 | # endif |
59 | #endif | 59 | #endif |
60 | #include <assert.h> | ||
61 | 60 | ||
62 | /* First you setup M and L parameters and pass the key schedule. | 61 | /* First you setup M and L parameters and pass the key schedule. |
63 | * This is called once per session setup... */ | 62 | * This is called once per session setup... */ |
diff --git a/src/lib/libcrypto/modes/cfb128.c b/src/lib/libcrypto/modes/cfb128.c index 593c337e8b..8399f0c5be 100644 --- a/src/lib/libcrypto/modes/cfb128.c +++ b/src/lib/libcrypto/modes/cfb128.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cfb128.c,v 1.3 2014/06/12 15:49:30 deraadt Exp $ */ | 1 | /* $OpenBSD: cfb128.c,v 1.4 2015/02/10 09:46:30 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 | * |
@@ -58,7 +58,6 @@ | |||
58 | # define NDEBUG | 58 | # define NDEBUG |
59 | # endif | 59 | # endif |
60 | #endif | 60 | #endif |
61 | #include <assert.h> | ||
62 | 61 | ||
63 | /* The input and output encrypted as though 128bit cfb mode is being | 62 | /* The input and output encrypted as though 128bit cfb mode is being |
64 | * used. The extra state information to record how much of the | 63 | * used. The extra state information to record how much of the |
@@ -72,8 +71,6 @@ void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, | |||
72 | unsigned int n; | 71 | unsigned int n; |
73 | size_t l = 0; | 72 | size_t l = 0; |
74 | 73 | ||
75 | assert(in && out && key && ivec && num); | ||
76 | |||
77 | n = *num; | 74 | n = *num; |
78 | 75 | ||
79 | if (enc) { | 76 | if (enc) { |
@@ -215,9 +212,6 @@ void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out, | |||
215 | size_t n; | 212 | size_t n; |
216 | unsigned char c[1],d[1]; | 213 | unsigned char c[1],d[1]; |
217 | 214 | ||
218 | assert(in && out && key && ivec && num); | ||
219 | assert(*num == 0); | ||
220 | |||
221 | for(n=0 ; n<bits ; ++n) | 215 | for(n=0 ; n<bits ; ++n) |
222 | { | 216 | { |
223 | c[0]=(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0; | 217 | c[0]=(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0; |
@@ -234,9 +228,6 @@ void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out, | |||
234 | { | 228 | { |
235 | size_t n; | 229 | size_t n; |
236 | 230 | ||
237 | assert(in && out && key && ivec && num); | ||
238 | assert(*num == 0); | ||
239 | |||
240 | for(n=0 ; n<length ; ++n) | 231 | for(n=0 ; n<length ; ++n) |
241 | cfbr_encrypt_block(&in[n],&out[n],8,key,ivec,enc,block); | 232 | cfbr_encrypt_block(&in[n],&out[n],8,key,ivec,enc,block); |
242 | } | 233 | } |
diff --git a/src/lib/libcrypto/modes/ctr128.c b/src/lib/libcrypto/modes/ctr128.c index 99d12b5503..7fd0223701 100644 --- a/src/lib/libcrypto/modes/ctr128.c +++ b/src/lib/libcrypto/modes/ctr128.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ctr128.c,v 1.5 2014/07/09 16:06:13 miod Exp $ */ | 1 | /* $OpenBSD: ctr128.c,v 1.6 2015/02/10 09:46:30 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 | * |
@@ -121,7 +121,6 @@ void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, | |||
121 | unsigned int n; | 121 | unsigned int n; |
122 | size_t l=0; | 122 | size_t l=0; |
123 | 123 | ||
124 | assert(in && out && key && ecount_buf && num); | ||
125 | assert(*num < 16); | 124 | assert(*num < 16); |
126 | 125 | ||
127 | n = *num; | 126 | n = *num; |
@@ -196,7 +195,6 @@ void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out, | |||
196 | { | 195 | { |
197 | unsigned int n,ctr32; | 196 | unsigned int n,ctr32; |
198 | 197 | ||
199 | assert(in && out && key && ecount_buf && num); | ||
200 | assert(*num < 16); | 198 | assert(*num < 16); |
201 | 199 | ||
202 | n = *num; | 200 | n = *num; |
diff --git a/src/lib/libcrypto/modes/cts128.c b/src/lib/libcrypto/modes/cts128.c index e34989adc1..192dfb7c14 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.3 2014/06/12 15:49:30 deraadt Exp $ */ | 1 | /* $OpenBSD: cts128.c,v 1.4 2015/02/10 09:46:30 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 | * |
@@ -15,7 +15,6 @@ | |||
15 | # define NDEBUG | 15 | # define NDEBUG |
16 | # endif | 16 | # endif |
17 | #endif | 17 | #endif |
18 | #include <assert.h> | ||
19 | 18 | ||
20 | /* | 19 | /* |
21 | * Trouble with Ciphertext Stealing, CTS, mode is that there is no | 20 | * Trouble with Ciphertext Stealing, CTS, mode is that there is no |
@@ -35,8 +34,6 @@ size_t CRYPTO_cts128_encrypt_block(const unsigned char *in, unsigned char *out, | |||
35 | unsigned char ivec[16], block128_f block) | 34 | unsigned char ivec[16], block128_f block) |
36 | { size_t residue, n; | 35 | { size_t residue, n; |
37 | 36 | ||
38 | assert (in && out && key && ivec); | ||
39 | |||
40 | if (len <= 16) return 0; | 37 | if (len <= 16) return 0; |
41 | 38 | ||
42 | if ((residue=len%16) == 0) residue = 16; | 39 | if ((residue=len%16) == 0) residue = 16; |
@@ -62,8 +59,6 @@ size_t CRYPTO_nistcts128_encrypt_block(const unsigned char *in, unsigned char *o | |||
62 | unsigned char ivec[16], block128_f block) | 59 | unsigned char ivec[16], block128_f block) |
63 | { size_t residue, n; | 60 | { size_t residue, n; |
64 | 61 | ||
65 | assert (in && out && key && ivec); | ||
66 | |||
67 | if (len < 16) return 0; | 62 | if (len < 16) return 0; |
68 | 63 | ||
69 | residue=len%16; | 64 | residue=len%16; |
@@ -91,8 +86,6 @@ size_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out, | |||
91 | { size_t residue; | 86 | { size_t residue; |
92 | union { size_t align; unsigned char c[16]; } tmp; | 87 | union { size_t align; unsigned char c[16]; } tmp; |
93 | 88 | ||
94 | assert (in && out && key && ivec); | ||
95 | |||
96 | if (len <= 16) return 0; | 89 | if (len <= 16) return 0; |
97 | 90 | ||
98 | if ((residue=len%16) == 0) residue = 16; | 91 | if ((residue=len%16) == 0) residue = 16; |
@@ -123,8 +116,6 @@ size_t CRYPTO_nistcts128_encrypt(const unsigned char *in, unsigned char *out, | |||
123 | { size_t residue; | 116 | { size_t residue; |
124 | union { size_t align; unsigned char c[16]; } tmp; | 117 | union { size_t align; unsigned char c[16]; } tmp; |
125 | 118 | ||
126 | assert (in && out && key && ivec); | ||
127 | |||
128 | if (len < 16) return 0; | 119 | if (len < 16) return 0; |
129 | 120 | ||
130 | residue=len%16; | 121 | residue=len%16; |
@@ -154,8 +145,6 @@ size_t CRYPTO_cts128_decrypt_block(const unsigned char *in, unsigned char *out, | |||
154 | { size_t residue, n; | 145 | { size_t residue, n; |
155 | union { size_t align; unsigned char c[32]; } tmp; | 146 | union { size_t align; unsigned char c[32]; } tmp; |
156 | 147 | ||
157 | assert (in && out && key && ivec); | ||
158 | |||
159 | if (len<=16) return 0; | 148 | if (len<=16) return 0; |
160 | 149 | ||
161 | if ((residue=len%16) == 0) residue = 16; | 150 | if ((residue=len%16) == 0) residue = 16; |
@@ -191,8 +180,6 @@ size_t CRYPTO_nistcts128_decrypt_block(const unsigned char *in, unsigned char *o | |||
191 | { size_t residue, n; | 180 | { size_t residue, n; |
192 | union { size_t align; unsigned char c[32]; } tmp; | 181 | union { size_t align; unsigned char c[32]; } tmp; |
193 | 182 | ||
194 | assert (in && out && key && ivec); | ||
195 | |||
196 | if (len<16) return 0; | 183 | if (len<16) return 0; |
197 | 184 | ||
198 | residue=len%16; | 185 | residue=len%16; |
@@ -234,8 +221,6 @@ size_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out, | |||
234 | { size_t residue; | 221 | { size_t residue; |
235 | union { size_t align; unsigned char c[32]; } tmp; | 222 | union { size_t align; unsigned char c[32]; } tmp; |
236 | 223 | ||
237 | assert (in && out && key && ivec); | ||
238 | |||
239 | if (len<=16) return 0; | 224 | if (len<=16) return 0; |
240 | 225 | ||
241 | if ((residue=len%16) == 0) residue = 16; | 226 | if ((residue=len%16) == 0) residue = 16; |
@@ -268,8 +253,6 @@ size_t CRYPTO_nistcts128_decrypt(const unsigned char *in, unsigned char *out, | |||
268 | { size_t residue; | 253 | { size_t residue; |
269 | union { size_t align; unsigned char c[32]; } tmp; | 254 | union { size_t align; unsigned char c[32]; } tmp; |
270 | 255 | ||
271 | assert (in && out && key && ivec); | ||
272 | |||
273 | if (len<16) return 0; | 256 | if (len<16) return 0; |
274 | 257 | ||
275 | residue=len%16; | 258 | residue=len%16; |
diff --git a/src/lib/libcrypto/modes/gcm128.c b/src/lib/libcrypto/modes/gcm128.c index 1106617763..4a72901a33 100644 --- a/src/lib/libcrypto/modes/gcm128.c +++ b/src/lib/libcrypto/modes/gcm128.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: gcm128.c,v 1.11 2015/02/07 13:19:15 doug Exp $ */ | 1 | /* $OpenBSD: gcm128.c,v 1.12 2015/02/10 09:46:30 miod Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 2010 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2010 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -59,7 +59,6 @@ | |||
59 | # define NDEBUG | 59 | # define NDEBUG |
60 | # endif | 60 | # endif |
61 | #endif | 61 | #endif |
62 | #include <assert.h> | ||
63 | 62 | ||
64 | #if defined(BSWAP4) && defined(__STRICT_ALIGNMENT) | 63 | #if defined(BSWAP4) && defined(__STRICT_ALIGNMENT) |
65 | /* redefine, because alignment is ensured */ | 64 | /* redefine, because alignment is ensured */ |
diff --git a/src/lib/libcrypto/modes/ofb128.c b/src/lib/libcrypto/modes/ofb128.c index 031110a274..1b8a6fd500 100644 --- a/src/lib/libcrypto/modes/ofb128.c +++ b/src/lib/libcrypto/modes/ofb128.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ofb128.c,v 1.3 2014/06/12 15:49:30 deraadt Exp $ */ | 1 | /* $OpenBSD: ofb128.c,v 1.4 2015/02/10 09:46:30 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 | * |
@@ -58,7 +58,6 @@ | |||
58 | # define NDEBUG | 58 | # define NDEBUG |
59 | # endif | 59 | # endif |
60 | #endif | 60 | #endif |
61 | #include <assert.h> | ||
62 | 61 | ||
63 | /* The input and output encrypted as though 128bit ofb mode is being | 62 | /* The input and output encrypted as though 128bit ofb mode is being |
64 | * used. The extra state information to record how much of the | 63 | * used. The extra state information to record how much of the |
@@ -72,8 +71,6 @@ void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, | |||
72 | unsigned int n; | 71 | unsigned int n; |
73 | size_t l=0; | 72 | size_t l=0; |
74 | 73 | ||
75 | assert(in && out && key && ivec && num); | ||
76 | |||
77 | n = *num; | 74 | n = *num; |
78 | 75 | ||
79 | #if !defined(OPENSSL_SMALL_FOOTPRINT) | 76 | #if !defined(OPENSSL_SMALL_FOOTPRINT) |
diff --git a/src/lib/libcrypto/modes/xts128.c b/src/lib/libcrypto/modes/xts128.c index e6a0fbb0fa..3e2378379e 100644 --- a/src/lib/libcrypto/modes/xts128.c +++ b/src/lib/libcrypto/modes/xts128.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: xts128.c,v 1.5 2014/07/09 16:06:13 miod Exp $ */ | 1 | /* $OpenBSD: xts128.c,v 1.6 2015/02/10 09:46:30 miod Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2011 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -58,7 +58,6 @@ | |||
58 | # define NDEBUG | 58 | # define NDEBUG |
59 | # endif | 59 | # endif |
60 | #endif | 60 | #endif |
61 | #include <assert.h> | ||
62 | 61 | ||
63 | int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], | 62 | int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], |
64 | const unsigned char *inp, unsigned char *out, | 63 | const unsigned char *inp, unsigned char *out, |