summaryrefslogtreecommitdiff
path: root/lib/libssl/ssl_asn1.c
AgeCommit message (Collapse)Author
2023-07-08Hide all public symbols in libsslBob Beck
With the guentherizer 9000 ok tb@
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-06-07Simplify another CBS_write_bytes() call in d2i_SSL_SESSION()Theo Buehler
ok jsing
2022-06-07Simplify various CBS_write_bytes() callsTheo Buehler
Now that session_id_length is a size_t, we can pass it directly to CBS_write_bytes() instead of using a temporary variable. ok jsing
2022-06-07Simplify CBS_write_bytes() invocationTheo Buehler
Now that master_key_length is a size_t, we no longer have to fiddle with data_len. We can rather pass a pointer to it to CBS_write_bytes(). ok jsing
2022-06-06Use SSL3_CK_VALUE_MASK instead of hardcoded 0xffff and remove someTheo Buehler
SSLv2 remnants. ok jsing
2022-01-11Rename 'peer' to 'peer_cert' in SSL_SESSION.Joel Sing
The 'peer' member of SSL_SESSION is the leaf/end-entity certificate provided by our peer. Rename it since 'peer' on its own is unhelpful. ok inoguchi@ tb@
2021-10-23Change tlsext_tick_lifetime_hint to uint32_t.Joel Sing
Now that SSL_SESSION is opaque, change tlsext_tick_lifetime_hint from long to uint32_t (matching RFC4507), rather than continuing to work around an inappropriate type choice. ok tb@
2021-05-16Make local header inclusion consistent.Joel Sing
Consistently include local headers in the same location, using the same grouping/sorting across all files.
2021-03-29whitespace nitsTheo Buehler
2018-08-27Simplify new session ticket encoding/generation.Joel Sing
The original code did a crazy encode/malloc/encode/decode/modify/encode dance, in order to encode a session in the form needed to encrypt then add to a session ticket. By modifying the encoding functions slightly, we can do this entire dance as a single encode. Inspired by similar changes in BoringSSL. ok inoguchi@ tb@
2018-03-20In i2d_SSL_SESSION(), on error call CBB_cleanup() with the correct CBB.Joel Sing
Spotted by Coverity, although reported as a different issue.
2017-05-06Add missing $OpenBSD$ tags.Joel Sing
2017-04-30Switch back to freezero() and explicitly initialise data_len to zero. TheJoel Sing
previous code was safe since data would always be NULL if data_len was uninitialised, however compilers cannot know this.
2017-04-16backout previous, data_len is not always initializedOtto Moerbeek
2017-04-14Switch i2d_SSL_SESSION() back to freezero(3) now that the size constraintsJoel Sing
have been relaxed.
2017-04-11Revert ssl_asn1.c r1.50 - CBB and freezero(3) do not play nicely together.Joel Sing
Back this out while we investigate and implement a solution. Found the hard way by sthen@
2017-04-10Use freezero() for i2d_SSL_SESSION() - one line of code instead of three.Joel Sing
In this case the memory allocated can also be significant, in which case freezero() will have less overhead than explicit_bzero() (munmap instead of touching all of the memory to write zeros).
2017-02-07Change SSLerror() back to taking two args, with the first one being an SSL *.Bob Beck
Make a table of "function codes" which maps the internal state of the SSL * to something like a useful name so in a typical error in the connection you know in what sort of place in the handshake things happened. (instead of by arcane function name). Add SSLerrorx() for when we don't have an SSL * ok jsing@ after us both being prodded by bluhm@ to make it not terrible
2017-01-26Send the error function codes to rot in the depths of hell where they belongBob Beck
We leave a single funciton code (0xFFF) to say "SSL_internal" so the public API will not break, and we replace all internal use of the two argument SSL_err() with the internal only SSL_error() that only takes a reason code. ok jsing@
2016-12-26Restore previous ASN.1 encoding for the peer certificate - this wasJoel Sing
unintentionally changed during the CBS/CBB rewrite. Issue reported by jeremy@ due to failing ruby tests. Analysis and near identical diff from Kazuki Yamaguchi <k at rhe.jp>.
2016-12-26Restore previous behaviour of incrementing the pointer so that it pointsJoel Sing
at the end of the buffer. Issue identified by and diff from Kazuki Yamaguchi <k at rhe.jp>.
2016-12-07Ensure that we zero memory used to hold the ASN.1 encoded session, sinceJoel Sing
this contains the session master key. ok deraadt@ doug@
2016-12-03Avoid signed vs unsigned warnings from clang by adding two casts,Joel Sing
slightly rewriting some code and changing the type of an array. ok bcook@ doug@
2016-11-05One of the error paths would attempt to access not-yet-initialized locals.Miod Vallat
Simply return since there is nothing more to do. Spotted by coverity. ok jsing@ beck@
2016-11-04Completely rewrite the session handling ASN.1 code using CBB and CBS. ThisJoel Sing
addresses two 2038 related issues and also adds support for allocation in the i2d function, which will allow for simplification in the callers. ok beck@ miod@
2016-03-11X509_free(3) is NULL-safe, so remove NULL checks before its calls.Michael McConville
ok doug@
2014-12-14Remove trailing whitespace.Joel Sing
2014-10-20SSL: Fix memory leak in d2i_SSL_SESSION.Brent Cook
Modified version of patch from Dmitry Eremin-Solenikov. ==28360== 98 bytes in 2 blocks are definitely lost in loss record 7 of 7 ==28360== at 0x402AC54: realloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==28360== by 0x40E2D2C: ASN1_STRING_set (asn1_lib.c:393) ==28360== by 0x40EC22C: asn1_ex_c2i (tasn_dec.c:959) ==28360== by 0x40EC632: asn1_d2i_ex_primitive (tasn_dec.c:824) ==28360== by 0x40ED2E6: ASN1_item_ex_d2i (tasn_dec.c:230) ==28360== by 0x40ED421: ASN1_item_d2i (tasn_dec.c:133) ==28360== by 0x40F0335: d2i_ASN1_OCTET_STRING (tasn_typ.c:75) ==28360== by 0x405FD6D: d2i_SSL_SESSION (ssl_asn1.c:367) ==28360== by 0x405DD6E: ssl3_send_newsession_ticket (s3_srvr.c:2743) ==28360== by 0x405EA48: ssl3_accept (s3_srvr.c:665) ==28360== by 0x4067C34: SSL_accept (ssl_lib.c:922) ==28360== by 0x404E97B: ssl23_get_client_hello (s23_srvr.c:573) ok miod@ beck@
2014-10-16Get rid of the last remaining BUF_strdup and BUF_strlcpy and friends, useBob Beck
intrinsic functions everywhere, and wrap these functions in an #ifndef LIBRESSL_INTERNAL to make sure we don't bring their use back.
2014-07-13Stop leaking internal library pointers in error messages.Joel Sing
Requested by miod@
2014-07-13Explicitly initialise slen - this was not previously done due to a missingJoel Sing
M_ASN1_D2I_begin macro.
2014-07-13Convert error handling to SSLerr and ERR_asprintf_error_data.Joel Sing
2014-07-13Convert d2i_SSL_SESSION to ASN1 primitives, instead of the horrificJoel Sing
asn1_mac.h macros. This still needs a lot of improvement, but immediately becomes readable. ok miod@ (sight unseen!)
2014-07-13Remove license introduced with the PSK code, which has since been removed.Joel Sing
ok deraadt@
2014-07-13Another compression remnant.Joel Sing
2014-07-13Rewrite i2d_SSL_SESSION to use the ASN1 primitives, rather than using theJoel Sing
horrific macros from asn1_mac.h. This is a classic example of using macros to obfuscate code, in an attempt to reduce the line count. The end result is so ridiculously convoluted that it is completely unreadable and it takes hours to deconstruct the macros and figure out what is actually going on behind the scenes. ok miod@
2014-07-13KNF and some code cleaning.Joel Sing
2014-07-11Missing initialization for error line in error paths; from Coverity viaMiod Vallat
OpenSSL trunk.
2014-07-11Remove the PSK code. We don't need to drag around thisBob Beck
baggage. ok miod@ jsing@
2014-07-10decompress libssl. ok beck jsingTed Unangst
2014-06-12tags as requested by miod and teduTheo de Raadt
2014-05-31TLS would not be entirely functional without extensions, so unifdefJoel Sing
OPENSSL_NO_TLSEXT. ok tedu@
2014-05-05Remove SRP and Kerberos support from libssl. These are complex protocolsTed Unangst
all on their own and we can't effectively maintain them without using them, which we don't. If the need arises, the code can be resurrected.
2014-04-20Chop off more SSLv2 tentacles and start fixing and noting y2038 issues.Philip Guenther
APIs that pass times as longs will have to change at some point... Bump major on both libcrypto and libssl. ok tedu@
2014-04-19More KNF and style consistency tweaksPhilip Guenther
2014-04-17Change library to use intrinsic memory allocation functions instead ofBob Beck
OPENSSL_foo wrappers. This changes: OPENSSL_malloc->malloc OPENSSL_free->free OPENSSL_relloc->realloc OPENSSL_freeFunc->free
2014-04-16add back SRP. i was being too greedy.Ted Unangst
2014-04-16disentangle SRP code from TLSTed Unangst
2014-04-16Kill the bogus "send an SSLv3/TLS hello in SSLv2 format" crap fromPhilip Guenther
the SSLv23_* client code. The server continues to accept it. It also kills the bits for SSL2 SESSIONs; even when the server gets an SSLv2-style compat handshake, the session that it creates has the correct version internally. ok tedu@ beck@