Update LibreSSL from version 2.4.4 => 2.9.1
authorMaxim Ag <mewabg@yandex.ru>
Sat, 20 Apr 2019 09:51:47 +0000 (12:51 +0300)
committerzrj <zrj@dragonflybsd.org>
Wed, 24 Apr 2019 16:28:06 +0000 (19:28 +0300)
Submitted-by: Maxim + v2 update to 2.9.1 stable
928 files changed:
crypto/libressl/ChangeLog
crypto/libressl/VERSION
crypto/libressl/apps/nc/atomicio.c
crypto/libressl/apps/nc/atomicio.h
crypto/libressl/apps/nc/compat/accept4.c [deleted file]
crypto/libressl/apps/nc/compat/base64.c [deleted file]
crypto/libressl/apps/nc/compat/readpassphrase.c [deleted file]
crypto/libressl/apps/nc/compat/socket.c [deleted file]
crypto/libressl/apps/nc/compat/strtonum.c [deleted file]
crypto/libressl/apps/nc/compat/sys/socket.h [deleted file]
crypto/libressl/apps/nc/nc.1
crypto/libressl/apps/nc/netcat.c
crypto/libressl/apps/nc/socks.c
crypto/libressl/apps/openssl/apps.c
crypto/libressl/apps/openssl/apps.h
crypto/libressl/apps/openssl/apps_posix.c
crypto/libressl/apps/openssl/apps_win.c [deleted file]
crypto/libressl/apps/openssl/asn1pars.c
crypto/libressl/apps/openssl/ca.c
crypto/libressl/apps/openssl/cert.pem
crypto/libressl/apps/openssl/certhash.c
crypto/libressl/apps/openssl/certhash_win.c [deleted file]
crypto/libressl/apps/openssl/ciphers.c
crypto/libressl/apps/openssl/cms.c [deleted file]
crypto/libressl/apps/openssl/compat/poll_win.c [deleted file]
crypto/libressl/apps/openssl/compat/strtonum.c [deleted file]
crypto/libressl/apps/openssl/crl.c
crypto/libressl/apps/openssl/crl2p7.c
crypto/libressl/apps/openssl/dgst.c
crypto/libressl/apps/openssl/dh.c
crypto/libressl/apps/openssl/dhparam.c
crypto/libressl/apps/openssl/dsa.c
crypto/libressl/apps/openssl/dsaparam.c
crypto/libressl/apps/openssl/ec.c
crypto/libressl/apps/openssl/ecparam.c
crypto/libressl/apps/openssl/enc.c
crypto/libressl/apps/openssl/errstr.c
crypto/libressl/apps/openssl/gendh.c
crypto/libressl/apps/openssl/gendsa.c
crypto/libressl/apps/openssl/genpkey.c
crypto/libressl/apps/openssl/genrsa.c
crypto/libressl/apps/openssl/nseq.c
crypto/libressl/apps/openssl/ocsp.c
crypto/libressl/apps/openssl/openssl.1
crypto/libressl/apps/openssl/openssl.c
crypto/libressl/apps/openssl/passwd.c
crypto/libressl/apps/openssl/pkcs12.c
crypto/libressl/apps/openssl/pkcs7.c
crypto/libressl/apps/openssl/pkcs8.c
crypto/libressl/apps/openssl/pkey.c
crypto/libressl/apps/openssl/pkeyparam.c
crypto/libressl/apps/openssl/pkeyutl.c
crypto/libressl/apps/openssl/prime.c
crypto/libressl/apps/openssl/progs.h
crypto/libressl/apps/openssl/rand.c
crypto/libressl/apps/openssl/req.c
crypto/libressl/apps/openssl/rsa.c
crypto/libressl/apps/openssl/rsautl.c
crypto/libressl/apps/openssl/s_apps.h
crypto/libressl/apps/openssl/s_cb.c
crypto/libressl/apps/openssl/s_client.c
crypto/libressl/apps/openssl/s_server.c
crypto/libressl/apps/openssl/s_socket.c
crypto/libressl/apps/openssl/s_time.c
crypto/libressl/apps/openssl/sess_id.c
crypto/libressl/apps/openssl/smime.c
crypto/libressl/apps/openssl/speed.c
crypto/libressl/apps/openssl/spkac.c
crypto/libressl/apps/openssl/testdsa.h
crypto/libressl/apps/openssl/testrsa.h
crypto/libressl/apps/openssl/timeouts.h
crypto/libressl/apps/openssl/ts.c
crypto/libressl/apps/openssl/verify.c
crypto/libressl/apps/openssl/version.c
crypto/libressl/apps/openssl/x509.c
crypto/libressl/crypto/VERSION
crypto/libressl/crypto/aes/aes-elf-x86_64.S [moved from crypto/libressl/crypto/aes/aes-elf-x86_64.s with 99% similarity]
crypto/libressl/crypto/aes/aes-macosx-x86_64.s [deleted file]
crypto/libressl/crypto/aes/aes_cbc.c
crypto/libressl/crypto/aes/aes_cfb.c [deleted file]
crypto/libressl/crypto/aes/aes_core.c
crypto/libressl/crypto/aes/aes_ctr.c [deleted file]
crypto/libressl/crypto/aes/aes_ecb.c [deleted file]
crypto/libressl/crypto/aes/aes_ige.c
crypto/libressl/crypto/aes/aes_locl.h
crypto/libressl/crypto/aes/aes_misc.c
crypto/libressl/crypto/aes/aes_ofb.c [deleted file]
crypto/libressl/crypto/aes/aes_wrap.c
crypto/libressl/crypto/aes/aesni-elf-x86_64.S [moved from crypto/libressl/crypto/aes/aesni-elf-x86_64.s with 99% similarity]
crypto/libressl/crypto/aes/aesni-macosx-x86_64.s [deleted file]
crypto/libressl/crypto/aes/aesni-sha1-elf-x86_64.S [moved from crypto/libressl/crypto/aes/aesni-sha1-elf-x86_64.s with 99% similarity]
crypto/libressl/crypto/aes/aesni-sha1-macosx-x86_64.s [deleted file]
crypto/libressl/crypto/aes/bsaes-elf-x86_64.S [moved from crypto/libressl/crypto/aes/bsaes-elf-x86_64.s with 99% similarity]
crypto/libressl/crypto/aes/bsaes-macosx-x86_64.s [deleted file]
crypto/libressl/crypto/aes/vpaes-elf-x86_64.S [moved from crypto/libressl/crypto/aes/vpaes-elf-x86_64.s with 98% similarity]
crypto/libressl/crypto/aes/vpaes-macosx-x86_64.s [deleted file]
crypto/libressl/crypto/asn1/a_bitstr.c
crypto/libressl/crypto/asn1/a_bool.c
crypto/libressl/crypto/asn1/a_bytes.c [deleted file]
crypto/libressl/crypto/asn1/a_d2i_fp.c
crypto/libressl/crypto/asn1/a_digest.c
crypto/libressl/crypto/asn1/a_dup.c
crypto/libressl/crypto/asn1/a_enum.c
crypto/libressl/crypto/asn1/a_i2d_fp.c
crypto/libressl/crypto/asn1/a_int.c
crypto/libressl/crypto/asn1/a_mbstr.c
crypto/libressl/crypto/asn1/a_object.c
crypto/libressl/crypto/asn1/a_octet.c
crypto/libressl/crypto/asn1/a_print.c
crypto/libressl/crypto/asn1/a_set.c [deleted file]
crypto/libressl/crypto/asn1/a_sign.c
crypto/libressl/crypto/asn1/a_strex.c
crypto/libressl/crypto/asn1/a_strnid.c
crypto/libressl/crypto/asn1/a_time.c
crypto/libressl/crypto/asn1/a_time_tm.c
crypto/libressl/crypto/asn1/a_type.c
crypto/libressl/crypto/asn1/a_utf8.c
crypto/libressl/crypto/asn1/a_verify.c
crypto/libressl/crypto/asn1/ameth_lib.c
crypto/libressl/crypto/asn1/asn1_err.c
crypto/libressl/crypto/asn1/asn1_gen.c
crypto/libressl/crypto/asn1/asn1_lib.c
crypto/libressl/crypto/asn1/asn1_locl.h
crypto/libressl/crypto/asn1/asn1_par.c
crypto/libressl/crypto/asn1/asn_mime.c
crypto/libressl/crypto/asn1/asn_moid.c
crypto/libressl/crypto/asn1/asn_pack.c
crypto/libressl/crypto/asn1/bio_asn1.c
crypto/libressl/crypto/asn1/bio_ndef.c
crypto/libressl/crypto/asn1/charmap.h
crypto/libressl/crypto/asn1/d2i_pr.c
crypto/libressl/crypto/asn1/d2i_pu.c [deleted file]
crypto/libressl/crypto/asn1/evp_asn1.c
crypto/libressl/crypto/asn1/f_enum.c [deleted file]
crypto/libressl/crypto/asn1/f_int.c
crypto/libressl/crypto/asn1/f_string.c
crypto/libressl/crypto/asn1/i2d_pr.c
crypto/libressl/crypto/asn1/i2d_pu.c [deleted file]
crypto/libressl/crypto/asn1/n_pkey.c
crypto/libressl/crypto/asn1/nsseq.c
crypto/libressl/crypto/asn1/p5_pbe.c
crypto/libressl/crypto/asn1/p5_pbev2.c
crypto/libressl/crypto/asn1/p8_pkey.c
crypto/libressl/crypto/asn1/t_bitst.c [deleted file]
crypto/libressl/crypto/asn1/t_crl.c
crypto/libressl/crypto/asn1/t_pkey.c
crypto/libressl/crypto/asn1/t_req.c
crypto/libressl/crypto/asn1/t_spki.c
crypto/libressl/crypto/asn1/t_x509.c
crypto/libressl/crypto/asn1/t_x509a.c
crypto/libressl/crypto/asn1/tasn_dec.c
crypto/libressl/crypto/asn1/tasn_enc.c
crypto/libressl/crypto/asn1/tasn_fre.c
crypto/libressl/crypto/asn1/tasn_new.c
crypto/libressl/crypto/asn1/tasn_prn.c
crypto/libressl/crypto/asn1/tasn_typ.c
crypto/libressl/crypto/asn1/tasn_utl.c
crypto/libressl/crypto/asn1/x_algor.c
crypto/libressl/crypto/asn1/x_attrib.c
crypto/libressl/crypto/asn1/x_bignum.c
crypto/libressl/crypto/asn1/x_crl.c
crypto/libressl/crypto/asn1/x_exten.c
crypto/libressl/crypto/asn1/x_info.c
crypto/libressl/crypto/asn1/x_long.c
crypto/libressl/crypto/asn1/x_name.c
crypto/libressl/crypto/asn1/x_nx509.c
crypto/libressl/crypto/asn1/x_pkey.c
crypto/libressl/crypto/asn1/x_pubkey.c
crypto/libressl/crypto/asn1/x_req.c
crypto/libressl/crypto/asn1/x_sig.c
crypto/libressl/crypto/asn1/x_spki.c
crypto/libressl/crypto/asn1/x_val.c
crypto/libressl/crypto/asn1/x_x509.c
crypto/libressl/crypto/asn1/x_x509a.c
crypto/libressl/crypto/bf/bf_cfb64.c
crypto/libressl/crypto/bf/bf_ecb.c
crypto/libressl/crypto/bf/bf_enc.c
crypto/libressl/crypto/bf/bf_locl.h
crypto/libressl/crypto/bf/bf_ofb64.c
crypto/libressl/crypto/bf/bf_pi.h
crypto/libressl/crypto/bf/bf_skey.c
crypto/libressl/crypto/bio/b_dump.c
crypto/libressl/crypto/bio/b_posix.c
crypto/libressl/crypto/bio/b_print.c
crypto/libressl/crypto/bio/b_sock.c
crypto/libressl/crypto/bio/b_win.c [deleted file]
crypto/libressl/crypto/bio/bf_buff.c
crypto/libressl/crypto/bio/bf_nbio.c
crypto/libressl/crypto/bio/bf_null.c [deleted file]
crypto/libressl/crypto/bio/bio_cb.c
crypto/libressl/crypto/bio/bio_err.c
crypto/libressl/crypto/bio/bio_lib.c
crypto/libressl/crypto/bio/bss_acpt.c
crypto/libressl/crypto/bio/bss_bio.c [deleted file]
crypto/libressl/crypto/bio/bss_conn.c
crypto/libressl/crypto/bio/bss_dgram.c
crypto/libressl/crypto/bio/bss_fd.c
crypto/libressl/crypto/bio/bss_file.c
crypto/libressl/crypto/bio/bss_log.c [deleted file]
crypto/libressl/crypto/bio/bss_mem.c
crypto/libressl/crypto/bio/bss_null.c
crypto/libressl/crypto/bio/bss_sock.c
crypto/libressl/crypto/bn/bn_add.c
crypto/libressl/crypto/bn/bn_asm.c
crypto/libressl/crypto/bn/bn_blind.c
crypto/libressl/crypto/bn/bn_const.c
crypto/libressl/crypto/bn/bn_ctx.c
crypto/libressl/crypto/bn/bn_depr.c [deleted file]
crypto/libressl/crypto/bn/bn_div.c
crypto/libressl/crypto/bn/bn_err.c
crypto/libressl/crypto/bn/bn_exp.c
crypto/libressl/crypto/bn/bn_exp2.c
crypto/libressl/crypto/bn/bn_gcd.c
crypto/libressl/crypto/bn/bn_gf2m.c
crypto/libressl/crypto/bn/bn_kron.c
crypto/libressl/crypto/bn/bn_lcl.h
crypto/libressl/crypto/bn/bn_lib.c
crypto/libressl/crypto/bn/bn_mod.c
crypto/libressl/crypto/bn/bn_mont.c
crypto/libressl/crypto/bn/bn_mpi.c [deleted file]
crypto/libressl/crypto/bn/bn_mul.c
crypto/libressl/crypto/bn/bn_nist.c
crypto/libressl/crypto/bn/bn_prime.c
crypto/libressl/crypto/bn/bn_prime.h
crypto/libressl/crypto/bn/bn_print.c
crypto/libressl/crypto/bn/bn_rand.c
crypto/libressl/crypto/bn/bn_recp.c
crypto/libressl/crypto/bn/bn_shift.c
crypto/libressl/crypto/bn/bn_sqr.c
crypto/libressl/crypto/bn/bn_sqrt.c
crypto/libressl/crypto/bn/bn_word.c
crypto/libressl/crypto/bn/bn_x931p.c [deleted file]
crypto/libressl/crypto/bn/gf2m-elf-x86_64.S [moved from crypto/libressl/crypto/bn/gf2m-elf-x86_64.s with 97% similarity]
crypto/libressl/crypto/bn/gf2m-macosx-x86_64.s [deleted file]
crypto/libressl/crypto/bn/modexp512-elf-x86_64.S [moved from crypto/libressl/crypto/bn/modexp512-elf-x86_64.s with 99% similarity]
crypto/libressl/crypto/bn/modexp512-macosx-x86_64.s [deleted file]
crypto/libressl/crypto/bn/mont-elf-x86_64.S [moved from crypto/libressl/crypto/bn/mont-elf-x86_64.s with 99% similarity]
crypto/libressl/crypto/bn/mont-macosx-x86_64.s [deleted file]
crypto/libressl/crypto/bn/mont5-elf-x86_64.S [moved from crypto/libressl/crypto/bn/mont5-elf-x86_64.s with 51% similarity]
crypto/libressl/crypto/bn/mont5-macosx-x86_64.s [deleted file]
crypto/libressl/crypto/buffer/buf_err.c
crypto/libressl/crypto/buffer/buf_str.c [deleted file]
crypto/libressl/crypto/buffer/buffer.c
crypto/libressl/crypto/camellia/camellia.c
crypto/libressl/crypto/camellia/camellia.h [deleted file]
crypto/libressl/crypto/camellia/cmll-elf-x86_64.S [moved from crypto/libressl/crypto/camellia/cmll-elf-x86_64.s with 99% similarity]
crypto/libressl/crypto/camellia/cmll-macosx-x86_64.s [deleted file]
crypto/libressl/crypto/camellia/cmll_cbc.c
crypto/libressl/crypto/camellia/cmll_cfb.c
crypto/libressl/crypto/camellia/cmll_ctr.c
crypto/libressl/crypto/camellia/cmll_ecb.c
crypto/libressl/crypto/camellia/cmll_locl.h
crypto/libressl/crypto/camellia/cmll_misc.c
crypto/libressl/crypto/camellia/cmll_ofb.c
crypto/libressl/crypto/cast/c_cfb64.c
crypto/libressl/crypto/cast/c_ecb.c
crypto/libressl/crypto/cast/c_enc.c
crypto/libressl/crypto/cast/c_ofb64.c
crypto/libressl/crypto/cast/c_skey.c
crypto/libressl/crypto/cast/cast_lcl.h
crypto/libressl/crypto/cast/cast_s.h
crypto/libressl/crypto/chacha/chacha-merged.c
crypto/libressl/crypto/chacha/chacha.c
crypto/libressl/crypto/cmac/cm_ameth.c
crypto/libressl/crypto/cmac/cm_pmeth.c
crypto/libressl/crypto/cmac/cmac.c
crypto/libressl/crypto/comp/c_rle.c [deleted file]
crypto/libressl/crypto/comp/c_zlib.c [deleted file]
crypto/libressl/crypto/comp/comp_err.c [deleted file]
crypto/libressl/crypto/comp/comp_lib.c [deleted file]
crypto/libressl/crypto/compat/arc4random.c [deleted file]
crypto/libressl/crypto/compat/arc4random.h [deleted file]
crypto/libressl/crypto/compat/arc4random_aix.h [deleted file]
crypto/libressl/crypto/compat/arc4random_freebsd.h [deleted file]
crypto/libressl/crypto/compat/arc4random_hpux.h [deleted file]
crypto/libressl/crypto/compat/arc4random_linux.h [deleted file]
crypto/libressl/crypto/compat/arc4random_netbsd.h [deleted file]
crypto/libressl/crypto/compat/arc4random_osx.h [deleted file]
crypto/libressl/crypto/compat/arc4random_solaris.h [deleted file]
crypto/libressl/crypto/compat/arc4random_uniform.c [deleted file]
crypto/libressl/crypto/compat/arc4random_win.h [deleted file]
crypto/libressl/crypto/compat/bsd-asprintf.c [deleted file]
crypto/libressl/crypto/compat/chacha_private.h [deleted file]
crypto/libressl/crypto/compat/explicit_bzero.c [deleted file]
crypto/libressl/crypto/compat/explicit_bzero_win.c [deleted file]
crypto/libressl/crypto/compat/getentropy_aix.c [deleted file]
crypto/libressl/crypto/compat/getentropy_freebsd.c [deleted file]
crypto/libressl/crypto/compat/getentropy_hpux.c [deleted file]
crypto/libressl/crypto/compat/getentropy_linux.c [deleted file]
crypto/libressl/crypto/compat/getentropy_netbsd.c [deleted file]
crypto/libressl/crypto/compat/getentropy_osx.c [deleted file]
crypto/libressl/crypto/compat/getentropy_solaris.c [deleted file]
crypto/libressl/crypto/compat/getentropy_win.c [deleted file]
crypto/libressl/crypto/compat/inet_pton.c [deleted file]
crypto/libressl/crypto/compat/posix_win.c [deleted file]
crypto/libressl/crypto/compat/reallocarray.c [deleted file]
crypto/libressl/crypto/compat/strcasecmp.c [deleted file]
crypto/libressl/crypto/compat/strlcat.c [deleted file]
crypto/libressl/crypto/compat/strlcpy.c [deleted file]
crypto/libressl/crypto/compat/strndup.c [deleted file]
crypto/libressl/crypto/compat/timegm.c [deleted file]
crypto/libressl/crypto/compat/timingsafe_bcmp.c [deleted file]
crypto/libressl/crypto/compat/timingsafe_memcmp.c [deleted file]
crypto/libressl/crypto/conf/conf_api.c
crypto/libressl/crypto/conf/conf_def.c
crypto/libressl/crypto/conf/conf_def.h
crypto/libressl/crypto/conf/conf_err.c
crypto/libressl/crypto/conf/conf_lib.c
crypto/libressl/crypto/conf/conf_mall.c
crypto/libressl/crypto/conf/conf_mod.c
crypto/libressl/crypto/conf/conf_sap.c
crypto/libressl/crypto/constant_time_locl.h
crypto/libressl/crypto/cpt_err.c
crypto/libressl/crypto/cpuid-elf-x86_64.S
crypto/libressl/crypto/cpuid-macosx-x86_64.S [deleted file]
crypto/libressl/crypto/cryptlib.c
crypto/libressl/crypto/cryptlib.h
crypto/libressl/crypto/crypto_init.c [new file with mode: 0644]
crypto/libressl/crypto/crypto_lock.c [new file with mode: 0644]
crypto/libressl/crypto/curve25519/curve25519-generic.c [new file with mode: 0644]
crypto/libressl/crypto/curve25519/curve25519.c [new file with mode: 0644]
crypto/libressl/crypto/curve25519/curve25519_internal.h [new file with mode: 0644]
crypto/libressl/crypto/cversion.c
crypto/libressl/crypto/des/cbc_cksm.c [deleted file]
crypto/libressl/crypto/des/cbc_enc.c
crypto/libressl/crypto/des/cfb64ede.c
crypto/libressl/crypto/des/cfb64enc.c
crypto/libressl/crypto/des/cfb_enc.c
crypto/libressl/crypto/des/des_enc.c
crypto/libressl/crypto/des/des_locl.h
crypto/libressl/crypto/des/ecb3_enc.c
crypto/libressl/crypto/des/ecb_enc.c
crypto/libressl/crypto/des/ede_cbcm_enc.c [deleted file]
crypto/libressl/crypto/des/enc_read.c [deleted file]
crypto/libressl/crypto/des/enc_writ.c [deleted file]
crypto/libressl/crypto/des/fcrypt.c
crypto/libressl/crypto/des/fcrypt_b.c
crypto/libressl/crypto/des/ncbc_enc.c
crypto/libressl/crypto/des/ofb64ede.c
crypto/libressl/crypto/des/ofb64enc.c
crypto/libressl/crypto/des/ofb_enc.c [deleted file]
crypto/libressl/crypto/des/pcbc_enc.c [deleted file]
crypto/libressl/crypto/des/qud_cksm.c [deleted file]
crypto/libressl/crypto/des/rand_key.c
crypto/libressl/crypto/des/set_key.c
crypto/libressl/crypto/des/spr.h
crypto/libressl/crypto/des/str2key.c [deleted file]
crypto/libressl/crypto/des/xcbc_enc.c
crypto/libressl/crypto/dh/dh_ameth.c
crypto/libressl/crypto/dh/dh_asn1.c
crypto/libressl/crypto/dh/dh_check.c
crypto/libressl/crypto/dh/dh_depr.c [deleted file]
crypto/libressl/crypto/dh/dh_err.c
crypto/libressl/crypto/dh/dh_gen.c
crypto/libressl/crypto/dh/dh_key.c
crypto/libressl/crypto/dh/dh_lib.c
crypto/libressl/crypto/dh/dh_pmeth.c
crypto/libressl/crypto/dh/dh_prn.c
crypto/libressl/crypto/dsa/dsa_ameth.c
crypto/libressl/crypto/dsa/dsa_asn1.c
crypto/libressl/crypto/dsa/dsa_depr.c
crypto/libressl/crypto/dsa/dsa_err.c
crypto/libressl/crypto/dsa/dsa_gen.c
crypto/libressl/crypto/dsa/dsa_key.c
crypto/libressl/crypto/dsa/dsa_lib.c
crypto/libressl/crypto/dsa/dsa_locl.h
crypto/libressl/crypto/dsa/dsa_meth.c [new file with mode: 0644]
crypto/libressl/crypto/dsa/dsa_ossl.c
crypto/libressl/crypto/dsa/dsa_pmeth.c
crypto/libressl/crypto/dsa/dsa_prn.c
crypto/libressl/crypto/dsa/dsa_sign.c
crypto/libressl/crypto/dsa/dsa_vrf.c
crypto/libressl/crypto/dso/dso_dlfcn.c [deleted file]
crypto/libressl/crypto/dso/dso_err.c
crypto/libressl/crypto/dso/dso_lib.c
crypto/libressl/crypto/dso/dso_null.c
crypto/libressl/crypto/dso/dso_openssl.c
crypto/libressl/crypto/ec/ec2_mult.c
crypto/libressl/crypto/ec/ec2_oct.c
crypto/libressl/crypto/ec/ec2_smpl.c
crypto/libressl/crypto/ec/ec_ameth.c
crypto/libressl/crypto/ec/ec_asn1.c
crypto/libressl/crypto/ec/ec_check.c
crypto/libressl/crypto/ec/ec_curve.c
crypto/libressl/crypto/ec/ec_cvt.c
crypto/libressl/crypto/ec/ec_err.c
crypto/libressl/crypto/ec/ec_key.c
crypto/libressl/crypto/ec/ec_kmeth.c [new file with mode: 0644]
crypto/libressl/crypto/ec/ec_lcl.h
crypto/libressl/crypto/ec/ec_lib.c
crypto/libressl/crypto/ec/ec_mult.c
crypto/libressl/crypto/ec/ec_oct.c
crypto/libressl/crypto/ec/ec_pmeth.c
crypto/libressl/crypto/ec/ec_print.c
crypto/libressl/crypto/ec/eck_prn.c
crypto/libressl/crypto/ec/ecp_mont.c
crypto/libressl/crypto/ec/ecp_nist.c
crypto/libressl/crypto/ec/ecp_oct.c
crypto/libressl/crypto/ec/ecp_smpl.c
crypto/libressl/crypto/ecdh/ech_err.c
crypto/libressl/crypto/ecdh/ech_key.c
crypto/libressl/crypto/ecdh/ech_lib.c
crypto/libressl/crypto/ecdh/ech_locl.h
crypto/libressl/crypto/ecdsa/ecs_asn1.c
crypto/libressl/crypto/ecdsa/ecs_err.c
crypto/libressl/crypto/ecdsa/ecs_lib.c
crypto/libressl/crypto/ecdsa/ecs_locl.h
crypto/libressl/crypto/ecdsa/ecs_ossl.c
crypto/libressl/crypto/ecdsa/ecs_sign.c
crypto/libressl/crypto/ecdsa/ecs_vrf.c
crypto/libressl/crypto/engine/eng_all.c [deleted file]
crypto/libressl/crypto/engine/eng_cnf.c [deleted file]
crypto/libressl/crypto/engine/eng_ctrl.c [deleted file]
crypto/libressl/crypto/engine/eng_dyn.c [deleted file]
crypto/libressl/crypto/engine/eng_err.c [deleted file]
crypto/libressl/crypto/engine/eng_fat.c [deleted file]
crypto/libressl/crypto/engine/eng_init.c [deleted file]
crypto/libressl/crypto/engine/eng_int.h [deleted file]
crypto/libressl/crypto/engine/eng_lib.c [deleted file]
crypto/libressl/crypto/engine/eng_list.c [deleted file]
crypto/libressl/crypto/engine/eng_openssl.c [deleted file]
crypto/libressl/crypto/engine/eng_pkey.c [deleted file]
crypto/libressl/crypto/engine/eng_table.c [deleted file]
crypto/libressl/crypto/engine/tb_asnmth.c [deleted file]
crypto/libressl/crypto/engine/tb_cipher.c [deleted file]
crypto/libressl/crypto/engine/tb_dh.c [deleted file]
crypto/libressl/crypto/engine/tb_digest.c [deleted file]
crypto/libressl/crypto/engine/tb_dsa.c [deleted file]
crypto/libressl/crypto/engine/tb_ecdh.c [deleted file]
crypto/libressl/crypto/engine/tb_ecdsa.c [deleted file]
crypto/libressl/crypto/engine/tb_pkmeth.c [deleted file]
crypto/libressl/crypto/engine/tb_rand.c [deleted file]
crypto/libressl/crypto/engine/tb_rsa.c [deleted file]
crypto/libressl/crypto/engine/tb_store.c [deleted file]
crypto/libressl/crypto/err/err.c
crypto/libressl/crypto/err/err_all.c
crypto/libressl/crypto/err/err_prn.c
crypto/libressl/crypto/evp/bio_b64.c
crypto/libressl/crypto/evp/bio_enc.c
crypto/libressl/crypto/evp/bio_md.c
crypto/libressl/crypto/evp/c_all.c
crypto/libressl/crypto/evp/digest.c
crypto/libressl/crypto/evp/e_aes.c
crypto/libressl/crypto/evp/e_aes_cbc_hmac_sha1.c
crypto/libressl/crypto/evp/e_bf.c
crypto/libressl/crypto/evp/e_camellia.c
crypto/libressl/crypto/evp/e_cast.c
crypto/libressl/crypto/evp/e_chacha.c
crypto/libressl/crypto/evp/e_chacha20poly1305.c
crypto/libressl/crypto/evp/e_des.c
crypto/libressl/crypto/evp/e_des3.c
crypto/libressl/crypto/evp/e_gost2814789.c
crypto/libressl/crypto/evp/e_idea.c
crypto/libressl/crypto/evp/e_null.c
crypto/libressl/crypto/evp/e_old.c [deleted file]
crypto/libressl/crypto/evp/e_rc2.c
crypto/libressl/crypto/evp/e_rc4.c
crypto/libressl/crypto/evp/e_rc4_hmac_md5.c
crypto/libressl/crypto/evp/e_sm4.c [new file with mode: 0644]
crypto/libressl/crypto/evp/e_xcbc_d.c
crypto/libressl/crypto/evp/encode.c
crypto/libressl/crypto/evp/evp_aead.c
crypto/libressl/crypto/evp/evp_enc.c
crypto/libressl/crypto/evp/evp_err.c
crypto/libressl/crypto/evp/evp_key.c
crypto/libressl/crypto/evp/evp_lib.c
crypto/libressl/crypto/evp/evp_locl.h
crypto/libressl/crypto/evp/evp_pbe.c
crypto/libressl/crypto/evp/evp_pkey.c
crypto/libressl/crypto/evp/m_dss.c
crypto/libressl/crypto/evp/m_dss1.c
crypto/libressl/crypto/evp/m_ecdsa.c
crypto/libressl/crypto/evp/m_gost2814789.c
crypto/libressl/crypto/evp/m_gostr341194.c
crypto/libressl/crypto/evp/m_md4.c
crypto/libressl/crypto/evp/m_md5.c
crypto/libressl/crypto/evp/m_md5_sha1.c [new file with mode: 0644]
crypto/libressl/crypto/evp/m_null.c [deleted file]
crypto/libressl/crypto/evp/m_ripemd.c
crypto/libressl/crypto/evp/m_sha1.c
crypto/libressl/crypto/evp/m_sigver.c
crypto/libressl/crypto/evp/m_sm3.c [new file with mode: 0644]
crypto/libressl/crypto/evp/m_streebog.c
crypto/libressl/crypto/evp/m_wp.c
crypto/libressl/crypto/evp/names.c
crypto/libressl/crypto/evp/p5_crpt.c
crypto/libressl/crypto/evp/p5_crpt2.c
crypto/libressl/crypto/evp/p_dec.c [deleted file]
crypto/libressl/crypto/evp/p_enc.c [deleted file]
crypto/libressl/crypto/evp/p_lib.c
crypto/libressl/crypto/evp/p_open.c [deleted file]
crypto/libressl/crypto/evp/p_seal.c [deleted file]
crypto/libressl/crypto/evp/p_sign.c
crypto/libressl/crypto/evp/p_verify.c
crypto/libressl/crypto/evp/pmeth_fn.c
crypto/libressl/crypto/evp/pmeth_gn.c
crypto/libressl/crypto/evp/pmeth_lib.c
crypto/libressl/crypto/ex_data.c
crypto/libressl/crypto/gost/gost.h [deleted file]
crypto/libressl/crypto/gost/gost2814789.c
crypto/libressl/crypto/gost/gost89_keywrap.c
crypto/libressl/crypto/gost/gost89_params.c
crypto/libressl/crypto/gost/gost89imit_ameth.c
crypto/libressl/crypto/gost/gost89imit_pmeth.c
crypto/libressl/crypto/gost/gost_asn1.h
crypto/libressl/crypto/gost/gost_err.c
crypto/libressl/crypto/gost/gost_locl.h
crypto/libressl/crypto/gost/gostr341001.c
crypto/libressl/crypto/gost/gostr341001_ameth.c
crypto/libressl/crypto/gost/gostr341001_key.c
crypto/libressl/crypto/gost/gostr341001_params.c
crypto/libressl/crypto/gost/gostr341001_pmeth.c
crypto/libressl/crypto/gost/gostr341194.c
crypto/libressl/crypto/gost/streebog.c
crypto/libressl/crypto/hkdf/hkdf.c [new file with mode: 0644]
crypto/libressl/crypto/hmac/hm_ameth.c
crypto/libressl/crypto/hmac/hm_pmeth.c
crypto/libressl/crypto/hmac/hmac.c
crypto/libressl/crypto/idea/i_cbc.c
crypto/libressl/crypto/idea/i_cfb64.c
crypto/libressl/crypto/idea/i_ecb.c
crypto/libressl/crypto/idea/i_ofb64.c
crypto/libressl/crypto/idea/i_skey.c
crypto/libressl/crypto/idea/idea_lcl.h
crypto/libressl/crypto/krb5/krb5_asn.c [deleted file]
crypto/libressl/crypto/lhash/lh_stats.c
crypto/libressl/crypto/lhash/lhash.c
crypto/libressl/crypto/malloc-wrapper.c [deleted file]
crypto/libressl/crypto/md32_common.h
crypto/libressl/crypto/md4/md4_dgst.c
crypto/libressl/crypto/md4/md4_locl.h
crypto/libressl/crypto/md4/md4_one.c
crypto/libressl/crypto/md5/md5-elf-x86_64.S [moved from crypto/libressl/crypto/md5/md5-elf-x86_64.s with 99% similarity]
crypto/libressl/crypto/md5/md5-macosx-x86_64.s [deleted file]
crypto/libressl/crypto/md5/md5_dgst.c
crypto/libressl/crypto/md5/md5_locl.h
crypto/libressl/crypto/md5/md5_one.c
crypto/libressl/crypto/mem_clr.c [deleted file]
crypto/libressl/crypto/mem_dbg.c
crypto/libressl/crypto/modes/cbc128.c
crypto/libressl/crypto/modes/ccm128.c
crypto/libressl/crypto/modes/cfb128.c
crypto/libressl/crypto/modes/ctr128.c
crypto/libressl/crypto/modes/cts128.c [deleted file]
crypto/libressl/crypto/modes/gcm128.c
crypto/libressl/crypto/modes/ghash-elf-x86_64.S [moved from crypto/libressl/crypto/modes/ghash-elf-x86_64.s with 99% similarity]
crypto/libressl/crypto/modes/ghash-macosx-x86_64.s [deleted file]
crypto/libressl/crypto/modes/modes_lcl.h
crypto/libressl/crypto/modes/ofb128.c
crypto/libressl/crypto/modes/xts128.c
crypto/libressl/crypto/o_init.c
crypto/libressl/crypto/o_str.c [deleted file]
crypto/libressl/crypto/o_time.c
crypto/libressl/crypto/o_time.h
crypto/libressl/crypto/objects/o_names.c
crypto/libressl/crypto/objects/obj_dat.c
crypto/libressl/crypto/objects/obj_dat.h
crypto/libressl/crypto/objects/obj_err.c
crypto/libressl/crypto/objects/obj_lib.c
crypto/libressl/crypto/objects/obj_xref.c
crypto/libressl/crypto/objects/obj_xref.h
crypto/libressl/crypto/ocsp/ocsp_asn.c
crypto/libressl/crypto/ocsp/ocsp_cl.c
crypto/libressl/crypto/ocsp/ocsp_err.c
crypto/libressl/crypto/ocsp/ocsp_ext.c
crypto/libressl/crypto/ocsp/ocsp_ht.c
crypto/libressl/crypto/ocsp/ocsp_lib.c
crypto/libressl/crypto/ocsp/ocsp_prn.c
crypto/libressl/crypto/ocsp/ocsp_srv.c
crypto/libressl/crypto/ocsp/ocsp_vfy.c
crypto/libressl/crypto/pem/pem_all.c
crypto/libressl/crypto/pem/pem_err.c
crypto/libressl/crypto/pem/pem_info.c
crypto/libressl/crypto/pem/pem_lib.c
crypto/libressl/crypto/pem/pem_oth.c
crypto/libressl/crypto/pem/pem_pk8.c
crypto/libressl/crypto/pem/pem_pkey.c
crypto/libressl/crypto/pem/pem_seal.c [deleted file]
crypto/libressl/crypto/pem/pem_sign.c [deleted file]
crypto/libressl/crypto/pem/pem_x509.c
crypto/libressl/crypto/pem/pem_xaux.c
crypto/libressl/crypto/pem/pvkfmt.c
crypto/libressl/crypto/pkcs12/p12_add.c
crypto/libressl/crypto/pkcs12/p12_asn.c
crypto/libressl/crypto/pkcs12/p12_attr.c
crypto/libressl/crypto/pkcs12/p12_crpt.c
crypto/libressl/crypto/pkcs12/p12_crt.c
crypto/libressl/crypto/pkcs12/p12_decr.c
crypto/libressl/crypto/pkcs12/p12_init.c
crypto/libressl/crypto/pkcs12/p12_key.c
crypto/libressl/crypto/pkcs12/p12_kiss.c
crypto/libressl/crypto/pkcs12/p12_mutl.c
crypto/libressl/crypto/pkcs12/p12_npas.c [deleted file]
crypto/libressl/crypto/pkcs12/p12_p8d.c
crypto/libressl/crypto/pkcs12/p12_p8e.c
crypto/libressl/crypto/pkcs12/p12_utl.c
crypto/libressl/crypto/pkcs12/pk12err.c
crypto/libressl/crypto/pkcs7/bio_pk7.c [deleted file]
crypto/libressl/crypto/pkcs7/pk7_asn1.c
crypto/libressl/crypto/pkcs7/pk7_attr.c
crypto/libressl/crypto/pkcs7/pk7_doit.c
crypto/libressl/crypto/pkcs7/pk7_lib.c
crypto/libressl/crypto/pkcs7/pk7_mime.c
crypto/libressl/crypto/pkcs7/pk7_smime.c
crypto/libressl/crypto/pkcs7/pkcs7err.c
crypto/libressl/crypto/poly1305/poly1305-donna.c
crypto/libressl/crypto/poly1305/poly1305.c
crypto/libressl/crypto/rand/rand_err.c
crypto/libressl/crypto/rand/rand_lib.c
crypto/libressl/crypto/rand/randfile.c [deleted file]
crypto/libressl/crypto/rc2/rc2_cbc.c
crypto/libressl/crypto/rc2/rc2_ecb.c
crypto/libressl/crypto/rc2/rc2_locl.h
crypto/libressl/crypto/rc2/rc2_skey.c
crypto/libressl/crypto/rc2/rc2cfb64.c
crypto/libressl/crypto/rc2/rc2ofb64.c
crypto/libressl/crypto/rc4/rc4-elf-x86_64.S [moved from crypto/libressl/crypto/rc4/rc4-elf-x86_64.s with 98% similarity]
crypto/libressl/crypto/rc4/rc4-macosx-x86_64.s [deleted file]
crypto/libressl/crypto/rc4/rc4-md5-elf-x86_64.S [moved from crypto/libressl/crypto/rc4/rc4-md5-elf-x86_64.s with 99% similarity]
crypto/libressl/crypto/rc4/rc4-md5-macosx-x86_64.s [deleted file]
crypto/libressl/crypto/rc4/rc4_enc.c
crypto/libressl/crypto/rc4/rc4_locl.h
crypto/libressl/crypto/rc4/rc4_skey.c
crypto/libressl/crypto/ripemd/rmd_dgst.c
crypto/libressl/crypto/ripemd/rmd_locl.h
crypto/libressl/crypto/ripemd/rmd_one.c
crypto/libressl/crypto/ripemd/rmdconst.h
crypto/libressl/crypto/rsa/rsa_ameth.c
crypto/libressl/crypto/rsa/rsa_asn1.c
crypto/libressl/crypto/rsa/rsa_chk.c
crypto/libressl/crypto/rsa/rsa_crpt.c
crypto/libressl/crypto/rsa/rsa_depr.c
crypto/libressl/crypto/rsa/rsa_eay.c
crypto/libressl/crypto/rsa/rsa_err.c
crypto/libressl/crypto/rsa/rsa_gen.c
crypto/libressl/crypto/rsa/rsa_lib.c
crypto/libressl/crypto/rsa/rsa_locl.h
crypto/libressl/crypto/rsa/rsa_meth.c [new file with mode: 0644]
crypto/libressl/crypto/rsa/rsa_none.c
crypto/libressl/crypto/rsa/rsa_oaep.c
crypto/libressl/crypto/rsa/rsa_pk1.c
crypto/libressl/crypto/rsa/rsa_pmeth.c
crypto/libressl/crypto/rsa/rsa_prn.c
crypto/libressl/crypto/rsa/rsa_pss.c
crypto/libressl/crypto/rsa/rsa_saos.c [deleted file]
crypto/libressl/crypto/rsa/rsa_sign.c
crypto/libressl/crypto/rsa/rsa_ssl.c [deleted file]
crypto/libressl/crypto/rsa/rsa_x931.c
crypto/libressl/crypto/sha/sha1-elf-x86_64.S [moved from crypto/libressl/crypto/sha/sha1-elf-x86_64.s with 99% similarity]
crypto/libressl/crypto/sha/sha1-macosx-x86_64.s [deleted file]
crypto/libressl/crypto/sha/sha1_one.c
crypto/libressl/crypto/sha/sha1dgst.c
crypto/libressl/crypto/sha/sha256-elf-x86_64.S
crypto/libressl/crypto/sha/sha256-macosx-x86_64.S [deleted file]
crypto/libressl/crypto/sha/sha256.c
crypto/libressl/crypto/sha/sha512-elf-x86_64.S
crypto/libressl/crypto/sha/sha512-macosx-x86_64.S [deleted file]
crypto/libressl/crypto/sha/sha512.c
crypto/libressl/crypto/sha/sha_locl.h
crypto/libressl/crypto/sm3/sm3.c [new file with mode: 0644]
crypto/libressl/crypto/sm3/sm3_locl.h [new file with mode: 0644]
crypto/libressl/crypto/sm4/sm4.c [new file with mode: 0644]
crypto/libressl/crypto/stack/stack.c
crypto/libressl/crypto/ts/ts_asn1.c
crypto/libressl/crypto/ts/ts_conf.c
crypto/libressl/crypto/ts/ts_err.c
crypto/libressl/crypto/ts/ts_lib.c
crypto/libressl/crypto/ts/ts_req_print.c
crypto/libressl/crypto/ts/ts_req_utils.c
crypto/libressl/crypto/ts/ts_rsp_print.c
crypto/libressl/crypto/ts/ts_rsp_sign.c
crypto/libressl/crypto/ts/ts_rsp_utils.c
crypto/libressl/crypto/ts/ts_rsp_verify.c
crypto/libressl/crypto/ts/ts_verify_ctx.c
crypto/libressl/crypto/txt_db/txt_db.c
crypto/libressl/crypto/ui/ui_err.c
crypto/libressl/crypto/ui/ui_lib.c
crypto/libressl/crypto/ui/ui_locl.h
crypto/libressl/crypto/ui/ui_openssl.c
crypto/libressl/crypto/ui/ui_openssl_win.c [deleted file]
crypto/libressl/crypto/ui/ui_util.c [deleted file]
crypto/libressl/crypto/whrlpool/wp-elf-x86_64.S [moved from crypto/libressl/crypto/whrlpool/wp-elf-x86_64.s with 99% similarity]
crypto/libressl/crypto/whrlpool/wp-macosx-x86_64.s [deleted file]
crypto/libressl/crypto/whrlpool/wp_block.c
crypto/libressl/crypto/whrlpool/wp_dgst.c
crypto/libressl/crypto/whrlpool/wp_locl.h
crypto/libressl/crypto/x509/by_dir.c
crypto/libressl/crypto/x509/by_file.c
crypto/libressl/crypto/x509/by_mem.c
crypto/libressl/crypto/x509/vpm_int.h [copied from crypto/libressl/crypto/x509/x509_lcl.h with 77% similarity]
crypto/libressl/crypto/x509/x509_att.c
crypto/libressl/crypto/x509/x509_cmp.c
crypto/libressl/crypto/x509/x509_d2.c
crypto/libressl/crypto/x509/x509_def.c
crypto/libressl/crypto/x509/x509_err.c
crypto/libressl/crypto/x509/x509_ext.c
crypto/libressl/crypto/x509/x509_lcl.h
crypto/libressl/crypto/x509/x509_lu.c
crypto/libressl/crypto/x509/x509_obj.c
crypto/libressl/crypto/x509/x509_r2x.c
crypto/libressl/crypto/x509/x509_req.c
crypto/libressl/crypto/x509/x509_set.c
crypto/libressl/crypto/x509/x509_trs.c
crypto/libressl/crypto/x509/x509_txt.c
crypto/libressl/crypto/x509/x509_v3.c
crypto/libressl/crypto/x509/x509_vfy.c
crypto/libressl/crypto/x509/x509_vpm.c
crypto/libressl/crypto/x509/x509cset.c
crypto/libressl/crypto/x509/x509name.c
crypto/libressl/crypto/x509/x509rset.c
crypto/libressl/crypto/x509/x509spki.c
crypto/libressl/crypto/x509/x509type.c
crypto/libressl/crypto/x509/x_all.c
crypto/libressl/crypto/x509v3/ext_dat.h
crypto/libressl/crypto/x509v3/pcy_cache.c
crypto/libressl/crypto/x509v3/pcy_data.c
crypto/libressl/crypto/x509v3/pcy_int.h
crypto/libressl/crypto/x509v3/pcy_lib.c
crypto/libressl/crypto/x509v3/pcy_map.c
crypto/libressl/crypto/x509v3/pcy_node.c
crypto/libressl/crypto/x509v3/pcy_tree.c
crypto/libressl/crypto/x509v3/v3_akey.c
crypto/libressl/crypto/x509v3/v3_akeya.c
crypto/libressl/crypto/x509v3/v3_alt.c
crypto/libressl/crypto/x509v3/v3_bcons.c
crypto/libressl/crypto/x509v3/v3_bitst.c
crypto/libressl/crypto/x509v3/v3_conf.c
crypto/libressl/crypto/x509v3/v3_cpols.c
crypto/libressl/crypto/x509v3/v3_crld.c
crypto/libressl/crypto/x509v3/v3_enum.c
crypto/libressl/crypto/x509v3/v3_extku.c
crypto/libressl/crypto/x509v3/v3_genn.c
crypto/libressl/crypto/x509v3/v3_ia5.c
crypto/libressl/crypto/x509v3/v3_info.c
crypto/libressl/crypto/x509v3/v3_int.c
crypto/libressl/crypto/x509v3/v3_lib.c
crypto/libressl/crypto/x509v3/v3_ncons.c
crypto/libressl/crypto/x509v3/v3_ocsp.c
crypto/libressl/crypto/x509v3/v3_pci.c
crypto/libressl/crypto/x509v3/v3_pcia.c
crypto/libressl/crypto/x509v3/v3_pcons.c
crypto/libressl/crypto/x509v3/v3_pku.c
crypto/libressl/crypto/x509v3/v3_pmaps.c
crypto/libressl/crypto/x509v3/v3_prn.c
crypto/libressl/crypto/x509v3/v3_purp.c
crypto/libressl/crypto/x509v3/v3_skey.c
crypto/libressl/crypto/x509v3/v3_sxnet.c
crypto/libressl/crypto/x509v3/v3_utl.c
crypto/libressl/crypto/x509v3/v3err.c
crypto/libressl/crypto/x86_arch.h [new file with mode: 0644]
crypto/libressl/include/compat/arpa/inet.h [deleted file]
crypto/libressl/include/compat/arpa/nameser.h [deleted file]
crypto/libressl/include/compat/dirent.h [deleted file]
crypto/libressl/include/compat/dirent_msvc.h [deleted file]
crypto/libressl/include/compat/err.h [deleted file]
crypto/libressl/include/compat/limits.h [deleted file]
crypto/libressl/include/compat/machine/endian.h [deleted file]
crypto/libressl/include/compat/netdb.h [deleted file]
crypto/libressl/include/compat/netinet/in.h [deleted file]
crypto/libressl/include/compat/netinet/ip.h [deleted file]
crypto/libressl/include/compat/netinet/tcp.h [deleted file]
crypto/libressl/include/compat/poll.h [deleted file]
crypto/libressl/include/compat/readpassphrase.h [deleted file]
crypto/libressl/include/compat/resolv.h [deleted file]
crypto/libressl/include/compat/stdio.h [deleted file]
crypto/libressl/include/compat/stdlib.h [deleted file]
crypto/libressl/include/compat/string.h [deleted file]
crypto/libressl/include/compat/sys/cdefs.h [deleted file]
crypto/libressl/include/compat/sys/ioctl.h [deleted file]
crypto/libressl/include/compat/sys/mman.h [deleted file]
crypto/libressl/include/compat/sys/param.h [deleted file]
crypto/libressl/include/compat/sys/select.h [deleted file]
crypto/libressl/include/compat/sys/socket.h [deleted file]
crypto/libressl/include/compat/sys/stat.h [deleted file]
crypto/libressl/include/compat/sys/time.h [deleted file]
crypto/libressl/include/compat/sys/types.h [deleted file]
crypto/libressl/include/compat/sys/uio.h [deleted file]
crypto/libressl/include/compat/time.h [deleted file]
crypto/libressl/include/compat/unistd.h [deleted file]
crypto/libressl/include/compat/win32netcompat.h [deleted file]
crypto/libressl/include/openssl/aes.h
crypto/libressl/include/openssl/asn1.h
crypto/libressl/include/openssl/asn1_mac.h [deleted file]
crypto/libressl/include/openssl/asn1t.h
crypto/libressl/include/openssl/bio.h
crypto/libressl/include/openssl/blowfish.h
crypto/libressl/include/openssl/bn.h
crypto/libressl/include/openssl/buffer.h
crypto/libressl/include/openssl/camellia.h
crypto/libressl/include/openssl/cast.h
crypto/libressl/include/openssl/chacha.h
crypto/libressl/include/openssl/cmac.h
crypto/libressl/include/openssl/cms.h [deleted file]
crypto/libressl/include/openssl/comp.h
crypto/libressl/include/openssl/conf.h
crypto/libressl/include/openssl/conf_api.h
crypto/libressl/include/openssl/crypto.h
crypto/libressl/include/openssl/curve25519.h [new file with mode: 0644]
crypto/libressl/include/openssl/des.h
crypto/libressl/include/openssl/dh.h
crypto/libressl/include/openssl/dsa.h
crypto/libressl/include/openssl/dso.h
crypto/libressl/include/openssl/dtls1.h
crypto/libressl/include/openssl/ec.h
crypto/libressl/include/openssl/ecdh.h
crypto/libressl/include/openssl/ecdsa.h
crypto/libressl/include/openssl/engine.h [deleted file]
crypto/libressl/include/openssl/err.h
crypto/libressl/include/openssl/evp.h
crypto/libressl/include/openssl/gost.h
crypto/libressl/include/openssl/hkdf.h [new file with mode: 0644]
crypto/libressl/include/openssl/hmac.h
crypto/libressl/include/openssl/idea.h
crypto/libressl/include/openssl/krb5_asn.h [deleted file]
crypto/libressl/include/openssl/lhash.h
crypto/libressl/include/openssl/md4.h
crypto/libressl/include/openssl/md5.h
crypto/libressl/include/openssl/modes.h
crypto/libressl/include/openssl/obj_mac.h
crypto/libressl/include/openssl/objects.h
crypto/libressl/include/openssl/ocsp.h
crypto/libressl/include/openssl/opensslconf.h
crypto/libressl/include/openssl/opensslfeatures.h
crypto/libressl/include/openssl/opensslv.h
crypto/libressl/include/openssl/ossl_typ.h
crypto/libressl/include/openssl/pem.h
crypto/libressl/include/openssl/pem2.h
crypto/libressl/include/openssl/pkcs12.h
crypto/libressl/include/openssl/pkcs7.h
crypto/libressl/include/openssl/poly1305.h
crypto/libressl/include/openssl/rand.h
crypto/libressl/include/openssl/rc2.h
crypto/libressl/include/openssl/rc4.h
crypto/libressl/include/openssl/ripemd.h
crypto/libressl/include/openssl/rsa.h
crypto/libressl/include/openssl/safestack.h
crypto/libressl/include/openssl/sha.h
crypto/libressl/include/openssl/sm3.h [copied from crypto/libressl/include/openssl/poly1305.h with 52% similarity]
crypto/libressl/include/openssl/sm4.h [copied from crypto/libressl/include/openssl/poly1305.h with 51% similarity]
crypto/libressl/include/openssl/srtp.h
crypto/libressl/include/openssl/ssl.h
crypto/libressl/include/openssl/ssl2.h
crypto/libressl/include/openssl/ssl23.h
crypto/libressl/include/openssl/ssl3.h
crypto/libressl/include/openssl/stack.h
crypto/libressl/include/openssl/tls1.h
crypto/libressl/include/openssl/ts.h
crypto/libressl/include/openssl/txt_db.h
crypto/libressl/include/openssl/ui.h
crypto/libressl/include/openssl/ui_compat.h [deleted file]
crypto/libressl/include/openssl/whrlpool.h
crypto/libressl/include/openssl/x509.h
crypto/libressl/include/openssl/x509_vfy.h
crypto/libressl/include/openssl/x509v3.h
crypto/libressl/include/pqueue.h
crypto/libressl/include/tls.h
crypto/libressl/ssl/VERSION
crypto/libressl/ssl/bio_ssl.c
crypto/libressl/ssl/bs_ber.c [deleted file]
crypto/libressl/ssl/bs_cbb.c
crypto/libressl/ssl/bs_cbs.c
crypto/libressl/ssl/bytestring.h
crypto/libressl/ssl/d1_both.c
crypto/libressl/ssl/d1_clnt.c
crypto/libressl/ssl/d1_enc.c
crypto/libressl/ssl/d1_lib.c
crypto/libressl/ssl/d1_meth.c [deleted file]
crypto/libressl/ssl/d1_pkt.c
crypto/libressl/ssl/d1_srtp.c
crypto/libressl/ssl/d1_srvr.c
crypto/libressl/ssl/pqueue.c
crypto/libressl/ssl/s23_clnt.c [deleted file]
crypto/libressl/ssl/s23_lib.c [deleted file]
crypto/libressl/ssl/s23_pkt.c [deleted file]
crypto/libressl/ssl/s23_srvr.c [deleted file]
crypto/libressl/ssl/s3_cbc.c
crypto/libressl/ssl/s3_clnt.c [deleted file]
crypto/libressl/ssl/s3_lib.c
crypto/libressl/ssl/s3_srvr.c [deleted file]
crypto/libressl/ssl/srtp.h
crypto/libressl/ssl/ssl_algs.c
crypto/libressl/ssl/ssl_asn1.c
crypto/libressl/ssl/ssl_both.c [moved from crypto/libressl/ssl/s3_both.c with 64% similarity]
crypto/libressl/ssl/ssl_cert.c
crypto/libressl/ssl/ssl_ciph.c
crypto/libressl/ssl/ssl_ciphers.c [new file with mode: 0644]
crypto/libressl/ssl/ssl_clnt.c [new file with mode: 0644]
crypto/libressl/ssl/ssl_err.c
crypto/libressl/ssl/ssl_err2.c [deleted file]
crypto/libressl/ssl/ssl_init.c [moved from crypto/libressl/crypto/compat/strnlen.c with 51% similarity]
crypto/libressl/ssl/ssl_lib.c
crypto/libressl/ssl/ssl_locl.h
crypto/libressl/ssl/ssl_methods.c [new file with mode: 0644]
crypto/libressl/ssl/ssl_packet.c [new file with mode: 0644]
crypto/libressl/ssl/ssl_pkt.c [moved from crypto/libressl/ssl/s3_pkt.c with 68% similarity]
crypto/libressl/ssl/ssl_rsa.c
crypto/libressl/ssl/ssl_sess.c
crypto/libressl/ssl/ssl_sigalgs.c [new file with mode: 0644]
crypto/libressl/ssl/ssl_sigalgs.h [new file with mode: 0644]
crypto/libressl/ssl/ssl_srvr.c [new file with mode: 0644]
crypto/libressl/ssl/ssl_stat.c
crypto/libressl/ssl/ssl_tlsext.c [new file with mode: 0644]
crypto/libressl/ssl/ssl_tlsext.h [new file with mode: 0644]
crypto/libressl/ssl/ssl_transcript.c [new file with mode: 0644]
crypto/libressl/ssl/ssl_txt.c
crypto/libressl/ssl/ssl_versions.c [new file with mode: 0644]
crypto/libressl/ssl/t1_clnt.c [deleted file]
crypto/libressl/ssl/t1_enc.c
crypto/libressl/ssl/t1_lib.c
crypto/libressl/ssl/t1_meth.c [deleted file]
crypto/libressl/ssl/t1_reneg.c [deleted file]
crypto/libressl/ssl/t1_srvr.c [deleted file]
crypto/libressl/ssl/tls13_internal.h [new file with mode: 0644]
crypto/libressl/ssl/tls13_key_schedule.c [new file with mode: 0644]
crypto/libressl/tls/VERSION [deleted file]
crypto/libressl/tls/strsep.c [deleted file]
crypto/libressl/tls/tls.c
crypto/libressl/tls/tls_bio_cb.c [new file with mode: 0644]
crypto/libressl/tls/tls_client.c
crypto/libressl/tls/tls_config.c
crypto/libressl/tls/tls_conninfo.c
crypto/libressl/tls/tls_internal.h
crypto/libressl/tls/tls_keypair.c [new file with mode: 0644]
crypto/libressl/tls/tls_ocsp.c [new file with mode: 0644]
crypto/libressl/tls/tls_peer.c
crypto/libressl/tls/tls_server.c
crypto/libressl/tls/tls_util.c
crypto/libressl/tls/tls_verify.c

