aboutsummaryrefslogtreecommitdiff
path: root/demos
AgeCommit message (Collapse)AuthorFilesLines
11 daysMVP demo TLS serverViktor Dukhovni2-2/+294
- No concurrency, one client-at-a-time - Blocking - No client certs - Fixed chain and key file names - Minimal support for session resumption Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Todd Short <todd.short@me.com> (Merged from https://github.com/openssl/openssl/pull/24505)
2024-05-22signal.h included two timesPiotrBzdrega1-1/+0
CLA: trivial Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <ppzgs1@gmail.com> (Merged from https://github.com/openssl/openssl/pull/24445)
2024-04-12Augment README.md in top level to indicate Makefile presenceNeil Horman1-0/+4
Note that they are available but only meant as a guide to self building, and are not used expressly to build as part of the overall openssl build 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)
2024-04-12disable http3 demo on windowsNeil Horman1-2/+4
The external nghttp3 library seems to have a linking issue on windows (several missing symbols). Disable that build in windows for now until its fixed 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)
2024-04-12make addr_len the right sign in sslechoNeil Horman1-0/+4
cygwin caught a signedness difference in this pointer. 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)
2024-04-12Replace getline with fgets in sslecho demoNeil Horman1-10/+9
Windows doesn't support getline, so we need to use fgets here 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)
2024-04-12dont include unistd.h on windows for sslechoNeil Horman1-4/+11
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)
2024-04-12Don't include unistd.h in sconnect for windowsNeil Horman1-1/+6
The platform doesn't support it 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)
2024-04-12Fix signal handling in saccept for windowsNeil Horman1-0/+4
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)
2024-04-12Fix warnings found by clang in CINeil Horman9-16/+16
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)
2024-04-12fix all the warnings in our demos and make them enableableNeil Horman13-31/+41
Fix up the warnings in the demos and make them configurable with enable-demos 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)
2024-04-12Convert demos to primary build systemNeil Horman18-2/+420
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)
2024-04-09Add demo for ECDH key exchangeslontis3-2/+227
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22916)
2024-04-09Copyright year updatesMatt Caswell4-4/+4
Reviewed-by: Neil Horman <nhorman@openssl.org> Release: yes (cherry picked from commit 3764f200f9d44622faa8ac1b15d2f3eb7c39e473) Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/24034)
2024-04-09Copyright year updatesRichard Levitte1-1/+1
Reviewed-by: Neil Horman <nhorman@openssl.org> Release: yes (cherry picked from commit 0ce7d1f355c1240653e320a3f6f8109c1f05f8c0) Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/24034)
2024-03-25Replace size_t with int and add the check for the EVP_MD_get_size()Jiasheng Jiang1-1/+6
Replace the type of "digest_size" with int to avoid implicit conversion when it is assigned by EVP_MD_get_size(). Moreover, add the check for the "digest_size". Fixes: 29ce1066bc ("Update the demos/README file because it is really old. New demos should provide best practice for API use. Add demonstration for computing a SHA3-512 digest - digest/EVP_MD_demo") Signed-off-by: Jiasheng Jiang <jiasheng@purdue.edu> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23924)
2024-03-25Replace unsigned with intJiasheng Jiang2-2/+2
Replace the type of "digest_length" with int to avoid implicit conversion when it is assigned by EVP_MD_get_size(). Otherwise, it may pass the following check and cause the integer overflow error when EVP_MD_get_size() returns negative numbers. Signed-off-by: Jiasheng Jiang <jiasheng@purdue.edu> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23922)
2024-03-25fix demos/sslecho/main.c so it builds on OpenBSD toosashan1-0/+1
trying to build `demos/sslecho/main.c` shipped by current openssl fails with error as follows: ``` cc -I../../include -g -Wall -c -o main.o main.c main.c:35:24: error: variable has incomplete type 'struct sockaddr_in' struct sockaddr_in addr; ^ main.c:35:12: note: forward declaration of 'struct sockaddr_in' struct sockaddr_in addr; ^ main.c:46:32: error: use of undeclared identifier 'INADDR_ANY' addr.sin_addr.s_addr = INADDR_ANY; ^ main.c:152:24: error: variable has incomplete type 'struct sockaddr_in' struct sockaddr_in addr; ^ main.c:152:12: note: forward declaration of 'struct sockaddr_in' struct sockaddr_in addr; ^ 3 errors generated. gmake: *** [<builtin>: main.o] Error 1 ``` including `netinet/in.h` fixes the build Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23936)
2024-03-01demos/http3: Use `SSL_write_ex2()` together with `SSL_WRITE_FLAG_CONCLUDE`Alexandr Nedvedicky2-8/+10
These calls were introduced by PR #23343. Change also does a minor tweak to Makefile so CFLAGS and LDFLAGS variables from the environment are respected. Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23602)
2023-12-29demos: fix cert scriptsJames Muir5-55/+84
set LD_LIBRARY_PATH so the correct libs can be found. Testing: cd demos/certs && sh mkcerts.sh cd demos/certs/apps && sh -x mkacerts.sh Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Paul Yang <kaishen.yy@antfin.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23142)
2023-11-21augment quic demos to support ipv4/6 connectionsNeil Horman5-35/+87
Because the quicserver utility supports expressly listening in ipv4/6 mode, its possible/likely that the server will listen on an ipv4 address, while the clients will connect via ipv6, leading to connection failures. Augment quic demo clients to afford them the same -6 option that the server has so that connection family can be co-ordinated Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com> Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22577)
2023-11-15demos: tidy up makefiles, fix warningsJames Muir37-202/+314
Update makefiles so that consistent patterns are used. Object files are compiled from source using an implicit rule (but using our CFLAGS); for linking, we give an explicit rule. Ensure that "make test" works in each subdirectory (even if it does not actually run any applications). The top-level demo makefile now works. The makefiles are not make-agnostic. e.g. they use the variable $(RM) in "clean" recipes, which is defined in gnu-make but may not be defined in others. Part of #17806 Testing: $ cd demo $ make test Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22698)
2023-11-10cms demos: print signingTime attributesJames Muir5-1/+88
Add a makefile for the cms demos, and add a routine to cms_ver.c to print any signingTime attributes from the CMS_ContentInfo object. This provides an example that could be extended if an application wants to examine the purported signing times. Part of #8026 Testing: $ cd demos/cms $ make test Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22618)
2023-11-08quic http3 demo: minor updatesJames Muir2-5/+12
-update run command to include LD_LIBRARY_PATH -suggest installing libnghttp3-dev on Ubuntu -drop "-f" from clean recipe (it is already included in $(RM)) Part of https://github.com/openssl/project/issues/253 Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22623)
2023-11-02Update the README with information about how to run the QUIC demosMatt Caswell1-0/+28
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22552)
2023-11-02Update the QUIC demos to accept hostname/port on the command lineMatt Caswell3-51/+90
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22552)
2023-11-02Extend the README to describe how to run the TLS demosMatt Caswell5-1/+128
We also supply some test certificates for use with the demos. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22552)
2023-11-02Amend the TLS demos to accept hostname/port as an argumentMatt Caswell2-32/+54
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22552)
2023-10-30Add a separate README for the guide demosMatt Caswell1-0/+15
Point users at the actual guide, and also explain about LD_LIBRARY_PATH Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22505)
2023-10-30Update to the demos README fileMatt Caswell1-10/+25
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22505)
2023-10-25quic: documentation and demo nitsJames Muir3-7/+9
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)
2023-10-25Create hierarchical demo Makefile.slontis12-27/+136
Adds a Makefile with all, clean, and test targets. This has only been added for demos that already contain Makefiles. For problematic tests that require inputs, the test target does nothing. (Note: Demos should be self contained and not require unknown external inputs. This PR does not attempt to fix this.) Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/20546)
2023-10-19Fix markdownHugo Landau1-1/+1
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22369)
2023-10-19Add SNIHugo Landau1-0/+4
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22369)
2023-10-19RenameHugo Landau3-120/+139
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22369)
2023-10-19Add link to nghttp3Hugo Landau1-1/+6
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22369)
2023-10-19Add copyright headersHugo Landau3-0/+24
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22369)
2023-10-19QUIC: Add comments to HTTP/3 demoHugo Landau2-6/+153
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22369)
2023-10-19QUIC: Add HTTP/3 demo using nghttp3Hugo Landau4-0/+855
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22369)
2023-09-11Bad function definitionDimitri Papadopoulos1-1/+1
void f() should probably be void f(void) Found by running the checkpatch.pl Linux script to enforce coding style. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21468)
2023-09-11"foo * bar" should be "foo *bar"Dimitri Papadopoulos3-4/+4
Found by running the checkpatch.pl Linux script to enforce coding style. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21468)
2023-09-08Return NULL if we fail to create a BIO in the demos/quicserverMatt Caswell5-10/+19
Strictly speaking the previous code was still correct since BIO_set_fd is tolerant of a NULL BIO. But this way is more clear. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21950)
2023-09-08Add a missing call to BIO_closesocket()Matt Caswell3-0/+3
A couple of the demos missed a call to this function in an error case. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21950)
2023-09-08Expand the explanation of how to go and do useful work in non-blockingMatt Caswell3-6/+31
Add additional commentary to the non-blocking examples explaining where to add code to go and do other useful work. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21950)
2023-09-08Add a new guide page on writing a non-blocking QUIC clientMatt Caswell1-8/+12
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21950)
2023-09-08Add a QUIC non-blocking demoMatt Caswell3-3/+394
Show how to write a QUIC client using a non-blocking socket Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21950)
2023-09-08Add a TLS non-blocking demoMatt Caswell2-2/+344
Show how to write a TLS client using a non-blocking socket Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21950)
2023-09-07Copyright year updatesMatt Caswell47-47/+47
Reviewed-by: Richard Levitte <levitte@openssl.org> Release: yes
2023-09-01Add ED25519 Signature demo.slontis3-6/+221
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21883)
2023-08-28Fix a bad merge in quic-multi-stream.c demoMatt Caswell1-1/+1
The function SSL_set_initial_peer_addr() got renamed to SSL_set1_initial_peer_addr(). The demo missed out on the rename when it got rebased on top of it. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21842)