Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Nov 2017 18:04:29 +0000 (UTC)
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325328 - in head: crypto/openssl crypto/openssl/apps crypto/openssl/crypto crypto/openssl/crypto/asn1 crypto/openssl/crypto/bn crypto/openssl/crypto/bn/asm crypto/openssl/crypto/dh cry...
Message-ID:  <201711021804.vA2I4TK8071402@repo.freebsd.org>

Next in thread | Raw E-Mail | Index | Archive | Help
Author: jkim
Date: Thu Nov  2 18:04:29 2017
New Revision: 325328
URL: https://svnweb.freebsd.org/changeset/base/325328

Log:
  Merge OpenSSL 1.0.2m.

Added:
  head/crypto/openssl/crypto/asn1/asn1_int.h
     - copied unchanged from r325326, vendor-crypto/openssl/dist/crypto/asn1/asn1_int.h
  head/crypto/openssl/doc/crypto/EVP_PKEY_meth_new.pod
     - copied unchanged from r325326, vendor-crypto/openssl/dist/doc/crypto/EVP_PKEY_meth_new.pod
  head/crypto/openssl/doc/crypto/X509_check_private_key.pod
     - copied unchanged from r325326, vendor-crypto/openssl/dist/doc/crypto/X509_check_private_key.pod
  head/crypto/openssl/doc/ssl/SSL_CTX_set_tlsext_servername_callback.pod
     - copied unchanged from r325326, vendor-crypto/openssl/dist/doc/ssl/SSL_CTX_set_tlsext_servername_callback.pod
  head/crypto/openssl/doc/ssl/SSL_export_keying_material.pod
     - copied unchanged from r325326, vendor-crypto/openssl/dist/doc/ssl/SSL_export_keying_material.pod
  head/secure/lib/libcrypto/man/EVP_PKEY_meth_new.3   (contents, props changed)
  head/secure/lib/libcrypto/man/X509_check_private_key.3   (contents, props changed)
  head/secure/lib/libssl/man/SSL_export_keying_material.3   (contents, props changed)
Deleted:
  head/crypto/openssl/doc/man3/SSL_CTX_set_tlsext_servername_callback.pod
