aboutsummaryrefslogtreecommitdiff
path: root/crypto/openssl/demos
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/openssl/demos')
-rw-r--r--crypto/openssl/demos/bio/saccept.c7
-rw-r--r--crypto/openssl/demos/bio/server-arg.c7
-rw-r--r--crypto/openssl/demos/bio/server-cmod.c7
-rw-r--r--crypto/openssl/demos/bio/server-conf.c7
-rw-r--r--crypto/openssl/demos/certs/mkcerts.sh2
-rw-r--r--crypto/openssl/demos/certs/ocspquery.sh2
-rw-r--r--crypto/openssl/demos/certs/ocsprun.sh4
-rw-r--r--crypto/openssl/demos/cms/cms_ddec.c4
-rw-r--r--crypto/openssl/demos/cms/cms_denc.c4
-rw-r--r--crypto/openssl/demos/pkey/EVP_PKEY_RSA_keygen.c4
10 files changed, 30 insertions, 18 deletions
diff --git a/crypto/openssl/demos/bio/saccept.c b/crypto/openssl/demos/bio/saccept.c
index 604051cda966..b0c930d6ce00 100644
--- a/crypto/openssl/demos/bio/saccept.c
+++ b/crypto/openssl/demos/bio/saccept.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1998-2024 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1998-2025 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -53,7 +53,8 @@ int main(int argc, char *argv[])
{
char *port = NULL;
BIO *in = NULL;
- BIO *ssl_bio, *tmp;
+ BIO *ssl_bio = NULL;
+ BIO *tmp;
SSL_CTX *ctx;
char buf[512];
int ret = EXIT_FAILURE, i;
@@ -83,6 +84,7 @@ int main(int argc, char *argv[])
* Basically it means the SSL BIO will be automatically setup
*/
BIO_set_accept_bios(in, ssl_bio);
+ ssl_bio = NULL;
/* Arrange to leave server loop on interrupt */
sigsetup();
@@ -121,5 +123,6 @@ int main(int argc, char *argv[])
if (ret != EXIT_SUCCESS)
ERR_print_errors_fp(stderr);
BIO_free(in);
+ BIO_free_all(ssl_bio);
return ret;
}
diff --git a/crypto/openssl/demos/bio/server-arg.c b/crypto/openssl/demos/bio/server-arg.c
index 60a87725a9de..ccf59b14056b 100644
--- a/crypto/openssl/demos/bio/server-arg.c
+++ b/crypto/openssl/demos/bio/server-arg.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2017 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2013-2025 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -23,7 +23,8 @@
int main(int argc, char *argv[])
{
char *port = "*:4433";
- BIO *ssl_bio, *tmp;
+ BIO *ssl_bio = NULL;
+ BIO *tmp;
SSL_CTX *ctx;
SSL_CONF_CTX *cctx;
char buf[512];
@@ -105,6 +106,7 @@ int main(int argc, char *argv[])
* Basically it means the SSL BIO will be automatically setup
*/
BIO_set_accept_bios(in, ssl_bio);
+ ssl_bio = NULL;
again:
/*
@@ -140,5 +142,6 @@ int main(int argc, char *argv[])
if (ret != EXIT_SUCCESS)
ERR_print_errors_fp(stderr);
BIO_free(in);
+ BIO_free_all(ssl_bio);
return ret;
}
diff --git a/crypto/openssl/demos/bio/server-cmod.c b/crypto/openssl/demos/bio/server-cmod.c
index 3642fbacf6ce..4970a6b6466b 100644
--- a/crypto/openssl/demos/bio/server-cmod.c
+++ b/crypto/openssl/demos/bio/server-cmod.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2017 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2015-2025 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -24,7 +24,8 @@ int main(int argc, char *argv[])
unsigned char buf[512];
char *port = "*:4433";
BIO *in = NULL;
- BIO *ssl_bio, *tmp;
+ BIO *ssl_bio = NULL;
+ BIO *tmp;
SSL_CTX *ctx;
int ret = EXIT_FAILURE, i;
@@ -52,6 +53,7 @@ int main(int argc, char *argv[])
* Basically it means the SSL BIO will be automatically setup
*/
BIO_set_accept_bios(in, ssl_bio);
+ ssl_bio = NULL;
again:
/*
@@ -90,5 +92,6 @@ int main(int argc, char *argv[])
if (ret != EXIT_SUCCESS)
ERR_print_errors_fp(stderr);
BIO_free(in);
+ BIO_free_all(ssl_bio);
return ret;
}
diff --git a/crypto/openssl/demos/bio/server-conf.c b/crypto/openssl/demos/bio/server-conf.c
index 5e07a15e7bc7..2c03d1d367cc 100644
--- a/crypto/openssl/demos/bio/server-conf.c
+++ b/crypto/openssl/demos/bio/server-conf.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2017 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2013-2025 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -25,7 +25,8 @@ int main(int argc, char *argv[])
{
char *port = "*:4433";
BIO *in = NULL;
- BIO *ssl_bio, *tmp;
+ BIO *ssl_bio = NULL;
+ BIO *tmp;
SSL_CTX *ctx;
SSL_CONF_CTX *cctx = NULL;
CONF *conf = NULL;
@@ -97,6 +98,7 @@ int main(int argc, char *argv[])
* Basically it means the SSL BIO will be automatically setup
*/
BIO_set_accept_bios(in, ssl_bio);
+ ssl_bio = NULL;
again:
/*
@@ -135,5 +137,6 @@ int main(int argc, char *argv[])
if (ret != EXIT_SUCCESS)
ERR_print_errors_fp(stderr);
BIO_free(in);
+ BIO_free_all(ssl_bio);
return ret;
}
diff --git a/crypto/openssl/demos/certs/mkcerts.sh b/crypto/openssl/demos/certs/mkcerts.sh
index 1825607fa33c..89300a6c52c5 100644
--- a/crypto/openssl/demos/certs/mkcerts.sh
+++ b/crypto/openssl/demos/certs/mkcerts.sh
@@ -1,7 +1,7 @@
#!/bin/sh
opensslcmd() {
- LD_LIBRARY_PATH=../.. ../../apps/openssl $@
+ LD_LIBRARY_PATH=../.. ../../apps/openssl "$@"
}
OPENSSL_CONF=../../apps/openssl.cnf
diff --git a/crypto/openssl/demos/certs/ocspquery.sh b/crypto/openssl/demos/certs/ocspquery.sh
index 7cb8e76423bb..b38e10ce2ef5 100644
--- a/crypto/openssl/demos/certs/ocspquery.sh
+++ b/crypto/openssl/demos/certs/ocspquery.sh
@@ -4,7 +4,7 @@
# called.
opensslcmd() {
- LD_LIBRARY_PATH=../.. ../../apps/openssl $@
+ LD_LIBRARY_PATH=../.. ../../apps/openssl "$@"
}
OPENSSL_CONF=../../apps/openssl.cnf
diff --git a/crypto/openssl/demos/certs/ocsprun.sh b/crypto/openssl/demos/certs/ocsprun.sh
index 77fd62fcf1bb..b2e927cd84da 100644
--- a/crypto/openssl/demos/certs/ocsprun.sh
+++ b/crypto/openssl/demos/certs/ocsprun.sh
@@ -1,7 +1,7 @@
#!/bin/sh
opensslcmd() {
- LD_LIBRARY_PATH=../.. ../../apps/openssl $@
+ LD_LIBRARY_PATH=../.. ../../apps/openssl "$@"
}
# Example of running an querying OpenSSL test OCSP responder.
@@ -18,4 +18,4 @@ opensslcmd version
PORT=8888
opensslcmd ocsp -port $PORT -index index.txt -CA intca.pem \
- -rsigner resp.pem -rkey respkey.pem -rother intca.pem $*
+ -rsigner resp.pem -rkey respkey.pem -rother intca.pem "$@"
diff --git a/crypto/openssl/demos/cms/cms_ddec.c b/crypto/openssl/demos/cms/cms_ddec.c
index d119e9722226..dd8ef90b6e3f 100644
--- a/crypto/openssl/demos/cms/cms_ddec.c
+++ b/crypto/openssl/demos/cms/cms_ddec.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008-2023 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2008-2025 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -58,7 +58,7 @@ int main(int argc, char **argv)
/* Open file containing detached content */
dcont = BIO_new_file("smencr.out", "rb");
- if (!in)
+ if (dcont == NULL)
goto err;
out = BIO_new_file("encrout.txt", "w");
diff --git a/crypto/openssl/demos/cms/cms_denc.c b/crypto/openssl/demos/cms/cms_denc.c
index 53b680f67484..e451a108fd46 100644
--- a/crypto/openssl/demos/cms/cms_denc.c
+++ b/crypto/openssl/demos/cms/cms_denc.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008-2023 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2008-2025 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -57,7 +57,7 @@ int main(int argc, char **argv)
dout = BIO_new_file("smencr.out", "wb");
- if (!in)
+ if (in == NULL || dout == NULL)
goto err;
/* encrypt content */
diff --git a/crypto/openssl/demos/pkey/EVP_PKEY_RSA_keygen.c b/crypto/openssl/demos/pkey/EVP_PKEY_RSA_keygen.c
index 62dd8405e77b..a889ab6f77d4 100644
--- a/crypto/openssl/demos/pkey/EVP_PKEY_RSA_keygen.c
+++ b/crypto/openssl/demos/pkey/EVP_PKEY_RSA_keygen.c
@@ -1,5 +1,5 @@
/*-
- * Copyright 2022-2023 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2022-2025 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -254,7 +254,7 @@ int main(int argc, char **argv)
if (argc > 1) {
bits_i = atoi(argv[1]);
- if (bits < 512) {
+ if (bits_i < 512) {
fprintf(stderr, "Invalid RSA key size\n");
return EXIT_FAILURE;
}