Skip to content

Commit

Permalink
mbedTLS: implement CURLOPT_SSL_CIPHER_LIST option
Browse files Browse the repository at this point in the history
Use a lookup list to set the cipher suites, allowing the
ciphers to be set by either openssl or IANA names.

To keep the binary size of the lookup list down we compress
each entry in the cipher list down to 2 + 6 bytes using the
C preprocessor.

Closes curl#13442
  • Loading branch information
jan2000 authored and bagder committed Apr 24, 2024
1 parent 43299e9 commit fba9afe
Show file tree
Hide file tree
Showing 11 changed files with 1,485 additions and 16 deletions.
1 change: 1 addition & 0 deletions .github/scripts/codespell-ignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ inout
msdos
ba
fo
ede
14 changes: 8 additions & 6 deletions docs/libcurl/opts/CURLOPT_PROXY_SSL_CIPHER_LIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ TLS-backend:
- Secure Transport
- wolfSSL
- GnuTLS
- mbedTLS
---

# NAME
Expand Down Expand Up @@ -49,12 +50,13 @@ set when you compile OpenSSL.
For WolfSSL, valid examples of cipher lists include **ECDHE-RSA-RC4-SHA**,
**AES256-SHA:AES256-SHA256**, etc.
For BearSSL, valid examples of cipher lists include
**ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES128-GCM-SHA256**, or when using IANA names
For mbedTLS and BearSSL, valid examples of cipher lists include
**ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES128-GCM-SHA256**, or when using
IANA names
**TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256:TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256**,
etc.
With BearSSL you do not add/remove ciphers. If one uses this option then all
known ciphers are disabled and only those passed in are enabled.
etc. With mbedTLS and BearSSL you do not add/remove ciphers. If one uses this
option then all known ciphers are disabled and only those passed in are
enabled.
Find more details about cipher lists on this URL:
Expand Down Expand Up @@ -86,7 +88,7 @@ int main(void)

# AVAILABILITY

Added in 7.52.0, in 7.83.0 for BearSSL
Added in 7.52.0, in 7.83.0 for BearSSL, in 8.8.0 for mbedTLS

If built TLS enabled.

Expand Down
10 changes: 6 additions & 4 deletions docs/libcurl/opts/CURLOPT_SSL_CIPHER_LIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ TLS-backend:
- Secure Transport
- wolfSSL
- GnuTLS
- mbedTLS
---

# NAME
Expand Down Expand Up @@ -48,12 +49,13 @@ you compile OpenSSL.
For WolfSSL, valid examples of cipher lists include **ECDHE-RSA-RC4-SHA**,
**AES256-SHA:AES256-SHA256**, etc.
For BearSSL, valid examples of cipher lists include
For mbedTLS and BearSSL, valid examples of cipher lists include
**ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES128-GCM-SHA256**, or when using
IANA names
**TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256:TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256**,
etc. With BearSSL you do not add/remove ciphers. If one uses this option then
all known ciphers are disabled and only those passed in are enabled.
etc. With mbedTLS and BearSSL you do not add/remove ciphers. If one uses this
option then all known ciphers are disabled and only those passed in are
enabled.
For Schannel, you can use this option to set algorithms but not specific
cipher suites. Refer to the ciphers lists document for algorithms.
Expand Down Expand Up @@ -87,7 +89,7 @@ int main(void)

# AVAILABILITY

Added in 7.9, in 7.83.0 for BearSSL
Added in 7.9, in 7.83.0 for BearSSL, in 8.8.0 for mbedTLS

If built TLS enabled.

Expand Down
2 changes: 2 additions & 0 deletions lib/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ LIB_VAUTH_HFILES = \

LIB_VTLS_CFILES = \
vtls/bearssl.c \
vtls/cipher_suite.c \
vtls/gtls.c \
vtls/hostcheck.c \
vtls/keylog.c \
Expand All @@ -60,6 +61,7 @@ LIB_VTLS_CFILES = \

LIB_VTLS_HFILES = \
vtls/bearssl.h \
vtls/cipher_suite.h \
vtls/gtls.h \
vtls/hostcheck.h \
vtls/keylog.h \
Expand Down

0 comments on commit fba9afe

Please sign in to comment.