From 273e048d695a49faad75ca2ffa6e445353142be8 Mon Sep 17 00:00:00 2001 From: jsing <> Date: Wed, 23 Apr 2025 10:09:08 +0000 Subject: Unifdef OPENSSL_SMALL_FOOTPRINT. We do not build with OPENSSL_SMALL_FOOTPRINT and it removes more untested code paths. Request by tb@ (and it was already on my TODO list!) --- src/lib/libcrypto/des/des_local.h | 6 +----- src/lib/libcrypto/modes/cbc128.c | 6 +----- src/lib/libcrypto/modes/cfb128.c | 6 +----- src/lib/libcrypto/modes/ctr128.c | 6 +----- src/lib/libcrypto/modes/ofb128.c | 4 +--- 5 files changed, 5 insertions(+), 23 deletions(-) (limited to 'src/lib') diff --git a/src/lib/libcrypto/des/des_local.h b/src/lib/libcrypto/des/des_local.h index 61bfde7520..077c03139f 100644 --- a/src/lib/libcrypto/des/des_local.h +++ b/src/lib/libcrypto/des/des_local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: des_local.h,v 1.5 2024/08/31 16:22:18 jsing Exp $ */ +/* $OpenBSD: des_local.h,v 1.6 2025/04/23 10:08:20 jsing Exp $ */ /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -217,10 +217,6 @@ ROTATE(uint32_t a, uint32_t n) extern const DES_LONG DES_SPtrans[8][64]; -#ifdef OPENSSL_SMALL_FOOTPRINT -#undef DES_UNROLL -#endif - __END_HIDDEN_DECLS #endif diff --git a/src/lib/libcrypto/modes/cbc128.c b/src/lib/libcrypto/modes/cbc128.c index 5767533c44..1b6858ee25 100644 --- a/src/lib/libcrypto/modes/cbc128.c +++ b/src/lib/libcrypto/modes/cbc128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cbc128.c,v 1.10 2025/04/21 16:01:18 jsing Exp $ */ +/* $OpenBSD: cbc128.c,v 1.11 2025/04/23 10:09:08 jsing Exp $ */ /* ==================================================================== * Copyright (c) 2008 The OpenSSL Project. All rights reserved. * @@ -70,7 +70,6 @@ CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, size_t n; const unsigned char *iv = ivec; -#if !defined(OPENSSL_SMALL_FOOTPRINT) if (STRICT_ALIGNMENT && ((size_t)in|(size_t)out|(size_t)ivec) % sizeof(size_t) != 0) { while (len >= 16) { @@ -94,7 +93,6 @@ CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, out += 16; } } -#endif while (len) { for (n = 0; n < 16 && n < len; ++n) out[n] = in[n] ^ iv[n]; @@ -123,7 +121,6 @@ CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, unsigned char c[16]; } tmp; -#if !defined(OPENSSL_SMALL_FOOTPRINT) if (in != out) { const unsigned char *iv = ivec; @@ -188,7 +185,6 @@ CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, } } } -#endif while (len) { unsigned char c; (*block)(in, tmp.c, key); diff --git a/src/lib/libcrypto/modes/cfb128.c b/src/lib/libcrypto/modes/cfb128.c index 4f9dac178d..9a63a46724 100644 --- a/src/lib/libcrypto/modes/cfb128.c +++ b/src/lib/libcrypto/modes/cfb128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cfb128.c,v 1.9 2025/04/21 16:01:18 jsing Exp $ */ +/* $OpenBSD: cfb128.c,v 1.10 2025/04/23 10:09:08 jsing Exp $ */ /* ==================================================================== * Copyright (c) 2008 The OpenSSL Project. All rights reserved. * @@ -71,7 +71,6 @@ CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, n = *num; if (enc) { -#if !defined(OPENSSL_SMALL_FOOTPRINT) if (16 % sizeof(size_t) == 0) do { /* always true actually */ while (n && len) { @@ -107,7 +106,6 @@ CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, return; } while (0); /* the rest would be commonly eliminated by x86* compiler */ -#endif while (l < len) { if (n == 0) { (*block)(ivec, ivec, key); @@ -118,7 +116,6 @@ CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, } *num = n; } else { -#if !defined(OPENSSL_SMALL_FOOTPRINT) if (16 % sizeof(size_t) == 0) do { /* always true actually */ while (n && len) { @@ -159,7 +156,6 @@ CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, return; } while (0); /* the rest would be commonly eliminated by x86* compiler */ -#endif while (l < len) { unsigned char c; if (n == 0) { diff --git a/src/lib/libcrypto/modes/ctr128.c b/src/lib/libcrypto/modes/ctr128.c index 6d1bcff313..30563ed6e3 100644 --- a/src/lib/libcrypto/modes/ctr128.c +++ b/src/lib/libcrypto/modes/ctr128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ctr128.c,v 1.16 2025/04/22 14:08:24 jsing Exp $ */ +/* $OpenBSD: ctr128.c,v 1.17 2025/04/23 10:09:08 jsing Exp $ */ /* ==================================================================== * Copyright (c) 2008 The OpenSSL Project. All rights reserved. * @@ -76,7 +76,6 @@ ctr128_inc(unsigned char *counter) } while (n); } -#if !defined(OPENSSL_SMALL_FOOTPRINT) static void ctr128_inc_aligned(unsigned char *counter) { @@ -96,7 +95,6 @@ ctr128_inc_aligned(unsigned char *counter) } while (n); #endif } -#endif /* The input encrypted as though 128bit counter mode is being * used. The extra state information to record how much of the @@ -122,7 +120,6 @@ CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, OPENSSL_assert(n < 16); -#if !defined(OPENSSL_SMALL_FOOTPRINT) if (16 % sizeof(size_t) == 0) do { /* always true actually */ while (n && len) { @@ -160,7 +157,6 @@ CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, return; } while (0); /* the rest would be commonly eliminated by x86* compiler */ -#endif while (l < len) { if (n == 0) { (*block)(ivec, ecount_buf, key); diff --git a/src/lib/libcrypto/modes/ofb128.c b/src/lib/libcrypto/modes/ofb128.c index 3f5a6ce110..8440e7f583 100644 --- a/src/lib/libcrypto/modes/ofb128.c +++ b/src/lib/libcrypto/modes/ofb128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ofb128.c,v 1.9 2025/04/21 16:01:18 jsing Exp $ */ +/* $OpenBSD: ofb128.c,v 1.10 2025/04/23 10:09:08 jsing Exp $ */ /* ==================================================================== * Copyright (c) 2008 The OpenSSL Project. All rights reserved. * @@ -70,7 +70,6 @@ CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, n = *num; -#if !defined(OPENSSL_SMALL_FOOTPRINT) if (16 % sizeof(size_t) == 0) do { /* always true actually */ while (n && len) { @@ -105,7 +104,6 @@ CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, return; } while (0); /* the rest would be commonly eliminated by x86* compiler */ -#endif while (l < len) { if (n == 0) { (*block)(ivec, ivec, key); -- cgit v1.2.3-55-g6feb