Modified:
  head/crypto/openssl/CHANGES
  head/crypto/openssl/INSTALL
  head/crypto/openssl/Makefile
  head/crypto/openssl/NEWS
  head/crypto/openssl/README
  head/crypto/openssl/apps/ca.c
  head/crypto/openssl/apps/s_client.c
  head/crypto/openssl/apps/s_server.c
  head/crypto/openssl/apps/speed.c
  head/crypto/openssl/apps/spkac.c
  head/crypto/openssl/apps/srp.c
  head/crypto/openssl/apps/tsget
  head/crypto/openssl/crypto/asn1/Makefile
  head/crypto/openssl/crypto/asn1/a_bitstr.c
  head/crypto/openssl/crypto/asn1/tasn_fre.c
  head/crypto/openssl/crypto/asn1/tasn_new.c
  head/crypto/openssl/crypto/asn1/x_name.c
  head/crypto/openssl/crypto/asn1/x_pkey.c
  head/crypto/openssl/crypto/bn/asm/x86_64-mont5.pl
  head/crypto/openssl/crypto/bn/bn_exp.c
  head/crypto/openssl/crypto/bn/bn_lib.c
  head/crypto/openssl/crypto/bn/bn_mont.c
  head/crypto/openssl/crypto/bn/bn_mul.c
  head/crypto/openssl/crypto/bn/bn_x931p.c
  head/crypto/openssl/crypto/cryptlib.c
  head/crypto/openssl/crypto/dh/Makefile
  head/crypto/openssl/crypto/dh/dh.h
  head/crypto/openssl/crypto/dh/dh_kdf.c
  head/crypto/openssl/crypto/dh/dh_pmeth.c
  head/crypto/openssl/crypto/dsa/dsa_ameth.c
  head/crypto/openssl/crypto/dsa/dsa_gen.c
  head/crypto/openssl/crypto/dsa/dsa_ossl.c
  head/crypto/openssl/crypto/ec/asm/ecp_nistz256-x86_64.pl
  head/crypto/openssl/crypto/ec/ecp_mont.c
  head/crypto/openssl/crypto/ec/ecp_nistp224.c
  head/crypto/openssl/crypto/ec/ecp_nistp256.c
  head/crypto/openssl/crypto/ec/ecp_nistp521.c
  head/crypto/openssl/crypto/ecdh/ech_lib.c
  head/crypto/openssl/crypto/ecdsa/ecs_lib.c
  head/crypto/openssl/crypto/ecdsa/ecs_ossl.c
  head/crypto/openssl/crypto/err/err.c
  head/crypto/openssl/crypto/evp/e_aes_cbc_hmac_sha1.c
  head/crypto/openssl/crypto/evp/e_aes_cbc_hmac_sha256.c
  head/crypto/openssl/crypto/evp/evp.h
  head/crypto/openssl/crypto/evp/evp_key.c
  head/crypto/openssl/crypto/evp/pmeth_lib.c
  head/crypto/openssl/crypto/ex_data.c
  head/crypto/openssl/crypto/lhash/lhash.c
  head/crypto/openssl/crypto/ocsp/ocsp_vfy.c
  head/crypto/openssl/crypto/opensslv.h
  head/crypto/openssl/crypto/pem/pem_lib.c
  head/crypto/openssl/crypto/pem/pem_pk8.c
  head/crypto/openssl/crypto/pem/pem_pkey.c
  head/crypto/openssl/crypto/pkcs12/p12_kiss.c
  head/crypto/openssl/crypto/rsa/rsa_ameth.c
  head/crypto/openssl/crypto/rsa/rsa_oaep.c
  head/crypto/openssl/crypto/rsa/rsa_pk1.c
  head/crypto/openssl/crypto/rsa/rsa_pmeth.c
  head/crypto/openssl/crypto/ui/ui_lib.c
  head/crypto/openssl/crypto/whrlpool/wp_dgst.c
  head/crypto/openssl/crypto/x509/by_dir.c
  head/crypto/openssl/crypto/x509/by_file.c
  head/crypto/openssl/crypto/x509v3/pcy_tree.c
  head/crypto/openssl/crypto/x509v3/v3_addr.c
  head/crypto/openssl/crypto/x509v3/v3_genn.c
  head/crypto/openssl/crypto/x509v3/v3_ncons.c
  head/crypto/openssl/crypto/x86_64cpuid.pl
  head/crypto/openssl/doc/apps/asn1parse.pod
  head/crypto/openssl/doc/apps/ca.pod
  head/crypto/openssl/doc/apps/ciphers.pod
  head/crypto/openssl/doc/apps/cms.pod
  head/crypto/openssl/doc/apps/crl.pod
  head/crypto/openssl/doc/apps/crl2pkcs7.pod
  head/crypto/openssl/doc/apps/dgst.pod
  head/crypto/openssl/doc/apps/dhparam.pod
  head/crypto/openssl/doc/apps/dsa.pod
  head/crypto/openssl/doc/apps/dsaparam.pod
  head/crypto/openssl/doc/apps/ec.pod
  head/crypto/openssl/doc/apps/ecparam.pod
  head/crypto/openssl/doc/apps/enc.pod
  head/crypto/openssl/doc/apps/errstr.pod
  head/crypto/openssl/doc/apps/gendsa.pod
  head/crypto/openssl/doc/apps/genpkey.pod
  head/crypto/openssl/doc/apps/genrsa.pod
  head/crypto/openssl/doc/apps/nseq.pod
  head/crypto/openssl/doc/apps/ocsp.pod
  head/crypto/openssl/doc/apps/passwd.pod
  head/crypto/openssl/doc/apps/pkcs12.pod
  head/crypto/openssl/doc/apps/pkcs7.pod
  head/crypto/openssl/doc/apps/pkcs8.pod
  head/crypto/openssl/doc/apps/pkey.pod
  head/crypto/openssl/doc/apps/pkeyparam.pod
  head/crypto/openssl/doc/apps/pkeyutl.pod
  head/crypto/openssl/doc/apps/rand.pod
  head/crypto/openssl/doc/apps/req.pod
  head/crypto/openssl/doc/apps/rsa.pod
  head/crypto/openssl/doc/apps/rsautl.pod
  head/crypto/openssl/doc/apps/s_client.pod
  head/crypto/openssl/doc/apps/s_server.pod
  head/crypto/openssl/doc/apps/s_time.pod
  head/crypto/openssl/doc/apps/sess_id.pod
  head/crypto/openssl/doc/apps/smime.pod
  head/crypto/openssl/doc/apps/speed.pod
  head/crypto/openssl/doc/apps/spkac.pod
  head/crypto/openssl/doc/apps/ts.pod
  head/crypto/openssl/doc/apps/tsget.pod
  head/crypto/openssl/doc/apps/verify.pod
  head/crypto/openssl/doc/apps/version.pod
  head/crypto/openssl/doc/apps/x509.pod
  head/crypto/openssl/doc/crypto/BN_bn2bin.pod
  head/crypto/openssl/doc/crypto/BN_new.pod
  head/crypto/openssl/doc/crypto/EVP_EncryptInit.pod
  head/crypto/openssl/doc/crypto/RSA_padding_add_PKCS1_type_1.pod
  head/crypto/openssl/doc/crypto/RSA_public_encrypt.pod
  head/crypto/openssl/doc/crypto/hmac.pod
  head/crypto/openssl/doc/ssl/SSL_set_connect_state.pod
  head/crypto/openssl/ssl/s23_clnt.c
  head/crypto/openssl/ssl/s3_pkt.c
  head/crypto/openssl/ssl/s3_srvr.c
  head/crypto/openssl/ssl/ssl_ciph.c
  head/crypto/openssl/ssl/ssl_lib.c
  head/crypto/openssl/ssl/ssl_sess.c
  head/crypto/openssl/ssl/ssltest.c
  head/crypto/openssl/ssl/tls1.h
  head/crypto/openssl/util/copy-if-different.pl
  head/crypto/openssl/util/copy.pl
  head/crypto/openssl/util/libeay.num
  head/crypto/openssl/util/mk1mf.pl
  head/secure/lib/libcrypto/Makefile.inc
  head/secure/lib/libcrypto/Makefile.man
  head/secure/lib/libcrypto/amd64/ecp_nistz256-x86_64.S
  head/secure/lib/libcrypto/amd64/x86_64-mont5.S
  head/secure/lib/libcrypto/amd64/x86_64cpuid.S
  head/secure/lib/libcrypto/man/ASN1_OBJECT_new.3
  head/secure/lib/libcrypto/man/ASN1_STRING_length.3
  head/secure/lib/libcrypto/man/ASN1_STRING_new.3
  head/secure/lib/libcrypto/man/ASN1_STRING_print_ex.3
  head/secure/lib/libcrypto/man/ASN1_TIME_set.3
  head/secure/lib/libcrypto/man/ASN1_generate_nconf.3
  head/secure/lib/libcrypto/man/BIO_ctrl.3
  head/secure/lib/libcrypto/man/BIO_f_base64.3
  head/secure/lib/libcrypto/man/BIO_f_buffer.3
  head/secure/lib/libcrypto/man/BIO_f_cipher.3
  head/secure/lib/libcrypto/man/BIO_f_md.3
  head/secure/lib/libcrypto/man/BIO_f_null.3
  head/secure/lib/libcrypto/man/BIO_f_ssl.3
  head/secure/lib/libcrypto/man/BIO_find_type.3
  head/secure/lib/libcrypto/man/BIO_new.3
  head/secure/lib/libcrypto/man/BIO_new_CMS.3
  head/secure/lib/libcrypto/man/BIO_push.3
  head/secure/lib/libcrypto/man/BIO_read.3
  head/secure/lib/libcrypto/man/BIO_s_accept.3
  head/secure/lib/libcrypto/man/BIO_s_bio.3
  head/secure/lib/libcrypto/man/BIO_s_connect.3
  head/secure/lib/libcrypto/man/BIO_s_fd.3
  head/secure/lib/libcrypto/man/BIO_s_file.3
  head/secure/lib/libcrypto/man/BIO_s_mem.3
  head/secure/lib/libcrypto/man/BIO_s_null.3
  head/secure/lib/libcrypto/man/BIO_s_socket.3
  head/secure/lib/libcrypto/man/BIO_set_callback.3
  head/secure/lib/libcrypto/man/BIO_should_retry.3
  head/secure/lib/libcrypto/man/BN_BLINDING_new.3
  head/secure/lib/libcrypto/man/BN_CTX_new.3
  head/secure/lib/libcrypto/man/BN_CTX_start.3
  head/secure/lib/libcrypto/man/BN_add.3
  head/secure/lib/libcrypto/man/BN_add_word.3
  head/secure/lib/libcrypto/man/BN_bn2bin.3
  head/secure/lib/libcrypto/man/BN_cmp.3
  head/secure/lib/libcrypto/man/BN_copy.3
  head/secure/lib/libcrypto/man/BN_generate_prime.3
  head/secure/lib/libcrypto/man/BN_mod_inverse.3
  head/secure/lib/libcrypto/man/BN_mod_mul_montgomery.3
  head/secure/lib/libcrypto/man/BN_mod_mul_reciprocal.3
  head/secure/lib/libcrypto/man/BN_new.3
  head/secure/lib/libcrypto/man/BN_num_bytes.3
  head/secure/lib/libcrypto/man/BN_rand.3
  head/secure/lib/libcrypto/man/BN_set_bit.3
  head/secure/lib/libcrypto/man/BN_swap.3
  head/secure/lib/libcrypto/man/BN_zero.3
  head/secure/lib/libcrypto/man/CMS_add0_cert.3
  head/secure/lib/libcrypto/man/CMS_add1_recipient_cert.3
  head/secure/lib/libcrypto/man/CMS_add1_signer.3
  head/secure/lib/libcrypto/man/CMS_compress.3
  head/secure/lib/libcrypto/man/CMS_decrypt.3
  head/secure/lib/libcrypto/man/CMS_encrypt.3
  head/secure/lib/libcrypto/man/CMS_final.3
  head/secure/lib/libcrypto/man/CMS_get0_RecipientInfos.3
  head/secure/lib/libcrypto/man/CMS_get0_SignerInfos.3
  head/secure/lib/libcrypto/man/CMS_get0_type.3
  head/secure/lib/libcrypto/man/CMS_get1_ReceiptRequest.3
  head/secure/lib/libcrypto/man/CMS_sign.3
  head/secure/lib/libcrypto/man/CMS_sign_receipt.3
  head/secure/lib/libcrypto/man/CMS_uncompress.3
  head/secure/lib/libcrypto/man/CMS_verify.3
  head/secure/lib/libcrypto/man/CMS_verify_receipt.3
  head/secure/lib/libcrypto/man/CONF_modules_free.3
  head/secure/lib/libcrypto/man/CONF_modules_load_file.3
  head/secure/lib/libcrypto/man/CRYPTO_set_ex_data.3
  head/secure/lib/libcrypto/man/DH_generate_key.3
  head/secure/lib/libcrypto/man/DH_generate_parameters.3
  head/secure/lib/libcrypto/man/DH_get_ex_new_index.3
  head/secure/lib/libcrypto/man/DH_new.3
  head/secure/lib/libcrypto/man/DH_set_method.3
  head/secure/lib/libcrypto/man/DH_size.3
  head/secure/lib/libcrypto/man/DSA_SIG_new.3
  head/secure/lib/libcrypto/man/DSA_do_sign.3
  head/secure/lib/libcrypto/man/DSA_dup_DH.3
  head/secure/lib/libcrypto/man/DSA_generate_key.3
  head/secure/lib/libcrypto/man/DSA_generate_parameters.3
  head/secure/lib/libcrypto/man/DSA_get_ex_new_index.3
  head/secure/lib/libcrypto/man/DSA_new.3
  head/secure/lib/libcrypto/man/DSA_set_method.3
  head/secure/lib/libcrypto/man/DSA_sign.3
  head/secure/lib/libcrypto/man/DSA_size.3
  head/secure/lib/libcrypto/man/EC_GFp_simple_method.3
  head/secure/lib/libcrypto/man/EC_GROUP_copy.3
  head/secure/lib/libcrypto/man/EC_GROUP_new.3
  head/secure/lib/libcrypto/man/EC_KEY_new.3
  head/secure/lib/libcrypto/man/EC_POINT_add.3
  head/secure/lib/libcrypto/man/EC_POINT_new.3
  head/secure/lib/libcrypto/man/ERR_GET_LIB.3
  head/secure/lib/libcrypto/man/ERR_clear_error.3
  head/secure/lib/libcrypto/man/ERR_error_string.3
  head/secure/lib/libcrypto/man/ERR_get_error.3
  head/secure/lib/libcrypto/man/ERR_load_crypto_strings.3
  head/secure/lib/libcrypto/man/ERR_load_strings.3
  head/secure/lib/libcrypto/man/ERR_print_errors.3
  head/secure/lib/libcrypto/man/ERR_put_error.3
  head/secure/lib/libcrypto/man/ERR_remove_state.3
  head/secure/lib/libcrypto/man/ERR_set_mark.3
  head/secure/lib/libcrypto/man/EVP_BytesToKey.3
  head/secure/lib/libcrypto/man/EVP_DigestInit.3
  head/secure/lib/libcrypto/man/EVP_DigestSignInit.3
  head/secure/lib/libcrypto/man/EVP_DigestVerifyInit.3
  head/secure/lib/libcrypto/man/EVP_EncodeInit.3
  head/secure/lib/libcrypto/man/EVP_EncryptInit.3
  head/secure/lib/libcrypto/man/EVP_OpenInit.3
  head/secure/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3
  head/secure/lib/libcrypto/man/EVP_PKEY_CTX_new.3
  head/secure/lib/libcrypto/man/EVP_PKEY_cmp.3
  head/secure/lib/libcrypto/man/EVP_PKEY_decrypt.3
  head/secure/lib/libcrypto/man/EVP_PKEY_derive.3
  head/secure/lib/libcrypto/man/EVP_PKEY_encrypt.3
  head/secure/lib/libcrypto/man/EVP_PKEY_get_default_digest.3
  head/secure/lib/libcrypto/man/EVP_PKEY_keygen.3
  head/secure/lib/libcrypto/man/EVP_PKEY_new.3
  head/secure/lib/libcrypto/man/EVP_PKEY_print_private.3
  head/secure/lib/libcrypto/man/EVP_PKEY_set1_RSA.3
  head/secure/lib/libcrypto/man/EVP_PKEY_sign.3
  head/secure/lib/libcrypto/man/EVP_PKEY_verify.3
  head/secure/lib/libcrypto/man/EVP_PKEY_verify_recover.3
  head/secure/lib/libcrypto/man/EVP_SealInit.3
  head/secure/lib/libcrypto/man/EVP_SignInit.3
  head/secure/lib/libcrypto/man/EVP_VerifyInit.3
  head/secure/lib/libcrypto/man/OBJ_nid2obj.3
  head/secure/lib/libcrypto/man/OPENSSL_Applink.3
  head/secure/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3
  head/secure/lib/libcrypto/man/OPENSSL_config.3
  head/secure/lib/libcrypto/man/OPENSSL_ia32cap.3
  head/secure/lib/libcrypto/man/OPENSSL_instrument_bus.3
  head/secure/lib/libcrypto/man/OPENSSL_load_builtin_modules.3
  head/secure/lib/libcrypto/man/OpenSSL_add_all_algorithms.3
  head/secure/lib/libcrypto/man/PEM_write_bio_CMS_stream.3
  head/secure/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3
  head/secure/lib/libcrypto/man/PKCS12_create.3
  head/secure/lib/libcrypto/man/PKCS12_parse.3
  head/secure/lib/libcrypto/man/PKCS7_decrypt.3
  head/secure/lib/libcrypto/man/PKCS7_encrypt.3
  head/secure/lib/libcrypto/man/PKCS7_sign.3
  head/secure/lib/libcrypto/man/PKCS7_sign_add_signer.3
  head/secure/lib/libcrypto/man/PKCS7_verify.3
  head/secure/lib/libcrypto/man/RAND_add.3
  head/secure/lib/libcrypto/man/RAND_bytes.3
  head/secure/lib/libcrypto/man/RAND_cleanup.3
  head/secure/lib/libcrypto/man/RAND_egd.3
  head/secure/lib/libcrypto/man/RAND_load_file.3
  head/secure/lib/libcrypto/man/RAND_set_rand_method.3
  head/secure/lib/libcrypto/man/RSA_blinding_on.3
  head/secure/lib/libcrypto/man/RSA_check_key.3
  head/secure/lib/libcrypto/man/RSA_generate_key.3
  head/secure/lib/libcrypto/man/RSA_get_ex_new_index.3
  head/secure/lib/libcrypto/man/RSA_new.3
  head/secure/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3
  head/secure/lib/libcrypto/man/RSA_print.3
  head/secure/lib/libcrypto/man/RSA_private_encrypt.3
  head/secure/lib/libcrypto/man/RSA_public_encrypt.3
  head/secure/lib/libcrypto/man/RSA_set_method.3
  head/secure/lib/libcrypto/man/RSA_sign.3
  head/secure/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3
  head/secure/lib/libcrypto/man/RSA_size.3
  head/secure/lib/libcrypto/man/SMIME_read_CMS.3
  head/secure/lib/libcrypto/man/SMIME_read_PKCS7.3
  head/secure/lib/libcrypto/man/SMIME_write_CMS.3
  head/secure/lib/libcrypto/man/SMIME_write_PKCS7.3
  head/secure/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3
  head/secure/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3
  head/secure/lib/libcrypto/man/X509_NAME_get_index_by_NID.3
  head/secure/lib/libcrypto/man/X509_NAME_print_ex.3
  head/secure/lib/libcrypto/man/X509_STORE_CTX_get_error.3
  head/secure/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3
  head/secure/lib/libcrypto/man/X509_STORE_CTX_new.3
  head/secure/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3
  head/secure/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3
  head/secure/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3
  head/secure/lib/libcrypto/man/X509_check_host.3
  head/secure/lib/libcrypto/man/X509_new.3
  head/secure/lib/libcrypto/man/X509_verify_cert.3
  head/secure/lib/libcrypto/man/bio.3
  head/secure/lib/libcrypto/man/blowfish.3
  head/secure/lib/libcrypto/man/bn.3
  head/secure/lib/libcrypto/man/bn_internal.3
  head/secure/lib/libcrypto/man/buffer.3
  head/secure/lib/libcrypto/man/crypto.3
  head/secure/lib/libcrypto/man/d2i_ASN1_OBJECT.3
  head/secure/lib/libcrypto/man/d2i_CMS_ContentInfo.3
  head/secure/lib/libcrypto/man/d2i_DHparams.3
  head/secure/lib/libcrypto/man/d2i_DSAPublicKey.3
  head/secure/lib/libcrypto/man/d2i_ECPKParameters.3
  head/secure/lib/libcrypto/man/d2i_ECPrivateKey.3
  head/secure/lib/libcrypto/man/d2i_PKCS8PrivateKey.3
  head/secure/lib/libcrypto/man/d2i_PrivateKey.3
  head/secure/lib/libcrypto/man/d2i_RSAPublicKey.3
  head/secure/lib/libcrypto/man/d2i_X509.3
  head/secure/lib/libcrypto/man/d2i_X509_ALGOR.3
  head/secure/lib/libcrypto/man/d2i_X509_CRL.3
  head/secure/lib/libcrypto/man/d2i_X509_NAME.3
  head/secure/lib/libcrypto/man/d2i_X509_REQ.3
  head/secure/lib/libcrypto/man/d2i_X509_SIG.3
  head/secure/lib/libcrypto/man/des.3
  head/secure/lib/libcrypto/man/dh.3
  head/secure/lib/libcrypto/man/dsa.3
  head/secure/lib/libcrypto/man/ec.3
  head/secure/lib/libcrypto/man/ecdsa.3
  head/secure/lib/libcrypto/man/engine.3
  head/secure/lib/libcrypto/man/err.3
  head/secure/lib/libcrypto/man/evp.3
  head/secure/lib/libcrypto/man/hmac.3
  head/secure/lib/libcrypto/man/i2d_CMS_bio_stream.3
  head/secure/lib/libcrypto/man/i2d_PKCS7_bio_stream.3
  head/secure/lib/libcrypto/man/lh_stats.3
  head/secure/lib/libcrypto/man/lhash.3
  head/secure/lib/libcrypto/man/md5.3
  head/secure/lib/libcrypto/man/mdc2.3
  head/secure/lib/libcrypto/man/pem.3
  head/secure/lib/libcrypto/man/rand.3
  head/secure/lib/libcrypto/man/rc4.3
  head/secure/lib/libcrypto/man/ripemd.3
  head/secure/lib/libcrypto/man/rsa.3
  head/secure/lib/libcrypto/man/sha.3
  head/secure/lib/libcrypto/man/threads.3
  head/secure/lib/libcrypto/man/ui.3
  head/secure/lib/libcrypto/man/ui_compat.3
  head/secure/lib/libcrypto/man/x509.3
  head/secure/lib/libssl/Makefile.man
  head/secure/lib/libssl/man/SSL_CIPHER_get_name.3
  head/secure/lib/libssl/man/SSL_COMP_add_compression_method.3
  head/secure/lib/libssl/man/SSL_CONF_CTX_new.3
  head/secure/lib/libssl/man/SSL_CONF_CTX_set1_prefix.3
  head/secure/lib/libssl/man/SSL_CONF_CTX_set_flags.3
  head/secure/lib/libssl/man/SSL_CONF_CTX_set_ssl_ctx.3
  head/secure/lib/libssl/man/SSL_CONF_cmd.3
  head/secure/lib/libssl/man/SSL_CONF_cmd_argv.3
  head/secure/lib/libssl/man/SSL_CTX_add1_chain_cert.3
  head/secure/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3
  head/secure/lib/libssl/man/SSL_CTX_add_session.3
  head/secure/lib/libssl/man/SSL_CTX_ctrl.3
  head/secure/lib/libssl/man/SSL_CTX_flush_sessions.3
  head/secure/lib/libssl/man/SSL_CTX_free.3
  head/secure/lib/libssl/man/SSL_CTX_get0_param.3
  head/secure/lib/libssl/man/SSL_CTX_get_ex_new_index.3
  head/secure/lib/libssl/man/SSL_CTX_get_verify_mode.3
  head/secure/lib/libssl/man/SSL_CTX_load_verify_locations.3
  head/secure/lib/libssl/man/SSL_CTX_new.3
  head/secure/lib/libssl/man/SSL_CTX_sess_number.3
  head/secure/lib/libssl/man/SSL_CTX_sess_set_cache_size.3
  head/secure/lib/libssl/man/SSL_CTX_sess_set_get_cb.3
  head/secure/lib/libssl/man/SSL_CTX_sessions.3
  head/secure/lib/libssl/man/SSL_CTX_set1_curves.3
  head/secure/lib/libssl/man/SSL_CTX_set1_verify_cert_store.3
  head/secure/lib/libssl/man/SSL_CTX_set_alpn_select_cb.3
  head/secure/lib/libssl/man/SSL_CTX_set_cert_cb.3
  head/secure/lib/libssl/man/SSL_CTX_set_cert_store.3
  head/secure/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3
  head/secure/lib/libssl/man/SSL_CTX_set_cipher_list.3
  head/secure/lib/libssl/man/SSL_CTX_set_client_CA_list.3
  head/secure/lib/libssl/man/SSL_CTX_set_client_cert_cb.3
  head/secure/lib/libssl/man/SSL_CTX_set_custom_cli_ext.3
  head/secure/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3
  head/secure/lib/libssl/man/SSL_CTX_set_generate_session_id.3
  head/secure/lib/libssl/man/SSL_CTX_set_info_callback.3
  head/secure/lib/libssl/man/SSL_CTX_set_max_cert_list.3
  head/secure/lib/libssl/man/SSL_CTX_set_mode.3
  head/secure/lib/libssl/man/SSL_CTX_set_msg_callback.3
  head/secure/lib/libssl/man/SSL_CTX_set_options.3
  head/secure/lib/libssl/man/SSL_CTX_set_psk_client_callback.3
  head/secure/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3
  head/secure/lib/libssl/man/SSL_CTX_set_read_ahead.3
  head/secure/lib/libssl/man/SSL_CTX_set_session_cache_mode.3
  head/secure/lib/libssl/man/SSL_CTX_set_session_id_context.3
  head/secure/lib/libssl/man/SSL_CTX_set_ssl_version.3
  head/secure/lib/libssl/man/SSL_CTX_set_timeout.3
  head/secure/lib/libssl/man/SSL_CTX_set_tlsext_servername_callback.3
  head/secure/lib/libssl/man/SSL_CTX_set_tlsext_status_cb.3
  head/secure/lib/libssl/man/SSL_CTX_set_tlsext_ticket_key_cb.3
  head/secure/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3
  head/secure/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3
  head/secure/lib/libssl/man/SSL_CTX_set_verify.3
  head/secure/lib/libssl/man/SSL_CTX_use_certificate.3
  head/secure/lib/libssl/man/SSL_CTX_use_psk_identity_hint.3
  head/secure/lib/libssl/man/SSL_CTX_use_serverinfo.3
  head/secure/lib/libssl/man/SSL_SESSION_free.3
  head/secure/lib/libssl/man/SSL_SESSION_get_ex_new_index.3
  head/secure/lib/libssl/man/SSL_SESSION_get_time.3
  head/secure/lib/libssl/man/SSL_accept.3
  head/secure/lib/libssl/man/SSL_alert_type_string.3
  head/secure/lib/libssl/man/SSL_check_chain.3
  head/secure/lib/libssl/man/SSL_clear.3
  head/secure/lib/libssl/man/SSL_connect.3
  head/secure/lib/libssl/man/SSL_do_handshake.3
  head/secure/lib/libssl/man/SSL_free.3
  head/secure/lib/libssl/man/SSL_get_SSL_CTX.3
  head/secure/lib/libssl/man/SSL_get_ciphers.3
  head/secure/lib/libssl/man/SSL_get_client_CA_list.3
  head/secure/lib/libssl/man/SSL_get_current_cipher.3
  head/secure/lib/libssl/man/SSL_get_default_timeout.3
  head/secure/lib/libssl/man/SSL_get_error.3
  head/secure/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3
  head/secure/lib/libssl/man/SSL_get_ex_new_index.3
  head/secure/lib/libssl/man/SSL_get_fd.3
  head/secure/lib/libssl/man/SSL_get_peer_cert_chain.3
  head/secure/lib/libssl/man/SSL_get_peer_certificate.3
  head/secure/lib/libssl/man/SSL_get_psk_identity.3
  head/secure/lib/libssl/man/SSL_get_rbio.3
  head/secure/lib/libssl/man/SSL_get_session.3
  head/secure/lib/libssl/man/SSL_get_verify_result.3
  head/secure/lib/libssl/man/SSL_get_version.3
  head/secure/lib/libssl/man/SSL_library_init.3
  head/secure/lib/libssl/man/SSL_load_client_CA_file.3
  head/secure/lib/libssl/man/SSL_new.3
  head/secure/lib/libssl/man/SSL_pending.3
  head/secure/lib/libssl/man/SSL_read.3
  head/secure/lib/libssl/man/SSL_rstate_string.3
  head/secure/lib/libssl/man/SSL_session_reused.3
  head/secure/lib/libssl/man/SSL_set_bio.3
  head/secure/lib/libssl/man/SSL_set_connect_state.3
  head/secure/lib/libssl/man/SSL_set_fd.3
  head/secure/lib/libssl/man/SSL_set_session.3
  head/secure/lib/libssl/man/SSL_set_shutdown.3
  head/secure/lib/libssl/man/SSL_set_verify_result.3
  head/secure/lib/libssl/man/SSL_shutdown.3
  head/secure/lib/libssl/man/SSL_state_string.3
  head/secure/lib/libssl/man/SSL_want.3
  head/secure/lib/libssl/man/SSL_write.3
  head/secure/lib/libssl/man/d2i_SSL_SESSION.3
  head/secure/lib/libssl/man/ssl.3
  head/secure/usr.bin/openssl/Makefile.man
  head/secure/usr.bin/openssl/man/CA.pl.1
  head/secure/usr.bin/openssl/man/asn1parse.1
  head/secure/usr.bin/openssl/man/c_rehash.1
  head/secure/usr.bin/openssl/man/ca.1
  head/secure/usr.bin/openssl/man/ciphers.1
  head/secure/usr.bin/openssl/man/cms.1
  head/secure/usr.bin/openssl/man/crl.1
  head/secure/usr.bin/openssl/man/crl2pkcs7.1
  head/secure/usr.bin/openssl/man/dgst.1
  head/secure/usr.bin/openssl/man/dhparam.1
  head/secure/usr.bin/openssl/man/dsa.1
  head/secure/usr.bin/openssl/man/dsaparam.1
  head/secure/usr.bin/openssl/man/ec.1
  head/secure/usr.bin/openssl/man/ecparam.1
  head/secure/usr.bin/openssl/man/enc.1
  head/secure/usr.bin/openssl/man/errstr.1
  head/secure/usr.bin/openssl/man/gendsa.1
  head/secure/usr.bin/openssl/man/genpkey.1
  head/secure/usr.bin/openssl/man/genrsa.1
  head/secure/usr.bin/openssl/man/nseq.1
  head/secure/usr.bin/openssl/man/ocsp.1
  head/secure/usr.bin/openssl/man/openssl.1
  head/secure/usr.bin/openssl/man/passwd.1
  head/secure/usr.bin/openssl/man/pkcs12.1
  head/secure/usr.bin/openssl/man/pkcs7.1
  head/secure/usr.bin/openssl/man/pkcs8.1
  head/secure/usr.bin/openssl/man/pkey.1
  head/secure/usr.bin/openssl/man/pkeyparam.1
  head/secure/usr.bin/openssl/man/pkeyutl.1
  head/secure/usr.bin/openssl/man/rand.1
  head/secure/usr.bin/openssl/man/req.1
  head/secure/usr.bin/openssl/man/rsa.1
  head/secure/usr.bin/openssl/man/rsautl.1
  head/secure/usr.bin/openssl/man/s_client.1
  head/secure/usr.bin/openssl/man/s_server.1
  head/secure/usr.bin/openssl/man/s_time.1
  head/secure/usr.bin/openssl/man/sess_id.1
  head/secure/usr.bin/openssl/man/smime.1
  head/secure/usr.bin/openssl/man/speed.1
  head/secure/usr.bin/openssl/man/spkac.1
  head/secure/usr.bin/openssl/man/ts.1
  head/secure/usr.bin/openssl/man/tsget.1
  head/secure/usr.bin/openssl/man/verify.1
  head/secure/usr.bin/openssl/man/version.1
  head/secure/usr.bin/openssl/man/x509.1
  head/secure/usr.bin/openssl/man/x509v3_config.1
