Skip to content

Commit

Permalink
ssl.c: Move functions out to separate files
Browse files Browse the repository at this point in the history
Moved E[CD][25519||448] APIs to pk.c
Move public key PEM APIs to pk.c.
Move wolfSSL loading and using of private keys and certificates to
ssl_load.c
Move PKCS#7 and PKCS#12 APIs to ssl_p7p12.c.
Move session and session cache APIs to ssl_sess.c.
Other minor fixes.
  • Loading branch information
SparkiDev committed Apr 16, 2024
1 parent 9b92aea commit 8e9810e
Show file tree
Hide file tree
Showing 29 changed files with 31,662 additions and 28,225 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,10 @@ else()
"\"${WOLFSSL_ROOT}/src/ssl_bn.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_certman.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_crypto.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_load.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_misc.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_p7p12.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_sess.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/x509.c\""
"\"${WOLFSSL_ROOT}/src/x509_str.c\""
"\"${WOLFSSL_ROOT}/wolfcrypt/src/evp.c\""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,10 @@ else()
"\"${WOLFSSL_ROOT}/src/ssl_bn.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_certman.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_crypto.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_load.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_misc.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_p7p12.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_sess.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/x509.c\""
"\"${WOLFSSL_ROOT}/src/x509_str.c\""
"\"${WOLFSSL_ROOT}/wolfcrypt/src/evp.c\""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,10 @@ else()
"\"${WOLFSSL_ROOT}/src/ssl_bn.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_certman.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_crypto.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_load.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_misc.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_p7p12.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_sess.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/x509.c\""
"\"${WOLFSSL_ROOT}/src/x509_str.c\""
"\"${WOLFSSL_ROOT}/wolfcrypt/src/evp.c\""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,10 @@ else()
"\"${WOLFSSL_ROOT}/src/ssl_bn.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_certman.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_crypto.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_load.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_misc.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_p7p12.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_sess.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/x509.c\""
"\"${WOLFSSL_ROOT}/src/x509_str.c\""
"\"${WOLFSSL_ROOT}/wolfcrypt/src/evp.c\""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,10 @@ else()
"\"${WOLFSSL_ROOT}/src/ssl_bn.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_certman.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_crypto.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_load.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_misc.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_p7p12.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/ssl_sess.c\"" # included by ssl.c
"\"${WOLFSSL_ROOT}/src/x509.c\""
"\"${WOLFSSL_ROOT}/src/x509_str.c\""
"\"${WOLFSSL_ROOT}/wolfcrypt/src/evp.c\""
Expand Down
3 changes: 3 additions & 0 deletions IDE/Espressif/ESP-IDF/libs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ set(COMPONENT_SRCEXCLUDE
"./src/ssl_bn.c" # included by ssl.c
"./src/ssl_certman.c" # included by ssl.c
"./src/ssl_crypto.c" # included by ssl.c
"./src/ssl_load.c" # included by ssl.c
"./src/ssl_misc.c" # included by ssl.c
"./src/ssl_p7p12.c" # included by ssl.c
"./src/ssl_sess.c" # included by ssl.c
"./src/x509.c"
"./src/x509_str.c"
"./wolfcrypt/src/evp.c"
Expand Down
3 changes: 3 additions & 0 deletions IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ list( REMOVE_ITEM SSL_SOURCES ../../../src/ssl_asn1.c )
list( REMOVE_ITEM SSL_SOURCES ../../../src/ssl_bn.c )
list( REMOVE_ITEM SSL_SOURCES ../../../src/ssl_certman.c )
list( REMOVE_ITEM SSL_SOURCES ../../../src/ssl_crypto.c )
list( REMOVE_ITEM SSL_SOURCES ../../../src/ssl_load.c )
list( REMOVE_ITEM SSL_SOURCES ../../../src/ssl_misc.c )
list( REMOVE_ITEM SSL_SOURCES ../../../src/ssl_p7p12.c )
list( REMOVE_ITEM SSL_SOURCES ../../../src/ssl_sess.c )
aux_source_directory( ${CRYPTO_SRC_DIR} CRYPTO_SOURCES )
list( REMOVE_ITEM CRYPTO_SOURCES ../../../wolfcrypt/src/evp.c )
list( REMOVE_ITEM CRYPTO_SOURCES ../../../wolfcrypt/src/misc.c )
Expand Down
Binary file added certs/dh-priv-2048.der
Binary file not shown.
14 changes: 14 additions & 0 deletions certs/dh-priv-2048.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-----BEGIN PRIVATE KEY-----
MIICJgIBADCCARcGCSqGSIb3DQEDATCCAQgCggEBALChCAacCBO6WQY8vDDV9QDB
T0Sn1u9KxiUnHOjSllMKXJHdosKUhL99skSfm9LBisW+clyn55Hm1J9zB4VbZkjH
cPq07gLJPZpK2j3BRj4ZadEXRgejTZ8rlhc5bTCNKvOU03XPoHXm8pIfGnAFqgSD
VzD72naTOFDoJ/1j7jzlt8gJrm9QNY6EzkoA6RJ+WjHXM/whE3bMFjDbDPzFYqc1
uO+3sKzANvbZyUZI+UCQACsbqmzjGsMLA54bwkbkSE4ic2/DX9Sa1jAHSNaMkKvU
9vHjSNNYS6a5zSm/aB8IS2OGL1xr1rYGZfem3ABna7vDqUGD+8f6yOIefq8AP5MC
AQIEggEEAoIBAGgTxi13nL+WV5P+7N5Pog7yPpAD+2VCLWQh7akd6hZQ2DMlHsUe
ptoAexAcst8vQOI1/Q1CX9ItJmUmLzUFNJSeYBp9kxNmNtSmgu2JUmQDF1GBsUlK
ERt4h2PuXGAaRH39V13QP7KfYnb+7k5vo6z90XaDubLq1OQIaTpM4TbLVZBKoCmx
ozuZjUQdC97adAKHQKBmpyI2AbfWM+Af43vV5uyfq4k4X+Y7k5habXFPRXcNKklk
n6OA/isuvSN6S4i2fVmAG0hguT0utQJq6oScMZmav8izdbfOdOavXILLjRf/2Qv+
+IMa9qlwxfqcj4oZahATC2Vd9242JWUdOpQ=
-----END PRIVATE KEY-----
Binary file added certs/dh-pub-2048.der
Binary file not shown.
14 changes: 14 additions & 0 deletions certs/dh-pub-2048.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-----BEGIN PUBLIC KEY-----
MIICJTCCARcGCSqGSIb3DQEDATCCAQgCggEBALChCAacCBO6WQY8vDDV9QDBT0Sn
1u9KxiUnHOjSllMKXJHdosKUhL99skSfm9LBisW+clyn55Hm1J9zB4VbZkjHcPq0
7gLJPZpK2j3BRj4ZadEXRgejTZ8rlhc5bTCNKvOU03XPoHXm8pIfGnAFqgSDVzD7
2naTOFDoJ/1j7jzlt8gJrm9QNY6EzkoA6RJ+WjHXM/whE3bMFjDbDPzFYqc1uO+3
sKzANvbZyUZI+UCQACsbqmzjGsMLA54bwkbkSE4ic2/DX9Sa1jAHSNaMkKvU9vHj
SNNYS6a5zSm/aB8IS2OGL1xr1rYGZfem3ABna7vDqUGD+8f6yOIefq8AP5MCAQID
ggEGAAKCAQEAgZ77PUjCE1nV8MPEk9zpTR6k1wYrpQKy3fjMK+kbuHUEw5AaMTK9
Gi3vpfwpg5ZaZTgTkPgakEcMwEagNDXEjzYOwxK5Ui6FVQ3VaDydVkhZppxpULu4
H1H2WwWUFTZTZlpCmhVsDWZwzy1RoxEfBnhC78hpLYKLzyASWC1EnCC9oP/U4aI/
D6i0bK1pXxPGFrML5jRkVpQReCkLI/aOgeTNUAcJC+USxIPSXpdPYl81zsWRgawP
bd2saVqE9DqJVSpoRY9yh1JoFqAagANNQL1x3sohEmMZq3EBbzReyawVW6Cbe5mb
LMtSN/UWqN/NwbYNcVj/GxFuoutVnS5jmw==
-----END PUBLIC KEY-----
20 changes: 20 additions & 0 deletions certs/dsa2048.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-----BEGIN DSA PRIVATE KEY-----
MIIDPwIBAAKCAQEAzI7JoNWaJxzaUt/HwOYGpD6KZknQWTNRacScXmSFx/Gr1dli
rP2h4BtX/5bvDJ/IRIfrXJHQRkIJUGojy4lvVelqEamoMqszDVG1eVG0q6IlEY3l
JL7Y8Z1OEm+sRFSAqbSBaE5EDrg5876DCHSixnrXan0KiFeDSNzPXm/uaAz3/wME
kKr3B5j4Z1qDI2ZHYMNDbgORrChmy/DTBcgJl7WuAV6AO51P3j6U/suCsLH8kYsd
iu7GBh83kUjS+GxdYBODp4Gsyo3QagQK6j4iThPxDbtga828XIejZytCoZ/NOVi+
VbGThM6yEE7kw5+yU2EBKaqWyyBgQh26dUtjwQIVAOelOdRqN16VBjkHdwrroAPr
eIKbAoIBAQCa1ExxL+z6MrKAfmFKa18YdkPDabpBx6cdeQHsrzSHZ08pgKg7h/bo
oejNGxyGOPbRDEYuyODJMCbVLH/BCL/MWoKO1NRJqqL65sGd8NmWsP8MWzOOBt2d
KKnpgEE72HqUIY9W8aK0K4kcdP9+kdwfkROYr8cG0kyQor3aFrplsC1ohzxuJY2Q
x7wNqUMDyb7PhW/bB3uM+LHCSRBpY1Y3xTDS+3Ga6IIHLj6VUPNzzzRb1asCFfLM
11LFKNhBGVVvuF/xmbPH2bNx9C3fIlk1hts5yhtNNZAZazHjyMYJv3ztAbSy9W7a
Y0E85jpyLWVI9gfNkoSLHacxa9bw+9n0AoIBAGZLu7fJSJUNWqYtoX/fH2dt7VJL
FmwXxq74asRX7S+z8CpVq7rK6hfoNXzlMQ1KlfxDb5c8XGesvmd/6U6qSLOSoXZ1
6gQ0f4czLSS2KZfjBHeTiRPbG5O4LJAaCTsm2VnzKglY3KwltKlFO6I6bGGEv2jU
6pvFKUhgFRA1LEQdtZrurMFo6Ee3QTQ5mvilIOkkxCxYP0xBMDoUbo3qrbqbQ9OY
L4PYFGfo+NVPrOA7v6dUFl5JZCZUpGtpfLqKg9kuZQqiJ++ZmQjXtZ+gAe9+F7+D
ay7dwDk4I2i0dmvlyvd87sBS4t2tWTpCBkWwx8F3BbIMMkBGqtp5dwRx33oCFQCY
7rlRNz51ExMGj5TT5ukAy2Jtmg==
-----END DSA PRIVATE KEY-----
7 changes: 6 additions & 1 deletion certs/include.am
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ EXTRA_DIST += \
certs/x942dh2048.der \
certs/x942dh2048.pem \
certs/fpki-cert.der \
certs/rid-cert.der
certs/rid-cert.der \
certs/dh-priv-2048.der \
certs/dh-priv-2048.pem \
certs/dh-pub-2048.der \
certs/dh-pub-2048.pem \
certs/dsa2048.pem

EXTRA_DIST += \
certs/ca-key.der \
Expand Down
1 change: 1 addition & 0 deletions examples/client/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -2166,6 +2166,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
(void)usePqc;
(void)pqcAlg;
(void)opensslPsk;
(void)fileFormat;
StackTrap();

/* Reinitialize the global myVerifyAction. */
Expand Down
3 changes: 3 additions & 0 deletions src/include.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ EXTRA_DIST += src/ssl_asn1.c
EXTRA_DIST += src/ssl_bn.c
EXTRA_DIST += src/ssl_certman.c
EXTRA_DIST += src/ssl_crypto.c
EXTRA_DIST += src/ssl_load.c
EXTRA_DIST += src/ssl_misc.c
EXTRA_DIST += src/ssl_p7p12.c
EXTRA_DIST += src/ssl_sess.c
EXTRA_DIST += src/x509.c
EXTRA_DIST += src/x509_str.c

Expand Down
Loading

0 comments on commit 8e9810e

Please sign in to comment.