From 0d345f0e10b14392925479fc61b6c9072a9605a3 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Fri, 7 Jun 2019 16:32:49 +0100 Subject: [PATCH] Make the PACKET/WPACKET code available to both libcrypto and libssl Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/9111) --- crypto/build.info | 2 +- {ssl => crypto}/packet.c | 2 +- ssl/packet_locl.h => include/internal/packet.h | 0 ssl/build.info | 6 +++++- ssl/record/rec_layer_d1.c | 2 +- ssl/record/rec_layer_s3.c | 2 +- ssl/ssl_locl.h | 2 +- ssl/ssl_rsa.c | 2 +- test/asynciotest.c | 2 +- test/bad_dtls_test.c | 2 +- test/build.info | 2 +- test/clienthellotest.c | 2 +- test/packettest.c | 2 +- test/servername_test.c | 2 +- test/sslbuffertest.c | 2 +- test/tls13ccstest.c | 2 +- test/wpackettest.c | 2 +- 17 files changed, 20 insertions(+), 16 deletions(-) rename {ssl => crypto}/packet.c (99%) rename ssl/packet_locl.h => include/internal/packet.h (100%) diff --git a/crypto/build.info b/crypto/build.info index b82978e1c7..90ccbc8b54 100644 --- a/crypto/build.info +++ b/crypto/build.info @@ -75,7 +75,7 @@ SOURCE[../libcrypto]=$UTIL_COMMON \ mem.c mem_sec.c mem_str.c mem_dbg.c \ cversion.c info.c cpt_err.c ebcdic.c uid.c o_time.c o_dir.c \ o_fopen.c getenv.c o_init.c o_fips.c init.c trace.c provider.c \ - asn1_dsa.c $UPLINKSRC + asn1_dsa.c packet.c $UPLINKSRC DEFINE[../libcrypto]=$UTIL_DEFINE $UPLINKDEF SOURCE[../providers/fips]=$UTIL_COMMON DEFINE[../providers/fips]=$UTIL_DEFINE diff --git a/ssl/packet.c b/crypto/packet.c similarity index 99% rename from ssl/packet.c rename to crypto/packet.c index 26cf1eb496..cb6739b85b 100644 --- a/ssl/packet.c +++ b/crypto/packet.c @@ -8,7 +8,7 @@ */ #include "internal/cryptlib.h" -#include "packet_locl.h" +#include "internal/packet.h" #include #define DEFAULT_BUF_SIZE 256 diff --git a/ssl/packet_locl.h b/include/internal/packet.h similarity index 100% rename from ssl/packet_locl.h rename to include/internal/packet.h diff --git a/ssl/build.info b/ssl/build.info index bb2f1deb53..152810ba25 100644 --- a/ssl/build.info +++ b/ssl/build.info @@ -1,6 +1,10 @@ LIBS=../libssl +#TODO: For now we just include the libcrypto packet.c in libssl as well. We +# could either continue to do it like this, or export all the WPACKET +# symbols so that libssl can use them like any other. Probably would do +# this privately so it does not become part of the public API. SOURCE[../libssl]=\ - pqueue.c packet.c \ + pqueue.c ../crypto/packet.c \ statem/statem_srvr.c statem/statem_clnt.c s3_lib.c s3_enc.c record/rec_layer_s3.c \ statem/statem_lib.c statem/extensions.c statem/extensions_srvr.c \ statem/extensions_clnt.c statem/extensions_cust.c s3_cbc.c s3_msg.c \ diff --git a/ssl/record/rec_layer_d1.c b/ssl/record/rec_layer_d1.c index 821c9cc5eb..1256f9e0c9 100644 --- a/ssl/record/rec_layer_d1.c +++ b/ssl/record/rec_layer_d1.c @@ -13,7 +13,7 @@ #include #include #include "record_locl.h" -#include "../packet_locl.h" +#include "internal/packet.h" #include "internal/cryptlib.h" int DTLS_RECORD_LAYER_new(RECORD_LAYER *rl) diff --git a/ssl/record/rec_layer_s3.c b/ssl/record/rec_layer_s3.c index a9911328e6..9efaf54be2 100644 --- a/ssl/record/rec_layer_s3.c +++ b/ssl/record/rec_layer_s3.c @@ -15,7 +15,7 @@ #include #include #include "record_locl.h" -#include "../packet_locl.h" +#include "internal/packet.h" #if defined(OPENSSL_SMALL_FOOTPRINT) || \ !( defined(AES_ASM) && ( \ diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h index 269f542f2a..a4278b2101 100644 --- a/ssl/ssl_locl.h +++ b/ssl/ssl_locl.h @@ -30,7 +30,7 @@ # include # include "record/record.h" # include "statem/statem.h" -# include "packet_locl.h" +# include "internal/packet.h" # include "internal/dane.h" # include "internal/refcount.h" # include "internal/tsan_assist.h" diff --git a/ssl/ssl_rsa.c b/ssl/ssl_rsa.c index 897c8f2e77..2c447eea3e 100644 --- a/ssl/ssl_rsa.c +++ b/ssl/ssl_rsa.c @@ -9,7 +9,7 @@ #include #include "ssl_locl.h" -#include "packet_locl.h" +#include "internal/packet.h" #include #include #include diff --git a/test/asynciotest.c b/test/asynciotest.c index 3bba098ad7..bf0a20561e 100644 --- a/test/asynciotest.c +++ b/test/asynciotest.c @@ -13,7 +13,7 @@ #include #include -#include "../ssl/packet_locl.h" +#include "internal/packet.h" #include "ssltestlib.h" #include "testutil.h" diff --git a/test/bad_dtls_test.c b/test/bad_dtls_test.c index 5f6b6a9a9d..66b5e1d2ed 100644 --- a/test/bad_dtls_test.c +++ b/test/bad_dtls_test.c @@ -37,7 +37,7 @@ #include #include #include -#include "../ssl/packet_locl.h" +#include "internal/packet.h" #include "internal/nelem.h" #include "testutil.h" diff --git a/test/build.info b/test/build.info index a61c0ce2be..e38f142259 100644 --- a/test/build.info +++ b/test/build.info @@ -587,7 +587,7 @@ IF[{- !$disabled{tests} -}] IF[{- !$disabled{shared} -}] PROGRAMS{noinst}=tls13secretstest SOURCE[tls13secretstest]=tls13secretstest.c - SOURCE[tls13secretstest]= ../ssl/tls13_enc.c ../ssl/packet.c + SOURCE[tls13secretstest]= ../ssl/tls13_enc.c ../crypto/packet.c INCLUDE[tls13secretstest]=.. ../include ../apps/include DEPEND[tls13secretstest]=../libcrypto ../libssl libtestutil.a ENDIF diff --git a/test/clienthellotest.c b/test/clienthellotest.c index 0afad6dbd6..03b8745595 100644 --- a/test/clienthellotest.c +++ b/test/clienthellotest.c @@ -17,7 +17,7 @@ #include #include -#include "../ssl/packet_locl.h" +#include "internal/packet.h" #include "testutil.h" diff --git a/test/packettest.c b/test/packettest.c index 41d938a68a..2d6c2a6ef9 100644 --- a/test/packettest.c +++ b/test/packettest.c @@ -7,7 +7,7 @@ * https://www.openssl.org/source/license.html */ -#include "../ssl/packet_locl.h" +#include "internal/packet.h" #include "testutil.h" #define BUF_LEN 255 diff --git a/test/servername_test.c b/test/servername_test.c index 86d261f375..3d19265db9 100644 --- a/test/servername_test.c +++ b/test/servername_test.c @@ -18,7 +18,7 @@ #include #include -#include "../ssl/packet_locl.h" +#include "internal/packet.h" #include "testutil.h" #include "internal/nelem.h" diff --git a/test/sslbuffertest.c b/test/sslbuffertest.c index 9a5ec2b958..e8293f7def 100644 --- a/test/sslbuffertest.c +++ b/test/sslbuffertest.c @@ -13,7 +13,7 @@ #include #include -#include "../ssl/packet_locl.h" +#include "internal/packet.h" #include "ssltestlib.h" #include "testutil.h" diff --git a/test/tls13ccstest.c b/test/tls13ccstest.c index 1d0a268615..999ca5700a 100644 --- a/test/tls13ccstest.c +++ b/test/tls13ccstest.c @@ -11,7 +11,7 @@ #include #include "ssltestlib.h" #include "testutil.h" -#include "../ssl/packet_locl.h" +#include "internal/packet.h" static char *cert = NULL; static char *privkey = NULL; diff --git a/test/wpackettest.c b/test/wpackettest.c index 0a27c639ea..abb001ea14 100644 --- a/test/wpackettest.c +++ b/test/wpackettest.c @@ -9,7 +9,7 @@ #include #include -#include "../ssl/packet_locl.h" +#include "internal/packet.h" #include "testutil.h" static const unsigned char simple1[] = { 0xff };