From 2000281dad3111407092e8ea4b23996d65988500 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Fri, 5 Apr 2024 16:19:01 -0400 Subject: Convert demos to primary build system Reviewed-by: Nicola Tuveri Reviewed-by: Tim Hudson Reviewed-by: Paul Dale Reviewed-by: Tom Cosgrove (Merged from https://github.com/openssl/openssl/pull/24047) --- build.info | 2 +- demos/bio/build.info | 29 ++++++++++++++++++++++++++ demos/build.info | 22 ++++++++++++++++++++ demos/cipher/build.info | 17 ++++++++++++++++ demos/cms/build.info | 45 +++++++++++++++++++++++++++++++++++++++++ demos/digest/build.info | 20 ++++++++++++++++++ demos/encode/build.info | 17 ++++++++++++++++ demos/encrypt/build.info | 11 ++++++++++ demos/guide/build.info | 31 ++++++++++++++++++++++++++++ demos/http3/build.info | 16 +++++++++++++++ demos/http3/gen_nghttp3.pl | 37 +++++++++++++++++++++++++++++++++ demos/http3/ossl-nghttp3-demo.c | 4 ++-- demos/kdf/build.info | 26 ++++++++++++++++++++++++ demos/keyexch/build.info | 11 ++++++++++ demos/mac/build.info | 26 ++++++++++++++++++++++++ demos/pkey/build.info | 36 +++++++++++++++++++++++++++++++++ demos/signature/build.info | 31 ++++++++++++++++++++++++++++ demos/smime/build.info | 32 +++++++++++++++++++++++++++++ demos/sslecho/build.info | 11 ++++++++++ 19 files changed, 421 insertions(+), 3 deletions(-) create mode 100644 demos/bio/build.info create mode 100644 demos/build.info create mode 100644 demos/cipher/build.info create mode 100644 demos/cms/build.info create mode 100644 demos/digest/build.info create mode 100644 demos/encode/build.info create mode 100644 demos/encrypt/build.info create mode 100644 demos/guide/build.info create mode 100644 demos/http3/build.info create mode 100755 demos/http3/gen_nghttp3.pl create mode 100644 demos/kdf/build.info create mode 100644 demos/keyexch/build.info create mode 100644 demos/mac/build.info create mode 100644 demos/pkey/build.info create mode 100644 demos/signature/build.info create mode 100644 demos/smime/build.info create mode 100644 demos/sslecho/build.info diff --git a/build.info b/build.info index 790f2421e5..ad780336d4 100644 --- a/build.info +++ b/build.info @@ -1,7 +1,7 @@ # Note that some of these directories are filtered in Configure. Look for # %skipdir there for further explanations. -SUBDIRS=crypto ssl apps util tools fuzz providers doc +SUBDIRS=crypto ssl apps util tools fuzz providers doc demos IF[{- !$disabled{tests} -}] SUBDIRS=test ENDIF diff --git a/demos/bio/build.info b/demos/bio/build.info new file mode 100644 index 0000000000..e5bf7727f2 --- /dev/null +++ b/demos/bio/build.info @@ -0,0 +1,29 @@ +PROGRAMS{noinst}=client-arg sconnect server-cmod client-conf saccept server-arg server-conf + +INCLUDE[client-arg]=../../include +SOURCE[client-arg]=client-arg.c +DEPEND[client-arg]=../../libcrypto ../../libssl + +INCLUDE[sconnect]=../../include +SOURCE[sconnect]=sconnect.c +DEPEND[sconnect]=../../libcrypto ../../libssl + +INCLUDE[server-cmod]=../../include +SOURCE[server-cmod]=server-cmod.c +DEPEND[server-cmod]=../../libcrypto ../../libssl + +INCLUDE[client-conf]=../../include +SOURCE[client-conf]=client-conf.c +DEPEND[client-conf]=../../libcrypto ../../libssl + +INCLUDE[saccept]=../../include +SOURCE[saccept]=saccept.c +DEPEND[saccept]=../../libcrypto ../../libssl + +INCLUDE[server-arg]=../../include +SOURCE[server-arg]=server-arg.c +DEPEND[server-arg]=../../libcrypto ../../libssl + +INCLUDE[server-conf]=../../include +SOURCE[server-conf]=server-conf.c +DEPEND[server-conf]=../../libcrypto ../../libssl diff --git a/demos/build.info b/demos/build.info new file mode 100644 index 0000000000..49484653f4 --- /dev/null +++ b/demos/build.info @@ -0,0 +1,22 @@ +SUBDIRS=bio cipher digest keyexch mac kdf pkey signature \ + encrypt encode sslecho + +IF[{- !$disabled{"quic"} -}] + SUBDIRS=http3 +ENDIF + +IF[{- !$disabled{"cms"} -}] + IF[{- !$disabled{"deprecated"} -}] + SUBDIRS=cms + ENDIF +ENDIF + +IF[{- !$disabled{"dgram"} -}] + SUBDIRS=guide +ENDIF + +IF[{- !$disabled{"des"} -}] + IF[{- !$disabled{"deprecated"} -}] + SUBDIRS=smime + ENDIF +ENDIF diff --git a/demos/cipher/build.info b/demos/cipher/build.info new file mode 100644 index 0000000000..4c74cc9233 --- /dev/null +++ b/demos/cipher/build.info @@ -0,0 +1,17 @@ +PROGRAMS{noinst}=aesccm aesgcm aeskeywrap ariacbc + +INCLUDE[aesccm]=../../include +SOURCE[aesccm]=aesccm.c +DEPEND[aesccm]=../../libcrypto ../../libssl + +INCLUDE[aesgcm]=../../include +SOURCE[aesgcm]=aesgcm.c +DEPEND[aesgcm]=../../libcrypto ../../libssl + +INCLUDE[aeskeywrap]=../../include +SOURCE[aeskeywrap]=aeskeywrap.c +DEPEND[aeskeywrap]=../../libcrypto ../../libssl + +INCLUDE[ariacbc]=../../include +SOURCE[ariacbc]=ariacbc.c +DEPEND[ariacbc]=../../libcrypto ../../libssl diff --git a/demos/cms/build.info b/demos/cms/build.info new file mode 100644 index 0000000000..43a4bb6f2c --- /dev/null +++ b/demos/cms/build.info @@ -0,0 +1,45 @@ +PROGRAMS{noinst} = cms_comp \ + cms_ddec \ + cms_dec \ + cms_denc \ + cms_enc \ + cms_sign \ + cms_sign2 \ + cms_uncomp \ + cms_ver + +INCLUDE[cms_comp]=../../include +SOURCE[cms_comp]=cms_comp.c +DEPEND[cms_comp]=../../libcrypto ../../libssl + +INCLUDE[cms_ddec]=../../include +SOURCE[cms_ddec]=cms_ddec.c +DEPEND[cms_ddec]=../../libcrypto ../../libssl + +INCLUDE[cms_dec]=../../include +SOURCE[cms_dec]=cms_dec.c +DEPEND[cms_dec]=../../libcrypto ../../libssl + +INCLUDE[cms_denc]=../../include +SOURCE[cms_denc]=cms_denc.c +DEPEND[cms_denc]=../../libcrypto ../../libssl + +INCLUDE[cms_enc]=../../include +SOURCE[cms_enc]=cms_enc.c +DEPEND[cms_enc]=../../libcrypto ../../libssl + +INCLUDE[cms_sign]=../../include +SOURCE[cms_sign]=cms_sign.c +DEPEND[cms_sign]=../../libcrypto ../../libssl + +INCLUDE[cms_sign2]=../../include +SOURCE[cms_sign2]=cms_sign2.c +DEPEND[cms_sign2]=../../libcrypto ../../libssl + +INCLUDE[cms_uncomp]=../../include +SOURCE[cms_uncomp]=cms_uncomp.c +DEPEND[cms_uncomp]=../../libcrypto ../../libssl + +INCLUDE[cms_ver]=../../include +SOURCE[cms_ver]=cms_ver.c +DEPEND[cms_ver]=../../libcrypto ../../libssl diff --git a/demos/digest/build.info b/demos/digest/build.info new file mode 100644 index 0000000000..b9fcc4e259 --- /dev/null +++ b/demos/digest/build.info @@ -0,0 +1,20 @@ +PROGRAMS{noinst} = EVP_MD_demo \ + EVP_MD_stdin \ + EVP_MD_xof \ + BIO_f_md + +INCLUDE[EVP_MD_demo]=../../include +SOURCE[EVP_MD_demo]=EVP_MD_demo.c +DEPEND[EVP_MD_demo]=../../libcrypto + +INCLUDE[EVP_MD_stdin]=../../include +SOURCE[EVP_MD_stdin]=EVP_MD_stdin.c +DEPEND[EVP_MD_stdin]=../../libcrypto + +INCLUDE[EVP_MD_xof]=../../include +SOURCE[EVP_MD_xof]=EVP_MD_xof.c +DEPEND[EVP_MD_xof]=../../libcrypto + +INCLUDE[BIO_f_md]=../../include +SOURCE[BIO_f_md]=BIO_f_md.c +DEPEND[BIO_f_md]=../../libcrypto diff --git a/demos/encode/build.info b/demos/encode/build.info new file mode 100644 index 0000000000..73fa6f76ee --- /dev/null +++ b/demos/encode/build.info @@ -0,0 +1,17 @@ +# +# To run the demos when linked with a shared library (default) ensure +# that libcrypto is on the library path. For example: +# +# LD_LIBRARY_PATH=../.. ./rsa_encode + +PROGRAMS{noinst} = ec_encode \ + rsa_encode + +INCLUDE[ec_encode]=../../include +SOURCE[ec_encode]=ec_encode.c +DEPEND[ec_encode]=../../libcrypto + +INCLUDE[rsa_encode]=../../include +SOURCE[rsa_encode]=rsa_encode.c +DEPEND[rsa_encode]=../../libcrypto + diff --git a/demos/encrypt/build.info b/demos/encrypt/build.info new file mode 100644 index 0000000000..cfe0f9bcba --- /dev/null +++ b/demos/encrypt/build.info @@ -0,0 +1,11 @@ +# +# To run the demos when linked with a shared library (default) ensure +# that libcrypto is on the library path. For example: +# +# LD_LIBRARY_PATH=../.. ./rsa_encrypt + +PROGRAMS{noinst} = rsa_encrypt + +INCLUDE[rsa_encrypt]=../../include +SOURCE[rsa_encrypt]=rsa_encrypt.c +DEPEND[rsa_encrypt]=../../libcrypto diff --git a/demos/guide/build.info b/demos/guide/build.info new file mode 100644 index 0000000000..21b2e358c2 --- /dev/null +++ b/demos/guide/build.info @@ -0,0 +1,31 @@ +# +# To run the demos when linked with a shared library (default) ensure that +# libcrypto and libssl are on the library path. For example: +# +# LD_LIBRARY_PATH=../.. ./tls-client-block www.example.com 443 + +PROGRAMS{noinst} = tls-client-block \ + quic-client-block \ + quic-multi-stream \ + tls-client-non-block \ + quic-client-non-block + +INCLUDE[tls-client-block]=../../include +SOURCE[tls-client-block]=tls-client-block.c +DEPEND[tls-client-block]=../../libcrypto ../../libssl + +INCLUDE[quic-client-block]=../../include +SOURCE[quic-client-block]=quic-client-block.c +DEPEND[quic-client-block]=../../libcrypto ../../libssl + +INCLUDE[quic-multi-stream]=../../include +SOURCE[quic-multi-stream]=quic-multi-stream.c +DEPEND[quic-multi-stream]=../../libcrypto ../../libssl + +INCLUDE[tls-client-non-block]=../../include +SOURCE[tls-client-non-block]=tls-client-non-block.c +DEPEND[tls-client-non-block]=../../libcrypto ../../libssl + +INCLUDE[quic-client-non-block]=../../include +SOURCE[quic-client-non-block]=quic-client-non-block.c +DEPEND[quic-client-non-block]=../../libcrypto ../../libssl diff --git a/demos/http3/build.info b/demos/http3/build.info new file mode 100644 index 0000000000..99a3e3f1a6 --- /dev/null +++ b/demos/http3/build.info @@ -0,0 +1,16 @@ +# +# To run the demo when linked with a shared library (default) ensure that +# libcrypto and libssl are on the library path. For example: +# +# LD_LIBRARY_PATH=../.. ./ossl-nghttp3-demo www.example.com:443 + + +PROGRAMS{noinst} = ossl-nghttp3-demo + +GENERATE[libnghttp3.so libnghttp3.a libnghttp3.dylib libnghttp3.lib libnghttp3.dll]=gen_nghttp3.pl +DEPEND[ossl-nghttp3-demo.o]=libnghttp3.so libnghttp3.a libnghttp3.dylib libnghttp3.lib libnghttp3.dll +DEPEND[ossl-nghttp3.o]=libnghttp3.so libnghttp3.a libnghttp3.dylib libnghttp3.lib libnghttp3.dll +INCLUDE[ossl-nghttp3-demo]=../../include nghttp3/lib/includes nghttp3/build/lib/includes +INCLUDE[ossl-nghttp3]=../../include nghttp3/lib/includes nghttp3/build/lib/includes +SOURCE[ossl-nghttp3-demo]=ossl-nghttp3.c ossl-nghttp3-demo.c +DEPEND[ossl-nghttp3-demo]=../../libcrypto ../../libssl ./libnghttp3 diff --git a/demos/http3/gen_nghttp3.pl b/demos/http3/gen_nghttp3.pl new file mode 100755 index 0000000000..55fd8b76f3 --- /dev/null +++ b/demos/http3/gen_nghttp3.pl @@ -0,0 +1,37 @@ +#!/usr/bin/env perl +# + +use File::Copy; +use File::Path; +use Fcntl ':flock'; +use strict; +use warnings; + +#open STDOUT, '>&STDERR'; + +chdir "demos/http3"; +open(my $fh, '>>', './build.info') or die "Could not open build.info - $!"; +flock($fh, LOCK_EX) or die "Could not lock build.info - $!"; + +if (-d "./nghttp3") { + rmtree("./nghttp3") or die "Cannot remove nghttp3: $!"; +} +system("git clone https://github.com/ngtcp2/nghttp3.git"); + +chdir "nghttp3"; +mkdir "build"; +system("git submodule init ./lib/sfparse ./tests/munit"); +system("git submodule update"); +system("cmake -DENABLE_LIB_ONLY=1 -S . -B build"); +system("cmake --build build"); + +my $libs="./build/lib/libnghttp*"; + +for my $file (glob $libs) { + copy($file, ".."); +} + +chdir "../../.."; +close($fh); + +exit(0); diff --git a/demos/http3/ossl-nghttp3-demo.c b/demos/http3/ossl-nghttp3-demo.c index b1cbd1abf9..e74dc565a2 100644 --- a/demos/http3/ossl-nghttp3-demo.c +++ b/demos/http3/ossl-nghttp3-demo.c @@ -53,12 +53,12 @@ static int on_recv_data(nghttp3_conn *h3conn, int64_t stream_id, const uint8_t *data, size_t datalen, void *conn_user_data, void *stream_user_data) { - ssize_t wr; + size_t wr; /* HTTP response body data - write it to stdout. */ while (datalen > 0) { wr = fwrite(data, 1, datalen, stdout); - if (wr < 0) + if (ferror(stdout)) return 1; data += wr; diff --git a/demos/kdf/build.info b/demos/kdf/build.info new file mode 100644 index 0000000000..e5c60a7e54 --- /dev/null +++ b/demos/kdf/build.info @@ -0,0 +1,26 @@ +# +# To run the demos when linked with a shared library (default) ensure that +# libcrypto is on the library path. For example: +# +# LD_LIBRARY_PATH=../.. ./hkdf + +PROGRAMS{noinst} = hkdf \ + pbkdf2 \ + scrypt \ + argon2 + +INCLUDE[hkdf]=../../include +SOURCE[hkdf]=hkdf.c +DEPEND[hkdf]=../../libcrypto + +INCLUDE[pbkdf2]=../../include +SOURCE[pbkdf2]=pbkdf2.c +DEPEND[pbkdf2]=../../libcrypto + +INCLUDE[scrypt]=../../include +SOURCE[scrypt]=scrypt.c +DEPEND[scrypt]=../../libcrypto + +INCLUDE[argon2]=../../include +SOURCE[argon2]=argon2.c +DEPEND[argon2]=../../libcrypto diff --git a/demos/keyexch/build.info b/demos/keyexch/build.info new file mode 100644 index 0000000000..a029baa08a --- /dev/null +++ b/demos/keyexch/build.info @@ -0,0 +1,11 @@ +# +# To run the demos when linked with a shared library (default) ensure +# that libcrypto is on the library path. For example: +# +# LD_LIBRARY_PATH=../.. ./x25519 + +PROGRAMS{noinst} = x25519 + +INCLUDE[x25519]=../../include +SOURCE[x25519]=x25519.c +DEPEND[x25519]=../../libcrypto diff --git a/demos/mac/build.info b/demos/mac/build.info new file mode 100644 index 0000000000..be8599dc41 --- /dev/null +++ b/demos/mac/build.info @@ -0,0 +1,26 @@ +# +# To run the demos when linked with a shared library (default) ensure +# that libcrypto is on the library path. For example: +# +# LD_LIBRARY_PATH=../.. ./gmac + +PROGRAMS{noinst} = gmac \ + hmac-sha512 \ + cmac-aes256 \ + poly1305 + +INCLUDE[gmac]=../../include +SOURCE[gmac]=gmac.c +DEPEND[gmac]=../../libcrypto + +INCLUDE[hmac-sha512]=../../include +SOURCE[hmac-sha512]=hmac-sha512.c +DEPEND[hmac-sha512]=../../libcrypto + +INCLUDE[cmac-aes256]=../../include +SOURCE[cmac-aes256]=cmac-aes256.c +DEPEND[cmac-aes256]=../../libcrypto + +INCLUDE[poly1305]=../../include +SOURCE[poly1305]=poly1305.c +DEPEND[poly1305]=../../libcrypto diff --git a/demos/pkey/build.info b/demos/pkey/build.info new file mode 100644 index 0000000000..b24d9a9dee --- /dev/null +++ b/demos/pkey/build.info @@ -0,0 +1,36 @@ +# +# To run the demos when linked with a shared library (default) ensure that +# libcrypto is on the library path. For example: +# +# LD_LIBRARY_PATH=../.. ./EVP_PKEY_EC_keygen + +PROGRAMS{noinst} = EVP_PKEY_EC_keygen \ + EVP_PKEY_RSA_keygen \ + EVP_PKEY_DSA_keygen \ + EVP_PKEY_DSA_paramgen \ + EVP_PKEY_DSA_paramvalidate \ + EVP_PKEY_DSA_paramfromdata + +INCLUDE[EVP_PKEY_EC_keygen]=../../include +SOURCE[EVP_PKEY_EC_keygen]=EVP_PKEY_EC_keygen.c +DEPEND[EVP_PKEY_EC_keygen]=../../libcrypto + +INCLUDE[EVP_PKEY_RSA_keygen]=../../include +SOURCE[EVP_PKEY_RSA_keygen]=EVP_PKEY_RSA_keygen.c +DEPEND[EVP_PKEY_RSA_keygen]=../../libcrypto + +INCLUDE[EVP_PKEY_DSA_keygen]=../../include +SOURCE[EVP_PKEY_DSA_keygen]=EVP_PKEY_DSA_keygen.c +DEPEND[EVP_PKEY_DSA_keygen]=../../libcrypto + +INCLUDE[EVP_PKEY_DSA_paramgen]=../../include +SOURCE[EVP_PKEY_DSA_paramgen]=EVP_PKEY_DSA_paramgen.c +DEPEND[EVP_PKEY_DSA_paramgen]=../../libcrypto + +INCLUDE[EVP_PKEY_DSA_paramvalidate]=../../include +SOURCE[EVP_PKEY_DSA_paramvalidate]=EVP_PKEY_DSA_paramvalidate.c +DEPEND[EVP_PKEY_DSA_paramvalidate]=../../libcrypto + +INCLUDE[EVP_PKEY_DSA_paramfromdata]=../../include +SOURCE[EVP_PKEY_DSA_paramfromdata]=EVP_PKEY_DSA_paramfromdata.c +DEPEND[EVP_PKEY_DSA_paramfromdata]=../../libcrypto diff --git a/demos/signature/build.info b/demos/signature/build.info new file mode 100644 index 0000000000..1a72d52e2b --- /dev/null +++ b/demos/signature/build.info @@ -0,0 +1,31 @@ +# +# To run the demos when linked with a shared library (default) ensure +# that libcrypto is on the library path. For example: +# +# LD_LIBRARY_PATH=../.. ./EVP_EC_Signature_demo + +PROGRAMS{noinst} = EVP_EC_Signature_demo \ + EVP_DSA_Signature_demo \ + EVP_ED_Signature_demo \ + rsa_pss_direct \ + rsa_pss_hash + +INCLUDE[EVP_EC_Signature_demo]=../../include +SOURCE[EVP_EC_Signature_demo]=EVP_EC_Signature_demo.c +DEPEND[EVP_EC_Signature_demo]=../../libcrypto + +INCLUDE[EVP_DSA_Signature_demo]=../../include +SOURCE[EVP_DSA_Signature_demo]=EVP_DSA_Signature_demo.c +DEPEND[EVP_DSA_Signature_demo]=../../libcrypto + +INCLUDE[EVP_ED_Signature_demo]=../../include +SOURCE[EVP_ED_Signature_demo]=EVP_ED_Signature_demo.c +DEPEND[EVP_ED_Signature_demo]=../../libcrypto + +INCLUDE[rsa_pss_direct]=../../include +SOURCE[rsa_pss_direct]=rsa_pss_direct.c +DEPEND[rsa_pss_direct]=../../libcrypto + +INCLUDE[rsa_pss_hash]=../../include +SOURCE[rsa_pss_hash]=rsa_pss_hash.c +DEPEND[rsa_pss_hash]=../../libcrypto diff --git a/demos/smime/build.info b/demos/smime/build.info new file mode 100644 index 0000000000..4ef10b2fa2 --- /dev/null +++ b/demos/smime/build.info @@ -0,0 +1,32 @@ +# +# To run the demos when linked with a shared library (default) ensure that +# libcrypto is on the library path. For example, to run the +# sm_enc demo: +# +# LD_LIBRARY_PATH=../.. ./sms_enc + +PROGRAMS{noinst} = smenc \ + smdec \ + smsign \ + smsign2 \ + smver + +INCLUDE[smenc]=../../include +SOURCE[smenc]=smenc.c +DEPEND[smenc]=../../libcrypto + +INCLUDE[smdec]=../../include +SOURCE[smdec]=smdec.c +DEPEND[smdec]=../../libcrypto + +INCLUDE[smsign]=../../include +SOURCE[smsign]=smsign.c +DEPEND[smsign]=../../libcrypto + +INCLUDE[smsign2]=../../include +SOURCE[smsign2]=smsign2.c +DEPEND[smsign2]=../../libcrypto + +INCLUDE[smver]=../../include +SOURCE[smver]=smver.c +DEPEND[smver]=../../libcrypto diff --git a/demos/sslecho/build.info b/demos/sslecho/build.info new file mode 100644 index 0000000000..d42716cd51 --- /dev/null +++ b/demos/sslecho/build.info @@ -0,0 +1,11 @@ +# +# To run the demos when linked with a shared library (default) ensure that +# libcrypto and libssl are on the library path. For example: +# +# LD_LIBRARY_PATH=../.. ./sslecho + +PROGRAMS{noinst} = sslecho + +INCLUDE[sslecho]=../../include +SOURCE[sslecho]=main.c +DEPEND[sslecho]=../../libcrypto ../../libssl -- cgit v1.2.3