index 0c5a934..5f91568 100644 (file)
@@ -28,7 +28,636 @@ history is also available from Git.
 
 LibreSSL Portable Release Notes:
 
-2.4.3 - Bug fixes and reliability improvements
+2.9.1 - Stable release
+
+       * Added support for XChaCha20 and XChaCha20-Poly1305.
+
+       * Added support for AES key wrap constructions via the EVP interface.
+
+       * Partial port of the OpenSSL EC_KEY_METHOD API for use by OpenSSH.
+
+       * Added pbkdf2 key derivation support to openssl(1)
+
+       * Removed SHA224 based handshake signatures from consideration for use in a TLS 1.2 handshake.
+
+       * Changed the default digest type of openssl(1) enc to to sha256.
+
+       * Changed the default digest type of openssl(1) dgst to sha256.
+
+       * Changed the default digest type of openssl(1) x509 -fingerprint to sha256.
+
+       * Changed the default digest type of openssl(1) crl -fingerprint to sha256.
+
+       * Improved Windows, Android, and ARM compatibility, including assembly
+         optimizations on Mingw-w64 targets.
+
+2.9.0 - Development release
+
+       * Added the SM4 block cipher from the Chinese standard GB/T 32907-2016.
+
+       * Fixed warnings about clock_gettime on Windows Visual Studio builds.
+
+       * Fixed CMake builds on systems where getpagesize is defined as an
+         inline function.
+
+       * CRYPTO_LOCK is now automatically initialized, with the legacy
+         callbacks stubbed for compatibility.
+
+       * Added the SM3 hash function from the Chinese standard GB/T 32905-2016.
+
+       * Added more OPENSSL_NO_* macros for compatibility with OpenSSL.
+
+       * Added extensive interoperability tests between LibreSSL and OpenSSL
+         1.0 and 1.1.
+
+       * Added additional Wycheproof tests and related bug fixes.
+
+       * Simplified sigalgs option processing and handshake signing algorithm
+
+       * Added the ability to use the RSA PSS algorithm for handshake
+         signatures.
+
+       * Added bn_rand_interval() and use it in code needing ranges of random
+         bn values.
+
+       * Added functionality to derive early, handshake, and application
+         secrets as per RFC8446.
+
+       * Added handshake state machine from RFC8446.
+
+       * Removed some ASN.1 related code from libcrypto that had not been used
+         since around 2000.
+
+       * Unexported internal symbols and internalized more record layer structs.
+
+       * Added support for assembly optimizations on 32-bit ARM ELF targets.
+
+       * Improved protection against timing side channels in ECDSA signature
+         generation.
+
+       * Coordinate blinding was added to some elliptic curves. This is the
+         last bit of the work by Brumley et al. to protect against the
+         Portsmash vulnerability.
+
+       * Ensure transcript handshake is always freed with TLS 1.2.
+
+2.8.2 - Stable release
+
+       * Added Wycheproof support for ECDH and ECDSA Web Crypto test vectors,
+         along with test harness fixes.
+
+       * Fixed memory leak in nc(1)
+
+2.8.1 - Test and compatibility improvements
+
+       * Added Wycheproof support for ECDH, RSASSA-PSS, AES-GCM,
+         AES-CMAC, AES-CCM, AES-CBC-PKCS5, DSA, ChaCha20-Poly1305, ECDSA, and
+         X25519 test vectors. Applied appropriate fixes for errors uncovered
+         by tests.
+
+       * Simplified key exchange signature generation and verification.
+
+       * Fixed a one-byte buffer overrun in callers of EVP_read_pw_string
+
+       * Converted more code paths to use CBB/CBS. All handshake messages are
+         now created by CBB.
+
+       * Fixed various memory leaks found by Coverity.
+
+       * Simplified session ticket parsing and handling, inspired by
+         BoringSSL.
+
+       * Modified signature of CRYPTO_mem_leaks_* to return -1. This function
+         is a no-op in LibreSSL, so this function returns an error to not
+         indicate the (non-)existence of memory leaks.
+
+       * SSL_copy_session_id, PEM_Sign, EVP_EncodeUpdate, BIO_set_cipher,
+         X509_OBJECT_up_ref_count now return an int for error handling,
+         matching OpenSSL.
+
+       * Converted a number of #defines into proper functions, matching
+         OpenSSL's ABI.
+
+       * Added X509_get0_serialNumber from OpenSSL.
+
+       * Removed EVP_PKEY2PKCS8_broken and PKCS8_set_broken, while adding
+         PKCS8_pkey_add1_attr_by_NID and PKCS8_pkey_get0_attrs, matching
+         OpenSSL.
+
+       * Removed broken pkcs8 formats from openssl(1).
+
+       * Converted more functions in public API to use const arguments.
+
+       * Stopped handing AES-GCM in ssl_cipher_get_evp, since they use the
+         EVP_AEAD interface.
+
+       * Stopped using composite EVP_CIPHER AEADs.
+
+       * Added timing-safe compares for checking results of signature
+         verification. There are no known attacks, this is just inexpensive
+         prudence.
+
+       * Correctly clear the current cipher state, when changing cipher state.
+         This fixed an issue where renegotiation of cipher suites would fail
+         when switched from AEAD to non-AEAD or vice-versa.
+         Issue reported by Bernard Spil.
+
+       * Added more cipher tests to appstest.sh, including all TLSv1.2
+         ciphers.
+
+       * Added RSA_meth_get_finish() RSA_meth_set1_name() from OpenSSL.
+
+       * Added new EVP_CIPHER_CTX_(get|set)_iv() API that allows the IV to be
+         retrieved and set with appropriate validation.
+
+2.8.0 - Bug fixes, security, and compatibility improvements
+
+       * Extensive documentation updates and additional API history.
+
+       * Fixed a pair of 20+ year-old bugs in X509_NAME_add_entry
+
+       * Tighten up checks for various X509_VERIFY_PARAM functions,
+         'poisoning' parameters so that an unverified certificate cannot be
+         used if it fails verification.
+
+       * Fixed a potential memory leak on failure in ASN1_item_digest
+
+       * Fixed a potential memory alignment crash in asn1_item_combine_free
+
+       * Removed unused SSL3_FLAGS_DELAY_CLIENT_FINISHED and
+         SSL3_FLAGS_POP_BUFFER flags in write path, simplifying IO paths.
+
+       * Removed SSL_OP_TLS_ROLLBACK_BUG buggy client workarounds.
+
+       * Made ENGINE_finish and ENGINE_free succeed on NULL and simplify callers
+         and matching OpenSSL behavior, rewrote ENGINE_* documentation.
+
+       * Added const annotations to many existing APIs from OpenSSL, making
+         interoperability easier for downstream applications.
+
+       * Fixed small timing side-channels in ecdsa_sign_setup and
+         dsa_sign_setup.
+
+       * Documented security pitfalls with BN_FLG_CONSTTIME and constant-time
+         operation of BN_* functions.
+
+       * Updated BN_clear to use explicit_bzero.
+
+       * Added a missing bounds check in c2i_ASN1_BIT_STRING.
+
+       * More CBS conversions, including simplifications to RSA key exchange,
+         and converted code to use dedicated buffers for secrets.
+
+       * Removed three remaining single DES cipher suites.
+
+       * Fixed a potential leak/incorrect return value in DSA signature
+         generation.
+
+       * Added a blinding value when generating DSA and ECDSA signatures, in
+         order to reduce the possibility of a side-channel attack leaking the
+         private key.
+
+       * Added ECC constant time scalar multiplication support.
+         From Billy Brumley and his team at Tampere University of Technology.
+
+       * Revised the implementation of RSASSA-PKCS1-v1_5 to match the
+         specification in RFC 8017. Based on an OpenSSL commit by David
+         Benjamin.
+
+       * Cleaned up BN_* implementations following changes made in OpenSSL by
+         Davide Galassi and others.
+
+2.7.4 - Security fixes
+
+       * Avoid a timing side-channel leak when generating DSA and ECDSA
+         signatures. This is caused by an attempt to do fast modular
+         arithmetic, which introduces branches that leak information
+         regarding secret values. Issue identified and reported by Keegan
+         Ryan of NCC Group.
+
+       * Reject excessively large primes in DH key generation. Problem
+         reported by Guido Vranken to OpenSSL
+         (https://github.com/openssl/openssl/pull/6457) and based on his
+         diff.
+
+2.7.3 - Bug fixes
+
+       * Removed incorrect NULL checks in DH_set0_key(). Reported by Ondrej
+         Sury
+
+       * Fixed an issue normalizing CPU architecture in the configure script,
+         which disabled assembly optimizations on platforms that get detected
+         as 'amd64', opposed to 'x86_64'
+
+       * Limited tls_config_clear_keys() to only clear private keys.
+         This was inadvertently clearing the keypair, which includes the OCSP
+         staple and pubkey hash - if an application called tls_configure()
+         followed by tls_config_clear_keys(), this would prevent OCSP staples
+         from working.
+
+2.7.2 - Stable release
+
+       * Updated and added extensive new HISTORY sections to API manuals.
+
+       * Added support for shared library builds with CMake on all supported
+         platforms. Note that some of the CMake options have changed, consult
+         the README for details.
+
+2.7.1 - Bug fixes
+
+       * Fixed a bug in int_x509_param_set_hosts, calling strlen() if name
+         length provided is 0 to match the OpenSSL behaviour. Issue noticed
+         by Christian Heimes <christian@python.org>.
+
+       * Fixed builds macOS 10.11 and older.
+
+2.7.0 - Bug fixes and improvements
+
+       * Added support for many OpenSSL 1.0.2 and 1.1 APIs, based on
+         observations of real-world usage in applications. These are
+         implemented in parallel with existing OpenSSL 1.0.1 APIs - visibility
+         changes have not been made to existing structs, allowing code written
+         for older OpenSSL APIs to continue working.
+
+       * Extensive corrections, improvements, and additions to the
+         API documentation, including new public APIs from OpenSSL that had
+         no pre-existing documentation.
+
+       * Added support for automatic library initialization in libcrypto,
+         libssl, and libtls. Support for pthread_once or a compatible
+         equivalent is now required of the target operating system. As a
+         side-effect, minimum Windows support is Vista or higher.
+
+       * Converted more packet handling methods to CBB, which improves
+         resiliency when generating TLS messages.
+
+       * Completed TLS extension handling rewrite, improving consistency of
+         checks for malformed and duplicate extensions.
+
+       * Rewrote ASN1_TYPE_{get,set}_octetstring() using templated ASN.1.
+         This removes the last remaining use of the old M_ASN1_* macros
+         (asn1_mac.h) from API that needs to continue to exist.
+
+       * Added support for client-side session resumption in libtls.
+         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.
+
+       * Improved support for strict alignment on ARMv7 architectures,
+         conditionally enabling assembly in those cases.
+
+       * Fixed a memory leak in libtls when reusing a tls_config.
+
+       * Merged more DTLS support into the regular TLS code path, removing
+         duplicated code.
+
+       * Many improvements to Windows Cmake-based builds and tests,
+         especially when targeting Visual Studio.
+
+2.6.4 - Bug fixes
+
+       * Make tls_config_parse_protocols() work correctly when passed a NULL
+         pointer for a protocol string. Issue found by semarie@, who also
+         provided the diff.
+
+       * Correct TLS extensions handling when no extensions are present.
+         If no TLS extensions are present in a client hello or server hello,
+         omit the entire extensions block, rather than including it with a
+         length of zero. Thanks to Eric Elena <eric at voguemerry dot com> for
+         providing packet captures and testing the fix.
+
+       * Fixed portable builds on older Android systems, and systems with out
+         IPV6_TCLASS support.
+
+2.6.3 - OpenBSD 6.2 Release
+
+       * No core changes from LibreSSL 2.6.2
+
+       * Minor compatibility fixes in portable version.
+
+2.6.2 - Bug fixes
+
+       * Provide a useful error with libtls if there are no OCSP URLs in a
+         peer certificate.
+
+       * Keep track of which keypair is in use by a TLS context, fixing a bug
+         where a TLS server with SNI would only return the OCSP staple for the
+         default keypair. Issue reported by William Graeber and confirmed by
+         Andreas Bartelt.
+
+       * Fixed various issues in the OCSP extension parsing code.
+         The original code incorrectly passes the pointer allocated via
+         CBS_stow() (using malloc()) to a d2i_*() function and then calls
+         free() on the now incremented pointer, most likely resulting in a
+         crash. This issue was reported by Robert Swiecki who found the issue
+         using honggfuzz.
+
+       * If tls_config_parse_protocols() is called with a NULL pointer,
+         return the default protocols instead of crashing - this makes the
+         behaviour more useful and mirrors what we already do in
+         tls_config_set_ciphers() et al.
+
+2.6.1 - Code removal, rewrites
+
+       * Added a "-T tlscompat" option to nc(1), which enables the use of all
+         TLS protocols and "compat" ciphers. This allows for TLS connections
+         to TLS servers that are using less than ideal cipher suites, without
+         having to resort to "-T tlsall" which enables all known cipher
+         suites.  Diff from Kyle J. McKay.
+
+       * Added a new TLS extension handling framework, somewhat analogous to
+         BoringSSL, and converted all TLS extensions to use it. Added new TLS
+         extension regression tests.
+
+       * Improved and added many new manpages. Updated *check_private_key
+         manpages with additional cautions regarding their use.
+
+       * Cleaned up the EC key/curve configuration handling.
+
+       * Added tls_config_set_ecdhecurves() to libtls, which allows the names
+         of the eliptical curves that may be used during client and server
+         key exchange to be specified.
+
+       * Converted more code paths to use CBB/CBS.
+
+       * Removed support for DSS/DSA, since we removed the cipher suites a
+         while back.
+
+       * Removed NPN support. NPN was never standardised and the last draft
+         expired in October 2012. ALPN was standardised in July 2014 and has
+         been supported in LibreSSL since December 2014. NPN has also been
+         removed from Chromium in May 2016.
+
+       * Removed SSL_OP_CRYPTOPRO_TLSEXT_BUG workaround for old/broken
+         CryptoPro clients.
+
+       * Removed support for the TLS padding extension, which was added as a
+         workaround for an old bug in F5's TLS termination.
+
+       * Worked around another bug in F5's TLS termination handling of the
+         elliptical curves extension. RFC 4492 only defines elliptic_curves
+         for ClientHello. However, F5 is sending it in ServerHello.  We need
+         to skip over it since our TLS extension parsing code is now more
+         strict. Thanks to Armin Wolfermann and WJ Liu for reporting.
+
+       * Added ability to clamp notafter valies in certificates for systems
+         with 32-bit time_t. This is necessary to conform to RFC 5280
+         4.1.2.5.
+
+       * Implemented the SSL_CTX_set_min_proto_version(3) API.
+
+       * Removed the original (pre-IETF) chacha20-poly1305 cipher suites.
+
+       * Reclassified ECDHE-RSA-DES-CBC3-SHA from HIGH to MEDIUM.
+
+2.6.0 - New APIs, bug fixes and improvements
+
+       * Added support for providing CRLs to libtls. Once a CRL is provided we
+         enable CRL checking for the full certificate chain. Based on a diff
+         from Jack Burton
+
+       * Allow non-compliant clients using IP literal addresses with SNI
+         to connect to a server using libtls.
+
+       * Avoid a potential NULL pointer dereference in d2i_ECPrivateKey().
+         Reported by Robert Swiecki, who found the issue using honggfuzz.
+
+       * Added definitions for three OIDs used in EV certificates.
+         From Kyle J. McKay
+
+       * Added tls_peer_cert_chain_pem to libtls, useful in private
+         certificate validation callbacks such as those in relayd.
+
+       * Converted explicit clear/free sequences to use freezero(3).
+
+       * Reworked TLS certificate name verification code to more strictly
+         follow RFC 6125.
+
+       * Cleaned up and simplified server key exchange EC point handling.
+
+       * Added tls_keypair_clear_key for clearing key material.
+
+       * Removed inconsistent IPv6 handling from BIO_get_accept_socket,
+         simplified BIO_get_host_ip and BIO_accept.
+
+       * Fixed the openssl(1) ca command so that is generates certificates
+         with RFC 5280-conformant time. Problem noticed by Harald Dunkel.
+
+       * Added ASN1_TIME_set_tm to set an asn1 from a struct tm *
+
+       * Added SSL{,_CTX}_set_{min,max}_proto_version() functions.
+
+       * Added HKDF (HMAC Key Derivation Function) from BoringSSL
+
+       * Provided a tls_unload_file() function that frees the memory returned
+         from 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.
+
+       * Perform reference counting for tls_config. This allows
+         tls_config_free() to be called as soon as it has been passed to the
+         final tls_configure() call, simplifying lifetime tracking for the
+         application.
+
+       * Moved internal state of SSL and other structures to be opaque.
+
+       * Dropped cipher suites with DSS authentication.
+
+       * nc(1) improvements, including:
+          nc -W to terminate nc after receiving a number of packets
+          nc -Z for saving the peer certificate and chain in a pem file
+
+2.5.5 - Bug fixes
+
+       * Distinguish between self-issued certificates and self-signed
+         certificates. The certificate verification code has special cases
+         for self-signed certificates and without this change, self-issued
+         certificates (which it seems are common place with
+         openvpn/easyrsa) were also being included in this category.
+
+       * Added getpagesize fallback, needed for Android bionic libc.
+
+2.5.4 - Security Updates
+
+       * Revert a previous change that forced consistency between return
+         value and error code when specifing a certificate verification
+         callback, since this breaks the documented API. When a user supplied
+         callback always returns 1, and later code checks the error code to
+         potentially abort post verification, this will result in incorrect
+         successul certificate verification.
+
+       * Switched Linux getrandom() usage to non-blocking mode, continuing to
+         use fallback mechanims if unsuccessful. This works around a design
+         flaw in Linux getrandom(2) where early boot usage in a library makes
+         it impossible to recover if getrandom(2) is not yet initialized.
+
+       * Fixed a bug caused by the return value being set early to signal
+         successful DTLS cookie validation. This can mask a later failure and
+         result in a positive return value being returned from
+         ssl3_get_client_hello(), when it should return a negative value to
+         propagate the error.
+
+       * Fixed a build error on non-x86/x86_64 systems running Solaris.
+
+2.5.3 - OpenBSD 6.1 Release
+
+       * Documentation updates
+
+       * Improved ocspcheck(1) error handling
+
+2.5.2 - Security features and bugfixes
+
+       * Added the recallocarray(3) memory allocation function, and converted
+         various places in the library to use it, such as CBB and BUF_MEM_grow.
+         recallocarray(3) is similar to reallocarray. Newly allocated memory
+         is cleared similar to calloc(3). Memory that becomes unallocated
+         while shrinking or moving existing allocations is explicitly
+         discarded by unmapping or clearing to 0
+
+       * Added new root CAs from SECOM Trust Systems / Security Communication
+         of Japan.
+
+       * Added EVP interface for MD5+SHA1 hashes.
+
+       * Fixed DTLS client failures when the server sends a certificate
+         request.
+
+       * Correct handling of padding when upgrading an SSLv2 challenge into
+         an SSLv3/TLS connection.
+
+       * Allow protocols and ciphers to be set on a TLS config object in
+         libtls.
+
+       * Improved nc(1) TLS handshake CPU usage and server-side error
+         reporting.
+
+2.5.1 - Bug and security fixes, new features, documentation updates
+
+       * X509_cmp_time() now passes a malformed GeneralizedTime field as an
+         error. Reported by Theofilos Petsios.
+
+       * Detect zero-length encrypted session data early, instead of when
+         malloc(0) fails or the HMAC check fails. Noted independently by
+         jsing@ and Kurt Cancemi.
+
+       * Check for and handle failure of HMAC_{Update,Final} or
+         EVP_DecryptUpdate().
+
+       * Massive update and normalization of manpages, conversion to
+         mandoc format. Many pages were rewritten for clarity and accuracy.
+         Portable doc links are up-to-date with a new conversion tool.
+
+       * Curve25519 Key Exchange support.
+
+       * Support for alternate chains for certificate verification.
+
+       * Code cleanups, CBS conversions, further unification of DTLS/SSL
+         handshake code, further ASN1 macro expansion and removal.
+
+       * Private symbol are now hidden in libssl and libcryto.
+
+       * Friendly certificate verification error messages in libtls, peer
+         verification is now always enabled.
+
+       * Added OCSP stapling support to libtls and netcat.
+
+       * Added ocspcheck utility to validate a certificate against its OCSP
+         responder and save the reply for stapling
+
+       * Enhanced regression tests and error handling for libtls.
+
+       * Added explicit constant and non-constant time BN functions,
+         defaulting to constant time wherever possible.
+
+       * Moved many leaked implementation details in public structs behind
+         opaque pointers.
+
+       * Added ticket support to libtls.
+
+       * Added support for setting the supported EC curves via
+         SSL{_CTX}_set1_groups{_list}() - also provide defines for the previous
+         SSL{_CTX}_set1_curves{_list} names. This also changes the default
+         list of curves to be X25519, P-256 and P-384. All other curves must
+         be manually enabled.
+
+       * Added -groups option to openssl(1) s_client for specifying the curves
+         to be used in a colon-separated list.
+
+       * Merged client/server version negotiation code paths into one,
+         reducing much duplicate code.
+
+       * Removed error function codes from libssl and libcrypto.
+
+       * Fixed an issue where a truncated packet could crash via an OOB read.
+
+       * Added SSL_OP_NO_CLIENT_RENEGOTIATION option that disallows
+         client-initiated renegotiation. This is the default for libtls
+         servers.
+
+       * Avoid a side-channel cache-timing attack that can leak the ECDSA
+         private keys when signing. This is due to BN_mod_inverse() being
+         used without the constant time flag being set. Reported by Cesar
+         Pereida Garcia and Billy Brumley (Tampere University of Technology).
+         The fix was developed by Cesar Pereida Garcia.
+
+       * iOS and MacOS compatibility updates from Simone Basso and Jacob
+         Berkman.
+
+
+2.5.0 - New APIs, bug fixes and improvements
+
+       * libtls now supports ALPN and SNI
+
+       * libtls adds a new callback interface for integrating custom IO
+         functions. Thanks to Tobias Pape.
+
+       * libtls now handles 4 cipher suite groups:
+           "secure" (TLSv1.2+AEAD+PFS)
+           "compat" (HIGH:!aNULL)
+           "legacy" (HIGH:MEDIUM:!aNULL)
+           "insecure" (ALL:!aNULL:!eNULL)
+
+           This allows for flexibility and finer grained control, rather than
+           having two extremes (an issue raised by Marko Kreen some time ago).
+
+       * Tightened error handling for tls_config_set_ciphers().
+
+       * libtls now always loads CA, key and certificate files at the time the
+         configuration function is called. This simplifies code and results in
+         a single memory based code path being used to provide data to libssl.
+
+       * Add support for OCSP intermediate certificates.
+
+       * Added functions used by stunnel and exim from BoringSSL - this
+         brings in X509_check_host, X509_check_email, X509_check_ip, and
+         X509_check_ip_asc.
+
+       * Added initial support for iOS, thanks to Jacob Berkman.
+
+       * Improved behavior of arc4random on Windows when using memory leak
+         analysis software.
+
+       * Correctly handle an EOF that occurs prior to the TLS handshake
+         completing. Reported by Vasily Kolobkov, based on a diff from Marko
+         Kreen.
+
+       * Limit the support of the "backward compatible" ssl2 handshake to
+         only be used if TLS 1.0 is enabled.
+
+       * Fix incorrect results in certain cases on 64-bit systems when
+         BN_mod_word() can return incorrect results. BN_mod_word() now can
+         return an error condition. Thanks to Brian Smith.
+
+       * Added constant-time updates to address CVE-2016-0702
+
+       * Fixed undefined behavior in BN_GF2m_mod_arr()
+
+       * Removed unused Cryptographic Message Support (CMS)
+
+       * More conversions of long long idioms to time_t
+
+       * Improved compatibility by avoiding printing NULL strings with
+         printf.
 
        * Reverted change that cleans up the EVP cipher context in
          EVP_EncryptFinal() and EVP_DecryptFinal(). Some software relies on the
@@ -45,7 +674,7 @@ LibreSSL Portable Release Notes:
 
        * Fixed loading default certificate locations with openssl s_client.
 
-       * Ensured OSCP only uses and compares GENERALIZEDTIME values as per
+       * Ensured OCSP only uses and compares GENERALIZEDTIME values as per
          RFC6960. Also added fixes for OCSP to work with intermediate
          certificates provided in responses.
 
@@ -502,7 +1131,7 @@ LibreSSL Portable Release Notes:
 
        * Removed nonfunctional Netscape browser-hang workaround code.
 
-       * Simplfied and refactored SSL/DTLS handshake code.
+       * Simplified and refactored SSL/DTLS handshake code.
 
        * Added SHA256 Camellia cipher suites for TLS 1.2 from RFC 5932.
 
index 8ca68b4..344ac63 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: atomicio.c,v 1.10 2011/01/08 00:47:19 jeremy Exp $ */
+/* $OpenBSD: atomicio.c,v 1.11 2012/12/04 02:24:47 deraadt Exp $ */
 /*
  * Copyright (c) 2006 Damien Miller. All rights reserved.
  * Copyright (c) 2005 Anil Madhavapeddy. All rights reserved.
index 8edc3e8..7bf5b25 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: atomicio.h,v 1.1 2005/05/24 20:13:28 avsm Exp $ */
+/* $OpenBSD: atomicio.h,v 1.2 2007/09/07 14:50:44 tobias Exp $ */
 
 /*
  * Copyright (c) 2006 Damien Miller.  All rights reserved.
diff --git a/crypto/libressl/apps/nc/compat/accept4.c b/crypto/libressl/apps/nc/compat/accept4.c
deleted file mode 100644 (file)
index 278198b..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <sys/socket.h>
-#include <fcntl.h>
-
-int
-accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
-{
-       int rets = accept(s, addr, addrlen);
-       if (rets == -1)
-               return s;
-
-       if (flags & SOCK_CLOEXEC) {
-               flags = fcntl(s, F_GETFD);
-               fcntl(rets, F_SETFD, flags | FD_CLOEXEC);
-       }
-
-       return rets;
-}
diff --git a/crypto/libressl/apps/nc/compat/base64.c b/crypto/libressl/apps/nc/compat/base64.c
deleted file mode 100644 (file)
index e90696d..0000000
+++ /dev/null
@@ -1,315 +0,0 @@
-/*     $OpenBSD: base64.c,v 1.8 2015/01/16 16:48:51 deraadt Exp $      */
-
-/*
- * Copyright (c) 1996 by Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- */
-
-/*
- * Portions Copyright (c) 1995 by International Business Machines, Inc.
- *
- * International Business Machines, Inc. (hereinafter called IBM) grants
- * permission under its copyrights to use, copy, modify, and distribute this
- * Software with or without fee, provided that the above copyright notice and
- * all paragraphs of this notice appear in all copies, and that the name of IBM
- * not be used in connection with the marketing of any product incorporating
- * the Software or modifications thereof, without specific, written prior
- * permission.
- *
- * To the extent it has a right to do so, IBM grants an immunity from suit
- * under its patents, if any, for the use, sale or manufacture of products to
- * the extent that such products are used for performing Domain Name System
- * dynamic updates in TCP/IP networks by means of the Software.  No immunity is
- * granted for any product per se or for any other function of any product.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE.  IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
- * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
- * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
- */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <arpa/nameser.h>
-
-#include <ctype.h>
-#include <resolv.h>
-#include <stdio.h>
-
-#include <stdlib.h>
-#include <string.h>
-
-static const char Base64[] =
-       "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-static const char Pad64 = '=';
-
-/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt)
-   The following encoding technique is taken from RFC 1521 by Borenstein
-   and Freed.  It is reproduced here in a slightly edited form for
-   convenience.
-
-   A 65-character subset of US-ASCII is used, enabling 6 bits to be
-   represented per printable character. (The extra 65th character, "=",
-   is used to signify a special processing function.)
-
-   The encoding process represents 24-bit groups of input bits as output
-   strings of 4 encoded characters. Proceeding from left to right, a
-   24-bit input group is formed by concatenating 3 8-bit input groups.
-   These 24 bits are then treated as 4 concatenated 6-bit groups, each
-   of which is translated into a single digit in the base64 alphabet.
-
-   Each 6-bit group is used as an index into an array of 64 printable
-   characters. The character referenced by the index is placed in the
-   output string.
-
-                         Table 1: The Base64 Alphabet
-
-      Value Encoding  Value Encoding  Value Encoding  Value Encoding
-          0 A            17 R            34 i            51 z
-          1 B            18 S            35 j            52 0
-          2 C            19 T            36 k            53 1
-          3 D            20 U            37 l            54 2
-          4 E            21 V            38 m            55 3
-          5 F            22 W            39 n            56 4
-          6 G            23 X            40 o            57 5
-          7 H            24 Y            41 p            58 6
-          8 I            25 Z            42 q            59 7
-          9 J            26 a            43 r            60 8
-         10 K            27 b            44 s            61 9
-         11 L            28 c            45 t            62 +
-         12 M            29 d            46 u            63 /
-         13 N            30 e            47 v
-         14 O            31 f            48 w         (pad) =
-         15 P            32 g            49 x
-         16 Q            33 h            50 y
-
-   Special processing is performed if fewer than 24 bits are available
-   at the end of the data being encoded.  A full encoding quantum is
-   always completed at the end of a quantity.  When fewer than 24 input
-   bits are available in an input group, zero bits are added (on the
-   right) to form an integral number of 6-bit groups.  Padding at the
-   end of the data is performed using the '=' character.
-
-   Since all base64 input is an integral number of octets, only the
-         -------------------------------------------------                       
-   following cases can arise:
-   
-       (1) the final quantum of encoding input is an integral
-           multiple of 24 bits; here, the final unit of encoded
-          output will be an integral multiple of 4 characters
-          with no "=" padding,
-       (2) the final quantum of encoding input is exactly 8 bits;
-           here, the final unit of encoded output will be two
-          characters followed by two "=" padding characters, or
-       (3) the final quantum of encoding input is exactly 16 bits;
-           here, the final unit of encoded output will be three
-          characters followed by one "=" padding character.
-   */
-
-int
-b64_ntop(src, srclength, target, targsize)
-       u_char const *src;
-       size_t srclength;
-       char *target;
-       size_t targsize;
-{
-       size_t datalength = 0;
-       u_char input[3];
-       u_char output[4];
-       int i;
-
-       while (2 < srclength) {
-               input[0] = *src++;
-               input[1] = *src++;
-               input[2] = *src++;
-               srclength -= 3;
-
-               output[0] = input[0] >> 2;
-               output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
-               output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
-               output[3] = input[2] & 0x3f;
-
-               if (datalength + 4 > targsize)
-                       return (-1);
-               target[datalength++] = Base64[output[0]];
-               target[datalength++] = Base64[output[1]];
-               target[datalength++] = Base64[output[2]];
-               target[datalength++] = Base64[output[3]];
-       }
-    
-       /* Now we worry about padding. */
-       if (0 != srclength) {
-               /* Get what's left. */
-               input[0] = input[1] = input[2] = '\0';
-               for (i = 0; i < srclength; i++)
-                       input[i] = *src++;
-       
-               output[0] = input[0] >> 2;
-               output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
-               output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
-
-               if (datalength + 4 > targsize)
-                       return (-1);
-               target[datalength++] = Base64[output[0]];
-               target[datalength++] = Base64[output[1]];
-               if (srclength == 1)
-                       target[datalength++] = Pad64;
-               else
-                       target[datalength++] = Base64[output[2]];
-               target[datalength++] = Pad64;
-       }
-       if (datalength >= targsize)
-               return (-1);
-       target[datalength] = '\0';      /* Returned value doesn't count \0. */
-       return (datalength);
-}
-
-/* skips all whitespace anywhere.
-   converts characters, four at a time, starting at (or after)
-   src from base - 64 numbers into three 8 bit bytes in the target area.
-   it returns the number of data bytes stored at the target, or -1 on error.
- */
-
-int
-b64_pton(src, target, targsize)
-       char const *src;
-       u_char *target;
-       size_t targsize;
-{
-       int tarindex, state, ch;
-       u_char nextbyte;
-       char *pos;
-
-       state = 0;
-       tarindex = 0;
-
-       while ((ch = (unsigned char)*src++) != '\0') {
-               if (isspace(ch))        /* Skip whitespace anywhere. */
-                       continue;
-
-               if (ch == Pad64)
-                       break;
-
-               pos = strchr(Base64, ch);
-               if (pos == 0)           /* A non-base64 character. */
-                       return (-1);
-
-               switch (state) {
-               case 0:
-                       if (target) {
-                               if (tarindex >= targsize)
-                                       return (-1);
-                               target[tarindex] = (pos - Base64) << 2;
-                       }
-                       state = 1;
-                       break;
-               case 1:
-                       if (target) {
-                               if (tarindex >= targsize)
-                                       return (-1);
-                               target[tarindex]   |=  (pos - Base64) >> 4;
-                               nextbyte = ((pos - Base64) & 0x0f) << 4;
-                               if (tarindex + 1 < targsize)
-                                       target[tarindex+1] = nextbyte;
-                               else if (nextbyte)
-                                       return (-1);
-                       }
-                       tarindex++;
-                       state = 2;
-                       break;
-               case 2:
-                       if (target) {
-                               if (tarindex >= targsize)
-                                       return (-1);
-                               target[tarindex]   |=  (pos - Base64) >> 2;
-                               nextbyte = ((pos - Base64) & 0x03) << 6;
-                               if (tarindex + 1 < targsize)
-                                       target[tarindex+1] = nextbyte;
-                               else if (nextbyte)
-                                       return (-1);
-                       }
-                       tarindex++;
-                       state = 3;
-                       break;
-               case 3:
-                       if (target) {
-                               if (tarindex >= targsize)
-                                       return (-1);
-                               target[tarindex] |= (pos - Base64);
-                       }
-                       tarindex++;
-                       state = 0;
-                       break;
-               }
-       }
-
-       /*
-        * We are done decoding Base-64 chars.  Let's see if we ended
-        * on a byte boundary, and/or with erroneous trailing characters.
-        */
-
-       if (ch == Pad64) {                      /* We got a pad char. */
-               ch = (unsigned char)*src++;     /* Skip it, get next. */
-               switch (state) {
-               case 0:         /* Invalid = in first position */
-               case 1:         /* Invalid = in second position */
-                       return (-1);
-
-               case 2:         /* Valid, means one byte of info */
-                       /* Skip any number of spaces. */
-                       for (; ch != '\0'; ch = (unsigned char)*src++)
-                               if (!isspace(ch))
-                                       break;
-                       /* Make sure there is another trailing = sign. */
-                       if (ch != Pad64)
-                               return (-1);
-                       ch = (unsigned char)*src++;             /* Skip the = */
-                       /* Fall through to "single trailing =" case. */
-                       /* FALLTHROUGH */
-
-               case 3:         /* Valid, means two bytes of info */
-                       /*
-                        * We know this char is an =.  Is there anything but
-                        * whitespace after it?
-                        */
-                       for (; ch != '\0'; ch = (unsigned char)*src++)
-                               if (!isspace(ch))
-                                       return (-1);
-
-                       /*
-                        * Now make sure for cases 2 and 3 that the "extra"
-                        * bits that slopped past the last full byte were
-                        * zeros.  If we don't check them, they become a
-                        * subliminal channel.
-                        */
-                       if (target && tarindex < targsize &&
-                           target[tarindex] != 0)
-                               return (-1);
-               }
-       } else {
-               /*
-                * We ended by seeing the end of the string.  Make sure we
-                * have no partial bytes lying around.
-                */
-               if (state != 0)
-                       return (-1);
-       }
-
-       return (tarindex);
-}
diff --git a/crypto/libressl/apps/nc/compat/readpassphrase.c b/crypto/libressl/apps/nc/compat/readpassphrase.c
deleted file mode 100644 (file)
index f3aa248..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/*     $OpenBSD: readpassphrase.c,v 1.22 2010/01/13 10:20:54 dtucker Exp $     */
-
-/*
- * Copyright (c) 2000-2002, 2007 Todd C. Miller <Todd.Miller@courtesan.com>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Sponsored in part by the Defense Advanced Research Projects
- * Agency (DARPA) and Air Force Research Laboratory, Air Force
- * Materiel Command, USAF, under agreement number F39502-99-1-0512.
- */
-
-/* OPENBSD ORIGINAL: lib/libc/gen/readpassphrase.c */
-
-#include <termios.h>
-#include <signal.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <readpassphrase.h>
-
-#ifndef _PATH_TTY
-# define _PATH_TTY "/dev/tty"
-#endif
-
-#ifdef TCSASOFT
-# define _T_FLUSH      (TCSAFLUSH|TCSASOFT)
-#else
-# define _T_FLUSH      (TCSAFLUSH)
-#endif
-
-/* SunOS 4.x which lacks _POSIX_VDISABLE, but has VDISABLE */
-#if !defined(_POSIX_VDISABLE) && defined(VDISABLE)
-#  define _POSIX_VDISABLE       VDISABLE
-#endif
-
-#ifndef _NSIG
-# ifdef NSIG
-#  define _NSIG NSIG
-# else
-#  define _NSIG 128
-# endif
-#endif
-
-static volatile sig_atomic_t signo[_NSIG];
-
-static void handler(int);
-
-char *
-readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags)
-{
-       ssize_t bytes_written = 0;
-       ssize_t nr;
-       int input, output, save_errno, i, need_restart;
-       char ch, *p, *end;
-       struct termios term, oterm;
-       struct sigaction sa, savealrm, saveint, savehup, savequit, saveterm;
-       struct sigaction savetstp, savettin, savettou, savepipe;
-
-       /* I suppose we could alloc on demand in this case (XXX). */
-       if (bufsiz == 0) {
-               errno = EINVAL;
-               return(NULL);
-       }
-
-restart:
-       for (i = 0; i < _NSIG; i++)
-               signo[i] = 0;
-       nr = -1;
-       save_errno = 0;
-       need_restart = 0;
-       /*
-        * Read and write to /dev/tty if available.  If not, read from
-        * stdin and write to stderr unless a tty is required.
-        */
-       if ((flags & RPP_STDIN) ||
-           (input = output = open(_PATH_TTY, O_RDWR)) == -1) {
-               if (flags & RPP_REQUIRE_TTY) {
-                       errno = ENOTTY;
-                       return(NULL);
-               }
-               input = STDIN_FILENO;
-               output = STDERR_FILENO;
-       }
-
-       /*
-        * Catch signals that would otherwise cause the user to end
-        * up with echo turned off in the shell.  Don't worry about
-        * things like SIGXCPU and SIGVTALRM for now.
-        */
-       sigemptyset(&sa.sa_mask);
-       sa.sa_flags = 0;                /* don't restart system calls */
-       sa.sa_handler = handler;
-       (void)sigaction(SIGALRM, &sa, &savealrm);
-       (void)sigaction(SIGHUP, &sa, &savehup);
-       (void)sigaction(SIGINT, &sa, &saveint);
-       (void)sigaction(SIGPIPE, &sa, &savepipe);
-       (void)sigaction(SIGQUIT, &sa, &savequit);
-       (void)sigaction(SIGTERM, &sa, &saveterm);
-       (void)sigaction(SIGTSTP, &sa, &savetstp);
-       (void)sigaction(SIGTTIN, &sa, &savettin);
-       (void)sigaction(SIGTTOU, &sa, &savettou);
-
-       /* Turn off echo if possible. */
-       if (input != STDIN_FILENO && tcgetattr(input, &oterm) == 0) {
-               memcpy(&term, &oterm, sizeof(term));
-               if (!(flags & RPP_ECHO_ON))
-                       term.c_lflag &= ~(ECHO | ECHONL);
-#ifdef VSTATUS
-               if (term.c_cc[VSTATUS] != _POSIX_VDISABLE)
-                       term.c_cc[VSTATUS] = _POSIX_VDISABLE;
-#endif
-               (void)tcsetattr(input, _T_FLUSH, &term);
-       } else {
-               memset(&term, 0, sizeof(term));
-               term.c_lflag |= ECHO;
-               memset(&oterm, 0, sizeof(oterm));
-               oterm.c_lflag |= ECHO;
-       }
-
-       /* No I/O if we are already backgrounded. */
-       if (signo[SIGTTOU] != 1 && signo[SIGTTIN] != 1) {
-               if (!(flags & RPP_STDIN))
-                       bytes_written = write(output, prompt, strlen(prompt));
-               end = buf + bufsiz - 1;
-               p = buf;
-               while ((nr = read(input, &ch, 1)) == 1 && ch != '\n' && ch != '\r') {
-                       if (p < end) {
-                               if ((flags & RPP_SEVENBIT))
-                                       ch &= 0x7f;
-                               if (isalpha((unsigned char)ch)) {
-                                       if ((flags & RPP_FORCELOWER))
-                                               ch = (char)tolower((unsigned char)ch);
-                                       if ((flags & RPP_FORCEUPPER))
-                                               ch = (char)toupper((unsigned char)ch);
-                               }
-                               *p++ = ch;
-                       }
-               }
-               *p = '\0';
-               save_errno = errno;
-               if (!(term.c_lflag & ECHO))
-                       bytes_written = write(output, "\n", 1);
-       }
-
-       (void) bytes_written;
-
-       /* Restore old terminal settings and signals. */
-       if (memcmp(&term, &oterm, sizeof(term)) != 0) {
-               while (tcsetattr(input, _T_FLUSH, &oterm) == -1 &&
-                   errno == EINTR)
-                       continue;
-       }
-       (void)sigaction(SIGALRM, &savealrm, NULL);
-       (void)sigaction(SIGHUP, &savehup, NULL);
-       (void)sigaction(SIGINT, &saveint, NULL);
-       (void)sigaction(SIGQUIT, &savequit, NULL);
-       (void)sigaction(SIGPIPE, &savepipe, NULL);
-       (void)sigaction(SIGTERM, &saveterm, NULL);
-       (void)sigaction(SIGTSTP, &savetstp, NULL);
-       (void)sigaction(SIGTTIN, &savettin, NULL);
-       (void)sigaction(SIGTTOU, &savettou, NULL);
-       if (input != STDIN_FILENO)
-               (void)close(input);
-
-       /*
-        * If we were interrupted by a signal, resend it to ourselves
-        * now that we have restored the signal handlers.
-        */
-       for (i = 0; i < _NSIG; i++) {
-               if (signo[i]) {
-                       kill(getpid(), i);
-                       switch (i) {
-                       case SIGTSTP:
-                       case SIGTTIN:
-                       case SIGTTOU:
-                               need_restart = 1;
-                       }
-               }
-       }
-       if (need_restart)
-               goto restart;
-
-       if (save_errno)
-               errno = save_errno;
-       return(nr == -1 ? NULL : buf);
-}
-
-static void handler(int s)
-{
-       signo[s] = 1;
-}
diff --git a/crypto/libressl/apps/nc/compat/socket.c b/crypto/libressl/apps/nc/compat/socket.c
deleted file mode 100644 (file)
index fd699f9..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#define SOCKET_FLAGS_PRIV
-
-#include <sys/socket.h>
-
-#ifdef NEED_SOCKET_FLAGS
-
-#include <fcntl.h>
-
-int
-_socket(int domain, int type, int protocol)
-{
-       int s = socket(domain, type & ~(SOCK_CLOEXEC | SOCK_NONBLOCK), protocol);
-       int flags;
-       if (s == -1)
-               return s;
-
-       if (type & SOCK_CLOEXEC) {
-               flags = fcntl(s, F_GETFD);
-               fcntl(s, F_SETFD, flags | FD_CLOEXEC);
-       }
-
-       if (type & SOCK_NONBLOCK) {
-               flags = fcntl(s, F_GETFL);
-               fcntl(s, F_SETFL, flags | O_NONBLOCK);
-       }
-       return s;
-}
-
-#endif
diff --git a/crypto/libressl/apps/nc/compat/strtonum.c b/crypto/libressl/apps/nc/compat/strtonum.c
deleted file mode 100644 (file)
index 1aeee34..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*     $OpenBSD: strtonum.c,v 1.7 2013/04/17 18:40:58 tedu Exp $       */
-
-/*
- * Copyright (c) 2004 Ted Unangst and Todd Miller
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-
-#define        INVALID         1
-#define        TOOSMALL        2
-#define        TOOLARGE        3
-
-long long
-strtonum(const char *numstr, long long minval, long long maxval,
-    const char **errstrp)
-{
-       long long ll = 0;
-       int error = 0;
-       char *ep;
-       struct errval {
-               const char *errstr;
-               int err;
-       } ev[4] = {
-               { NULL,         0 },
-               { "invalid",    EINVAL },
-               { "too small",  ERANGE },
-               { "too large",  ERANGE },
-       };
-
-       ev[0].err = errno;
-       errno = 0;
-       if (minval > maxval) {
-               error = INVALID;
-       } else {
-               ll = strtoll(numstr, &ep, 10);
-               if (numstr == ep || *ep != '\0')
-                       error = INVALID;
-               else if ((ll == LLONG_MIN && errno == ERANGE) || ll < minval)
-                       error = TOOSMALL;
-               else if ((ll == LLONG_MAX && errno == ERANGE) || ll > maxval)
-                       error = TOOLARGE;
-       }
-       if (errstrp != NULL)
-               *errstrp = ev[error].errstr;
-       errno = ev[error].err;
-       if (error)
-               ll = 0;
-
-       return (ll);
-}
diff --git a/crypto/libressl/apps/nc/compat/sys/socket.h b/crypto/libressl/apps/nc/compat/sys/socket.h
deleted file mode 100644 (file)
index 13eb380..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Public domain
- * sys/socket.h compatibility shim
- */
-
-#ifndef _WIN32
-#include_next <sys/socket.h>
-
-#if !defined(SOCK_NONBLOCK) || !defined(SOCK_CLOEXEC)
-#define NEED_SOCKET_FLAGS
-int _socket(int domain, int type, int protocol);
-#ifndef SOCKET_FLAGS_PRIV
-#define socket(d, t, p) _socket(d, t, p)
-#endif
-#endif
-
-#ifndef SOCK_NONBLOCK
-#define        SOCK_NONBLOCK           0x4000  /* set O_NONBLOCK */
-#endif
-
-#ifndef SOCK_CLOEXEC
-#define        SOCK_CLOEXEC            0x8000  /* set FD_CLOEXEC */
-#endif
-
-#ifndef HAVE_ACCEPT4
-int accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags);
-#endif
-
-#else
-#include <win32netcompat.h>
-#endif
index e9d3499..6bdfe4f 100644 (file)
@@ -1,4 +1,4 @@
-.\"     $OpenBSD: nc.1,v 1.73 2016/06/28 17:35:14 jca Exp $
+.\"     $OpenBSD: nc.1,v 1.93 2018/12/27 17:45:36 jmc Exp $
 .\"
 .\" Copyright (c) 1996 David Sacerdote
 .\" All rights reserved.
