From c54f1e6efb3beda80d415ba75614cbc695f799be Mon Sep 17 00:00:00 2001 From: miod <> Date: Tue, 10 Feb 2015 09:46:30 +0000 Subject: 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@ --- src/lib/libcrypto/modes/cbc128.c | 7 +------ src/lib/libcrypto/modes/ccm128.c | 3 +-- src/lib/libcrypto/modes/cfb128.c | 11 +---------- src/lib/libcrypto/modes/ctr128.c | 4 +--- src/lib/libcrypto/modes/cts128.c | 19 +------------------ src/lib/libcrypto/modes/gcm128.c | 3 +-- src/lib/libcrypto/modes/ofb128.c | 5 +---- src/lib/libcrypto/modes/xts128.c | 3 +-- 8 files changed, 8 insertions(+), 47 deletions(-) (limited to 'src/lib/libcrypto/modes') 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 @@ -/* $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 #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/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 @@ -/* $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 /* First you setup M and L parameters and pass the key schedule. * 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 @@ -/* $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 /* 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 /* * 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/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 @@ -/* $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 #if defined(BSWAP4) && defined(__STRICT_ALIGNMENT) /* 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 @@ -/* $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 /* 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/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 @@ -/* $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 int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], const unsigned char *inp, unsigned char *out, -- cgit v1.2.3-55-g6feb