diff options
author | Pauli <paul.dale@oracle.com> | 2017-08-18 09:50:25 +1000 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2017-08-18 09:50:25 +1000 |
commit | b99fe5f4927b305bae88daac2484c284fe749329 (patch) | |
tree | 0497ffa8a2d0e0ea72ecca5d32d6878888835fd4 | |
parent | 524fdd515569e12047ddb29ba4c7f19706aacc98 (diff) |
Remove tests dependence on e_os.h
Apart from ssltest_old.c, the test suite relied on e_os.h for the
OSSL_NELEM macro and nothing else.
The ssltest_old.c also requires EXIT and some socket macros.
Create a new header to define the OSSL_NELEM macro and use that instead.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4186)
58 files changed, 74 insertions, 58 deletions
@@ -1,5 +1,5 @@ /* - * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -14,6 +14,8 @@ # include <openssl/e_os2.h> # include <openssl/crypto.h> +# include <internal/nelem.h> + /* * <openssl/e_os2.h> contains what we can justify to make visible to the * outside; this file e_os.h is not part of the exported interface. @@ -540,8 +542,6 @@ struct servent *getservbyname(const char *name, const char *proto); # endif /* end vxworks */ -#define OSSL_NELEM(x) (sizeof(x)/sizeof((x)[0])) - #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION # define CRYPTO_memcmp memcmp #endif diff --git a/include/internal/nelem.h b/include/internal/nelem.h new file mode 100644 index 0000000000..d65a21a9fb --- /dev/null +++ b/include/internal/nelem.h @@ -0,0 +1,14 @@ +/* + * Copyright 2017 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_NELEM_H +# define HEADER_NELEM_H + +# define OSSL_NELEM(x) (sizeof(x)/sizeof((x)[0])) +#endif diff --git a/test/asn1_internal_test.c b/test/asn1_internal_test.c index 194a073788..06e324b5b7 100644 --- a/test/asn1_internal_test.c +++ b/test/asn1_internal_test.c @@ -16,7 +16,7 @@ #include <openssl/evp.h> #include <openssl/objects.h> #include "testutil.h" -#include "e_os.h" +#include <internal/nelem.h> /********************************************************************** * diff --git a/test/asn1_time_test.c b/test/asn1_time_test.c index 184a18a5ad..897436c3f4 100644 --- a/test/asn1_time_test.c +++ b/test/asn1_time_test.c @@ -16,7 +16,7 @@ #include <openssl/evp.h> #include <openssl/objects.h> #include "testutil.h" -#include "e_os.h" +#include <internal/nelem.h> struct testdata { char *data; /* TIME string value */ diff --git a/test/bad_dtls_test.c b/test/bad_dtls_test.c index 2c10a1cc5b..932cb0eb1d 100644 --- a/test/bad_dtls_test.c +++ b/test/bad_dtls_test.c @@ -39,7 +39,7 @@ #include <openssl/kdf.h> #include "../ssl/packet_locl.h" -#include "../e_os.h" /* for OSSL_NELEM() */ +#include <internal/nelem.h> #include "testutil.h" diff --git a/test/bftest.c b/test/bftest.c index cc509f2dfc..0639ec888d 100644 --- a/test/bftest.c +++ b/test/bftest.c @@ -19,7 +19,7 @@ #include "testutil.h" -#include "../e_os.h" +#include <internal/nelem.h> #ifndef OPENSSL_NO_BF # include <openssl/blowfish.h> diff --git a/test/bntest.c b/test/bntest.c index f32b308d0c..cb292c6aba 100644 --- a/test/bntest.c +++ b/test/bntest.c @@ -12,7 +12,7 @@ #include <string.h> #include <ctype.h> -#include "e_os.h" +#include <internal/nelem.h> #include <internal/numbers.h> #include <openssl/bn.h> #include <openssl/crypto.h> diff --git a/test/casttest.c b/test/casttest.c index 0fdcb100cc..417a4cba2e 100644 --- a/test/casttest.c +++ b/test/casttest.c @@ -12,7 +12,7 @@ #include <stdlib.h> #include <openssl/opensslconf.h> /* To see if OPENSSL_NO_CAST is defined */ -#include "e_os.h" +#include <internal/nelem.h> #include "testutil.h" #ifndef OPENSSL_NO_CAST diff --git a/test/cipher_overhead_test.c b/test/cipher_overhead_test.c index e93bf33e4c..a07ac7e86b 100644 --- a/test/cipher_overhead_test.c +++ b/test/cipher_overhead_test.c @@ -7,7 +7,7 @@ * https://www.openssl.org/source/license.html */ -#include "e_os.h" +#include <internal/nelem.h> #include "testutil.h" #ifdef __VMS diff --git a/test/cipherbytes_test.c b/test/cipherbytes_test.c index 6601f7b5d6..13d6b23aaa 100644 --- a/test/cipherbytes_test.c +++ b/test/cipherbytes_test.c @@ -18,7 +18,7 @@ #include <openssl/ssl3.h> #include <openssl/tls1.h> -#include "e_os.h" +#include <internal/nelem.h> #include "testutil.h" static SSL_CTX *ctx; diff --git a/test/cipherlist_test.c b/test/cipherlist_test.c index 829042748a..6ec963110e 100644 --- a/test/cipherlist_test.c +++ b/test/cipherlist_test.c @@ -18,7 +18,7 @@ #include <openssl/ssl3.h> #include <openssl/tls1.h> -#include "e_os.h" +#include <internal/nelem.h> #include "testutil.h" typedef struct cipherlist_test_fixture { diff --git a/test/ciphername_test.c b/test/ciphername_test.c index f010a3b8bc..0eac902ca9 100644 --- a/test/ciphername_test.c +++ b/test/ciphername_test.c @@ -19,7 +19,7 @@ #include <openssl/ssl3.h> #include <openssl/tls1.h> -#include "e_os.h" +#include <internal/nelem.h> #include "testutil.h" typedef struct cipher_id_name { diff --git a/test/constant_time_test.c b/test/constant_time_test.c index 8575194e90..24cbaf3660 100644 --- a/test/constant_time_test.c +++ b/test/constant_time_test.c @@ -10,7 +10,7 @@ #include <stdio.h> #include <stdlib.h> -#include "e_os.h" +#include <internal/nelem.h> #include "internal/constant_time_locl.h" #include "testutil.h" #include "internal/numbers.h" diff --git a/test/crltest.c b/test/crltest.c index 720c13b3a2..f5af4b1e4f 100644 --- a/test/crltest.c +++ b/test/crltest.c @@ -7,7 +7,7 @@ * https://www.openssl.org/source/license.html */ -#include "../e_os.h" +#include <internal/nelem.h> #include <string.h> #include <openssl/bio.h> #include <openssl/crypto.h> diff --git a/test/d2i_test.c b/test/d2i_test.c index e5ebcfa027..48edba4946 100644 --- a/test/d2i_test.c +++ b/test/d2i_test.c @@ -20,7 +20,7 @@ #include <openssl/err.h> #include <openssl/x509.h> #include <openssl/x509v3.h> -#include "e_os.h" +#include <internal/nelem.h> static const ASN1_ITEM *item_type; static const char *test_file; diff --git a/test/danetest.c b/test/danetest.c index d21f554c7e..de51c83f56 100644 --- a/test/danetest.c +++ b/test/danetest.c @@ -24,7 +24,7 @@ #endif #include "testutil.h" -#include "e_os.h" +#include <internal/nelem.h> #define _UC(c) ((unsigned char)(c)) diff --git a/test/dhtest.c b/test/dhtest.c index 595732c673..ac09c445fa 100644 --- a/test/dhtest.c +++ b/test/dhtest.c @@ -11,7 +11,7 @@ #include <stdlib.h> #include <string.h> -#include "e_os.h" +#include <internal/nelem.h> #include <openssl/crypto.h> #include <openssl/bio.h> #include <openssl/bn.h> diff --git a/test/drbgtest.c b/test/drbgtest.c index 62d2dbde64..28d0d905c3 100644 --- a/test/drbgtest.c +++ b/test/drbgtest.c @@ -8,7 +8,7 @@ */ #include <string.h> -#include "e_os.h" +#include <internal/nelem.h> #include <openssl/crypto.h> #include <openssl/err.h> #include <openssl/rand.h> diff --git a/test/dsatest.c b/test/dsatest.c index 7c58731df8..d25a1d701f 100644 --- a/test/dsatest.c +++ b/test/dsatest.c @@ -19,7 +19,7 @@ #include <openssl/dsa.h> #include "testutil.h" -#include "e_os.h" +#include <internal/nelem.h> #ifndef OPENSSL_NO_DSA static int dsa_cb(int p, int n, BN_GENCB *arg); diff --git a/test/dtlsv1listentest.c b/test/dtlsv1listentest.c index e401ccffdd..00120cc0ab 100644 --- a/test/dtlsv1listentest.c +++ b/test/dtlsv1listentest.c @@ -12,7 +12,7 @@ #include <openssl/bio.h> #include <openssl/err.h> #include <openssl/conf.h> -#include "e_os.h" +#include <internal/nelem.h> #include "testutil.h" #ifndef OPENSSL_NO_SOCK diff --git a/test/ecstresstest.c b/test/ecstresstest.c index e16ccd59f6..7c76f02108 100644 --- a/test/ecstresstest.c +++ b/test/ecstresstest.c @@ -8,7 +8,7 @@ * or in the file LICENSE in the source distribution. */ -#include "e_os.h" +#include <internal/nelem.h> #include "testutil.h" #include <stdio.h> diff --git a/test/ectest.c b/test/ectest.c index 80e10013a8..85847e0870 100644 --- a/test/ectest.c +++ b/test/ectest.c @@ -8,7 +8,7 @@ * https://www.openssl.org/source/license.html */ -#include "e_os.h" +#include <internal/nelem.h> #include "testutil.h" #ifndef OPENSSL_NO_EC diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c index acccfe5449..5ca95e4fd6 100644 --- a/test/evp_extra_test.c +++ b/test/evp_extra_test.c @@ -16,7 +16,7 @@ #include <openssl/rsa.h> #include <openssl/x509.h> #include "testutil.h" -#include "e_os.h" +#include <internal/nelem.h> /* * kExampleRSAKeyDER is an RSA private key in ASN.1, DER format. Of course, you diff --git a/test/exptest.c b/test/exptest.c index b357a2349d..62a2377dfd 100644 --- a/test/exptest.c +++ b/test/exptest.c @@ -11,7 +11,7 @@ #include <stdlib.h> #include <string.h> -#include "../e_os.h" +#include <internal/nelem.h> #include <openssl/bio.h> #include <openssl/bn.h> diff --git a/test/handshake_helper.c b/test/handshake_helper.c index d200332771..b33cdd5640 100644 --- a/test/handshake_helper.c +++ b/test/handshake_helper.c @@ -18,7 +18,7 @@ #ifndef OPENSSL_NO_SOCK # define USE_SOCKETS -# include "e_os.h" +# include <internal/nelem.h> #endif #include "handshake_helper.h" diff --git a/test/hmactest.c b/test/hmactest.c index efe21e0609..abd1193d81 100644 --- a/test/hmactest.c +++ b/test/hmactest.c @@ -11,7 +11,7 @@ #include <string.h> #include <stdlib.h> -#include "../e_os.h" +#include <internal/nelem.h> # include <openssl/hmac.h> # include <openssl/sha.h> diff --git a/test/ideatest.c b/test/ideatest.c index 32fea47ab7..5b715fe1c9 100644 --- a/test/ideatest.c +++ b/test/ideatest.c @@ -9,7 +9,7 @@ #include <string.h> -#include "../e_os.h" +#include <internal/nelem.h> #include "testutil.h" #ifndef OPENSSL_NO_IDEA diff --git a/test/igetest.c b/test/igetest.c index a5c890e346..8a1db67704 100644 --- a/test/igetest.c +++ b/test/igetest.c @@ -12,7 +12,7 @@ #include <openssl/rand.h> #include <stdio.h> #include <string.h> -#include "e_os.h" +#include <internal/nelem.h> #include "testutil.h" #define TEST_SIZE 128 diff --git a/test/lhash_test.c b/test/lhash_test.c index 704b1807b4..6deea8d992 100644 --- a/test/lhash_test.c +++ b/test/lhash_test.c @@ -16,7 +16,7 @@ #include <openssl/err.h> #include <openssl/crypto.h> -#include "e_os.h" +#include <internal/nelem.h> #include "testutil.h" /* diff --git a/test/md2test.c b/test/md2test.c index cda84697af..df55932f82 100644 --- a/test/md2test.c +++ b/test/md2test.c @@ -9,7 +9,7 @@ #include <string.h> -#include "../e_os.h" +#include <internal/nelem.h> #include "testutil.h" #ifndef OPENSSL_NO_MD2 diff --git a/test/mdc2_internal_test.c b/test/mdc2_internal_test.c index 2c8d22d990..c5e74ea5ef 100644 --- a/test/mdc2_internal_test.c +++ b/test/mdc2_internal_test.c @@ -14,7 +14,7 @@ #include <openssl/mdc2.h> #include "testutil.h" -#include "e_os.h" +#include <internal/nelem.h> typedef struct { const char *input; diff --git a/test/mdc2test.c b/test/mdc2test.c index 4f29953480..5dfe60e8bf 100644 --- a/test/mdc2test.c +++ b/test/mdc2test.c @@ -9,7 +9,7 @@ #include <string.h> -#include "../e_os.h" +#include <internal/nelem.h> #include "testutil.h" #if defined(OPENSSL_NO_DES) && !defined(OPENSSL_NO_MDC2) diff --git a/test/modes_internal_test.c b/test/modes_internal_test.c index e2eb3b65d0..3fd0498b8b 100644 --- a/test/modes_internal_test.c +++ b/test/modes_internal_test.c @@ -16,7 +16,7 @@ #include <openssl/modes.h> #include "../crypto/modes/modes_lcl.h" #include "testutil.h" -#include "e_os.h" +#include <internal/nelem.h> typedef struct { size_t size; diff --git a/test/poly1305_internal_test.c b/test/poly1305_internal_test.c index 592f4b6e83..55b76440ea 100644 --- a/test/poly1305_internal_test.c +++ b/test/poly1305_internal_test.c @@ -15,7 +15,7 @@ #include "testutil.h" #include "internal/poly1305.h" #include "../crypto/poly1305/poly1305_local.h" -#include "e_os.h" +#include <internal/nelem.h> typedef struct { size_t size; diff --git a/test/rc2test.c b/test/rc2test.c index 6323d81beb..fc00076b17 100644 --- a/test/rc2test.c +++ b/test/rc2test.c @@ -7,7 +7,7 @@ * https://www.openssl.org/source/license.html */ -#include "../e_os.h" +#include <internal/nelem.h> #include "testutil.h" #ifndef OPENSSL_NO_RC2 diff --git a/test/rc4test.c b/test/rc4test.c index b2032fdd34..e3f41b6208 100644 --- a/test/rc4test.c +++ b/test/rc4test.c @@ -9,7 +9,7 @@ #include <string.h> -#include "../e_os.h" +#include <internal/nelem.h> #include "testutil.h" #ifndef OPENSSL_NO_RC4 diff --git a/test/rc5test.c b/test/rc5test.c index 16a0364630..9aa214f814 100644 --- a/test/rc5test.c +++ b/test/rc5test.c @@ -9,7 +9,7 @@ #include <string.h> -#include "../e_os.h" +#include <internal/nelem.h> #include "testutil.h" #ifndef OPENSSL_NO_RC5 diff --git a/test/rsa_test.c b/test/rsa_test.c index 55339f9053..13dcde1890 100644 --- a/test/rsa_test.c +++ b/test/rsa_test.c @@ -12,7 +12,7 @@ #include <stdio.h> #include <string.h> -#include "e_os.h" +#include <internal/nelem.h> #include <openssl/crypto.h> #include <openssl/err.h> diff --git a/test/servername_test.c b/test/servername_test.c index e0fe4d5eb5..f1b66ee510 100644 --- a/test/servername_test.c +++ b/test/servername_test.c @@ -21,7 +21,7 @@ #include "../ssl/packet_locl.h" #include "testutil.h" -#include "e_os.h" +#include <internal/nelem.h> #define CLIENT_VERSION_LEN 2 diff --git a/test/siphash_internal_test.c b/test/siphash_internal_test.c index ca24339ee7..60a2d8dd01 100644 --- a/test/siphash_internal_test.c +++ b/test/siphash_internal_test.c @@ -16,7 +16,7 @@ #include "testutil.h" #include "internal/siphash.h" #include "../crypto/siphash/siphash_local.h" -#include "e_os.h" +#include <internal/nelem.h> static BIO* b_stderr = NULL; static BIO* b_stdout = NULL; diff --git a/test/ssl_cert_table_internal_test.c b/test/ssl_cert_table_internal_test.c index 9d6d2b5759..9f52015214 100644 --- a/test/ssl_cert_table_internal_test.c +++ b/ |