@@ -25,7 +25,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd $Mdocdate: June 28 2016 $
+.Dd $Mdocdate: December 27 2018 $
 .Dt NC 1
 .Os
 .Sh NAME
 .Op Fl M Ar ttl
 .Op Fl m Ar minttl
 .Op Fl O Ar length
+.Op Fl o Ar staplefile
 .Op Fl P Ar proxy_username
 .Op Fl p Ar source_port
 .Op Fl R Ar CAfile
 .Op Fl s Ar source
 .Op Fl T Ar keyword
 .Op Fl V Ar rtable
+.Op Fl W Ar recvlimit
 .Op Fl w Ar timeout
 .Op Fl X Ar proxy_protocol
 .Op Fl x Ar proxy_address Ns Op : Ns Ar port
+.Op Fl Z Ar peercertfile
 .Op Ar destination
 .Op Ar port
 .Sh DESCRIPTION
@@ -93,27 +96,31 @@ and much, much more
 The options are as follows:
 .Bl -tag -width Ds
 .It Fl 4
-Forces
-.Nm
-to use IPv4 addresses only.
+Use IPv4 addresses only.
 .It Fl 6
-Forces
-.Nm
-to use IPv6 addresses only.
+Use IPv6 addresses only.
 .It Fl C Ar certfile
