openssl/demos
Jiasheng Jiang 0117a02013 Replace size_t with int and add the check for the EVP_MD_get_size()
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)

(cherry picked from commit 87e747000f)
2024-03-25 17:52:05 +01:00
..
bio Fixup demo exit status magic numbers 2023-11-16 14:46:25 +01:00
certs Add config_diagnostics to our configuration files. 2021-08-04 08:15:14 +10:00
cipher Fixup demo exit status magic numbers 2023-11-16 14:46:25 +01:00
cms cms demos: print signingTime attributes 2023-11-16 14:46:25 +01:00
digest Replace size_t with int and add the check for the EVP_MD_get_size() 2024-03-25 17:52:05 +01:00
encode Fixup demo exit status magic numbers 2023-11-16 14:46:25 +01:00
encrypt demo: Fix makefile target 2023-03-15 13:58:20 +11:00
kdf Fixup demo exit status magic numbers 2023-11-16 14:46:25 +01:00
keyexch Fixup demo exit status magic numbers 2023-11-16 14:46:25 +01:00
mac Fixup demo exit status magic numbers 2023-11-16 14:46:25 +01:00
pkcs12 Fixup demo exit status magic numbers 2023-11-16 14:46:25 +01:00
pkey Fixup demo exit status magic numbers 2023-11-16 14:46:25 +01:00
signature Fixup demo exit status magic numbers 2023-11-16 14:46:25 +01:00
smime Fixup demo exit status magic numbers 2023-11-16 14:46:25 +01:00
sslecho fix demos/sslecho/main.c so it builds on OpenBSD too 2024-03-25 13:50:39 +01:00
README.txt Add Demos for DSA params/DSA keygen. 2022-12-22 12:09:58 +01:00

README.txt

OpenSSL Demonstration Applications

This folder contains source code that demonstrates the proper use of the OpenSSL
library API.

bio:                   Demonstration of a simple TLS client and server

certs:                 Demonstration of creating certs, using OCSP

cipher:
aesgcm.c               Demonstration of symmetric cipher GCM mode encrypt/decrypt
aesccm.c               Demonstration of symmetric cipher CCM mode encrypt/decrypt
ariacbc.c              Demonstration of symmetric cipher CBC mode encrypt/decrypt

cms:

digest:
EVP_MD_demo.c          Compute a digest from multiple buffers
EVP_MD_stdin.c         Compute a digest with data read from stdin
EVP_MD_xof.c           Compute a digest using the SHAKE256 XOF
EVP_f_md.c             Compute a digest using BIO and EVP_f_md

encrypt:
rsa_encrypt.c          Encrypt and decrypt data using an RSA keypair.

encode:
rsa_encode.c           Encode and decode PEM-encoded RSA keys

kdf:
hkdf.c                 Demonstration of HMAC based key derivation
pbkdf2.c               Demonstration of PBKDF2 password based key derivation
scrypt.c               Demonstration of SCRYPT password based key derivation

mac:
gmac.c                 Demonstration of GMAC message authentication
poly1305.c             Demonstration of Poly1305-AES message authentication
siphash.c              Demonstration of SIPHASH message authentication

pkey:
EVP_PKEY_EC_keygen.c           Generate an EC key.
EVP_PKEY_RSA_keygen.c          Generate an RSA key.
EVP_PKEY_DSA_keygen.c          Generate a DSA key.
EVP_PKEY_DSA_paramgen.c        Generate a DSA param key.
EVP_PKEY_DSA_paramvalidate.c   Validate a DSA param key.
EVP_PKEY_DSA_paramfromdata.c   Load a DSA param key using raw data.

smime:

pkcs12:
pkread.c               Print out a description of a PKCS12 file.
pkwrite.c              Add a password to an existing PKCS12 file.

signature:
EVP_Signature_demo.c   Compute and verify a signature from multiple buffers
rsa_pss_direct.c       Compute and verify an RSA-PSS signature from a hash
rsa_pss_hash.c         Compute and verify an RSA-PSS signature over a buffer

sslecho:
main.c                 Simple SSL echo client/server.