Directory Properties:
  head/crypto/openssl/   (props changed)

Modified: head/crypto/openssl/CHANGES
==============================================================================
--- head/crypto/openssl/CHANGES	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/CHANGES	Thu Nov  2 18:04:29 2017	(r325328)
@@ -2,6 +2,44 @@
  OpenSSL CHANGES
  _______________
 
+ This is a high-level summary of the most important changes.
+ For a full list of changes, see the git commit log; for example,
+ https://github.com/openssl/openssl/commits/ and pick the appropriate
+ release branch.
+
+ Changes between 1.0.2l and 1.0.2m [2 Nov 2017]
+
+  *) bn_sqrx8x_internal carry bug on x86_64
+
+     There is a carry propagating bug in the x86_64 Montgomery squaring
+     procedure. No EC algorithms are affected. Analysis suggests that attacks
+     against RSA and DSA as a result of this defect would be very difficult to
+     perform and are not believed likely. Attacks against DH are considered just
+     feasible (although very difficult) because most of the work necessary to
+     deduce information about a private key may be performed offline. The amount
+     of resources required for such an attack would be very significant and
+     likely only accessible to a limited number of attackers. An attacker would
+     additionally need online access to an unpatched system using the target
+     private key in a scenario with persistent DH parameters and a private
+     key that is shared between multiple clients.
+
+     This only affects processors that support the BMI1, BMI2 and ADX extensions
+     like Intel Broadwell (5th generation) and later or AMD Ryzen.
+
+     This issue was reported to OpenSSL by the OSS-Fuzz project.
+     (CVE-2017-3736)
+     [Andy Polyakov]
+
+  *) Malformed X.509 IPAddressFamily could cause OOB read
+
+     If an X.509 certificate has a malformed IPAddressFamily extension,
+     OpenSSL could do a one-byte buffer overread. The most likely result
+     would be an erroneous display of the certificate in text format.
+
+     This issue was reported to OpenSSL by the OSS-Fuzz project.
+     (CVE-2017-3735)
+     [Rich Salz]
+
  Changes between 1.0.2k and 1.0.2l [25 May 2017]
 
   *) Have 'config' recognise 64-bit mingw and choose 'mingw64' as the target