-Specifies the filename from which the public key part of the TLS
-certificate is loaded, in PEM format.
-May only be used with TLS.
+Load the public key part of the TLS peer certificate from
+.Ar certfile ,
+in PEM format.
+Requires
+.Fl c .
 .It Fl c
-If using a TCP socket to connect or listen, use TLS.
-Illegal if not using TCP sockets.
+Use TLS to connect or listen.
+Cannot be used together with any of the options
+.Fl FuU .
 .It Fl D
 Enable debugging on the socket.
 .It Fl d
 Do not attempt to read from stdin.
 .It Fl e Ar name
-Specify the name that must be present in the peer certificate when using TLS.
-Illegal if not using TLS.
+Only accept the TLS peer certificate if it contains the
+.Ar name .
+Requires
+.Fl c .
+If not specified,
+.Ar destination
+is used.
 .It Fl F
 Pass the first connected socket using
 .Xr sendmsg 2
@@ -129,47 +136,49 @@ using the
 .Xr ssh_config 5
 .Cm ProxyUseFdpass
 option).
+Cannot be used with
+.Fl c
+or
+.Fl U .
 .It Fl H Ar hash
-Specifies the required hash string of the peer certificate when using TLS.
-The string format required is that used by
-.Xr tls_peer_cert_hash 3 .
-Illegal if not using TLS, and may not be used with -T noverify.
+Only accept the TLS peer certificate if its hash returned from
+.Xr tls_peer_cert_hash 3
+matches
+.Ar hash .
+Requires
+.Fl c
+and cannot be used with
+.Fl T Cm noverify .
 .It Fl h
