Convert demos to primary build system

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/24047)
This commit is contained in:
Neil Horman 2024-04-05 16:19:01 -04:00
parent 875db35ac6
commit 2000281dad
19 changed files with 421 additions and 3 deletions

View File

@ -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

29
demos/bio/build.info Normal file
View File

@ -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

22
demos/build.info Normal file
View File

@ -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

17
demos/cipher/build.info Normal file
View File

@ -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

45
demos/cms/build.info Normal file
View File

@ -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

20
demos/digest/build.info Normal file
View File

@ -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

17
demos/encode/build.info Normal file
View File

@ -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

11
demos/encrypt/build.info Normal file
View File

@ -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

31
demos/guide/build.info Normal file
View File

@ -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

16
demos/http3/build.info Normal file
View File

@ -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

37
demos/http3/gen_nghttp3.pl Executable file
View File

@ -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);

View File

@ -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;

26
demos/kdf/build.info Normal file
View File

@ -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

11
demos/keyexch/build.info Normal file
View File

@ -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

26
demos/mac/build.info Normal file
View File

@ -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

36
demos/pkey/build.info Normal file
View File

@ -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

View File

@ -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

32
demos/smime/build.info Normal file
View File

@ -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

11
demos/sslecho/build.info Normal file
View File

@ -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