summaryrefslogtreecommitdiff
path: root/src/lib/libtls/tls.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Hide the tls_signer from public visibility. It's not ready yet andtb2022-03-241-21/+1
| | | | | | should not be used. It will be revisited after release. ok beck inoguchi jsing
* Provide our own signature padding defines.jsing2022-02-011-1/+5
| | | | | | | | Rather than leaking libcrypto defines through the tls_sign_cb and tls_signer_sign() interfaces, provide and use our own TLS_PADDING_* defines. ok inoguchi@ tb@
* Revise signer callback interface.jsing2022-02-011-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | The current design of tls_sign_cb provides a pointer to a buffer where the signature needs to be copied, however it fails to provide a length which could result in buffer overwrites. Furthermore, tls_signer_sign() is designed such that it allocates and returns ownership to the caller. Revise tls_sign_cb so that the called function is expected to allocate a buffer, returning ownership of the buffer (along with its length) to the caller of the callback. This makes it far easier (and safer) to implement a tls_sign_cb callback, plus tls_signer_sign can be directly plugged in (with an appropriate cast). While here, rename and reorder some arguments - while we will normally sign a digest, there is no requirement for this to be the case hence use 'input' and 'input_len'. Move padding (an input) before the outputs and add some additional bounds/return value checks. This is technically an API/ABI break that would need a libtls major bump, however since nothing is using the signer interface (outside of regress), we'll ride the original minor bump. With input from tb@ ok inoguchi@ tb@
* Introduce a signer interface intented to make TLS privsep simplereric2022-01-251-1/+17
| | | | | | | | | | | | | | | | to implement. Add a tls_config_set_sign_cb() function that allows to register a callback for the signing operation on a tls_config. When used, the context installs fake pivate keys internally, and the callback receives the hash of the public key. Add a tls_signer_*() set of functions to manage tls_signer objects. A tls_signer is an opaque structure on which keys are added. It is used to compute signatures with private keys identified by their associated public key hash. Discussed with and ok jsing@ tb@
* Enable TLS version 1.3 in the default protocols for libtls.beck2020-01-221-2/+2
| | | | | | | This will as yet not do anything, until we turn it on in the lower level libraries. ok jsing@
* Add support for TLSv1.3 as a protocol to libtls.jsing2020-01-201-3/+6
| | | | | | | This makes tls_config_parse_protocols() recognise and handle "tlsv1.3". If TLSv1.3 is enabled libtls will also request libssl to enable it. ok beck@ tb@
* Provide tls_conn_cipher_strength().jsing2019-11-021-1/+2
| | | | | | | | | This returns the strength in bits of the symmetric cipher used for the connection. Diff from gilles@ ok tb@
* expose the default cert file as a function, not a define. it's reallytedu2018-11-291-3/+3
| | | | | | an internal detail of the library, so the string should live inside it, not in the application code. ok jsing
* Define TLS_CA_CERT_FILE rather than having every application create theirjsing2018-11-061-1/+3
| | | | | | own define for /etc/ssl/cert.pem. ok beck@ bluhm@ tb@
* Bump TLS API version since we've added more functionality.jsing2018-02-101-2/+2
|
* Add support to libtls for client-side TLS session resumption.jsing2018-02-101-1/+3
| | | | | | | | | | | | A libtls client can specify a session file descriptor (a regular file with appropriate ownership and permissions) and libtls will manage reading and writing of session data across TLS handshakes. Discussed at length with deraadt@ and tedu@. Rides previous minor bump. ok beck@
* Add a tls_config_set_ecdhecurves() function to libtls, which allows thejsing2017-08-101-2/+3
| | | | | | | | | | names of the elliptic curves that may be used during client and server key exchange to be specified. This deprecates tls_config_set_ecdhecurve(), which could only be used to specify a single supported curve. ok beck@
* Add support for providing CRLs to libtls - once a CRL is provided wejsing2017-07-061-1/+4
| | | | | | | | enable CRL checking for the full certificate chain. Based on a diff from Jack Burton <jack at saosce dot com dot au>, thanks! Discussed with beck@
* Provide a tls_unload_file() function, that frees the memory returned fromjsing2017-05-061-1/+2
| | | | | | | | a tls_load_file() call, ensuring that it the contents become inaccessible. This is specifically needed on platforms where the library allocators may be different from the application allocator. ok beck@
* Add tls_peer_cert_chain_pem - To retreive the peer certificate and chainbeck2017-04-051-1/+2
| | | | | | | as PEM format. This allows for it to be used or examined with tools external to libtls bump minor ok jsing@
* Add tls_config_[add|set]keypair_ocsp functions so that ocsp staples may bebeck2017-01-311-4/+14
| | | | | | | | added associated to a keypair used for SNI, and are usable for more than just the "main" certificate. Modify httpd to use this. Bump libtls minor. ok jsing@
* Bump TLS_API due to new features being added earlier this week.jsing2017-01-261-2/+2
|
* Introduce ticket support. To enable them it is enough to set a positiveclaudio2017-01-241-1/+10
| | | | | | | | | | | | | | | | | | | | lifetime with tls_config_set_session_lifetime(). This enables tickets and uses an internal automatic rekeying mode for the ticket keys. If multiple processes are involved the following functions can be used to make tickets work accross all instances: - tls_config_set_session_id() sets the session identifier - tls_config_add_ticket_key() adds an encryption and authentication key For now only the last 4 keys added will be used (unless they are too old). If tls_config_add_ticket_key() is used the caller must ensure to add new keys regularly. It is best to do this 4 times per session lifetime (which is also the ticket key lifetime). Since tickets break PFS it is best to minimize the session lifetime according to needs. With a lot of help, input and OK beck@, jsing@
* Wrap long lines.jsing2017-01-221-4/+7
|
* Bump TLS_API due to recent feature additions and changes.jsing2016-11-111-2/+2
|
* Change the return value of tls_config_set_protocols() andjsing2016-11-111-3/+3
| | | | | | | | | | tls_config_set_verify_depth() from void to int. This makes them consistent with all other tls_config_set_* functions and will allow for call time validation to be implemented. Rides libtls major bump. ok beck@
* Add support for server side OCSP stapling to libtls.beck2016-11-051-1/+3
| | | | Add support for server side OCSP stapling to netcat.
* Add ocsp_require_stapling config option for tls - allows a connectionbeck2016-11-041-1/+2
| | | | | | to indicate that it requires the peer to provide a stapled OCSP response with the handshake. Provide a "-T muststaple" for nc that uses it. ok jsing@, guenther@
* Add OCSP client side support to libtls.beck2016-11-021-1/+36
| | | | | | | | | | | | | - Provide access to certificate OCSP URL - Provide ability to check a raw OCSP reply against an established TLS ctx - Check and validate OCSP stapling info in the TLS handshake if a stapled OCSP response is provided.` Add example code to show OCSP URL and stapled info into netcat. ok jsing@
* add a little more typing to the first callback argument.tedu2016-09-131-3/+3
| | | | it's always a tls context.
* Bump TLS_API for addition of callbacks.jsing2016-09-041-2/+2
|
* Add callback-based interface to libtls.bcook2016-09-041-1/+10
| | | | | | | This allows working with buffers and callback functions instead of directly on sockets or file descriptors. Original patch from Tobias Pape <tobias_at_netshed.de>. ok beck@
* Bump TLS_API due to the addition of server side SNI functions.jsing2016-08-221-2/+2
|
* Provide an API that enables server side SNI support - add the ability tojsing2016-08-221-1/+7
| | | | | | | | provide additional keypairs (via tls_config_add_keypair_{file,mem}()) and allow the server to determine what servername the client requested (via tls_conn_servername()). ok beck@
* Add ALPN support to libtls.jsing2016-08-121-3/+5
| | | | ok beck@ doug@
* Revert previous since it adds new symbols.jsing2016-08-021-4/+2
| | | | Requested by deraadt@
* Bump TLS_API for addition of ALPN support.jsing2016-08-011-2/+2
|
* Add ALPN support to libtls.jsing2016-08-011-2/+4
| | | | ok beck@ doug@
* Fix function parameters that do not have an underscore prefix.jsing2016-05-271-10/+10
|
* Factor our the keypair handling in libtls. This results in more readablejsing2016-04-281-1/+5
| | | | | | | | | and self-contained code, while preparing for the ability to handle multiple keypairs. Also provide two additional functions that allow a public certificate and private key to be set with a single function call. ok beck@
* Rework the error handling in libtls so that we can associate errors withjsing2016-04-281-1/+2
| | | | | | | | | | | both configuration and contexts. This allows us to propagate errors that occur during configuration, rather than either just failing with no reason or delaying the failure until it can be propagated via the tls context. Also provide a tls_config_error() function for retrieving the last error from a tls_config *. ok bcook@
* Add tls_peer_cert_notbefore and tls_peer_cert_notafter to expose peer ↵beck2015-10-071-1/+4
| | | | | | | certificate validity times for tls connections. ok jsing@
* include <sys/types.h> for ssize_tbcook2015-10-011-1/+3
| | | | ok jsing@, deraadt@
* Provide tls_config_insecure_noverifytime() in order to be able to disablejsing2015-09-141-1/+2
| | | | | | certificate validity checking. ok beck@
* add visibility of ciper and connection version stringsbeck2015-09-131-1/+3
| | | | ok jsing@
* Move connection info into it's own private structure allocated and filled inbeck2015-09-121-4/+4
| | | | | | at handshake time. change accessors to return const char * to remove need for caller to free memory. ok jsing@
* Put tls_peer_cert* functions in the same place.jsing2015-09-121-6/+6
|
* add tls_peer functions for checking names and issuers of peer certificates.beck2015-09-111-1/+6
| | | | ok jsing@
* Provide tls_peer_cert_hash() which returns a hash of the raw certificatejsing2015-09-111-1/+3
| | | | | | | | | | | | | that was presented by the peer. The hash used is currently SHA256, however since we prefix the result with the hash name, we can change this in the future as the need arises. The same output can be generated by using: h=$(openssl x509 -outform der -in mycert.crt | sha256) printf "SHA256:${h}\n" ok beck@
* change TLS_READ_AGAIN to TLS_WANT_POLLIN and TLS_WRITE_AGAIN to TLS_WANT_POLLOUTbeck2015-09-101-3/+3
| | | | | | | to make it more clear to users of this api what needs to be done in these error cases. Discussed extensively with bluhm@ and jsing@ and others. ok jsing@
* Change tls_read and tls_write semantics to return an ssize_t to betterbeck2015-09-101-4/+3
| | | | | | | | match read() and write() semantics to make porting existing code using read/write easier.. requested by bluhm@ who convinced jsing and I to break the api ok jsing@ bluhm@
* Split tls_handshake() out from tls_accept/tls_connect. By doing this thejsing2015-09-101-1/+2
| | | | | | | | | | | | | | | tls_accept/tls_connect functions can be guaranteed to succeed or fail and will no longer return TLS_READ_AGAIN/TLS_WRITE_AGAIN. This also resolves the semantics of tls_accept_*. The tls_handshake() function now does I/O and can return TLS_READ_AGAIN/TLS_WRITE_AGAIN. Calls to tls_read() and tls_write() will trigger the handshake if it has not already completed, meaning that in many cases existing code will continue to work. Discussed over many coffees at l2k15. ok beck@ bluhm@
* Add support for preferring the server's cipher list or the client's cipherjsing2015-09-101-3/+6
| | | | | | | | list. Prefer the server's cipher list by default. Based on a diff from Kyle Thompson <jmp at giga dot moe>. ok beck@ bcook@
* Add client certificate support. Still needs a few tweaks but this willbeck2015-09-091-1/+4
| | | | | ride upcoming minor bump ok jsing@
* Add standard headers, C++ support to tls.h.bcook2015-06-191-1/+12
| | | | | | | | | | | | | | | | | This makes using libtls easier to include by including dependent headers, making something like this work as expected: #include <iostream> #include <tls.h> int main() { std::cout << "tls_init: " << tls_init() << "\n"; } This also makes building a standalone libtls-portable simpler. ok doug@, jsing@