Modified: head/crypto/openssl/INSTALL
==============================================================================
--- head/crypto/openssl/INSTALL	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/INSTALL	Thu Nov  2 18:04:29 2017	(r325328)
@@ -190,10 +190,8 @@
      the failure that isn't a problem in OpenSSL itself (like a missing
      or malfunctioning bc).  If it is a problem with OpenSSL itself,
      try removing any compiler optimization flags from the CFLAG line
-     in Makefile.ssl and run "make clean; make". Please send a bug
-     report to <openssl-bugs@openssl.org>, including the output of
-     "make report" in order to be added to the request tracker at
-     http://www.openssl.org/support/rt.html.
+     in Makefile.ssl and run "make clean; make". To report a bug please open an
+     issue on GitHub, at https://github.com/openssl/openssl/issues.
 
   4. If everything tests ok, install OpenSSL with
 

Modified: head/crypto/openssl/Makefile
==============================================================================
--- head/crypto/openssl/Makefile	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/Makefile	Thu Nov  2 18:04:29 2017	(r325328)
@@ -4,7 +4,7 @@
 ## Makefile for OpenSSL
 ##
 
-VERSION=1.0.2l
+VERSION=1.0.2m
 MAJOR=1
 MINOR=0.2
 SHLIB_VERSION_NUMBER=1.0.0

