diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2015-02-10 09:46:31 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2015-02-10 09:46:31 +0000 |
commit | 61857c24eaf84a4f538fc779ca01dc3805bdeaeb (patch) | |
tree | a0c224893163e3f81f580642e62d569d454f7b43 /lib/libssl | |
parent | 68d5dad4b60fe6ee19f010c922e1f1d8c56c1ba8 (diff) |
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 'lib/libssl')
-rw-r--r-- | lib/libssl/src/crypto/aes/aes_core.c | 5 | ||||
-rw-r--r-- | lib/libssl/src/crypto/aes/aes_ecb.c | 6 | ||||
-rw-r--r-- | lib/libssl/src/crypto/aes/aes_ige.c | 6 | ||||
-rw-r--r-- | lib/libssl/src/crypto/aes/aes_x86core.c | 5 | ||||
-rw-r--r-- | lib/libssl/src/crypto/des/cfb_enc.c | 8 | ||||
-rw-r--r-- | lib/libssl/src/crypto/engine/eng_aesni.c | 7 | ||||
-rw-r--r-- | lib/libssl/src/crypto/gost/gost2814789.c | 6 | ||||
-rw-r--r-- | lib/libssl/src/crypto/modes/cbc128.c | 7 | ||||
-rw-r--r-- | lib/libssl/src/crypto/modes/ccm128.c | 3 | ||||
-rw-r--r-- | lib/libssl/src/crypto/modes/cfb128.c | 11 | ||||
-rw-r--r-- | lib/libssl/src/crypto/modes/ctr128.c | 4 | ||||
-rw-r--r-- | lib/libssl/src/crypto/modes/cts128.c | 19 | ||||
-rw-r--r-- | lib/libssl/src/crypto/modes/gcm128.c | 3 | ||||
-rw-r--r-- | lib/libssl/src/crypto/modes/ofb128.c | 5 | ||||
-rw-r--r-- | lib/libssl/src/crypto/modes/xts128.c | 3 | ||||
-rw-r--r-- | lib/libssl/src/crypto/ts/ts_verify_ctx.c | 4 |
16 files changed, 17 insertions, 85 deletions
diff --git a/lib/libssl/src/crypto/aes/aes_core.c b/lib/libssl/src/crypto/aes/aes_core.c index ee21057392c..93c32b919b3 100644 --- a/lib/libssl/src/crypto/aes/aes_core.c +++ b/lib/libssl/src/crypto/aes/aes_core.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aes_core.c,v 1.11 2014/07/09 09:10:07 miod Exp $ */ +/* $OpenBSD: aes_core.c,v 1.12 2015/02/10 09:46:30 miod Exp $ */ /** * rijndael-alg-fst.c * @@ -33,7 +33,6 @@ # define NDEBUG # endif #endif -#include <assert.h> #include <stdlib.h> #include <openssl/aes.h> @@ -795,7 +794,6 @@ AES_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key) int r; #endif /* ?FULL_UNROLL */ - assert(in && out && key); rk = key->rd_key; /* @@ -986,7 +984,6 @@ AES_decrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key) int r; #endif /* ?FULL_UNROLL */ - assert(in && out && key); rk = key->rd_key; /* diff --git a/lib/libssl/src/crypto/aes/aes_ecb.c b/lib/libssl/src/crypto/aes/aes_ecb.c index 976c48fdbc2..b05e53994b2 100644 --- a/lib/libssl/src/crypto/aes/aes_ecb.c +++ b/lib/libssl/src/crypto/aes/aes_ecb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aes_ecb.c,v 1.5 2014/06/12 15:49:27 deraadt Exp $ */ +/* $OpenBSD: aes_ecb.c,v 1.6 2015/02/10 09:46:30 miod Exp $ */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * @@ -54,7 +54,6 @@ # define NDEBUG # endif #endif -#include <assert.h> #include <openssl/aes.h> #include "aes_locl.h" @@ -63,9 +62,6 @@ void AES_ecb_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key, const int enc) { - assert(in && out && key); - assert((AES_ENCRYPT == enc) || (AES_DECRYPT == enc)); - if (AES_ENCRYPT == enc) AES_encrypt(in, out, key); else diff --git a/lib/libssl/src/crypto/aes/aes_ige.c b/lib/libssl/src/crypto/aes/aes_ige.c index a8dec0a3612..16ef5612eb7 100644 --- a/lib/libssl/src/crypto/aes/aes_ige.c +++ b/lib/libssl/src/crypto/aes/aes_ige.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aes_ige.c,v 1.6 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: aes_ige.c,v 1.7 2015/02/10 09:46:30 miod Exp $ */ /* ==================================================================== * Copyright (c) 2006 The OpenSSL Project. All rights reserved. * @@ -81,10 +81,8 @@ AES_ige_encrypt(const unsigned char *in, unsigned char *out, size_t length, const AES_KEY *key, unsigned char *ivec, const int enc) { size_t n; - size_t len = length; + size_t len; - OPENSSL_assert(in && out && key && ivec); - OPENSSL_assert((AES_ENCRYPT == enc) || (AES_DECRYPT == enc)); OPENSSL_assert((length % AES_BLOCK_SIZE) == 0); len = length / AES_BLOCK_SIZE; diff --git a/lib/libssl/src/crypto/aes/aes_x86core.c b/lib/libssl/src/crypto/aes/aes_x86core.c index c7a2e0a9a65..c604fa876f4 100644 --- a/lib/libssl/src/crypto/aes/aes_x86core.c +++ b/lib/libssl/src/crypto/aes/aes_x86core.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aes_x86core.c,v 1.7 2014/10/28 07:35:58 jsg Exp $ */ +/* $OpenBSD: aes_x86core.c,v 1.8 2015/02/10 09:46:30 miod Exp $ */ /** * rijndael-alg-fst.c * @@ -40,7 +40,6 @@ # define NDEBUG # endif #endif -#include <assert.h> #include <stdlib.h> #include <openssl/aes.h> @@ -661,7 +660,6 @@ AES_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key) u32 s0, s1, s2, s3, t[4]; int r; - assert(in && out && key); rk = key->rd_key; /* @@ -881,7 +879,6 @@ AES_decrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key) u32 s0, s1, s2, s3, t[4]; int r; - assert(in && out && key); rk = key->rd_key; /* diff --git a/lib/libssl/src/crypto/des/cfb_enc.c b/lib/libssl/src/crypto/des/cfb_enc.c index d654a6a8e2f..59a3e718622 100644 --- a/lib/libssl/src/crypto/des/cfb_enc.c +++ b/lib/libssl/src/crypto/des/cfb_enc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cfb_enc.c,v 1.12 2014/10/28 07:35:58 jsg Exp $ */ +/* $OpenBSD: cfb_enc.c,v 1.13 2015/02/10 09:46:30 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -57,7 +57,6 @@ */ #include "des_locl.h" -#include <assert.h> #include <machine/endian.h> /* The input and output are loaded in multiples of 8 bits. @@ -82,11 +81,6 @@ void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, #else unsigned int sh[4]; unsigned char *ovec=(unsigned char *)sh; - - /* I kind of count that compiler optimizes away this assertioni,*/ - assert (sizeof(sh[0])==4); /* as this holds true for all, */ - /* but 16-bit platforms... */ - #endif if (numbits<=0 || numbits > 64) return; diff --git a/lib/libssl/src/crypto/engine/eng_aesni.c b/lib/libssl/src/crypto/engine/eng_aesni.c index 94c4c1fb6a4..5f9a36236ac 100644 --- a/lib/libssl/src/crypto/engine/eng_aesni.c +++ b/lib/libssl/src/crypto/engine/eng_aesni.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eng_aesni.c,v 1.7 2014/07/11 08:44:48 jsing Exp $ */ +/* $OpenBSD: eng_aesni.c,v 1.8 2015/02/10 09:46:30 miod Exp $ */ /* * Support for Intel AES-NI intruction set * Author: Huang Ying <ying.huang@intel.com> @@ -73,7 +73,6 @@ * */ -#include <assert.h> #include <stdio.h> #include <openssl/opensslconf.h> @@ -156,8 +155,6 @@ aesni_cfb128_encrypt(const unsigned char *in, unsigned char *out, unsigned int n; size_t l = 0; - assert(in && out && key && ivec && num); - n = *num; if (enc) { @@ -261,8 +258,6 @@ aesni_ofb128_encrypt(const unsigned char *in, unsigned char *out, unsigned int n; size_t l = 0; - assert(in && out && key && ivec && num); - n = *num; #if !defined(OPENSSL_SMALL_FOOTPRINT) diff --git a/lib/libssl/src/crypto/gost/gost2814789.c b/lib/libssl/src/crypto/gost/gost2814789.c index e1084cb4acf..b1bef9eae3e 100644 --- a/lib/libssl/src/crypto/gost/gost2814789.c +++ b/lib/libssl/src/crypto/gost/gost2814789.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gost2814789.c,v 1.3 2014/12/07 16:33:51 jsing Exp $ */ +/* $OpenBSD: gost2814789.c,v 1.4 2015/02/10 09:46:30 miod Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> * Copyright (c) 2005-2006 Cryptocom LTD @@ -212,8 +212,6 @@ Gost2814789_cfb64_encrypt(const unsigned char *in, unsigned char *out, unsigned int n; size_t l = 0; - OPENSSL_assert(in && out && key && ivec && num); - n = *num; if (enc) { @@ -357,8 +355,6 @@ Gost2814789_cnt_encrypt(const unsigned char *in, unsigned char *out, size_t len, unsigned int n; size_t l = 0; - OPENSSL_assert(in && out && key && cnt_buf && num); - n = *num; #if !defined(OPENSSL_SMALL_FOOTPRINT) diff --git a/lib/libssl/src/crypto/modes/cbc128.c b/lib/libssl/src/crypto/modes/cbc128.c index 74fcdbe6e3c..fe45103b0ca 100644 --- a/lib/libssl/src/crypto/modes/cbc128.c +++ b/lib/libssl/src/crypto/modes/cbc128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cbc128.c,v 1.3 2014/06/12 15:49:30 deraadt Exp $ */ +/* $OpenBSD: cbc128.c,v 1.4 2015/02/10 09:46:30 miod Exp $ */ /* ==================================================================== * Copyright (c) 2008 The OpenSSL Project. All rights reserved. * @@ -58,7 +58,6 @@ # define NDEBUG # endif #endif -#include <assert.h> #undef STRICT_ALIGNMENT #ifdef __STRICT_ALIGNMENT @@ -74,8 +73,6 @@ void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, size_t n; const unsigned char *iv = ivec; - assert(in && out && key && ivec); - #if !defined(OPENSSL_SMALL_FOOTPRINT) if (STRICT_ALIGNMENT && ((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, size_t n; union { size_t t[16/sizeof(size_t)]; unsigned char c[16]; } tmp; - assert(in && out && key && ivec); - #if !defined(OPENSSL_SMALL_FOOTPRINT) if (in != out) { const unsigned char *iv = ivec; diff --git a/lib/libssl/src/crypto/modes/ccm128.c b/lib/libssl/src/crypto/modes/ccm128.c index 241e3a97084..58cc4f44c6a 100644 --- a/lib/libssl/src/crypto/modes/ccm128.c +++ b/lib/libssl/src/crypto/modes/ccm128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ccm128.c,v 1.3 2014/06/12 15:49:30 deraadt Exp $ */ +/* $OpenBSD: ccm128.c,v 1.4 2015/02/10 09:46:30 miod Exp $ */ /* ==================================================================== * Copyright (c) 2011 The OpenSSL Project. All rights reserved. * @@ -57,7 +57,6 @@ # define NDEBUG # endif #endif -#include <assert.h> /* First you setup M and L parameters and pass the key schedule. * This is called once per session setup... */ diff --git a/lib/libssl/src/crypto/modes/cfb128.c b/lib/libssl/src/crypto/modes/cfb128.c index 593c337e8b7..8399f0c5be0 100644 --- a/lib/libssl/src/crypto/modes/cfb128.c +++ b/lib/libssl/src/crypto/modes/cfb128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cfb128.c,v 1.3 2014/06/12 15:49:30 deraadt Exp $ */ +/* $OpenBSD: cfb128.c,v 1.4 2015/02/10 09:46:30 miod Exp $ */ /* ==================================================================== * Copyright (c) 2008 The OpenSSL Project. All rights reserved. * @@ -58,7 +58,6 @@ # define NDEBUG # endif #endif -#include <assert.h> /* The input and output encrypted as though 128bit cfb mode is being * 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, unsigned int n; size_t l = 0; - assert(in && out && key && ivec && num); - n = *num; if (enc) { @@ -215,9 +212,6 @@ void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out, size_t n; unsigned char c[1],d[1]; - assert(in && out && key && ivec && num); - assert(*num == 0); - for(n=0 ; n<bits ; ++n) { 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, { size_t n; - assert(in && out && key && ivec && num); - assert(*num == 0); - for(n=0 ; n<length ; ++n) cfbr_encrypt_block(&in[n],&out[n],8,key,ivec,enc,block); } diff --git a/lib/libssl/src/crypto/modes/ctr128.c b/lib/libssl/src/crypto/modes/ctr128.c index 99d12b55036..7fd0223701a 100644 --- a/lib/libssl/src/crypto/modes/ctr128.c +++ b/lib/libssl/src/crypto/modes/ctr128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ctr128.c,v 1.5 2014/07/09 16:06:13 miod Exp $ */ +/* $OpenBSD: ctr128.c,v 1.6 2015/02/10 09:46:30 miod Exp $ */ /* ==================================================================== * Copyright (c) 2008 The OpenSSL Project. All rights reserved. * @@ -121,7 +121,6 @@ void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, unsigned int n; size_t l=0; - assert(in && out && key && ecount_buf && num); assert(*num < 16); n = *num; @@ -196,7 +195,6 @@ void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out, { unsigned int n,ctr32; - assert(in && out && key && ecount_buf && num); assert(*num < 16); n = *num; diff --git a/lib/libssl/src/crypto/modes/cts128.c b/lib/libssl/src/crypto/modes/cts128.c index e34989adc1a..192dfb7c14e 100644 --- a/lib/libssl/src/crypto/modes/cts128.c +++ b/lib/libssl/src/crypto/modes/cts128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cts128.c,v 1.3 2014/06/12 15:49:30 deraadt Exp $ */ +/* $OpenBSD: cts128.c,v 1.4 2015/02/10 09:46:30 miod Exp $ */ /* ==================================================================== * Copyright (c) 2008 The OpenSSL Project. All rights reserved. * @@ -15,7 +15,6 @@ # define NDEBUG # endif #endif -#include <assert.h> /* * 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, unsigned char ivec[16], block128_f block) { size_t residue, n; - assert (in && out && key && ivec); - if (len <= 16) return 0; if ((residue=len%16) == 0) residue = 16; @@ -62,8 +59,6 @@ size_t CRYPTO_nistcts128_encrypt_block(const unsigned char *in, unsigned char *o unsigned char ivec[16], block128_f block) { size_t residue, n; - assert (in && out && key && ivec); - if (len < 16) return 0; residue=len%16; @@ -91,8 +86,6 @@ size_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out, { size_t residue; union { size_t align; unsigned char c[16]; } tmp; - assert (in && out && key && ivec); - if (len <= 16) return 0; if ((residue=len%16) == 0) residue = 16; @@ -123,8 +116,6 @@ size_t CRYPTO_nistcts128_encrypt(const unsigned char *in, unsigned char *out, { size_t residue; union { size_t align; unsigned char c[16]; } tmp; - assert (in && out && key && ivec); - if (len < 16) return 0; residue=len%16; @@ -154,8 +145,6 @@ size_t CRYPTO_cts128_decrypt_block(const unsigned char *in, unsigned char *out, { size_t residue, n; union { size_t align; unsigned char c[32]; } tmp; - assert (in && out && key && ivec); - if (len<=16) return 0; if ((residue=len%16) == 0) residue = 16; @@ -191,8 +180,6 @@ size_t CRYPTO_nistcts128_decrypt_block(const unsigned char *in, unsigned char *o { size_t residue, n; union { size_t align; unsigned char c[32]; } tmp; - assert (in && out && key && ivec); - if (len<16) return 0; residue=len%16; @@ -234,8 +221,6 @@ size_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out, { size_t residue; union { size_t align; unsigned char c[32]; } tmp; - assert (in && out && key && ivec); - if (len<=16) return 0; if ((residue=len%16) == 0) residue = 16; @@ -268,8 +253,6 @@ size_t CRYPTO_nistcts128_decrypt(const unsigned char *in, unsigned char *out, { size_t residue; union { size_t align; unsigned char c[32]; } tmp; - assert (in && out && key && ivec); - if (len<16) return 0; residue=len%16; diff --git a/lib/libssl/src/crypto/modes/gcm128.c b/lib/libssl/src/crypto/modes/gcm128.c index 1106617763c..4a72901a334 100644 --- a/lib/libssl/src/crypto/modes/gcm128.c +++ b/lib/libssl/src/crypto/modes/gcm128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gcm128.c,v 1.11 2015/02/07 13:19:15 doug Exp $ */ +/* $OpenBSD: gcm128.c,v 1.12 2015/02/10 09:46:30 miod Exp $ */ /* ==================================================================== * Copyright (c) 2010 The OpenSSL Project. All rights reserved. * @@ -59,7 +59,6 @@ # define NDEBUG # endif #endif -#include <assert.h> #if defined(BSWAP4) && defined(__STRICT_ALIGNMENT) /* redefine, because alignment is ensured */ diff --git a/lib/libssl/src/crypto/modes/ofb128.c b/lib/libssl/src/crypto/modes/ofb128.c index 031110a274e..1b8a6fd500d 100644 --- a/lib/libssl/src/crypto/modes/ofb128.c +++ b/lib/libssl/src/crypto/modes/ofb128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ofb128.c,v 1.3 2014/06/12 15:49:30 deraadt Exp $ */ +/* $OpenBSD: ofb128.c,v 1.4 2015/02/10 09:46:30 miod Exp $ */ /* ==================================================================== * Copyright (c) 2008 The OpenSSL Project. All rights reserved. * @@ -58,7 +58,6 @@ # define NDEBUG # endif #endif -#include <assert.h> /* The input and output encrypted as though 128bit ofb mode is being * 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, unsigned int n; size_t l=0; - assert(in && out && key && ivec && num); - n = *num; #if !defined(OPENSSL_SMALL_FOOTPRINT) diff --git a/lib/libssl/src/crypto/modes/xts128.c b/lib/libssl/src/crypto/modes/xts128.c index e6a0fbb0fa9..3e2378379e0 100644 --- a/lib/libssl/src/crypto/modes/xts128.c +++ b/lib/libssl/src/crypto/modes/xts128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xts128.c,v 1.5 2014/07/09 16:06:13 miod Exp $ */ +/* $OpenBSD: xts128.c,v 1.6 2015/02/10 09:46:30 miod Exp $ */ /* ==================================================================== * Copyright (c) 2011 The OpenSSL Project. All rights reserved. * @@ -58,7 +58,6 @@ # define NDEBUG # endif #endif -#include <assert.h> int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], const unsigned char *inp, unsigned char *out, diff --git a/lib/libssl/src/crypto/ts/ts_verify_ctx.c b/lib/libssl/src/crypto/ts/ts_verify_ctx.c index 373399d9434..7dda76e7d9a 100644 --- a/lib/libssl/src/crypto/ts/ts_verify_ctx.c +++ b/lib/libssl/src/crypto/ts/ts_verify_ctx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ts_verify_ctx.c,v 1.7 2014/07/11 08:44:49 jsing Exp $ */ +/* $OpenBSD: ts_verify_ctx.c,v 1.8 2015/02/10 09:46:30 miod Exp $ */ /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL * project 2003. */ @@ -76,7 +76,6 @@ TS_VERIFY_CTX_new(void) void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx) { - OPENSSL_assert(ctx != NULL); memset(ctx, 0, sizeof(TS_VERIFY_CTX)); } @@ -123,7 +122,6 @@ TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx) ASN1_OCTET_STRING *msg; const ASN1_INTEGER *nonce; - OPENSSL_assert(req != NULL); if (ret) TS_VERIFY_CTX_cleanup(ret); else if (!(ret = TS_VERIFY_CTX_new())) |