summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorJames Muir <james@openssl.org>2023-10-23 21:00:41 -0400
committerMatt Caswell <matt@openssl.org>2023-10-25 09:44:32 +0100
commit59d8a338edca98e5bb077a2a364d82e53e7cce77 (patch)
tree482210bea70c56d1740f92ee39d23b404360bd3b /demos
parent687326ce0ac56c405029cfedd435b2e6625a22e3 (diff)
quic: documentation and demo nits
The code for the quic demos (from the openssl guide) is presented as modifications of tls-client-block.c. Make it so that the quic code better matches the tls code (drop unneeded assignments to "ret", use the same comment on SSL_connect(), add the same printf() statement). Also fix some minor typos. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22483)
Diffstat (limited to 'demos')
-rw-r--r--demos/guide/quic-client-block.c5
-rw-r--r--demos/guide/quic-multi-stream.c9
-rw-r--r--demos/guide/tls-client-block.c2
3 files changed, 9 insertions, 7 deletions
diff --git a/demos/guide/quic-client-block.c b/demos/guide/quic-client-block.c
index e6cabfef26..65822fe8c4 100644
--- a/demos/guide/quic-client-block.c
+++ b/demos/guide/quic-client-block.c
@@ -210,8 +210,9 @@ int main(void)
goto end;
}
- /* Connect to the server and perform the TLS handshake */
- if ((ret = SSL_connect(ssl)) < 1) {
+ /* Do the handshake with the server */
+ if (SSL_connect(ssl) < 1) {
+ printf("Failed to connect to the server\n");
/*
* If the failure is due to a verification error we can get more
* information about it from SSL_get_verify_result().
diff --git a/demos/guide/quic-multi-stream.c b/demos/guide/quic-multi-stream.c
index 56db5a98a8..44ee36e0ad 100644
--- a/demos/guide/quic-multi-stream.c
+++ b/demos/guide/quic-multi-stream.c
@@ -47,7 +47,7 @@ static BIO *create_socket_bio(const char *hostname, const char *port,
*/
for (ai = res; ai != NULL; ai = BIO_ADDRINFO_next(ai)) {
/*
- * Create a TCP socket. We could equally use non-OpenSSL calls such
+ * Create a UDP socket. We could equally use non-OpenSSL calls such
* as "socket" here for this and the subsequent connect and close
* functions. But for portability reasons and also so that we get
* errors on the OpenSSL stack in the event of a failure we use
@@ -82,7 +82,6 @@ static BIO *create_socket_bio(const char *hostname, const char *port,
}
}
-
/* Free the address information resources we allocated earlier */
BIO_ADDRINFO_free(res);
@@ -96,6 +95,7 @@ static BIO *create_socket_bio(const char *hostname, const char *port,
BIO_closesocket(sock);
return NULL;
}
+
/*
* Associate the newly created BIO with the underlying socket. By
* passing BIO_CLOSE here the socket will be automatically closed when
@@ -222,8 +222,9 @@ int main(void)
goto end;
}
- /* Connect to the server and perform the TLS handshake */
- if ((ret = SSL_connect(ssl)) < 1) {
+ /* Do the handshake with the server */
+ if (SSL_connect(ssl) < 1) {
+ printf("Failed to connect to the server\n");
/*
* If the failure is due to a verification error we can get more
* information about it from SSL_get_verify_result().
diff --git a/demos/guide/tls-client-block.c b/demos/guide/tls-client-block.c
index 75ce7ebcc2..576fc7b325 100644
--- a/demos/guide/tls-client-block.c
+++ b/demos/guide/tls-client-block.c
@@ -74,7 +74,7 @@ static BIO *create_socket_bio(const char *hostname, const char *port)
if (sock == -1)
return NULL;
- /* Create a BIO to wrap the socket*/
+ /* Create a BIO to wrap the socket */
bio = BIO_new(BIO_s_socket());
if (bio == NULL) {
BIO_closesocket(sock);