Modified: head/crypto/openssl/NEWS
==============================================================================
--- head/crypto/openssl/NEWS	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/NEWS	Thu Nov  2 18:04:29 2017	(r325328)
@@ -5,6 +5,11 @@
   This file gives a brief overview of the major changes between each OpenSSL
   release. For more details please read the CHANGES file.
 
+  Major changes between OpenSSL 1.0.2l and OpenSSL 1.0.2m [2 Nov 2017]
+
+      o bn_sqrx8x_internal carry bug on x86_64 (CVE-2017-3736)
+      o Malformed X.509 IPAddressFamily could cause OOB read (CVE-2017-3735)
+
   Major changes between OpenSSL 1.0.2k and OpenSSL 1.0.2l [25 May 2017]
 
       o config now recognises 64-bit mingw and chooses mingw64 instead of mingw

Modified: head/crypto/openssl/README
==============================================================================
--- head/crypto/openssl/README	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/README	Thu Nov  2 18:04:29 2017	(r325328)
@@ -1,5 +1,5 @@
 
- OpenSSL 1.0.2l 25 May 2017
+ OpenSSL 1.0.2m 2 Nov 2017
 
  Copyright (c) 1998-2015 The OpenSSL Project
  Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson

Modified: head/crypto/openssl/apps/ca.c
==============================================================================
--- head/crypto/openssl/apps/ca.c	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/apps/ca.c	Thu Nov  2 18:04:29 2017	(r325328)
@@ -1985,10 +1985,6 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *
     /* Lets add the extensions, if there are any */
     if (ext_sect) {
         X509V3_CTX ctx;
-        if (ci->version == NULL)
-            if ((ci->version = ASN1_INTEGER_new()) == NULL)
-                goto err;
-        ASN1_INTEGER_set(ci->version, 2); /* version 3 certificate */
 
         /*
          * Free the current entries if any, there should not be any I believe
@@ -2049,6 +2045,15 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *
         BIO_printf(bio_err, "ERROR: adding extensions from request\n");
         ERR_print_errors(bio_err);
         goto err;
+    }
+
+    {
+        STACK_OF(X509_EXTENSION) *exts = ci->extensions;
+
+        if (exts != NULL && sk_X509_EXTENSION_num(exts) > 0)
+            /* Make it an X509 v3 certificate. */
+            if (!X509_set_version(ret, 2))
+                goto err;
     }
 
     /* Set the right value for the noemailDN option */

Modified: head/crypto/openssl/apps/s_client.c
==============================================================================
--- head/crypto/openssl/apps/s_client.c	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/apps/s_client.c	Thu Nov  2 18:04:29 2017	(r325328)
@@ -1667,6 +1667,8 @@ int MAIN(int argc, char **argv)
             if (strstr(mbuf, "/stream:features>"))
                 goto shut;
             seen = BIO_read(sbio, mbuf, BUFSIZZ);
