提交 b99fe5f4 编写于 作者: P Pauli

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: NRich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4186)
上级 524fdd51
/*
* 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
......
/*
* 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
......@@ -16,7 +16,7 @@
#include <openssl/evp.h>
#include <openssl/objects.h>
#include "testutil.h"
#include "e_os.h"
#include <internal/nelem.h>
/**********************************************************************
*
......
......@@ -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 */
......
......@@ -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"
......
......@@ -19,7 +19,7 @@
#include "testutil.h"
#include "../e_os.h"
#include <internal/nelem.h>
#ifndef OPENSSL_NO_BF
# include <openssl/blowfish.h>
......
......@@ -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>
......
......@@ -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
......
......@@ -7,7 +7,7 @@
* https://www.openssl.org/source/license.html
*/
#include "e_os.h"
#include <internal/nelem.h>
#include "testutil.h"
#ifdef __VMS
......
......@@ -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;
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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"
......
......@@ -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>
......
......@@ -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;
......
......@@ -24,7 +24,7 @@
#endif
#include "testutil.h"
#include "e_os.h"
#include <internal/nelem.h>
#define _UC(c) ((unsigned char)(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>
......
......@@ -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>
......
......@@ -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);
......
......@@ -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
......
......@@ -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>
......
......@@ -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
......
......@@ -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
......
......@@ -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>
......
......@@ -18,7 +18,7 @@
#ifndef OPENSSL_NO_SOCK
# define USE_SOCKETS
# include "e_os.h"
# include <internal/nelem.h>
#endif
#include "handshake_helper.h"
......
......@@ -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>
......
......@@ -9,7 +9,7 @@
#include <string.h>
#include "../e_os.h"
#include <internal/nelem.h>
#include "testutil.h"
#ifndef OPENSSL_NO_IDEA
......
......@@ -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
......
......@@ -16,7 +16,7 @@
#include <openssl/err.h>
#include <openssl/crypto.h>
#include "e_os.h"
#include <internal/nelem.h>
#include "testutil.h"
/*
......
......@@ -9,7 +9,7 @@
#include <string.h>
#include "../e_os.h"
#include <internal/nelem.h>
#include "testutil.h"
#ifndef OPENSSL_NO_MD2
......
......@@ -14,7 +14,7 @@
#include <openssl/mdc2.h>
#include "testutil.h"
#include "e_os.h"
#include <internal/nelem.h>
typedef struct {
const char *input;
......
......@@ -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)
......
......@@ -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;
......
......@@ -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;
......
......@@ -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
......
......@@ -9,7 +9,7 @@
#include <string.h>
#include "../e_os.h"
#include <internal/nelem.h>
#include "testutil.h"
#ifndef OPENSSL_NO_RC4
......
......@@ -9,7 +9,7 @@
#include <string.h>
#include "../e_os.h"
#include <internal/nelem.h>
#include "testutil.h"
#ifndef OPENSSL_NO_RC5
......
......@@ -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>
......
......@@ -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
......
......@@ -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;
......
......@@ -14,7 +14,7 @@
#include <openssl/ssl.h>
#include "testutil.h"
#include "e_os.h"
#include <internal/nelem.h>
#ifdef __VMS
# pragma names save
......
......@@ -12,7 +12,7 @@
#include <openssl/e_os2.h>
#include <openssl/crypto.h>
#include "e_os.h"
#include <internal/nelem.h>
#include "ssl_test_ctx.h"
#include "testutil.h"
......
......@@ -15,7 +15,7 @@
#include <stdio.h>
#include <string.h>
#include "e_os.h"
#include <internal/nelem.h>
#include "ssl_test_ctx.h"
#include "testutil.h"
#include <openssl/e_os2.h>
......
......@@ -17,7 +17,7 @@
#include "ssltestlib.h"
#include "testutil.h"
#include "e_os.h"
#include <internal/nelem.h>
#include "../ssl/ssl_locl.h"
static char *cert = NULL;
......
......@@ -25,6 +25,8 @@
#include <string.h>
#include <time.h>
#include <internal/nelem.h>
#define USE_SOCKETS
#include "e_os.h"
......
......@@ -9,7 +9,7 @@
#include <string.h>
#include "e_os.h"
#include <internal/nelem.h>
#include "ssltestlib.h"
#include "testutil.h"
......
......@@ -16,7 +16,7 @@
#include <openssl/err.h>
#include <openssl/crypto.h>
#include "e_os.h"
#include <internal/nelem.h>
#include "testutil.h"
/* The macros below generate unused functions which error out one of the clang
......
......@@ -16,7 +16,7 @@
#include <openssl/crypto.h>
#include <openssl/bn.h>
#include "e_os.h"
#include <internal/nelem.h>
#include "testutil.h"
#define TEST(expected, test) test_case((expected), #test, (test))
......
......@@ -14,7 +14,7 @@
#include <string.h>
#include <assert.h>
#include "../../e_os.h"
#include <internal/nelem.h>
#include <openssl/bio.h>
/*
......
......@@ -13,7 +13,7 @@
#include <string.h>
#include <ctype.h>
#include "../../e_os.h"
#include <internal/nelem.h>
/* The size of memory buffers to display on failure */
#define MEM_BUFFER_SIZE (2000)
......
......@@ -8,7 +8,7 @@
*/
#include "../testutil.h"
#include "../../e_os.h"
#include <internal/nelem.h>
#include "output.h"
#include "tu_local.h"
......
......@@ -12,7 +12,7 @@
#include <string.h>
#include <ctype.h>
#include "e_os.h"
#include "internal/nelem.h"
#include "../testutil.h"
#include "tu_local.h"
......
......@@ -14,7 +14,7 @@
#include <errno.h>
#include <string.h>
#include <ctype.h>
#include "../../e_os.h"
#include <internal/nelem.h>
/*
* Output a failed test first line.
......
......@@ -16,7 +16,7 @@
#include <openssl/asn1.h>
#include <openssl/x509.h>
#include "testutil.h"
#include "e_os.h"
#include <internal/nelem.h>
typedef struct {
const char *data;
......
......@@ -8,7 +8,7 @@
*/
#include <string.h>
#include "e_os.h"
#include <internal/nelem.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include "testutil.h"
......
......@@ -15,7 +15,7 @@
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include "testutil.h"
#include "e_os.h"
#include <internal/nelem.h>
/**********************************************************************
*
......
......@@ -15,7 +15,7 @@
#include <openssl/asn1.h>
#include <openssl/x509.h>
#include "testutil.h"
#include "e_os.h"
#include <internal/nelem.h>
typedef struct {
const char *data;
......
......@@ -16,7 +16,7 @@
#include <openssl/pem.h>
#include <openssl/conf.h>
#include <openssl/err.h>
#include "e_os.h"
#include <internal/nelem.h>
#include "testutil.h"
static int test_certs(int num)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册