-Prints out
+Print out the
 .Nm
-help.
+help text and exit.
 .It Fl I Ar length
-Specifies the size of the TCP receive buffer.
+Specify the size of the TCP receive buffer.
 .It Fl i Ar interval
-Specifies a delay time interval between lines of text sent and received.
+Sleep for
+.Ar interval
+seconds between lines of text sent and received.
 Also causes a delay time between connections to multiple ports.
 .It Fl K Ar keyfile
-Specifies the filename from which the private key
-is loaded in PEM format.
-May only be used with TLS.
+Load the TLS private key from
+.Ar keyfile ,
+in PEM format.
+Requires
+.Fl c .
 .It Fl k
-Forces
-.Nm
-to stay listening for another connection after its current connection
-is completed.
-It is an error to use this option without the
-.Fl l
-option.
+When a connection is completed, listen for another one.
+Requires
+.Fl l .
 When used together with the
 .Fl u
 option, the server socket is not connected and it can receive UDP datagrams from
 multiple hosts.
 .It Fl l
-Used to specify that
-.Nm
-should listen for an incoming connection rather than initiate a
+Listen for an incoming connection rather than initiating a
 connection to a remote host.
-It is an error to use this option in conjunction with the
-.Fl p ,
-.Fl s ,
-or
-.Fl z
-options.
+Cannot be used together with any of the options
+.Fl psxz .
 Additionally, any timeouts specified with the
 .Fl w
 option are ignored.