+            if (seen <= 0)
+                goto shut;
             mbuf[seen] = 0;
         }
         BIO_printf(sbio,

Modified: head/crypto/openssl/apps/s_server.c
==============================================================================
--- head/crypto/openssl/apps/s_server.c	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/apps/s_server.c	Thu Nov  2 18:04:29 2017	(r325328)
@@ -3017,7 +3017,7 @@ static int www_body(char *hostname, int s, int stype, 
                 PEM_write_bio_X509(io, peer);
             } else
                 BIO_puts(io, "no client certificate available\n");
-            BIO_puts(io, "</BODY></HTML>\r\n\r\n");
+            BIO_puts(io, "</pre></BODY></HTML>\r\n\r\n");
             break;
         } else if ((www == 2 || www == 3)
                    && (strncmp("GET /", buf, 5) == 0)) {

Modified: head/crypto/openssl/apps/speed.c
==============================================================================
--- head/crypto/openssl/apps/speed.c	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/apps/speed.c	Thu Nov  2 18:04:29 2017	(r325328)
@@ -307,7 +307,8 @@ static SIGRETTYPE sig_done(int sig)
 #  if !defined(SIGALRM)
 #   define SIGALRM
 #  endif
-static unsigned int lapse, schlock;
+static volatile unsigned int lapse;
+static volatile unsigned int schlock;
 static void alarm_win32(unsigned int secs)
 {
     lapse = secs * 1000;
@@ -725,6 +726,7 @@ int MAIN(int argc, char **argv)
                 BIO_printf(bio_err, "no EVP given\n");
                 goto end;
             }
+            evp_md = NULL;
             evp_cipher = EVP_get_cipherbyname(*argv);
             if (!evp_cipher) {
                 evp_md = EVP_get_digestbyname(*argv);

Modified: head/crypto/openssl/apps/spkac.c
==============================================================================
--- head/crypto/openssl/apps/spkac.c	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/apps/spkac.c	Thu Nov  2 18:04:29 2017	(r325328)
@@ -5,7 +5,7 @@
  * 1999. Based on an original idea by Massimiliano Pala (madwolf@openca.org).
  */
 /* ====================================================================
- * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
+ * Copyright (c) 1999-2017 The OpenSSL Project.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -185,20 +185,23 @@ int MAIN(int argc, char **argv)
     }
     e = setup_engine(bio_err, engine, 0);
 
-    if (keyfile) {
+    if (keyfile != NULL) {
         pkey = load_key(bio_err,
                         strcmp(keyfile, "-") ? keyfile : NULL,
                         FORMAT_PEM, 1, passin, e, "private key");
-        if (!pkey) {
+        if (pkey == NULL)
             goto end;
-        }
         spki = NETSCAPE_SPKI_new();
-        if (challenge)
+        if (spki == NULL)
+            goto end;
+        if (challenge != NULL)
             ASN1_STRING_set(spki->spkac->challenge,
                             challenge, (int)strlen(challenge));
         NETSCAPE_SPKI_set_pubkey(spki, pkey);
         NETSCAPE_SPKI_sign(spki, pkey, EVP_md5());
         spkstr = NETSCAPE_SPKI_b64_encode(spki);
+        if (spkstr == NULL)
+            goto end;
 
         if (outfile)
             out = BIO_new_file(outfile, "w");
@@ -253,7 +256,7 @@ int MAIN(int argc, char **argv)
 
     spki = NETSCAPE_SPKI_b64_decode(spkstr, -1);
 
-    if (!spki) {
+    if (spki == NULL) {
         BIO_printf(bio_err, "Error loading SPKAC\n");
         ERR_print_errors(bio_err);
         goto end;
@@ -282,9 +285,9 @@ int MAIN(int argc, char **argv)
     pkey = NETSCAPE_SPKI_get_pubkey(spki);
     if (verify) {
         i = NETSCAPE_SPKI_verify(spki, pkey);
-        if (i > 0)
+        if (i > 0) {
             BIO_printf(bio_err, "Signature OK\n");
-        else {
+        } else {
             BIO_printf(bio_err, "Signature Failure\n");
             ERR_print_errors(bio_err);
             goto end;

Modified: head/crypto/openssl/apps/srp.c
==============================================================================
--- head/crypto/openssl/apps/srp.c	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/apps/srp.c	Thu Nov  2 18:04:29 2017	(r325328)
@@ -123,13 +123,14 @@ static int get_index(CA_DB *db, char *id, char type)
     int i;
     if (id == NULL)
         return -1;
-    if (type == DB_SRP_INDEX)
+    if (type == DB_SRP_INDEX) {
         for (i = 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++) {
             pp = sk_OPENSSL_PSTRING_value(db->db->data, i);
             if (pp[DB_srptype][0] == DB_SRP_INDEX
                 && !strcmp(id, pp[DB_srpid]))
                 return i;
-    } else
+        }
+    } else {
         for (i = 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++) {
             pp = sk_OPENSSL_PSTRING_value(db->db->data, i);
 
@@ -137,6 +138,7 @@ static int get_index(CA_DB *db, char *id, char type)
                 && !strcmp(id, pp[DB_srpid]))
                 return i;
         }
+    }
 
     return -1;
 }
@@ -177,8 +179,8 @@ static int update_index(CA_DB *db, BIO *bio, char **ro
     char **irow;
     int i;
 
-    if ((irow =
-         (char **)OPENSSL_malloc(sizeof(char *) * (DB_NUMBER + 1))) == NULL) {
+    irow = (char **)OPENSSL_malloc(sizeof(char *) * (DB_NUMBER + 1));
+    if (irow == NULL) {
         BIO_printf(bio_err, "Memory allocation failure\n");
         return 0;
     }
@@ -205,30 +207,32 @@ static char *srp_verify_user(const char *user, const c
                              char *srp_usersalt, const char *g, const char *N,
                              const char *passin, BIO *bio, int verbose)
 {
-    char password[1024];
+    char password[1025];
     PW_CB_DATA cb_tmp;
     char *verifier = NULL;
     char *gNid = NULL;
+    int len;
 
     cb_tmp.prompt_info = user;
     cb_tmp.password = passin;
 
-    if (password_callback(password, 1024, 0, &cb_tmp) > 0) {
+    len = password_callback(password, sizeof(password)-1, 0, &cb_tmp);
+    if (len > 0) {
+        password[len] = 0;
         VERBOSE BIO_printf(bio,
                            "Validating\n   user=\"%s\"\n srp_verifier=\"%s\"\n srp_usersalt=\"%s\"\n g=\"%s\"\n N=\"%s\"\n",
                            user, srp_verifier, srp_usersalt, g, N);
-        BIO_printf(bio, "Pass %s\n", password);
+        VVERBOSE BIO_printf(bio, "Pass %s\n", password);
 
-        if (!
-            (gNid =
-             SRP_create_verifier(user, password, &srp_usersalt, &verifier, N,
-                                 g))) {
+        if (!(gNid = SRP_create_verifier(user, password, &srp_usersalt,
+                                         &verifier, N, g))) {
             BIO_printf(bio, "Internal error validating SRP verifier\n");
         } else {
             if (strcmp(verifier, srp_verifier))
                 gNid = NULL;
             OPENSSL_free(verifier);
         }
+        OPENSSL_cleanse(password, len);
     }
     return gNid;
 }
@@ -237,24 +241,27 @@ static char *srp_create_user(char *user, char **srp_ve
                              char **srp_usersalt, char *g, char *N,
                              char *passout, BIO *bio, int verbose)
 {
-    char password[1024];
+    char password[1025];
     PW_CB_DATA cb_tmp;
     char *gNid = NULL;
     char *salt = NULL;
+    int len;
     cb_tmp.prompt_info = user;
     cb_tmp.password = passout;
 
-    if (password_callback(password, 1024, 1, &cb_tmp) > 0) {
+    len = password_callback(password, sizeof(password)-1, 1, &cb_tmp);
+    if (len > 0) {
+        password[len] = 0;
         VERBOSE BIO_printf(bio,
                            "Creating\n user=\"%s\"\n g=\"%s\"\n N=\"%s\"\n",
                            user, g, N);
-        if (!
-            (gNid =
-             SRP_create_verifier(user, password, &salt, srp_verifier, N,
-                                 g))) {
+        if (!(gNid = SRP_create_verifier(user, password, &salt,
+                                         srp_verifier, N, g))) {
             BIO_printf(bio, "Internal error creating SRP verifier\n");
-        } else
+        } else {
             *srp_usersalt = salt;
+        }
+        OPENSSL_cleanse(password, len);
         VVERBOSE BIO_printf(bio, "gNid=%s salt =\"%s\"\n verifier =\"%s\"\n",
                             gNid, salt, *srp_verifier);
 
@@ -314,9 +321,9 @@ int MAIN(int argc, char **argv)
     argc--;
     argv++;
     while (argc >= 1 && badops == 0) {
-        if (strcmp(*argv, "-verbose") == 0)
+        if (strcmp(*argv, "-verbose") == 0) {
             verbose++;
-        else if (strcmp(*argv, "-config") == 0) {
+        } else if (strcmp(*argv, "-config") == 0) {
             if (--argc < 1)
                 goto bad;
             configfile = *(++argv);
@@ -328,15 +335,15 @@ int MAIN(int argc, char **argv)
             if (--argc < 1)
                 goto bad;
             dbfile = *(++argv);
-        } else if (strcmp(*argv, "-add") == 0)
+        } else if (strcmp(*argv, "-add") == 0) {
             add_user = 1;
-        else if (strcmp(*argv, "-delete") == 0)
+        } else if (strcmp(*argv, "-delete") == 0) {
             delete_user = 1;
-        else if (strcmp(*argv, "-modify") == 0)
+        } else if (strcmp(*argv, "-modify") == 0) {
             modify_user = 1;
-        else if (strcmp(*argv, "-list") == 0)
+        } else if (strcmp(*argv, "-list") == 0) {
             list_user = 1;
-        else if (strcmp(*argv, "-gn") == 0) {
+        } else if (strcmp(*argv, "-gn") == 0) {
             if (--argc < 1)
                 goto bad;
             gN = *(++argv);
@@ -366,8 +373,9 @@ int MAIN(int argc, char **argv)
             BIO_printf(bio_err, "unknown option %s\n", *argv);
             badops = 1;
             break;
-        } else
+        } else {
             break;
+        }
 
         argc--;
         argv++;
@@ -388,7 +396,7 @@ int MAIN(int argc, char **argv)
                    "Need at least one user for options -add, -delete, -modify. \n");
         badops = 1;
     }
-    if ((passin || passout) && argc != 1) {
+    if ((passargin || passargout) && argc != 1) {
         BIO_printf(bio_err,
                    "-passin, -passout arguments only valid with one user.\n");
         badops = 1;
@@ -706,9 +714,9 @@ int MAIN(int argc, char **argv)
                 doupdatedb = 1;
             }
         }
-        if (--argc > 0)
+        if (--argc > 0) {
             user = *(argv++);
-        else {
+        } else {
             user = NULL;
             list_user = 0;
         }

Modified: head/crypto/openssl/apps/tsget
==============================================================================
--- head/crypto/openssl/apps/tsget	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/apps/tsget	Thu Nov  2 18:04:29 2017	(r325328)
@@ -193,4 +193,3 @@ REQUEST: foreach (@ARGV) {
     STDERR->printflush(", $output written.\n") if $options{v};
 }
 $curl->cleanup();
-WWW::Curl::Easy::global_cleanup();

Modified: head/crypto/openssl/crypto/asn1/Makefile
==============================================================================
--- head/crypto/openssl/crypto/asn1/Makefile	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/crypto/asn1/Makefile	Thu Nov  2 18:04:29 2017	(r325328)
@@ -680,7 +680,7 @@ tasn_fre.o: ../../include/openssl/e_os2.h ../../includ
 tasn_fre.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 tasn_fre.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 tasn_fre.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-tasn_fre.o: ../../include/openssl/symhacks.h tasn_fre.c
+tasn_fre.o: ../../include/openssl/symhacks.h asn1_int.h tasn_fre.c
 tasn_new.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
 tasn_new.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
 tasn_new.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
@@ -688,7 +688,7 @@ tasn_new.o: ../../include/openssl/lhash.h ../../includ
 tasn_new.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 tasn_new.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 tasn_new.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-tasn_new.o: ../../include/openssl/symhacks.h tasn_new.c
+tasn_new.o: ../../include/openssl/symhacks.h asn1_int.h tasn_new.c
 tasn_prn.o: ../../e_os.h ../../include/openssl/asn1.h
 tasn_prn.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 tasn_prn.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h

Modified: head/crypto/openssl/crypto/asn1/a_bitstr.c
==============================================================================
--- head/crypto/openssl/crypto/asn1/a_bitstr.c	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/crypto/asn1/a_bitstr.c	Thu Nov  2 18:04:29 2017	(r325328)
@@ -56,6 +56,7 @@
  * [including the GNU Public Licence.]
  */
 
+#include <limits.h>
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/asn1.h>
@@ -133,6 +134,11 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING *
 
     if (len < 1) {
         i = ASN1_R_STRING_TOO_SHORT;
+        goto err;
+    }
+
+    if (len > INT_MAX) {
+        i = ASN1_R_STRING_TOO_LONG;
         goto err;
     }
 

Copied: head/crypto/openssl/crypto/asn1/asn1_int.h (from r325326, vendor-crypto/openssl/dist/crypto/asn1/asn1_int.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/crypto/openssl/crypto/asn1/asn1_int.h	Thu Nov  2 18:04:29 2017	(r325328, copy of r325326, vendor-crypto/openssl/dist/crypto/asn1/asn1_int.h)
@@ -0,0 +1,63 @@
+/* asn1t.h */
+/*
+ * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
+ * 2006.
+ */
+/* ====================================================================
+ * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    licensing@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+/* Internal ASN1 template structures and functions: not for application use */
+
+void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it,
+                            int combine);

Modified: head/crypto/openssl/crypto/asn1/tasn_fre.c
==============================================================================
--- head/crypto/openssl/crypto/asn1/tasn_fre.c	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/crypto/asn1/tasn_fre.c	Thu Nov  2 18:04:29 2017	(r325328)
@@ -61,10 +61,8 @@
 #include <openssl/asn1.h>
 #include <openssl/asn1t.h>
 #include <openssl/objects.h>
+#include "asn1_int.h"
 
-static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it,
-                                   int combine);
-
 /* Free up an ASN1 structure */
 
 void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it)
@@ -77,8 +75,7 @@ void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_I
     asn1_item_combine_free(pval, it, 0);
 }
 
-static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it,
-                                   int combine)
+void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine)
 {
     const ASN1_TEMPLATE *tt = NULL, *seqtt;
     const ASN1_EXTERN_FUNCS *ef;

Modified: head/crypto/openssl/crypto/asn1/tasn_new.c
==============================================================================
--- head/crypto/openssl/crypto/asn1/tasn_new.c	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/crypto/asn1/tasn_new.c	Thu Nov  2 18:04:29 2017	(r325328)
@@ -63,6 +63,7 @@
 #include <openssl/err.h>
 #include <openssl/asn1t.h>
 #include <string.h>
+#include "asn1_int.h"
 
 static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
                                     int combine);
@@ -199,7 +200,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval,
     return 1;
 
  memerr2:
-    ASN1_item_ex_free(pval, it);
+    asn1_item_combine_free(pval, it, combine);
  memerr:
     ASN1err(ASN1_F_ASN1_ITEM_EX_COMBINE_NEW, ERR_R_MALLOC_FAILURE);
 #ifdef CRYPTO_MDEBUG
@@ -209,7 +210,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval,
     return 0;
 
  auxerr2:
-    ASN1_item_ex_free(pval, it);
+    asn1_item_combine_free(pval, it, combine);
  auxerr:
     ASN1err(ASN1_F_ASN1_ITEM_EX_COMBINE_NEW, ASN1_R_AUX_ERROR);
 #ifdef CRYPTO_MDEBUG

