]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Convert demos to primary build system
authorNeil Horman <nhorman@openssl.org>
Fri, 5 Apr 2024 20:19:01 +0000 (16:19 -0400)
committerNeil Horman <nhorman@openssl.org>
Fri, 12 Apr 2024 12:02:19 +0000 (08:02 -0400)
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)

19 files changed:
build.info
demos/bio/build.info [new file with mode: 0644]
demos/build.info [new file with mode: 0644]
demos/cipher/build.info [new file with mode: 0644]
demos/cms/build.info [new file with mode: 0644]
demos/digest/build.info [new file with mode: 0644]
demos/encode/build.info [new file with mode: 0644]
demos/encrypt/build.info [new file with mode: 0644]
demos/guide/build.info [new file with mode: 0644]
demos/http3/build.info [new file with mode: 0644]
demos/http3/gen_nghttp3.pl [new file with mode: 0755]
demos/http3/ossl-nghttp3-demo.c
demos/kdf/build.info [new file with mode: 0644]
demos/keyexch/build.info [new file with mode: 0644]
demos/mac/build.info [new file with mode: 0644]
demos/pkey/build.info [new file with mode: 0644]
demos/signature/build.info [new file with mode: 0644]
demos/smime/build.info [new file with mode: 0644]
demos/sslecho/build.info [new file with mode: 0644]

index 790f2421e55d5da903a0c8bb7c2e6dbf5d70b981..ad780336d4619ca92f9a706e15537691ae0877c7 100644 (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
diff --git a/demos/bio/build.info b/demos/bio/build.info
new file mode 100644 (file)
index 0000000..e5bf772
--- /dev/null
@@ -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 (file)
index 0000000..4948465
--- /dev/null
@@ -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 (file)
index 0000000..4c74cc9
--- /dev/null
@@ -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 (file)
index 0000000..43a4bb6
--- /dev/null
@@ -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 (file)
index 0000000..b9fcc4e
--- /dev/null
@@ -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 (file)
index 0000000..73fa6f7
--- /dev/null
@@ -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 (file)
index 0000000..cfe0f9b
--- /dev/null
@@ -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 (file)
index 0000000..21b2e35
--- /dev/null
@@ -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 (file)
index 0000000..99a3e3f
--- /dev/null
@@ -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 (executable)
index 0000000..55fd8b7
--- /dev/null
@@ -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);
index b1cbd1abf9d250b88aab218d1515547f11501c62..e74dc565a2e23b6dfd2388e3e2e9d05373c6bcf1 100644 (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;
diff --git a/demos/kdf/build.info b/demos/kdf/build.info
new file mode 100644 (file)
index 0000000..e5c60a7
--- /dev/null
@@ -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 (file)
index 0000000..a029baa
--- /dev/null
@@ -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 (file)
index 0000000..be8599d
--- /dev/null
@@ -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 (file)
index 0000000..b24d9a9
--- /dev/null
@@ -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 (file)
index 0000000..1a72d52
--- /dev/null
@@ -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 (file)
index 0000000..4ef10b2
--- /dev/null
@@ -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 (file)
index 0000000..d42716c
--- /dev/null
@@ -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