1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-22 16:42:56 -08:00
Commit Graph

51 Commits

Author SHA1 Message Date
tb
6565de7c79 Fix two more unchecked EVP_PKEY_assign() calls
In SSL{_CTX}_use_RSAPrivateKey() switch from EVP_PKEY_assign_RSA() to
EVP_PKEY_set1_RSA() and hold on to the reference of the the pkey for
the duration of ssl_set_pkey(). Use single exit and other minor style
cleanups.

ok joshua jsing
2023-12-30 06:25:56 +00:00
beck
71e048498e Hide all public symbols in libssl
With the guentherizer 9000

ok tb@
2023-07-08 16:40:13 +00:00
tb
c9675a23de Make internal header file names consistent
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-26 16:08:50 +00:00
tb
5b39a7377a Recommit -r1.45 but without error checking EVP_PKEY_copy_parameters()
EVP_PKEY_copy_parameters() will unconditionally fail if the pkey's ameth
has no copy_params(). Obviously this is indistinguishable from actual
failure...

ok jsing
2022-08-31 20:49:37 +00:00
tb
b17cb24a4c Revert r1.46. Causes fireworks in regress. 2022-08-31 20:20:53 +00:00
tb
137b8d4926 Avoid potential NULL dereference in ssl_set_pkey()
Switch from X509_get_pubkey() to X509_get0_pubkey() to avoid an unnecessary
EVP_PKEY_free(). Check the return values of X509_get0_pubkey() and
EVP_PKEY_copy_parameters(). If the former returns NULL, the latter will
dereference NULL.

CID 25020

ok jsing
2022-08-31 06:51:36 +00:00
tb
9c40045402 Rename use_* to ssl_use_* for consistency.
discussed with jsing
2022-06-30 09:08:35 +00:00
tb
dc2a950bb3 Make ssl_cert_add{0,1}_chain_cert() take ssl/ctx
ok beck jsing
2022-06-29 21:18:04 +00:00
tb
5dbcc7f027 ssl_cert_set{0,1}_chain() take ssl/ctx
ok beck jsing
2022-06-29 21:17:22 +00:00
tb
9107516832 Add a security check to ssl_set_cert()
ok beck jsing
2022-06-29 21:16:30 +00:00
tb
96697e9055 Make ssl_set_{cert,pkey} take an ssl/ctx
ok beck jsing
2022-06-29 21:13:34 +00:00
tb
ba90dbc1c2 Refactor use_certificate_chain_* to take ssl/ctx instead of a cert
ok beck jsing
2022-06-29 21:12:19 +00:00
jsing
e7fd08e8b6 Cleanup/simplify ssl_cert_type()
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@
2022-02-03 16:33:12 +00:00
jsing
ef36d1f9e8 Rename CERT to SSL_CERT and CERT_PKEY to SSL_CERT_PKEY.
Nearly all structs in libssl start with an SSL_ suffix, rename CERT and
CERT_PKEY for consistency.

ok inoguchi@ tb@
2022-01-08 12:43:44 +00:00
tb
590ebd80a0 Stop using BIO_s_file_inernal() in libssl.
BIO_s_file_internal() should never have leaked out of libcrypto,
but it did. As a first step of getting rid of it, stop using it
internally.

ok jsing
2021-11-29 18:36:27 +00:00
tb
f1ba087af8 Simplify two weirdly formatted pieces of code in ssl_rsa.c and stop
reaching into the EVP_PKEY struct.

ok inoguchi jsing
2021-11-26 16:40:02 +00:00
tb
526e23522a Unhandroll X509_up_ref()
ok beck jsing
2021-10-23 16:11:30 +00:00
jsing
f7b3b769f9 Indent all labels with a single space.
This ensures that diff reports the correct function prototype.

Prompted by tb@
2021-06-11 11:13:53 +00:00
jsing
10e340b287 Make local header inclusion consistent.
Consistently include local headers in the same location, using the same
grouping/sorting across all files.
2021-05-16 14:10:43 +00:00
tb
2be1b12038 Prepare to provide SSL_use_certificate_chain_file()
This is the same as SSL_CTX_use_certificate_chain_file() but for an
SSL object instead of an SSL_CTX object. remi found this in a recent
librelp update, so we need to provide it. The function will be exposed
in an upcoming library bump.

ok inoguchi on an earlier version, input/ok jsing
2021-03-19 19:51:07 +00:00
jsing
2e83ec4fa7 Rework ssl_ctx_use_certificate_chain_bio() to use the CERT_PKEY chain.
This means that any additional CA certificates end up on the per
certificate chain, rather than the single/shared extra_certs.

Also simplify this code and in particular, avoid setting the return value
to indicate success until we've actually succeeded.