Modified: head/crypto/openssl/crypto/asn1/x_name.c
==============================================================================
--- head/crypto/openssl/crypto/asn1/x_name.c	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/crypto/asn1/x_name.c	Thu Nov  2 18:04:29 2017	(r325328)
@@ -523,19 +523,11 @@ static int i2d_name_canon(STACK_OF(STACK_OF_X509_NAME_
 
 int X509_NAME_set(X509_NAME **xn, X509_NAME *name)
 {
-    X509_NAME *in;
-
-    if (!xn || !name)
-        return (0);
-
-    if (*xn != name) {
-        in = X509_NAME_dup(name);
-        if (in != NULL) {
-            X509_NAME_free(*xn);
-            *xn = in;
-        }
-    }
-    return (*xn != NULL);
+    if ((name = X509_NAME_dup(name)) == NULL)
+        return 0;
+    X509_NAME_free(*xn);
+    *xn = name;
+    return 1;
 }
 
 IMPLEMENT_STACK_OF(X509_NAME_ENTRY)

Modified: head/crypto/openssl/crypto/asn1/x_pkey.c
==============================================================================
--- head/crypto/openssl/crypto/asn1/x_pkey.c	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/crypto/asn1/x_pkey.c	Thu Nov  2 18:04:29 2017	(r325328)
@@ -106,10 +106,14 @@ X509_PKEY *X509_PKEY_new(void)
     X509_PKEY *ret = NULL;
     ASN1_CTX c;
 
-    M_ASN1_New_Malloc(ret, X509_PKEY);
+    ret = OPENSSL_malloc(sizeof(X509_PKEY));
+    if (ret == NULL) {
+        c.line = __LINE__;
+        goto err;
+    }
     ret->version = 0;
-    M_ASN1_New(ret->enc_algor, X509_ALGOR_new);
-    M_ASN1_New(ret->enc_pkey, M_ASN1_OCTET_STRING_new);
+    ret->enc_algor = X509_ALGOR_new();
+    ret->enc_pkey = M_ASN1_OCTET_STRING_new();
     ret->dec_pkey = NULL;
     ret->key_length = 0;
     ret->key_data = NULL;
@@ -117,8 +121,15 @@ X509_PKEY *X509_PKEY_new(void)
     ret->cipher.cipher = NULL;
     memset(ret->cipher.iv, 0, EVP_MAX_IV_LENGTH);
     ret->references = 1;
-    return (ret);
-    M_ASN1_New_Error(ASN1_F_X509_PKEY_NEW);
+    if (ret->enc_algor == NULL || ret->enc_pkey == NULL) {
+        c.line = __LINE__;
+        goto err;
+    }
+    return ret;
+err:
+    X509_PKEY_free(ret);
+    ASN1_MAC_H_err(ASN1_F_X509_PKEY_NEW, ERR_R_MALLOC_FAILURE, c.line);
+    return NULL;
 }
 
 void X509_PKEY_free(X509_PKEY *x)

Modified: head/crypto/openssl/crypto/bn/asm/x86_64-mont5.pl
==============================================================================
--- head/crypto/openssl/crypto/bn/asm/x86_64-mont5.pl	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/crypto/bn/asm/x86_64-mont5.pl	Thu Nov  2 18:04:29 2017	(r325328)
@@ -3090,11 +3090,19 @@ $code.=<<___;
 
 .align	32
 .Lsqrx8x_break:
-	sub	16+8(%rsp),%r8		# consume last carry
+	xor	$zero,$zero
+	sub	16+8(%rsp),%rbx		# mov 16(%rsp),%cf
+	adcx	$zero,%r8
 	mov	24+8(%rsp),$carry	# initial $tptr, borrow $carry
+	adcx	$zero,%r9
 	mov	0*8($aptr),%rdx		# a[8], modulo-scheduled
-	xor	%ebp,%ebp		# xor	$zero,$zero
+	adc	\$0,%r10
 	mov	%r8,0*8($tptr)
+	adc	\$0,%r11
+	adc	\$0,%r12
+	adc	\$0,%r13
+	adc	\$0,%r14
+	adc	\$0,%r15
 	cmp	$carry,$tptr		# cf=0, of=0
 	je	.Lsqrx8x_outer_loop
 

Modified: head/crypto/openssl/crypto/bn/bn_exp.c
==============================================================================
--- head/crypto/openssl/crypto/bn/bn_exp.c	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/crypto/bn/bn_exp.c	Thu Nov  2 18:04:29 2017	(r325328)
@@ -145,7 +145,8 @@ int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p
     int i, bits, ret = 0;
     BIGNUM *v, *rr;
 
-    if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) {
+    if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0
+            || BN_get_flags(a, BN_FLG_CONSTTIME) != 0) {
         /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */
         BNerr(BN_F_BN_EXP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
         return -1;
@@ -245,7 +246,9 @@ int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNU
     if (BN_is_odd(m)) {
 # ifdef MONT_EXP_WORD
         if (a->top == 1 && !a->neg
-            && (BN_get_flags(p, BN_FLG_CONSTTIME) == 0)) {
+            && (BN_get_flags(p, BN_FLG_CONSTTIME) == 0)
+            && (BN_get_flags(a, BN_FLG_CONSTTIME) == 0)
+            && (BN_get_flags(m, BN_FLG_CONSTTIME) == 0)) {
             BN_ULONG A = a->d[0];
             ret = BN_mod_exp_mont_word(r, A, p, m, ctx, NULL);
         } else
@@ -277,7 +280,9 @@ int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const 
     BIGNUM *val[TABLE_SIZE];
     BN_RECP_CTX recp;
 
-    if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) {
+    if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0
+            || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
+            || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {
         /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */
         BNerr(BN_F_BN_MOD_EXP_RECP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
         return -1;
@@ -411,7 +416,9 @@ int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const
     BIGNUM *val[TABLE_SIZE];
     BN_MONT_CTX *mont = NULL;
 
-    if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) {
+    if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0
+            || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
+            || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {
         return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
     }
 
@@ -1217,7 +1224,8 @@ int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const
 #define BN_TO_MONTGOMERY_WORD(r, w, mont) \
                 (BN_set_word(r, (w)) && BN_to_montgomery(r, r, (mont), ctx))
 
-    if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) {
+    if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0
+            || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {
         /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */
         BNerr(BN_F_BN_MOD_EXP_MONT_WORD, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
         return -1;
@@ -1348,7 +1356,9 @@ int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, cons
     /* Table of variables obtained from 'ctx' */
     BIGNUM *val[TABLE_SIZE];
 
-    if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) {
+    if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0
+            || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
+            || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {
         /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */
         BNerr(BN_F_BN_MOD_EXP_SIMPLE, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
         return -1;

Modified: head/crypto/openssl/crypto/bn/bn_lib.c
==============================================================================
--- head/crypto/openssl/crypto/bn/bn_lib.c	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/crypto/bn/bn_lib.c	Thu Nov  2 18:04:29 2017	(r325328)
@@ -524,6 +524,9 @@ BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
     memcpy(a->d, b->d, sizeof(b->d[0]) * b->top);
 #endif
 
+    if (BN_get_flags(b, BN_FLG_CONSTTIME) != 0)
+        BN_set_flags(a, BN_FLG_CONSTTIME);
+
     a->top = b->top;
     a->neg = b->neg;
     bn_check_top(a);

Modified: head/crypto/openssl/crypto/bn/bn_mont.c
==============================================================================
--- head/crypto/openssl/crypto/bn/bn_mont.c	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/crypto/bn/bn_mont.c	Thu Nov  2 18:04:29 2017	(r325328)
@@ -394,6 +394,9 @@ int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *m
         tmod.dmax = 2;
         tmod.neg = 0;
 
+        if (BN_get_flags(mod, BN_FLG_CONSTTIME) != 0)
+            BN_set_flags(&tmod, BN_FLG_CONSTTIME);
+
         mont->ri = (BN_num_bits(mod) + (BN_BITS2 - 1)) / BN_BITS2 * BN_BITS2;
 
 # if defined(OPENSSL_BN_ASM_MONT) && (BN_BITS2<=32)

Modified: head/crypto/openssl/crypto/bn/bn_mul.c
==============================================================================
--- head/crypto/openssl/crypto/bn/bn_mul.c	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/crypto/bn/bn_mul.c	Thu Nov  2 18:04:29 2017	(r325328)
@@ -1032,46 +1032,6 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b
             rr->top = top;
             goto end;
         }
-# if 0
-        if (i == 1 && !BN_get_flags(b, BN_FLG_STATIC_DATA)) {
-            BIGNUM *tmp_bn = (BIGNUM *)b;
-            if (bn_wexpand(tmp_bn, al) == NULL)
-                goto err;
-            tmp_bn->d[bl] = 0;
-            bl++;
-            i--;
-        } else if (i == -1 && !BN_get_flags(a, BN_FLG_STATIC_DATA)) {
-            BIGNUM *tmp_bn = (BIGNUM *)a;
-            if (bn_wexpand(tmp_bn, bl) == NULL)
-                goto err;
-            tmp_bn->d[al] = 0;
-            al++;
-            i++;
-        }
-        if (i == 0) {
-            /* symmetric and > 4 */
-            /* 16 or larger */
-            j = BN_num_bits_word((BN_ULONG)al);
-            j = 1 << (j - 1);
-            k = j + j;
-            t = BN_CTX_get(ctx);
-            if (al == j) {      /* exact multiple */
-                if (bn_wexpand(t, k * 2) == NULL)
-                    goto err;
-                if (bn_wexpand(rr, k * 2) == NULL)
-                    goto err;
-                bn_mul_recursive(rr->d, a->d, b->d, al, t->d);
-            } else {
-                if (bn_wexpand(t, k * 4) == NULL)
-                    goto err;
-                if (bn_wexpand(rr, k * 4) == NULL)
-                    goto err;
-                bn_mul_part_recursive(rr->d, a->d, b->d, al - j, j, t->d);
-            }
-            rr->top = top;
-            goto end;
-        }
-# endif
     }
 #endif                          /* BN_RECURSION */
     if (bn_wexpand(rr, top) == NULL)

Modified: head/crypto/openssl/crypto/bn/bn_x931p.c
==============================================================================
--- head/crypto/openssl/crypto/bn/bn_x931p.c	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/crypto/bn/bn_x931p.c	Thu Nov  2 18:04:29 2017	(r325328)
@@ -217,6 +217,8 @@ int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int n
 
     BN_CTX_start(ctx);
     t = BN_CTX_get(ctx);
+    if (t == NULL)
+        goto err;
 
     for (i = 0; i < 1000; i++) {
         if (!BN_rand(Xq, nbits, 1, 0))
@@ -255,10 +257,12 @@ int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, B
     int ret = 0;
 
     BN_CTX_start(ctx);
-    if (!Xp1)
+    if (Xp1 == NULL)
         Xp1 = BN_CTX_get(ctx);
-    if (!Xp2)
+    if (Xp2 == NULL)
         Xp2 = BN_CTX_get(ctx);
+    if (Xp1 == NULL || Xp2 == NULL)
+        goto error;
 
     if (!BN_rand(Xp1, 101, 0, 0))
         goto error;

Modified: head/crypto/openssl/crypto/cryptlib.c
==============================================================================
--- head/crypto/openssl/crypto/cryptlib.c	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/crypto/cryptlib.c	Thu Nov  2 18:04:29 2017	(r325328)
@@ -469,11 +469,18 @@ void CRYPTO_THREADID_set_pointer(CRYPTO_THREADID *id, 
     }
 }
 
+#ifdef OPENSSL_FIPS
+extern int FIPS_crypto_threadid_set_callback(void (*func) (CRYPTO_THREADID *));
+#endif
+
 int CRYPTO_THREADID_set_callback(void (*func) (CRYPTO_THREADID *))
 {
     if (threadid_callback)
         return 0;
     threadid_callback = func;
+#ifdef OPENSSL_FIPS
+    FIPS_crypto_threadid_set_callback(func);
+#endif
     return 1;
 }
 

Modified: head/crypto/openssl/crypto/dh/Makefile
==============================================================================
--- head/crypto/openssl/crypto/dh/Makefile	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/crypto/dh/Makefile	Thu Nov  2 18:04:29 2017	(r325328)
@@ -134,7 +134,7 @@ dh_gen.o: ../../include/openssl/opensslconf.h ../../in
 dh_gen.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
 dh_gen.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 dh_gen.o: ../cryptlib.h dh_gen.c
-dh_kdf.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
+dh_kdf.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 dh_kdf.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
 dh_kdf.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 dh_kdf.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h

Modified: head/crypto/openssl/crypto/dh/dh.h
==============================================================================
--- head/crypto/openssl/crypto/dh/dh.h	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/crypto/dh/dh.h	Thu Nov  2 18:04:29 2017	(r325328)
@@ -257,11 +257,13 @@ DH *DH_get_1024_160(void);
 DH *DH_get_2048_224(void);
 DH *DH_get_2048_256(void);
 
+# ifndef OPENSSL_NO_CMS
 /* RFC2631 KDF */
 int DH_KDF_X9_42(unsigned char *out, size_t outlen,
                  const unsigned char *Z, size_t Zlen,
                  ASN1_OBJECT *key_oid,
                  const unsigned char *ukm, size_t ukmlen, const EVP_MD *md);
+# endif
 
 # define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \
         EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \

Modified: head/crypto/openssl/crypto/dh/dh_kdf.c
==============================================================================
--- head/crypto/openssl/crypto/dh/dh_kdf.c	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/crypto/dh/dh_kdf.c	Thu Nov  2 18:04:29 2017	(r325328)
@@ -51,6 +51,9 @@
  * ====================================================================
  */
 
+#include <e_os.h>
+
+#ifndef OPENSSL_NO_CMS
 #include <string.h>
 #include <openssl/dh.h>
 #include <openssl/evp.h>
@@ -185,3 +188,4 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen,
     EVP_MD_CTX_cleanup(&mctx);
     return rv;
 }
+#endif

Modified: head/crypto/openssl/crypto/dh/dh_pmeth.c
==============================================================================
--- head/crypto/openssl/crypto/dh/dh_pmeth.c	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/crypto/dh/dh_pmeth.c	Thu Nov  2 18:04:29 2017	(r325328)
@@ -207,7 +207,11 @@ static int pkey_dh_ctrl(EVP_PKEY_CTX *ctx, int type, i
     case EVP_PKEY_CTRL_DH_KDF_TYPE:
         if (p1 == -2)
             return dctx->kdf_type;
+#ifdef OPENSSL_NO_CMS
+        if (p1 != EVP_PKEY_DH_KDF_NONE)
+#else
         if (p1 != EVP_PKEY_DH_KDF_NONE && p1 != EVP_PKEY_DH_KDF_X9_42)
+#endif
             return -2;
         dctx->kdf_type = p1;
         return 1;
@@ -448,7 +452,9 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned 
             return ret;
         *keylen = ret;
         return 1;
-    } else if (dctx->kdf_type == EVP_PKEY_DH_KDF_X9_42) {
+    }
+#ifndef OPENSSL_NO_CMS
+    else if (dctx->kdf_type == EVP_PKEY_DH_KDF_X9_42) {
         unsigned char *Z = NULL;
         size_t Zlen = 0;
         if (!dctx->kdf_outlen || !dctx->kdf_oid)
@@ -479,6 +485,7 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned 
         }
         return ret;
     }
+#endif
     return 1;
 }
 

Modified: head/crypto/openssl/crypto/dsa/dsa_ameth.c
==============================================================================
--- head/crypto/openssl/crypto/dsa/dsa_ameth.c	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/crypto/dsa/dsa_ameth.c	Thu Nov  2 18:04:29 2017	(r325328)
@@ -258,6 +258,7 @@ static int dsa_priv_decode(EVP_PKEY *pkey, PKCS8_PRIV_
         goto dsaerr;
     }
 
+    BN_set_flags(dsa->priv_key, BN_FLG_CONSTTIME);
     if (!BN_mod_exp(dsa->pub_key, dsa->g, dsa->priv_key, dsa->p, ctx)) {
         DSAerr(DSA_F_DSA_PRIV_DECODE, DSA_R_BN_ERROR);
         goto dsaerr;

Modified: head/crypto/openssl/crypto/dsa/dsa_gen.c
==============================================================================
--- head/crypto/openssl/crypto/dsa/dsa_gen.c	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/crypto/dsa/dsa_gen.c	Thu Nov  2 18:04:29 2017	(r325328)
@@ -482,6 +482,8 @@ int dsa_builtin_paramgen2(DSA *ret, size_t L, size_t N
     } else {
         p = BN_CTX_get(ctx);
         q = BN_CTX_get(ctx);
+        if (q == NULL)
+            goto err;
     }
 
     if (!BN_lshift(test, BN_value_one(), L - 1))

Modified: head/crypto/openssl/crypto/dsa/dsa_ossl.c
==============================================================================
--- head/crypto/openssl/crypto/dsa/dsa_ossl.c	Thu Nov  2 17:35:49 2017	(r325327)
+++ head/crypto/openssl/crypto/dsa/dsa_ossl.c	Thu Nov  2 18:04:29 2017	(r325328)
@@ -224,7 +224,9 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BI
 {
     BN_CTX *ctx;
     BIGNUM k, kq, *K, *kinv = NULL, *r = NULL;
+    BIGNUM l, m;
     int ret = 0;
+    int q_bits;
 
     if (!dsa->p || !dsa->q || !dsa->g) {
         DSAerr(DSA_F_DSA_SIGN_SETUP, DSA_R_MISSING_PARAMETERS);
@@ -233,6 +235,8 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BI
 
     BN_init(&k);
     BN_init(&kq);
+    BN_init(&l);
+    BN_init(&m);
 
     if (ctx_in == NULL) {
         if ((ctx = BN_CTX_new()) == NULL)
@@ -243,6 +247,13 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BI
     if ((r = BN_new()) == NULL)
         goto err;
 
+    /* Preallocate space */
+    q_bits = BN_num_bits(dsa->q);
+    if (!BN_set_bit(&k, q_bits)
+        || !BN_set_bit(&l, q_bits)
+        || !BN_set_bit(&m, q_bits))
+        goto err;
+
     /* Get random k */
     do
         if (!BN_rand_range(&k, dsa->q))
@@ -263,25 +274,24 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BI
     /* Compute r = (g^k mod p) mod q */
 
     if ((dsa->flags & DSA_FLAG_NO_EXP_CONSTTIME) == 0) {
-        if (!BN_copy(&kq, &k))
-            goto err;
-
-        BN_set_flags(&kq, BN_FLG_CONSTTIME);
-
         /*
          * We do not want timing information to leak the length of k, so we
-         * compute g^k using an equivalent exponent of fixed length. (This
-         * is a kludge that we need because the BN_mod_exp_mont() does not
-         * let us specify the desired timing behaviour.)
+         * compute G^k using an equivalent scalar of fixed bit-length.
+         *
+         * We unconditionally perform both of these additions to prevent a
+         * small timing information leakage.  We then choose the sum that is
+         * one bit longer than the modulus.
+         *

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?201711021804.vA2I4TK8071402>