summaryrefslogtreecommitdiff
path: root/lib/libssl/ssl_locl.h
AgeCommit message (Collapse)Author
2022-11-26Make internal header file names consistentTheo Buehler
Libcrypto currently has a mess of *_lcl.h, *_locl.h, and *_local.h names used for internal headers. Move all these headers we inherited from OpenSSL to *_local.h, reserving the name *_internal.h for our own code. Similarly, move dtls_locl.h and ssl_locl.h to dtls_local and ssl_local.h. constant_time_locl.h is moved to constant_time.h since it's special. Adjust all .c files in libcrypto, libssl and regress. The diff is mechanical with the exception of tls13_quic.c, where #include <ssl_locl.h> was fixed manually. discussed with jsing, no objection bcook
2022-11-11Convert the legacy TLS stack to tls_content.Joel Sing
This converts the legacy TLS stack to tls_content - records are now opened into a tls_content structure, rather than being written back into the same buffer that the sealed record was read into. This will allow for further clean up of the legacy record layer. ok tb@
2022-11-10Use tls_buffer for alert and handshake fragments in the legacy stack.Joel Sing
This avoids a bunch of pointer munging and a handrolled memmove. ok tb@
2022-11-07Rewrite TLSv1.2 key exporter.Joel Sing
Replace the grotty TLSv1.2 key exporter with a cleaner version that uses CBB and CBS. ok tb@
2022-10-20Provide ssl_session_dup()Theo Buehler
SSL_SESSION_dup() is a currently essentially unused public OpenSSL 1.1.1 API. Add a version that does not duplicate the secrets for internal use. If the public API should be needed, we can easily make it a wrapper. ok jsing
2022-10-20Extend SSL_SESSION struct for TLSv1.3 PSKTheo Buehler
Add members necessary to store the "ticket_age_add" value and the resumption master secret needed in the TLSv1.3 version of session resumption. ok jsing
2022-10-02Get rid of SSL_CTX_INTERNAL and SSL_INTERNAL.Joel Sing
These are no longer necessary due to SSL_CTX and SSL now being fully opaque. Merge SSL_CTX_INTERNAL back into SSL_CTX and SSL_INTERNAL back into SSL. Prompted by tb@
2022-10-01Move handshake message handling functions from ssl_both.c to client/server.Joel Sing
Currently, ssl_both.c contains several functions that are used by both the legacy client and legacy server. This interwines the client and server, making it harder to make progressive changes. While it does deduplicate some code, it also ends up with code that is conditioned on s->server and forces the caller to pass in SSL3_ST_* values. Move these functions from ssl_both.c into ssl_clnt.c and ssl_srvr.c, renaming as appropriate and removing the s->server conditionals. Also move the client and server function prototypes from ssl_locl.h into the .c files, making them static in the process. ok tb@
2022-09-10Provide a version of ssl_msg_callback() that takes a CBS.Joel Sing
Use this from the TLSv1.3 code. ok tb@
2022-08-21Wire up SSL_QUIC_METHOD callbacks to the record layer callbacks for QUIC.Joel Sing
ok tb@
2022-08-21Provide SSL_QUIC_METHOD.Joel Sing
This provides SSL_QUIC_METHOD (aka ssl_quic_method_st), which allows for QUIC callback hooks to be passed to an SSL_CTX or SSL. This is largely ported/adapted from BoringSSL. It is worth noting that this struct is not opaque and the original interface exposed by BoringSSL differs to the one they now use. The original interface was copied by quictls and it appears that this API will not be updated to match BoringSSL. To make things even more challenging, at least one consumer does not use named initialisers, making code completely dependent on the order in which the function pointers are defined as struct members. In order to try to support both variants, the set_read_secret/set_write_secret functions are included, however they have to go at the end. ok tb@
2022-08-18Tweak prototype to match function definition (n -> index)Theo Buehler
2022-08-17Refactor tls1_get_supported_group()Theo Buehler
This splits tls1_get_supported_group() into a few helper functions to be able to count shared groups and to return the n-th shared group since someone thought it is a great idea to expose that in a single API and some others thought it is useful to add this info to log noise. This is all made a bit more complicated thanks to the security level having its tentacles everywhere and because a user-provided security callback can influence the list of groups shared by the peers. ok jsing
2022-08-17Make tls1_get_{format,group_}list() take a const SSLTheo Buehler
ok jsing
2022-08-17Provide ssl_security_shared_group()Theo Buehler
Refactor ssl_security_supported_group() into a wrapper of a new internal ssl_security_group() which takes a secop as an argument. This allows adding ssl_security_shared_group() which will be needed in upcoming commits. ok jsing
2022-08-17Deduplicate peer certificate chain processing code.Joel Sing
Rather than reimplement this in each TLS client and server, deduplicate it into a single function. Furthermore, rather than dealing with the API hazard that is SSL_get_peer_cert_chain() in this code, simply produce two chains - one that has the leaf and one that does not. SSL_get_peer_cert_chain() can then return the appropriate one. This also moves the peer cert chain from the SSL_SESSION to the SSL_HANDSHAKE, which makes more sense since it is not available on resumption. ok tb@
2022-07-24Provide record layer callbacks for QUIC.Joel Sing
QUIC uses TLS to complete the handshake, however unlike normal TLS it does not use the TLS record layer, rather it provides its own transport. This means that we need to intercept all communication between the TLS handshake and the record layer. This allows TLS handshake message writes to be directed to QUIC, likewise for TLS handshake message reads. Alerts also need to be sent via QUIC, plus it needs to be provided with the traffic keys that are derived by TLS. ok tb@
2022-07-22Convert TLS transcript from BUF_MEM to tls_buffer.Joel Sing
ok beck@ tb@
2022-07-20Change various ALPN related internal struct membersTheo Buehler
Change alpn_client_proto_list and alpn_selected from unsigned char * to uint8_t and change alpn_client_proto_list_len to be a size_t instead of an unsigned int. ok jsing
2022-07-17Provide SSL_is_quic()Joel Sing
This function will allow code to know if the SSL connection is configured for use with QUIC or not. Also move existing SSL_.*quic.* functions under LIBRESSL_HAS_QUIC to prevent exposing them prematurely. ok beck@ tb@
2022-07-10Annotate the security callback and the security ex_data as deliberatelyTheo Buehler
not exposed in the public API.
2022-07-07Unifdef LIBRESSL_HAS_SECURITY_LEVEL and remove some workaroundsTheo Buehler
that are no longer needed now that libcrypto exposes the necessary security-bits API. ok jsing
2022-07-02Stop using ssl{_ctx,}_security() outside of ssl_seclevel.cTheo Buehler
The API is ugly and we can easily abstract it away. The SSL_SECOP_* stuff is now confined into ssl_seclevel.c and the rest of the library can make use of the more straightforward wrappers, which makes it a lot easier on the eyes. ok beck jsing
2022-07-02Rename uses 'curve' to 'group' and rework tls1 group API.Theo Buehler
This reworks various tls1_ curve APIs to indicate success via a boolean return value and move the output to an out parameter. This makes the caller code easier and more consistent. Based on a suggestion by jsing ok jsing
2022-06-30Check security level for supported groups.Theo Buehler
ok jsing
2022-06-30Add checks to ensure we do not initiate or negotiate handshakes withTheo Buehler
versions below the minimum required by the security level. input & ok jsing
2022-06-29Make ssl_cert_add{0,1}_chain_cert() take ssl/ctxTheo Buehler
ok beck jsing
2022-06-29ssl_cert_set{0,1}_chain() take ssl/ctxTheo Buehler
ok beck jsing
2022-06-29Refactor use_certificate_chain_* to take ssl/ctx instead of a certTheo Buehler
ok beck jsing
2022-06-29Add functions that check security level in certs and cert chains.Theo Buehler
ok beck jsing
2022-06-29Parse the @SECLEVEL=n annotation in cipher stringsTheo Buehler
To this end, hand the SSL_CERT through about 5 levels of indirection to set an integer on it. ok beck jsing
2022-06-29Add support for sending QUIC transport parametersBob Beck
This is the start of adding the boringssl API for QUIC support, and the TLS extensions necessary to send and receive QUIC transport data. Inspired by boringssl's https://boringssl-review.googlesource.com/24464 ok jsing@ tb@
2022-06-29whitespace nitTheo Buehler
2022-06-29Also check the security level of the 'tmp dh'Theo Buehler
ok beck jsing
2022-06-29Check the security of DH key sharesTheo Buehler
ok beck, looks good to jsing
2022-06-29Rename one s to ssl for consistencyTheo Buehler
2022-06-28Add prototypes for ssl{_ctx,}_security()Theo Buehler
ok beck jsing sthen
2022-06-28Implement the default security level callbackTheo Buehler
And here is where the fun starts. The tentacles will grow everywhere. ok beck jsing sthen
2022-06-28Add security callback, level and ex_data fields to SSL_CERTTheo Buehler
ok beck jsing sthen
2022-06-07Switch sid_ctx_length in SSL, SSL_CTX and SSL_SESSION to a size_tTheo Buehler
ok jsing
2022-06-07Switch SSL_SESSION's session_id_length to a size_tTheo Buehler
ok jsing
2022-06-07Switch the SSL_SESSION's master_key_length to a size_tTheo Buehler
ok jsing
2022-06-06Tweak comment describing the SSL_SESSION ASN.1Theo Buehler
ok jsing
2022-06-06Fix spaces before tabsTheo Buehler
2022-06-03Add a use_psk_dhe_ke flag to the TLSv1.3 handshake structTheo Buehler
This will be used to indicate client side support for DHE key establishment. ok jsing
2022-03-17Remove const from tls1_transcript_hash_value()Joel Sing
This function populates the passed *out argument, hence it should not be marked const. ok tb@
2022-03-12Factor out change cipher spec handing code in the legacy stack.Joel Sing
Factor out the code that handles the processing of a change cipher spec message that has been read in the legacy stack, deduplicating code in the DTLS stack. ok inoguchi@ tb@
2022-02-21Factor out alert handing code in the legacy stack.Joel Sing
Pull out the code that processes incoming alerts - a chunk of the complexity is due to the fact that in TLSv1.2 and earlier, alerts can be fragmented across multiple records or multiple alerts can be delivered in a single record. In DTLS there is no way that we can reassemble fragmented alerts (although the RFC is silent on this), however we could have multiple alerts in the same record. This change means that we will handle this situation more appropriately and if we encounter a fragmented alert we will now treat this as a decode error (instead of silently ignoring it). ok beck@ tb@
2022-02-05Bye bye S3I.Joel Sing
S3I has served us well, however now that libssl is fully opaque it is time to say goodbye. Aside from removing the calloc/free/memset, the rest is mechanical sed. ok inoguchi@ tb@
2022-02-03Cleanup/simplify ssl_cert_type()Joel Sing
Remove the X509 argument as it is unused - this was passed so that ssl_cert_type() can get the public key from the X509 object if the EVP_PKEY argument is NULL, however this is never the case. ok tb@