summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2022-02-01Provide our own signature padding defines.Joel Sing
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@
2022-02-01Revise signer callback interface.Joel Sing
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@
2022-01-31Inline RELOC_* into boot_md.c and simplify the code based on whatPhilip Guenther
we can verify at build time. Track dt_pltgot as an Elf_Addr instead of an Elf_Addr* to eliminat casts on both setting and using. Set RELATIVE_RELOC so the ld.so Makefile can verify that it has just the relocation types we expect. Nothing depends on archdep.h pulling in other #includes anymore, so delete the #includes and hide the RELOC_* functions that are only used by lib/csu behind "#ifdef RCRT0" Tested with full build.
2022-01-31Update libexpat to 2.4.4. This fixes CVE-2022-23852 and CVE-2022-23990.Alexander Bluhm
Relevant for OpenBSD are security fixes #550 #551 and other changes #553 (missing in change log). No library bump necessary. OK millert@
2022-01-29Add limits.h for INT_MAX in tls_signer.cKinichiro Inoguchi
ok jsing@ tb@
2022-01-28Error check for sk_push in libsslKinichiro Inoguchi
CID 118976 118979 ok tb@
2022-01-28Error check for sk_push in libsslKinichiro Inoguchi
CID 24838 comment and ok tb@
2022-01-28Only memcpy() into imsg->data if datalen is not 0. Passing a NULL pointerClaudio Jeker
to memcpy() is UB no matter if len is 0. Reported by fouzhe on openbgpd-portable github page. OK tb@
2022-01-28When it's the possessive of 'it', it's spelled "its", without thePhilip Guenther
apostrophe.
2022-01-28Expose tls_signer_error()Joel Sing
Add tls_signer_error to Symbols.list - this was missed during the last libtls minor bump and can ride along. ok deraadt@
2022-01-27sort includes as usualTheo Buehler
2022-01-27Do not depend on engine.h pulling in err.h and evp.hTheo Buehler
2022-01-26whitespaceTheo Buehler
2022-01-25minor bump after api additiomEric Faurot
2022-01-25Introduce a signer interface intented to make TLS privsep simplerEric Faurot
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@
2022-01-25Rewrite paragraph to refer to EVP_CIPHER_CTX_new() and HMAC_CTX_new()Theo Buehler
to match reality. spotted by/ok jmc
2022-01-25Remove some HMAC_CTX_init() remnants in HMAC(3).Theo Buehler
spotted by/ok jmc
2022-01-25Fix another return 0 bug in SSL_shutdown()Theo Buehler
If tls13_recod_layer_send_pending() returns TLS13_IO_EOF, we will bubble this up to the caller via tls13_legacy_return_code(), which translates TLS13_IO_EOF to 0. This can happen if we have pending post handshake-handshake data and the peer closes the pipe. Presumably tls13_legacy_shutdown() should be rewritten yet again. ok jsing
2022-01-25Avoid an infinite loop in SSL_shutdown()Theo Buehler
If the peer closed the write side of the connection and we have not yet received the close_notify, SSL_shutdown() makes an extra read to try and read the peer's close_notify from the pipe. In that situation, we receive EOF. The legacy stack will return -1 while the TLSv1.3 stack will end up returning 0. Since the documentation is not super explicit about what should be done if SSL_shutdown() returns 0, some applications will enter an infinite loop. The code and documentation indicate that SSL_shutdown() should only be called once more if it returned 0. Newer versions of the OpenSSL documentation explicitly say that one should call SSL_read() if SSL_shutdown() returns 0 in order to retrieve the close_notify. Doing this would also have avoided this infinite loop. Reported by Carsten Arzig and bluhm with a test case extracted from the syslogd tests using IO::Socket::SSL, which has such an infinite loop. ok bluhm jsing
2022-01-24Document X509_V_ERR_UNNESTED_RESOURCE. Previous version looked goodTheo Buehler
to claudio
2022-01-24Garbage collect unused ret in ssl3_get_new_session_ticket()Theo Buehler
ret is used to bubble up an error from ssl3_get_message() and is unused otherwise. Zap dead store and silly ret = 1; return ret; ok inoguchi jsing
2022-01-24In ssl3_get_server_key_exchange() switch a 'goto err' toTheo Buehler
'goto fatal_err' so that the illegal_parameter alert is actually sent in case of X509_get0_pubkey() failure. ok inoguchi jsing
2022-01-24Avoid use of uninitialized in tlsext_sni_server_parse()Theo Buehler
If the hostname is too long, tlsext_sni_is_valid_hostname() will fail without having initialized *is_ip. As a result, the garbage value could lead to accepting (but otherwise ignoring) overlong and possibly invalid hostnames without erroring in tlsext_sni_server_parse(). ok inoguchi jsing
2022-01-24Garbage collect the unused rv in tls1_check_ec_server_key() andTheo Buehler
convert to usual form of error checking. ok inoguchi jsing
2022-01-22Use memmove instead of memcpy for overlapping memoryKinichiro Inoguchi
CID 251047 251094 OK beck@ jsing@ millert@ tb@
2022-01-22Use memmove instead of memcpy for overlapping memoryKinichiro Inoguchi
CID 250936 251103 OK beck@ jsing@ millert@ tb@
2022-01-22X509_GET_PUBKEY(3) return value check in libcryptoKinichiro Inoguchi
CID 345116 ok beck@ tb@
2022-01-22X509_GET_PUBKEY(3) return value check in libcryptoKinichiro Inoguchi
CID 25131 ok beck@ tb@ suggest using X509_REQ_get0_pubkey() and remove the EVP_PKEY_free() from tb@
2022-01-22X509_GET_PUBKEY(3) return value check in libcryptoKinichiro Inoguchi
ok beck@ tb@ suggest using X509_get0_pubkey() and remove EVP_PKEY_free() from tb@
2022-01-22X509_GET_PUBKEY(3) return value check in libcryptoKinichiro Inoguchi
ok beck@ tb@
2022-01-22X509_GET_PUBKEY(3) return value check in libcryptoKinichiro Inoguchi
ok beck@ tb@
2022-01-21In 1999 fd_set overflowing beyond FD_SETSIZE became enough of a problem that ITheo de Raadt
changed the entire tree to use fd_set allocation, and this manpage documented the "calloc(howmany(max+1, NFDBITS), sizeof(fd_mask))" idiom. Since then we completed converting the entire tree to poll(2), for many reasons, even ssh/sshd. Now the use of kernel-only sys/param.h-found howmany() and related macross grate on me, so it is time to recommend use of poll(2) instead. [On a related note, MacOS poll(2) is been dangerously broken for many years; that is their problem to handle as the whole ecosystem joins us in pivoting select -> poll) ok millert
2022-01-21Document EAGAIN error return, as specified by POSIX.Todd C. Miller
Our poll does not use EAGAIN but code needs to handle it for portability. OK deraadt@ visa@
2022-01-21Optimization for tiny x in cos and sinGreg Steuck
Subset of FreeBSD commit 4339c67c485f0b1f7699863fc29f6c06862d1dde: Moved the optimization for tiny x from __kernel_{cos,sin}[f](x) to {cos_sin}[f](x) so that x doesn't need to be reclassified in the "kernel" functions to determine if it is tiny (it still needs to be reclassified in the cosine case for other reasons that will go away). ... Parts of the original change were applied separately before. Suggested by kettenis@ OK mbuhl@, tested by mbuhl@ and phessler@
2022-01-21Unplug assembly implementations of trig functions on x86 platformsGreg Steuck
The same change was done by NetBSD some time back as: Disable x87 implementations of sin, cos, tan. The x87 hardware uses a bad approximation to pi for argument reduction, and consequently yields bad answers for inputs near pi or pi/2. OK mbuhl@, tested by mbuhl@ and phessler@
2022-01-21Copy cos(3) software implementation from FreeBSD-13Greg Steuck
The result passes more tests from msun suite. In particular, testacc(cos, -0.34061437849088045332L, 0.94254960031831729956L, ALL_STD_EXCEPT, FE_INEXACT); matches instead of being 1e-16 off. OK mbuhl@, tested by mbuhl@ and phessler@
2022-01-20Remove the remaining three parens in return statements.Theo Buehler
2022-01-20Use correct spelling of NULL.Theo Buehler
2022-01-20remove unused variable from all copies of _asr_strdname()Christian Weisgerber
... including those inlined into print_dname(). This also fixes -Wunused-but-set-variable warnings warnings in smtpd and smtpctl. The code was imported with asr and then copied around. ok deraadt@ guenther@
2022-01-20Add check for EVP_CIPHER_CTX_ctrlKinichiro Inoguchi
suggestion from tb@
2022-01-20Add check for EVP_CIPHER_CTX_set_key_length return valueKinichiro Inoguchi
CID 21653 ok jsing@ millert@ tb@
2022-01-20Add check for OBJ_nid2obj return valueKinichiro Inoguchi
input from tb@
2022-01-20Add check for ASN1_INTEGER_setKinichiro Inoguchi
CID 24893 ok jsing@ millert@ tb@
2022-01-20Fix check for BN_mod_inverse_ct return valueKinichiro Inoguchi
ok jsing@ millert@ tb@
2022-01-20Add check for BN_sub return valueKinichiro Inoguchi
CID 24839 ok jsing@ millert@ tb@
2022-01-20Fix check for BN_mod_inverse_ct return valueKinichiro Inoguchi
ok jsing@ millert@ tb@
2022-01-20Add check for BIO_indent return valueKinichiro Inoguchi
CID 24778 ok jsing@ millert@ tb@
2022-01-20Fix check for BN_mod_inverse_ct return valueKinichiro Inoguchi
ok jsing@ millert@ tb@
2022-01-20Fix check for BN_mod_inverse_ct return valueKinichiro Inoguchi
ok jsing@ millert@ tb@
2022-01-20Add check for BIO_indent return valueKinichiro Inoguchi
CID 24812 ok jsing@ millert@ tb@