ok beck@ tb@
2019-03-25 16:46:48 +00:00
jsing
ac64f7f4b8 Stop pretending that a cert member in a SSL and SSL_CTX can be NULL.
ok beck@ tb@
2018-11-08 20:55:18 +00:00
tb
0a4fabb92f OpenSSL started adding const to functions all over the place. Make all
our libssl functions match theirs wrt const, except for BIO_f_ssl(3)
which will be fixed in a later step.

this went through a i386 bulk by sthen
ok jsing
2018-04-25 07:10:39 +00:00
beck
c9d7abb729 Change SSLerror() back to taking two args, with the first one being an SSL *.
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-02-07 02:08:38 +00:00
beck
57ef7d8be6 Finish the fallout of the SSLerr->SSLerror cleanup to get rid of the ugly
line wraps that resulted
2017-01-26 12:16:13 +00:00
beck
c37c9edfef Send the error function codes to rot in the depths of hell where they belong
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@
2017-01-26 10:40:21 +00:00
jsing
2da53ce5a2 sk_pop_free() checks for NULL so do not bother doing it from the callers. 2017-01-24 14:57:31 +00:00
beck
c420d3582b move default_passwd_cb and default_passwd_cb_userdata back into
the ssl_ctx from internal - these are used directly by python
and openvpn and a few other things - we have the set accessors
but the get accessors were added in 1.1 and these roll their
own caveat OPENSSL_VERSION chickenpluckery
2017-01-23 22:34:38 +00:00
jsing
1d51f822e3 Move most of the fields in SSL_CTX to internal - the ones that remain are
known to be in use.

ok beck@
2017-01-23 05:13:02 +00:00
jsing
b7f7365c22 Move callback function pointers and argument pointers from SSL_CTX to
internal.

ok beck@
2017-01-23 04:15:28 +00:00
mmcc
0ce686e5e4 X509_free(3) is NULL-safe, so remove NULL checks before its calls.
ok doug@
2016-03-11 07:08:44 +00:00
reyk
642f72f1c1 Rename SSL_CTX_use_certificate_chain() to SSL_CTX_use_certificate_chain_mem().
As discussed with beck@ jsing@ and others
OK beck@
2015-02-06 01:37:11 +00:00
jsing
265bd06d02 Remove trailing whitespace. 2014-12-14 15:30:50 +00:00
jsing
c5899dbc08 Sort and group includes. 2014-11-16 14:12:47 +00:00
reyk
5e89dc0d88 Add a new API function SSL_CTX_use_certificate_chain() that allows to
read the PEM-encoded certificate chain from memory instead of a file.
This idea is derived from an older implementation in relayd that was
needed to use the function with a privep'ed process in a chroot.  Now
it is time to get it into LibreSSL to make the API more privsep-
friendly and to make it available for other programs and the ressl
library.

ok jsing@ miod@
2014-09-28 14:45:48 +00:00
miod
6d04a7b1e8 if (x) FOO_free(x) -> FOO_free(x).
Improves readability, keeps the code smaller so that it is warmer in your
cache.

review & ok deraadt@
2014-07-12 16:03:36 +00:00
guenther
790a986dcb KNF, particularly wrapped lines of calls to PEM_read_bio_FOO() and
multiline comments

ok jsing@
2014-06-22 19:09:37 +00:00
deraadt
c3d6a26af7 tags as requested by miod and tedu 2014-06-12 15:49:27 +00:00
jsing
73c984695c BIO_free has an implicit NULL check, so do not bother checking for NULL
before calling it.
2014-06-07 14:35:31 +00:00
beck
0057b87e06 Any sane platform has stdio. Stop pretending we will ever use a platform
that does not.
"fire bomb" tedu@
2014-05-29 18:27:52 +00:00
tedu
f9cd3d1023 always build in RSA and DSA. ok deraadt miod 2014-04-17 21:37:37 +00:00
jsing
35fb06776c First pass at applying KNF to the OpenSSL code, which almost makes it
readable. This pass is whitespace only and can readily be verified using
tr and md5.
2014-04-14 13:10:35 +00:00
miod
97222edd40 Merge conflicts; remove MacOS, Netware, OS/2, VMS and Windows build machinery. 2014-04-13 15:25:20 +00:00
djm
0a5d6eded2 resolve conflicts, fix local changes 2010-10-01 22:58:41 +00:00
djm
4fcf65c5c5 resolve conflicts 2008-09-06 12:17:47 +00:00
djm
40d8aef356 resolve conflicts 2005-04-29 05:39:09 +00:00
markus
cdc51833b6 merge 0.9.7c; minor bugsfixes;
API addition: ERR_release_err_state_table
[make includes before you build libssl/libcrypto]
2003-11-11 22:15:18 +00:00
markus
1f9308f95c merge openssl-0.9.7-beta3, tested on vax by miod@ 2002-09-10 16:31:53 +00:00
beck
da347917d3 OpenSSL 0.9.7 stable 2002 05 08 merge 2002-05-15 02:29:01 +00:00
beck
913ec97426 OpenSSL 0.9.4 merge 1999-09-29 04:35:07 +00:00