Skip to content

Commit

Permalink
Convert demos to primary build system
Browse files Browse the repository at this point in the history
Reviewed-by: Nicola Tuveri <[email protected]>
Reviewed-by: Tim Hudson <[email protected]>
Reviewed-by: Paul Dale <[email protected]>
Reviewed-by: Tom Cosgrove <[email protected]>
(Merged from openssl#24047)
  • Loading branch information
nhorman committed Apr 12, 2024
1 parent 875db35 commit 2000281
Show file tree
Hide file tree
Showing 19 changed files with 421 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.info
Original file line number Diff line number Diff line change
@@ -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
Expand Down
29 changes: 29 additions & 0 deletions demos/bio/build.info
Original file line number Diff line number Diff line change
@@ -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 changes: 22 additions & 0 deletions demos/build.info
Original file line number Diff line number Diff line change
@@ -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 changes: 17 additions & 0 deletions demos/cipher/build.info
Original file line number Diff line number Diff line change
@@ -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 changes: 45 additions & 0 deletions demos/cms/build.info
Original file line number Diff line number Diff line change
@@ -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 changes: 20 additions & 0 deletions demos/digest/build.info
Original file line number Diff line number Diff line change
@@ -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 changes: 17 additions & 0 deletions demos/encode/build.info
Original file line number Diff line number Diff line change
@@ -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 changes: 11 additions & 0 deletions demos/encrypt/build.info
Original file line number Diff line number Diff line change
@@ -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 changes: 31 additions & 0 deletions demos/guide/build.info
Original file line number Diff line number Diff line change
@@ -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 changes: 16 additions & 0 deletions demos/http3/build.info
Original file line number Diff line number Diff line change
@@ -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 changes: 37 additions & 0 deletions demos/http3/gen_nghttp3.pl
Original file line number Diff line number Diff line change
@@ -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);
4 changes: 2 additions & 2 deletions demos/http3/ossl-nghttp3-demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
26 changes: 26 additions & 0 deletions demos/kdf/build.info
Original file line number Diff line number Diff line change
@@ -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 changes: 11 additions & 0 deletions demos/keyexch/build.info
Original file line number Diff line number Diff line change
@@ -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 changes: 26 additions & 0 deletions demos/mac/build.info
Original file line number Diff line number Diff line change
@@ -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 changes: 36 additions & 0 deletions demos/pkey/build.info
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 2000281

Please sign in to comment.