@@ -186,81 +195,111 @@ Some servers require this to finish their work.
 Do not do any DNS or service lookups on any specified addresses,
 hostnames or ports.
 .It Fl O Ar length
-Specifies the size of the TCP send buffer.
+Specify the size of the TCP send buffer.
+.It Fl o Ar staplefile
+During the TLS handshake, load data to be stapled from
+.Ar staplefile ,
+which is expected to contain an OCSP response from an OCSP server in
+DER format.
+Requires
+.Fl c
+and
+.Fl C .
 .It Fl P Ar proxy_username
 Specifies a username to present to a proxy server that requires authentication.
 If no username is specified then authentication will not be attempted.
 Proxy authentication is only supported for HTTP CONNECT proxies at present.
 .It Fl p Ar source_port
-Specifies the source port
+Specify the source port
 .Nm
 should use, subject to privilege restrictions and availability.
-It is an error to use this option in conjunction with the
-.Fl l
-option.
+Cannot be used together with
+.Fl l .
 .It Fl R Ar CAfile
-Specifies the filename from which the root CA bundle for certificate
-verification is loaded, in PEM format.
-Illegal if not using TLS.
-The default is
+Load the root CA bundle for TLS certificate verification from
+.Ar CAfile ,
+in PEM format, instead of
 .Pa /etc/ssl/cert.pem .
+Requires
+.Fl c .
 .It Fl r
-Specifies that source and/or destination ports should be chosen randomly
+Choose source and/or destination ports randomly
 instead of sequentially within a range or in the order that the system
 assigns them.
 .It Fl S
-Enables the RFC 2385 TCP MD5 signature option.
+Enable the RFC 2385 TCP MD5 signature option.
 .It Fl s Ar source
-Specifies the IP of the interface which is used to send the packets.
+Send packets from the interface with the
+.Ar source
+IP address.
 For
 .Ux Ns -domain
 datagram sockets, specifies the local temporary socket file
 to create and use so that datagrams can be received.
-It is an error to use this option in conjunction with the
+Cannot be used together with
 .Fl l
-option.
+or
+.Fl x .
 .It Fl T Ar keyword
-Change IPv4 TOS value or TLS options.
-For TLS options
+Change the IPv4 TOS/IPv6 traffic class value or the TLS options.
+.Pp
+For TLS options,
 .Ar keyword
-may be one of
-.Ar tlslegacy ,
-which allows legacy TLS protocols;
-.Ar noverify ,
+may be one of:
+.Cm noverify ,
 which disables certificate verification;
-.Ar noname ,
-which disables certificate name checking; or
-.Ar clientcert ,
-which requires a client certificate on incoming connections.
-It is illegal to specify TLS options if not using TLS.
-.Pp
-For IPv4 TOS value
+.Cm noname ,
+which disables certificate name checking;
+.Cm clientcert ,
+which requires a client certificate on incoming connections; or
+.Cm muststaple ,
+which requires the peer to provide a valid stapled OCSP response
+with the handshake.
+The following TLS options specify a value in the form of a
+.Ar key Ns = Ns Ar value
+pair:
+.Cm ciphers ,
+which allows the supported TLS ciphers to be specified (see
+.Xr tls_config_set_ciphers 3
+for further details);
+.Cm protocols ,
+which allows the supported TLS protocols to be specified (see
+.Xr tls_config_parse_protocols 3
+for further details).
+Specifying TLS options requires
+.Fl c .
+.Pp
+For the IPv4 TOS/IPv6 traffic class value,
 .Ar keyword
 may be one of
-.Ar critical ,
-.Ar inetcontrol ,
-.Ar lowdelay ,
-.Ar netcontrol ,
-.Ar throughput ,
-.Ar reliability ,
+.Cm critical ,
+.Cm inetcontrol ,
+.Cm lowdelay ,
+.Cm netcontrol ,
+.Cm throughput ,
+.Cm reliability ,
 or one of the DiffServ Code Points:
-.Ar ef ,
-.Ar af11 ... af43 ,
-.Ar cs0 ... cs7 ;
+.Cm ef ,
+.Cm af11 No ... Cm af43 ,
+.Cm cs0 No ... Cm cs7 ;
 or a number in either hex or decimal.
 .It Fl t
-Causes
-.Nm
-to send RFC 854 DON'T and WON'T responses to RFC 854 DO and WILL requests.
+Send RFC 854 DON'T and WON'T responses to RFC 854 DO and WILL requests.
 This makes it possible to use
 .Nm
 to script telnet sessions.
 .It Fl U
-Specifies to use
+Use
 .Ux Ns -domain
 sockets.
+Cannot be used together with any of the options
+.Fl cFx .
 .It Fl u
-Use UDP instead of the default option of TCP.
+Use UDP instead of TCP.
+Cannot be used together with
+.Fl c
+or
+.Fl x .
 For
 .Ux Ns -domain
 sockets, use a datagram socket instead of a stream socket.
@@ -274,9 +313,11 @@ flag is given.
 .It Fl V Ar rtable
 Set the routing table to be used.
 .It Fl v
-Have
-.Nm
-give more verbose output.
+Produce more verbose output.
+.It Fl W Ar recvlimit
+Terminate after receiving
+.Ar recvlimit
+packets from the network.
 .It Fl w Ar timeout
 Connections which cannot be established or are idle timeout after
 .Ar timeout
@@ -292,22 +333,20 @@ will listen forever for a connection, with or without the
 flag.
 The default is no timeout.
 .It Fl X Ar proxy_protocol
-Requests that
-.Nm
-should use the specified protocol when talking to the proxy server.
+Use
+.Ar proxy_protocol
+when talking to the proxy server.
 Supported protocols are
-.Dq 4
+.Cm 4
 (SOCKS v.4),
-.Dq 5
+.Cm 5
 (SOCKS v.5)
 and
-.Dq connect
+.Cm connect
 (HTTPS proxy).
 If the protocol is not specified, SOCKS version 5 is used.
 .It Fl x Ar proxy_address Ns Op : Ns Ar port
-Requests that
-.Nm
-should connect to
+Connect to
 .Ar destination
 using a proxy at
 .Ar proxy_address
@@ -317,13 +356,21 @@ If
 .Ar port
 is not specified, the well-known port for the proxy protocol is used (1080
 for SOCKS, 3128 for HTTPS).
+An IPv6 address can be specified unambiguously by enclosing
+.Ar proxy_address
+in square brackets.
+A proxy cannot be used with any of the options
+.Fl lsuU .
+.It Fl Z Ar peercertfile
+Save the peer certificates to
+.Ar peercertfile ,
+in PEM format.
+Requires
+.Fl c .
 .It Fl z
-Specifies that
-.Nm
-should just scan for listening daemons, without sending any data to them.
-It is an error to use this option in conjunction with the
-.Fl l
-option.
+Only scan for listening daemons, without sending any data to them.
+Cannot be used together with
+.Fl l .
 .El
 .Pp
 .Ar destination
@@ -344,8 +391,9 @@ sockets, a destination is required and is the socket path to connect to
 option is given).
 .Pp
 .Ar port
-can be a specified as a numeric port number, or as a service name.
-Ports may be specified in a range of the form nn-mm.
+can be specified as a numeric port number or as a service name.
+Port ranges may be specified as numeric port numbers of the form
+.Ar nn Ns - Ns Ar mm .
 In general,
 a destination port must be specified,
 unless the
@@ -472,10 +520,15 @@ the source port, with a timeout of 5 seconds:
 .Pp
 .Dl $ nc -p 31337 -w 5 host.example.com 42
 .Pp
+Open a TCP connection to port 443 of www.example.com, and negotiate TLS with
+any supported TLS protocol version and "compat" ciphers:
+.Pp
+.Dl $ nc -cv -T protocols=all -T ciphers=compat www.example.com 443
+.Pp
 Open a TCP connection to port 443 of www.google.ca, and negotiate TLS.
-Check for a different name in the certificate for validation.
+Check for a different name in the certificate for validation:
 .Pp
-.Dl $  nc -v -c -e adsf.au.doubleclick.net www.google.ca 443
+.Dl $ nc -cv -e adsf.au.doubleclick.net www.google.ca 443
 .Pp
 Open a UDP connection to port 53 of host.example.com:
 .Pp
@@ -513,8 +566,8 @@ if the proxy requires it:
 .Xr cat 1 ,
 .Xr ssh 1
 .Sh AUTHORS
-Original implementation by *Hobbit*
-.Aq Mt hobbit@avian.org .
+Original implementation by
+.An *Hobbit* Aq Mt hobbit@avian.org .
 .br
 Rewritten with IPv6 support by
 .An Eric Jackson Aq Mt ericj@monkey.org .
index cdb2db2..25b767c 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: netcat.c,v 1.159 2016/07/07 14:09:44 jsing Exp $ */
+/* $OpenBSD: netcat.c,v 1.203 2019/02/26 17:32:47 jsing Exp $ */
 /*
  * Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
  * Copyright (c) 2015 Bob Beck.  All rights reserved.
@@ -42,6 +42,7 @@
 #include <netinet/ip.h>
 #include <arpa/telnet.h>
 
+#include <ctype.h>
 #include <err.h>
 #include <errno.h>
 #include <limits.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
-#include <unistd.h>
 #include <tls.h>
+#include <unistd.h>
+
 #include "atomicio.h"
 
 #define PORT_MAX       65535
 #define UNIX_DG_TMP_SOCKET_SIZE        19
 
-#define POLL_STDIN 0
-#define POLL_NETOUT 1
-#define POLL_NETIN 2
-#define POLL_STDOUT 3
-#define BUFSIZE 16384
-#ifndef DEFAULT_CA_FILE
-#define DEFAULT_CA_FILE "/etc/ssl/cert.pem"
-#endif
+#define POLL_STDIN     0
+#define POLL_NETOUT    1
+#define POLL_NETIN     2
+#define POLL_STDOUT    3
+#define BUFSIZE                16384
 
-#define TLS_LEGACY     (1 << 1)
-#define TLS_NOVERIFY   (1 << 2)
-#define TLS_NONAME     (1 << 3)
-#define TLS_CCERT      (1 << 4)
+#define TLS_NOVERIFY   (1 << 1)
+#define TLS_NONAME     (1 << 2)
+#define TLS_CCERT      (1 << 3)
+#define TLS_MUSTSTAPLE (1 << 4)
 
 /* Command Line Options */
 int    dflag;                                  /* detached, no stdin */
@@ -103,20 +102,19 @@ int       rtableid = -1;
 #endif
 
 int    usetls;                                 /* use TLS */
-char    *Cflag;                                        /* Public cert file */
-char    *Kflag;                                        /* Private key file */
-char    *Rflag = DEFAULT_CA_FILE;              /* Root CA file */
+const char    *Cflag;                          /* Public cert file */
+const char    *Kflag;                          /* Private key file */
+const char    *oflag;                          /* OCSP stapling file */
+const char    *Rflag;                          /* Root CA file */
 int    tls_cachanged;                          /* Using non-default CA file */
 int     TLSopt;                                        /* TLS options */
 char   *tls_expectname;                        /* required name in peer cert */
 char   *tls_expecthash;                        /* required hash of peer cert */
-uint8_t *cacert;
-size_t  cacertlen;
-uint8_t *privkey;
-size_t  privkeylen;
-uint8_t *pubcert;
-size_t  pubcertlen;
+char   *tls_ciphers;                           /* TLS ciphers */
+char   *tls_protocols;                         /* TLS protocols */
+FILE   *Zflag;                                 /* file to save peer cert */
 
+int recvcount, recvlimit;
 int timeout = -1;
 int family = AF_UNSPEC;
 char *portlist[PORT_MAX+1];
@@ -125,12 +123,14 @@ int ttl = -1;
 int minttl = -1;
 
 void   atelnet(int, unsigned char *, unsigned int);
+int    strtoport(char *portstr, int udp);
 void   build_ports(char *);
-void   help(void);
-int    local_listen(char *, char *, struct addrinfo);
+void   help(void) __attribute__((noreturn));
+int    local_listen(const char *, const char *, struct addrinfo);
 void   readwrite(int, struct tls *);
 void   fdpass(int nfd) __attribute__((noreturn));
 int    remote_connect(const char *, const char *, struct addrinfo);
+int    timeout_tls(int, struct tls *, int (*)(struct tls *));
 int    timeout_connect(int, const struct sockaddr *, socklen_t);
 int    socks_connect(const char *, const char *, struct addrinfo,
            const char *, const char *, struct addrinfo, int, const char *);
@@ -139,10 +139,11 @@ int       unix_bind(char *, int);
 int    unix_connect(char *);
 int    unix_listen(char *);
 void   set_common_sockopts(int, int);
-int    map_tos(char *, int *);
-int    map_tls(char *, int *);
-void   report_connect(const struct sockaddr *, socklen_t, char *);
-void   report_tls(struct tls *tls_ctx, char * host, char *tls_expectname);
+int    process_tos_opt(char *, int *);
+int    process_tls_opt(char *, int *);
+void   save_peer_cert(struct tls *_tls_ctx, FILE *_fp);
+void   report_sock(const char *, const struct sockaddr *, socklen_t, char *);
+void   report_tls(struct tls *tls_ctx, char * host);
 void   usage(int);
 ssize_t drainbuf(int, unsigned char *, size_t *, struct tls *);
 ssize_t fillbuf(int, unsigned char *, size_t *, struct tls *);
@@ -158,23 +159,26 @@ main(int argc, char *argv[])
        struct servent *sv;
        socklen_t len;
        struct sockaddr_storage cliaddr;
-       char *proxy = NULL;
-       const char *errstr, *proxyhost = "", *proxyport = NULL;
+       char *proxy = NULL, *proxyport = NULL;
+       const char *errstr;
        struct addrinfo proxyhints;
        char unix_dg_tmp_socket_buf[UNIX_DG_TMP_SOCKET_SIZE];
        struct tls_config *tls_cfg = NULL;
        struct tls *tls_ctx = NULL;
+       uint32_t protocols;
 
        ret = 1;
        socksv = 5;
        host = NULL;
        uport = NULL;
        sv = NULL;
+       Rflag = tls_default_ca_cert_file();
 
        signal(SIGPIPE, SIG_IGN);
 
        while ((ch = getopt(argc, argv,
-           "46C:cDde:FH:hI:i:K:klM:m:NnO:P:p:R:rSs:T:tUuV:vw:X:x:z")) != -1) {
+           "46C:cDde:FH:hI:i:K:klM:m:NnO:o:P:p:R:rSs:T:tUuV:vW:w:X:x:Z:z"))
+           != -1) {
                switch (ch) {
                case '4':
                        family = AF_INET;
@@ -279,6 +283,11 @@ main(int argc, char *argv[])
                case 'v':
                        vflag = 1;
                        break;
+               case 'W':
+                       recvlimit = strtonum(optarg, 1, INT_MAX, &errstr);
+                       if (errstr)
+                               errx(1, "receive limit %s: %s", errstr, optarg);
+                       break;
                case 'w':
                        timeout = strtonum(optarg, 0, INT_MAX / 1000, &errstr);
                        if (errstr)
@@ -290,6 +299,12 @@ main(int argc, char *argv[])
                        if ((proxy = strdup(optarg)) == NULL)
                                err(1, NULL);
                        break;
+               case 'Z':
+                       if (strcmp(optarg, "-") == 0)
+                               Zflag = stderr;
+                       else if ((Zflag = fopen(optarg, "w")) == NULL)
+                               err(1, "can't open %s", optarg);
+                       break;
                case 'z':
                        zflag = 1;
                        break;
@@ -308,6 +323,9 @@ main(int argc, char *argv[])
                                errx(1, "TCP send window %s: %s",
                                    errstr, optarg);
                        break;
+               case 'o':
+                       oflag = optarg;
+                       break;
 #ifdef TCP_MD5SIG
                case 'S':
                        Sflag = 1;
@@ -316,9 +334,9 @@ main(int argc, char *argv[])
                case 'T':
                        errstr = NULL;
                        errno = 0;
-                       if (map_tos(optarg, &Tflag))
+                       if (process_tls_opt(optarg, &TLSopt))
                                break;
-                       if (map_tls(optarg, &TLSopt))
+                       if (process_tos_opt(optarg, &Tflag))
                                break;
                        if (strlen(optarg) > 1 && optarg[0] == '0' &&
                            optarg[1] == 'x')
@@ -342,30 +360,12 @@ main(int argc, char *argv[])
                        err(1, "setrtable");
 #endif
 
-       if (family == AF_UNIX) {
-               if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1)
-                       err(1, "pledge");
-       } else if (Fflag) {
-               if (Pflag) {
-                       if (pledge("stdio inet dns sendfd tty", NULL) == -1)
-                               err(1, "pledge");
-               } else if (pledge("stdio inet dns sendfd", NULL) == -1)
-                       err(1, "pledge");
-       } else if (Pflag) {
-               if (pledge("stdio inet dns tty", NULL) == -1)
-                       err(1, "pledge");
-       } else if (usetls) {
-               if (pledge("stdio rpath inet dns", NULL) == -1)
-                       err(1, "pledge");
-       } else if (pledge("stdio inet dns", NULL) == -1)
-               err(1, "pledge");
-
        /* Cruft to make sure options are clean, and used properly. */
        if (argv[0] && !argv[1] && family == AF_UNIX) {
                host = argv[0];
                uport = NULL;
        } else if (argv[0] && !argv[1]) {
-               if  (!lflag)
+               if (!lflag)
                        usage(1);
                uport = argv[0];
                host = NULL;
@@ -375,6 +375,50 @@ main(int argc, char *argv[])
        } else
                usage(1);
 
+       if (usetls) {
+               if (Cflag && unveil(Cflag, "r") == -1)
+                       err(1, "unveil");
+               if (unveil(Rflag, "r") == -1)
+                       err(1, "unveil");
+               if (Kflag && unveil(Kflag, "r") == -1)
+                       err(1, "unveil");
+               if (oflag && unveil(oflag, "r") == -1)
+                       err(1, "unveil");
+       } else {
+               if (family == AF_UNIX) {
+                       if (unveil(host, "rwc") == -1)
+                               err(1, "unveil");
+                       if (uflag && !lflag) {
+                               if (unveil(sflag ? sflag : "/tmp", "rwc") == -1)
+                                       err(1, "unveil");
+                       }
+               } else {
+                       if (unveil("/", "") == -1)
+                               err(1, "unveil");
+               }
+       }
+
+       if (family == AF_UNIX) {
+               if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1)
+                       err(1, "pledge");
+       } else if (Fflag && Pflag) {
+               if (pledge("stdio inet dns sendfd tty", NULL) == -1)
+                       err(1, "pledge");
+       } else if (Fflag) {
+               if (pledge("stdio inet dns sendfd", NULL) == -1)
+                       err(1, "pledge");
+       } else if (Pflag && usetls) {
+               if (pledge("stdio rpath inet dns tty", NULL) == -1)
+                       err(1, "pledge");
+       } else if (Pflag) {
+               if (pledge("stdio inet dns tty", NULL) == -1)
+                       err(1, "pledge");
+       } else if (usetls) {
+               if (pledge("stdio rpath inet dns", NULL) == -1)
+                       err(1, "pledge");
+       } else if (pledge("stdio inet dns", NULL) == -1)
+               err(1, "pledge");
+
        if (lflag && sflag)
                errx(1, "cannot use -s and -l");
        if (lflag && pflag)
@@ -397,6 +441,10 @@ main(int argc, char *argv[])
                errx(1, "you must specify -c to use -C");
        if (Kflag && !usetls)
                errx(1, "you must specify -c to use -K");
+       if (Zflag && !usetls)
+               errx(1, "you must specify -c to use -Z");
+       if (oflag && !Cflag)
+               errx(1, "you must specify -C to use -o");
        if (tls_cachanged && !usetls)
                errx(1, "you must specify -c to use -R");
        if (tls_expecthash && !usetls)
@@ -437,15 +485,29 @@ main(int argc, char *argv[])
                if (family == AF_UNIX)
                        errx(1, "no proxy support for unix sockets");
 
-               /* XXX IPv6 transport to proxy would probably work */
-               if (family == AF_INET6)
-                       errx(1, "no proxy support for IPv6");
-
                if (sflag)
                        errx(1, "no proxy support for local source address");
 
-               proxyhost = strsep(&proxy, ":");
-               proxyport = proxy;
+               if (*proxy == '[') {
+                       ++proxy;
+                       proxyport = strchr(proxy, ']');
+                       if (proxyport == NULL)
+                               errx(1, "missing closing bracket in proxy");
+                       *proxyport++ = '\0';
+                       if (*proxyport == '\0')
+                               /* Use default proxy port. */
+                               proxyport = NULL;
+                       else {
+                               if (*proxyport == ':')
+                                       ++proxyport;
+                               else
+                                       errx(1, "garbage proxy port delimiter");
+                       }
+               } else {
+                       proxyport = strrchr(proxy, ':');
+                       if (proxyport != NULL)
+                               *proxyport++ = '\0';
+               }
 
                memset(&proxyhints, 0, sizeof(struct addrinfo));
                proxyhints.ai_family = family;
@@ -456,50 +518,42 @@ main(int argc, char *argv[])
        }
 
        if (usetls) {
-               if (Rflag && (cacert = tls_load_file(Rflag, &cacertlen, NULL)) == NULL)
-                       errx(1, "unable to load root CA file %s", Rflag);
-               if (Cflag && (pubcert = tls_load_file(Cflag, &pubcertlen, NULL)) == NULL)
-                       errx(1, "unable to load TLS certificate file %s", Cflag);
-               if (Kflag && (privkey = tls_load_file(Kflag, &privkeylen, NULL)) == NULL)
-                       errx(1, "unable to load TLS key file %s", Kflag);
-
-               if (Pflag) {
-                       if (pledge("stdio inet dns tty", NULL) == -1)
-                               err(1, "pledge");
-               } else if (pledge("stdio inet dns", NULL) == -1)
-                       err(1, "pledge");
-
-               if (tls_init() == -1)
-                       errx(1, "unable to initialize TLS");
                if ((tls_cfg = tls_config_new()) == NULL)
                        errx(1, "unable to allocate TLS config");
-               if (Rflag && tls_config_set_ca_mem(tls_cfg, cacert, cacertlen) == -1)
-                       errx(1, "unable to set root CA file %s", Rflag);
-               if (Cflag && tls_config_set_cert_mem(tls_cfg, pubcert, pubcertlen) == -1)
-                       errx(1, "unable to set TLS certificate file %s", Cflag);
-               if (Kflag && tls_config_set_key_mem(tls_cfg, privkey, privkeylen) == -1)
-                       errx(1, "unable to set TLS key file %s", Kflag);
-               if (TLSopt & TLS_LEGACY) {
-                       tls_config_set_protocols(tls_cfg, TLS_PROTOCOLS_ALL);
-                       tls_config_set_ciphers(tls_cfg, "all");
-               }
+               if (Rflag && tls_config_set_ca_file(tls_cfg, Rflag) == -1)
+                       errx(1, "%s", tls_config_error(tls_cfg));
+               if (Cflag && tls_config_set_cert_file(tls_cfg, Cflag) == -1)
+                       errx(1, "%s", tls_config_error(tls_cfg));
+               if (Kflag && tls_config_set_key_file(tls_cfg, Kflag) == -1)
+                       errx(1, "%s", tls_config_error(tls_cfg));
+               if (oflag && tls_config_set_ocsp_staple_file(tls_cfg, oflag) == -1)
+                       errx(1, "%s", tls_config_error(tls_cfg));
+               if (tls_config_parse_protocols(&protocols, tls_protocols) == -1)
+                       errx(1, "invalid TLS protocols `%s'", tls_protocols);
+               if (tls_config_set_protocols(tls_cfg, protocols) == -1)
+                       errx(1, "%s", tls_config_error(tls_cfg));
+               if (tls_config_set_ciphers(tls_cfg, tls_ciphers) == -1)
+                       errx(1, "%s", tls_config_error(tls_cfg));
                if (!lflag && (TLSopt & TLS_CCERT))
                        errx(1, "clientcert is only valid with -l");
                if (TLSopt & TLS_NONAME)
                        tls_config_insecure_noverifyname(tls_cfg);
                if (TLSopt & TLS_NOVERIFY) {
                        if (tls_expecthash != NULL)
-                               errx(1, "-H and -T noverify may not be used"
+                               errx(1, "-H and -T noverify may not be used "
                                    "together");
                        tls_config_insecure_noverifycert(tls_cfg);
-               } else {
-                        if (Rflag && access(Rflag, R_OK) == -1)
-                                errx(1, "unable to find root CA file %s", Rflag);
-                }
+               }
+               if (TLSopt & TLS_MUSTSTAPLE)
+                       tls_config_ocsp_require_stapling(tls_cfg);
+
+               if (Pflag) {
+                       if (pledge("stdio inet dns tty", NULL) == -1)
+                               err(1, "pledge");
+               } else if (pledge("stdio inet dns", NULL) == -1)
+                       err(1, "pledge");
        }
        if (lflag) {
-               struct tls *tls_cctx = NULL;
-               int connfd;
                ret = 0;
 
                if (family == AF_UNIX) {
@@ -519,29 +573,32 @@ main(int argc, char *argv[])
                }
                /* Allow only one connection at a time, but stay alive. */
                for (;;) {
-                       if (family != AF_UNIX)
+                       if (family != AF_UNIX) {
+                               if (s != -1)
+                                       close(s);
                                s = local_listen(host, uport, hints);
+                       }
                        if (s < 0)
                                err(1, NULL);
-                       /*
-                        * For UDP and -k, don't connect the socket, let it
-                        * receive datagrams from multiple socket pairs.
-                        */
-                       if (uflag && kflag)
+                       if (uflag && kflag) {
+                               /*
+                                * For UDP and -k, don't connect the socket,
+                                * let it receive datagrams from multiple
+                                * socket pairs.
+                                */
                                readwrite(s, NULL);
-                       /*
-                        * For UDP and not -k, we will use recvfrom() initially
-                        * to wait for a caller, then use the regular functions
-                        * to talk to the caller.
-                        */
-                       else if (uflag && !kflag) {
-                               int rv, plen;
-                               char buf[16384];
+                       } else if (uflag && !kflag) {
+                               /*
+                                * For UDP and not -k, we will use recvfrom()
+                                * initially to wait for a caller, then use
+                                * the regular functions to talk to the caller.
+                                */
+                               int rv;
+                               char buf[2048];
                                struct sockaddr_storage z;
 
                                len = sizeof(z);
-                               plen = 2048;
-                               rv = recvfrom(s, buf, plen, MSG_PEEK,
+                               rv = recvfrom(s, buf, sizeof(buf), MSG_PEEK,
                                    (struct sockaddr *)&z, &len);
                                if (rv < 0)
                                        err(1, "recvfrom");
@@ -551,10 +608,14 @@ main(int argc, char *argv[])
                                        err(1, "connect");
 
                                if (vflag)
-                                       report_connect((struct sockaddr *)&z, len, NULL);
+                                       report_sock("Connection received",
+                                           (struct sockaddr *)&z, len, NULL);
 
                                readwrite(s, NULL);
                        } else {
+                               struct tls *tls_cctx = NULL;
+                               int connfd;
+
                                len = sizeof(cliaddr);
                                connfd = accept4(s, (struct sockaddr *)&cliaddr,
                                    &len, SOCK_NONBLOCK);
@@ -563,28 +624,20 @@ main(int argc, char *argv[])
                                        err(1, "accept");
                                }
                                if (vflag)
-                                       report_connect((struct sockaddr *)&cliaddr, len,
+                                       report_sock("Connection received",
+                                           (struct sockaddr *)&cliaddr, len,
                                            family == AF_UNIX ? host : NULL);
                                if ((usetls) &&
                                    (tls_cctx = tls_setup_server(tls_ctx, connfd, host)))
                                        readwrite(connfd, tls_cctx);
                                if (!usetls)
                                        readwrite(connfd, NULL);
-                               if (tls_cctx) {
-                                       int i;
-
-                                       do {
-                                               i = tls_close(tls_cctx);
-                                       } while (i == TLS_WANT_POLLIN ||
-                                           i == TLS_WANT_POLLOUT);
-                                       tls_free(tls_cctx);
-                                       tls_cctx = NULL;
-                               }
+                               if (tls_cctx)
+                                       timeout_tls(s, tls_cctx, tls_close);
                                close(connfd);
+                               tls_free(tls_cctx);
                        }
-                       if (family != AF_UNIX)
-                               close(s);
-                       else if (uflag) {
+                       if (family == AF_UNIX && uflag) {
                                if (connect(s, NULL, 0) < 0)
                                        err(1, "connect");
                        }
@@ -595,15 +648,18 @@ main(int argc, char *argv[])
        } else if (family == AF_UNIX) {
                ret = 0;
 
-               if ((s = unix_connect(host)) > 0 && !zflag) {
-                       readwrite(s, NULL);
+               if ((s = unix_connect(host)) > 0) {
+                       if (!zflag)
+                               readwrite(s, NULL);
                        close(s);
-               } else
+               } else {
+                       warn("%s", host);
                        ret = 1;
+               }
 
                if (uflag)
                        unlink(unix_dg_tmp_socket);
-               exit(ret);
+               return ret;
 
        } else {
                int i = 0;
@@ -615,6 +671,8 @@ main(int argc, char *argv[])
                for (s = -1, i = 0; portlist[i] != NULL; i++) {
                        if (s != -1)
                                close(s);
+                       tls_free(tls_ctx);
+                       tls_ctx = NULL;
 
                        if (usetls) {
                                if ((tls_ctx = tls_client()) == NULL)
@@ -625,7 +683,7 @@ main(int argc, char *argv[])
                        }
                        if (xflag)
                                s = socks_connect(host, portlist[i], hints,
-                                   proxyhost, proxyport, proxyhints, socksv,
+                                   proxy, proxyport, proxyhints, socksv,
                                    Pflag);
                        else
                                s = remote_connect(host, portlist[i], hints);
@@ -665,26 +723,18 @@ main(int argc, char *argv[])
                                        tls_setup_client(tls_ctx, s, host);
                                if (!zflag)
                                        readwrite(s, tls_ctx);
-                               if (tls_ctx) {
-                                       int j;
-
-                                       do {
-                                               j = tls_close(tls_ctx);
-                                       } while (j == TLS_WANT_POLLIN ||
-                                           j == TLS_WANT_POLLOUT);
-                                       tls_free(tls_ctx);
-                                       tls_ctx = NULL;
-                               }
+                               if (tls_ctx)
+                                       timeout_tls(s, tls_ctx, tls_close);
                        }
                }
        }
 
        if (s != -1)
                close(s);
-
+       tls_free(tls_ctx);
        tls_config_free(tls_cfg);
 
-       exit(ret);
+       return ret;
 }
 
 /*
@@ -700,7 +750,7 @@ unix_bind(char *path, int flags)
        /* Create unix domain socket. */
        if ((s = socket(AF_UNIX, flags | (uflag ? SOCK_DGRAM : SOCK_STREAM),
            0)) < 0)
-               return (-1);
+               return -1;
 
        memset(&s_un, 0, sizeof(struct sockaddr_un));
        s_un.sun_family = AF_UNIX;
@@ -709,64 +759,92 @@ unix_bind(char *path, int flags)
            sizeof(s_un.sun_path)) {
                close(s);
                errno = ENAMETOOLONG;
-               return (-1);
+               return -1;
        }
 
        if (bind(s, (struct sockaddr *)&s_un, sizeof(s_un)) < 0) {
                save_errno = errno;
                close(s);
                errno = save_errno;
-               return (-1);
+               return -1;
+       }
+       if (vflag)
+               report_sock("Bound", NULL, 0, path);
+
+       return s;
+}
+
+int
+timeout_tls(int s, struct tls *tls_ctx, int (*func)(struct tls *))
+{
+       struct pollfd pfd;
+       int ret;
+
+       while ((ret = (*func)(tls_ctx)) != 0) {
+               if (ret == TLS_WANT_POLLIN)
+                       pfd.events = POLLIN;
+               else if (ret == TLS_WANT_POLLOUT)
+                       pfd.events = POLLOUT;
+               else
+                       break;
+               pfd.fd = s;
+               if ((ret = poll(&pfd, 1, timeout)) == 1)
+                       continue;
+               else if (ret == 0) {
+                       errno = ETIMEDOUT;
+                       ret = -1;
+                       break;
+               } else
+                       err(1, "poll failed");
        }
-       return (s);
+
+       return ret;
 }
 
 void
 tls_setup_client(struct tls *tls_ctx, int s, char *host)
 {
-       int i;
+       const char *errstr;
 
        if (tls_connect_socket(tls_ctx, s,
                tls_expectname ? tls_expectname : host) == -1) {
                errx(1, "tls connection failed (%s)",
                    tls_error(tls_ctx));
        }
-       do {
-               if ((i = tls_handshake(tls_ctx)) == -1)
-                       errx(1, "tls handshake failed (%s)",
-                           tls_error(tls_ctx));
-       } while (i == TLS_WANT_POLLIN || i == TLS_WANT_POLLOUT);
+       if (timeout_tls(s, tls_ctx, tls_handshake) == -1) {
+               if ((errstr = tls_error(tls_ctx)) == NULL)
+                       errstr = strerror(errno);
+               errx(1, "tls handshake failed (%s)", errstr);
+       }
        if (vflag)
-               report_tls(tls_ctx, host, tls_expectname);
+               report_tls(tls_ctx, host);
        if (tls_expecthash && tls_peer_cert_hash(tls_ctx) &&
            strcmp(tls_expecthash, tls_peer_cert_hash(tls_ctx)) != 0)
                errx(1, "peer certificate is not %s", tls_expecthash);
+       if (Zflag) {
+               save_peer_cert(tls_ctx, Zflag);
+               if (Zflag != stderr && (fclose(Zflag) != 0))
+                       err(1, "fclose failed saving peer cert");
+       }
 }
 
 struct tls *
 tls_setup_server(struct tls *tls_ctx, int connfd, char *host)
 {
        struct tls *tls_cctx;
+       const char *errstr;
 
-       if (tls_accept_socket(tls_ctx, &tls_cctx,
-               connfd) == -1) {
-               warnx("tls accept failed (%s)",
-                   tls_error(tls_ctx));
-               tls_cctx = NULL;
+       if (tls_accept_socket(tls_ctx, &tls_cctx, connfd) == -1) {
+               warnx("tls accept failed (%s)", tls_error(tls_ctx));
+       } else if (timeout_tls(connfd, tls_cctx, tls_handshake) == -1) {
+               if ((errstr = tls_error(tls_cctx)) == NULL)
+                       errstr = strerror(errno);
+               warnx("tls handshake failed (%s)", errstr);
        } else {
-               int i;
-
-               do {
-                       if ((i = tls_handshake(tls_cctx)) == -1)
-                               warnx("tls handshake failed (%s)",
-                                   tls_error(tls_cctx));
-               } while(i == TLS_WANT_POLLIN || i == TLS_WANT_POLLOUT);
-       }
-       if (tls_cctx) {
                int gotcert = tls_peer_cert_provided(tls_cctx);
 
                if (vflag && gotcert)
-                       report_tls(tls_cctx, host, tls_expectname);
+                       report_tls(tls_cctx, host);
                if ((TLSopt & TLS_CCERT) && !gotcert)
                        warnx("No client certificate provided");
                else if (gotcert && tls_peer_cert_hash(tls_ctx) && tls_expecthash &&
@@ -795,10 +873,10 @@ unix_connect(char *path)
 
        if (uflag) {
                if ((s = unix_bind(unix_dg_tmp_socket, SOCK_CLOEXEC)) < 0)
-                       return (-1);
+                       return -1;
        } else {
                if ((s = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0)) < 0)
-                       return (-1);
+                       return -1;
        }
 
        memset(&s_un, 0, sizeof(struct sockaddr_un));
@@ -808,15 +886,15 @@ unix_connect(char *path)
            sizeof(s_un.sun_path)) {
                close(s);
                errno = ENAMETOOLONG;
-               return (-1);
+               return -1;
        }
        if (connect(s, (struct sockaddr *)&s_un, sizeof(s_un)) < 0) {
                save_errno = errno;
                close(s);
                errno = save_errno;
-               return (-1);
+               return -1;
        }
-       return (s);
+       return s;
 
 }
 
@@ -828,14 +906,17 @@ int
 unix_listen(char *path)
 {
        int s;
-       if ((s = unix_bind(path, 0)) < 0)
-               return (-1);
 
+       if ((s = unix_bind(path, 0)) < 0)
+               return -1;
        if (listen(s, 5) < 0) {
                close(s);
-               return (-1);
+               return -1;
        }
-       return (s);
+       if (vflag)
+               report_sock("Listening", NULL, 0, path);
+
+       return s;
 }
 
 /*
@@ -847,18 +928,18 @@ int
 remote_connect(const char *host, const char *port, struct addrinfo hints)
 {
        struct addrinfo *res, *res0;
-       int s, error, save_errno;
+       int s = -1, error, save_errno;
 #ifdef SO_BINDANY
        int on = 1;
 #endif
 
-       if ((error = getaddrinfo(host, port, &hints, &res)))
-               errx(1, "getaddrinfo: %s", gai_strerror(error));
+       if ((error = getaddrinfo(host, port, &hints, &res0)))
+               errx(1, "getaddrinfo for host \"%s\" port %s: %s", host,
+                   port, gai_strerror(error));
 
-       res0 = res;
-       do {
-               if ((s = socket(res0->ai_family, res0->ai_socktype |
-                   SOCK_NONBLOCK, res0->ai_protocol)) < 0)
+       for (res = res0; res; res = res->ai_next) {
+               if ((s = socket(res->ai_family, res->ai_socktype |
+                   SOCK_NONBLOCK, res->ai_protocol)) < 0)
                        continue;
 
                /* Bind to a local port or source address if specified. */
@@ -870,7 +951,7 @@ remote_connect(const char *host, const char *port, struct addrinfo hints)
                        setsockopt(s, SOL_SOCKET, SO_BINDANY, &on, sizeof(on));
 #endif
                        memset(&ahints, 0, sizeof(struct addrinfo));
-                       ahints.ai_family = res0->ai_family;
+                       ahints.ai_family = res->ai_family;
                        ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM;
                        ahints.ai_protocol = uflag ? IPPROTO_UDP : IPPROTO_TCP;
                        ahints.ai_flags = AI_PASSIVE;
@@ -883,9 +964,9 @@ remote_connect(const char *host, const char *port, struct addrinfo hints)
                        freeaddrinfo(ares);
                }
 
-               set_common_sockopts(s, res0->ai_family);
+               set_common_sockopts(s, res->ai_family);
 
-               if (timeout_connect(s, res0->ai_addr, res0->ai_addrlen) == 0)
+               if (timeout_connect(s, res->ai_addr, res->ai_addrlen) == 0)
                        break;
                if (vflag)
                        warn("connect to %s port %s (%s) failed", host, port,
@@ -895,11 +976,11 @@ remote_connect(const char *host, const char *port, struct addrinfo hints)
                close(s);
                errno = save_errno;
                s = -1;
-       } while ((res0 = res0->ai_next) != NULL);
+       }
 
-       freeaddrinfo(res);
+       freeaddrinfo(res0);
 
-       return (s);
+       return s;
 }
 
 int
@@ -927,7 +1008,7 @@ timeout_connect(int s, const struct sockaddr *name, socklen_t namelen)
                        err(1, "poll failed");
        }
 
-       return (ret);
+       return ret;
 }
 
 /*
@@ -936,10 +1017,10 @@ timeout_connect(int s, const struct sockaddr *name, socklen_t namelen)
  * address. Returns -1 on failure.
  */
 int
-local_listen(char *host, char *port, struct addrinfo hints)
+local_listen(const char *host, const char *port, struct addrinfo hints)
 {
        struct addrinfo *res, *res0;
-       int s, save_errno;
+       int s = -1, save_errno;
 #ifdef SO_REUSEPORT
        int ret, x = 1;
 #endif
@@ -955,13 +1036,12 @@ local_listen(char *host, char *port, struct addrinfo hints)
        if (host == NULL && hints.ai_family == AF_UNSPEC)
                hints.ai_family = AF_INET;
 
-       if ((error = getaddrinfo(host, port, &hints, &res)))
+       if ((error = getaddrinfo(host, port, &hints, &res0)))
                errx(1, "getaddrinfo: %s", gai_strerror(error));
 
-       res0 = res;
-       do {
-               if ((s = socket(res0->ai_family, res0->ai_socktype,
-                   res0->ai_protocol)) < 0)
+       for (res = res0; res; res = res->ai_next) {
+               if ((s = socket(res->ai_family, res->ai_socktype,
+                   res->ai_protocol)) < 0)
                        continue;
 
 #ifdef SO_REUSEPORT
@@ -970,26 +1050,36 @@ local_listen(char *host, char *port, struct addrinfo hints)
                        err(1, NULL);
 #endif
 
-               set_common_sockopts(s, res0->ai_family);
+               set_common_sockopts(s, res->ai_family);
 
-               if (bind(s, (struct sockaddr *)res0->ai_addr,
-                   res0->ai_addrlen) == 0)
+               if (bind(s, (struct sockaddr *)res->ai_addr,
+                   res->ai_addrlen) == 0)
                        break;
 
                save_errno = errno;
                close(s);
                errno = save_errno;
                s = -1;
-       } while ((res0 = res0->ai_next) != NULL);
+       }
 
        if (!uflag && s != -1) {
                if (listen(s, 1) < 0)
                        err(1, "listen");
        }
+       if (vflag && s != -1) {
+               struct sockaddr_storage ss;
+               socklen_t len;
+
+               len = sizeof(ss);
+               if (getsockname(s, (struct sockaddr *)&ss, &len) == -1)
+                       err(1, "getsockname");
+               report_sock(uflag ? "Bound" : "Listening",
+                   (struct sockaddr *)&ss, len, NULL);
+       }
 
-       freeaddrinfo(res);
+       freeaddrinfo(res0);
 
-       return (s);
+       return s;
 }
 
 /*
@@ -1032,21 +1122,15 @@ readwrite(int net_fd, struct tls *tls_ctx)
        while (1) {
                /* both inputs are gone, buffers are empty, we are done */
                if (pfd[POLL_STDIN].fd == -1 && pfd[POLL_NETIN].fd == -1 &&
-                   stdinbufpos == 0 && netinbufpos == 0) {
-                       close(net_fd);
+                   stdinbufpos == 0 && netinbufpos == 0)
                        return;
-               }
                /* both outputs are gone, we can't continue */
-               if (pfd[POLL_NETOUT].fd == -1 && pfd[POLL_STDOUT].fd == -1) {
-                       close(net_fd);
+               if (pfd[POLL_NETOUT].fd == -1 && pfd[POLL_STDOUT].fd == -1)
                        return;
-               }
                /* listen and net in gone, queues empty, done */
                if (lflag && pfd[POLL_NETIN].fd == -1 &&
-                   stdinbufpos == 0 && netinbufpos == 0) {
-                       close(net_fd);
+                   stdinbufpos == 0 && netinbufpos == 0)
                        return;
-               }
 
                /* help says -i is for "wait between lines sent". We read and
                 * write arbitrary amounts of data, and we don't want to start
@@ -1058,10 +1142,8 @@ readwrite(int net_fd, struct tls *tls_ctx)
                num_fds = poll(pfd, 4, timeout);
 
                /* treat poll errors */
-               if (num_fds == -1) {
-                       close(net_fd);
+               if (num_fds == -1)
                        err(1, "polling error");
-               }
 
                /* timeout happened */
                if (num_fds == 0)
@@ -1151,6 +1233,12 @@ readwrite(int net_fd, struct tls *tls_ctx)
                                shutdown(pfd[POLL_NETIN].fd, SHUT_RD);
                                pfd[POLL_NETIN].fd = -1;
                        }
+                       if (recvlimit > 0 && ++recvcount >= recvlimit) {
+                               if (pfd[POLL_NETIN].fd != -1)
+                                       shutdown(pfd[POLL_NETIN].fd, SHUT_RD);
+                               pfd[POLL_NETIN].fd = -1;
+                               pfd[POLL_STDIN].fd = -1;
+                       }
                        /* read something - poll stdout */
                        if (netinbufpos > 0)
                                pfd[POLL_STDOUT].events = POLLOUT;