summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libc/include/thread_private.h66
-rw-r--r--src/lib/libc/net/ether_aton.36
-rw-r--r--src/lib/libc/net/ethers.c4
-rw-r--r--src/lib/libc/net/gai_strerror.36
-rw-r--r--src/lib/libc/net/if_indextoname.312
-rw-r--r--src/lib/libc/net/inet6_opt_init.318
-rw-r--r--src/lib/libc/net/inet6_rth_space.38
-rw-r--r--src/lib/libc/stdlib/exit.311
-rw-r--r--src/lib/libc/stdlib/malloc.328
-rw-r--r--src/lib/libc/stdlib/malloc.c9
-rw-r--r--src/lib/libc/stdlib/mkstemp.c5
-rw-r--r--src/lib/libc/stdlib/mktemp.342
-rw-r--r--src/lib/libc/stdlib/ptsname.36
-rw-r--r--src/lib/libc/stdlib/rand48.38
-rw-r--r--src/lib/libc/stdlib/realpath.36
-rw-r--r--src/lib/libc/string/memmem.36
-rw-r--r--src/lib/libcrypto/Makefile17
-rw-r--r--src/lib/libcrypto/Symbols.list5
-rw-r--r--src/lib/libcrypto/aes/aes.c296
-rw-r--r--src/lib/libcrypto/aes/aes_amd64.c201
-rw-r--r--src/lib/libcrypto/aes/aes_core.c101
-rw-r--r--src/lib/libcrypto/aes/aes_i386.c201
-rw-r--r--src/lib/libcrypto/aes/aes_ige.c195
-rw-r--r--src/lib/libcrypto/aes/aes_local.h31
-rw-r--r--src/lib/libcrypto/aes/asm/aes-586.pl30
-rwxr-xr-xsrc/lib/libcrypto/aes/asm/aes-x86_64.pl90
-rw-r--r--src/lib/libcrypto/aes/asm/bsaes-x86_64.pl3123
-rw-r--r--src/lib/libcrypto/aes/asm/vpaes-x86.pl911
-rw-r--r--src/lib/libcrypto/aes/asm/vpaes-x86_64.pl1222
-rw-r--r--src/lib/libcrypto/arch/aarch64/Makefile.inc4
-rw-r--r--src/lib/libcrypto/arch/aarch64/crypto_arch.h3
-rw-r--r--src/lib/libcrypto/arch/aarch64/opensslconf.h131
-rw-r--r--src/lib/libcrypto/arch/alpha/opensslconf.h129
-rw-r--r--src/lib/libcrypto/arch/amd64/Makefile.inc13
-rw-r--r--src/lib/libcrypto/arch/amd64/crypto_arch.h15
-rw-r--r--src/lib/libcrypto/arch/amd64/crypto_cpu_caps.c16
-rw-r--r--src/lib/libcrypto/arch/amd64/opensslconf.h126
-rw-r--r--src/lib/libcrypto/arch/arm/Makefile.inc27
-rw-r--r--src/lib/libcrypto/arch/arm/arm_arch.h59
-rw-r--r--src/lib/libcrypto/arch/arm/armcap.c88
-rw-r--r--src/lib/libcrypto/arch/arm/armv4cpuid.S69
-rw-r--r--src/lib/libcrypto/arch/arm/crypto_arch.h16
-rw-r--r--src/lib/libcrypto/arch/arm/opensslconf.h131
-rw-r--r--src/lib/libcrypto/arch/hppa/opensslconf.h131
-rw-r--r--src/lib/libcrypto/arch/i386/Makefile.inc12
-rw-r--r--src/lib/libcrypto/arch/i386/crypto_arch.h21
-rw-r--r--src/lib/libcrypto/arch/i386/crypto_cpu_caps.c24
-rw-r--r--src/lib/libcrypto/arch/i386/opensslconf.h131
-rw-r--r--src/lib/libcrypto/arch/m88k/opensslconf.h131
-rw-r--r--src/lib/libcrypto/arch/mips64/opensslconf.h131
-rw-r--r--src/lib/libcrypto/arch/powerpc/opensslconf.h131
-rw-r--r--src/lib/libcrypto/arch/powerpc64/opensslconf.h126
-rw-r--r--src/lib/libcrypto/arch/riscv64/opensslconf.h131
-rw-r--r--src/lib/libcrypto/arch/sh/opensslconf.h131
-rw-r--r--src/lib/libcrypto/arch/sparc64/opensslconf.h131
-rw-r--r--src/lib/libcrypto/asn1/a_bitstr.c4
-rw-r--r--src/lib/libcrypto/asn1/a_enum.c4
-rw-r--r--src/lib/libcrypto/asn1/a_int.c4
-rw-r--r--src/lib/libcrypto/asn1/a_mbstr.c4
-rw-r--r--src/lib/libcrypto/asn1/a_object.c4
-rw-r--r--src/lib/libcrypto/asn1/a_pkey.c4
-rw-r--r--src/lib/libcrypto/asn1/a_pubkey.c4
-rw-r--r--src/lib/libcrypto/asn1/a_strex.c30
-rw-r--r--src/lib/libcrypto/asn1/a_string.c4
-rw-r--r--src/lib/libcrypto/asn1/a_strnid.c3
-rw-r--r--src/lib/libcrypto/asn1/a_time.c3
-rw-r--r--src/lib/libcrypto/asn1/a_time_tm.c6
-rw-r--r--src/lib/libcrypto/asn1/a_type.c4
-rw-r--r--src/lib/libcrypto/asn1/asn1_gen.c4
-rw-r--r--src/lib/libcrypto/asn1/asn1_item.c4
-rw-r--r--src/lib/libcrypto/asn1/asn1_old.c4
-rw-r--r--src/lib/libcrypto/asn1/asn1_old_lib.c4
-rw-r--r--src/lib/libcrypto/asn1/asn_mime.c9
-rw-r--r--src/lib/libcrypto/asn1/asn_moid.c4
-rw-r--r--src/lib/libcrypto/asn1/bio_ndef.c4
-rw-r--r--src/lib/libcrypto/asn1/p5_pbe.c9
-rw-r--r--src/lib/libcrypto/asn1/p5_pbev2.c14
-rw-r--r--src/lib/libcrypto/asn1/t_crl.c4
-rw-r--r--src/lib/libcrypto/asn1/t_req.c4
-rw-r--r--src/lib/libcrypto/asn1/t_x509.c62
-rw-r--r--src/lib/libcrypto/asn1/tasn_dec.c4
-rw-r--r--src/lib/libcrypto/asn1/tasn_enc.c4
-rw-r--r--src/lib/libcrypto/asn1/tasn_new.c4
-rw-r--r--src/lib/libcrypto/asn1/tasn_prn.c5
-rw-r--r--src/lib/libcrypto/asn1/tasn_utl.c4
-rw-r--r--src/lib/libcrypto/asn1/x_crl.c10
-rw-r--r--src/lib/libcrypto/asn1/x_info.c96
-rw-r--r--src/lib/libcrypto/asn1/x_long.c4
-rw-r--r--src/lib/libcrypto/asn1/x_name.c8
-rw-r--r--src/lib/libcrypto/asn1/x_pkey.c123
-rw-r--r--src/lib/libcrypto/asn1/x_pubkey.c4
-rw-r--r--src/lib/libcrypto/bf/bf_local.h47
-rw-r--r--src/lib/libcrypto/bio/b_dump.c3
-rw-r--r--src/lib/libcrypto/bio/b_sock.c5
-rw-r--r--src/lib/libcrypto/bio/bf_buff.c4
-rw-r--r--src/lib/libcrypto/bio/bio.h27
-rw-r--r--src/lib/libcrypto/bio/bio_cb.c3
-rw-r--r--src/lib/libcrypto/bio/bio_lib.c4
-rw-r--r--src/lib/libcrypto/bio/bss_acpt.c13
-rw-r--r--src/lib/libcrypto/bio/bss_bio.c4
-rw-r--r--src/lib/libcrypto/bio/bss_conn.c6
-rw-r--r--src/lib/libcrypto/bio/bss_file.c4
-rw-r--r--src/lib/libcrypto/bio/bss_log.c216
-rw-r--r--src/lib/libcrypto/bio/bss_mem.c11
-rw-r--r--src/lib/libcrypto/bn/arch/amd64/bn_arch.c6
-rw-r--r--src/lib/libcrypto/bn/asm/bn-586.pl3
-rwxr-xr-xsrc/lib/libcrypto/bn/asm/x86-mont.pl3
-rw-r--r--src/lib/libcrypto/bn/bn_add.c76
-rw-r--r--src/lib/libcrypto/bn/bn_add_sub.c178
-rw-r--r--src/lib/libcrypto/bn/bn_convert.c4
-rw-r--r--src/lib/libcrypto/bn/bn_ctx.c4
-rw-r--r--src/lib/libcrypto/bn/bn_div.c4
-rw-r--r--src/lib/libcrypto/bn/bn_exp.c5
-rw-r--r--src/lib/libcrypto/bn/bn_gcd.c11
-rw-r--r--src/lib/libcrypto/bn/bn_internal.h26
-rw-r--r--src/lib/libcrypto/bn/bn_isqrt.c4
-rw-r--r--src/lib/libcrypto/bn/bn_lib.c5
-rw-r--r--src/lib/libcrypto/bn/bn_local.h12
-rw-r--r--src/lib/libcrypto/bn/bn_mod.c5
-rw-r--r--src/lib/libcrypto/bn/bn_mod_sqrt.c5
-rw-r--r--src/lib/libcrypto/bn/bn_mod_words.c114
-rw-r--r--src/lib/libcrypto/bn/bn_mont.c78
-rw-r--r--src/lib/libcrypto/bn/bn_mul.c71
-rw-r--r--src/lib/libcrypto/bn/bn_prime.c5
-rw-r--r--src/lib/libcrypto/bn/bn_rand.c5
-rw-r--r--src/lib/libcrypto/bn/bn_recp.c5
-rw-r--r--src/lib/libcrypto/bn/bn_shift.c4
-rw-r--r--src/lib/libcrypto/bn/bn_sqr.c47
-rw-r--r--src/lib/libcrypto/buffer/buffer.c5
-rw-r--r--src/lib/libcrypto/bytestring/bs_ber.c4
-rw-r--r--src/lib/libcrypto/cert.pem732
-rw-r--r--src/lib/libcrypto/cms/cms_dd.c4
-rw-r--r--src/lib/libcrypto/cms/cms_enc.c4
-rw-r--r--src/lib/libcrypto/cms/cms_env.c4
-rw-r--r--src/lib/libcrypto/cms/cms_ess.c4
-rw-r--r--src/lib/libcrypto/cms/cms_io.c4
-rw-r--r--src/lib/libcrypto/cms/cms_kari.c4
-rw-r--r--src/lib/libcrypto/cms/cms_lib.c4
-rw-r--r--src/lib/libcrypto/cms/cms_pwri.c4
-rw-r--r--src/lib/libcrypto/cms/cms_sd.c44
-rw-r--r--src/lib/libcrypto/cms/cms_smime.c4
-rw-r--r--src/lib/libcrypto/conf/README73
-rw-r--r--src/lib/libcrypto/conf/conf_def.c4
-rw-r--r--src/lib/libcrypto/conf/conf_lib.c4
-rw-r--r--src/lib/libcrypto/conf/conf_mod.c5
-rw-r--r--src/lib/libcrypto/crypto_ex_data.c15
-rw-r--r--src/lib/libcrypto/crypto_init.c30
-rw-r--r--src/lib/libcrypto/crypto_internal.h4
-rw-r--r--src/lib/libcrypto/crypto_legacy.c27
-rw-r--r--src/lib/libcrypto/crypto_local.h8
-rw-r--r--src/lib/libcrypto/ct/ct_b64.c4
-rw-r--r--src/lib/libcrypto/ct/ct_log.c4
-rw-r--r--src/lib/libcrypto/ct/ct_oct.c4
-rw-r--r--src/lib/libcrypto/ct/ct_policy.c7
-rw-r--r--src/lib/libcrypto/ct/ct_sct.c4
-rw-r--r--src/lib/libcrypto/ct/ct_sct_ctx.c4
-rw-r--r--src/lib/libcrypto/ct/ct_vfy.c4
-rw-r--r--src/lib/libcrypto/curve25519/curve25519.c243
-rw-r--r--src/lib/libcrypto/des/des.h15
-rw-r--r--src/lib/libcrypto/des/des_enc.c121
-rw-r--r--src/lib/libcrypto/des/des_fcrypt.c34
-rw-r--r--src/lib/libcrypto/des/des_local.h6
-rw-r--r--src/lib/libcrypto/dh/dh_ameth.c4
-rw-r--r--src/lib/libcrypto/dh/dh_check.c3
-rw-r--r--src/lib/libcrypto/dh/dh_gen.c4
-rw-r--r--src/lib/libcrypto/dh/dh_key.c4
-rw-r--r--src/lib/libcrypto/dh/dh_lib.c4
-rw-r--r--src/lib/libcrypto/dh/dh_pmeth.c4
-rw-r--r--src/lib/libcrypto/dsa/dsa_ameth.c4
-rw-r--r--src/lib/libcrypto/dsa/dsa_asn1.c4
-rw-r--r--src/lib/libcrypto/dsa/dsa_lib.c4
-rw-r--r--src/lib/libcrypto/dsa/dsa_meth.c4
-rw-r--r--src/lib/libcrypto/dsa/dsa_ossl.c4
-rw-r--r--src/lib/libcrypto/dsa/dsa_pmeth.c4
-rw-r--r--src/lib/libcrypto/dsa/dsa_prn.c5
-rw-r--r--src/lib/libcrypto/ec/ec_ameth.c4
-rw-r--r--src/lib/libcrypto/ec/ec_asn1.c4
-rw-r--r--src/lib/libcrypto/ec/ec_convert.c4
-rw-r--r--src/lib/libcrypto/ec/ec_curve.c316
-rw-r--r--src/lib/libcrypto/ec/ec_field.c202
-rw-r--r--src/lib/libcrypto/ec/ec_internal.h65
-rw-r--r--src/lib/libcrypto/ec/ec_key.c4
-rw-r--r--src/lib/libcrypto/ec/ec_lib.c34
-rw-r--r--src/lib/libcrypto/ec/ec_local.h26
-rw-r--r--src/lib/libcrypto/ec/ec_mult.c38
-rw-r--r--src/lib/libcrypto/ec/ec_pmeth.c4
-rw-r--r--src/lib/libcrypto/ec/eck_prn.c4
-rw-r--r--src/lib/libcrypto/ec/ecp_hp_methods.c943
-rw-r--r--src/lib/libcrypto/ec/ecp_methods.c30
-rw-r--r--src/lib/libcrypto/ec/ecx_methods.c4
-rw-r--r--src/lib/libcrypto/ecdh/ecdh.c4
-rw-r--r--src/lib/libcrypto/ecdsa/ecdsa.c4
-rw-r--r--src/lib/libcrypto/err/err.c34
-rw-r--r--src/lib/libcrypto/err/err.h79
-rw-r--r--src/lib/libcrypto/err/err_local.h30
-rw-r--r--src/lib/libcrypto/evp/e_aes.c1169
-rw-r--r--src/lib/libcrypto/evp/e_bf.c30
-rw-r--r--src/lib/libcrypto/evp/e_camellia.c112
-rw-r--r--src/lib/libcrypto/evp/e_cast.c30
-rw-r--r--src/lib/libcrypto/evp/e_chacha20poly1305.c4
-rw-r--r--src/lib/libcrypto/evp/e_des.c44
-rw-r--r--src/lib/libcrypto/evp/e_des3.c69
-rw-r--r--src/lib/libcrypto/evp/e_idea.c26
-rw-r--r--src/lib/libcrypto/evp/e_rc2.c4
-rw-r--r--src/lib/libcrypto/evp/e_xcbc_d.c8
-rw-r--r--src/lib/libcrypto/evp/evp.h30
-rw-r--r--src/lib/libcrypto/evp/evp_aead.c4
-rw-r--r--src/lib/libcrypto/evp/evp_cipher.c46
-rw-r--r--src/lib/libcrypto/evp/evp_digest.c4
-rw-r--r--src/lib/libcrypto/evp/evp_key.c4
-rw-r--r--src/lib/libcrypto/evp/evp_local.h4
-rw-r--r--src/lib/libcrypto/evp/evp_names.c3
-rw-r--r--src/lib/libcrypto/evp/evp_pbe.c4
-rw-r--r--src/lib/libcrypto/evp/evp_pkey.c4
-rw-r--r--src/lib/libcrypto/evp/m_sigver.c4
-rw-r--r--src/lib/libcrypto/evp/p_legacy.c4
-rw-r--r--src/lib/libcrypto/evp/p_lib.c20
-rw-r--r--src/lib/libcrypto/evp/p_sign.c3
-rw-r--r--src/lib/libcrypto/evp/p_verify.c3
-rw-r--r--src/lib/libcrypto/evp/pmeth_fn.c4
-rw-r--r--src/lib/libcrypto/evp/pmeth_gn.c4
-rw-r--r--src/lib/libcrypto/evp/pmeth_lib.c4
-rw-r--r--src/lib/libcrypto/format-pem.pl3
-rw-r--r--src/lib/libcrypto/hidden/openssl/bio.h3
-rw-r--r--src/lib/libcrypto/hidden/openssl/pem.h4
-rw-r--r--src/lib/libcrypto/hidden/openssl/x509.h4
-rw-r--r--src/lib/libcrypto/hkdf/hkdf.c4
-rw-r--r--src/lib/libcrypto/hmac/hmac.c4
-rw-r--r--src/lib/libcrypto/idea/idea.h9
-rw-r--r--src/lib/libcrypto/kdf/hkdf_evp.c8
-rw-r--r--src/lib/libcrypto/kdf/tls1_prf.c7
-rw-r--r--src/lib/libcrypto/lhash/lhash.c8
-rw-r--r--src/lib/libcrypto/man/ACCESS_DESCRIPTION_new.35
-rw-r--r--src/lib/libcrypto/man/AES_encrypt.35
-rw-r--r--src/lib/libcrypto/man/ASIdentifiers_new.35
-rw-r--r--src/lib/libcrypto/man/ASN1_BIT_STRING_set.35
-rw-r--r--src/lib/libcrypto/man/ASN1_INTEGER_get.35
-rw-r--r--src/lib/libcrypto/man/ASN1_NULL_new.35
-rw-r--r--src/lib/libcrypto/man/ASN1_OBJECT_new.35
-rw-r--r--src/lib/libcrypto/man/ASN1_PRINTABLE_type.35
-rw-r--r--src/lib/libcrypto/man/ASN1_STRING_TABLE_get.38
-rw-r--r--src/lib/libcrypto/man/ASN1_STRING_length.37
-rw-r--r--src/lib/libcrypto/man/ASN1_STRING_new.37
-rw-r--r--src/lib/libcrypto/man/ASN1_STRING_print_ex.36
-rw-r--r--src/lib/libcrypto/man/ASN1_TIME_set.35
-rw-r--r--src/lib/libcrypto/man/ASN1_TYPE_get.35
-rw-r--r--src/lib/libcrypto/man/ASN1_UNIVERSALSTRING_to_string.35
-rw-r--r--src/lib/libcrypto/man/ASN1_generate_nconf.35
-rw-r--r--src/lib/libcrypto/man/ASN1_get_object.35
-rw-r--r--src/lib/libcrypto/man/ASN1_item_d2i.35
-rw-r--r--src/lib/libcrypto/man/ASN1_item_digest.35
-rw-r--r--src/lib/libcrypto/man/ASN1_item_new.35
-rw-r--r--src/lib/libcrypto/man/ASN1_item_pack.35
-rw-r--r--src/lib/libcrypto/man/ASN1_item_sign.35
-rw-r--r--src/lib/libcrypto/man/ASN1_item_verify.35
-rw-r--r--src/lib/libcrypto/man/ASN1_mbstring_copy.35
-rw-r--r--src/lib/libcrypto/man/ASN1_parse_dump.35
-rw-r--r--src/lib/libcrypto/man/ASN1_put_object.35
-rw-r--r--src/lib/libcrypto/man/ASRange_new.311
-rw-r--r--src/lib/libcrypto/man/AUTHORITY_KEYID_new.35
-rw-r--r--src/lib/libcrypto/man/BASIC_CONSTRAINTS_new.35
-rw-r--r--src/lib/libcrypto/man/BF_set_key.35
-rw-r--r--src/lib/libcrypto/man/BIO_accept.35
-rw-r--r--src/lib/libcrypto/man/BIO_ctrl.35
-rw-r--r--src/lib/libcrypto/man/BIO_dump.339
-rw-r--r--src/lib/libcrypto/man/BIO_dup_chain.35
-rw-r--r--src/lib/libcrypto/man/BIO_f_base64.35
-rw-r--r--src/lib/libcrypto/man/BIO_f_buffer.35
-rw-r--r--src/lib/libcrypto/man/BIO_f_cipher.35
-rw-r--r--src/lib/libcrypto/man/BIO_f_md.35
-rw-r--r--src/lib/libcrypto/man/BIO_f_null.35
-rw-r--r--src/lib/libcrypto/man/BIO_find_type.35
-rw-r--r--src/lib/libcrypto/man/BIO_get_data.35
-rw-r--r--src/lib/libcrypto/man/BIO_get_ex_new_index.35
-rw-r--r--src/lib/libcrypto/man/BIO_meth_new.35
-rw-r--r--src/lib/libcrypto/man/BIO_new.35
-rw-r--r--src/lib/libcrypto/man/BIO_new_CMS.35
-rw-r--r--src/lib/libcrypto/man/BIO_printf.35
-rw-r--r--src/lib/libcrypto/man/BIO_push.35
-rw-r--r--src/lib/libcrypto/man/BIO_read.35
-rw-r--r--src/lib/libcrypto/man/BIO_s_accept.35
-rw-r--r--src/lib/libcrypto/man/BIO_s_bio.35
-rw-r--r--src/lib/libcrypto/man/BIO_s_connect.35
-rw-r--r--src/lib/libcrypto/man/BIO_s_datagram.35
-rw-r--r--src/lib/libcrypto/man/BIO_s_fd.35
-rw-r--r--src/lib/libcrypto/man/BIO_s_file.35
-rw-r--r--src/lib/libcrypto/man/BIO_s_mem.35
-rw-r--r--src/lib/libcrypto/man/BIO_s_null.36
-rw-r--r--src/lib/libcrypto/man/BIO_s_socket.35
-rw-r--r--src/lib/libcrypto/man/BIO_set_callback.35
-rw-r--r--src/lib/libcrypto/man/BIO_should_retry.35
-rw-r--r--src/lib/libcrypto/man/BN_CTX_new.35
-rw-r--r--src/lib/libcrypto/man/BN_CTX_start.35
-rw-r--r--src/lib/libcrypto/man/BN_add.38
-rw-r--r--src/lib/libcrypto/man/BN_add_word.35
-rw-r--r--src/lib/libcrypto/man/BN_bn2bin.35
-rw-r--r--src/lib/libcrypto/man/BN_cmp.35
-rw-r--r--src/lib/libcrypto/man/BN_copy.35
-rw-r--r--src/lib/libcrypto/man/BN_generate_prime.35
-rw-r--r--src/lib/libcrypto/man/BN_get_rfc3526_prime_8192.35
-rw-r--r--src/lib/libcrypto/man/BN_kronecker.35
-rw-r--r--src/lib/libcrypto/man/BN_mod_inverse.35
-rw-r--r--src/lib/libcrypto/man/BN_mod_mul_montgomery.35
-rw-r--r--src/lib/libcrypto/man/BN_mod_sqrt.35
-rw-r--r--src/lib/libcrypto/man/BN_new.37
-rw-r--r--src/lib/libcrypto/man/BN_num_bytes.35
-rw-r--r--src/lib/libcrypto/man/BN_rand.35
-rw-r--r--src/lib/libcrypto/man/BN_set_bit.35
-rw-r--r--src/lib/libcrypto/man/BN_set_flags.35
-rw-r--r--src/lib/libcrypto/man/BN_set_negative.35
-rw-r--r--src/lib/libcrypto/man/BN_swap.35
-rw-r--r--src/lib/libcrypto/man/BN_zero.310
-rw-r--r--src/lib/libcrypto/man/BUF_MEM_new.35
-rw-r--r--src/lib/libcrypto/man/CMAC_Init.35
-rw-r--r--src/lib/libcrypto/man/CMS_ContentInfo_new.35
-rw-r--r--src/lib/libcrypto/man/CMS_add0_cert.35
-rw-r--r--src/lib/libcrypto/man/CMS_add1_recipient_cert.35
-rw-r--r--src/lib/libcrypto/man/CMS_add1_signer.35
-rw-r--r--src/lib/libcrypto/man/CMS_compress.35
-rw-r--r--src/lib/libcrypto/man/CMS_decrypt.35
-rw-r--r--src/lib/libcrypto/man/CMS_encrypt.35
-rw-r--r--src/lib/libcrypto/man/CMS_final.35
-rw-r--r--src/lib/libcrypto/man/CMS_get0_RecipientInfos.35
-rw-r--r--src/lib/libcrypto/man/CMS_get0_SignerInfos.35
-rw-r--r--src/lib/libcrypto/man/CMS_get0_type.35
-rw-r--r--src/lib/libcrypto/man/CMS_get1_ReceiptRequest.35
-rw-r--r--src/lib/libcrypto/man/CMS_sign.37
-rw-r--r--src/lib/libcrypto/man/CMS_sign_receipt.35
-rw-r--r--src/lib/libcrypto/man/CMS_signed_add1_attr.317
-rw-r--r--src/lib/libcrypto/man/CMS_uncompress.35
-rw-r--r--src/lib/libcrypto/man/CMS_verify.35
-rw-r--r--src/lib/libcrypto/man/CMS_verify_receipt.35
-rw-r--r--src/lib/libcrypto/man/CONF_modules_free.35
-rw-r--r--src/lib/libcrypto/man/CONF_modules_load_file.315
-rw-r--r--src/lib/libcrypto/man/CRYPTO_lock.35
-rw-r--r--src/lib/libcrypto/man/CRYPTO_memcmp.35
-rw-r--r--src/lib/libcrypto/man/CRYPTO_set_ex_data.35
-rw-r--r--src/lib/libcrypto/man/CRYPTO_set_mem_functions.35
-rw-r--r--src/lib/libcrypto/man/ChaCha.35
-rw-r--r--src/lib/libcrypto/man/DES_set_key.35
-rw-r--r--src/lib/libcrypto/man/DH_generate_key.35
-rw-r--r--src/lib/libcrypto/man/DH_generate_parameters.35
-rw-r--r--src/lib/libcrypto/man/DH_get0_pqg.315
-rw-r--r--src/lib/libcrypto/man/DH_get_ex_new_index.35
-rw-r--r--src/lib/libcrypto/man/DH_new.35
-rw-r--r--src/lib/libcrypto/man/DH_set_method.35
-rw-r--r--src/lib/libcrypto/man/DH_size.35
-rw-r--r--src/lib/libcrypto/man/DIST_POINT_new.35
-rw-r--r--src/lib/libcrypto/man/DSA_SIG_new.35
-rw-r--r--src/lib/libcrypto/man/DSA_do_sign.35
-rw-r--r--src/lib/libcrypto/man/DSA_dup_DH.35
-rw-r--r--src/lib/libcrypto/man/DSA_generate_key.35
-rw-r--r--src/lib/libcrypto/man/DSA_generate_parameters_ex.37
-rw-r--r--src/lib/libcrypto/man/DSA_get0_pqg.315
-rw-r--r--src/lib/libcrypto/man/DSA_get_ex_new_index.35
-rw-r--r--src/lib/libcrypto/man/DSA_meth_new.35
-rw-r--r--src/lib/libcrypto/man/DSA_new.35
-rw-r--r--src/lib/libcrypto/man/DSA_set_method.35
-rw-r--r--src/lib/libcrypto/man/DSA_sign.35
-rw-r--r--src/lib/libcrypto/man/DSA_size.35
-rw-r--r--src/lib/libcrypto/man/ECDH_compute_key.37
-rw-r--r--src/lib/libcrypto/man/ECDSA_SIG_new.317
-rw-r--r--src/lib/libcrypto/man/EC_GROUP_check.3160
-rw-r--r--src/lib/libcrypto/man/EC_GROUP_copy.3492
-rw-r--r--src/lib/libcrypto/man/EC_GROUP_get_curve_name.3266
-rw-r--r--src/lib/libcrypto/man/EC_GROUP_new.3353
-rw-r--r--src/lib/libcrypto/man/EC_GROUP_new_by_curve_name.3311
-rw-r--r--src/lib/libcrypto/man/EC_GROUP_new_curve_GFp.3458
-rw-r--r--src/lib/libcrypto/man/EC_KEY_METHOD_new.314
-rw-r--r--src/lib/libcrypto/man/EC_KEY_new.322
-rw-r--r--src/lib/libcrypto/man/EC_POINT_add.319
-rw-r--r--src/lib/libcrypto/man/EC_POINT_get_affine_coordinates.3216
-rw-r--r--src/lib/libcrypto/man/EC_POINT_new.3497
-rw-r--r--src/lib/libcrypto/man/EC_POINT_point2oct.3434
-rw-r--r--src/lib/libcrypto/man/ENGINE_new.35
-rw-r--r--src/lib/libcrypto/man/ERR.35
-rw-r--r--src/lib/libcrypto/man/ERR_GET_LIB.35
-rw-r--r--src/lib/libcrypto/man/ERR_asprintf_error_data.35
-rw-r--r--src/lib/libcrypto/man/ERR_clear_error.35
-rw-r--r--src/lib/libcrypto/man/ERR_error_string.35
-rw-r--r--src/lib/libcrypto/man/ERR_get_error.35
-rw-r--r--src/lib/libcrypto/man/ERR_load_crypto_strings.37
-rw-r--r--src/lib/libcrypto/man/ERR_load_strings.35
-rw-r--r--src/lib/libcrypto/man/ERR_print_errors.35
-rw-r--r--src/lib/libcrypto/man/ERR_put_error.35
-rw-r--r--src/lib/libcrypto/man/ERR_remove_state.35
-rw-r--r--src/lib/libcrypto/man/ERR_set_mark.35
-rw-r--r--src/lib/libcrypto/man/ESS_SIGNING_CERT_new.35
-rw-r--r--src/lib/libcrypto/man/EVP_AEAD_CTX_init.35
-rw-r--r--src/lib/libcrypto/man/EVP_BytesToKey.35
-rw-r--r--src/lib/libcrypto/man/EVP_CIPHER_CTX_ctrl.314
-rw-r--r--src/lib/libcrypto/man/EVP_CIPHER_CTX_get_cipher_data.35
-rw-r--r--src/lib/libcrypto/man/EVP_CIPHER_CTX_init.35
-rw-r--r--src/lib/libcrypto/man/EVP_CIPHER_CTX_set_flags.35
-rw-r--r--src/lib/libcrypto/man/EVP_CIPHER_do_all.35
-rw-r--r--src/lib/libcrypto/man/EVP_CIPHER_meth_new.35
-rw-r--r--src/lib/libcrypto/man/EVP_CIPHER_nid.35
-rw-r--r--src/lib/libcrypto/man/EVP_DigestInit.312
-rw-r--r--src/lib/libcrypto/man/EVP_DigestSignInit.35
-rw-r--r--src/lib/libcrypto/man/EVP_DigestVerifyInit.35
-rw-r--r--src/lib/libcrypto/man/EVP_EncodeInit.35
-rw-r--r--src/lib/libcrypto/man/EVP_EncryptInit.35
-rw-r--r--src/lib/libcrypto/man/EVP_MD_CTX_ctrl.39
-rw-r--r--src/lib/libcrypto/man/EVP_MD_nid.35
-rw-r--r--src/lib/libcrypto/man/EVP_OpenInit.35
-rw-r--r--src/lib/libcrypto/man/EVP_PKCS82PKEY.35
-rw-r--r--src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.37
-rw-r--r--src/lib/libcrypto/man/EVP_PKEY_CTX_get_operation.35
-rw-r--r--src/lib/libcrypto/man/EVP_PKEY_CTX_new.35
-rw-r--r--src/lib/libcrypto/man/EVP_PKEY_CTX_set_hkdf_md.35
-rw-r--r--src/lib/libcrypto/man/EVP_PKEY_CTX_set_tls1_prf_md.37
-rw-r--r--src/lib/libcrypto/man/EVP_PKEY_asn1_get_count.35
-rw-r--r--src/lib/libcrypto/man/EVP_PKEY_cmp.35
-rw-r--r--src/lib/libcrypto/man/EVP_PKEY_decrypt.35
-rw-r--r--src/lib/libcrypto/man/EVP_PKEY_derive.35
-rw-r--r--src/lib/libcrypto/man/EVP_PKEY_encrypt.35
-rw-r--r--src/lib/libcrypto/man/EVP_PKEY_get_default_digest_nid.35
-rw-r--r--src/lib/libcrypto/man/EVP_PKEY_keygen.35
-rw-r--r--src/lib/libcrypto/man/EVP_PKEY_new.35
-rw-r--r--src/lib/libcrypto/man/EVP_PKEY_new_CMAC_key.35
-rw-r--r--src/lib/libcrypto/man/EVP_PKEY_print_private.35
-rw-r--r--src/lib/libcrypto/man/EVP_PKEY_set1_RSA.325
-rw-r--r--src/lib/libcrypto/man/EVP_PKEY_sign.37
-rw-r--r--src/lib/libcrypto/man/EVP_PKEY_size.35
-rw-r--r--src/lib/libcrypto/man/EVP_PKEY_verify.37
-rw-r--r--src/lib/libcrypto/man/EVP_PKEY_verify_recover.37
-rw-r--r--src/lib/libcrypto/man/EVP_SealInit.35
-rw-r--r--src/lib/libcrypto/man/EVP_SignInit.35
-rw-r--r--src/lib/libcrypto/man/EVP_VerifyInit.35
-rw-r--r--src/lib/libcrypto/man/EVP_aes_128_cbc.35
-rw-r--r--src/lib/libcrypto/man/EVP_aes_128_ccm.35
-rw-r--r--src/lib/libcrypto/man/EVP_aes_128_gcm.35
-rw-r--r--src/lib/libcrypto/man/EVP_camellia_128_cbc.35
-rw-r--r--src/lib/libcrypto/man/EVP_chacha20.35
-rw-r--r--src/lib/libcrypto/man/EVP_des_cbc.35
-rw-r--r--src/lib/libcrypto/man/EVP_rc2_cbc.35
-rw-r--r--src/lib/libcrypto/man/EVP_rc4.35
-rw-r--r--src/lib/libcrypto/man/EVP_sha1.35
-rw-r--r--src/lib/libcrypto/man/EVP_sha3_224.35
-rw-r--r--src/lib/libcrypto/man/EVP_sm3.35
-rw-r--r--src/lib/libcrypto/man/EVP_sm4_cbc.35
-rw-r--r--src/lib/libcrypto/man/EXTENDED_KEY_USAGE_new.35
-rw-r--r--src/lib/libcrypto/man/GENERAL_NAME_new.35
-rw-r--r--src/lib/libcrypto/man/HMAC.35
-rw-r--r--src/lib/libcrypto/man/IPAddressRange_new.313
-rw-r--r--src/lib/libcrypto/man/MD5.35
-rw-r--r--src/lib/libcrypto/man/Makefile17
-rw-r--r--src/lib/libcrypto/man/NAME_CONSTRAINTS_new.35
-rw-r--r--src/lib/libcrypto/man/OBJ_NAME_add.3307
-rw-r--r--src/lib/libcrypto/man/OBJ_create.36
-rw-r--r--src/lib/libcrypto/man/OBJ_find_sigid_algs.36
-rw-r--r--src/lib/libcrypto/man/OBJ_nid2obj.35
-rw-r--r--src/lib/libcrypto/man/OCSP_CRLID_new.35
-rw-r--r--src/lib/libcrypto/man/OCSP_REQUEST_new.35
-rw-r--r--src/lib/libcrypto/man/OCSP_SERVICELOC_new.35
-rw-r--r--src/lib/libcrypto/man/OCSP_cert_to_id.37
-rw-r--r--src/lib/libcrypto/man/OCSP_request_add1_nonce.35
-rw-r--r--src/lib/libcrypto/man/OCSP_resp_find_status.35
-rw-r--r--src/lib/libcrypto/man/OCSP_response_status.35
-rw-r--r--src/lib/libcrypto/man/OCSP_sendreq_new.35
-rw-r--r--src/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.35
-rw-r--r--src/lib/libcrypto/man/OPENSSL_cleanse.35
-rw-r--r--src/lib/libcrypto/man/OPENSSL_config.312
-rw-r--r--src/lib/libcrypto/man/OPENSSL_init_crypto.311
-rw-r--r--src/lib/libcrypto/man/OPENSSL_load_builtin_modules.3101
-rw-r--r--src/lib/libcrypto/man/OPENSSL_malloc.35
-rw-r--r--src/lib/libcrypto/man/OPENSSL_sk_new.35
-rw-r--r--src/lib/libcrypto/man/OpenSSL_add_all_algorithms.369
-rw-r--r--src/lib/libcrypto/man/PEM_ASN1_read.37
-rw-r--r--src/lib/libcrypto/man/PEM_X509_INFO_read_bio.3 (renamed from src/lib/libcrypto/man/PEM_X509_INFO_read.3)44
-rw-r--r--src/lib/libcrypto/man/PEM_bytes_read_bio.37
-rw-r--r--src/lib/libcrypto/man/PEM_read.37
-rw-r--r--src/lib/libcrypto/man/PEM_read_bio_PrivateKey.37
-rw-r--r--src/lib/libcrypto/man/PEM_write_bio_CMS_stream.35
-rw-r--r--src/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.35
-rw-r--r--src/lib/libcrypto/man/PKCS12_SAFEBAG_new.35
-rw-r--r--src/lib/libcrypto/man/PKCS12_create.35
-rw-r--r--src/lib/libcrypto/man/PKCS12_new.35
-rw-r--r--src/lib/libcrypto/man/PKCS12_newpass.35
-rw-r--r--src/lib/libcrypto/man/PKCS12_parse.35
-rw-r--r--src/lib/libcrypto/man/PKCS5_PBKDF2_HMAC.35
-rw-r--r--src/lib/libcrypto/man/PKCS7_add_attribute.311
-rw-r--r--src/lib/libcrypto/man/PKCS7_dataFinal.35
-rw-r--r--src/lib/libcrypto/man/PKCS7_dataInit.35
-rw-r--r--src/lib/libcrypto/man/PKCS7_decrypt.35
-rw-r--r--src/lib/libcrypto/man/PKCS7_encrypt.35
-rw-r--r--src/lib/libcrypto/man/PKCS7_final.35
-rw-r--r--src/lib/libcrypto/man/PKCS7_get_signer_info.35
-rw-r--r--src/lib/libcrypto/man/PKCS7_new.35
-rw-r--r--src/lib/libcrypto/man/PKCS7_set_content.35
-rw-r--r--src/lib/libcrypto/man/PKCS7_set_type.35
-rw-r--r--src/lib/libcrypto/man/PKCS7_sign.35
-rw-r--r--src/lib/libcrypto/man/PKCS7_sign_add_signer.35
-rw-r--r--src/lib/libcrypto/man/PKCS7_verify.35
-rw-r--r--src/lib/libcrypto/man/PKCS8_PRIV_KEY_INFO_new.35
-rw-r--r--src/lib/libcrypto/man/PKCS8_pkey_set0.35
-rw-r--r--src/lib/libcrypto/man/PKEY_USAGE_PERIOD_new.35
-rw-r--r--src/lib/libcrypto/man/POLICYINFO_new.35
-rw-r--r--src/lib/libcrypto/man/RAND_add.35
-rw-r--r--src/lib/libcrypto/man/RAND_bytes.35
-rw-r--r--src/lib/libcrypto/man/RAND_load_file.35
-rw-r--r--src/lib/libcrypto/man/RAND_set_rand_method.35
-rw-r--r--src/lib/libcrypto/man/RC2_encrypt.35
-rw-r--r--src/lib/libcrypto/man/RC4.35
-rw-r--r--src/lib/libcrypto/man/RIPEMD160.35
-rw-r--r--src/lib/libcrypto/man/RSA_PSS_PARAMS_new.35
-rw-r--r--src/lib/libcrypto/man/RSA_blinding_on.35
-rw-r--r--src/lib/libcrypto/man/RSA_check_key.35
-rw-r--r--src/lib/libcrypto/man/RSA_generate_key.35
-rw-r--r--src/lib/libcrypto/man/RSA_get0_key.321
-rw-r--r--src/lib/libcrypto/man/RSA_get_ex_new_index.35
-rw-r--r--src/lib/libcrypto/man/RSA_meth_new.35
-rw-r--r--src/lib/libcrypto/man/RSA_new.35
-rw-r--r--src/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.35
-rw-r--r--src/lib/libcrypto/man/RSA_pkey_ctx_ctrl.35
-rw-r--r--src/lib/libcrypto/man/RSA_print.35
-rw-r--r--src/lib/libcrypto/man/RSA_private_encrypt.35
-rw-r--r--src/lib/libcrypto/man/RSA_public_encrypt.35
-rw-r--r--src/lib/libcrypto/man/RSA_security_bits.35
-rw-r--r--src/lib/libcrypto/man/RSA_set_method.35
-rw-r--r--src/lib/libcrypto/man/RSA_sign.37
-rw-r--r--src/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.35
-rw-r--r--src/lib/libcrypto/man/RSA_size.35
-rw-r--r--src/lib/libcrypto/man/SHA1.35
-rw-r--r--src/lib/libcrypto/man/SMIME_crlf_copy.39
-rw-r--r--src/lib/libcrypto/man/SMIME_read_ASN1.3124
-rw-r--r--src/lib/libcrypto/man/SMIME_read_CMS.310
-rw-r--r--src/lib/libcrypto/man/SMIME_read_PKCS7.310
-rw-r--r--src/lib/libcrypto/man/SMIME_text.310
-rw-r--r--src/lib/libcrypto/man/SMIME_write_ASN1.3163
-rw-r--r--src/lib/libcrypto/man/SMIME_write_CMS.3124
-rw-r--r--src/lib/libcrypto/man/SMIME_write_PKCS7.3152
-rw-r--r--src/lib/libcrypto/man/STACK_OF.35
-rw-r--r--src/lib/libcrypto/man/TS_REQ_new.35
-rw-r--r--src/lib/libcrypto/man/UI_create_method.35
-rw-r--r--src/lib/libcrypto/man/UI_get_string_type.35
-rw-r--r--src/lib/libcrypto/man/UI_new.35
-rw-r--r--src/lib/libcrypto/man/X25519.35
-rw-r--r--src/lib/libcrypto/man/X509V3_EXT_get_nid.35
-rw-r--r--src/lib/libcrypto/man/X509V3_EXT_print.35
-rw-r--r--src/lib/libcrypto/man/X509V3_extensions_print.35
-rw-r--r--src/lib/libcrypto/man/X509V3_get_d2i.35
-rw-r--r--src/lib/libcrypto/man/X509V3_parse_list.35
-rw-r--r--src/lib/libcrypto/man/X509_ALGOR_dup.35
-rw-r--r--src/lib/libcrypto/man/X509_ATTRIBUTE_get0_object.35
-rw-r--r--src/lib/libcrypto/man/X509_ATTRIBUTE_new.35
-rw-r--r--src/lib/libcrypto/man/X509_ATTRIBUTE_set1_object.35
-rw-r--r--src/lib/libcrypto/man/X509_CINF_new.35
-rw-r--r--src/lib/libcrypto/man/X509_CRL_get0_by_serial.35
-rw-r--r--src/lib/libcrypto/man/X509_CRL_new.35
-rw-r--r--src/lib/libcrypto/man/X509_CRL_print.35
-rw-r--r--src/lib/libcrypto/man/X509_EXTENSION_set_object.35
-rw-r--r--src/lib/libcrypto/man/X509_INFO_new.310
-rw-r--r--src/lib/libcrypto/man/X509_LOOKUP_hash_dir.35
-rw-r--r--src/lib/libcrypto/man/X509_LOOKUP_new.35
-rw-r--r--src/lib/libcrypto/man/X509_NAME_ENTRY_get_object.35
-rw-r--r--src/lib/libcrypto/man/X509_NAME_add_entry_by_txt.35
-rw-r--r--src/lib/libcrypto/man/X509_NAME_get_index_by_NID.35
-rw-r--r--src/lib/libcrypto/man/X509_NAME_hash.37
-rw-r--r--src/lib/libcrypto/man/X509_NAME_new.35
-rw-r--r--src/lib/libcrypto/man/X509_NAME_print_ex.35
-rw-r--r--src/lib/libcrypto/man/X509_OBJECT_get0_X509.35
-rw-r--r--src/lib/libcrypto/man/X509_PKEY_new.392
-rw-r--r--src/lib/libcrypto/man/X509_PUBKEY_new.35
-rw-r--r--src/lib/libcrypto/man/X509_PURPOSE_set.35
-rw-r--r--src/lib/libcrypto/man/X509_REQ_add1_attr.35
-rw-r--r--src/lib/libcrypto/man/X509_REQ_add_extensions.35
-rw-r--r--src/lib/libcrypto/man/X509_REQ_new.35
-rw-r--r--src/lib/libcrypto/man/X509_REQ_print_ex.36
-rw-r--r--src/lib/libcrypto/man/X509_REVOKED_new.35
-rw-r--r--src/lib/libcrypto/man/X509_SIG_get0.35
-rw-r--r--src/lib/libcrypto/man/X509_SIG_new.35
-rw-r--r--src/lib/libcrypto/man/X509_STORE_CTX_get_error.35
-rw-r--r--src/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.35
-rw-r--r--src/lib/libcrypto/man/X509_STORE_CTX_new.35
-rw-r--r--src/lib/libcrypto/man/X509_STORE_CTX_set_flags.37
-rw-r--r--src/lib/libcrypto/man/X509_STORE_CTX_set_verify.35
-rw-r--r--src/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.35
-rw-r--r--src/lib/libcrypto/man/X509_STORE_get_by_subject.35
-rw-r--r--src/lib/libcrypto/man/X509_STORE_load_locations.35
-rw-r--r--src/lib/libcrypto/man/X509_STORE_new.35
-rw-r--r--src/lib/libcrypto/man/X509_STORE_set1_param.35
-rw-r--r--src/lib/libcrypto/man/X509_STORE_set_verify_cb_func.35
-rw-r--r--src/lib/libcrypto/man/X509_VERIFY_PARAM_new.35
-rw-r--r--src/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.35
-rw-r--r--src/lib/libcrypto/man/X509_add1_trust_object.35
-rw-r--r--src/lib/libcrypto/man/X509_check_ca.35
-rw-r--r--src/lib/libcrypto/man/X509_check_host.35
-rw-r--r--src/lib/libcrypto/man/X509_check_issued.35
-rw-r--r--src/lib/libcrypto/man/X509_check_private_key.35
-rw-r--r--src/lib/libcrypto/man/X509_check_purpose.35
-rw-r--r--src/lib/libcrypto/man/X509_cmp.38
-rw-r--r--src/lib/libcrypto/man/X509_cmp_time.35
-rw-r--r--src/lib/libcrypto/man/X509_digest.35
-rw-r--r--src/lib/libcrypto/man/X509_find_by_subject.35
-rw-r--r--src/lib/libcrypto/man/X509_get0_notBefore.35
-rw-r--r--src/lib/libcrypto/man/X509_get0_signature.318
-rw-r--r--src/lib/libcrypto/man/X509_get1_email.35
-rw-r--r--src/lib/libcrypto/man/X509_get_extension_flags.39
-rw-r--r--src/lib/libcrypto/man/X509_get_pubkey.35
-rw-r--r--src/lib/libcrypto/man/X509_get_pubkey_parameters.35
-rw-r--r--src/lib/libcrypto/man/X509_get_serialNumber.35
-rw-r--r--src/lib/libcrypto/man/X509_get_subject_name.35
-rw-r--r--src/lib/libcrypto/man/X509_get_version.35
-rw-r--r--src/lib/libcrypto/man/X509_keyid_set1.35
-rw-r--r--src/lib/libcrypto/man/X509_load_cert_file.35
-rw-r--r--src/lib/libcrypto/man/X509_new.36
-rw-r--r--src/lib/libcrypto/man/X509_ocspid_print.35
-rw-r--r--src/lib/libcrypto/man/X509_print_ex.310
-rw-r--r--src/lib/libcrypto/man/X509_sign.317
-rw-r--r--src/lib/libcrypto/man/X509_signature_dump.35
-rw-r--r--src/lib/libcrypto/man/X509_verify_cert.35
-rw-r--r--src/lib/libcrypto/man/X509v3_addr_add_inherit.35
-rw-r--r--src/lib/libcrypto/man/X509v3_addr_get_range.35
-rw-r--r--src/lib/libcrypto/man/X509v3_addr_inherits.35
-rw-r--r--src/lib/libcrypto/man/X509v3_addr_subset.35
-rw-r--r--src/lib/libcrypto/man/X509v3_addr_validate_path.35
-rw-r--r--src/lib/libcrypto/man/X509v3_asid_add_id_or_range.35
-rw-r--r--src/lib/libcrypto/man/X509v3_get_ext_by_NID.35
-rw-r--r--src/lib/libcrypto/man/a2d_ASN1_OBJECT.35
-rw-r--r--src/lib/libcrypto/man/a2i_ipadd.35
-rw-r--r--src/lib/libcrypto/man/crypto.36
-rw-r--r--src/lib/libcrypto/man/d2i_ASN1_NULL.35
-rw-r--r--src/lib/libcrypto/man/d2i_ASN1_OBJECT.35
-rw-r--r--src/lib/libcrypto/man/d2i_ASN1_OCTET_STRING.35
-rw-r--r--src/lib/libcrypto/man/d2i_ASN1_SEQUENCE_ANY.35
-rw-r--r--src/lib/libcrypto/man/d2i_AUTHORITY_KEYID.35
-rw-r--r--src/lib/libcrypto/man/d2i_BASIC_CONSTRAINTS.35
-rw-r--r--src/lib/libcrypto/man/d2i_CMS_ContentInfo.35
-rw-r--r--src/lib/libcrypto/man/d2i_DHparams.35
-rw-r--r--src/lib/libcrypto/man/d2i_DIST_POINT.35
-rw-r--r--src/lib/libcrypto/man/d2i_DSAPublicKey.35
-rw-r--r--src/lib/libcrypto/man/d2i_ECPKParameters.38
-rw-r--r--src/lib/libcrypto/man/d2i_ESS_SIGNING_CERT.35
-rw-r--r--src/lib/libcrypto/man/d2i_GENERAL_NAME.35
-rw-r--r--src/lib/libcrypto/man/d2i_OCSP_REQUEST.35
-rw-r--r--src/lib/libcrypto/man/d2i_OCSP_RESPONSE.35
-rw-r--r--src/lib/libcrypto/man/d2i_PKCS12.35
-rw-r--r--src/lib/libcrypto/man/d2i_PKCS7.35
-rw-r--r--src/lib/libcrypto/man/d2i_PKCS8PrivateKey_bio.35
-rw-r--r--src/lib/libcrypto/man/d2i_PKCS8_PRIV_KEY_INFO.35
-rw-r--r--src/lib/libcrypto/man/d2i_PKEY_USAGE_PERIOD.35
-rw-r--r--src/lib/libcrypto/man/d2i_POLICYINFO.35
-rw-r--r--src/lib/libcrypto/man/d2i_PrivateKey.35
-rw-r--r--src/lib/libcrypto/man/d2i_RSAPublicKey.35
-rw-r--r--src/lib/libcrypto/man/d2i_TS_REQ.35
-rw-r--r--src/lib/libcrypto/man/d2i_X509.35
-rw-r--r--src/lib/libcrypto/man/d2i_X509_ALGOR.35
-rw-r--r--src/lib/libcrypto/man/d2i_X509_ATTRIBUTE.35
-rw-r--r--src/lib/libcrypto/man/d2i_X509_CRL.313
-rw-r--r--src/lib/libcrypto/man/d2i_X509_EXTENSION.35
-rw-r--r--src/lib/libcrypto/man/d2i_X509_NAME.35
-rw-r--r--src/lib/libcrypto/man/d2i_X509_REQ.35
-rw-r--r--src/lib/libcrypto/man/d2i_X509_SIG.35
-rw-r--r--src/lib/libcrypto/man/des_read_pw.35
-rw-r--r--src/lib/libcrypto/man/evp.37
-rw-r--r--src/lib/libcrypto/man/i2a_ASN1_STRING.35
-rw-r--r--src/lib/libcrypto/man/i2d_CMS_bio_stream.35
-rw-r--r--src/lib/libcrypto/man/i2d_PKCS7_bio_stream.35
-rw-r--r--src/lib/libcrypto/man/lh_new.35
-rw-r--r--src/lib/libcrypto/man/s2i_ASN1_INTEGER.317
-rw-r--r--src/lib/libcrypto/man/v2i_ASN1_BIT_STRING.35
-rw-r--r--src/lib/libcrypto/mlkem/mlkem.h26
-rw-r--r--src/lib/libcrypto/mlkem/mlkem1024.c173
-rw-r--r--src/lib/libcrypto/mlkem/mlkem768.c178
-rw-r--r--src/lib/libcrypto/mlkem/mlkem_internal.h15
-rw-r--r--src/lib/libcrypto/modes/asm/ghash-x86.pl3
-rw-r--r--src/lib/libcrypto/modes/cbc128.c16
-rw-r--r--src/lib/libcrypto/modes/ccm128.c100
-rw-r--r--src/lib/libcrypto/modes/cfb128.c16
-rw-r--r--src/lib/libcrypto/modes/ctr128.c48
-rw-r--r--src/lib/libcrypto/modes/gcm128.c1129
-rw-r--r--src/lib/libcrypto/modes/gcm128_amd64.c44
-rw-r--r--src/lib/libcrypto/modes/gcm128_i386.c56
-rw-r--r--src/lib/libcrypto/modes/modes_local.h80
-rw-r--r--src/lib/libcrypto/modes/ofb128.c14
-rw-r--r--src/lib/libcrypto/modes/xts128.c51
-rw-r--r--src/lib/libcrypto/objects/obj_dat.c4
-rw-r--r--src/lib/libcrypto/objects/obj_lib.c4
-rw-r--r--src/lib/libcrypto/objects/obj_mac.num3
-rw-r--r--src/lib/libcrypto/objects/objects.txt6
-rw-r--r--src/lib/libcrypto/ocsp/ocsp_cl.c4
-rw-r--r--src/lib/libcrypto/ocsp/ocsp_ht.c6
-rw-r--r--src/lib/libcrypto/ocsp/ocsp_lib.c4
-rw-r--r--src/lib/libcrypto/ocsp/ocsp_prn.c3
-rw-r--r--src/lib/libcrypto/ocsp/ocsp_srv.c4
-rw-r--r--src/lib/libcrypto/ocsp/ocsp_vfy.c4
-rw-r--r--src/lib/libcrypto/pem/pem.h6
-rw-r--r--src/lib/libcrypto/pem/pem_info.c177
-rw-r--r--src/lib/libcrypto/pem/pem_lib.c4
-rw-r--r--src/lib/libcrypto/pem/pem_oth.c5
-rw-r--r--src/lib/libcrypto/pem/pem_pk8.c6
-rw-r--r--src/lib/libcrypto/pem/pem_pkey.c4
-rw-r--r--src/lib/libcrypto/pem/pem_sign.c5
-rw-r--r--src/lib/libcrypto/pem/pvkfmt.c8
-rw-r--r--src/lib/libcrypto/pkcs12/p12_add.c4
-rw-r--r--src/lib/libcrypto/pkcs12/p12_crt.c4
-rw-r--r--src/lib/libcrypto/pkcs12/p12_decr.c4
-rw-r--r--src/lib/libcrypto/pkcs12/p12_init.c4
-rw-r--r--src/lib/libcrypto/pkcs12/p12_key.c4
-rw-r--r--src/lib/libcrypto/pkcs12/p12_kiss.c4
-rw-r--r--src/lib/libcrypto/pkcs12/p12_mutl.c10
-rw-r--r--src/lib/libcrypto/pkcs12/p12_npas.c4
-rw-r--r--src/lib/libcrypto/pkcs12/p12_p8e.c4
-rw-r--r--src/lib/libcrypto/pkcs12/p12_sbag.c4
-rw-r--r--src/lib/libcrypto/pkcs12/pkcs12.h4
-rw-r--r--src/lib/libcrypto/pkcs7/pk7_asn1.c8
-rw-r--r--src/lib/libcrypto/pkcs7/pk7_attr.c166
-rw-r--r--src/lib/libcrypto/pkcs7/pk7_doit.c84
-rw-r--r--src/lib/libcrypto/pkcs7/pk7_lib.c4
-rw-r--r--src/lib/libcrypto/pkcs7/pk7_smime.c4
-rw-r--r--src/lib/libcrypto/pkcs7/pkcs7.h8
-rw-r--r--src/lib/libcrypto/rc2/rc2.c (renamed from src/lib/libcrypto/rc2/rc2_cbc.c)373
-rw-r--r--src/lib/libcrypto/rc2/rc2.h9
-rw-r--r--src/lib/libcrypto/rc2/rc2_ecb.c91
-rw-r--r--src/lib/libcrypto/rc2/rc2_skey.c142
-rw-r--r--src/lib/libcrypto/rc2/rc2cfb64.c124
-rw-r--r--src/lib/libcrypto/rc2/rc2ofb64.c111
-rw-r--r--src/lib/libcrypto/rc2/rrc2.doc219
-rw-r--r--src/lib/libcrypto/rc2/version22
-rw-r--r--src/lib/libcrypto/rc4/rc4.h9
-rw-r--r--src/lib/libcrypto/rsa/rsa_ameth.c4
-rw-r--r--src/lib/libcrypto/rsa/rsa_blinding.c4
-rw-r--r--src/lib/libcrypto/rsa/rsa_chk.c4
-rw-r--r--src/lib/libcrypto/rsa/rsa_eay.c4
-rw-r--r--src/lib/libcrypto/rsa/rsa_gen.c4
-rw-r--r--src/lib/libcrypto/rsa/rsa_lib.c4
-rw-r--r--src/lib/libcrypto/rsa/rsa_meth.c3
-rw-r--r--src/lib/libcrypto/rsa/rsa_none.c5
-rw-r--r--src/lib/libcrypto/rsa/rsa_oaep.c4
-rw-r--r--src/lib/libcrypto/rsa/rsa_pk1.c4
-rw-r--r--src/lib/libcrypto/rsa/rsa_pmeth.c4
-rw-r--r--src/lib/libcrypto/rsa/rsa_prn.c5
-rw-r--r--src/lib/libcrypto/rsa/rsa_pss.c4
-rw-r--r--src/lib/libcrypto/rsa/rsa_saos.c5
-rw-r--r--src/lib/libcrypto/rsa/rsa_sign.c4
-rw-r--r--src/lib/libcrypto/rsa/rsa_x931.c5
-rw-r--r--src/lib/libcrypto/sha/asm/sha1-586.pl8
-rw-r--r--src/lib/libcrypto/sha/asm/sha512-586.pl3
-rw-r--r--src/lib/libcrypto/sha/sha1_aarch64.c34
-rw-r--r--src/lib/libcrypto/sha/sha1_aarch64_ce.S214
-rw-r--r--src/lib/libcrypto/sha/sha3.c77
-rw-r--r--src/lib/libcrypto/sha/sha3_internal.h16
-rw-r--r--src/lib/libcrypto/shlib_version2
-rw-r--r--src/lib/libcrypto/sm2/sm2_crypt.c4
-rw-r--r--src/lib/libcrypto/sm2/sm2_pmeth.c4
-rw-r--r--src/lib/libcrypto/sm2/sm2_sign.c4
-rw-r--r--src/lib/libcrypto/ts/ts_asn1.c4
-rw-r--r--src/lib/libcrypto/ts/ts_conf.c3
-rw-r--r--src/lib/libcrypto/ts/ts_req_utils.c4
-rw-r--r--src/lib/libcrypto/ts/ts_rsp_sign.c42
-rw-r--r--src/lib/libcrypto/ts/ts_rsp_utils.c4
-rw-r--r--src/lib/libcrypto/ts/ts_rsp_verify.c4
-rw-r--r--src/lib/libcrypto/ts/ts_verify_ctx.c4
-rw-r--r--src/lib/libcrypto/ui/ui_lib.c4
-rw-r--r--src/lib/libcrypto/x509/by_dir.c4
-rw-r--r--src/lib/libcrypto/x509/by_file.c4
-rw-r--r--src/lib/libcrypto/x509/by_mem.c4
-rw-r--r--src/lib/libcrypto/x509/x509.h22
-rw-r--r--src/lib/libcrypto/x509/x509_addr.c4
-rw-r--r--src/lib/libcrypto/x509/x509_akey.c4
-rw-r--r--src/lib/libcrypto/x509/x509_alt.c4
-rw-r--r--src/lib/libcrypto/x509/x509_asid.c4
-rw-r--r--src/lib/libcrypto/x509/x509_att.c4
-rw-r--r--src/lib/libcrypto/x509/x509_bcons.c4
-rw-r--r--src/lib/libcrypto/x509/x509_bitst.c4
-rw-r--r--src/lib/libcrypto/x509/x509_cmp.c4
-rw-r--r--src/lib/libcrypto/x509/x509_conf.c9
-rw-r--r--src/lib/libcrypto/x509/x509_cpols.c4
-rw-r--r--src/lib/libcrypto/x509/x509_crld.c4
-rw-r--r--src/lib/libcrypto/x509/x509_extku.c4
-rw-r--r--src/lib/libcrypto/x509/x509_genn.c4
-rw-r--r--src/lib/libcrypto/x509/x509_ia5.c5
-rw-r--r--src/lib/libcrypto/x509/x509_info.c5
-rw-r--r--src/lib/libcrypto/x509/x509_lib.c4
-rw-r--r--src/lib/libcrypto/x509/x509_lu.c4
-rw-r--r--src/lib/libcrypto/x509/x509_ncons.c4
-rw-r--r--src/lib/libcrypto/x509/x509_ocsp.c4
-rw-r--r--src/lib/libcrypto/x509/x509_pcons.c4
-rw-r--r--src/lib/libcrypto/x509/x509_pmaps.c4
-rw-r--r--src/lib/libcrypto/x509/x509_policy.c6
-rw-r--r--src/lib/libcrypto/x509/x509_prn.c7
-rw-r--r--src/lib/libcrypto/x509/x509_purp.c3
-rw-r--r--src/lib/libcrypto/x509/x509_r2x.c4
-rw-r--r--src/lib/libcrypto/x509/x509_req.c4
-rw-r--r--src/lib/libcrypto/x509/x509_skey.c4
-rw-r--r--src/lib/libcrypto/x509/x509_utl.c4
-rw-r--r--src/lib/libcrypto/x509/x509_v3.c4
-rw-r--r--src/lib/libcrypto/x509/x509_vfy.c4
-rw-r--r--src/lib/libcrypto/x509/x509_vpm.c63
-rw-r--r--src/lib/libcrypto/x509/x509name.c4
-rw-r--r--src/lib/libcrypto/x509/x509spki.c5
-rw-r--r--src/lib/libcrypto/x509/x_all.c8
-rw-r--r--src/lib/libssl/LICENSE18
-rw-r--r--src/lib/libssl/bio_ssl.c6
-rw-r--r--src/lib/libssl/bs_ber.c4
-rw-r--r--src/lib/libssl/man/BIO_f_ssl.35
-rw-r--r--src/lib/libssl/man/DTLSv1_listen.35
-rw-r--r--src/lib/libssl/man/OPENSSL_init_ssl.35
-rw-r--r--src/lib/libssl/man/PEM_read_SSL_SESSION.35
-rw-r--r--src/lib/libssl/man/SSL_CIPHER_get_name.37
-rw-r--r--src/lib/libssl/man/SSL_COMP_add_compression_method.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_add1_chain_cert.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_add_extra_chain_cert.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_add_session.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_ctrl.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_flush_sessions.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_free.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_get0_certificate.36
-rw-r--r--src/lib/libssl/man/SSL_CTX_get_ex_new_index.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_get_verify_mode.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_load_verify_locations.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_new.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_sess_number.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_sess_set_cache_size.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_sess_set_get_cb.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_sessions.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set1_groups.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_alpn_select_cb.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_cert_store.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_cert_verify_callback.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_cipher_list.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_client_CA_list.37
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_client_cert_cb.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_default_passwd_cb.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_generate_session_id.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_info_callback.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_keylog_callback.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_max_cert_list.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_min_proto_version.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_mode.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_msg_callback.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_num_tickets.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_options.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_quiet_shutdown.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_read_ahead.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_security_level.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_session_cache_mode.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_session_id_context.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_ssl_version.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_timeout.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_tlsext_servername_callback.37
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_tlsext_status_cb.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_tlsext_ticket_key_cb.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_tlsext_use_srtp.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_verify.35
-rw-r--r--src/lib/libssl/man/SSL_CTX_use_certificate.35
-rw-r--r--src/lib/libssl/man/SSL_SESSION_free.35
-rw-r--r--src/lib/libssl/man/SSL_SESSION_get0_cipher.35
-rw-r--r--src/lib/libssl/man/SSL_SESSION_get0_peer.35
-rw-r--r--src/lib/libssl/man/SSL_SESSION_get_compress_id.35
-rw-r--r--src/lib/libssl/man/SSL_SESSION_get_ex_new_index.35
-rw-r--r--src/lib/libssl/man/SSL_SESSION_get_id.35
-rw-r--r--src/lib/libssl/man/SSL_SESSION_get_protocol_version.35
-rw-r--r--src/lib/libssl/man/SSL_SESSION_get_time.35
-rw-r--r--src/lib/libssl/man/SSL_SESSION_has_ticket.35
-rw-r--r--src/lib/libssl/man/SSL_SESSION_is_resumable.35
-rw-r--r--src/lib/libssl/man/SSL_SESSION_new.35
-rw-r--r--src/lib/libssl/man/SSL_SESSION_print.35
-rw-r--r--src/lib/libssl/man/SSL_SESSION_set1_id_context.35
-rw-r--r--src/lib/libssl/man/SSL_accept.35
-rw-r--r--src/lib/libssl/man/SSL_alert_type_string.35
-rw-r--r--src/lib/libssl/man/SSL_clear.35
-rw-r--r--src/lib/libssl/man/SSL_connect.35
-rw-r--r--src/lib/libssl/man/SSL_copy_session_id.35
-rw-r--r--src/lib/libssl/man/SSL_do_handshake.35
-rw-r--r--src/lib/libssl/man/SSL_dup.35
-rw-r--r--src/lib/libssl/man/SSL_dup_CA_list.36
-rw-r--r--src/lib/libssl/man/SSL_export_keying_material.35
-rw-r--r--src/lib/libssl/man/SSL_free.35
-rw-r--r--src/lib/libssl/man/SSL_get_SSL_CTX.35
-rw-r--r--src/lib/libssl/man/SSL_get_certificate.35
-rw-r--r--src/lib/libssl/man/SSL_get_ciphers.35
-rw-r--r--src/lib/libssl/man/SSL_get_client_CA_list.35
-rw-r--r--src/lib/libssl/man/SSL_get_client_random.35
-rw-r--r--src/lib/libssl/man/SSL_get_current_cipher.37
-rw-r--r--src/lib/libssl/man/SSL_get_default_timeout.35
-rw-r--r--src/lib/libssl/man/SSL_get_error.35
-rw-r--r--src/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.35
-rw-r--r--src/lib/libssl/man/SSL_get_ex_new_index.35
-rw-r--r--src/lib/libssl/man/SSL_get_fd.35
-rw-r--r--src/lib/libssl/man/SSL_get_finished.35
-rw-r--r--src/lib/libssl/man/SSL_get_peer_cert_chain.35
-rw-r--r--src/lib/libssl/man/SSL_get_peer_certificate.35
-rw-r--r--src/lib/libssl/man/SSL_get_rbio.35
-rw-r--r--src/lib/libssl/man/SSL_get_server_tmp_key.35
-rw-r--r--src/lib/libssl/man/SSL_get_session.35
-rw-r--r--src/lib/libssl/man/SSL_get_shared_ciphers.35
-rw-r--r--src/lib/libssl/man/SSL_get_state.35
-rw-r--r--src/lib/libssl/man/SSL_get_verify_result.35
-rw-r--r--src/lib/libssl/man/SSL_get_version.311
-rw-r--r--src/lib/libssl/man/SSL_library_init.35
-rw-r--r--src/lib/libssl/man/SSL_load_client_CA_file.35
-rw-r--r--src/lib/libssl/man/SSL_new.35
-rw-r--r--src/lib/libssl/man/SSL_num_renegotiations.35
-rw-r--r--src/lib/libssl/man/SSL_pending.35
-rw-r--r--src/lib/libssl/man/SSL_read.35
-rw-r--r--src/lib/libssl/man/SSL_read_early_data.35
-rw-r--r--src/lib/libssl/man/SSL_renegotiate.35
-rw-r--r--src/lib/libssl/man/SSL_rstate_string.35
-rw-r--r--src/lib/libssl/man/SSL_session_reused.35
-rw-r--r--src/lib/libssl/man/SSL_set1_host.35
-rw-r--r--src/lib/libssl/man/SSL_set1_param.35
-rw-r--r--src/lib/libssl/man/SSL_set_SSL_CTX.35
-rw-r--r--src/lib/libssl/man/SSL_set_bio.35
-rw-r--r--src/lib/libssl/man/SSL_set_connect_state.35
-rw-r--r--src/lib/libssl/man/SSL_set_fd.35
-rw-r--r--src/lib/libssl/man/SSL_set_max_send_fragment.35
-rw-r--r--src/lib/libssl/man/SSL_set_psk_use_session_callback.35
-rw-r--r--src/lib/libssl/man/SSL_set_session.35
-rw-r--r--src/lib/libssl/man/SSL_set_shutdown.35
-rw-r--r--src/lib/libssl/man/SSL_set_tmp_ecdh.35
-rw-r--r--src/lib/libssl/man/SSL_set_verify_result.35
-rw-r--r--src/lib/libssl/man/SSL_shutdown.35
-rw-r--r--src/lib/libssl/man/SSL_state_string.35
-rw-r--r--src/lib/libssl/man/SSL_want.35
-rw-r--r--src/lib/libssl/man/SSL_write.35
-rw-r--r--src/lib/libssl/man/d2i_SSL_SESSION.35
-rw-r--r--src/lib/libssl/pqueue.c6
-rw-r--r--src/lib/libssl/pqueue.h10
-rw-r--r--src/lib/libssl/shlib_version4
-rw-r--r--src/lib/libssl/ssl.h28
-rw-r--r--src/lib/libssl/ssl3.h60
-rw-r--r--src/lib/libssl/ssl_err.c7
-rw-r--r--src/lib/libssl/ssl_lib.c9
-rw-r--r--src/lib/libssl/ssl_local.h25
-rw-r--r--src/lib/libssl/ssl_stat.c69
-rw-r--r--src/lib/libssl/ssl_tlsext.c33
-rw-r--r--src/lib/libssl/t1_lib.c147
-rw-r--r--src/lib/libssl/tls1.h6
-rw-r--r--src/lib/libssl/tls13_lib.c4
-rw-r--r--src/lib/libtls/man/tls_accept_socket.35
-rw-r--r--src/lib/libtls/man/tls_client.35
-rw-r--r--src/lib/libtls/man/tls_config_ocsp_require_stapling.35
-rw-r--r--src/lib/libtls/man/tls_config_set_protocols.36
-rw-r--r--src/lib/libtls/man/tls_config_set_session_id.35
-rw-r--r--src/lib/libtls/man/tls_config_verify.35
-rw-r--r--src/lib/libtls/man/tls_conn_version.35
-rw-r--r--src/lib/libtls/man/tls_connect.35
-rw-r--r--src/lib/libtls/man/tls_init.35
-rw-r--r--src/lib/libtls/man/tls_load_file.35
-rw-r--r--src/lib/libtls/man/tls_ocsp_process_response.35
-rw-r--r--src/lib/libtls/man/tls_read.35
-rw-r--r--src/lib/libtls/shlib_version4
-rw-r--r--src/lib/libtls/tls_server.c4
-rw-r--r--src/regress/lib/libc/Makefile11
-rw-r--r--src/regress/lib/libc/arc4random-fork/arc4random-fork.c2
-rw-r--r--src/regress/lib/libc/explicit_bzero/explicit_bzero.c4
-rw-r--r--src/regress/lib/libc/hash/Makefile5
-rw-r--r--src/regress/lib/libc/hash/hash_test.c935
-rw-r--r--src/regress/lib/libc/illumos/Makefile7
-rw-r--r--src/regress/lib/libc/illumos/Makefile.inc9
-rw-r--r--src/regress/lib/libc/illumos/oclo/Makefile16
-rw-r--r--src/regress/lib/libc/malloc/malloc_errs/malloc_errs.c15
-rw-r--r--src/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c4
-rw-r--r--src/regress/lib/libc/stdio/Makefile29
-rw-r--r--src/regress/lib/libc/stdio/test___fpending.c58
-rw-r--r--src/regress/lib/libc/stdio/test___freadahead.c71
-rw-r--r--src/regress/lib/libc/stdio/test___freading.c125
-rw-r--r--src/regress/lib/libc/stdio/test___freadptr.c78
-rw-r--r--src/regress/lib/libc/stdio/test___fseterr.c60
-rw-r--r--src/regress/lib/libc/stdio/test___fwriting.c83
-rw-r--r--src/regress/lib/libc/stdio/test_fflush.c345
-rw-r--r--src/regress/lib/libc/stdio/test_ungetwc.c90
-rw-r--r--src/regress/lib/libcrypto/aes/aes_test.c303
-rw-r--r--src/regress/lib/libcrypto/asn1/asn1time.c26
-rw-r--r--src/regress/lib/libcrypto/bio/bio_dump.c4
-rw-r--r--src/regress/lib/libcrypto/c2sp/Makefile13
-rw-r--r--src/regress/lib/libcrypto/certs/Makefile19
-rw-r--r--src/regress/lib/libcrypto/ec/Makefile9
-rw-r--r--src/regress/lib/libcrypto/ec/ec_arithmetic.c210
-rw-r--r--src/regress/lib/libcrypto/ec/ec_asn1_test.c321
-rw-r--r--src/regress/lib/libcrypto/ec/ectest.c9
-rw-r--r--src/regress/lib/libcrypto/evp/evp_pkey_cleanup.c4
-rw-r--r--src/regress/lib/libcrypto/evp/evp_test.c82
-rw-r--r--src/regress/lib/libcrypto/gcm128/gcm128test.c32
-rwxr-xr-xsrc/regress/lib/libcrypto/man/check_complete.pl11
-rw-r--r--src/regress/lib/libcrypto/md/Makefile18
-rw-r--r--src/regress/lib/libcrypto/md/md_test.c210
-rw-r--r--src/regress/lib/libcrypto/mlkem/mlkem_iteration_tests.c16
-rw-r--r--src/regress/lib/libcrypto/mlkem/mlkem_tests.c26
-rw-r--r--src/regress/lib/libcrypto/mlkem/mlkem_tests_util.c118
-rw-r--r--src/regress/lib/libcrypto/mlkem/mlkem_tests_util.h38
-rw-r--r--src/regress/lib/libcrypto/mlkem/mlkem_unittest.c70
-rw-r--r--src/regress/lib/libcrypto/mlkem/parse_test_file.c13
-rw-r--r--src/regress/lib/libcrypto/sha/Makefile8
-rw-r--r--src/regress/lib/libcrypto/sha/sha_test.c286
-rw-r--r--src/regress/lib/libcrypto/test/test.c226
-rw-r--r--src/regress/lib/libcrypto/test/test.h137
-rw-r--r--src/regress/lib/libcrypto/test/test_util.c51
-rw-r--r--src/regress/lib/libcrypto/wycheproof/Makefile10
-rw-r--r--src/regress/lib/libcrypto/x509/Makefile11
-rw-r--r--src/regress/lib/libcrypto/x509/bettertls/Makefile8
-rw-r--r--src/regress/lib/libcrypto/x509/x509_name_test.c420
-rw-r--r--src/regress/lib/libcrypto/x509/x509name.c62
-rw-r--r--src/regress/lib/libcrypto/x509/x509name.expected3
-rw-r--r--src/regress/lib/libssl/interop/Makefile4
-rw-r--r--src/regress/lib/libssl/interop/botan/Makefile9
-rw-r--r--src/regress/lib/libssl/interop/cert/Makefile9
-rw-r--r--src/regress/lib/libssl/interop/cipher/Makefile17
-rw-r--r--src/regress/lib/libssl/interop/netcat/Makefile9
-rw-r--r--src/regress/lib/libssl/interop/openssl33/Makefile44
-rw-r--r--src/regress/lib/libssl/interop/openssl34/Makefile44
-rw-r--r--src/regress/lib/libssl/interop/openssl35/Makefile44
-rw-r--r--src/regress/lib/libssl/interop/session/Makefile9
-rw-r--r--src/regress/lib/libssl/interop/version/Makefile12
-rw-r--r--src/regress/lib/libssl/openssl-ruby/Makefile23
-rw-r--r--src/regress/lib/libssl/pqueue/Makefile7
-rw-r--r--src/regress/lib/libssl/pqueue/expected.txt3
-rw-r--r--src/regress/lib/libssl/pqueue/pq_test.c95
-rw-r--r--src/regress/lib/libssl/tlsext/tlsexttest.c41
-rw-r--r--src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py308
-rw-r--r--src/regress/lib/libtls/tls/tlstest.c139
-rw-r--r--src/usr.bin/nc/nc.114
-rw-r--r--src/usr.bin/nc/netcat.c18
-rw-r--r--src/usr.bin/nc/socks.c36
-rw-r--r--src/usr.bin/openssl/apps.c30
-rw-r--r--src/usr.bin/openssl/ca.c33
-rw-r--r--src/usr.bin/openssl/certhash.c22
-rw-r--r--src/usr.bin/openssl/cms.c38
-rw-r--r--src/usr.bin/openssl/gendsa.c5
-rw-r--r--src/usr.bin/openssl/genrsa.c5
-rw-r--r--src/usr.bin/openssl/ocsp.c12
-rw-r--r--src/usr.bin/openssl/openssl.152
-rw-r--r--src/usr.bin/openssl/openssl.c5
-rw-r--r--src/usr.bin/openssl/pkcs12.c5
-rw-r--r--src/usr.bin/openssl/pkcs8.c6
-rw-r--r--src/usr.bin/openssl/smime.c16
-rw-r--r--src/usr.bin/openssl/speed.c290
1031 files changed, 14721 insertions, 18962 deletions
diff --git a/src/lib/libc/include/thread_private.h b/src/lib/libc/include/thread_private.h
index 1ec1071161..3e1dbcdf6e 100644
--- a/src/lib/libc/include/thread_private.h
+++ b/src/lib/libc/include/thread_private.h
@@ -1,10 +1,13 @@
1/* $OpenBSD: thread_private.h,v 1.37 2024/08/18 02:25:51 guenther Exp $ */ 1/* $OpenBSD: thread_private.h,v 1.40 2025/08/04 01:44:33 dlg Exp $ */
2 2
3/* PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman <marc@snafu.org> */ 3/* PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman <marc@snafu.org> */
4 4
5#ifndef _THREAD_PRIVATE_H_ 5#ifndef _THREAD_PRIVATE_H_
6#define _THREAD_PRIVATE_H_ 6#define _THREAD_PRIVATE_H_
7 7
8#include <sys/types.h>
9#include <sys/gmon.h>
10
8extern int __isthreaded; 11extern int __isthreaded;
9 12
10#define _MALLOC_MUTEXES 32 13#define _MALLOC_MUTEXES 32
@@ -292,6 +295,12 @@ TAILQ_HEAD(pthread_queue, pthread);
292 295
293#ifdef FUTEX 296#ifdef FUTEX
294 297
298/*
299 * CAS based implementations
300 */
301
302#define __CMTX_CAS
303
295struct pthread_mutex { 304struct pthread_mutex {
296 volatile unsigned int lock; 305 volatile unsigned int lock;
297 int type; 306 int type;
@@ -312,6 +321,10 @@ struct pthread_rwlock {
312 321
313#else 322#else
314 323
324/*
325 * spinlock based implementations
326 */
327
315struct pthread_mutex { 328struct pthread_mutex {
316 _atomic_lock_t lock; 329 _atomic_lock_t lock;
317 struct pthread_queue lockers; 330 struct pthread_queue lockers;
@@ -336,6 +349,46 @@ struct pthread_rwlock {
336}; 349};
337#endif /* FUTEX */ 350#endif /* FUTEX */
338 351
352/* libc mutex */
353
354#define __CMTX_UNLOCKED 0
355#define __CMTX_LOCKED 1
356#define __CMTX_CONTENDED 2
357
358#ifdef __CMTX_CAS
359struct __cmtx {
360 volatile unsigned int lock;
361};
362
363#define __CMTX_INITIALIZER() { \
364 .lock = __CMTX_UNLOCKED, \
365}
366#else /* __CMTX_CAS */
367struct __cmtx {
368 _atomic_lock_t spin;
369 volatile unsigned int lock;
370};
371
372#define __CMTX_INITIALIZER() { \
373 .spin = _SPINLOCK_UNLOCKED, \
374 .lock = __CMTX_UNLOCKED, \
375}
376#endif /* __CMTX_CAS */
377
378/* libc recursive mutex */
379
380struct __rcmtx {
381 volatile pthread_t owner;
382 struct __cmtx mtx;
383 unsigned int depth;
384};
385
386#define __RCMTX_INITIALIZER() { \
387 .owner = NULL, \
388 .mtx = __CMTX_INITIALIZER(), \
389 .depth = 0, \
390}
391
339struct pthread_mutex_attr { 392struct pthread_mutex_attr {
340 int ma_type; 393 int ma_type;
341 int ma_protocol; 394 int ma_protocol;
@@ -390,6 +443,7 @@ struct pthread {
390 443
391 /* cancel received in a delayed cancel block? */ 444 /* cancel received in a delayed cancel block? */
392 int delayed_cancel; 445 int delayed_cancel;
446 struct gmonparam *gmonparam;
393}; 447};
394/* flags in pthread->flags */ 448/* flags in pthread->flags */
395#define THREAD_DONE 0x001 449#define THREAD_DONE 0x001
@@ -410,6 +464,16 @@ void _spinlock(volatile _atomic_lock_t *);
410int _spinlocktry(volatile _atomic_lock_t *); 464int _spinlocktry(volatile _atomic_lock_t *);
411void _spinunlock(volatile _atomic_lock_t *); 465void _spinunlock(volatile _atomic_lock_t *);
412 466
467void __cmtx_init(struct __cmtx *);
468int __cmtx_enter_try(struct __cmtx *);
469void __cmtx_enter(struct __cmtx *);
470void __cmtx_leave(struct __cmtx *);
471
472void __rcmtx_init(struct __rcmtx *);
473int __rcmtx_enter_try(struct __rcmtx *);
474void __rcmtx_enter(struct __rcmtx *);
475void __rcmtx_leave(struct __rcmtx *);
476
413void _rthread_debug(int, const char *, ...) 477void _rthread_debug(int, const char *, ...)
414 __attribute__((__format__ (printf, 2, 3))); 478 __attribute__((__format__ (printf, 2, 3)));
415pid_t _thread_dofork(pid_t (*_sys_fork)(void)); 479pid_t _thread_dofork(pid_t (*_sys_fork)(void));
diff --git a/src/lib/libc/net/ether_aton.3 b/src/lib/libc/net/ether_aton.3
index 98562dc44c..83fe98880c 100644
--- a/src/lib/libc/net/ether_aton.3
+++ b/src/lib/libc/net/ether_aton.3
@@ -1,8 +1,8 @@
1.\" $OpenBSD: ether_aton.3,v 1.3 2022/09/11 06:38:10 jmc Exp $ 1.\" $OpenBSD: ether_aton.3,v 1.4 2025/06/29 00:33:46 dlg Exp $
2.\" 2.\"
3.\" Written by roland@frob.com. Public domain. 3.\" Written by roland@frob.com. Public domain.
4.\" 4.\"
5.Dd $Mdocdate: September 11 2022 $ 5.Dd $Mdocdate: June 29 2025 $
6.Dt ETHER_ATON 3 6.Dt ETHER_ATON 3
7.Os 7.Os
8.Sh NAME 8.Sh NAME
@@ -19,7 +19,7 @@
19.In netinet/in.h 19.In netinet/in.h
20.In netinet/if_ether.h 20.In netinet/if_ether.h
21.Ft char * 21.Ft char *
22.Fn ether_ntoa "struct ether_addr *e" 22.Fn ether_ntoa "const struct ether_addr *e"
23.Ft struct ether_addr * 23.Ft struct ether_addr *
24.Fn ether_aton "const char *s" 24.Fn ether_aton "const char *s"
25.Ft int 25.Ft int
diff --git a/src/lib/libc/net/ethers.c b/src/lib/libc/net/ethers.c
index d62be1ca71..6edad5c5e5 100644
--- a/src/lib/libc/net/ethers.c
+++ b/src/lib/libc/net/ethers.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ethers.c,v 1.27 2019/01/25 00:19:25 millert Exp $ */ 1/* $OpenBSD: ethers.c,v 1.28 2025/06/29 00:33:46 dlg Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998 Todd C. Miller <millert@openbsd.org> 4 * Copyright (c) 1998 Todd C. Miller <millert@openbsd.org>
@@ -42,7 +42,7 @@
42static char * _ether_aton(const char *, struct ether_addr *); 42static char * _ether_aton(const char *, struct ether_addr *);
43 43
44char * 44char *
45ether_ntoa(struct ether_addr *e) 45ether_ntoa(const struct ether_addr *e)
46{ 46{
47 static char a[] = "xx:xx:xx:xx:xx:xx"; 47 static char a[] = "xx:xx:xx:xx:xx:xx";
48 48
diff --git a/src/lib/libc/net/gai_strerror.3 b/src/lib/libc/net/gai_strerror.3
index d271f492c5..93d11aad09 100644
--- a/src/lib/libc/net/gai_strerror.3
+++ b/src/lib/libc/net/gai_strerror.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: gai_strerror.3,v 1.10 2017/05/03 01:58:33 deraadt Exp $ 1.\" $OpenBSD: gai_strerror.3,v 1.11 2025/06/13 18:34:00 schwarze Exp $
2.\" $KAME: gai_strerror.3,v 1.1 2005/01/05 03:04:47 itojun Exp $ 2.\" $KAME: gai_strerror.3,v 1.1 2005/01/05 03:04:47 itojun Exp $
3.\" 3.\"
4.\" Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") 4.\" Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
@@ -16,7 +16,7 @@
16.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17.\" PERFORMANCE OF THIS SOFTWARE. 17.\" PERFORMANCE OF THIS SOFTWARE.
18.\" 18.\"
19.Dd $Mdocdate: May 3 2017 $ 19.Dd $Mdocdate: June 13 2025 $
20.Dt GAI_STRERROR 3 20.Dt GAI_STRERROR 3
21.Os 21.Os
22.Sh NAME 22.Sh NAME
@@ -26,7 +26,7 @@
26.In sys/types.h 26.In sys/types.h
27.In sys/socket.h 27.In sys/socket.h
28.In netdb.h 28.In netdb.h
29.Ft "const char *" 29.Ft const char *
30.Fn gai_strerror "int ecode" 30.Fn gai_strerror "int ecode"
31.Sh DESCRIPTION 31.Sh DESCRIPTION
32The 32The
diff --git a/src/lib/libc/net/if_indextoname.3 b/src/lib/libc/net/if_indextoname.3
index 25d2a2722f..9d00d66bd5 100644
--- a/src/lib/libc/net/if_indextoname.3
+++ b/src/lib/libc/net/if_indextoname.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: if_indextoname.3,v 1.16 2015/11/21 07:48:10 jmc Exp $ 1.\" $OpenBSD: if_indextoname.3,v 1.17 2025/06/13 18:34:00 schwarze Exp $
2.\" Copyright (c) 1983, 1991, 1993 2.\" Copyright (c) 1983, 1991, 1993
3.\" The Regents of the University of California. All rights reserved. 3.\" The Regents of the University of California. All rights reserved.
4.\" 4.\"
@@ -28,7 +28,7 @@
28.\" 28.\"
29.\" From: @(#)rcmd.3 8.1 (Berkeley) 6/4/93 29.\" From: @(#)rcmd.3 8.1 (Berkeley) 6/4/93
30.\" 30.\"
31.Dd $Mdocdate: November 21 2015 $ 31.Dd $Mdocdate: June 13 2025 $
32.Dt IF_NAMETOINDEX 3 32.Dt IF_NAMETOINDEX 3
33.Os 33.Os
34.Sh NAME 34.Sh NAME
@@ -41,13 +41,13 @@
41.In sys/types.h 41.In sys/types.h
42.In sys/socket.h 42.In sys/socket.h
43.In net/if.h 43.In net/if.h
44.Ft "unsigned int" 44.Ft unsigned int
45.Fn if_nametoindex "const char *ifname" 45.Fn if_nametoindex "const char *ifname"
46.Ft "char *" 46.Ft char *
47.Fn if_indextoname "unsigned int ifindex" "char *ifname" 47.Fn if_indextoname "unsigned int ifindex" "char *ifname"
48.Ft "struct if_nameindex *" 48.Ft struct if_nameindex *
49.Fn if_nameindex "void" 49.Fn if_nameindex "void"
50.Ft "void" 50.Ft void
51.Fn if_freenameindex "struct if_nameindex *ptr" 51.Fn if_freenameindex "struct if_nameindex *ptr"
52.Sh DESCRIPTION 52.Sh DESCRIPTION
53These functions map interface indexes to interface names (such as 53These functions map interface indexes to interface names (such as
diff --git a/src/lib/libc/net/inet6_opt_init.3 b/src/lib/libc/net/inet6_opt_init.3
index 41ba842166..87244507a9 100644
--- a/src/lib/libc/net/inet6_opt_init.3
+++ b/src/lib/libc/net/inet6_opt_init.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: inet6_opt_init.3,v 1.8 2022/03/31 17:27:16 naddy Exp $ 1.\" $OpenBSD: inet6_opt_init.3,v 1.9 2025/06/13 18:34:00 schwarze Exp $
2.\" $KAME: inet6_opt_init.3,v 1.7 2004/12/27 05:08:23 itojun Exp $ 2.\" $KAME: inet6_opt_init.3,v 1.7 2004/12/27 05:08:23 itojun Exp $
3.\" 3.\"
4.\" Copyright (C) 2004 WIDE Project. 4.\" Copyright (C) 2004 WIDE Project.
@@ -28,7 +28,7 @@
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE. 29.\" SUCH DAMAGE.
30.\" 30.\"
31.Dd $Mdocdate: March 31 2022 $ 31.Dd $Mdocdate: June 13 2025 $
32.Dt INET6_OPT_INIT 3 32.Dt INET6_OPT_INIT 3
33.Os 33.Os
34.\" 34.\"
@@ -44,19 +44,19 @@
44.\" 44.\"
45.Sh SYNOPSIS 45.Sh SYNOPSIS
46.In netinet/in.h 46.In netinet/in.h
47.Ft "int" 47.Ft int
48.Fn inet6_opt_init "void *extbuf" "socklen_t extlen" 48.Fn inet6_opt_init "void *extbuf" "socklen_t extlen"
49.Ft "int" 49.Ft int
50.Fn inet6_opt_append "void *extbuf" "socklen_t extlen" "int offset" "u_int8_t type" "socklen_t len" "u_int8_t align" "void **databufp" 50.Fn inet6_opt_append "void *extbuf" "socklen_t extlen" "int offset" "u_int8_t type" "socklen_t len" "u_int8_t align" "void **databufp"
51.Ft "int" 51.Ft int
52.Fn inet6_opt_finish "void *extbuf" "socklen_t extlen" "int offset" 52.Fn inet6_opt_finish "void *extbuf" "socklen_t extlen" "int offset"
53.Ft "int" 53.Ft int
54.Fn inet6_opt_set_val "void *databuf" "int offset" "void *val" "socklen_t vallen" 54.Fn inet6_opt_set_val "void *databuf" "int offset" "void *val" "socklen_t vallen"
55.Ft "int" 55.Ft int
56.Fn inet6_opt_next "void *extbuf" "socklen_t extlen" "int offset" "u_int8_t *typep" "socklen_t *lenp" "void **databufp" 56.Fn inet6_opt_next "void *extbuf" "socklen_t extlen" "int offset" "u_int8_t *typep" "socklen_t *lenp" "void **databufp"
57.Ft "int" 57.Ft int
58.Fn inet6_opt_find "void *extbuf" "socklen_t extlen" "int offset" "u_int8_t type" "socklen_t *lenp" "void **databufp" 58.Fn inet6_opt_find "void *extbuf" "socklen_t extlen" "int offset" "u_int8_t type" "socklen_t *lenp" "void **databufp"
59.Ft "int" 59.Ft int
60.Fn inet6_opt_get_val "void *databuf" "socklen_t offset" "void *val" "socklen_t vallen" 60.Fn inet6_opt_get_val "void *databuf" "socklen_t offset" "void *val" "socklen_t vallen"
61.\" 61.\"
62.Sh DESCRIPTION 62.Sh DESCRIPTION
diff --git a/src/lib/libc/net/inet6_rth_space.3 b/src/lib/libc/net/inet6_rth_space.3
index c40b45057e..7304266fe1 100644
--- a/src/lib/libc/net/inet6_rth_space.3
+++ b/src/lib/libc/net/inet6_rth_space.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: inet6_rth_space.3,v 1.8 2022/03/31 17:27:16 naddy Exp $ 1.\" $OpenBSD: inet6_rth_space.3,v 1.9 2025/06/13 18:34:00 schwarze Exp $
2.\" $KAME: inet6_rth_space.3,v 1.7 2005/01/05 03:00:44 itojun Exp $ 2.\" $KAME: inet6_rth_space.3,v 1.7 2005/01/05 03:00:44 itojun Exp $
3.\" 3.\"
4.\" Copyright (C) 2004 WIDE Project. 4.\" Copyright (C) 2004 WIDE Project.
@@ -28,7 +28,7 @@
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE. 29.\" SUCH DAMAGE.
30.\" 30.\"
31.Dd $Mdocdate: March 31 2022 $ 31.Dd $Mdocdate: June 13 2025 $
32.Dt INET6_RTH_SPACE 3 32.Dt INET6_RTH_SPACE 3
33.Os 33.Os
34.\" 34.\"
@@ -45,7 +45,7 @@
45.In netinet/in.h 45.In netinet/in.h
46.Ft socklen_t 46.Ft socklen_t
47.Fn inet6_rth_space "int" "int" 47.Fn inet6_rth_space "int" "int"
48.Ft "void *" 48.Ft void *
49.Fn inet6_rth_init "void *" "socklen_t" "int" "int" 49.Fn inet6_rth_init "void *" "socklen_t" "int" "int"
50.Ft int 50.Ft int
51.Fn inet6_rth_add "void *" "const struct in6_addr *" 51.Fn inet6_rth_add "void *" "const struct in6_addr *"
@@ -53,7 +53,7 @@
53.Fn inet6_rth_reverse "const void *" "void *" 53.Fn inet6_rth_reverse "const void *" "void *"
54.Ft int 54.Ft int
55.Fn inet6_rth_segments "const void *" 55.Fn inet6_rth_segments "const void *"
56.Ft "struct in6_addr *" 56.Ft struct in6_addr *
57.Fn inet6_rth_getaddr "const void *" "int" 57.Fn inet6_rth_getaddr "const void *" "int"
58.\" 58.\"
59.Sh DESCRIPTION 59.Sh DESCRIPTION
diff --git a/src/lib/libc/stdlib/exit.3 b/src/lib/libc/stdlib/exit.3
index 22acade86c..ccb416ee82 100644
--- a/src/lib/libc/stdlib/exit.3
+++ b/src/lib/libc/stdlib/exit.3
@@ -29,9 +29,9 @@
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE. 30.\" SUCH DAMAGE.
31.\" 31.\"
32.\" $OpenBSD: exit.3,v 1.18 2024/08/30 03:44:48 guenther Exp $ 32.\" $OpenBSD: exit.3,v 1.19 2025/06/03 14:15:53 yasuoka Exp $
33.\" 33.\"
34.Dd $Mdocdate: August 30 2024 $ 34.Dd $Mdocdate: June 3 2025 $
35.Dt EXIT 3 35.Dt EXIT 3
36.Os 36.Os
37.Sh NAME 37.Sh NAME
@@ -54,9 +54,7 @@ Call the functions registered with the
54.Xr atexit 3 54.Xr atexit 3
55function, in the reverse order of their registration. 55function, in the reverse order of their registration.
56.It 56.It
57Flush all open output streams. 57Flush and close all open streams.
58.It
59Close all open streams.
60.It 58.It
61Unlink all files created with the 59Unlink all files created with the
62.Xr tmpfile 3 60.Xr tmpfile 3
@@ -79,6 +77,7 @@ function never returns.
79.Sh SEE ALSO 77.Sh SEE ALSO
80.Xr _exit 2 , 78.Xr _exit 2 ,
81.Xr atexit 3 , 79.Xr atexit 3 ,
80.Xr fflush 3 ,
82.Xr intro 3 , 81.Xr intro 3 ,
83.Xr sysexits 3 , 82.Xr sysexits 3 ,
84.Xr tmpfile 3 83.Xr tmpfile 3
@@ -86,7 +85,7 @@ function never returns.
86The 85The
87.Fn exit 86.Fn exit
88function conforms to 87function conforms to
89.St -isoC-99 . 88.St -p1003.1-2024 .
90.Sh HISTORY 89.Sh HISTORY
91An 90An
92.Fn exit 91.Fn exit
diff --git a/src/lib/libc/stdlib/malloc.3 b/src/lib/libc/stdlib/malloc.3
index bea5575bf8..ee13b01bd4 100644
--- a/src/lib/libc/stdlib/malloc.3
+++ b/src/lib/libc/stdlib/malloc.3
@@ -30,9 +30,9 @@
30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE. 31.\" SUCH DAMAGE.
32.\" 32.\"
33.\" $OpenBSD: malloc.3,v 1.142 2024/08/03 20:09:24 guenther Exp $ 33.\" $OpenBSD: malloc.3,v 1.147 2025/06/04 00:38:01 yasuoka Exp $
34.\" 34.\"
35.Dd $Mdocdate: August 3 2024 $ 35.Dd $Mdocdate: June 4 2025 $
36.Dt MALLOC 3 36.Dt MALLOC 3
37.Os 37.Os
38.Sh NAME 38.Sh NAME
@@ -69,7 +69,8 @@
69.Fn malloc_conceal "size_t size" 69.Fn malloc_conceal "size_t size"
70.Ft void * 70.Ft void *
71.Fn calloc_conceal "size_t nmemb" "size_t size" 71.Fn calloc_conceal "size_t nmemb" "size_t size"
72.Vt char *malloc_options ; 72.Vt const char * const
73.Va malloc_options ;
73.Sh DESCRIPTION 74.Sh DESCRIPTION
74The standard functions 75The standard functions
75.Fn malloc , 76.Fn malloc ,
@@ -268,7 +269,15 @@ next checks the environment for a variable called
268and finally looks at the global variable 269and finally looks at the global variable
269.Va malloc_options 270.Va malloc_options
270in the program. 271in the program.
271Each is scanned for the flags documented below. 272Since
273.Fn malloc
274might already get called before the beginning of
275.Fn main ,
276either initialize
277.Va malloc_options
278to a string literal at file scope or do not declare it at all.
279.Pp
280Each of the three strings is scanned for the flags documented below.
272Unless otherwise noted uppercase means on, lowercase means off. 281Unless otherwise noted uppercase means on, lowercase means off.
273During initialization, flags occurring later modify the behaviour 282During initialization, flags occurring later modify the behaviour
274that was requested by flags processed earlier. 283that was requested by flags processed earlier.
@@ -363,18 +372,9 @@ Use with
363to get a verbose dump of malloc's internal state. 372to get a verbose dump of malloc's internal state.
364.It Cm X 373.It Cm X
365.Dq xmalloc . 374.Dq xmalloc .
366Rather than return failure, 375Rather than return failure to handle out-of-memory conditions gracefully,
367.Xr abort 3 376.Xr abort 3
368the program with a diagnostic message on stderr. 377the program with a diagnostic message on stderr.
369It is the intention that this option be set at compile time by
370including in the source:
371.Bd -literal -offset indent
372extern char *malloc_options;
373malloc_options = "X";
374.Ed
375.Pp
376Note that this will cause code that is supposed to handle
377out-of-memory conditions gracefully to abort instead.
378.It Cm < 378.It Cm <
379.Dq Halve the cache size . 379.Dq Halve the cache size .
380Decrease the size of the free page cache by a factor of two. 380Decrease the size of the free page cache by a factor of two.
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c
index cad8e5d6a1..c6261d87c5 100644
--- a/src/lib/libc/stdlib/malloc.c
+++ b/src/lib/libc/stdlib/malloc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: malloc.c,v 1.297 2024/09/20 02:00:46 jsg Exp $ */ 1/* $OpenBSD: malloc.c,v 1.299 2025/06/12 16:07:09 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2008, 2010, 2011, 2016, 2023 Otto Moerbeek <otto@drijf.net> 3 * Copyright (c) 2008, 2010, 2011, 2016, 2023 Otto Moerbeek <otto@drijf.net>
4 * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org> 4 * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org>
@@ -31,7 +31,6 @@
31#include <sys/queue.h> 31#include <sys/queue.h>
32#include <sys/mman.h> 32#include <sys/mman.h>
33#include <sys/sysctl.h> 33#include <sys/sysctl.h>
34#include <uvm/uvmexp.h>
35#include <errno.h> 34#include <errno.h>
36#include <stdarg.h> 35#include <stdarg.h>
37#include <stdint.h> 36#include <stdint.h>
@@ -264,7 +263,8 @@ static union {
264 __attribute__((section(".openbsd.mutable"))); 263 __attribute__((section(".openbsd.mutable")));
265#define mopts malloc_readonly.mopts 264#define mopts malloc_readonly.mopts
266 265
267char *malloc_options; /* compile-time options */ 266/* compile-time options */
267const char *const malloc_options __attribute__((weak));
268 268
269static __dead void wrterror(struct dir_info *d, char *msg, ...) 269static __dead void wrterror(struct dir_info *d, char *msg, ...)
270 __attribute__((__format__ (printf, 2, 3))); 270 __attribute__((__format__ (printf, 2, 3)));
@@ -501,7 +501,8 @@ omalloc_parseopt(char opt)
501static void 501static void
502omalloc_init(void) 502omalloc_init(void)
503{ 503{
504 char *p, *q, b[16]; 504 const char *p;
505 char *q, b[16];
505 int i, j; 506 int i, j;
506 const int mib[2] = { CTL_VM, VM_MALLOC_CONF }; 507 const int mib[2] = { CTL_VM, VM_MALLOC_CONF };
507 size_t sb; 508 size_t sb;
diff --git a/src/lib/libc/stdlib/mkstemp.c b/src/lib/libc/stdlib/mkstemp.c
index 75a9d27d1a..760575005f 100644
--- a/src/lib/libc/stdlib/mkstemp.c
+++ b/src/lib/libc/stdlib/mkstemp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: mkstemp.c,v 1.1 2024/01/19 19:45:02 millert Exp $ */ 1/* $OpenBSD: mkstemp.c,v 1.2 2025/08/04 04:59:31 guenther Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Todd C. Miller 3 * Copyright (c) 2024 Todd C. Miller
4 * 4 *
@@ -20,7 +20,8 @@
20#include <fcntl.h> 20#include <fcntl.h>
21#include <stdlib.h> 21#include <stdlib.h>
22 22
23#define MKOSTEMP_FLAGS (O_APPEND | O_CLOEXEC | O_DSYNC | O_RSYNC | O_SYNC) 23#define MKOSTEMP_FLAGS \
24 (O_APPEND | O_CLOEXEC | O_CLOFORK | O_DSYNC | O_RSYNC | O_SYNC)
24 25
25static int 26static int
26mkstemp_cb(const char *path, int flags) 27mkstemp_cb(const char *path, int flags)
diff --git a/src/lib/libc/stdlib/mktemp.3 b/src/lib/libc/stdlib/mktemp.3
index 83b7c9eb30..a967358164 100644
--- a/src/lib/libc/stdlib/mktemp.3
+++ b/src/lib/libc/stdlib/mktemp.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: mktemp.3,v 1.2 2024/03/01 21:30:40 millert Exp $ 1.\" $OpenBSD: mktemp.3,v 1.4 2025/08/04 14:11:37 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 1989, 1991, 1993 3.\" Copyright (c) 1989, 1991, 1993
4.\" The Regents of the University of California. All rights reserved. 4.\" The Regents of the University of California. All rights reserved.
@@ -27,17 +27,17 @@
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE. 28.\" SUCH DAMAGE.
29.\" 29.\"
30.Dd $Mdocdate: March 1 2024 $ 30.Dd $Mdocdate: August 4 2025 $
31.Dt MKTEMP 3 31.Dt MKTEMP 3
32.Os 32.Os
33.Sh NAME 33.Sh NAME
34.Nm mktemp , 34.Nm mktemp ,
35.Nm mkstemp , 35.Nm mkstemp ,
36.Nm mkostemp ,
37.Nm mkstemps , 36.Nm mkstemps ,
38.Nm mkostemps ,
39.Nm mkdtemp , 37.Nm mkdtemp ,
40.Nm mkdtemps 38.Nm mkdtemps ,
39.Nm mkostemp ,
40.Nm mkostemps
41.Nd make temporary file name (unique) 41.Nd make temporary file name (unique)
42.Sh SYNOPSIS 42.Sh SYNOPSIS
43.In stdlib.h 43.In stdlib.h
@@ -119,6 +119,8 @@ system call:
119Append on each write. 119Append on each write.
120.It Dv O_CLOEXEC 120.It Dv O_CLOEXEC
121Set the close-on-exec flag on the new file descriptor. 121Set the close-on-exec flag on the new file descriptor.
122.It Dv O_CLOFORK
123Set the close-on-fork flag on the new file descriptor.
122.It Dv O_SYNC 124.It Dv O_SYNC
123Perform synchronous I/O operations. 125Perform synchronous I/O operations.
124.El 126.El
@@ -163,8 +165,8 @@ functions return a pointer to the template on success and
163on failure. 165on failure.
164The 166The
165.Fn mkstemp , 167.Fn mkstemp ,
166.Fn mkostemp ,
167.Fn mkstemps , 168.Fn mkstemps ,
169.Fn mkostemp ,
168and 170and
169.Fn mkostemps 171.Fn mkostemps
170functions return \-1 if no suitable file could be created. 172functions return \-1 if no suitable file could be created.
@@ -253,9 +255,9 @@ of
253The 255The
254.Fn mktemp , 256.Fn mktemp ,
255.Fn mkstemp , 257.Fn mkstemp ,
256.Fn mkostemp , 258.Fn mkdtemp ,
257and 259and
258.Fn mkdtemp 260.Fn mkostemp
259functions may set 261functions may set
260.Va errno 262.Va errno
261to one of the following values: 263to one of the following values:
@@ -318,8 +320,8 @@ function.
318.Pp 320.Pp
319The 321The
320.Fn mkstemp , 322.Fn mkstemp ,
321.Fn mkostemp ,
322.Fn mkstemps , 323.Fn mkstemps ,
324.Fn mkostemp ,
323and 325and
324.Fn mkostemps 326.Fn mkostemps
325functions may also set 327functions may also set
@@ -345,18 +347,16 @@ function.
345.Xr tmpnam 3 347.Xr tmpnam 3
346.Sh STANDARDS 348.Sh STANDARDS
347The 349The
348.Fn mkdtemp 350.Fn mkstemp ,
351.Fn mkdtemp ,
349and 352and
350.Fn mkstemp 353.Fn mkostemp
351functions conform to the 354functions conform to the
352.St -p1003.1-2008 355.St -p1003.1-2024
353specification. 356specification.
354The ability to specify more than six 357The ability to specify more than six
355.Em X Ns s 358.Em X Ns s
356is an extension to that standard. 359is an extension to that standard.
357The
358.Fn mkostemp
359function is expected to conform to a future revision of that standard.
360.Pp 360.Pp
361The 361The
362.Fn mktemp 362.Fn mktemp
@@ -368,9 +368,9 @@ it is no longer a part of the standard.
368.Pp 368.Pp
369The 369The
370.Fn mkstemps , 370.Fn mkstemps ,
371.Fn mkostemps , 371.Fn mkdtemps ,
372and 372and
373.Fn mkdtemps 373.Fn mkostemps
374functions are non-standard and should not be used if portability is required. 374functions are non-standard and should not be used if portability is required.
375.Sh HISTORY 375.Sh HISTORY
376A 376A
@@ -378,14 +378,14 @@ A
378function appeared in 378function appeared in
379.At v7 . 379.At v7 .
380The 380The
381.Fn mkdtemp
382function appeared in
383.Ox 2.2 .
384The
385.Fn mkstemp 381.Fn mkstemp
386function appeared in 382function appeared in
387.Bx 4.3 . 383.Bx 4.3 .
388The 384The
385.Fn mkdtemp
386function appeared in
387.Ox 2.2 .
388The
389.Fn mkstemps 389.Fn mkstemps
390function appeared in 390function appeared in
391.Ox 2.3 . 391.Ox 2.3 .
diff --git a/src/lib/libc/stdlib/ptsname.3 b/src/lib/libc/stdlib/ptsname.3
index 98705528f5..eea36a5a02 100644
--- a/src/lib/libc/stdlib/ptsname.3
+++ b/src/lib/libc/stdlib/ptsname.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ptsname.3,v 1.2 2012/12/04 18:42:16 millert Exp $ 1.\" $OpenBSD: ptsname.3,v 1.3 2025/06/13 18:34:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2002 The FreeBSD Project, Inc. 3.\" Copyright (c) 2002 The FreeBSD Project, Inc.
4.\" All rights reserved. 4.\" All rights reserved.
@@ -32,7 +32,7 @@
32.\" 32.\"
33.\" $FreeBSD: head/lib/libc/stdlib/ptsname.3 240412 2012-09-12 17:54:09Z emaste $ 33.\" $FreeBSD: head/lib/libc/stdlib/ptsname.3 240412 2012-09-12 17:54:09Z emaste $
34.\" 34.\"
35.Dd $Mdocdate: December 4 2012 $ 35.Dd $Mdocdate: June 13 2025 $
36.Dt PTSNAME 3 36.Dt PTSNAME 3
37.Os 37.Os
38.Sh NAME 38.Sh NAME
@@ -44,7 +44,7 @@
44.In stdlib.h 44.In stdlib.h
45.Ft int 45.Ft int
46.Fn grantpt "int fildes" 46.Fn grantpt "int fildes"
47.Ft "char *" 47.Ft char *
48.Fn ptsname "int fildes" 48.Fn ptsname "int fildes"
49.Ft int 49.Ft int
50.Fn unlockpt "int fildes" 50.Fn unlockpt "int fildes"
diff --git a/src/lib/libc/stdlib/rand48.3 b/src/lib/libc/stdlib/rand48.3
index fa7a7179bc..02e1999db9 100644
--- a/src/lib/libc/stdlib/rand48.3
+++ b/src/lib/libc/stdlib/rand48.3
@@ -9,9 +9,9 @@
9.\" of any kind. I shall in no event be liable for anything that happens 9.\" of any kind. I shall in no event be liable for anything that happens
10.\" to anyone/anything when using this software. 10.\" to anyone/anything when using this software.
11.\" 11.\"
12.\" $OpenBSD: rand48.3,v 1.21 2019/12/20 19:16:40 tb Exp $ 12.\" $OpenBSD: rand48.3,v 1.22 2025/06/13 18:34:00 schwarze Exp $
13.\" 13.\"
14.Dd $Mdocdate: December 20 2019 $ 14.Dd $Mdocdate: June 13 2025 $
15.Dt DRAND48 3 15.Dt DRAND48 3
16.Os 16.Os
17.Sh NAME 17.Sh NAME
@@ -46,9 +46,9 @@
46.Fn srand48 "long seed" 46.Fn srand48 "long seed"
47.Ft void 47.Ft void
48.Fn srand48_deterministic "long seed" 48.Fn srand48_deterministic "long seed"
49.Ft "unsigned short *" 49.Ft unsigned short *
50.Fn seed48 "unsigned short xseed[3]" 50.Fn seed48 "unsigned short xseed[3]"
51.Ft "unsigned short *" 51.Ft unsigned short *
52.Fn seed48_deterministic "unsigned short xseed[3]" 52.Fn seed48_deterministic "unsigned short xseed[3]"
53.Ft void 53.Ft void
54.Fn lcong48 "unsigned short p[7]" 54.Fn lcong48 "unsigned short p[7]"
diff --git a/src/lib/libc/stdlib/realpath.3 b/src/lib/libc/stdlib/realpath.3
index 1dec10fef4..1f932e3bb5 100644
--- a/src/lib/libc/stdlib/realpath.3
+++ b/src/lib/libc/stdlib/realpath.3
@@ -28,9 +28,9 @@
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE. 29.\" SUCH DAMAGE.
30.\" 30.\"
31.\" $OpenBSD: realpath.3,v 1.26 2021/10/13 15:04:53 kn Exp $ 31.\" $OpenBSD: realpath.3,v 1.27 2025/06/13 18:34:00 schwarze Exp $
32.\" 32.\"
33.Dd $Mdocdate: October 13 2021 $ 33.Dd $Mdocdate: June 13 2025 $
34.Dt REALPATH 3 34.Dt REALPATH 3
35.Os 35.Os
36.Sh NAME 36.Sh NAME
@@ -39,7 +39,7 @@
39.Sh SYNOPSIS 39.Sh SYNOPSIS
40.In limits.h 40.In limits.h
41.In stdlib.h 41.In stdlib.h
42.Ft "char *" 42.Ft char *
43.Fn realpath "const char *pathname" "char *resolved" 43.Fn realpath "const char *pathname" "char *resolved"
44.Sh DESCRIPTION 44.Sh DESCRIPTION
45The 45The
diff --git a/src/lib/libc/string/memmem.3 b/src/lib/libc/string/memmem.3
index de62d738de..eeb621f8f6 100644
--- a/src/lib/libc/string/memmem.3
+++ b/src/lib/libc/string/memmem.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: memmem.3,v 1.4 2024/08/03 20:13:23 guenther Exp $ 1.\" $OpenBSD: memmem.3,v 1.5 2025/06/13 18:34:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2005 Pascal Gloor <pascal.gloor@spale.com> 3.\" Copyright (c) 2005 Pascal Gloor <pascal.gloor@spale.com>
4.\" 4.\"
@@ -26,7 +26,7 @@
26.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27.\" SUCH DAMAGE. 27.\" SUCH DAMAGE.
28.\" 28.\"
29.Dd $Mdocdate: August 3 2024 $ 29.Dd $Mdocdate: June 13 2025 $
30.Dt MEMMEM 3 30.Dt MEMMEM 3
31.Os 31.Os
32.Sh NAME 32.Sh NAME
@@ -34,7 +34,7 @@
34.Nd locate a byte substring in a byte string 34.Nd locate a byte substring in a byte string
35.Sh SYNOPSIS 35.Sh SYNOPSIS
36.In string.h 36.In string.h
37.Ft "void *" 37.Ft void *
38.Fo memmem 38.Fo memmem
39.Fa "const void *big" "size_t big_len" 39.Fa "const void *big" "size_t big_len"
40.Fa "const void *little" "size_t little_len" 40.Fa "const void *little" "size_t little_len"
diff --git a/src/lib/libcrypto/Makefile b/src/lib/libcrypto/Makefile
index db3bc767d9..b0ab507983 100644
--- a/src/lib/libcrypto/Makefile
+++ b/src/lib/libcrypto/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.231 2024/12/19 23:56:32 tb Exp $ 1# $OpenBSD: Makefile,v 1.241 2025/07/16 15:59:26 tb Exp $
2 2
3LIB= crypto 3LIB= crypto
4LIBREBUILD=y 4LIBREBUILD=y
@@ -25,6 +25,7 @@ CFLAGS+= -DLIBRESSL_NAMESPACE -DLIBRESSL_CRYPTO_NAMESPACE
25CFLAGS+= -DHAVE_FUNOPEN 25CFLAGS+= -DHAVE_FUNOPEN
26 26
27CFLAGS+= -I${LCRYPTO_SRC} 27CFLAGS+= -I${LCRYPTO_SRC}
28CFLAGS+= -I${LCRYPTO_SRC}/aes
28CFLAGS+= -I${LCRYPTO_SRC}/arch/${MACHINE_CPU} 29CFLAGS+= -I${LCRYPTO_SRC}/arch/${MACHINE_CPU}
29CFLAGS+= -I${LCRYPTO_SRC}/asn1 30CFLAGS+= -I${LCRYPTO_SRC}/asn1
30CFLAGS+= -I${LCRYPTO_SRC}/bio 31CFLAGS+= -I${LCRYPTO_SRC}/bio
@@ -67,7 +68,6 @@ SRCS+= crypto_memory.c
67# aes/ 68# aes/
68SRCS+= aes.c 69SRCS+= aes.c
69SRCS+= aes_core.c 70SRCS+= aes_core.c
70SRCS+= aes_ige.c
71 71
72# asn1/ 72# asn1/
73SRCS+= a_bitstr.c 73SRCS+= a_bitstr.c
@@ -119,10 +119,8 @@ SRCS+= x_attrib.c
119SRCS+= x_bignum.c 119SRCS+= x_bignum.c
120SRCS+= x_crl.c 120SRCS+= x_crl.c
121SRCS+= x_exten.c 121SRCS+= x_exten.c
122SRCS+= x_info.c
123SRCS+= x_long.c 122SRCS+= x_long.c
124SRCS+= x_name.c 123SRCS+= x_name.c
125SRCS+= x_pkey.c
126SRCS+= x_pubkey.c 124SRCS+= x_pubkey.c
127SRCS+= x_req.c 125SRCS+= x_req.c
128SRCS+= x_sig.c 126SRCS+= x_sig.c
@@ -152,13 +150,13 @@ SRCS+= bss_conn.c
152SRCS+= bss_dgram.c 150SRCS+= bss_dgram.c
153SRCS+= bss_fd.c 151SRCS+= bss_fd.c
154SRCS+= bss_file.c 152SRCS+= bss_file.c
155SRCS+= bss_log.c
156SRCS+= bss_mem.c 153SRCS+= bss_mem.c
157SRCS+= bss_null.c 154SRCS+= bss_null.c
158SRCS+= bss_sock.c 155SRCS+= bss_sock.c
159 156
160# bn/ 157# bn/
161SRCS+= bn_add.c 158SRCS+= bn_add.c
159SRCS+= bn_add_sub.c
162SRCS+= bn_bpsw.c 160SRCS+= bn_bpsw.c
163SRCS+= bn_const.c 161SRCS+= bn_const.c
164SRCS+= bn_convert.c 162SRCS+= bn_convert.c
@@ -172,6 +170,7 @@ SRCS+= bn_kron.c
172SRCS+= bn_lib.c 170SRCS+= bn_lib.c
173SRCS+= bn_mod.c 171SRCS+= bn_mod.c
174SRCS+= bn_mod_sqrt.c 172SRCS+= bn_mod_sqrt.c
173SRCS+= bn_mod_words.c
175SRCS+= bn_mont.c 174SRCS+= bn_mont.c
176SRCS+= bn_mul.c 175SRCS+= bn_mul.c
177SRCS+= bn_prime.c 176SRCS+= bn_prime.c
@@ -281,11 +280,13 @@ SRCS+= ec_asn1.c
281SRCS+= ec_convert.c 280SRCS+= ec_convert.c
282SRCS+= ec_curve.c 281SRCS+= ec_curve.c
283SRCS+= ec_err.c 282SRCS+= ec_err.c
283SRCS+= ec_field.c
284SRCS+= ec_key.c 284SRCS+= ec_key.c
285SRCS+= ec_lib.c 285SRCS+= ec_lib.c
286SRCS+= ec_mult.c 286SRCS+= ec_mult.c
287SRCS+= ec_pmeth.c 287SRCS+= ec_pmeth.c
288SRCS+= eck_prn.c 288SRCS+= eck_prn.c
289SRCS+= ecp_hp_methods.c
289SRCS+= ecp_methods.c 290SRCS+= ecp_methods.c
290SRCS+= ecx_methods.c 291SRCS+= ecx_methods.c
291 292
@@ -450,11 +451,7 @@ SRCS+= rand_lib.c
450SRCS+= randfile.c 451SRCS+= randfile.c
451 452
452# rc2/ 453# rc2/
453SRCS+= rc2_cbc.c 454SRCS+= rc2.c
454SRCS+= rc2_ecb.c
455SRCS+= rc2_skey.c
456SRCS+= rc2cfb64.c
457SRCS+= rc2ofb64.c
458 455
459# rc4/ 456# rc4/
460SRCS+= rc4.c 457SRCS+= rc4.c
diff --git a/src/lib/libcrypto/Symbols.list b/src/lib/libcrypto/Symbols.list
index e259430bbf..2aae617f0a 100644
--- a/src/lib/libcrypto/Symbols.list
+++ b/src/lib/libcrypto/Symbols.list
@@ -308,7 +308,6 @@ BIO_s_connect
308BIO_s_datagram 308BIO_s_datagram
309BIO_s_fd 309BIO_s_fd
310BIO_s_file 310BIO_s_file
311BIO_s_log
312BIO_s_mem 311BIO_s_mem
313BIO_s_null 312BIO_s_null
314BIO_s_socket 313BIO_s_socket
@@ -1664,9 +1663,7 @@ PEM_ASN1_write_bio
1664PEM_SignFinal 1663PEM_SignFinal
1665PEM_SignInit 1664PEM_SignInit
1666PEM_SignUpdate 1665PEM_SignUpdate
1667PEM_X509_INFO_read
1668PEM_X509_INFO_read_bio 1666PEM_X509_INFO_read_bio
1669PEM_X509_INFO_write_bio
1670PEM_bytes_read_bio 1667PEM_bytes_read_bio
1671PEM_def_callback 1668PEM_def_callback
1672PEM_dek_info 1669PEM_dek_info
@@ -2474,8 +2471,6 @@ X509_OBJECT_idx_by_subject
2474X509_OBJECT_new 2471X509_OBJECT_new
2475X509_OBJECT_retrieve_by_subject 2472X509_OBJECT_retrieve_by_subject
2476X509_OBJECT_retrieve_match 2473X509_OBJECT_retrieve_match
2477X509_PKEY_free
2478X509_PKEY_new
2479X509_PUBKEY_free 2474X509_PUBKEY_free
2480X509_PUBKEY_get 2475X509_PUBKEY_get
2481X509_PUBKEY_get0 2476X509_PUBKEY_get0
diff --git a/src/lib/libcrypto/aes/aes.c b/src/lib/libcrypto/aes/aes.c
index d36a006360..693badcd66 100644
--- a/src/lib/libcrypto/aes/aes.c
+++ b/src/lib/libcrypto/aes/aes.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: aes.c,v 1.4 2024/08/11 13:02:39 jsing Exp $ */ 1/* $OpenBSD: aes.c,v 1.14 2025/07/22 09:13:49 jsing Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -46,21 +46,72 @@
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE. 47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 * ==================================================================== 48 * ====================================================================
49 *
50 */ 49 */
51 50
52#include <string.h> 51#include <string.h>
53 52
54#include <openssl/aes.h> 53#include <openssl/aes.h>
55#include <openssl/bio.h> 54#include <openssl/bio.h>
55#include <openssl/crypto.h>
56#include <openssl/modes.h> 56#include <openssl/modes.h>
57 57
58#include "crypto_arch.h" 58#include "crypto_arch.h"
59#include "crypto_internal.h"
60#include "modes_local.h"
59 61
60static const unsigned char aes_wrap_default_iv[] = { 62static const unsigned char aes_wrap_default_iv[] = {
61 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 63 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6,
62}; 64};
63 65
66int aes_set_encrypt_key_internal(const unsigned char *userKey, const int bits,
67 AES_KEY *key);
68int aes_set_decrypt_key_internal(const unsigned char *userKey, const int bits,
69 AES_KEY *key);
70void aes_encrypt_internal(const unsigned char *in, unsigned char *out,
71 const AES_KEY *key);
72void aes_decrypt_internal(const unsigned char *in, unsigned char *out,
73 const AES_KEY *key);
74
75int
76AES_set_encrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key)
77{
78 return aes_set_encrypt_key_internal(userKey, bits, key);
79}
80LCRYPTO_ALIAS(AES_set_encrypt_key);
81
82int
83AES_set_decrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key)
84{
85 return aes_set_decrypt_key_internal(userKey, bits, key);
86}
87LCRYPTO_ALIAS(AES_set_decrypt_key);
88
89void
90AES_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key)
91{
92 aes_encrypt_internal(in, out, key);
93}
94LCRYPTO_ALIAS(AES_encrypt);
95
96void
97AES_decrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key)
98{
99 aes_decrypt_internal(in, out, key);
100}
101LCRYPTO_ALIAS(AES_decrypt);
102
103void
104aes_encrypt_block128(const unsigned char *in, unsigned char *out, const void *key)
105{
106 aes_encrypt_internal(in, out, key);
107}
108
109void
110aes_decrypt_block128(const unsigned char *in, unsigned char *out, const void *key)
111{
112 aes_decrypt_internal(in, out, key);
113}
114
64#ifdef HAVE_AES_CBC_ENCRYPT_INTERNAL 115#ifdef HAVE_AES_CBC_ENCRYPT_INTERNAL
65void aes_cbc_encrypt_internal(const unsigned char *in, unsigned char *out, 116void aes_cbc_encrypt_internal(const unsigned char *in, unsigned char *out,
66 size_t len, const AES_KEY *key, unsigned char *ivec, const int enc); 117 size_t len, const AES_KEY *key, unsigned char *ivec, const int enc);
@@ -72,10 +123,10 @@ aes_cbc_encrypt_internal(const unsigned char *in, unsigned char *out,
72{ 123{
73 if (enc) 124 if (enc)
74 CRYPTO_cbc128_encrypt(in, out, len, key, ivec, 125 CRYPTO_cbc128_encrypt(in, out, len, key, ivec,
75 (block128_f)AES_encrypt); 126 aes_encrypt_block128);
76 else 127 else
77 CRYPTO_cbc128_decrypt(in, out, len, key, ivec, 128 CRYPTO_cbc128_decrypt(in, out, len, key, ivec,
78 (block128_f)AES_decrypt); 129 aes_decrypt_block128);
79} 130}
80#endif 131#endif
81 132
@@ -98,7 +149,7 @@ AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, size_t length,
98 const AES_KEY *key, unsigned char *ivec, int *num, const int enc) 149 const AES_KEY *key, unsigned char *ivec, int *num, const int enc)
99{ 150{
100 CRYPTO_cfb128_encrypt(in, out, length, key, ivec, num, enc, 151 CRYPTO_cfb128_encrypt(in, out, length, key, ivec, num, enc,
101 (block128_f)AES_encrypt); 152 aes_encrypt_block128);
102} 153}
103LCRYPTO_ALIAS(AES_cfb128_encrypt); 154LCRYPTO_ALIAS(AES_cfb128_encrypt);
104 155
@@ -108,7 +159,7 @@ AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, size_t length,
108 const AES_KEY *key, unsigned char *ivec, int *num, const int enc) 159 const AES_KEY *key, unsigned char *ivec, int *num, const int enc)
109{ 160{
110 CRYPTO_cfb128_1_encrypt(in, out, length, key, ivec, num, enc, 161 CRYPTO_cfb128_1_encrypt(in, out, length, key, ivec, num, enc,
111 (block128_f)AES_encrypt); 162 aes_encrypt_block128);
112} 163}
113LCRYPTO_ALIAS(AES_cfb1_encrypt); 164LCRYPTO_ALIAS(AES_cfb1_encrypt);
114 165
@@ -117,17 +168,134 @@ AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, size_t length,
117 const AES_KEY *key, unsigned char *ivec, int *num, const int enc) 168 const AES_KEY *key, unsigned char *ivec, int *num, const int enc)
118{ 169{
119 CRYPTO_cfb128_8_encrypt(in, out, length, key, ivec, num, enc, 170 CRYPTO_cfb128_8_encrypt(in, out, length, key, ivec, num, enc,
120 (block128_f)AES_encrypt); 171 aes_encrypt_block128);
121} 172}
122LCRYPTO_ALIAS(AES_cfb8_encrypt); 173LCRYPTO_ALIAS(AES_cfb8_encrypt);
123 174
124void 175void
176aes_ccm64_encrypt_generic(const unsigned char *in, unsigned char *out,
177 size_t blocks, const void *key, const unsigned char ivec[16],
178 unsigned char cmac[16], int encrypt)
179{
180 uint8_t iv[AES_BLOCK_SIZE], buf[AES_BLOCK_SIZE];
181 uint8_t in_mask;
182 uint64_t ctr;
183 int i;
184
185 in_mask = 0 - (encrypt != 0);
186
187 memcpy(iv, ivec, sizeof(iv));
188
189 ctr = crypto_load_be64toh(&iv[8]);
190
191 while (blocks > 0) {
192 crypto_store_htobe64(&iv[8], ctr);
193 aes_encrypt_internal(iv, buf, key);
194 ctr++;
195
196 for (i = 0; i < 16; i++) {
197 out[i] = in[i] ^ buf[i];
198 cmac[i] ^= (in[i] & in_mask) | (out[i] & ~in_mask);
199 }
200
201 aes_encrypt_internal(cmac, cmac, key);
202
203 in += 16;
204 out += 16;
205 blocks--;
206 }
207
208 explicit_bzero(buf, sizeof(buf));
209 explicit_bzero(iv, sizeof(iv));
210}
211
212#ifdef HAVE_AES_CCM64_ENCRYPT_INTERNAL
213void aes_ccm64_encrypt_internal(const unsigned char *in, unsigned char *out,
214 size_t blocks, const void *key, const unsigned char ivec[16],
215 unsigned char cmac[16], int encrypt);
216
217#else
218static inline void
219aes_ccm64_encrypt_internal(const unsigned char *in, unsigned char *out,
220 size_t blocks, const void *key, const unsigned char ivec[16],
221 unsigned char cmac[16], int encrypt)
222{
223 aes_ccm64_encrypt_generic(in, out, blocks, key, ivec, cmac, encrypt);
224}
225#endif
226
227void
228aes_ccm64_encrypt_ccm128f(const unsigned char *in, unsigned char *out,
229 size_t blocks, const void *key, const unsigned char ivec[16],
230 unsigned char cmac[16])
231{
232 aes_ccm64_encrypt_internal(in, out, blocks, key, ivec, cmac, 1);
233}
234
235void
236aes_ccm64_decrypt_ccm128f(const unsigned char *in, unsigned char *out,
237 size_t blocks, const void *key, const unsigned char ivec[16],
238 unsigned char cmac[16])
239{
240 aes_ccm64_encrypt_internal(in, out, blocks, key, ivec, cmac, 0);
241}
242
243void
244aes_ctr32_encrypt_generic(const unsigned char *in, unsigned char *out,
245 size_t blocks, const AES_KEY *key, const unsigned char ivec[AES_BLOCK_SIZE])
246{
247 uint8_t iv[AES_BLOCK_SIZE], buf[AES_BLOCK_SIZE];
248 uint32_t ctr;
249 int i;
250
251 memcpy(iv, ivec, sizeof(iv));
252
253 ctr = crypto_load_be32toh(&iv[12]);
254
255 while (blocks > 0) {
256 crypto_store_htobe32(&iv[12], ctr);
257 aes_encrypt_internal(iv, buf, key);
258 ctr++;
259
260 for (i = 0; i < AES_BLOCK_SIZE; i++)
261 out[i] = in[i] ^ buf[i];
262
263 in += 16;
264 out += 16;
265 blocks--;
266 }
267
268 explicit_bzero(buf, sizeof(buf));
269 explicit_bzero(iv, sizeof(iv));
270}
271
272#ifdef HAVE_AES_CTR32_ENCRYPT_INTERNAL
273void aes_ctr32_encrypt_internal(const unsigned char *in, unsigned char *out,
274 size_t blocks, const AES_KEY *key, const unsigned char ivec[AES_BLOCK_SIZE]);
275
276#else
277static inline void
278aes_ctr32_encrypt_internal(const unsigned char *in, unsigned char *out,
279 size_t blocks, const AES_KEY *key, const unsigned char ivec[AES_BLOCK_SIZE])
280{
281 aes_ctr32_encrypt_generic(in, out, blocks, key, ivec);
282}
283#endif
284
285void
286aes_ctr32_encrypt_ctr128f(const unsigned char *in, unsigned char *out, size_t blocks,
287 const void *key, const unsigned char ivec[AES_BLOCK_SIZE])
288{
289 aes_ctr32_encrypt_internal(in, out, blocks, key, ivec);
290}
291
292void
125AES_ctr128_encrypt(const unsigned char *in, unsigned char *out, 293AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,
126 size_t length, const AES_KEY *key, unsigned char ivec[AES_BLOCK_SIZE], 294 size_t length, const AES_KEY *key, unsigned char ivec[AES_BLOCK_SIZE],
127 unsigned char ecount_buf[AES_BLOCK_SIZE], unsigned int *num) 295 unsigned char ecount_buf[AES_BLOCK_SIZE], unsigned int *num)
128{ 296{
129 CRYPTO_ctr128_encrypt(in, out, length, key, ivec, ecount_buf, num, 297 CRYPTO_ctr128_encrypt_ctr32(in, out, length, key, ivec, ecount_buf,
130 (block128_f)AES_encrypt); 298 num, aes_ctr32_encrypt_ctr128f);
131} 299}
132LCRYPTO_ALIAS(AES_ctr128_encrypt); 300LCRYPTO_ALIAS(AES_ctr128_encrypt);
133 301
@@ -142,15 +310,121 @@ AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
142} 310}
143LCRYPTO_ALIAS(AES_ecb_encrypt); 311LCRYPTO_ALIAS(AES_ecb_encrypt);
144 312
313#ifndef HAVE_AES_ECB_ENCRYPT_INTERNAL
314void
315aes_ecb_encrypt_internal(const unsigned char *in, unsigned char *out,
316 size_t len, const AES_KEY *key, int encrypt)
317{
318 while (len >= AES_BLOCK_SIZE) {
319 AES_ecb_encrypt(in, out, key, encrypt);
320 in += AES_BLOCK_SIZE;
321 out += AES_BLOCK_SIZE;
322 len -= AES_BLOCK_SIZE;
323 }
324}
325#endif
326
327#define N_WORDS (AES_BLOCK_SIZE / sizeof(unsigned long))
328typedef struct {
329 unsigned long data[N_WORDS];
330} aes_block_t;
331
332void
333AES_ige_encrypt(const unsigned char *in, unsigned char *out, size_t length,
334 const AES_KEY *key, unsigned char *ivec, const int enc)
335{
336 aes_block_t tmp, tmp2;
337 aes_block_t iv;
338 aes_block_t iv2;
339 size_t n;
340 size_t len;
341
342 /* N.B. The IV for this mode is _twice_ the block size */
343
344 OPENSSL_assert((length % AES_BLOCK_SIZE) == 0);
345
346 len = length / AES_BLOCK_SIZE;
347
348 memcpy(iv.data, ivec, AES_BLOCK_SIZE);
349 memcpy(iv2.data, ivec + AES_BLOCK_SIZE, AES_BLOCK_SIZE);
350
351 if (AES_ENCRYPT == enc) {
352 while (len) {
353 memcpy(tmp.data, in, AES_BLOCK_SIZE);
354 for (n = 0; n < N_WORDS; ++n)
355 tmp2.data[n] = tmp.data[n] ^ iv.data[n];
356 AES_encrypt((unsigned char *)tmp2.data,
357 (unsigned char *)tmp2.data, key);
358 for (n = 0; n < N_WORDS; ++n)
359 tmp2.data[n] ^= iv2.data[n];
360 memcpy(out, tmp2.data, AES_BLOCK_SIZE);
361 iv = tmp2;
362 iv2 = tmp;
363 --len;
364 in += AES_BLOCK_SIZE;
365 out += AES_BLOCK_SIZE;
366 }
367 } else {
368 while (len) {
369 memcpy(tmp.data, in, AES_BLOCK_SIZE);
370 tmp2 = tmp;
371 for (n = 0; n < N_WORDS; ++n)
372 tmp.data[n] ^= iv2.data[n];
373 AES_decrypt((unsigned char *)tmp.data,
374 (unsigned char *)tmp.data, key);
375 for (n = 0; n < N_WORDS; ++n)
376 tmp.data[n] ^= iv.data[n];
377 memcpy(out, tmp.data, AES_BLOCK_SIZE);
378 iv = tmp2;
379 iv2 = tmp;
380 --len;
381 in += AES_BLOCK_SIZE;
382 out += AES_BLOCK_SIZE;
383 }
384 }
385 memcpy(ivec, iv.data, AES_BLOCK_SIZE);
386 memcpy(ivec + AES_BLOCK_SIZE, iv2.data, AES_BLOCK_SIZE);
387}
388LCRYPTO_ALIAS(AES_ige_encrypt);
389
145void 390void
146AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, size_t length, 391AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, size_t length,
147 const AES_KEY *key, unsigned char *ivec, int *num) 392 const AES_KEY *key, unsigned char *ivec, int *num)
148{ 393{
149 CRYPTO_ofb128_encrypt(in, out, length, key, ivec, num, 394 CRYPTO_ofb128_encrypt(in, out, length, key, ivec, num,
150 (block128_f)AES_encrypt); 395 aes_encrypt_block128);
151} 396}
152LCRYPTO_ALIAS(AES_ofb128_encrypt); 397LCRYPTO_ALIAS(AES_ofb128_encrypt);
153 398
399void
400aes_xts_encrypt_generic(const unsigned char *in, unsigned char *out, size_t len,
401 const AES_KEY *key1, const AES_KEY *key2, const unsigned char iv[16],
402 int encrypt)
403{
404 XTS128_CONTEXT xctx;
405
406 if (encrypt)
407 xctx.block1 = aes_encrypt_block128;
408 else
409 xctx.block1 = aes_decrypt_block128;
410
411 xctx.block2 = aes_encrypt_block128;
412 xctx.key1 = key1;
413 xctx.key2 = key2;
414
415 CRYPTO_xts128_encrypt(&xctx, iv, in, out, len, encrypt);
416}
417
418#ifndef HAVE_AES_XTS_ENCRYPT_INTERNAL
419void
420aes_xts_encrypt_internal(const unsigned char *in, unsigned char *out, size_t len,
421 const AES_KEY *key1, const AES_KEY *key2, const unsigned char iv[16],
422 int encrypt)
423{
424 aes_xts_encrypt_generic(in, out, len, key1, key2, iv, encrypt);
425}
426#endif
427
154int 428int
155AES_wrap_key(AES_KEY *key, const unsigned char *iv, unsigned char *out, 429AES_wrap_key(AES_KEY *key, const unsigned char *iv, unsigned char *out,
156 const unsigned char *in, unsigned int inlen) 430 const unsigned char *in, unsigned int inlen)
@@ -217,7 +491,7 @@ AES_unwrap_key(AES_KEY *key, const unsigned char *iv, unsigned char *out,
217 } 491 }
218 if (!iv) 492 if (!iv)
219 iv = aes_wrap_default_iv; 493 iv = aes_wrap_default_iv;
220 if (memcmp(A, iv, 8)) { 494 if (timingsafe_memcmp(A, iv, 8) != 0) {
221 explicit_bzero(out, inlen); 495 explicit_bzero(out, inlen);
222 return 0; 496 return 0;
223 } 497 }
diff --git a/src/lib/libcrypto/aes/aes_amd64.c b/src/lib/libcrypto/aes/aes_amd64.c
new file mode 100644
index 0000000000..183a5cce14
--- /dev/null
+++ b/src/lib/libcrypto/aes/aes_amd64.c
@@ -0,0 +1,201 @@
1/* $OpenBSD: aes_amd64.c,v 1.5 2025/07/22 09:13:49 jsing Exp $ */
2/*
3 * Copyright (c) 2025 Joel Sing <jsing@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#include <openssl/aes.h>
19
20#include "crypto_arch.h"
21#include "modes_local.h"
22
23int aes_set_encrypt_key_generic(const unsigned char *userKey, const int bits,
24 AES_KEY *key);
25int aes_set_decrypt_key_generic(const unsigned char *userKey, const int bits,
26 AES_KEY *key);
27
28void aes_encrypt_generic(const unsigned char *in, unsigned char *out,
29 const AES_KEY *key);
30void aes_decrypt_generic(const unsigned char *in, unsigned char *out,
31 const AES_KEY *key);
32
33void aes_cbc_encrypt_generic(const unsigned char *in, unsigned char *out,
34 size_t len, const AES_KEY *key, unsigned char *ivec, const int enc);
35
36void aes_ccm64_encrypt_generic(const unsigned char *in, unsigned char *out,
37 size_t blocks, const void *key, const unsigned char ivec[16],
38 unsigned char cmac[16], int encrypt);
39
40void aes_ctr32_encrypt_generic(const unsigned char *in, unsigned char *out,
41 size_t blocks, const AES_KEY *key, const unsigned char ivec[AES_BLOCK_SIZE]);
42
43void aes_xts_encrypt_generic(const unsigned char *in, unsigned char *out,
44 size_t len, const AES_KEY *key1, const AES_KEY *key2,
45 const unsigned char iv[16], int encrypt);
46
47int aesni_set_encrypt_key(const unsigned char *userKey, int bits,
48 AES_KEY *key);
49int aesni_set_decrypt_key(const unsigned char *userKey, int bits,
50 AES_KEY *key);
51
52void aesni_encrypt(const unsigned char *in, unsigned char *out,
53 const AES_KEY *key);
54void aesni_decrypt(const unsigned char *in, unsigned char *out,
55 const AES_KEY *key);
56
57void aesni_cbc_encrypt(const unsigned char *in, unsigned char *out,
58 size_t len, const AES_KEY *key, unsigned char *ivec, const int enc);
59
60void aesni_ccm64_encrypt_blocks(const unsigned char *in, unsigned char *out,
61 size_t blocks, const void *key, const unsigned char ivec[16],
62 unsigned char cmac[16]);
63
64void aesni_ccm64_decrypt_blocks(const unsigned char *in, unsigned char *out,
65 size_t blocks, const void *key, const unsigned char ivec[16],
66 unsigned char cmac[16]);
67
68void aesni_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out,
69 size_t blocks, const void *key, const unsigned char *ivec);
70
71void aesni_ecb_encrypt(const unsigned char *in, unsigned char *out,
72 size_t length, const AES_KEY *key, int enc);
73
74void aesni_xts_encrypt(const unsigned char *in, unsigned char *out,
75 size_t length, const AES_KEY *key1, const AES_KEY *key2,
76 const unsigned char iv[16]);
77
78void aesni_xts_decrypt(const unsigned char *in, unsigned char *out,
79 size_t length, const AES_KEY *key1, const AES_KEY *key2,
80 const unsigned char iv[16]);
81
82int
83aes_set_encrypt_key_internal(const unsigned char *userKey, const int bits,
84 AES_KEY *key)
85{
86 if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_AES) != 0)
87 return aesni_set_encrypt_key(userKey, bits, key);
88
89 return aes_set_encrypt_key_generic(userKey, bits, key);
90}
91
92int
93aes_set_decrypt_key_internal(const unsigned char *userKey, const int bits,
94 AES_KEY *key)
95{
96 if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_AES) != 0)
97 return aesni_set_decrypt_key(userKey, bits, key);
98
99 return aes_set_decrypt_key_generic(userKey, bits, key);
100}
101
102void
103aes_encrypt_internal(const unsigned char *in, unsigned char *out,
104 const AES_KEY *key)
105{
106 if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_AES) != 0) {
107 aesni_encrypt(in, out, key);
108 return;
109 }
110
111 aes_encrypt_generic(in, out, key);
112}
113
114void
115aes_decrypt_internal(const unsigned char *in, unsigned char *out,
116 const AES_KEY *key)
117{
118 if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_AES) != 0) {
119 aesni_decrypt(in, out, key);
120 return;
121 }
122
123 aes_decrypt_generic(in, out, key);
124}
125
126void
127aes_cbc_encrypt_internal(const unsigned char *in, unsigned char *out,
128 size_t len, const AES_KEY *key, unsigned char *ivec, const int enc)
129{
130 if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_AES) != 0) {
131 aesni_cbc_encrypt(in, out, len, key, ivec, enc);
132 return;
133 }
134
135 aes_cbc_encrypt_generic(in, out, len, key, ivec, enc);
136}
137
138void
139aes_ccm64_encrypt_internal(const unsigned char *in, unsigned char *out,
140 size_t blocks, const void *key, const unsigned char ivec[16],
141 unsigned char cmac[16], int encrypt)
142{
143 if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_AES) != 0) {
144 if (encrypt)
145 aesni_ccm64_encrypt_blocks(in, out, blocks, key, ivec, cmac);
146 else
147 aesni_ccm64_decrypt_blocks(in, out, blocks, key, ivec, cmac);
148 return;
149 }
150
151 aes_ccm64_encrypt_generic(in, out, blocks, key, ivec, cmac, encrypt);
152}
153
154void
155aes_ctr32_encrypt_internal(const unsigned char *in, unsigned char *out,
156 size_t blocks, const AES_KEY *key, const unsigned char ivec[AES_BLOCK_SIZE])
157{
158 if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_AES) != 0) {
159 aesni_ctr32_encrypt_blocks(in, out, blocks, key, ivec);
160 return;
161 }
162
163 aes_ctr32_encrypt_generic(in, out, blocks, key, ivec);
164}
165
166void
167aes_ecb_encrypt_internal(const unsigned char *in, unsigned char *out,
168 size_t len, const AES_KEY *key, int encrypt)
169{
170 if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_AES) != 0) {
171 aesni_ecb_encrypt(in, out, len, key, encrypt);
172 return;
173 }
174
175 while (len >= AES_BLOCK_SIZE) {
176 if (encrypt)
177 aes_encrypt_generic(in, out, key);
178 else
179 aes_decrypt_generic(in, out, key);
180
181 in += AES_BLOCK_SIZE;
182 out += AES_BLOCK_SIZE;
183 len -= AES_BLOCK_SIZE;
184 }
185}
186
187void
188aes_xts_encrypt_internal(const unsigned char *in, unsigned char *out,
189 size_t len, const AES_KEY *key1, const AES_KEY *key2,
190 const unsigned char iv[16], int encrypt)
191{
192 if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_AES) != 0) {
193 if (encrypt)
194 aesni_xts_encrypt(in, out, len, key1, key2, iv);
195 else
196 aesni_xts_decrypt(in, out, len, key1, key2, iv);
197 return;
198 }
199
200 aes_xts_encrypt_generic(in, out, len, key1, key2, iv, encrypt);
201}
diff --git a/src/lib/libcrypto/aes/aes_core.c b/src/lib/libcrypto/aes/aes_core.c
index 4383d74903..8eccb998d3 100644
--- a/src/lib/libcrypto/aes/aes_core.c
+++ b/src/lib/libcrypto/aes/aes_core.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: aes_core.c,v 1.25 2024/11/13 21:00:57 tb Exp $ */ 1/* $OpenBSD: aes_core.c,v 1.27 2025/04/21 12:23:09 jsing Exp $ */
2/** 2/**
3 * rijndael-alg-fst.c 3 * rijndael-alg-fst.c
4 * 4 *
@@ -30,7 +30,7 @@
30 * compatible API. 30 * compatible API.
31 */ 31 */
32 32
33#include <stdlib.h> 33#include <stdint.h>
34 34
35#include <openssl/aes.h> 35#include <openssl/aes.h>
36 36
@@ -55,7 +55,7 @@ Td4[x] = Si[x].[01];
55 !defined(HAVE_AES_SET_DECRYPT_KEY_INTERNAL) || \ 55 !defined(HAVE_AES_SET_DECRYPT_KEY_INTERNAL) || \
56 !defined(HAVE_AES_ENCRYPT_INTERNAL) || \ 56 !defined(HAVE_AES_ENCRYPT_INTERNAL) || \
57 !defined(HAVE_AES_DECRYPT_INTERNAL) 57 !defined(HAVE_AES_DECRYPT_INTERNAL)
58static const u32 Te0[256] = { 58static const uint32_t Te0[256] = {
59 0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU, 59 0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU,
60 0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U, 60 0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U,
61 0x60303050U, 0x02010103U, 0xce6767a9U, 0x562b2b7dU, 61 0x60303050U, 0x02010103U, 0xce6767a9U, 0x562b2b7dU,
@@ -121,7 +121,7 @@ static const u32 Te0[256] = {
121 0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U, 121 0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U,
122 0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU, 122 0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU,
123}; 123};
124static const u32 Te1[256] = { 124static const uint32_t Te1[256] = {
125 0xa5c66363U, 0x84f87c7cU, 0x99ee7777U, 0x8df67b7bU, 125 0xa5c66363U, 0x84f87c7cU, 0x99ee7777U, 0x8df67b7bU,
126 0x0dfff2f2U, 0xbdd66b6bU, 0xb1de6f6fU, 0x5491c5c5U, 126 0x0dfff2f2U, 0xbdd66b6bU, 0xb1de6f6fU, 0x5491c5c5U,
127 0x50603030U, 0x03020101U, 0xa9ce6767U, 0x7d562b2bU, 127 0x50603030U, 0x03020101U, 0xa9ce6767U, 0x7d562b2bU,
@@ -187,7 +187,7 @@ static const u32 Te1[256] = {
187 0xc3824141U, 0xb0299999U, 0x775a2d2dU, 0x111e0f0fU, 187 0xc3824141U, 0xb0299999U, 0x775a2d2dU, 0x111e0f0fU,
188 0xcb7bb0b0U, 0xfca85454U, 0xd66dbbbbU, 0x3a2c1616U, 188 0xcb7bb0b0U, 0xfca85454U, 0xd66dbbbbU, 0x3a2c1616U,
189}; 189};
190static const u32 Te2[256] = { 190static const uint32_t Te2[256] = {
191 0x63a5c663U, 0x7c84f87cU, 0x7799ee77U, 0x7b8df67bU, 191 0x63a5c663U, 0x7c84f87cU, 0x7799ee77U, 0x7b8df67bU,
192 0xf20dfff2U, 0x6bbdd66bU, 0x6fb1de6fU, 0xc55491c5U, 192 0xf20dfff2U, 0x6bbdd66bU, 0x6fb1de6fU, 0xc55491c5U,
193 0x30506030U, 0x01030201U, 0x67a9ce67U, 0x2b7d562bU, 193 0x30506030U, 0x01030201U, 0x67a9ce67U, 0x2b7d562bU,
@@ -253,7 +253,7 @@ static const u32 Te2[256] = {
253 0x41c38241U, 0x99b02999U, 0x2d775a2dU, 0x0f111e0fU, 253 0x41c38241U, 0x99b02999U, 0x2d775a2dU, 0x0f111e0fU,
254 0xb0cb7bb0U, 0x54fca854U, 0xbbd66dbbU, 0x163a2c16U, 254 0xb0cb7bb0U, 0x54fca854U, 0xbbd66dbbU, 0x163a2c16U,
255}; 255};
256static const u32 Te3[256] = { 256static const uint32_t Te3[256] = {
257 0x6363a5c6U, 0x7c7c84f8U, 0x777799eeU, 0x7b7b8df6U, 257 0x6363a5c6U, 0x7c7c84f8U, 0x777799eeU, 0x7b7b8df6U,
258 0xf2f20dffU, 0x6b6bbdd6U, 0x6f6fb1deU, 0xc5c55491U, 258 0xf2f20dffU, 0x6b6bbdd6U, 0x6f6fb1deU, 0xc5c55491U,
259 0x30305060U, 0x01010302U, 0x6767a9ceU, 0x2b2b7d56U, 259 0x30305060U, 0x01010302U, 0x6767a9ceU, 0x2b2b7d56U,
@@ -320,7 +320,7 @@ static const u32 Te3[256] = {
320 0xb0b0cb7bU, 0x5454fca8U, 0xbbbbd66dU, 0x16163a2cU, 320 0xb0b0cb7bU, 0x5454fca8U, 0xbbbbd66dU, 0x16163a2cU,
321}; 321};
322 322
323static const u32 Td0[256] = { 323static const uint32_t Td0[256] = {
324 0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U, 324 0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U,
325 0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U, 325 0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U,
326 0x2030fa55U, 0xad766df6U, 0x88cc7691U, 0xf5024c25U, 326 0x2030fa55U, 0xad766df6U, 0x88cc7691U, 0xf5024c25U,
@@ -386,7 +386,7 @@ static const u32 Td0[256] = {
386 0x39a80171U, 0x080cb3deU, 0xd8b4e49cU, 0x6456c190U, 386 0x39a80171U, 0x080cb3deU, 0xd8b4e49cU, 0x6456c190U,
387 0x7bcb8461U, 0xd532b670U, 0x486c5c74U, 0xd0b85742U, 387 0x7bcb8461U, 0xd532b670U, 0x486c5c74U, 0xd0b85742U,
388}; 388};
389static const u32 Td1[256] = { 389static const uint32_t Td1[256] = {
390 0x5051f4a7U, 0x537e4165U, 0xc31a17a4U, 0x963a275eU, 390 0x5051f4a7U, 0x537e4165U, 0xc31a17a4U, 0x963a275eU,
391 0xcb3bab6bU, 0xf11f9d45U, 0xabacfa58U, 0x934be303U, 391 0xcb3bab6bU, 0xf11f9d45U, 0xabacfa58U, 0x934be303U,
392 0x552030faU, 0xf6ad766dU, 0x9188cc76U, 0x25f5024cU, 392 0x552030faU, 0xf6ad766dU, 0x9188cc76U, 0x25f5024cU,
@@ -452,7 +452,7 @@ static const u32 Td1[256] = {
452 0x7139a801U, 0xde080cb3U, 0x9cd8b4e4U, 0x906456c1U, 452 0x7139a801U, 0xde080cb3U, 0x9cd8b4e4U, 0x906456c1U,
453 0x617bcb84U, 0x70d532b6U, 0x74486c5cU, 0x42d0b857U, 453 0x617bcb84U, 0x70d532b6U, 0x74486c5cU, 0x42d0b857U,
454}; 454};
455static const u32 Td2[256] = { 455static const uint32_t Td2[256] = {
456 0xa75051f4U, 0x65537e41U, 0xa4c31a17U, 0x5e963a27U, 456 0xa75051f4U, 0x65537e41U, 0xa4c31a17U, 0x5e963a27U,
457 0x6bcb3babU, 0x45f11f9dU, 0x58abacfaU, 0x03934be3U, 457 0x6bcb3babU, 0x45f11f9dU, 0x58abacfaU, 0x03934be3U,
458 0xfa552030U, 0x6df6ad76U, 0x769188ccU, 0x4c25f502U, 458 0xfa552030U, 0x6df6ad76U, 0x769188ccU, 0x4c25f502U,
@@ -518,7 +518,7 @@ static const u32 Td2[256] = {
518 0x017139a8U, 0xb3de080cU, 0xe49cd8b4U, 0xc1906456U, 518 0x017139a8U, 0xb3de080cU, 0xe49cd8b4U, 0xc1906456U,
519 0x84617bcbU, 0xb670d532U, 0x5c74486cU, 0x5742d0b8U, 519 0x84617bcbU, 0xb670d532U, 0x5c74486cU, 0x5742d0b8U,
520}; 520};
521static const u32 Td3[256] = { 521static const uint32_t Td3[256] = {
522 0xf4a75051U, 0x4165537eU, 0x17a4c31aU, 0x275e963aU, 522 0xf4a75051U, 0x4165537eU, 0x17a4c31aU, 0x275e963aU,
523 0xab6bcb3bU, 0x9d45f11fU, 0xfa58abacU, 0xe303934bU, 523 0xab6bcb3bU, 0x9d45f11fU, 0xfa58abacU, 0xe303934bU,
524 0x30fa5520U, 0x766df6adU, 0xcc769188U, 0x024c25f5U, 524 0x30fa5520U, 0x766df6adU, 0xcc769188U, 0x024c25f5U,
@@ -588,7 +588,7 @@ static const u32 Td3[256] = {
588 588
589#if !defined(HAVE_AES_ENCRYPT_INTERNAL) || \ 589#if !defined(HAVE_AES_ENCRYPT_INTERNAL) || \
590 !defined(HAVE_AES_DECRYPT_INTERNAL) 590 !defined(HAVE_AES_DECRYPT_INTERNAL)
591static const u8 Td4[256] = { 591static const uint8_t Td4[256] = {
592 0x52U, 0x09U, 0x6aU, 0xd5U, 0x30U, 0x36U, 0xa5U, 0x38U, 592 0x52U, 0x09U, 0x6aU, 0xd5U, 0x30U, 0x36U, 0xa5U, 0x38U,
593 0xbfU, 0x40U, 0xa3U, 0x9eU, 0x81U, 0xf3U, 0xd7U, 0xfbU, 593 0xbfU, 0x40U, 0xa3U, 0x9eU, 0x81U, 0xf3U, 0xd7U, 0xfbU,
594 0x7cU, 0xe3U, 0x39U, 0x82U, 0x9bU, 0x2fU, 0xffU, 0x87U, 594 0x7cU, 0xe3U, 0x39U, 0x82U, 0x9bU, 0x2fU, 0xffU, 0x87U,
@@ -626,29 +626,24 @@ static const u8 Td4[256] = {
626 626
627#if !defined(HAVE_AES_SET_ENCRYPT_KEY_INTERNAL) || \ 627#if !defined(HAVE_AES_SET_ENCRYPT_KEY_INTERNAL) || \
628 !defined(HAVE_AES_SET_DECRYPT_KEY_INTERNAL) 628 !defined(HAVE_AES_SET_DECRYPT_KEY_INTERNAL)
629static const u32 rcon[] = { 629static const uint32_t rcon[] = {
630 0x01000000, 0x02000000, 0x04000000, 0x08000000, 630 0x01000000, 0x02000000, 0x04000000, 0x08000000,
631 0x10000000, 0x20000000, 0x40000000, 0x80000000, 631 0x10000000, 0x20000000, 0x40000000, 0x80000000,
632 0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */ 632 0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */
633}; 633};
634#endif 634#endif
635 635
636#ifdef HAVE_AES_SET_ENCRYPT_KEY_INTERNAL 636#ifndef HAVE_AES_SET_ENCRYPT_KEY_INTERNAL
637int aes_set_encrypt_key_internal(const unsigned char *userKey, const int bits,
638 AES_KEY *key);
639
640#else
641
642/* 637/*
643 * Expand the cipher key into the encryption key schedule. 638 * Expand the cipher key into the encryption key schedule.
644 */ 639 */
645static inline int 640int
646aes_set_encrypt_key_internal(const unsigned char *userKey, const int bits, 641aes_set_encrypt_key_internal(const unsigned char *userKey, const int bits,
647 AES_KEY *key) 642 AES_KEY *key)
648{ 643{
649 u32 *rk; 644 uint32_t *rk;
650 int i = 0; 645 int i = 0;
651 u32 temp; 646 uint32_t temp;
652 647
653 if (!userKey || !key) 648 if (!userKey || !key)
654 return -1; 649 return -1;
@@ -742,28 +737,17 @@ aes_set_encrypt_key_internal(const unsigned char *userKey, const int bits,
742} 737}
743#endif 738#endif
744 739
745int 740#ifndef HAVE_AES_SET_DECRYPT_KEY_INTERNAL
746AES_set_encrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key)
747{
748 return aes_set_encrypt_key_internal(userKey, bits, key);
749}
750LCRYPTO_ALIAS(AES_set_encrypt_key);
751
752#ifdef HAVE_AES_SET_DECRYPT_KEY_INTERNAL
753int aes_set_decrypt_key_internal(const unsigned char *userKey, const int bits,
754 AES_KEY *key);
755
756#else
757/* 741/*
758 * Expand the cipher key into the decryption key schedule. 742 * Expand the cipher key into the decryption key schedule.
759 */ 743 */
760static inline int 744int
761aes_set_decrypt_key_internal(const unsigned char *userKey, const int bits, 745aes_set_decrypt_key_internal(const unsigned char *userKey, const int bits,
762 AES_KEY *key) 746 AES_KEY *key)
763{ 747{
764 u32 *rk; 748 uint32_t *rk;
765 int i, j, status; 749 int i, j, status;
766 u32 temp; 750 uint32_t temp;
767 751
768 /* first, start with an encryption schedule */ 752 /* first, start with an encryption schedule */
769 status = AES_set_encrypt_key(userKey, bits, key); 753 status = AES_set_encrypt_key(userKey, bits, key);
@@ -815,27 +799,16 @@ aes_set_decrypt_key_internal(const unsigned char *userKey, const int bits,
815} 799}
816#endif 800#endif
817 801
818int 802#ifndef HAVE_AES_ENCRYPT_INTERNAL
819AES_set_decrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key)
820{
821 return aes_set_decrypt_key_internal(userKey, bits, key);
822}
823LCRYPTO_ALIAS(AES_set_decrypt_key);
824
825#ifdef HAVE_AES_ENCRYPT_INTERNAL
826void aes_encrypt_internal(const unsigned char *in, unsigned char *out,
827 const AES_KEY *key);
828
829#else
830/* 803/*
831 * Encrypt a single block - in and out can overlap. 804 * Encrypt a single block - in and out can overlap.
832 */ 805 */
833static inline void 806void
834aes_encrypt_internal(const unsigned char *in, unsigned char *out, 807aes_encrypt_internal(const unsigned char *in, unsigned char *out,
835 const AES_KEY *key) 808 const AES_KEY *key)
836{ 809{
837 const u32 *rk; 810 const uint32_t *rk;
838 u32 s0, s1, s2, s3, t0, t1, t2, t3; 811 uint32_t s0, s1, s2, s3, t0, t1, t2, t3;
839#ifndef FULL_UNROLL 812#ifndef FULL_UNROLL
840 int r; 813 int r;
841#endif /* ?FULL_UNROLL */ 814#endif /* ?FULL_UNROLL */
@@ -1018,27 +991,16 @@ aes_encrypt_internal(const unsigned char *in, unsigned char *out,
1018} 991}
1019#endif 992#endif
1020 993
1021void 994#ifndef HAVE_AES_DECRYPT_INTERNAL
1022AES_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key)
1023{
1024 aes_encrypt_internal(in, out, key);
1025}
1026LCRYPTO_ALIAS(AES_encrypt);
1027
1028#ifdef HAVE_AES_DECRYPT_INTERNAL
1029void aes_decrypt_internal(const unsigned char *in, unsigned char *out,
1030 const AES_KEY *key);
1031
1032#else
1033/* 995/*
1034 * Decrypt a single block - in and out can overlap. 996 * Decrypt a single block - in and out can overlap.
1035 */ 997 */
1036static inline void 998void
1037aes_decrypt_internal(const unsigned char *in, unsigned char *out, 999aes_decrypt_internal(const unsigned char *in, unsigned char *out,
1038 const AES_KEY *key) 1000 const AES_KEY *key)
1039{ 1001{
1040 const u32 *rk; 1002 const uint32_t *rk;
1041 u32 s0, s1, s2, s3, t0, t1, t2, t3; 1003 uint32_t s0, s1, s2, s3, t0, t1, t2, t3;
1042#ifndef FULL_UNROLL 1004#ifndef FULL_UNROLL
1043 int r; 1005 int r;
1044#endif /* ?FULL_UNROLL */ 1006#endif /* ?FULL_UNROLL */
@@ -1220,10 +1182,3 @@ aes_decrypt_internal(const unsigned char *in, unsigned char *out,
1220 crypto_store_htobe32(&out[3 * 4], s3); 1182 crypto_store_htobe32(&out[3 * 4], s3);
1221} 1183}
1222#endif 1184#endif
1223
1224void
1225AES_decrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key)
1226{
1227 aes_decrypt_internal(in, out, key);
1228}
1229LCRYPTO_ALIAS(AES_decrypt);
diff --git a/src/lib/libcrypto/aes/aes_i386.c b/src/lib/libcrypto/aes/aes_i386.c
new file mode 100644
index 0000000000..85a14454da
--- /dev/null
+++ b/src/lib/libcrypto/aes/aes_i386.c
@@ -0,0 +1,201 @@
1/* $OpenBSD: aes_i386.c,v 1.5 2025/07/22 09:13:49 jsing Exp $ */
2/*
3 * Copyright (c) 2025 Joel Sing <jsing@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#include <openssl/aes.h>
19
20#include "crypto_arch.h"
21#include "modes_local.h"
22
23int aes_set_encrypt_key_generic(const unsigned char *userKey, const int bits,
24 AES_KEY *key);
25int aes_set_decrypt_key_generic(const unsigned char *userKey, const int bits,
26 AES_KEY *key);
27
28void aes_encrypt_generic(const unsigned char *in, unsigned char *out,
29 const AES_KEY *key);
30void aes_decrypt_generic(const unsigned char *in, unsigned char *out,
31 const AES_KEY *key);
32
33void aes_cbc_encrypt_generic(const unsigned char *in, unsigned char *out,
34 size_t len, const AES_KEY *key, unsigned char *ivec, const int enc);
35
36void aes_ccm64_encrypt_generic(const unsigned char *in, unsigned char *out,
37 size_t blocks, const void *key, const unsigned char ivec[16],
38 unsigned char cmac[16], int encrypt);
39
40void aes_ctr32_encrypt_generic(const unsigned char *in, unsigned char *out,
41 size_t blocks, const AES_KEY *key, const unsigned char ivec[AES_BLOCK_SIZE]);
42
43void aes_xts_encrypt_generic(const unsigned char *in, unsigned char *out,
44 size_t len, const AES_KEY *key1, const AES_KEY *key2,
45 const unsigned char iv[16], int encrypt);
46
47int aesni_set_encrypt_key(const unsigned char *userKey, int bits,
48 AES_KEY *key);
49int aesni_set_decrypt_key(const unsigned char *userKey, int bits,
50 AES_KEY *key);
51
52void aesni_encrypt(const unsigned char *in, unsigned char *out,
53 const AES_KEY *key);
54void aesni_decrypt(const unsigned char *in, unsigned char *out,
55 const AES_KEY *key);
56
57void aesni_cbc_encrypt(const unsigned char *in, unsigned char *out,
58 size_t len, const AES_KEY *key, unsigned char *ivec, const int enc);
59
60void aesni_ccm64_encrypt_blocks(const unsigned char *in, unsigned char *out,
61 size_t blocks, const void *key, const unsigned char ivec[16],
62 unsigned char cmac[16]);
63
64void aesni_ccm64_decrypt_blocks(const unsigned char *in, unsigned char *out,
65 size_t blocks, const void *key, const unsigned char ivec[16],
66 unsigned char cmac[16]);
67
68void aesni_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out,
69 size_t blocks, const void *key, const unsigned char *ivec);
70
71void aesni_ecb_encrypt(const unsigned char *in, unsigned char *out,
72 size_t length, const AES_KEY *key, int enc);
73
74void aesni_xts_encrypt(const unsigned char *in, unsigned char *out,
75 size_t length, const AES_KEY *key1, const AES_KEY *key2,
76 const unsigned char iv[16]);
77
78void aesni_xts_decrypt(const unsigned char *in, unsigned char *out,
79 size_t length, const AES_KEY *key1, const AES_KEY *key2,
80 const unsigned char iv[16]);
81
82int
83aes_set_encrypt_key_internal(const unsigned char *userKey, const int bits,
84 AES_KEY *key)
85{
86 if ((crypto_cpu_caps_i386 & CRYPTO_CPU_CAPS_I386_AES) != 0)
87 return aesni_set_encrypt_key(userKey, bits, key);
88
89 return aes_set_encrypt_key_generic(userKey, bits, key);
90}
91
92int
93aes_set_decrypt_key_internal(const unsigned char *userKey, const int bits,
94 AES_KEY *key)
95{
96 if ((crypto_cpu_caps_i386 & CRYPTO_CPU_CAPS_I386_AES) != 0)
97 return aesni_set_decrypt_key(userKey, bits, key);
98
99 return aes_set_decrypt_key_generic(userKey, bits, key);
100}
101
102void
103aes_encrypt_internal(const unsigned char *in, unsigned char *out,
104 const AES_KEY *key)
105{
106 if ((crypto_cpu_caps_i386 & CRYPTO_CPU_CAPS_I386_AES) != 0) {
107 aesni_encrypt(in, out, key);
108 return;
109 }
110
111 aes_encrypt_generic(in, out, key);
112}
113
114void
115aes_decrypt_internal(const unsigned char *in, unsigned char *out,
116 const AES_KEY *key)
117{
118 if ((crypto_cpu_caps_i386 & CRYPTO_CPU_CAPS_I386_AES) != 0) {
119 aesni_decrypt(in, out, key);
120 return;
121 }
122
123 aes_decrypt_generic(in, out, key);
124}
125
126void
127aes_cbc_encrypt_internal(const unsigned char *in, unsigned char *out,
128 size_t len, const AES_KEY *key, unsigned char *ivec, const int enc)
129{
130 if ((crypto_cpu_caps_i386 & CRYPTO_CPU_CAPS_I386_AES) != 0) {
131 aesni_cbc_encrypt(in, out, len, key, ivec, enc);
132 return;
133 }
134
135 aes_cbc_encrypt_generic(in, out, len, key, ivec, enc);
136}
137
138void
139aes_ccm64_encrypt_internal(const unsigned char *in, unsigned char *out,
140 size_t blocks, const void *key, const unsigned char ivec[16],
141 unsigned char cmac[16], int encrypt)
142{
143 if ((crypto_cpu_caps_i386 & CRYPTO_CPU_CAPS_I386_AES) != 0) {
144 if (encrypt)
145 aesni_ccm64_encrypt_blocks(in, out, blocks, key, ivec, cmac);
146 else
147 aesni_ccm64_decrypt_blocks(in, out, blocks, key, ivec, cmac);
148 return;
149 }
150
151 aes_ccm64_encrypt_generic(in, out, blocks, key, ivec, cmac, encrypt);
152}
153
154void
155aes_ctr32_encrypt_internal(const unsigned char *in, unsigned char *out,
156 size_t blocks, const AES_KEY *key, const unsigned char ivec[AES_BLOCK_SIZE])
157{
158 if ((crypto_cpu_caps_i386 & CRYPTO_CPU_CAPS_I386_AES) != 0) {
159 aesni_ctr32_encrypt_blocks(in, out, blocks, key, ivec);
160 return;
161 }
162
163 aes_ctr32_encrypt_generic(in, out, blocks, key, ivec);
164}
165
166void
167aes_ecb_encrypt_internal(const unsigned char *in, unsigned char *out,
168 size_t len, const AES_KEY *key, int encrypt)
169{
170 if ((crypto_cpu_caps_i386 & CRYPTO_CPU_CAPS_I386_AES) != 0) {
171 aesni_ecb_encrypt(in, out, len, key, encrypt);
172 return;
173 }
174
175 while (len >= AES_BLOCK_SIZE) {
176 if (encrypt)
177 aes_encrypt_generic(in, out, key);
178 else
179 aes_decrypt_generic(in, out, key);
180
181 in += AES_BLOCK_SIZE;
182 out += AES_BLOCK_SIZE;
183 len -= AES_BLOCK_SIZE;
184 }
185}
186
187void
188aes_xts_encrypt_internal(const unsigned char *in, unsigned char *out,
189 size_t len, const AES_KEY *key1, const AES_KEY *key2,
190 const unsigned char iv[16], int encrypt)
191{
192 if ((crypto_cpu_caps_i386 & CRYPTO_CPU_CAPS_I386_AES) != 0) {
193 if (encrypt)
194 aesni_xts_encrypt(in, out, len, key1, key2, iv);
195 else
196 aesni_xts_decrypt(in, out, len, key1, key2, iv);
197 return;
198 }
199
200 aes_xts_encrypt_generic(in, out, len, key1, key2, iv, encrypt);
201}
diff --git a/src/lib/libcrypto/aes/aes_ige.c b/src/lib/libcrypto/aes/aes_ige.c
deleted file mode 100644
index 1a6fcfcfbf..0000000000
--- a/src/lib/libcrypto/aes/aes_ige.c
+++ /dev/null
@@ -1,195 +0,0 @@
1/* $OpenBSD: aes_ige.c,v 1.10 2024/03/30 05:14:12 joshua Exp $ */
2/* ====================================================================
3 * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * 3. All advertising materials mentioning features or use of this
18 * software must display the following acknowledgment:
19 * "This product includes software developed by the OpenSSL Project
20 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
21 *
22 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23 * endorse or promote products derived from this software without
24 * prior written permission. For written permission, please contact
25 * openssl-core@openssl.org.
26 *
27 * 5. Products derived from this software may not be called "OpenSSL"
28 * nor may "OpenSSL" appear in their names without prior written
29 * permission of the OpenSSL Project.
30 *
31 * 6. Redistributions of any form whatsoever must retain the following
32 * acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
40 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 * ====================================================================
49 *
50 */
51
52#include <openssl/aes.h>
53#include <openssl/crypto.h>
54
55#include "aes_local.h"
56
57#define N_WORDS (AES_BLOCK_SIZE / sizeof(unsigned long))
58typedef struct {
59 unsigned long data[N_WORDS];
60} aes_block_t;
61
62/* XXX: probably some better way to do this */
63#if defined(__i386__) || defined(__x86_64__)
64#define UNALIGNED_MEMOPS_ARE_FAST 1
65#else
66#define UNALIGNED_MEMOPS_ARE_FAST 0
67#endif
68
69#if UNALIGNED_MEMOPS_ARE_FAST
70#define load_block(d, s) (d) = *(const aes_block_t *)(s)
71#define store_block(d, s) *(aes_block_t *)(d) = (s)
72#else
73#define load_block(d, s) memcpy((d).data, (s), AES_BLOCK_SIZE)
74#define store_block(d, s) memcpy((d), (s).data, AES_BLOCK_SIZE)
75#endif
76
77/* N.B. The IV for this mode is _twice_ the block size */
78
79void
80AES_ige_encrypt(const unsigned char *in, unsigned char *out, size_t length,
81 const AES_KEY *key, unsigned char *ivec, const int enc)
82{
83 size_t n;
84 size_t len;
85
86 OPENSSL_assert((length % AES_BLOCK_SIZE) == 0);
87
88 len = length / AES_BLOCK_SIZE;
89
90 if (AES_ENCRYPT == enc) {
91 if (in != out && (UNALIGNED_MEMOPS_ARE_FAST ||
92 ((size_t)in|(size_t)out|(size_t)ivec) %
93 sizeof(long) == 0)) {
94 aes_block_t *ivp = (aes_block_t *)ivec;
95 aes_block_t *iv2p = (aes_block_t *)(ivec + AES_BLOCK_SIZE);
96
97 while (len) {
98 aes_block_t *inp = (aes_block_t *)in;
99 aes_block_t *outp = (aes_block_t *)out;
100
101 for (n = 0; n < N_WORDS; ++n)
102 outp->data[n] = inp->data[n] ^ ivp->data[n];
103 AES_encrypt((unsigned char *)outp->data, (unsigned char *)outp->data, key);
104 for (n = 0; n < N_WORDS; ++n)
105 outp->data[n] ^= iv2p->data[n];
106 ivp = outp;
107 iv2p = inp;
108 --len;
109 in += AES_BLOCK_SIZE;
110 out += AES_BLOCK_SIZE;
111 }
112 memmove(ivec, ivp->data, AES_BLOCK_SIZE);
113 memmove(ivec + AES_BLOCK_SIZE, iv2p->data, AES_BLOCK_SIZE);
114 } else {
115 aes_block_t tmp, tmp2;
116 aes_block_t iv;
117 aes_block_t iv2;
118
119 load_block(iv, ivec);
120 load_block(iv2, ivec + AES_BLOCK_SIZE);
121
122 while (len) {
123 load_block(tmp, in);
124 for (n = 0; n < N_WORDS; ++n)
125 tmp2.data[n] = tmp.data[n] ^ iv.data[n];
126 AES_encrypt((unsigned char *)tmp2.data,
127 (unsigned char *)tmp2.data, key);
128 for (n = 0; n < N_WORDS; ++n)
129 tmp2.data[n] ^= iv2.data[n];
130 store_block(out, tmp2);
131 iv = tmp2;
132 iv2 = tmp;
133 --len;
134 in += AES_BLOCK_SIZE;
135 out += AES_BLOCK_SIZE;
136 }
137 memcpy(ivec, iv.data, AES_BLOCK_SIZE);
138 memcpy(ivec + AES_BLOCK_SIZE, iv2.data, AES_BLOCK_SIZE);
139 }
140 } else {
141 if (in != out && (UNALIGNED_MEMOPS_ARE_FAST ||
142 ((size_t)in|(size_t)out|(size_t)ivec) %
143 sizeof(long) == 0)) {
144 aes_block_t *ivp = (aes_block_t *)ivec;
145 aes_block_t *iv2p = (aes_block_t *)(ivec + AES_BLOCK_SIZE);
146
147 while (len) {
148 aes_block_t tmp;
149 aes_block_t *inp = (aes_block_t *)in;
150 aes_block_t *outp = (aes_block_t *)out;
151
152 for (n = 0; n < N_WORDS; ++n)
153 tmp.data[n] = inp->data[n] ^ iv2p->data[n];
154 AES_decrypt((unsigned char *)tmp.data,
155 (unsigned char *)outp->data, key);
156 for (n = 0; n < N_WORDS; ++n)
157 outp->data[n] ^= ivp->data[n];
158 ivp = inp;
159 iv2p = outp;
160 --len;
161 in += AES_BLOCK_SIZE;
162 out += AES_BLOCK_SIZE;
163 }
164 memmove(ivec, ivp->data, AES_BLOCK_SIZE);
165 memmove(ivec + AES_BLOCK_SIZE, iv2p->data, AES_BLOCK_SIZE);
166 } else {
167 aes_block_t tmp, tmp2;
168 aes_block_t iv;
169 aes_block_t iv2;
170
171 load_block(iv, ivec);
172 load_block(iv2, ivec + AES_BLOCK_SIZE);
173
174 while (len) {
175 load_block(tmp, in);
176 tmp2 = tmp;
177 for (n = 0; n < N_WORDS; ++n)
178 tmp.data[n] ^= iv2.data[n];
179 AES_decrypt((unsigned char *)tmp.data,
180 (unsigned char *)tmp.data, key);
181 for (n = 0; n < N_WORDS; ++n)
182 tmp.data[n] ^= iv.data[n];
183 store_block(out, tmp);
184 iv = tmp2;
185 iv2 = tmp;
186 --len;
187 in += AES_BLOCK_SIZE;
188 out += AES_BLOCK_SIZE;
189 }
190 memcpy(ivec, iv.data, AES_BLOCK_SIZE);
191 memcpy(ivec + AES_BLOCK_SIZE, iv2.data, AES_BLOCK_SIZE);
192 }
193 }
194}
195LCRYPTO_ALIAS(AES_ige_encrypt);
diff --git a/src/lib/libcrypto/aes/aes_local.h b/src/lib/libcrypto/aes/aes_local.h
index e0714df409..a265eaac1d 100644
--- a/src/lib/libcrypto/aes/aes_local.h
+++ b/src/lib/libcrypto/aes/aes_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: aes_local.h,v 1.4 2025/01/25 17:59:44 tb Exp $ */ 1/* $OpenBSD: aes_local.h,v 1.11 2025/07/22 09:29:31 jsing Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -60,17 +60,30 @@
60 60
61__BEGIN_HIDDEN_DECLS 61__BEGIN_HIDDEN_DECLS
62 62
63typedef unsigned int u32;
64typedef unsigned short u16;
65typedef unsigned char u8;
66
67#define MAXKC (256/32)
68#define MAXKB (256/8)
69#define MAXNR 14
70
71/* This controls loop-unrolling in aes_core.c */ 63/* This controls loop-unrolling in aes_core.c */
72#undef FULL_UNROLL 64#undef FULL_UNROLL
73 65
66void aes_encrypt_block128(const unsigned char *in, unsigned char *out,
67 const void *key);
68
69void aes_ctr32_encrypt_ctr128f(const unsigned char *in, unsigned char *out,
70 size_t blocks, const void *key, const unsigned char ivec[AES_BLOCK_SIZE]);
71
72void aes_ccm64_encrypt_ccm128f(const unsigned char *in, unsigned char *out,
73 size_t blocks, const void *key, const unsigned char ivec[16],
74 unsigned char cmac[16]);
75
76void aes_ccm64_decrypt_ccm128f(const unsigned char *in, unsigned char *out,
77 size_t blocks, const void *key, const unsigned char ivec[16],
78 unsigned char cmac[16]);
79
80void aes_ecb_encrypt_internal(const unsigned char *in, unsigned char *out,
81 size_t len, const AES_KEY *key, int encrypt);
82
83void aes_xts_encrypt_internal(const char unsigned *in, char unsigned *out,
84 size_t len, const AES_KEY *key1, const AES_KEY *key2,
85 const unsigned char iv[16], int encrypt);
86
74__END_HIDDEN_DECLS 87__END_HIDDEN_DECLS
75 88
76#endif /* !HEADER_AES_LOCAL_H */ 89#endif /* !HEADER_AES_LOCAL_H */
diff --git a/src/lib/libcrypto/aes/asm/aes-586.pl b/src/lib/libcrypto/aes/asm/aes-586.pl
index 364099d4d3..402a1a3c46 100644
--- a/src/lib/libcrypto/aes/asm/aes-586.pl
+++ b/src/lib/libcrypto/aes/asm/aes-586.pl
@@ -1158,8 +1158,8 @@ sub enclast()
1158 &data_word(0x00000000, 0x00000000, 0x00000000, 0x00000000); 1158 &data_word(0x00000000, 0x00000000, 0x00000000, 0x00000000);
1159 &previous(); 1159 &previous();
1160 1160
1161# void aes_encrypt_internal(const void *inp, void *out, const AES_KEY *key); 1161# void aes_encrypt_generic(const void *inp, void *out, const AES_KEY *key);
1162&function_begin("aes_encrypt_internal"); 1162&function_begin("aes_encrypt_generic");
1163 &mov ($acc,&wparam(0)); # load inp 1163 &mov ($acc,&wparam(0)); # load inp
1164 &mov ($key,&wparam(2)); # load key 1164 &mov ($key,&wparam(2)); # load key
1165 1165
@@ -1213,7 +1213,7 @@ sub enclast()
1213 &mov (&DWP(4,$acc),$s1); 1213 &mov (&DWP(4,$acc),$s1);
1214 &mov (&DWP(8,$acc),$s2); 1214 &mov (&DWP(8,$acc),$s2);
1215 &mov (&DWP(12,$acc),$s3); 1215 &mov (&DWP(12,$acc),$s3);
1216&function_end("aes_encrypt_internal"); 1216&function_end("aes_encrypt_generic");
1217 1217
1218#--------------------------------------------------------------------# 1218#--------------------------------------------------------------------#
1219 1219
@@ -1947,8 +1947,8 @@ sub declast()
1947 &data_byte(0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d); 1947 &data_byte(0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d);
1948 &previous(); 1948 &previous();
1949 1949
1950# void aes_decrypt_internal(const void *inp, void *out, const AES_KEY *key); 1950# void aes_decrypt_generic(const void *inp, void *out, const AES_KEY *key);
1951&function_begin("aes_decrypt_internal"); 1951&function_begin("aes_decrypt_generic");
1952 &mov ($acc,&wparam(0)); # load inp 1952 &mov ($acc,&wparam(0)); # load inp
1953 &mov ($key,&wparam(2)); # load key 1953 &mov ($key,&wparam(2)); # load key
1954 1954
@@ -2002,9 +2002,9 @@ sub declast()
2002 &mov (&DWP(4,$acc),$s1); 2002 &mov (&DWP(4,$acc),$s1);
2003 &mov (&DWP(8,$acc),$s2); 2003 &mov (&DWP(8,$acc),$s2);
2004 &mov (&DWP(12,$acc),$s3); 2004 &mov (&DWP(12,$acc),$s3);
2005&function_end("aes_decrypt_internal"); 2005&function_end("aes_decrypt_generic");
2006 2006
2007# void aes_cbc_encrypt_internal(const void char *inp, unsigned char *out, 2007# void aes_cbc_encrypt_generic(const void char *inp, unsigned char *out,
2008# size_t length, const AES_KEY *key, unsigned char *ivp,const int enc); 2008# size_t length, const AES_KEY *key, unsigned char *ivp,const int enc);
2009{ 2009{
2010# stack frame layout 2010# stack frame layout
@@ -2028,7 +2028,7 @@ my $ivec=&DWP(60,"esp"); # ivec[16]
2028my $aes_key=&DWP(76,"esp"); # copy of aes_key 2028my $aes_key=&DWP(76,"esp"); # copy of aes_key
2029my $mark=&DWP(76+240,"esp"); # copy of aes_key->rounds 2029my $mark=&DWP(76+240,"esp"); # copy of aes_key->rounds
2030 2030
2031&function_begin("aes_cbc_encrypt_internal"); 2031&function_begin("aes_cbc_encrypt_generic");
2032 &mov ($s2 eq "ecx"? $s2 : "",&wparam(2)); # load len 2032 &mov ($s2 eq "ecx"? $s2 : "",&wparam(2)); # load len
2033 &cmp ($s2,0); 2033 &cmp ($s2,0);
2034 &je (&label("drop_out")); 2034 &je (&label("drop_out"));
@@ -2616,7 +2616,7 @@ my $mark=&DWP(76+240,"esp"); # copy of aes_key->rounds
2616 2616
2617 &mov ("esp",$_esp); 2617 &mov ("esp",$_esp);
2618 &popf (); 2618 &popf ();
2619&function_end("aes_cbc_encrypt_internal"); 2619&function_end("aes_cbc_encrypt_generic");
2620} 2620}
2621 2621
2622#------------------------------------------------------------------# 2622#------------------------------------------------------------------#
@@ -2849,12 +2849,12 @@ sub enckey()
2849 &set_label("exit"); 2849 &set_label("exit");
2850&function_end("_x86_AES_set_encrypt_key"); 2850&function_end("_x86_AES_set_encrypt_key");
2851 2851
2852# int aes_set_encrypt_key_internal(const unsigned char *userKey, const int bits, 2852# int aes_set_encrypt_key_generic(const unsigned char *userKey, const int bits,
2853# AES_KEY *key) 2853# AES_KEY *key)
2854&function_begin_B("aes_set_encrypt_key_internal"); 2854&function_begin_B("aes_set_encrypt_key_generic");
2855 &call ("_x86_AES_set_encrypt_key"); 2855 &call ("_x86_AES_set_encrypt_key");
2856 &ret (); 2856 &ret ();
2857&function_end_B("aes_set_encrypt_key_internal"); 2857&function_end_B("aes_set_encrypt_key_generic");
2858 2858
2859sub deckey() 2859sub deckey()
2860{ my ($i,$key,$tp1,$tp2,$tp4,$tp8) = @_; 2860{ my ($i,$key,$tp1,$tp2,$tp4,$tp8) = @_;
@@ -2911,9 +2911,9 @@ sub deckey()
2911 &mov (&DWP(4*$i,$key),$tp1); 2911 &mov (&DWP(4*$i,$key),$tp1);
2912} 2912}
2913 2913
2914# int aes_set_decrypt_key_internal(const unsigned char *userKey, const int bits, 2914# int aes_set_decrypt_key_generic(const unsigned char *userKey, const int bits,
2915# AES_KEY *key) 2915# AES_KEY *key)
2916&function_begin_B("aes_set_decrypt_key_internal"); 2916&function_begin_B("aes_set_decrypt_key_generic");
2917 &call ("_x86_AES_set_encrypt_key"); 2917 &call ("_x86_AES_set_encrypt_key");
2918 &cmp ("eax",0); 2918 &cmp ("eax",0);
2919 &je (&label("proceed")); 2919 &je (&label("proceed"));
@@ -2969,6 +2969,6 @@ sub deckey()
2969 &jb (&label("permute")); 2969 &jb (&label("permute"));
2970 2970
2971 &xor ("eax","eax"); # return success 2971 &xor ("eax","eax"); # return success
2972&function_end("aes_set_decrypt_key_internal"); 2972&function_end("aes_set_decrypt_key_generic");
2973 2973
2974&asm_finish(); 2974&asm_finish();
diff --git a/src/lib/libcrypto/aes/asm/aes-x86_64.pl b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
index 324c4a2be2..2c73627546 100755
--- a/src/lib/libcrypto/aes/asm/aes-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
@@ -586,15 +586,15 @@ $code.=<<___;
586.size _x86_64_AES_encrypt_compact,.-_x86_64_AES_encrypt_compact 586.size _x86_64_AES_encrypt_compact,.-_x86_64_AES_encrypt_compact
587___ 587___
588 588
589# void aes_encrypt_internal(const void *inp, void *out, const AES_KEY *key); 589# void aes_encrypt_generic(const void *inp, void *out, const AES_KEY *key);
590$code.=<<___; 590$code.=<<___;
591.globl aes_encrypt_internal 591.globl aes_encrypt_generic
592.type aes_encrypt_internal,\@function,3 592.type aes_encrypt_generic,\@function,3
593.align 16 593.align 16
594.globl asm_AES_encrypt 594.globl asm_AES_encrypt
595.hidden asm_AES_encrypt 595.hidden asm_AES_encrypt
596asm_AES_encrypt: 596asm_AES_encrypt:
597aes_encrypt_internal: 597aes_encrypt_generic:
598 _CET_ENDBR 598 _CET_ENDBR
599 push %rbx 599 push %rbx
600 push %rbp 600 push %rbp
@@ -655,7 +655,7 @@ aes_encrypt_internal:
655 lea 48(%rsi),%rsp 655 lea 48(%rsi),%rsp
656.Lenc_epilogue: 656.Lenc_epilogue:
657 ret 657 ret
658.size aes_encrypt_internal,.-aes_encrypt_internal 658.size aes_encrypt_generic,.-aes_encrypt_generic
659___ 659___
660 660
661#------------------------------------------------------------------# 661#------------------------------------------------------------------#
@@ -1188,15 +1188,15 @@ $code.=<<___;
1188.size _x86_64_AES_decrypt_compact,.-_x86_64_AES_decrypt_compact 1188.size _x86_64_AES_decrypt_compact,.-_x86_64_AES_decrypt_compact
1189___ 1189___
1190 1190
1191# void aes_decrypt_internal(const void *inp, void *out, const AES_KEY *key); 1191# void aes_decrypt_generic(const void *inp, void *out, const AES_KEY *key);
1192$code.=<<___; 1192$code.=<<___;
1193.globl aes_decrypt_internal 1193.globl aes_decrypt_generic
1194.type aes_decrypt_internal,\@function,3 1194.type aes_decrypt_generic,\@function,3
1195.align 16 1195.align 16
1196.globl asm_AES_decrypt 1196.globl asm_AES_decrypt
1197.hidden asm_AES_decrypt 1197.hidden asm_AES_decrypt
1198asm_AES_decrypt: 1198asm_AES_decrypt:
1199aes_decrypt_internal: 1199aes_decrypt_generic:
1200 _CET_ENDBR 1200 _CET_ENDBR
1201 push %rbx 1201 push %rbx
1202 push %rbp 1202 push %rbp
@@ -1259,7 +1259,7 @@ aes_decrypt_internal:
1259 lea 48(%rsi),%rsp 1259 lea 48(%rsi),%rsp
1260.Ldec_epilogue: 1260.Ldec_epilogue:
1261 ret 1261 ret
1262.size aes_decrypt_internal,.-aes_decrypt_internal 1262.size aes_decrypt_generic,.-aes_decrypt_generic
1263___ 1263___
1264#------------------------------------------------------------------# 1264#------------------------------------------------------------------#
1265 1265
@@ -1290,13 +1290,13 @@ $code.=<<___;
1290___ 1290___
1291} 1291}
1292 1292
1293# int aes_set_encrypt_key_internal(const unsigned char *userKey, const int bits, 1293# int aes_set_encrypt_key_generic(const unsigned char *userKey, const int bits,
1294# AES_KEY *key) 1294# AES_KEY *key)
1295$code.=<<___; 1295$code.=<<___;
1296.globl aes_set_encrypt_key_internal 1296.globl aes_set_encrypt_key_generic
1297.type aes_set_encrypt_key_internal,\@function,3 1297.type aes_set_encrypt_key_generic,\@function,3
1298.align 16 1298.align 16
1299aes_set_encrypt_key_internal: 1299aes_set_encrypt_key_generic:
1300 _CET_ENDBR 1300 _CET_ENDBR
1301 push %rbx 1301 push %rbx
1302 push %rbp 1302 push %rbp
@@ -1318,7 +1318,7 @@ aes_set_encrypt_key_internal:
1318 add \$56,%rsp 1318 add \$56,%rsp
1319.Lenc_key_epilogue: 1319.Lenc_key_epilogue:
1320 ret 1320 ret
1321.size aes_set_encrypt_key_internal,.-aes_set_encrypt_key_internal 1321.size aes_set_encrypt_key_generic,.-aes_set_encrypt_key_generic
1322 1322
1323.type _x86_64_AES_set_encrypt_key,\@abi-omnipotent 1323.type _x86_64_AES_set_encrypt_key,\@abi-omnipotent
1324.align 16 1324.align 16
@@ -1562,13 +1562,13 @@ $code.=<<___;
1562___ 1562___
1563} 1563}
1564 1564
1565# int aes_set_decrypt_key_internal(const unsigned char *userKey, const int bits, 1565# int aes_set_decrypt_key_generic(const unsigned char *userKey, const int bits,
1566# AES_KEY *key) 1566# AES_KEY *key)
1567$code.=<<___; 1567$code.=<<___;
1568.globl aes_set_decrypt_key_internal 1568.globl aes_set_decrypt_key_generic
1569.type aes_set_decrypt_key_internal,\@function,3 1569.type aes_set_decrypt_key_generic,\@function,3
1570.align 16 1570.align 16
1571aes_set_decrypt_key_internal: 1571aes_set_decrypt_key_generic:
1572 _CET_ENDBR 1572 _CET_ENDBR
1573 push %rbx 1573 push %rbx
1574 push %rbp 1574 push %rbp
@@ -1638,10 +1638,10 @@ $code.=<<___;
1638 add \$56,%rsp 1638 add \$56,%rsp
1639.Ldec_key_epilogue: 1639.Ldec_key_epilogue:
1640 ret 1640 ret
1641.size aes_set_decrypt_key_internal,.-aes_set_decrypt_key_internal 1641.size aes_set_decrypt_key_generic,.-aes_set_decrypt_key_generic
1642___ 1642___
1643 1643
1644# void aes_cbc_encrypt_internal(const void char *inp, unsigned char *out, 1644# void aes_cbc_encrypt_generic(const void char *inp, unsigned char *out,
1645# size_t length, const AES_KEY *key, unsigned char *ivp,const int enc); 1645# size_t length, const AES_KEY *key, unsigned char *ivp,const int enc);
1646{ 1646{
1647# stack frame layout 1647# stack frame layout
@@ -1659,15 +1659,15 @@ my $aes_key="80(%rsp)"; # copy of aes_key
1659my $mark="80+240(%rsp)"; # copy of aes_key->rounds 1659my $mark="80+240(%rsp)"; # copy of aes_key->rounds
1660 1660
1661$code.=<<___; 1661$code.=<<___;
1662.globl aes_cbc_encrypt_internal 1662.globl aes_cbc_encrypt_generic
1663.type aes_cbc_encrypt_internal,\@function,6 1663.type aes_cbc_encrypt_generic,\@function,6
1664.align 16 1664.align 16
1665.extern OPENSSL_ia32cap_P 1665.extern OPENSSL_ia32cap_P
1666.hidden OPENSSL_ia32cap_P 1666.hidden OPENSSL_ia32cap_P
1667.globl asm_AES_cbc_encrypt 1667.globl asm_AES_cbc_encrypt
1668.hidden asm_AES_cbc_encrypt 1668.hidden asm_AES_cbc_encrypt
1669asm_AES_cbc_encrypt: 1669asm_AES_cbc_encrypt:
1670aes_cbc_encrypt_internal: 1670aes_cbc_encrypt_generic:
1671 _CET_ENDBR 1671 _CET_ENDBR
1672 cmp \$0,%rdx # check length 1672 cmp \$0,%rdx # check length
1673 je .Lcbc_epilogue 1673 je .Lcbc_epilogue
@@ -2117,7 +2117,7 @@ aes_cbc_encrypt_internal:
2117 popfq 2117 popfq
2118.Lcbc_epilogue: 2118.Lcbc_epilogue:
2119 ret 2119 ret
2120.size aes_cbc_encrypt_internal,.-aes_cbc_encrypt_internal 2120.size aes_cbc_encrypt_generic,.-aes_cbc_encrypt_generic
2121___ 2121___
2122} 2122}
2123 2123
@@ -2782,45 +2782,45 @@ cbc_se_handler:
2782 2782
2783.section .pdata 2783.section .pdata
2784.align 4 2784.align 4
2785 .rva .LSEH_begin_aes_encrypt_internal 2785 .rva .LSEH_begin_aes_encrypt_generic
2786 .rva .LSEH_end_aes_encrypt_internal 2786 .rva .LSEH_end_aes_encrypt_generic
2787 .rva .LSEH_info_aes_encrypt_internal 2787 .rva .LSEH_info_aes_encrypt_generic
2788 2788
2789 .rva .LSEH_begin_aes_decrypt_internal 2789 .rva .LSEH_begin_aes_decrypt_generic
2790 .rva .LSEH_end_aes_decrypt_internal 2790 .rva .LSEH_end_aes_decrypt_generic
2791 .rva .LSEH_info_aes_decrypt_internal 2791 .rva .LSEH_info_aes_decrypt_generic
2792 2792
2793 .rva .LSEH_begin_aes_set_encrypt_key_internal 2793 .rva .LSEH_begin_aes_set_encrypt_key_generic
2794 .rva .LSEH_end_aes_set_encrypt_key_internal 2794 .rva .LSEH_end_aes_set_encrypt_key_generic
2795 .rva .LSEH_info_aes_set_encrypt_key_internal 2795 .rva .LSEH_info_aes_set_encrypt_key_generic
2796 2796
2797 .rva .LSEH_begin_aes_set_decrypt_key_internal 2797 .rva .LSEH_begin_aes_set_decrypt_key_generic
2798 .rva .LSEH_end_aes_set_decrypt_key_internal 2798 .rva .LSEH_end_aes_set_decrypt_key_generic
2799 .rva .LSEH_info_aes_set_decrypt_key_internal 2799 .rva .LSEH_info_aes_set_decrypt_key_generic
2800 2800
2801 .rva .LSEH_begin_aes_cbc_encrypt_internal 2801 .rva .LSEH_begin_aes_cbc_encrypt_generic
2802 .rva .LSEH_end_aes_cbc_encrypt_internal 2802 .rva .LSEH_end_aes_cbc_encrypt_generic
2803 .rva .LSEH_info_aes_cbc_encrypt_internal 2803 .rva .LSEH_info_aes_cbc_encrypt_generic
2804 2804
2805.section .xdata 2805.section .xdata
2806.align 8 2806.align 8
2807.LSEH_info_aes_encrypt_internal: 2807.LSEH_info_aes_encrypt_generic:
2808 .byte 9,0,0,0 2808 .byte 9,0,0,0
2809 .rva block_se_handler 2809 .rva block_se_handler
2810 .rva .Lenc_prologue,.Lenc_epilogue # HandlerData[] 2810 .rva .Lenc_prologue,.Lenc_epilogue # HandlerData[]
2811.LSEH_info_aes_decrypt_internal: 2811.LSEH_info_aes_decrypt_generic:
2812 .byte 9,0,0,0 2812 .byte 9,0,0,0
2813 .rva block_se_handler 2813 .rva block_se_handler
2814 .rva .Ldec_prologue,.Ldec_epilogue # HandlerData[] 2814 .rva .Ldec_prologue,.Ldec_epilogue # HandlerData[]
2815.LSEH_info_aes_set_encrypt_key_internal: 2815.LSEH_info_aes_set_encrypt_key_generic:
2816 .byte 9,0,0,0 2816 .byte 9,0,0,0
2817 .rva key_se_handler 2817 .rva key_se_handler
2818 .rva .Lenc_key_prologue,.Lenc_key_epilogue # HandlerData[] 2818 .rva .Lenc_key_prologue,.Lenc_key_epilogue # HandlerData[]
2819.LSEH_info_aes_set_decrypt_key_internal: 2819.LSEH_info_aes_set_decrypt_key_generic:
2820 .byte 9,0,0,0 2820 .byte 9,0,0,0
2821 .rva key_se_handler 2821 .rva key_se_handler
2822 .rva .Ldec_key_prologue,.Ldec_key_epilogue # HandlerData[] 2822 .rva .Ldec_key_prologue,.Ldec_key_epilogue # HandlerData[]
2823.LSEH_info_aes_cbc_encrypt_internal: 2823.LSEH_info_aes_cbc_encrypt_generic:
2824 .byte 9,0,0,0 2824 .byte 9,0,0,0
2825 .rva cbc_se_handler 2825 .rva cbc_se_handler
2826___ 2826___
diff --git a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
deleted file mode 100644
index c44a338114..0000000000
--- a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
+++ /dev/null
@@ -1,3123 +0,0 @@
1#!/usr/bin/env perl
2
3###################################################################
4### AES-128 [originally in CTR mode] ###
5### bitsliced implementation for Intel Core 2 processors ###
6### requires support of SSE extensions up to SSSE3 ###
7### Author: Emilia Käsper and Peter Schwabe ###
8### Date: 2009-03-19 ###
9### Public domain ###
10### ###
11### See http://homes.esat.kuleuven.be/~ekasper/#software for ###
12### further information. ###
13###################################################################
14#
15# September 2011.
16#
17# Started as transliteration to "perlasm" the original code has
18# undergone following changes:
19#
20# - code was made position-independent;
21# - rounds were folded into a loop resulting in >5x size reduction
22# from 12.5KB to 2.2KB;
23# - above was possible thanks to mixcolumns() modification that
24# allowed to feed its output back to aesenc[last], this was
25# achieved at cost of two additional inter-registers moves;
26# - some instruction reordering and interleaving;
27# - this module doesn't implement key setup subroutine, instead it
28# relies on conversion of "conventional" key schedule as returned
29# by AES_set_encrypt_key (see discussion below);
30# - first and last round keys are treated differently, which allowed
31# to skip one shiftrows(), reduce bit-sliced key schedule and
32# speed-up conversion by 22%;
33# - support for 192- and 256-bit keys was added;
34#
35# Resulting performance in CPU cycles spent to encrypt one byte out
36# of 4096-byte buffer with 128-bit key is:
37#
38# Emilia's this(*) difference
39#
40# Core 2 9.30 8.69 +7%
41# Nehalem(**) 7.63 6.98 +9%
42# Atom 17.1 17.4 -2%(***)
43#
44# (*) Comparison is not completely fair, because "this" is ECB,
45# i.e. no extra processing such as counter values calculation
46# and xor-ing input as in Emilia's CTR implementation is
47# performed. However, the CTR calculations stand for not more
48# than 1% of total time, so comparison is *rather* fair.
49#
50# (**) Results were collected on Westmere, which is considered to
51# be equivalent to Nehalem for this code.
52#
53# (***) Slowdown on Atom is rather strange per se, because original
54# implementation has a number of 9+-bytes instructions, which
55# are bad for Atom front-end, and which I eliminated completely.
56# In attempt to address deterioration sbox() was tested in FP
57# SIMD "domain" (movaps instead of movdqa, xorps instead of
58# pxor, etc.). While it resulted in nominal 4% improvement on
59# Atom, it hurted Westmere by more than 2x factor.
60#
61# As for key schedule conversion subroutine. Interface to OpenSSL
62# relies on per-invocation on-the-fly conversion. This naturally
63# has impact on performance, especially for short inputs. Conversion
64# time in CPU cycles and its ratio to CPU cycles spent in 8x block
65# function is:
66#
67# conversion conversion/8x block
68# Core 2 240 0.22
69# Nehalem 180 0.20
70# Atom 430 0.19
71#
72# The ratio values mean that 128-byte blocks will be processed
73# 16-18% slower, 256-byte blocks - 9-10%, 384-byte blocks - 6-7%,
74# etc. Then keep in mind that input sizes not divisible by 128 are
75# *effectively* slower, especially shortest ones, e.g. consecutive
76# 144-byte blocks are processed 44% slower than one would expect,
77# 272 - 29%, 400 - 22%, etc. Yet, despite all these "shortcomings"
78# it's still faster than ["hyper-threading-safe" code path in]
79# aes-x86_64.pl on all lengths above 64 bytes...
80#
81# October 2011.
82#
83# Add decryption procedure. Performance in CPU cycles spent to decrypt
84# one byte out of 4096-byte buffer with 128-bit key is:
85#
86# Core 2 9.83
87# Nehalem 7.74
88# Atom 19.0
89#
90# November 2011.
91#
92# Add bsaes_xts_[en|de]crypt. Less-than-80-bytes-block performance is
93# suboptimal, but XTS is meant to be used with larger blocks...
94#
95# <appro@openssl.org>
96
97$flavour = shift;
98$output = shift;
99if ($flavour =~ /\./) { $output = $flavour; undef $flavour; }
100
101$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
102
103$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
104( $xlate="${dir}x86_64-xlate.pl" and -f $xlate ) or
105( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
106die "can't locate x86_64-xlate.pl";
107
108open OUT,"| \"$^X\" $xlate $flavour $output";
109*STDOUT=*OUT;
110
111my ($inp,$out,$len,$key,$ivp)=("%rdi","%rsi","%rdx","%rcx");
112my @XMM=map("%xmm$_",(15,0..14)); # best on Atom, +10% over (0..15)
113my $ecb=0; # suppress unreferenced ECB subroutines, spare some space...
114
115{
116my ($key,$rounds,$const)=("%rax","%r10d","%r11");
117
118sub Sbox {
119# input in lsb > [b0, b1, b2, b3, b4, b5, b6, b7] < msb
120# output in lsb > [b0, b1, b4, b6, b3, b7, b2, b5] < msb
121my @b=@_[0..7];
122my @t=@_[8..11];
123my @s=@_[12..15];
124 &InBasisChange (@b);
125 &Inv_GF256 (@b[6,5,0,3,7,1,4,2],@t,@s);
126 &OutBasisChange (@b[7,1,4,2,6,5,0,3]);
127}
128
129sub InBasisChange {
130# input in lsb > [b0, b1, b2, b3, b4, b5, b6, b7] < msb
131# output in lsb > [b6, b5, b0, b3, b7, b1, b4, b2] < msb
132my @b=@_[0..7];
133$code.=<<___;
134 pxor @b[6], @b[5]
135 pxor @b[1], @b[2]
136 pxor @b[0], @b[3]
137 pxor @b[2], @b[6]
138 pxor @b[0], @b[5]
139
140 pxor @b[3], @b[6]
141 pxor @b[7], @b[3]
142 pxor @b[5], @b[7]
143 pxor @b[4], @b[3]
144 pxor @b[5], @b[4]
145 pxor @b[1], @b[3]
146
147 pxor @b[7], @b[2]
148 pxor @b[5], @b[1]
149___
150}
151
152sub OutBasisChange {
153# input in lsb > [b0, b1, b2, b3, b4, b5, b6, b7] < msb
154# output in lsb > [b6, b1, b2, b4, b7, b0, b3, b5] < msb
155my @b=@_[0..7];
156$code.=<<___;
157 pxor @b[6], @b[0]
158 pxor @b[4], @b[1]
159 pxor @b[0], @b[2]
160 pxor @b[6], @b[4]
161 pxor @b[1], @b[6]
162
163 pxor @b[5], @b[1]
164 pxor @b[3], @b[5]
165 pxor @b[7], @b[3]
166 pxor @b[5], @b[7]
167 pxor @b[5], @b[2]
168
169 pxor @b[7], @b[4]
170___
171}
172
173sub InvSbox {
174# input in lsb > [b0, b1, b2, b3, b4, b5, b6, b7] < msb
175# output in lsb > [b0, b1, b6, b4, b2, b7, b3, b5] < msb
176my @b=@_[0..7];
177my @t=@_[8..11];
178my @s=@_[12..15];
179 &InvInBasisChange (@b);
180 &Inv_GF256 (@b[5,1,2,6,3,7,0,4],@t,@s);
181 &InvOutBasisChange (@b[3,7,0,4,5,1,2,6]);
182}
183
184sub InvInBasisChange { # OutBasisChange in reverse
185my @b=@_[5,1,2,6,3,7,0,4];
186$code.=<<___
187 pxor @b[7], @b[4]
188
189 pxor @b[5], @b[7]
190 pxor @b[5], @b[2]
191 pxor @b[7], @b[3]
192 pxor @b[3], @b[5]
193 pxor @b[5], @b[1]
194
195 pxor @b[1], @b[6]
196 pxor @b[0], @b[2]
197 pxor @b[6], @b[4]
198 pxor @b[6], @b[0]
199 pxor @b[4], @b[1]
200___
201}
202
203sub InvOutBasisChange { # InBasisChange in reverse
204my @b=@_[2,5,7,3,6,1,0,4];
205$code.=<<___;
206 pxor @b[5], @b[1]
207 pxor @b[7], @b[2]
208
209 pxor @b[1], @b[3]
210 pxor @b[5], @b[4]
211 pxor @b[5], @b[7]
212 pxor @b[4], @b[3]
213 pxor @b[0], @b[5]
214 pxor @b[7], @b[3]
215 pxor @b[2], @b[6]
216 pxor @b[1], @b[2]
217 pxor @b[3], @b[6]
218
219 pxor @b[0], @b[3]
220 pxor @b[6], @b[5]
221___
222}
223
224sub Mul_GF4 {
225#;*************************************************************
226#;* Mul_GF4: Input x0-x1,y0-y1 Output x0-x1 Temp t0 (8) *
227#;*************************************************************
228my ($x0,$x1,$y0,$y1,$t0)=@_;
229$code.=<<___;
230 movdqa $y0, $t0
231 pxor $y1, $t0
232 pand $x0, $t0
233 pxor $x1, $x0
234 pand $y0, $x1
235 pand $y1, $x0
236 pxor $x1, $x0
237 pxor $t0, $x1
238___
239}
240
241sub Mul_GF4_N { # not used, see next subroutine
242# multiply and scale by N
243my ($x0,$x1,$y0,$y1,$t0)=@_;
244$code.=<<___;
245 movdqa $y0, $t0
246 pxor $y1, $t0
247 pand $x0, $t0
248 pxor $x1, $x0
249 pand $y0, $x1
250 pand $y1, $x0
251 pxor $x0, $x1
252 pxor $t0, $x0
253___
254}
255
256sub Mul_GF4_N_GF4 {
257# interleaved Mul_GF4_N and Mul_GF4
258my ($x0,$x1,$y0,$y1,$t0,
259 $x2,$x3,$y2,$y3,$t1)=@_;
260$code.=<<___;
261 movdqa $y0, $t0
262 movdqa $y2, $t1
263 pxor $y1, $t0
264 pxor $y3, $t1
265 pand $x0, $t0
266 pand $x2, $t1
267 pxor $x1, $x0
268 pxor $x3, $x2
269 pand $y0, $x1
270 pand $y2, $x3
271 pand $y1, $x0
272 pand $y3, $x2
273 pxor $x0, $x1
274 pxor $x3, $x2
275 pxor $t0, $x0
276 pxor $t1, $x3
277___
278}
279sub Mul_GF16_2 {
280my @x=@_[0..7];
281my @y=@_[8..11];
282my @t=@_[12..15];
283$code.=<<___;
284 movdqa @x[0], @t[0]
285 movdqa @x[1], @t[1]
286___
287 &Mul_GF4 (@x[0], @x[1], @y[0], @y[1], @t[2]);
288$code.=<<___;
289 pxor @x[2], @t[0]
290 pxor @x[3], @t[1]
291 pxor @y[2], @y[0]
292 pxor @y[3], @y[1]
293___
294 Mul_GF4_N_GF4 (@t[0], @t[1], @y[0], @y[1], @t[3],
295 @x[2], @x[3], @y[2], @y[3], @t[2]);
296$code.=<<___;
297 pxor @t[0], @x[0]
298 pxor @t[0], @x[2]
299 pxor @t[1], @x[1]
300 pxor @t[1], @x[3]
301
302 movdqa @x[4], @t[0]
303 movdqa @x[5], @t[1]
304 pxor @x[6], @t[0]
305 pxor @x[7], @t[1]
306___
307 &Mul_GF4_N_GF4 (@t[0], @t[1], @y[0], @y[1], @t[3],
308 @x[6], @x[7], @y[2], @y[3], @t[2]);
309$code.=<<___;
310 pxor @y[2], @y[0]
311 pxor @y[3], @y[1]
312___
313 &Mul_GF4 (@x[4], @x[5], @y[0], @y[1], @t[3]);
314$code.=<<___;
315 pxor @t[0], @x[4]
316 pxor @t[0], @x[6]
317 pxor @t[1], @x[5]
318 pxor @t[1], @x[7]
319___
320}
321sub Inv_GF256 {
322#;********************************************************************
323#;* Inv_GF256: Input x0-x7 Output x0-x7 Temp t0-t3,s0-s3 (144) *
324#;********************************************************************
325my @x=@_[0..7];
326my @t=@_[8..11];
327my @s=@_[12..15];
328# direct optimizations from hardware
329$code.=<<___;
330 movdqa @x[4], @t[3]
331 movdqa @x[5], @t[2]
332 movdqa @x[1], @t[1]
333 movdqa @x[7], @s[1]
334 movdqa @x[0], @s[0]
335
336 pxor @x[6], @t[3]
337 pxor @x[7], @t[2]
338 pxor @x[3], @t[1]
339 movdqa @t[3], @s[2]
340 pxor @x[6], @s[1]
341 movdqa @t[2], @t[0]
342 pxor @x[2], @s[0]
343 movdqa @t[3], @s[3]
344
345 por @t[1], @t[2]
346 por @s[0], @t[3]
347 pxor @t[0], @s[3]
348 pand @s[0], @s[2]
349 pxor @t[1], @s[0]
350 pand @t[1], @t[0]
351 pand @s[0], @s[3]
352 movdqa @x[3], @s[0]
353 pxor @x[2], @s[0]
354 pand @s[0], @s[1]
355 pxor @s[1], @t[3]
356 pxor @s[1], @t[2]
357 movdqa @x[4], @s[1]
358 movdqa @x[1], @s[0]
359 pxor @x[5], @s[1]
360 pxor @x[0], @s[0]
361 movdqa @s[1], @t[1]
362 pand @s[0], @s[1]
363 por @s[0], @t[1]
364 pxor @s[1], @t[0]
365 pxor @s[3], @t[3]
366 pxor @s[2], @t[2]
367 pxor @s[3], @t[1]
368 movdqa @x[7], @s[0]
369 pxor @s[2], @t[0]
370 movdqa @x[6], @s[1]
371 pxor @s[2], @t[1]
372 movdqa @x[5], @s[2]
373 pand @x[3], @s[0]
374 movdqa @x[4], @s[3]
375 pand @x[2], @s[1]
376 pand @x[1], @s[2]
377 por @x[0], @s[3]
378 pxor @s[0], @t[3]
379 pxor @s[1], @t[2]
380 pxor @s[2], @t[1]
381 pxor @s[3], @t[0]
382
383 #Inv_GF16 \t0, \t1, \t2, \t3, \s0, \s1, \s2, \s3
384
385 # new smaller inversion
386
387 movdqa @t[3], @s[0]
388 pand @t[1], @t[3]
389 pxor @t[2], @s[0]
390
391 movdqa @t[0], @s[2]
392 movdqa @s[0], @s[3]
393 pxor @t[3], @s[2]
394 pand @s[2], @s[3]
395
396 movdqa @t[1], @s[1]
397 pxor @t[2], @s[3]
398 pxor @t[0], @s[1]
399
400 pxor @t[2], @t[3]
401
402 pand @t[3], @s[1]
403
404 movdqa @s[2], @t[2]
405 pxor @t[0], @s[1]
406
407 pxor @s[1], @t[2]
408 pxor @s[1], @t[1]
409
410 pand @t[0], @t[2]
411
412 pxor @t[2], @s[2]
413 pxor @t[2], @t[1]
414
415 pand @s[3], @s[2]
416
417 pxor @s[0], @s[2]
418___
419# output in s3, s2, s1, t1
420
421# Mul_GF16_2 \x0, \x1, \x2, \x3, \x4, \x5, \x6, \x7, \t2, \t3, \t0, \t1, \s0, \s1, \s2, \s3
422
423# Mul_GF16_2 \x0, \x1, \x2, \x3, \x4, \x5, \x6, \x7, \s3, \s2, \s1, \t1, \s0, \t0, \t2, \t3
424 &Mul_GF16_2(@x,@s[3,2,1],@t[1],@s[0],@t[0,2,3]);
425
426### output msb > [x3,x2,x1,x0,x7,x6,x5,x4] < lsb
427}
428
429# AES linear components
430
431sub ShiftRows {
432my @x=@_[0..7];
433my $mask=pop;
434$code.=<<___;
435 pxor 0x00($key),@x[0]
436 pxor 0x10($key),@x[1]
437 pshufb $mask,@x[0]
438 pxor 0x20($key),@x[2]
439 pshufb $mask,@x[1]
440 pxor 0x30($key),@x[3]
441 pshufb $mask,@x[2]
442 pxor 0x40($key),@x[4]
443 pshufb $mask,@x[3]
444 pxor 0x50($key),@x[5]
445 pshufb $mask,@x[4]
446 pxor 0x60($key),@x[6]
447 pshufb $mask,@x[5]
448 pxor 0x70($key),@x[7]
449 pshufb $mask,@x[6]
450 lea 0x80($key),$key
451 pshufb $mask,@x[7]
452___
453}
454
455sub MixColumns {
456# modified to emit output in order suitable for feeding back to aesenc[last]
457my @x=@_[0..7];
458my @t=@_[8..15];
459my $inv=@_[16]; # optional
460$code.=<<___;
461 pshufd \$0x93, @x[0], @t[0] # x0 <<< 32
462 pshufd \$0x93, @x[1], @t[1]
463 pxor @t[0], @x[0] # x0 ^ (x0 <<< 32)
464 pshufd \$0x93, @x[2], @t[2]
465 pxor @t[1], @x[1]
466 pshufd \$0x93, @x[3], @t[3]
467 pxor @t[2], @x[2]
468 pshufd \$0x93, @x[4], @t[4]
469 pxor @t[3], @x[3]
470 pshufd \$0x93, @x[5], @t[5]
471 pxor @t[4], @x[4]
472 pshufd \$0x93, @x[6], @t[6]
473 pxor @t[5], @x[5]
474 pshufd \$0x93, @x[7], @t[7]
475 pxor @t[6], @x[6]
476 pxor @t[7], @x[7]
477
478 pxor @x[0], @t[1]
479 pxor @x[7], @t[0]
480 pxor @x[7], @t[1]
481 pshufd \$0x4E, @x[0], @x[0] # (x0 ^ (x0 <<< 32)) <<< 64)
482 pxor @x[1], @t[2]
483 pshufd \$0x4E, @x[1], @x[1]
484 pxor @x[4], @t[5]
485 pxor @t[0], @x[0]
486 pxor @x[5], @t[6]
487 pxor @t[1], @x[1]
488 pxor @x[3], @t[4]
489 pshufd \$0x4E, @x[4], @t[0]
490 pxor @x[6], @t[7]
491 pshufd \$0x4E, @x[5], @t[1]
492 pxor @x[2], @t[3]
493 pshufd \$0x4E, @x[3], @x[4]
494 pxor @x[7], @t[3]
495 pshufd \$0x4E, @x[7], @x[5]
496 pxor @x[7], @t[4]
497 pshufd \$0x4E, @x[6], @x[3]
498 pxor @t[4], @t[0]
499 pshufd \$0x4E, @x[2], @x[6]
500 pxor @t[5], @t[1]
501___
502$code.=<<___ if (!$inv);
503 pxor @t[3], @x[4]
504 pxor @t[7], @x[5]
505 pxor @t[6], @x[3]
506 movdqa @t[0], @x[2]
507 pxor @t[2], @x[6]
508 movdqa @t[1], @x[7]
509___
510$code.=<<___ if ($inv);
511 pxor @x[4], @t[3]
512 pxor @t[7], @x[5]
513 pxor @x[3], @t[6]
514 movdqa @t[0], @x[3]
515 pxor @t[2], @x[6]
516 movdqa @t[6], @x[2]
517 movdqa @t[1], @x[7]
518 movdqa @x[6], @x[4]
519 movdqa @t[3], @x[6]
520___
521}
522
523sub InvMixColumns_orig {
524my @x=@_[0..7];
525my @t=@_[8..15];
526
527$code.=<<___;
528 # multiplication by 0x0e
529 pshufd \$0x93, @x[7], @t[7]
530 movdqa @x[2], @t[2]
531 pxor @x[5], @x[7] # 7 5
532 pxor @x[5], @x[2] # 2 5
533 pshufd \$0x93, @x[0], @t[0]
534 movdqa @x[5], @t[5]
535 pxor @x[0], @x[5] # 5 0 [1]
536 pxor @x[1], @x[0] # 0 1
537 pshufd \$0x93, @x[1], @t[1]
538 pxor @x[2], @x[1] # 1 25
539 pxor @x[6], @x[0] # 01 6 [2]
540 pxor @x[3], @x[1] # 125 3 [4]
541 pshufd \$0x93, @x[3], @t[3]
542 pxor @x[0], @x[2] # 25 016 [3]
543 pxor @x[7], @x[3] # 3 75
544 pxor @x[6], @x[7] # 75 6 [0]
545 pshufd \$0x93, @x[6], @t[6]
546 movdqa @x[4], @t[4]
547 pxor @x[4], @x[6] # 6 4
548 pxor @x[3], @x[4] # 4 375 [6]
549 pxor @x[7], @x[3] # 375 756=36
550 pxor @t[5], @x[6] # 64 5 [7]
551 pxor @t[2], @x[3] # 36 2
552 pxor @t[4], @x[3] # 362 4 [5]
553 pshufd \$0x93, @t[5], @t[5]
554___
555 my @y = @x[7,5,0,2,1,3,4,6];
556$code.=<<___;
557 # multiplication by 0x0b
558 pxor @y[0], @y[1]
559 pxor @t[0], @y[0]
560 pxor @t[1], @y[1]
561 pshufd \$0x93, @t[2], @t[2]
562 pxor @t[5], @y[0]
563 pxor @t[6], @y[1]
564 pxor @t[7], @y[0]
565 pshufd \$0x93, @t[4], @t[4]
566 pxor @t[6], @t[7] # clobber t[7]
567 pxor @y[0], @y[1]
568
569 pxor @t[0], @y[3]
570 pshufd \$0x93, @t[0], @t[0]
571 pxor @t[1], @y[2]
572 pxor @t[1], @y[4]
573 pxor @t[2], @y[2]
574 pshufd \$0x93, @t[1], @t[1]
575 pxor @t[2], @y[3]
576 pxor @t[2], @y[5]
577 pxor @t[7], @y[2]
578 pshufd \$0x93, @t[2], @t[2]
579 pxor @t[3], @y[3]
580 pxor @t[3], @y[6]
581 pxor @t[3], @y[4]
582 pshufd \$0x93, @t[3], @t[3]
583 pxor @t[4], @y[7]
584 pxor @t[4], @y[5]
585 pxor @t[7], @y[7]
586 pxor @t[5], @y[3]
587 pxor @t[4], @y[4]
588 pxor @t[5], @t[7] # clobber t[7] even more
589
590 pxor @t[7], @y[5]
591 pshufd \$0x93, @t[4], @t[4]
592 pxor @t[7], @y[6]
593 pxor @t[7], @y[4]
594
595 pxor @t[5], @t[7]
596 pshufd \$0x93, @t[5], @t[5]
597 pxor @t[6], @t[7] # restore t[7]
598
599 # multiplication by 0x0d
600 pxor @y[7], @y[4]
601 pxor @t[4], @y[7]
602 pshufd \$0x93, @t[6], @t[6]
603 pxor @t[0], @y[2]
604 pxor @t[5], @y[7]
605 pxor @t[2], @y[2]
606 pshufd \$0x93, @t[7], @t[7]
607
608 pxor @y[1], @y[3]
609 pxor @t[1], @y[1]
610 pxor @t[0], @y[0]
611 pxor @t[0], @y[3]
612 pxor @t[5], @y[1]
613 pxor @t[5], @y[0]
614 pxor @t[7], @y[1]
615 pshufd \$0x93, @t[0], @t[0]
616 pxor @t[6], @y[0]
617 pxor @y[1], @y[3]
618 pxor @t[1], @y[4]
619 pshufd \$0x93, @t[1], @t[1]
620
621 pxor @t[7], @y[7]
622 pxor @t[2], @y[4]
623 pxor @t[2], @y[5]
624 pshufd \$0x93, @t[2], @t[2]
625 pxor @t[6], @y[2]
626 pxor @t[3], @t[6] # clobber t[6]
627 pxor @y[7], @y[4]
628 pxor @t[6], @y[3]
629
630 pxor @t[6], @y[6]
631 pxor @t[5], @y[5]
632 pxor @t[4], @y[6]
633 pshufd \$0x93, @t[4], @t[4]
634 pxor @t[6], @y[5]
635 pxor @t[7], @y[6]
636 pxor @t[3], @t[6] # restore t[6]
637
638 pshufd \$0x93, @t[5], @t[5]
639 pshufd \$0x93, @t[6], @t[6]
640 pshufd \$0x93, @t[7], @t[7]
641 pshufd \$0x93, @t[3], @t[3]
642
643 # multiplication by 0x09
644 pxor @y[1], @y[4]
645 pxor @y[1], @t[1] # t[1]=y[1]
646 pxor @t[5], @t[0] # clobber t[0]
647 pxor @t[5], @t[1]
648 pxor @t[0], @y[3]
649 pxor @y[0], @t[0] # t[0]=y[0]
650 pxor @t[6], @t[1]
651 pxor @t[7], @t[6] # clobber t[6]
652 pxor @t[1], @y[4]
653 pxor @t[4], @y[7]
654 pxor @y[4], @t[4] # t[4]=y[4]
655 pxor @t[3], @y[6]
656 pxor @y[3], @t[3] # t[3]=y[3]
657 pxor @t[2], @y[5]
658 pxor @y[2], @t[2] # t[2]=y[2]
659 pxor @t[7], @t[3]
660 pxor @y[5], @t[5] # t[5]=y[5]
661 pxor @t[6], @t[2]
662 pxor @t[6], @t[5]
663 pxor @y[6], @t[6] # t[6]=y[6]
664 pxor @y[7], @t[7] # t[7]=y[7]
665
666 movdqa @t[0],@XMM[0]
667 movdqa @t[1],@XMM[1]
668 movdqa @t[2],@XMM[2]
669 movdqa @t[3],@XMM[3]
670 movdqa @t[4],@XMM[4]
671 movdqa @t[5],@XMM[5]
672 movdqa @t[6],@XMM[6]
673 movdqa @t[7],@XMM[7]
674___
675}
676
677sub InvMixColumns {
678my @x=@_[0..7];
679my @t=@_[8..15];
680
681# Thanks to Jussi Kivilinna for providing pointer to
682#
683# | 0e 0b 0d 09 | | 02 03 01 01 | | 05 00 04 00 |
684# | 09 0e 0b 0d | = | 01 02 03 01 | x | 00 05 00 04 |
685# | 0d 09 0e 0b | | 01 01 02 03 | | 04 00 05 00 |
686# | 0b 0d 09 0e | | 03 01 01 02 | | 00 04 00 05 |
687
688$code.=<<___;
689 # multiplication by 0x05-0x00-0x04-0x00
690 pshufd \$0x4E, @x[0], @t[0]
691 pshufd \$0x4E, @x[6], @t[6]
692 pxor @x[0], @t[0]
693 pshufd \$0x4E, @x[7], @t[7]
694 pxor @x[6], @t[6]
695 pshufd \$0x4E, @x[1], @t[1]
696 pxor @x[7], @t[7]
697 pshufd \$0x4E, @x[2], @t[2]
698 pxor @x[1], @t[1]
699 pshufd \$0x4E, @x[3], @t[3]
700 pxor @x[2], @t[2]
701 pxor @t[6], @x[0]
702 pxor @t[6], @x[1]
703 pshufd \$0x4E, @x[4], @t[4]
704 pxor @x[3], @t[3]
705 pxor @t[0], @x[2]
706 pxor @t[1], @x[3]
707 pshufd \$0x4E, @x[5], @t[5]
708 pxor @x[4], @t[4]
709 pxor @t[7], @x[1]
710 pxor @t[2], @x[4]
711 pxor @x[5], @t[5]
712
713 pxor @t[7], @x[2]
714 pxor @t[6], @x[3]
715 pxor @t[6], @x[4]
716 pxor @t[3], @x[5]
717 pxor @t[4], @x[6]
718 pxor @t[7], @x[4]
719 pxor @t[7], @x[5]
720 pxor @t[5], @x[7]
721___
722 &MixColumns (@x,@t,1); # flipped 2<->3 and 4<->6
723}
724
725sub aesenc { # not used
726my @b=@_[0..7];
727my @t=@_[8..15];
728$code.=<<___;
729 movdqa 0x30($const),@t[0] # .LSR
730___
731 &ShiftRows (@b,@t[0]);
732 &Sbox (@b,@t);
733 &MixColumns (@b[0,1,4,6,3,7,2,5],@t);
734}
735
736sub aesenclast { # not used
737my @b=@_[0..7];
738my @t=@_[8..15];
739$code.=<<___;
740 movdqa 0x40($const),@t[0] # .LSRM0
741___
742 &ShiftRows (@b,@t[0]);
743 &Sbox (@b,@t);
744$code.=<<___
745 pxor 0x00($key),@b[0]
746 pxor 0x10($key),@b[1]
747 pxor 0x20($key),@b[4]
748 pxor 0x30($key),@b[6]
749 pxor 0x40($key),@b[3]
750 pxor 0x50($key),@b[7]
751 pxor 0x60($key),@b[2]
752 pxor 0x70($key),@b[5]
753___
754}
755
756sub swapmove {
757my ($a,$b,$n,$mask,$t)=@_;
758$code.=<<___;
759 movdqa $b,$t
760 psrlq \$$n,$b
761 pxor $a,$b
762 pand $mask,$b
763 pxor $b,$a
764 psllq \$$n,$b
765 pxor $t,$b
766___
767}
768sub swapmove2x {
769my ($a0,$b0,$a1,$b1,$n,$mask,$t0,$t1)=@_;
770$code.=<<___;
771 movdqa $b0,$t0
772 psrlq \$$n,$b0
773 movdqa $b1,$t1
774 psrlq \$$n,$b1
775 pxor $a0,$b0
776 pxor $a1,$b1
777 pand $mask,$b0
778 pand $mask,$b1
779 pxor $b0,$a0
780 psllq \$$n,$b0
781 pxor $b1,$a1
782 psllq \$$n,$b1
783 pxor $t0,$b0
784 pxor $t1,$b1
785___
786}
787
788sub bitslice {
789my @x=reverse(@_[0..7]);
790my ($t0,$t1,$t2,$t3)=@_[8..11];
791$code.=<<___;
792 movdqa 0x00($const),$t0 # .LBS0
793 movdqa 0x10($const),$t1 # .LBS1
794___
795 &swapmove2x(@x[0,1,2,3],1,$t0,$t2,$t3);
796 &swapmove2x(@x[4,5,6,7],1,$t0,$t2,$t3);
797$code.=<<___;
798 movdqa 0x20($const),$t0 # .LBS2
799___
800 &swapmove2x(@x[0,2,1,3],2,$t1,$t2,$t3);
801 &swapmove2x(@x[4,6,5,7],2,$t1,$t2,$t3);
802
803 &swapmove2x(@x[0,4,1,5],4,$t0,$t2,$t3);
804 &swapmove2x(@x[2,6,3,7],4,$t0,$t2,$t3);
805}
806
807$code.=<<___;
808.text
809
810.extern asm_AES_encrypt
811.extern asm_AES_decrypt
812
813.type _bsaes_encrypt8,\@abi-omnipotent
814.align 64
815_bsaes_encrypt8:
816 _CET_ENDBR
817 lea .LBS0(%rip), $const # constants table
818
819 movdqa ($key), @XMM[9] # round 0 key
820 lea 0x10($key), $key
821 movdqa 0x50($const), @XMM[8] # .LM0SR
822 pxor @XMM[9], @XMM[0] # xor with round0 key
823 pxor @XMM[9], @XMM[1]
824 pshufb @XMM[8], @XMM[0]
825 pxor @XMM[9], @XMM[2]
826 pshufb @XMM[8], @XMM[1]
827 pxor @XMM[9], @XMM[3]
828 pshufb @XMM[8], @XMM[2]
829 pxor @XMM[9], @XMM[4]
830 pshufb @XMM[8], @XMM[3]
831 pxor @XMM[9], @XMM[5]
832 pshufb @XMM[8], @XMM[4]
833 pxor @XMM[9], @XMM[6]
834 pshufb @XMM[8], @XMM[5]
835 pxor @XMM[9], @XMM[7]
836 pshufb @XMM[8], @XMM[6]
837 pshufb @XMM[8], @XMM[7]
838_bsaes_encrypt8_bitslice:
839___
840 &bitslice (@XMM[0..7, 8..11]);
841$code.=<<___;
842 dec $rounds
843 jmp .Lenc_sbox
844.align 16
845.Lenc_loop:
846___
847 &ShiftRows (@XMM[0..7, 8]);
848$code.=".Lenc_sbox:\n";
849 &Sbox (@XMM[0..7, 8..15]);
850$code.=<<___;
851 dec $rounds
852 jl .Lenc_done
853___
854 &MixColumns (@XMM[0,1,4,6,3,7,2,5, 8..15]);
855$code.=<<___;
856 movdqa 0x30($const), @XMM[8] # .LSR
857 jnz .Lenc_loop
858 movdqa 0x40($const), @XMM[8] # .LSRM0
859 jmp .Lenc_loop
860.align 16
861.Lenc_done:
862___
863 # output in lsb > [t0, t1, t4, t6, t3, t7, t2, t5] < msb
864 &bitslice (@XMM[0,1,4,6,3,7,2,5, 8..11]);
865$code.=<<___;
866 movdqa ($key), @XMM[8] # last round key
867 pxor @XMM[8], @XMM[4]
868 pxor @XMM[8], @XMM[6]
869 pxor @XMM[8], @XMM[3]
870 pxor @XMM[8], @XMM[7]
871 pxor @XMM[8], @XMM[2]
872 pxor @XMM[8], @XMM[5]
873 pxor @XMM[8], @XMM[0]
874 pxor @XMM[8], @XMM[1]
875 ret
876.size _bsaes_encrypt8,.-_bsaes_encrypt8
877
878.type _bsaes_decrypt8,\@abi-omnipotent
879.align 64
880_bsaes_decrypt8:
881 _CET_ENDBR
882 lea .LBS0(%rip), $const # constants table
883
884 movdqa ($key), @XMM[9] # round 0 key
885 lea 0x10($key), $key
886 movdqa -0x30($const), @XMM[8] # .LM0ISR
887 pxor @XMM[9], @XMM[0] # xor with round0 key
888 pxor @XMM[9], @XMM[1]
889 pshufb @XMM[8], @XMM[0]
890 pxor @XMM[9], @XMM[2]
891 pshufb @XMM[8], @XMM[1]
892 pxor @XMM[9], @XMM[3]
893 pshufb @XMM[8], @XMM[2]
894 pxor @XMM[9], @XMM[4]
895 pshufb @XMM[8], @XMM[3]
896 pxor @XMM[9], @XMM[5]
897 pshufb @XMM[8], @XMM[4]
898 pxor @XMM[9], @XMM[6]
899 pshufb @XMM[8], @XMM[5]
900 pxor @XMM[9], @XMM[7]
901 pshufb @XMM[8], @XMM[6]
902 pshufb @XMM[8], @XMM[7]
903___
904 &bitslice (@XMM[0..7, 8..11]);
905$code.=<<___;
906 dec $rounds
907 jmp .Ldec_sbox
908.align 16
909.Ldec_loop:
910___
911 &ShiftRows (@XMM[0..7, 8]);
912$code.=".Ldec_sbox:\n";
913 &InvSbox (@XMM[0..7, 8..15]);
914$code.=<<___;
915 dec $rounds
916 jl .Ldec_done
917___
918 &InvMixColumns (@XMM[0,1,6,4,2,7,3,5, 8..15]);
919$code.=<<___;
920 movdqa -0x10($const), @XMM[8] # .LISR
921 jnz .Ldec_loop
922 movdqa -0x20($const), @XMM[8] # .LISRM0
923 jmp .Ldec_loop
924.align 16
925.Ldec_done:
926___
927 &bitslice (@XMM[0,1,6,4,2,7,3,5, 8..11]);
928$code.=<<___;
929 movdqa ($key), @XMM[8] # last round key
930 pxor @XMM[8], @XMM[6]
931 pxor @XMM[8], @XMM[4]
932 pxor @XMM[8], @XMM[2]
933 pxor @XMM[8], @XMM[7]
934 pxor @XMM[8], @XMM[3]
935 pxor @XMM[8], @XMM[5]
936 pxor @XMM[8], @XMM[0]
937 pxor @XMM[8], @XMM[1]
938 ret
939.size _bsaes_decrypt8,.-_bsaes_decrypt8
940___
941}
942{
943my ($out,$inp,$rounds,$const)=("%rax","%rcx","%r10d","%r11");
944
945sub bitslice_key {
946my @x=reverse(@_[0..7]);
947my ($bs0,$bs1,$bs2,$t2,$t3)=@_[8..12];
948
949 &swapmove (@x[0,1],1,$bs0,$t2,$t3);
950$code.=<<___;
951 #&swapmove(@x[2,3],1,$t0,$t2,$t3);
952 movdqa @x[0], @x[2]
953 movdqa @x[1], @x[3]
954___
955 #&swapmove2x(@x[4,5,6,7],1,$t0,$t2,$t3);
956
957 &swapmove2x (@x[0,2,1,3],2,$bs1,$t2,$t3);
958$code.=<<___;
959 #&swapmove2x(@x[4,6,5,7],2,$t1,$t2,$t3);
960 movdqa @x[0], @x[4]
961 movdqa @x[2], @x[6]
962 movdqa @x[1], @x[5]
963 movdqa @x[3], @x[7]
964___
965 &swapmove2x (@x[0,4,1,5],4,$bs2,$t2,$t3);
966 &swapmove2x (@x[2,6,3,7],4,$bs2,$t2,$t3);
967}
968
969$code.=<<___;
970.type _bsaes_key_convert,\@abi-omnipotent
971.align 16
972_bsaes_key_convert:
973 _CET_ENDBR
974 lea .Lmasks(%rip), $const
975 movdqu ($inp), %xmm7 # load round 0 key
976 lea 0x10($inp), $inp
977 movdqa 0x00($const), %xmm0 # 0x01...
978 movdqa 0x10($const), %xmm1 # 0x02...
979 movdqa 0x20($const), %xmm2 # 0x04...
980 movdqa 0x30($const), %xmm3 # 0x08...
981 movdqa 0x40($const), %xmm4 # .LM0
982 pcmpeqd %xmm5, %xmm5 # .LNOT
983
984 movdqu ($inp), %xmm6 # load round 1 key
985 movdqa %xmm7, ($out) # save round 0 key
986 lea 0x10($out), $out
987 dec $rounds
988 jmp .Lkey_loop
989.align 16
990.Lkey_loop:
991 pshufb %xmm4, %xmm6 # .LM0
992
993 movdqa %xmm0, %xmm8
994 movdqa %xmm1, %xmm9
995
996 pand %xmm6, %xmm8
997 pand %xmm6, %xmm9
998 movdqa %xmm2, %xmm10
999 pcmpeqb %xmm0, %xmm8
1000 psllq \$4, %xmm0 # 0x10...
1001 movdqa %xmm3, %xmm11
1002 pcmpeqb %xmm1, %xmm9
1003 psllq \$4, %xmm1 # 0x20...
1004
1005 pand %xmm6, %xmm10
1006 pand %xmm6, %xmm11
1007 movdqa %xmm0, %xmm12
1008 pcmpeqb %xmm2, %xmm10
1009 psllq \$4, %xmm2 # 0x40...
1010 movdqa %xmm1, %xmm13
1011 pcmpeqb %xmm3, %xmm11
1012 psllq \$4, %xmm3 # 0x80...
1013
1014 movdqa %xmm2, %xmm14
1015 movdqa %xmm3, %xmm15
1016 pxor %xmm5, %xmm8 # "pnot"
1017 pxor %xmm5, %xmm9
1018
1019 pand %xmm6, %xmm12
1020 pand %xmm6, %xmm13
1021 movdqa %xmm8, 0x00($out) # write bit-sliced round key
1022 pcmpeqb %xmm0, %xmm12
1023 psrlq \$4, %xmm0 # 0x01...
1024 movdqa %xmm9, 0x10($out)
1025 pcmpeqb %xmm1, %xmm13
1026 psrlq \$4, %xmm1 # 0x02...
1027 lea 0x10($inp), $inp
1028
1029 pand %xmm6, %xmm14
1030 pand %xmm6, %xmm15
1031 movdqa %xmm10, 0x20($out)
1032 pcmpeqb %xmm2, %xmm14
1033 psrlq \$4, %xmm2 # 0x04...
1034 movdqa %xmm11, 0x30($out)
1035 pcmpeqb %xmm3, %xmm15
1036 psrlq \$4, %xmm3 # 0x08...
1037 movdqu ($inp), %xmm6 # load next round key
1038
1039 pxor %xmm5, %xmm13 # "pnot"
1040 pxor %xmm5, %xmm14
1041 movdqa %xmm12, 0x40($out)
1042 movdqa %xmm13, 0x50($out)
1043 movdqa %xmm14, 0x60($out)
1044 movdqa %xmm15, 0x70($out)
1045 lea 0x80($out),$out
1046 dec $rounds
1047 jnz .Lkey_loop
1048
1049 movdqa 0x50($const), %xmm7 # .L63
1050 #movdqa %xmm6, ($out) # don't save last round key
1051 ret
1052.size _bsaes_key_convert,.-_bsaes_key_convert
1053___
1054}
1055
1056if (0 && !$win64) { # following four functions are unsupported interface
1057 # used for benchmarking...
1058$code.=<<___;
1059.globl bsaes_enc_key_convert
1060.type bsaes_enc_key_convert,\@function,2
1061.align 16
1062bsaes_enc_key_convert:
1063 _CET_ENDBR
1064 mov 240($inp),%r10d # pass rounds
1065 mov $inp,%rcx # pass key
1066 mov $out,%rax # pass key schedule
1067 call _bsaes_key_convert
1068 pxor %xmm6,%xmm7 # fix up last round key
1069 movdqa %xmm7,(%rax) # save last round key
1070 ret
1071.size bsaes_enc_key_convert,.-bsaes_enc_key_convert
1072
1073.globl bsaes_encrypt_128
1074.type bsaes_encrypt_128,\@function,4
1075.align 16
1076bsaes_encrypt_128:
1077.Lenc128_loop:
1078 _CET_ENDBR
1079 movdqu 0x00($inp), @XMM[0] # load input
1080 movdqu 0x10($inp), @XMM[1]
1081 movdqu 0x20($inp), @XMM[2]
1082 movdqu 0x30($inp), @XMM[3]
1083 movdqu 0x40($inp), @XMM[4]
1084 movdqu 0x50($inp), @XMM[5]
1085 movdqu 0x60($inp), @XMM[6]
1086 movdqu 0x70($inp), @XMM[7]
1087 mov $key, %rax # pass the $key
1088 lea 0x80($inp), $inp
1089 mov \$10,%r10d
1090
1091 call _bsaes_encrypt8
1092
1093 movdqu @XMM[0], 0x00($out) # write output
1094 movdqu @XMM[1], 0x10($out)
1095 movdqu @XMM[4], 0x20($out)
1096 movdqu @XMM[6], 0x30($out)
1097 movdqu @XMM[3], 0x40($out)
1098 movdqu @XMM[7], 0x50($out)
1099 movdqu @XMM[2], 0x60($out)
1100 movdqu @XMM[5], 0x70($out)
1101 lea 0x80($out), $out
1102 sub \$0x80,$len
1103 ja .Lenc128_loop
1104 ret
1105.size bsaes_encrypt_128,.-bsaes_encrypt_128
1106
1107.globl bsaes_dec_key_convert
1108.type bsaes_dec_key_convert,\@function,2
1109.align 16
1110bsaes_dec_key_convert:
1111 _CET_ENDBR
1112 mov 240($inp),%r10d # pass rounds
1113 mov $inp,%rcx # pass key
1114 mov $out,%rax # pass key schedule
1115 call _bsaes_key_convert
1116 pxor ($out),%xmm7 # fix up round 0 key
1117 movdqa %xmm6,(%rax) # save last round key
1118 movdqa %xmm7,($out)
1119 ret
1120.size bsaes_dec_key_convert,.-bsaes_dec_key_convert
1121
1122.globl bsaes_decrypt_128
1123.type bsaes_decrypt_128,\@function,4
1124.align 16
1125bsaes_decrypt_128:
1126 _CET_ENDBR
1127.Ldec128_loop:
1128 movdqu 0x00($inp), @XMM[0] # load input
1129 movdqu 0x10($inp), @XMM[1]
1130 movdqu 0x20($inp), @XMM[2]
1131 movdqu 0x30($inp), @XMM[3]
1132 movdqu 0x40($inp), @XMM[4]
1133 movdqu 0x50($inp), @XMM[5]
1134 movdqu 0x60($inp), @XMM[6]
1135 movdqu 0x70($inp), @XMM[7]
1136 mov $key, %rax # pass the $key
1137 lea 0x80($inp), $inp
1138 mov \$10,%r10d
1139
1140 call _bsaes_decrypt8
1141
1142 movdqu @XMM[0], 0x00($out) # write output
1143 movdqu @XMM[1], 0x10($out)
1144 movdqu @XMM[6], 0x20($out)
1145 movdqu @XMM[4], 0x30($out)
1146 movdqu @XMM[2], 0x40($out)
1147 movdqu @XMM[7], 0x50($out)
1148 movdqu @XMM[3], 0x60($out)
1149 movdqu @XMM[5], 0x70($out)
1150 lea 0x80($out), $out
1151 sub \$0x80,$len
1152 ja .Ldec128_loop
1153 ret
1154.size bsaes_decrypt_128,.-bsaes_decrypt_128
1155___
1156}
1157{
1158######################################################################
1159#
1160# OpenSSL interface
1161#
1162my ($arg1,$arg2,$arg3,$arg4,$arg5,$arg6)=$win64 ? ("%rcx","%rdx","%r8","%r9","%r10","%r11d")
1163 : ("%rdi","%rsi","%rdx","%rcx","%r8","%r9d");
1164my ($inp,$out,$len,$key)=("%r12","%r13","%r14","%r15");
1165
1166if ($ecb) {
1167$code.=<<___;
1168.globl bsaes_ecb_encrypt_blocks
1169.type bsaes_ecb_encrypt_blocks,\@abi-omnipotent
1170.align 16
1171bsaes_ecb_encrypt_blocks:
1172 _CET_ENDBR
1173 mov %rsp, %rax
1174.Lecb_enc_prologue:
1175 push %rbp
1176 push %rbx
1177 push %r12
1178 push %r13
1179 push %r14
1180 push %r15
1181 lea -0x48(%rsp),%rsp
1182___
1183$code.=<<___ if ($win64);
1184 lea -0xa0(%rsp), %rsp
1185 movaps %xmm6, 0x40(%rsp)
1186 movaps %xmm7, 0x50(%rsp)
1187 movaps %xmm8, 0x60(%rsp)
1188 movaps %xmm9, 0x70(%rsp)
1189 movaps %xmm10, 0x80(%rsp)
1190 movaps %xmm11, 0x90(%rsp)
1191 movaps %xmm12, 0xa0(%rsp)
1192 movaps %xmm13, 0xb0(%rsp)
1193 movaps %xmm14, 0xc0(%rsp)
1194 movaps %xmm15, 0xd0(%rsp)
1195.Lecb_enc_body:
1196___
1197$code.=<<___;
1198 mov %rsp,%rbp # backup %rsp
1199 mov 240($arg4),%eax # rounds
1200 mov $arg1,$inp # backup arguments
1201 mov $arg2,$out
1202 mov $arg3,$len
1203 mov $arg4,$key
1204 cmp \$8,$arg3
1205 jb .Lecb_enc_short
1206
1207 mov %eax,%ebx # backup rounds
1208 shl \$7,%rax # 128 bytes per inner round key
1209 sub \$`128-32`,%rax # size of bit-sliced key schedule
1210 sub %rax,%rsp
1211 mov %rsp,%rax # pass key schedule
1212 mov $key,%rcx # pass key
1213 mov %ebx,%r10d # pass rounds
1214 call _bsaes_key_convert
1215 pxor %xmm6,%xmm7 # fix up last round key
1216 movdqa %xmm7,(%rax) # save last round key
1217
1218 sub \$8,$len
1219.Lecb_enc_loop:
1220 movdqu 0x00($inp), @XMM[0] # load input
1221 movdqu 0x10($inp), @XMM[1]
1222 movdqu 0x20($inp), @XMM[2]
1223 movdqu 0x30($inp), @XMM[3]
1224 movdqu 0x40($inp), @XMM[4]
1225 movdqu 0x50($inp), @XMM[5]
1226 mov %rsp, %rax # pass key schedule
1227 movdqu 0x60($inp), @XMM[6]
1228 mov %ebx,%r10d # pass rounds
1229 movdqu 0x70($inp), @XMM[7]
1230 lea 0x80($inp), $inp
1231
1232 call _bsaes_encrypt8
1233
1234 movdqu @XMM[0], 0x00($out) # write output
1235 movdqu @XMM[1], 0x10($out)
1236 movdqu @XMM[4], 0x20($out)
1237 movdqu @XMM[6], 0x30($out)
1238 movdqu @XMM[3], 0x40($out)
1239 movdqu @XMM[7], 0x50($out)
1240 movdqu @XMM[2], 0x60($out)
1241 movdqu @XMM[5], 0x70($out)
1242 lea 0x80($out), $out
1243 sub \$8,$len
1244 jnc .Lecb_enc_loop
1245
1246 add \$8,$len
1247 jz .Lecb_enc_done
1248
1249 movdqu 0x00($inp), @XMM[0] # load input
1250 mov %rsp, %rax # pass key schedule
1251 mov %ebx,%r10d # pass rounds
1252 cmp \$2,$len
1253 jb .Lecb_enc_one
1254 movdqu 0x10($inp), @XMM[1]
1255 je .Lecb_enc_two
1256 movdqu 0x20($inp), @XMM[2]
1257 cmp \$4,$len
1258 jb .Lecb_enc_three
1259 movdqu 0x30($inp), @XMM[3]
1260 je .Lecb_enc_four
1261 movdqu 0x40($inp), @XMM[4]
1262 cmp \$6,$len
1263 jb .Lecb_enc_five
1264 movdqu 0x50($inp), @XMM[5]
1265 je .Lecb_enc_six
1266 movdqu 0x60($inp), @XMM[6]
1267 call _bsaes_encrypt8
1268 movdqu @XMM[0], 0x00($out) # write output
1269 movdqu @XMM[1], 0x10($out)
1270 movdqu @XMM[4], 0x20($out)
1271 movdqu @XMM[6], 0x30($out)
1272 movdqu @XMM[3], 0x40($out)
1273 movdqu @XMM[7], 0x50($out)
1274 movdqu @XMM[2], 0x60($out)
1275 jmp .Lecb_enc_done
1276.align 16
1277.Lecb_enc_six:
1278 call _bsaes_encrypt8
1279 movdqu @XMM[0], 0x00($out) # write output
1280 movdqu @XMM[1], 0x10($out)
1281 movdqu @XMM[4], 0x20($out)
1282 movdqu @XMM[6], 0x30($out)
1283 movdqu @XMM[3], 0x40($out)
1284 movdqu @XMM[7], 0x50($out)
1285 jmp .Lecb_enc_done
1286.align 16
1287.Lecb_enc_five:
1288 call _bsaes_encrypt8
1289 movdqu @XMM[0], 0x00($out) # write output
1290 movdqu @XMM[1], 0x10($out)
1291 movdqu @XMM[4], 0x20($out)
1292 movdqu @XMM[6], 0x30($out)
1293 movdqu @XMM[3], 0x40($out)
1294 jmp .Lecb_enc_done
1295.align 16
1296.Lecb_enc_four:
1297 call _bsaes_encrypt8
1298 movdqu @XMM[0], 0x00($out) # write output
1299 movdqu @XMM[1], 0x10($out)
1300 movdqu @XMM[4], 0x20($out)
1301 movdqu @XMM[6], 0x30($out)
1302 jmp .Lecb_enc_done
1303.align 16
1304.Lecb_enc_three:
1305 call _bsaes_encrypt8
1306 movdqu @XMM[0], 0x00($out) # write output
1307 movdqu @XMM[1], 0x10($out)
1308 movdqu @XMM[4], 0x20($out)
1309 jmp .Lecb_enc_done
1310.align 16
1311.Lecb_enc_two:
1312 call _bsaes_encrypt8
1313 movdqu @XMM[0], 0x00($out) # write output
1314 movdqu @XMM[1], 0x10($out)
1315 jmp .Lecb_enc_done
1316.align 16
1317.Lecb_enc_one:
1318 call _bsaes_encrypt8
1319 movdqu @XMM[0], 0x00($out) # write output
1320 jmp .Lecb_enc_done
1321.align 16
1322.Lecb_enc_short:
1323 lea ($inp), $arg1
1324 lea ($out), $arg2
1325 lea ($key), $arg3
1326 call asm_AES_encrypt
1327 lea 16($inp), $inp
1328 lea 16($out), $out
1329 dec $len
1330 jnz .Lecb_enc_short
1331
1332.Lecb_enc_done:
1333 lea (%rsp),%rax
1334 pxor %xmm0, %xmm0
1335.Lecb_enc_bzero: # wipe key schedule [if any]
1336 movdqa %xmm0, 0x00(%rax)
1337 movdqa %xmm0, 0x10(%rax)
1338 lea 0x20(%rax), %rax
1339 cmp %rax, %rbp
1340 jb .Lecb_enc_bzero
1341
1342 lea (%rbp),%rsp # restore %rsp
1343___
1344$code.=<<___ if ($win64);
1345 movaps 0x40(%rbp), %xmm6
1346 movaps 0x50(%rbp), %xmm7
1347 movaps 0x60(%rbp), %xmm8
1348 movaps 0x70(%rbp), %xmm9
1349 movaps 0x80(%rbp), %xmm10
1350 movaps 0x90(%rbp), %xmm11
1351 movaps 0xa0(%rbp), %xmm12
1352 movaps 0xb0(%rbp), %xmm13
1353 movaps 0xc0(%rbp), %xmm14
1354 movaps 0xd0(%rbp), %xmm15
1355 lea 0xa0(%rbp), %rsp
1356___
1357$code.=<<___;
1358 mov 0x48(%rsp), %r15
1359 mov 0x50(%rsp), %r14
1360 mov 0x58(%rsp), %r13
1361 mov 0x60(%rsp), %r12
1362 mov 0x68(%rsp), %rbx
1363 mov 0x70(%rsp), %rax
1364 lea 0x78(%rsp), %rsp
1365 mov %rax, %rbp
1366.Lecb_enc_epilogue:
1367 ret
1368.size bsaes_ecb_encrypt_blocks,.-bsaes_ecb_encrypt_blocks
1369
1370.globl bsaes_ecb_decrypt_blocks
1371.type bsaes_ecb_decrypt_blocks,\@abi-omnipotent
1372.align 16
1373bsaes_ecb_decrypt_blocks:
1374 _CET_ENDBR
1375 mov %rsp, %rax
1376.Lecb_dec_prologue:
1377 push %rbp
1378 push %rbx
1379 push %r12
1380 push %r13
1381 push %r14
1382 push %r15
1383 lea -0x48(%rsp),%rsp
1384___
1385$code.=<<___ if ($win64);
1386 lea -0xa0(%rsp), %rsp
1387 movaps %xmm6, 0x40(%rsp)
1388 movaps %xmm7, 0x50(%rsp)
1389 movaps %xmm8, 0x60(%rsp)
1390 movaps %xmm9, 0x70(%rsp)
1391 movaps %xmm10, 0x80(%rsp)
1392 movaps %xmm11, 0x90(%rsp)
1393 movaps %xmm12, 0xa0(%rsp)
1394 movaps %xmm13, 0xb0(%rsp)
1395 movaps %xmm14, 0xc0(%rsp)
1396 movaps %xmm15, 0xd0(%rsp)
1397.Lecb_dec_body:
1398___
1399$code.=<<___;
1400 mov %rsp,%rbp # backup %rsp
1401 mov 240($arg4),%eax # rounds
1402 mov $arg1,$inp # backup arguments
1403 mov $arg2,$out
1404 mov $arg3,$len
1405 mov $arg4,$key
1406 cmp \$8,$arg3
1407 jb .Lecb_dec_short
1408
1409 mov %eax,%ebx # backup rounds
1410 shl \$7,%rax # 128 bytes per inner round key
1411 sub \$`128-32`,%rax # size of bit-sliced key schedule
1412 sub %rax,%rsp
1413 mov %rsp,%rax # pass key schedule
1414 mov $key,%rcx # pass key
1415 mov %ebx,%r10d # pass rounds
1416 call _bsaes_key_convert
1417 pxor (%rsp),%xmm7 # fix up 0 round key
1418 movdqa %xmm6,(%rax) # save last round key
1419 movdqa %xmm7,(%rsp)
1420
1421 sub \$8,$len
1422.Lecb_dec_loop:
1423 movdqu 0x00($inp), @XMM[0] # load input
1424 movdqu 0x10($inp), @XMM[1]
1425 movdqu 0x20($inp), @XMM[2]
1426 movdqu 0x30($inp), @XMM[3]
1427 movdqu 0x40($inp), @XMM[4]
1428 movdqu 0x50($inp), @XMM[5]
1429 mov %rsp, %rax # pass key schedule
1430 movdqu 0x60($inp), @XMM[6]
1431 mov %ebx,%r10d # pass rounds
1432 movdqu 0x70($inp), @XMM[7]
1433 lea 0x80($inp), $inp
1434
1435 call _bsaes_decrypt8
1436
1437 movdqu @XMM[0], 0x00($out) # write output
1438 movdqu @XMM[1], 0x10($out)
1439 movdqu @XMM[6], 0x20($out)
1440 movdqu @XMM[4], 0x30($out)
1441 movdqu @XMM[2], 0x40($out)
1442 movdqu @XMM[7], 0x50($out)
1443 movdqu @XMM[3], 0x60($out)
1444 movdqu @XMM[5], 0x70($out)
1445 lea 0x80($out), $out
1446 sub \$8,$len
1447 jnc .Lecb_dec_loop
1448
1449 add \$8,$len
1450 jz .Lecb_dec_done
1451
1452 movdqu 0x00($inp), @XMM[0] # load input
1453 mov %rsp, %rax # pass key schedule
1454 mov %ebx,%r10d # pass rounds
1455 cmp \$2,$len
1456 jb .Lecb_dec_one
1457 movdqu 0x10($inp), @XMM[1]
1458 je .Lecb_dec_two
1459 movdqu 0x20($inp), @XMM[2]
1460 cmp \$4,$len
1461 jb .Lecb_dec_three
1462 movdqu 0x30($inp), @XMM[3]
1463 je .Lecb_dec_four
1464 movdqu 0x40($inp), @XMM[4]
1465 cmp \$6,$len
1466 jb .Lecb_dec_five
1467 movdqu 0x50($inp), @XMM[5]
1468 je .Lecb_dec_six
1469 movdqu 0x60($inp), @XMM[6]
1470 call _bsaes_decrypt8
1471 movdqu @XMM[0], 0x00($out) # write output
1472 movdqu @XMM[1], 0x10($out)
1473 movdqu @XMM[6], 0x20($out)
1474 movdqu @XMM[4], 0x30($out)
1475 movdqu @XMM[2], 0x40($out)
1476 movdqu @XMM[7], 0x50($out)
1477 movdqu @XMM[3], 0x60($out)
1478 jmp .Lecb_dec_done
1479.align 16
1480.Lecb_dec_six:
1481 call _bsaes_decrypt8
1482 movdqu @XMM[0], 0x00($out) # write output
1483 movdqu @XMM[1], 0x10($out)
1484 movdqu @XMM[6], 0x20($out)
1485 movdqu @XMM[4], 0x30($out)
1486 movdqu @XMM[2], 0x40($out)
1487 movdqu @XMM[7], 0x50($out)
1488 jmp .Lecb_dec_done
1489.align 16
1490.Lecb_dec_five:
1491 call _bsaes_decrypt8
1492 movdqu @XMM[0], 0x00($out) # write output
1493 movdqu @XMM[1], 0x10($out)
1494 movdqu @XMM[6], 0x20($out)
1495 movdqu @XMM[4], 0x30($out)
1496 movdqu @XMM[2], 0x40($out)
1497 jmp .Lecb_dec_done
1498.align 16
1499.Lecb_dec_four:
1500 call _bsaes_decrypt8
1501 movdqu @XMM[0], 0x00($out) # write output
1502 movdqu @XMM[1], 0x10($out)
1503 movdqu @XMM[6], 0x20($out)
1504 movdqu @XMM[4], 0x30($out)
1505 jmp .Lecb_dec_done
1506.align 16
1507.Lecb_dec_three:
1508 call _bsaes_decrypt8
1509 movdqu @XMM[0], 0x00($out) # write output
1510 movdqu @XMM[1], 0x10($out)
1511 movdqu @XMM[6], 0x20($out)
1512 jmp .Lecb_dec_done
1513.align 16
1514.Lecb_dec_two:
1515 call _bsaes_decrypt8
1516 movdqu @XMM[0], 0x00($out) # write output
1517 movdqu @XMM[1], 0x10($out)
1518 jmp .Lecb_dec_done
1519.align 16
1520.Lecb_dec_one:
1521 call _bsaes_decrypt8
1522 movdqu @XMM[0], 0x00($out) # write output
1523 jmp .Lecb_dec_done
1524.align 16
1525.Lecb_dec_short:
1526 lea ($inp), $arg1
1527 lea ($out), $arg2
1528 lea ($key), $arg3
1529 call asm_AES_decrypt
1530 lea 16($inp), $inp
1531 lea 16($out), $out
1532 dec $len
1533 jnz .Lecb_dec_short
1534
1535.Lecb_dec_done:
1536 lea (%rsp),%rax
1537 pxor %xmm0, %xmm0
1538.Lecb_dec_bzero: # wipe key schedule [if any]
1539 movdqa %xmm0, 0x00(%rax)
1540 movdqa %xmm0, 0x10(%rax)
1541 lea 0x20(%rax), %rax
1542 cmp %rax, %rbp
1543 jb .Lecb_dec_bzero
1544
1545 lea (%rbp),%rsp # restore %rsp
1546___
1547$code.=<<___ if ($win64);
1548 movaps 0x40(%rbp), %xmm6
1549 movaps 0x50(%rbp), %xmm7
1550 movaps 0x60(%rbp), %xmm8
1551 movaps 0x70(%rbp), %xmm9
1552 movaps 0x80(%rbp), %xmm10
1553 movaps 0x90(%rbp), %xmm11
1554 movaps 0xa0(%rbp), %xmm12
1555 movaps 0xb0(%rbp), %xmm13
1556 movaps 0xc0(%rbp), %xmm14
1557 movaps 0xd0(%rbp), %xmm15
1558 lea 0xa0(%rbp), %rsp
1559___
1560$code.=<<___;
1561 mov 0x48(%rsp), %r15
1562 mov 0x50(%rsp), %r14
1563 mov 0x58(%rsp), %r13
1564 mov 0x60(%rsp), %r12
1565 mov 0x68(%rsp), %rbx
1566 mov 0x70(%rsp), %rax
1567 lea 0x78(%rsp), %rsp
1568 mov %rax, %rbp
1569.Lecb_dec_epilogue:
1570 ret
1571.size bsaes_ecb_decrypt_blocks,.-bsaes_ecb_decrypt_blocks
1572___
1573}
1574$code.=<<___;
1575.extern asm_AES_cbc_encrypt
1576.globl bsaes_cbc_encrypt
1577.type bsaes_cbc_encrypt,\@abi-omnipotent
1578.align 16
1579bsaes_cbc_encrypt:
1580 _CET_ENDBR
1581___
1582$code.=<<___ if ($win64);
1583 mov 48(%rsp),$arg6 # pull direction flag
1584___
1585$code.=<<___;
1586 cmp \$0,$arg6
1587 jne asm_AES_cbc_encrypt
1588 cmp \$128,$arg3
1589 jb asm_AES_cbc_encrypt
1590
1591 mov %rsp, %rax
1592.Lcbc_dec_prologue:
1593 push %rbp
1594 push %rbx
1595 push %r12
1596 push %r13
1597 push %r14
1598 push %r15
1599 lea -0x48(%rsp), %rsp
1600___
1601$code.=<<___ if ($win64);
1602 mov 0xa0(%rsp),$arg5 # pull ivp
1603 lea -0xa0(%rsp), %rsp
1604 movaps %xmm6, 0x40(%rsp)
1605 movaps %xmm7, 0x50(%rsp)
1606 movaps %xmm8, 0x60(%rsp)
1607 movaps %xmm9, 0x70(%rsp)
1608 movaps %xmm10, 0x80(%rsp)
1609 movaps %xmm11, 0x90(%rsp)
1610 movaps %xmm12, 0xa0(%rsp)
1611 movaps %xmm13, 0xb0(%rsp)
1612 movaps %xmm14, 0xc0(%rsp)
1613 movaps %xmm15, 0xd0(%rsp)
1614.Lcbc_dec_body:
1615___
1616$code.=<<___;
1617 mov %rsp, %rbp # backup %rsp
1618 mov 240($arg4), %eax # rounds
1619 mov $arg1, $inp # backup arguments
1620 mov $arg2, $out
1621 mov $arg3, $len
1622 mov $arg4, $key
1623 mov $arg5, %rbx
1624 shr \$4, $len # bytes to blocks
1625
1626 mov %eax, %edx # rounds
1627 shl \$7, %rax # 128 bytes per inner round key
1628 sub \$`128-32`, %rax # size of bit-sliced key schedule
1629 sub %rax, %rsp
1630
1631 mov %rsp, %rax # pass key schedule
1632 mov $key, %rcx # pass key
1633 mov %edx, %r10d # pass rounds
1634 call _bsaes_key_convert
1635 pxor (%rsp),%xmm7 # fix up 0 round key
1636 movdqa %xmm6,(%rax) # save last round key
1637 movdqa %xmm7,(%rsp)
1638
1639 movdqu (%rbx), @XMM[15] # load IV
1640 sub \$8,$len
1641.Lcbc_dec_loop:
1642 movdqu 0x00($inp), @XMM[0] # load input
1643 movdqu 0x10($inp), @XMM[1]
1644 movdqu 0x20($inp), @XMM[2]
1645 movdqu 0x30($inp), @XMM[3]
1646 movdqu 0x40($inp), @XMM[4]
1647 movdqu 0x50($inp), @XMM[5]
1648 mov %rsp, %rax # pass key schedule
1649 movdqu 0x60($inp), @XMM[6]
1650 mov %edx,%r10d # pass rounds
1651 movdqu 0x70($inp), @XMM[7]
1652 movdqa @XMM[15], 0x20(%rbp) # put aside IV
1653
1654 call _bsaes_decrypt8
1655
1656 pxor 0x20(%rbp), @XMM[0] # ^= IV
1657 movdqu 0x00($inp), @XMM[8] # re-load input
1658 movdqu 0x10($inp), @XMM[9]
1659 pxor @XMM[8], @XMM[1]
1660 movdqu 0x20($inp), @XMM[10]
1661 pxor @XMM[9], @XMM[6]
1662 movdqu 0x30($inp), @XMM[11]
1663 pxor @XMM[10], @XMM[4]
1664 movdqu 0x40($inp), @XMM[12]
1665 pxor @XMM[11], @XMM[2]
1666 movdqu 0x50($inp), @XMM[13]
1667 pxor @XMM[12], @XMM[7]
1668 movdqu 0x60($inp), @XMM[14]
1669 pxor @XMM[13], @XMM[3]
1670 movdqu 0x70($inp), @XMM[15] # IV
1671 pxor @XMM[14], @XMM[5]
1672 movdqu @XMM[0], 0x00($out) # write output
1673 lea 0x80($inp), $inp
1674 movdqu @XMM[1], 0x10($out)
1675 movdqu @XMM[6], 0x20($out)
1676 movdqu @XMM[4], 0x30($out)
1677 movdqu @XMM[2], 0x40($out)
1678 movdqu @XMM[7], 0x50($out)
1679 movdqu @XMM[3], 0x60($out)
1680 movdqu @XMM[5], 0x70($out)
1681 lea 0x80($out), $out
1682 sub \$8,$len
1683 jnc .Lcbc_dec_loop
1684
1685 add \$8,$len
1686 jz .Lcbc_dec_done
1687
1688 movdqu 0x00($inp), @XMM[0] # load input
1689 mov %rsp, %rax # pass key schedule
1690 mov %edx, %r10d # pass rounds
1691 cmp \$2,$len
1692 jb .Lcbc_dec_one
1693 movdqu 0x10($inp), @XMM[1]
1694 je .Lcbc_dec_two
1695 movdqu 0x20($inp), @XMM[2]
1696 cmp \$4,$len
1697 jb .Lcbc_dec_three
1698 movdqu 0x30($inp), @XMM[3]
1699 je .Lcbc_dec_four
1700 movdqu 0x40($inp), @XMM[4]
1701 cmp \$6,$len
1702 jb .Lcbc_dec_five
1703 movdqu 0x50($inp), @XMM[5]
1704 je .Lcbc_dec_six
1705 movdqu 0x60($inp), @XMM[6]
1706 movdqa @XMM[15], 0x20(%rbp) # put aside IV
1707 call _bsaes_decrypt8
1708 pxor 0x20(%rbp), @XMM[0] # ^= IV
1709 movdqu 0x00($inp), @XMM[8] # re-load input
1710 movdqu 0x10($inp), @XMM[9]
1711 pxor @XMM[8], @XMM[1]
1712 movdqu 0x20($inp), @XMM[10]
1713 pxor @XMM[9], @XMM[6]
1714 movdqu 0x30($inp), @XMM[11]
1715 pxor @XMM[10], @XMM[4]
1716 movdqu 0x40($inp), @XMM[12]
1717 pxor @XMM[11], @XMM[2]
1718 movdqu 0x50($inp), @XMM[13]
1719 pxor @XMM[12], @XMM[7]
1720 movdqu 0x60($inp), @XMM[15] # IV
1721 pxor @XMM[13], @XMM[3]
1722 movdqu @XMM[0], 0x00($out) # write output
1723 movdqu @XMM[1], 0x10($out)
1724 movdqu @XMM[6], 0x20($out)
1725 movdqu @XMM[4], 0x30($out)
1726 movdqu @XMM[2], 0x40($out)
1727 movdqu @XMM[7], 0x50($out)
1728 movdqu @XMM[3], 0x60($out)
1729 jmp .Lcbc_dec_done
1730.align 16
1731.Lcbc_dec_six:
1732 movdqa @XMM[15], 0x20(%rbp) # put aside IV
1733 call _bsaes_decrypt8
1734 pxor 0x20(%rbp), @XMM[0] # ^= IV
1735 movdqu 0x00($inp), @XMM[8] # re-load input
1736 movdqu 0x10($inp), @XMM[9]
1737 pxor @XMM[8], @XMM[1]
1738 movdqu 0x20($inp), @XMM[10]
1739 pxor @XMM[9], @XMM[6]
1740 movdqu 0x30($inp), @XMM[11]
1741 pxor @XMM[10], @XMM[4]
1742 movdqu 0x40($inp), @XMM[12]
1743 pxor @XMM[11], @XMM[2]
1744 movdqu 0x50($inp), @XMM[15] # IV
1745 pxor @XMM[12], @XMM[7]
1746 movdqu @XMM[0], 0x00($out) # write output
1747 movdqu @XMM[1], 0x10($out)
1748 movdqu @XMM[6], 0x20($out)
1749 movdqu @XMM[4], 0x30($out)
1750 movdqu @XMM[2], 0x40($out)
1751 movdqu @XMM[7], 0x50($out)
1752 jmp .Lcbc_dec_done
1753.align 16
1754.Lcbc_dec_five:
1755 movdqa @XMM[15], 0x20(%rbp) # put aside IV
1756 call _bsaes_decrypt8
1757 pxor 0x20(%rbp), @XMM[0] # ^= IV
1758 movdqu 0x00($inp), @XMM[8] # re-load input
1759 movdqu 0x10($inp), @XMM[9]
1760 pxor @XMM[8], @XMM[1]
1761 movdqu 0x20($inp), @XMM[10]
1762 pxor @XMM[9], @XMM[6]
1763 movdqu 0x30($inp), @XMM[11]
1764 pxor @XMM[10], @XMM[4]
1765 movdqu 0x40($inp), @XMM[15] # IV
1766 pxor @XMM[11], @XMM[2]
1767 movdqu @XMM[0], 0x00($out) # write output
1768 movdqu @XMM[1], 0x10($out)
1769 movdqu @XMM[6], 0x20($out)
1770 movdqu @XMM[4], 0x30($out)
1771 movdqu @XMM[2], 0x40($out)
1772 jmp .Lcbc_dec_done
1773.align 16
1774.Lcbc_dec_four:
1775 movdqa @XMM[15], 0x20(%rbp) # put aside IV
1776 call _bsaes_decrypt8
1777 pxor 0x20(%rbp), @XMM[0] # ^= IV
1778 movdqu 0x00($inp), @XMM[8] # re-load input
1779 movdqu 0x10($inp), @XMM[9]
1780 pxor @XMM[8], @XMM[1]
1781 movdqu 0x20($inp), @XMM[10]
1782 pxor @XMM[9], @XMM[6]
1783 movdqu 0x30($inp), @XMM[15] # IV
1784 pxor @XMM[10], @XMM[4]
1785 movdqu @XMM[0], 0x00($out) # write output
1786 movdqu @XMM[1], 0x10($out)
1787 movdqu @XMM[6], 0x20($out)
1788 movdqu @XMM[4], 0x30($out)
1789 jmp .Lcbc_dec_done
1790.align 16
1791.Lcbc_dec_three:
1792 movdqa @XMM[15], 0x20(%rbp) # put aside IV
1793 call _bsaes_decrypt8
1794 pxor 0x20(%rbp), @XMM[0] # ^= IV
1795 movdqu 0x00($inp), @XMM[8] # re-load input
1796 movdqu 0x10($inp), @XMM[9]
1797 pxor @XMM[8], @XMM[1]
1798 movdqu 0x20($inp), @XMM[15] # IV
1799 pxor @XMM[9], @XMM[6]
1800 movdqu @XMM[0], 0x00($out) # write output
1801 movdqu @XMM[1], 0x10($out)
1802 movdqu @XMM[6], 0x20($out)
1803 jmp .Lcbc_dec_done
1804.align 16
1805.Lcbc_dec_two:
1806 movdqa @XMM[15], 0x20(%rbp) # put aside IV
1807 call _bsaes_decrypt8
1808 pxor 0x20(%rbp), @XMM[0] # ^= IV
1809 movdqu 0x00($inp), @XMM[8] # re-load input
1810 movdqu 0x10($inp), @XMM[15] # IV
1811 pxor @XMM[8], @XMM[1]
1812 movdqu @XMM[0], 0x00($out) # write output
1813 movdqu @XMM[1], 0x10($out)
1814 jmp .Lcbc_dec_done
1815.align 16
1816.Lcbc_dec_one:
1817 lea ($inp), $arg1
1818 lea 0x20(%rbp), $arg2 # buffer output
1819 lea ($key), $arg3
1820 call asm_AES_decrypt # doesn't touch %xmm
1821 pxor 0x20(%rbp), @XMM[15] # ^= IV
1822 movdqu @XMM[15], ($out) # write output
1823 movdqa @XMM[0], @XMM[15] # IV
1824
1825.Lcbc_dec_done:
1826 movdqu @XMM[15], (%rbx) # return IV
1827 lea (%rsp), %rax
1828 pxor %xmm0, %xmm0
1829.Lcbc_dec_bzero: # wipe key schedule [if any]
1830 movdqa %xmm0, 0x00(%rax)
1831 movdqa %xmm0, 0x10(%rax)
1832 lea 0x20(%rax), %rax
1833 cmp %rax, %rbp
1834 ja .Lcbc_dec_bzero
1835
1836 lea (%rbp),%rsp # restore %rsp
1837___
1838$code.=<<___ if ($win64);
1839 movaps 0x40(%rbp), %xmm6
1840 movaps 0x50(%rbp), %xmm7
1841 movaps 0x60(%rbp), %xmm8
1842 movaps 0x70(%rbp), %xmm9
1843 movaps 0x80(%rbp), %xmm10
1844 movaps 0x90(%rbp), %xmm11
1845 movaps 0xa0(%rbp), %xmm12
1846 movaps 0xb0(%rbp), %xmm13
1847 movaps 0xc0(%rbp), %xmm14
1848 movaps 0xd0(%rbp), %xmm15
1849 lea 0xa0(%rbp), %rsp
1850___
1851$code.=<<___;
1852 mov 0x48(%rsp), %r15
1853 mov 0x50(%rsp), %r14
1854 mov 0x58(%rsp), %r13
1855 mov 0x60(%rsp), %r12
1856 mov 0x68(%rsp), %rbx
1857 mov 0x70(%rsp), %rax
1858 lea 0x78(%rsp), %rsp
1859 mov %rax, %rbp
1860.Lcbc_dec_epilogue:
1861 ret
1862.size bsaes_cbc_encrypt,.-bsaes_cbc_encrypt
1863
1864.globl bsaes_ctr32_encrypt_blocks
1865.type bsaes_ctr32_encrypt_blocks,\@abi-omnipotent
1866.align 16
1867bsaes_ctr32_encrypt_blocks:
1868 _CET_ENDBR
1869 mov %rsp, %rax
1870.Lctr_enc_prologue:
1871 push %rbp
1872 push %rbx
1873 push %r12
1874 push %r13
1875 push %r14
1876 push %r15
1877 lea -0x48(%rsp), %rsp
1878___
1879$code.=<<___ if ($win64);
1880 mov 0xa0(%rsp),$arg5 # pull ivp
1881 lea -0xa0(%rsp), %rsp
1882 movaps %xmm6, 0x40(%rsp)
1883 movaps %xmm7, 0x50(%rsp)
1884 movaps %xmm8, 0x60(%rsp)
1885 movaps %xmm9, 0x70(%rsp)
1886 movaps %xmm10, 0x80(%rsp)
1887 movaps %xmm11, 0x90(%rsp)
1888 movaps %xmm12, 0xa0(%rsp)
1889 movaps %xmm13, 0xb0(%rsp)
1890 movaps %xmm14, 0xc0(%rsp)
1891 movaps %xmm15, 0xd0(%rsp)
1892.Lctr_enc_body:
1893___
1894$code.=<<___;
1895 mov %rsp, %rbp # backup %rsp
1896 movdqu ($arg5), %xmm0 # load counter
1897 mov 240($arg4), %eax # rounds
1898 mov $arg1, $inp # backup arguments
1899 mov $arg2, $out
1900 mov $arg3, $len
1901 mov $arg4, $key
1902 movdqa %xmm0, 0x20(%rbp) # copy counter
1903 cmp \$8, $arg3
1904 jb .Lctr_enc_short
1905
1906 mov %eax, %ebx # rounds
1907 shl \$7, %rax # 128 bytes per inner round key
1908 sub \$`128-32`, %rax # size of bit-sliced key schedule
1909 sub %rax, %rsp
1910
1911 mov %rsp, %rax # pass key schedule
1912 mov $key, %rcx # pass key
1913 mov %ebx, %r10d # pass rounds
1914 call _bsaes_key_convert
1915 pxor %xmm6,%xmm7 # fix up last round key
1916 movdqa %xmm7,(%rax) # save last round key
1917
1918 movdqa (%rsp), @XMM[9] # load round0 key
1919 lea .LADD1(%rip), %r11
1920 movdqa 0x20(%rbp), @XMM[0] # counter copy
1921 movdqa -0x20(%r11), @XMM[8] # .LSWPUP
1922 pshufb @XMM[8], @XMM[9] # byte swap upper part
1923 pshufb @XMM[8], @XMM[0]
1924 movdqa @XMM[9], (%rsp) # save adjusted round0 key
1925 jmp .Lctr_enc_loop
1926.align 16
1927.Lctr_enc_loop:
1928 movdqa @XMM[0], 0x20(%rbp) # save counter
1929 movdqa @XMM[0], @XMM[1] # prepare 8 counter values
1930 movdqa @XMM[0], @XMM[2]
1931 paddd 0x00(%r11), @XMM[1] # .LADD1
1932 movdqa @XMM[0], @XMM[3]
1933 paddd 0x10(%r11), @XMM[2] # .LADD2
1934 movdqa @XMM[0], @XMM[4]
1935 paddd 0x20(%r11), @XMM[3] # .LADD3
1936 movdqa @XMM[0], @XMM[5]
1937 paddd 0x30(%r11), @XMM[4] # .LADD4
1938 movdqa @XMM[0], @XMM[6]
1939 paddd 0x40(%r11), @XMM[5] # .LADD5
1940 movdqa @XMM[0], @XMM[7]
1941 paddd 0x50(%r11), @XMM[6] # .LADD6
1942 paddd 0x60(%r11), @XMM[7] # .LADD7
1943
1944 # Borrow prologue from _bsaes_encrypt8 to use the opportunity
1945 # to flip byte order in 32-bit counter
1946 movdqa (%rsp), @XMM[9] # round 0 key
1947 lea 0x10(%rsp), %rax # pass key schedule
1948 movdqa -0x10(%r11), @XMM[8] # .LSWPUPM0SR
1949 pxor @XMM[9], @XMM[0] # xor with round0 key
1950 pxor @XMM[9], @XMM[1]
1951 pshufb @XMM[8], @XMM[0]
1952 pxor @XMM[9], @XMM[2]
1953 pshufb @XMM[8], @XMM[1]
1954 pxor @XMM[9], @XMM[3]
1955 pshufb @XMM[8], @XMM[2]
1956 pxor @XMM[9], @XMM[4]
1957 pshufb @XMM[8], @XMM[3]
1958 pxor @XMM[9], @XMM[5]
1959 pshufb @XMM[8], @XMM[4]
1960 pxor @XMM[9], @XMM[6]
1961 pshufb @XMM[8], @XMM[5]
1962 pxor @XMM[9], @XMM[7]
1963 pshufb @XMM[8], @XMM[6]
1964 lea .LBS0(%rip), %r11 # constants table
1965 pshufb @XMM[8], @XMM[7]
1966 mov %ebx,%r10d # pass rounds
1967
1968 call _bsaes_encrypt8_bitslice
1969
1970 sub \$8,$len
1971 jc .Lctr_enc_loop_done
1972
1973 movdqu 0x00($inp), @XMM[8] # load input
1974 movdqu 0x10($inp), @XMM[9]
1975 movdqu 0x20($inp), @XMM[10]
1976 movdqu 0x30($inp), @XMM[11]
1977 movdqu 0x40($inp), @XMM[12]
1978 movdqu 0x50($inp), @XMM[13]
1979 movdqu 0x60($inp), @XMM[14]
1980 movdqu 0x70($inp), @XMM[15]
1981 lea 0x80($inp),$inp
1982 pxor @XMM[0], @XMM[8]
1983 movdqa 0x20(%rbp), @XMM[0] # load counter
1984 pxor @XMM[9], @XMM[1]
1985 movdqu @XMM[8], 0x00($out) # write output
1986 pxor @XMM[10], @XMM[4]
1987 movdqu @XMM[1], 0x10($out)
1988 pxor @XMM[11], @XMM[6]
1989 movdqu @XMM[4], 0x20($out)
1990 pxor @XMM[12], @XMM[3]
1991 movdqu @XMM[6], 0x30($out)
1992 pxor @XMM[13], @XMM[7]
1993 movdqu @XMM[3], 0x40($out)
1994 pxor @XMM[14], @XMM[2]
1995 movdqu @XMM[7], 0x50($out)
1996 pxor @XMM[15], @XMM[5]
1997 movdqu @XMM[2], 0x60($out)
1998 lea .LADD1(%rip), %r11
1999 movdqu @XMM[5], 0x70($out)
2000 lea 0x80($out), $out
2001 paddd 0x70(%r11), @XMM[0] # .LADD8
2002 jnz .Lctr_enc_loop
2003
2004 jmp .Lctr_enc_done
2005.align 16
2006.Lctr_enc_loop_done:
2007 add \$8, $len
2008 movdqu 0x00($inp), @XMM[8] # load input
2009 pxor @XMM[8], @XMM[0]
2010 movdqu @XMM[0], 0x00($out) # write output
2011 cmp \$2,$len
2012 jb .Lctr_enc_done
2013 movdqu 0x10($inp), @XMM[9]
2014 pxor @XMM[9], @XMM[1]
2015 movdqu @XMM[1], 0x10($out)
2016 je .Lctr_enc_done
2017 movdqu 0x20($inp), @XMM[10]
2018 pxor @XMM[10], @XMM[4]
2019 movdqu @XMM[4], 0x20($out)
2020 cmp \$4,$len
2021 jb .Lctr_enc_done
2022 movdqu 0x30($inp), @XMM[11]
2023 pxor @XMM[11], @XMM[6]
2024 movdqu @XMM[6], 0x30($out)
2025 je .Lctr_enc_done
2026 movdqu 0x40($inp), @XMM[12]
2027 pxor @XMM[12], @XMM[3]
2028 movdqu @XMM[3], 0x40($out)
2029 cmp \$6,$len
2030 jb .Lctr_enc_done
2031 movdqu 0x50($inp), @XMM[13]
2032 pxor @XMM[13], @XMM[7]
2033 movdqu @XMM[7], 0x50($out)
2034 je .Lctr_enc_done
2035 movdqu 0x60($inp), @XMM[14]
2036 pxor @XMM[14], @XMM[2]
2037 movdqu @XMM[2], 0x60($out)
2038 jmp .Lctr_enc_done
2039
2040.align 16
2041.Lctr_enc_short:
2042 lea 0x20(%rbp), $arg1
2043 lea 0x30(%rbp), $arg2
2044 lea ($key), $arg3
2045 call asm_AES_encrypt
2046 movdqu ($inp), @XMM[1]
2047 lea 16($inp), $inp
2048 mov 0x2c(%rbp), %eax # load 32-bit counter
2049 bswap %eax
2050 pxor 0x30(%rbp), @XMM[1]
2051 inc %eax # increment
2052 movdqu @XMM[1], ($out)
2053 bswap %eax
2054 lea 16($out), $out
2055 mov %eax, 0x2c(%rsp) # save 32-bit counter
2056 dec $len
2057 jnz .Lctr_enc_short
2058
2059.Lctr_enc_done:
2060 lea (%rsp), %rax
2061 pxor %xmm0, %xmm0
2062.Lctr_enc_bzero: # wipe key schedule [if any]
2063 movdqa %xmm0, 0x00(%rax)
2064 movdqa %xmm0, 0x10(%rax)
2065 lea 0x20(%rax), %rax
2066 cmp %rax, %rbp
2067 ja .Lctr_enc_bzero
2068
2069 lea (%rbp),%rsp # restore %rsp
2070___
2071$code.=<<___ if ($win64);
2072 movaps 0x40(%rbp), %xmm6
2073 movaps 0x50(%rbp), %xmm7
2074 movaps 0x60(%rbp), %xmm8
2075 movaps 0x70(%rbp), %xmm9
2076 movaps 0x80(%rbp), %xmm10
2077 movaps 0x90(%rbp), %xmm11
2078 movaps 0xa0(%rbp), %xmm12
2079 movaps 0xb0(%rbp), %xmm13
2080 movaps 0xc0(%rbp), %xmm14
2081 movaps 0xd0(%rbp), %xmm15
2082 lea 0xa0(%rbp), %rsp
2083___
2084$code.=<<___;
2085 mov 0x48(%rsp), %r15
2086 mov 0x50(%rsp), %r14
2087 mov 0x58(%rsp), %r13
2088 mov 0x60(%rsp), %r12
2089 mov 0x68(%rsp), %rbx
2090 mov 0x70(%rsp), %rax
2091 lea 0x78(%rsp), %rsp
2092 mov %rax, %rbp
2093.Lctr_enc_epilogue:
2094 ret
2095.size bsaes_ctr32_encrypt_blocks,.-bsaes_ctr32_encrypt_blocks
2096___
2097######################################################################
2098# void bsaes_xts_[en|de]crypt(const char *inp,char *out,size_t len,
2099# const AES_KEY *key1, const AES_KEY *key2,
2100# const unsigned char iv[16]);
2101#
2102my ($twmask,$twres,$twtmp)=@XMM[13..15];
2103$arg6=~s/d$//;
2104
2105$code.=<<___;
2106.globl bsaes_xts_encrypt
2107.type bsaes_xts_encrypt,\@abi-omnipotent
2108.align 16
2109bsaes_xts_encrypt:
2110 _CET_ENDBR
2111 mov %rsp, %rax
2112.Lxts_enc_prologue:
2113 push %rbp
2114 push %rbx
2115 push %r12
2116 push %r13
2117 push %r14
2118 push %r15
2119 lea -0x48(%rsp), %rsp
2120___
2121$code.=<<___ if ($win64);
2122 mov 0xa0(%rsp),$arg5 # pull key2
2123 mov 0xa8(%rsp),$arg6 # pull ivp
2124 lea -0xa0(%rsp), %rsp
2125 movaps %xmm6, 0x40(%rsp)
2126 movaps %xmm7, 0x50(%rsp)
2127 movaps %xmm8, 0x60(%rsp)
2128 movaps %xmm9, 0x70(%rsp)
2129 movaps %xmm10, 0x80(%rsp)
2130 movaps %xmm11, 0x90(%rsp)
2131 movaps %xmm12, 0xa0(%rsp)
2132 movaps %xmm13, 0xb0(%rsp)
2133 movaps %xmm14, 0xc0(%rsp)
2134 movaps %xmm15, 0xd0(%rsp)
2135.Lxts_enc_body:
2136___
2137$code.=<<___;
2138 mov %rsp, %rbp # backup %rsp
2139 mov $arg1, $inp # backup arguments
2140 mov $arg2, $out
2141 mov $arg3, $len
2142 mov $arg4, $key
2143
2144 lea ($arg6), $arg1
2145 lea 0x20(%rbp), $arg2
2146 lea ($arg5), $arg3
2147 call asm_AES_encrypt # generate initial tweak
2148
2149 mov 240($key), %eax # rounds
2150 mov $len, %rbx # backup $len
2151
2152 mov %eax, %edx # rounds
2153 shl \$7, %rax # 128 bytes per inner round key
2154 sub \$`128-32`, %rax # size of bit-sliced key schedule
2155 sub %rax, %rsp
2156
2157 mov %rsp, %rax # pass key schedule
2158 mov $key, %rcx # pass key
2159 mov %edx, %r10d # pass rounds
2160 call _bsaes_key_convert
2161 pxor %xmm6, %xmm7 # fix up last round key
2162 movdqa %xmm7, (%rax) # save last round key
2163
2164 and \$-16, $len
2165 sub \$0x80, %rsp # place for tweak[8]
2166 movdqa 0x20(%rbp), @XMM[7] # initial tweak
2167
2168 pxor $twtmp, $twtmp
2169 movdqa .Lxts_magic(%rip), $twmask
2170 pcmpgtd @XMM[7], $twtmp # broadcast upper bits
2171
2172 sub \$0x80, $len
2173 jc .Lxts_enc_short
2174 jmp .Lxts_enc_loop
2175
2176.align 16
2177.Lxts_enc_loop:
2178___
2179 for ($i=0;$i<7;$i++) {
2180 $code.=<<___;
2181 pshufd \$0x13, $twtmp, $twres
2182 pxor $twtmp, $twtmp
2183 movdqa @XMM[7], @XMM[$i]
2184 movdqa @XMM[7], `0x10*$i`(%rsp)# save tweak[$i]
2185 paddq @XMM[7], @XMM[7] # psllq 1,$tweak
2186 pand $twmask, $twres # isolate carry and residue
2187 pcmpgtd @XMM[7], $twtmp # broadcast upper bits
2188 pxor $twres, @XMM[7]
2189___
2190 $code.=<<___ if ($i>=1);
2191 movdqu `0x10*($i-1)`($inp), @XMM[8+$i-1]
2192___
2193 $code.=<<___ if ($i>=2);
2194 pxor @XMM[8+$i-2], @XMM[$i-2]# input[] ^ tweak[]
2195___
2196 }
2197$code.=<<___;
2198 movdqu 0x60($inp), @XMM[8+6]
2199 pxor @XMM[8+5], @XMM[5]
2200 movdqu 0x70($inp), @XMM[8+7]
2201 lea 0x80($inp), $inp
2202 movdqa @XMM[7], 0x70(%rsp)
2203 pxor @XMM[8+6], @XMM[6]
2204 lea 0x80(%rsp), %rax # pass key schedule
2205 pxor @XMM[8+7], @XMM[7]
2206 mov %edx, %r10d # pass rounds
2207
2208 call _bsaes_encrypt8
2209
2210 pxor 0x00(%rsp), @XMM[0] # ^= tweak[]
2211 pxor 0x10(%rsp), @XMM[1]
2212 movdqu @XMM[0], 0x00($out) # write output
2213 pxor 0x20(%rsp), @XMM[4]
2214 movdqu @XMM[1], 0x10($out)
2215 pxor 0x30(%rsp), @XMM[6]
2216 movdqu @XMM[4], 0x20($out)
2217 pxor 0x40(%rsp), @XMM[3]
2218 movdqu @XMM[6], 0x30($out)
2219 pxor 0x50(%rsp), @XMM[7]
2220 movdqu @XMM[3], 0x40($out)
2221 pxor 0x60(%rsp), @XMM[2]
2222 movdqu @XMM[7], 0x50($out)
2223 pxor 0x70(%rsp), @XMM[5]
2224 movdqu @XMM[2], 0x60($out)
2225 movdqu @XMM[5], 0x70($out)
2226 lea 0x80($out), $out
2227
2228 movdqa 0x70(%rsp), @XMM[7] # prepare next iteration tweak
2229 pxor $twtmp, $twtmp
2230 movdqa .Lxts_magic(%rip), $twmask
2231 pcmpgtd @XMM[7], $twtmp
2232 pshufd \$0x13, $twtmp, $twres
2233 pxor $twtmp, $twtmp
2234 paddq @XMM[7], @XMM[7] # psllq 1,$tweak
2235 pand $twmask, $twres # isolate carry and residue
2236 pcmpgtd @XMM[7], $twtmp # broadcast upper bits
2237 pxor $twres, @XMM[7]
2238
2239 sub \$0x80,$len
2240 jnc .Lxts_enc_loop
2241
2242.Lxts_enc_short:
2243 add \$0x80, $len
2244 jz .Lxts_enc_done
2245___
2246 for ($i=0;$i<7;$i++) {
2247 $code.=<<___;
2248 pshufd \$0x13, $twtmp, $twres
2249 pxor $twtmp, $twtmp
2250 movdqa @XMM[7], @XMM[$i]
2251 movdqa @XMM[7], `0x10*$i`(%rsp)# save tweak[$i]
2252 paddq @XMM[7], @XMM[7] # psllq 1,$tweak
2253 pand $twmask, $twres # isolate carry and residue
2254 pcmpgtd @XMM[7], $twtmp # broadcast upper bits
2255 pxor $twres, @XMM[7]
2256___
2257 $code.=<<___ if ($i>=1);
2258 movdqu `0x10*($i-1)`($inp), @XMM[8+$i-1]
2259 cmp \$`0x10*$i`,$len
2260 je .Lxts_enc_$i
2261___
2262 $code.=<<___ if ($i>=2);
2263 pxor @XMM[8+$i-2], @XMM[$i-2]# input[] ^ tweak[]
2264___
2265 }
2266$code.=<<___;
2267 movdqu 0x60($inp), @XMM[8+6]
2268 pxor @XMM[8+5], @XMM[5]
2269 movdqa @XMM[7], 0x70(%rsp)
2270 lea 0x70($inp), $inp
2271 pxor @XMM[8+6], @XMM[6]
2272 lea 0x80(%rsp), %rax # pass key schedule
2273 mov %edx, %r10d # pass rounds
2274
2275 call _bsaes_encrypt8
2276
2277 pxor 0x00(%rsp), @XMM[0] # ^= tweak[]
2278 pxor 0x10(%rsp), @XMM[1]
2279 movdqu @XMM[0], 0x00($out) # write output
2280 pxor 0x20(%rsp), @XMM[4]
2281 movdqu @XMM[1], 0x10($out)
2282 pxor 0x30(%rsp), @XMM[6]
2283 movdqu @XMM[4], 0x20($out)
2284 pxor 0x40(%rsp), @XMM[3]
2285 movdqu @XMM[6], 0x30($out)
2286 pxor 0x50(%rsp), @XMM[7]
2287 movdqu @XMM[3], 0x40($out)
2288 pxor 0x60(%rsp), @XMM[2]
2289 movdqu @XMM[7], 0x50($out)
2290 movdqu @XMM[2], 0x60($out)
2291 lea 0x70($out), $out
2292
2293 movdqa 0x70(%rsp), @XMM[7] # next iteration tweak
2294 jmp .Lxts_enc_done
2295.align 16
2296.Lxts_enc_6:
2297 pxor @XMM[8+4], @XMM[4]
2298 lea 0x60($inp), $inp
2299 pxor @XMM[8+5], @XMM[5]
2300 lea 0x80(%rsp), %rax # pass key schedule
2301 mov %edx, %r10d # pass rounds
2302
2303 call _bsaes_encrypt8
2304
2305 pxor 0x00(%rsp), @XMM[0] # ^= tweak[]
2306 pxor 0x10(%rsp), @XMM[1]
2307 movdqu @XMM[0], 0x00($out) # write output
2308 pxor 0x20(%rsp), @XMM[4]
2309 movdqu @XMM[1], 0x10($out)
2310 pxor 0x30(%rsp), @XMM[6]
2311 movdqu @XMM[4], 0x20($out)
2312 pxor 0x40(%rsp), @XMM[3]
2313 movdqu @XMM[6], 0x30($out)
2314 pxor 0x50(%rsp), @XMM[7]
2315 movdqu @XMM[3], 0x40($out)
2316 movdqu @XMM[7], 0x50($out)
2317 lea 0x60($out), $out
2318
2319 movdqa 0x60(%rsp), @XMM[7] # next iteration tweak
2320 jmp .Lxts_enc_done
2321.align 16
2322.Lxts_enc_5:
2323 pxor @XMM[8+3], @XMM[3]
2324 lea 0x50($inp), $inp
2325 pxor @XMM[8+4], @XMM[4]
2326 lea 0x80(%rsp), %rax # pass key schedule
2327 mov %edx, %r10d # pass rounds
2328
2329 call _bsaes_encrypt8
2330
2331 pxor 0x00(%rsp), @XMM[0] # ^= tweak[]
2332 pxor 0x10(%rsp), @XMM[1]
2333 movdqu @XMM[0], 0x00($out) # write output
2334 pxor 0x20(%rsp), @XMM[4]
2335 movdqu @XMM[1], 0x10($out)
2336 pxor 0x30(%rsp), @XMM[6]
2337 movdqu @XMM[4], 0x20($out)
2338 pxor 0x40(%rsp), @XMM[3]
2339 movdqu @XMM[6], 0x30($out)
2340 movdqu @XMM[3], 0x40($out)
2341 lea 0x50($out), $out
2342
2343 movdqa 0x50(%rsp), @XMM[7] # next iteration tweak
2344 jmp .Lxts_enc_done
2345.align 16
2346.Lxts_enc_4:
2347 pxor @XMM[8+2], @XMM[2]
2348 lea 0x40($inp), $inp
2349 pxor @XMM[8+3], @XMM[3]
2350 lea 0x80(%rsp), %rax # pass key schedule
2351 mov %edx, %r10d # pass rounds
2352
2353 call _bsaes_encrypt8
2354
2355 pxor 0x00(%rsp), @XMM[0] # ^= tweak[]
2356 pxor 0x10(%rsp), @XMM[1]
2357 movdqu @XMM[0], 0x00($out) # write output
2358 pxor 0x20(%rsp), @XMM[4]
2359 movdqu @XMM[1], 0x10($out)
2360 pxor 0x30(%rsp), @XMM[6]
2361 movdqu @XMM[4], 0x20($out)
2362 movdqu @XMM[6], 0x30($out)
2363 lea 0x40($out), $out
2364
2365 movdqa 0x40(%rsp), @XMM[7] # next iteration tweak
2366 jmp .Lxts_enc_done
2367.align 16
2368.Lxts_enc_3:
2369 pxor @XMM[8+1], @XMM[1]
2370 lea 0x30($inp), $inp
2371 pxor @XMM[8+2], @XMM[2]
2372 lea 0x80(%rsp), %rax # pass key schedule
2373 mov %edx, %r10d # pass rounds
2374
2375 call _bsaes_encrypt8
2376
2377 pxor 0x00(%rsp), @XMM[0] # ^= tweak[]
2378 pxor 0x10(%rsp), @XMM[1]
2379 movdqu @XMM[0], 0x00($out) # write output
2380 pxor 0x20(%rsp), @XMM[4]
2381 movdqu @XMM[1], 0x10($out)
2382 movdqu @XMM[4], 0x20($out)
2383 lea 0x30($out), $out
2384
2385 movdqa 0x30(%rsp), @XMM[7] # next iteration tweak
2386 jmp .Lxts_enc_done
2387.align 16
2388.Lxts_enc_2:
2389 pxor @XMM[8+0], @XMM[0]
2390 lea 0x20($inp), $inp
2391 pxor @XMM[8+1], @XMM[1]
2392 lea 0x80(%rsp), %rax # pass key schedule
2393 mov %edx, %r10d # pass rounds
2394
2395 call _bsaes_encrypt8
2396
2397 pxor 0x00(%rsp), @XMM[0] # ^= tweak[]
2398 pxor 0x10(%rsp), @XMM[1]
2399 movdqu @XMM[0], 0x00($out) # write output
2400 movdqu @XMM[1], 0x10($out)
2401 lea 0x20($out), $out
2402
2403 movdqa 0x20(%rsp), @XMM[7] # next iteration tweak
2404 jmp .Lxts_enc_done
2405.align 16
2406.Lxts_enc_1:
2407 pxor @XMM[0], @XMM[8]
2408 lea 0x10($inp), $inp
2409 movdqa @XMM[8], 0x20(%rbp)
2410 lea 0x20(%rbp), $arg1
2411 lea 0x20(%rbp), $arg2
2412 lea ($key), $arg3
2413 call asm_AES_encrypt # doesn't touch %xmm
2414 pxor 0x20(%rbp), @XMM[0] # ^= tweak[]
2415 #pxor @XMM[8], @XMM[0]
2416 #lea 0x80(%rsp), %rax # pass key schedule
2417 #mov %edx, %r10d # pass rounds
2418 #call _bsaes_encrypt8
2419 #pxor 0x00(%rsp), @XMM[0] # ^= tweak[]
2420 movdqu @XMM[0], 0x00($out) # write output
2421 lea 0x10($out), $out
2422
2423 movdqa 0x10(%rsp), @XMM[7] # next iteration tweak
2424
2425.Lxts_enc_done:
2426 and \$15, %ebx
2427 jz .Lxts_enc_ret
2428 mov $out, %rdx
2429
2430.Lxts_enc_steal:
2431 movzb ($inp), %eax
2432 movzb -16(%rdx), %ecx
2433 lea 1($inp), $inp
2434 mov %al, -16(%rdx)
2435 mov %cl, 0(%rdx)
2436 lea 1(%rdx), %rdx
2437 sub \$1,%ebx
2438 jnz .Lxts_enc_steal
2439
2440 movdqu -16($out), @XMM[0]
2441 lea 0x20(%rbp), $arg1
2442 pxor @XMM[7], @XMM[0]
2443 lea 0x20(%rbp), $arg2
2444 movdqa @XMM[0], 0x20(%rbp)
2445 lea ($key), $arg3
2446 call asm_AES_encrypt # doesn't touch %xmm
2447 pxor 0x20(%rbp), @XMM[7]
2448 movdqu @XMM[7], -16($out)
2449
2450.Lxts_enc_ret:
2451 lea (%rsp), %rax
2452 pxor %xmm0, %xmm0
2453.Lxts_enc_bzero: # wipe key schedule [if any]
2454 movdqa %xmm0, 0x00(%rax)
2455 movdqa %xmm0, 0x10(%rax)
2456 lea 0x20(%rax), %rax
2457 cmp %rax, %rbp
2458 ja .Lxts_enc_bzero
2459
2460 lea (%rbp),%rsp # restore %rsp
2461___
2462$code.=<<___ if ($win64);
2463 movaps 0x40(%rbp), %xmm6
2464 movaps 0x50(%rbp), %xmm7
2465 movaps 0x60(%rbp), %xmm8
2466 movaps 0x70(%rbp), %xmm9
2467 movaps 0x80(%rbp), %xmm10
2468 movaps 0x90(%rbp), %xmm11
2469 movaps 0xa0(%rbp), %xmm12
2470 movaps 0xb0(%rbp), %xmm13
2471 movaps 0xc0(%rbp), %xmm14
2472 movaps 0xd0(%rbp), %xmm15
2473 lea 0xa0(%rbp), %rsp
2474___
2475$code.=<<___;
2476 mov 0x48(%rsp), %r15
2477 mov 0x50(%rsp), %r14
2478 mov 0x58(%rsp), %r13
2479 mov 0x60(%rsp), %r12
2480 mov 0x68(%rsp), %rbx
2481 mov 0x70(%rsp), %rax
2482 lea 0x78(%rsp), %rsp
2483 mov %rax, %rbp
2484.Lxts_enc_epilogue:
2485 ret
2486.size bsaes_xts_encrypt,.-bsaes_xts_encrypt
2487
2488.globl bsaes_xts_decrypt
2489.type bsaes_xts_decrypt,\@abi-omnipotent
2490.align 16
2491bsaes_xts_decrypt:
2492 _CET_ENDBR
2493 mov %rsp, %rax
2494.Lxts_dec_prologue:
2495 push %rbp
2496 push %rbx
2497 push %r12
2498 push %r13
2499 push %r14
2500 push %r15
2501 lea -0x48(%rsp), %rsp
2502___
2503$code.=<<___ if ($win64);
2504 mov 0xa0(%rsp),$arg5 # pull key2
2505 mov 0xa8(%rsp),$arg6 # pull ivp
2506 lea -0xa0(%rsp), %rsp
2507 movaps %xmm6, 0x40(%rsp)
2508 movaps %xmm7, 0x50(%rsp)
2509 movaps %xmm8, 0x60(%rsp)
2510 movaps %xmm9, 0x70(%rsp)
2511 movaps %xmm10, 0x80(%rsp)
2512 movaps %xmm11, 0x90(%rsp)
2513 movaps %xmm12, 0xa0(%rsp)
2514 movaps %xmm13, 0xb0(%rsp)
2515 movaps %xmm14, 0xc0(%rsp)
2516 movaps %xmm15, 0xd0(%rsp)
2517.Lxts_dec_body:
2518___
2519$code.=<<___;
2520 mov %rsp, %rbp # backup %rsp
2521 mov $arg1, $inp # backup arguments
2522 mov $arg2, $out
2523 mov $arg3, $len
2524 mov $arg4, $key
2525
2526 lea ($arg6), $arg1
2527 lea 0x20(%rbp), $arg2
2528 lea ($arg5), $arg3
2529 call asm_AES_encrypt # generate initial tweak
2530
2531 mov 240($key), %eax # rounds
2532 mov $len, %rbx # backup $len
2533
2534 mov %eax, %edx # rounds
2535 shl \$7, %rax # 128 bytes per inner round key
2536 sub \$`128-32`, %rax # size of bit-sliced key schedule
2537 sub %rax, %rsp
2538
2539 mov %rsp, %rax # pass key schedule
2540 mov $key, %rcx # pass key
2541 mov %edx, %r10d # pass rounds
2542 call _bsaes_key_convert
2543 pxor (%rsp), %xmm7 # fix up round 0 key
2544 movdqa %xmm6, (%rax) # save last round key
2545 movdqa %xmm7, (%rsp)
2546
2547 xor %eax, %eax # if ($len%16) len-=16;
2548 and \$-16, $len
2549 test \$15, %ebx
2550 setnz %al
2551 shl \$4, %rax
2552 sub %rax, $len
2553
2554 sub \$0x80, %rsp # place for tweak[8]
2555 movdqa 0x20(%rbp), @XMM[7] # initial tweak
2556
2557 pxor $twtmp, $twtmp
2558 movdqa .Lxts_magic(%rip), $twmask
2559 pcmpgtd @XMM[7], $twtmp # broadcast upper bits
2560
2561 sub \$0x80, $len
2562 jc .Lxts_dec_short
2563 jmp .Lxts_dec_loop
2564
2565.align 16
2566.Lxts_dec_loop:
2567___
2568 for ($i=0;$i<7;$i++) {
2569 $code.=<<___;
2570 pshufd \$0x13, $twtmp, $twres
2571 pxor $twtmp, $twtmp
2572 movdqa @XMM[7], @XMM[$i]
2573 movdqa @XMM[7], `0x10*$i`(%rsp)# save tweak[$i]
2574 paddq @XMM[7], @XMM[7] # psllq 1,$tweak
2575 pand $twmask, $twres # isolate carry and residue
2576 pcmpgtd @XMM[7], $twtmp # broadcast upper bits
2577 pxor $twres, @XMM[7]
2578___
2579 $code.=<<___ if ($i>=1);
2580 movdqu `0x10*($i-1)`($inp), @XMM[8+$i-1]
2581___
2582 $code.=<<___ if ($i>=2);
2583 pxor @XMM[8+$i-2], @XMM[$i-2]# input[] ^ tweak[]
2584___
2585 }
2586$code.=<<___;
2587 movdqu 0x60($inp), @XMM[8+6]
2588 pxor @XMM[8+5], @XMM[5]
2589 movdqu 0x70($inp), @XMM[8+7]
2590 lea 0x80($inp), $inp
2591 movdqa @XMM[7], 0x70(%rsp)
2592 pxor @XMM[8+6], @XMM[6]
2593 lea 0x80(%rsp), %rax # pass key schedule
2594 pxor @XMM[8+7], @XMM[7]
2595 mov %edx, %r10d # pass rounds
2596
2597 call _bsaes_decrypt8
2598
2599 pxor 0x00(%rsp), @XMM[0] # ^= tweak[]
2600 pxor 0x10(%rsp), @XMM[1]
2601 movdqu @XMM[0], 0x00($out) # write output
2602 pxor 0x20(%rsp), @XMM[6]
2603 movdqu @XMM[1], 0x10($out)
2604 pxor 0x30(%rsp), @XMM[4]
2605 movdqu @XMM[6], 0x20($out)
2606 pxor 0x40(%rsp), @XMM[2]
2607 movdqu @XMM[4], 0x30($out)
2608 pxor 0x50(%rsp), @XMM[7]
2609 movdqu @XMM[2], 0x40($out)
2610 pxor 0x60(%rsp), @XMM[3]
2611 movdqu @XMM[7], 0x50($out)
2612 pxor 0x70(%rsp), @XMM[5]
2613 movdqu @XMM[3], 0x60($out)
2614 movdqu @XMM[5], 0x70($out)
2615 lea 0x80($out), $out
2616
2617 movdqa 0x70(%rsp), @XMM[7] # prepare next iteration tweak
2618 pxor $twtmp, $twtmp
2619 movdqa .Lxts_magic(%rip), $twmask
2620 pcmpgtd @XMM[7], $twtmp
2621 pshufd \$0x13, $twtmp, $twres
2622 pxor $twtmp, $twtmp
2623 paddq @XMM[7], @XMM[7] # psllq 1,$tweak
2624 pand $twmask, $twres # isolate carry and residue
2625 pcmpgtd @XMM[7], $twtmp # broadcast upper bits
2626 pxor $twres, @XMM[7]
2627
2628 sub \$0x80,$len
2629 jnc .Lxts_dec_loop
2630
2631.Lxts_dec_short:
2632 add \$0x80, $len
2633 jz .Lxts_dec_done
2634___
2635 for ($i=0;$i<7;$i++) {
2636 $code.=<<___;
2637 pshufd \$0x13, $twtmp, $twres
2638 pxor $twtmp, $twtmp
2639 movdqa @XMM[7], @XMM[$i]
2640 movdqa @XMM[7], `0x10*$i`(%rsp)# save tweak[$i]
2641 paddq @XMM[7], @XMM[7] # psllq 1,$tweak
2642 pand $twmask, $twres # isolate carry and residue
2643 pcmpgtd @XMM[7], $twtmp # broadcast upper bits
2644 pxor $twres, @XMM[7]
2645___
2646 $code.=<<___ if ($i>=1);
2647 movdqu `0x10*($i-1)`($inp), @XMM[8+$i-1]
2648 cmp \$`0x10*$i`,$len
2649 je .Lxts_dec_$i
2650___
2651 $code.=<<___ if ($i>=2);
2652 pxor @XMM[8+$i-2], @XMM[$i-2]# input[] ^ tweak[]
2653___
2654 }
2655$code.=<<___;
2656 movdqu 0x60($inp), @XMM[8+6]
2657 pxor @XMM[8+5], @XMM[5]
2658 movdqa @XMM[7], 0x70(%rsp)
2659 lea 0x70($inp), $inp
2660 pxor @XMM[8+6], @XMM[6]
2661 lea 0x80(%rsp), %rax # pass key schedule
2662 mov %edx, %r10d # pass rounds
2663
2664 call _bsaes_decrypt8
2665
2666 pxor 0x00(%rsp), @XMM[0] # ^= tweak[]
2667 pxor 0x10(%rsp), @XMM[1]
2668 movdqu @XMM[0], 0x00($out) # write output
2669 pxor 0x20(%rsp), @XMM[6]
2670 movdqu @XMM[1], 0x10($out)
2671 pxor 0x30(%rsp), @XMM[4]
2672 movdqu @XMM[6], 0x20($out)
2673 pxor 0x40(%rsp), @XMM[2]
2674 movdqu @XMM[4], 0x30($out)
2675 pxor 0x50(%rsp), @XMM[7]
2676 movdqu @XMM[2], 0x40($out)
2677 pxor 0x60(%rsp), @XMM[3]
2678 movdqu @XMM[7], 0x50($out)
2679 movdqu @XMM[3], 0x60($out)
2680 lea 0x70($out), $out
2681
2682 movdqa 0x70(%rsp), @XMM[7] # next iteration tweak
2683 jmp .Lxts_dec_done
2684.align 16
2685.Lxts_dec_6:
2686 pxor @XMM[8+4], @XMM[4]
2687 lea 0x60($inp), $inp
2688 pxor @XMM[8+5], @XMM[5]
2689 lea 0x80(%rsp), %rax # pass key schedule
2690 mov %edx, %r10d # pass rounds
2691
2692 call _bsaes_decrypt8
2693
2694 pxor 0x00(%rsp), @XMM[0] # ^= tweak[]
2695 pxor 0x10(%rsp), @XMM[1]
2696 movdqu @XMM[0], 0x00($out) # write output
2697 pxor 0x20(%rsp), @XMM[6]
2698 movdqu @XMM[1], 0x10($out)
2699 pxor 0x30(%rsp), @XMM[4]
2700 movdqu @XMM[6], 0x20($out)
2701 pxor 0x40(%rsp), @XMM[2]
2702 movdqu @XMM[4], 0x30($out)
2703 pxor 0x50(%rsp), @XMM[7]
2704 movdqu @XMM[2], 0x40($out)
2705 movdqu @XMM[7], 0x50($out)
2706 lea 0x60($out), $out
2707
2708 movdqa 0x60(%rsp), @XMM[7] # next iteration tweak
2709 jmp .Lxts_dec_done
2710.align 16
2711.Lxts_dec_5:
2712 pxor @XMM[8+3], @XMM[3]
2713 lea 0x50($inp), $inp
2714 pxor @XMM[8+4], @XMM[4]
2715 lea 0x80(%rsp), %rax # pass key schedule
2716 mov %edx, %r10d # pass rounds
2717
2718 call _bsaes_decrypt8
2719
2720 pxor 0x00(%rsp), @XMM[0] # ^= tweak[]
2721 pxor 0x10(%rsp), @XMM[1]
2722 movdqu @XMM[0], 0x00($out) # write output
2723 pxor 0x20(%rsp), @XMM[6]
2724 movdqu @XMM[1], 0x10($out)
2725 pxor 0x30(%rsp), @XMM[4]
2726 movdqu @XMM[6], 0x20($out)
2727 pxor 0x40(%rsp), @XMM[2]
2728 movdqu @XMM[4], 0x30($out)
2729 movdqu @XMM[2], 0x40($out)
2730 lea 0x50($out), $out
2731
2732 movdqa 0x50(%rsp), @XMM[7] # next iteration tweak
2733 jmp .Lxts_dec_done
2734.align 16
2735.Lxts_dec_4:
2736 pxor @XMM[8+2], @XMM[2]
2737 lea 0x40($inp), $inp
2738 pxor @XMM[8+3], @XMM[3]
2739 lea 0x80(%rsp), %rax # pass key schedule
2740 mov %edx, %r10d # pass rounds
2741
2742 call _bsaes_decrypt8
2743
2744 pxor 0x00(%rsp), @XMM[0] # ^= tweak[]
2745 pxor 0x10(%rsp), @XMM[1]
2746 movdqu @XMM[0], 0x00($out) # write output
2747 pxor 0x20(%rsp), @XMM[6]
2748 movdqu @XMM[1], 0x10($out)
2749 pxor 0x30(%rsp), @XMM[4]
2750 movdqu @XMM[6], 0x20($out)
2751 movdqu @XMM[4], 0x30($out)
2752 lea 0x40($out), $out
2753
2754 movdqa 0x40(%rsp), @XMM[7] # next iteration tweak
2755 jmp .Lxts_dec_done
2756.align 16
2757.Lxts_dec_3:
2758 pxor @XMM[8+1], @XMM[1]
2759 lea 0x30($inp), $inp
2760 pxor @XMM[8+2], @XMM[2]
2761 lea 0x80(%rsp), %rax # pass key schedule
2762 mov %edx, %r10d # pass rounds
2763
2764 call _bsaes_decrypt8
2765
2766 pxor 0x00(%rsp), @XMM[0] # ^= tweak[]
2767 pxor 0x10(%rsp), @XMM[1]
2768 movdqu @XMM[0], 0x00($out) # write output
2769 pxor 0x20(%rsp), @XMM[6]
2770 movdqu @XMM[1], 0x10($out)
2771 movdqu @XMM[6], 0x20($out)
2772 lea 0x30($out), $out
2773
2774 movdqa 0x30(%rsp), @XMM[7] # next iteration tweak
2775 jmp .Lxts_dec_done
2776.align 16
2777.Lxts_dec_2:
2778 pxor @XMM[8+0], @XMM[0]
2779 lea 0x20($inp), $inp
2780 pxor @XMM[8+1], @XMM[1]
2781 lea 0x80(%rsp), %rax # pass key schedule
2782 mov %edx, %r10d # pass rounds
2783
2784 call _bsaes_decrypt8
2785
2786 pxor 0x00(%rsp), @XMM[0] # ^= tweak[]
2787 pxor 0x10(%rsp), @XMM[1]
2788 movdqu @XMM[0], 0x00($out) # write output
2789 movdqu @XMM[1], 0x10($out)
2790 lea 0x20($out), $out
2791
2792 movdqa 0x20(%rsp), @XMM[7] # next iteration tweak
2793 jmp .Lxts_dec_done
2794.align 16
2795.Lxts_dec_1:
2796 pxor @XMM[0], @XMM[8]
2797 lea 0x10($inp), $inp
2798 movdqa @XMM[8], 0x20(%rbp)
2799 lea 0x20(%rbp), $arg1
2800 lea 0x20(%rbp), $arg2
2801 lea ($key), $arg3
2802 call asm_AES_decrypt # doesn't touch %xmm
2803 pxor 0x20(%rbp), @XMM[0] # ^= tweak[]
2804 #pxor @XMM[8], @XMM[0]
2805 #lea 0x80(%rsp), %rax # pass key schedule
2806 #mov %edx, %r10d # pass rounds
2807 #call _bsaes_decrypt8
2808 #pxor 0x00(%rsp), @XMM[0] # ^= tweak[]
2809 movdqu @XMM[0], 0x00($out) # write output
2810 lea 0x10($out), $out
2811
2812 movdqa 0x10(%rsp), @XMM[7] # next iteration tweak
2813
2814.Lxts_dec_done:
2815 and \$15, %ebx
2816 jz .Lxts_dec_ret
2817
2818 pxor $twtmp, $twtmp
2819 movdqa .Lxts_magic(%rip), $twmask
2820 pcmpgtd @XMM[7], $twtmp
2821 pshufd \$0x13, $twtmp, $twres
2822 movdqa @XMM[7], @XMM[6]
2823 paddq @XMM[7], @XMM[7] # psllq 1,$tweak
2824 pand $twmask, $twres # isolate carry and residue
2825 movdqu ($inp), @XMM[0]
2826 pxor $twres, @XMM[7]
2827
2828 lea 0x20(%rbp), $arg1
2829 pxor @XMM[7], @XMM[0]
2830 lea 0x20(%rbp), $arg2
2831 movdqa @XMM[0], 0x20(%rbp)
2832 lea ($key), $arg3
2833 call asm_AES_decrypt # doesn't touch %xmm
2834 pxor 0x20(%rbp), @XMM[7]
2835 mov $out, %rdx
2836 movdqu @XMM[7], ($out)
2837
2838.Lxts_dec_steal:
2839 movzb 16($inp), %eax
2840 movzb (%rdx), %ecx
2841 lea 1($inp), $inp
2842 mov %al, (%rdx)
2843 mov %cl, 16(%rdx)
2844 lea 1(%rdx), %rdx
2845 sub \$1,%ebx
2846 jnz .Lxts_dec_steal
2847
2848 movdqu ($out), @XMM[0]
2849 lea 0x20(%rbp), $arg1
2850 pxor @XMM[6], @XMM[0]
2851 lea 0x20(%rbp), $arg2
2852 movdqa @XMM[0], 0x20(%rbp)
2853 lea ($key), $arg3
2854 call asm_AES_decrypt # doesn't touch %xmm
2855 pxor 0x20(%rbp), @XMM[6]
2856 movdqu @XMM[6], ($out)
2857
2858.Lxts_dec_ret:
2859 lea (%rsp), %rax
2860 pxor %xmm0, %xmm0
2861.Lxts_dec_bzero: # wipe key schedule [if any]
2862 movdqa %xmm0, 0x00(%rax)
2863 movdqa %xmm0, 0x10(%rax)
2864 lea 0x20(%rax), %rax
2865 cmp %rax, %rbp
2866 ja .Lxts_dec_bzero
2867
2868 lea (%rbp),%rsp # restore %rsp
2869___
2870$code.=<<___ if ($win64);
2871 movaps 0x40(%rbp), %xmm6
2872 movaps 0x50(%rbp), %xmm7
2873 movaps 0x60(%rbp), %xmm8
2874 movaps 0x70(%rbp), %xmm9
2875 movaps 0x80(%rbp), %xmm10
2876 movaps 0x90(%rbp), %xmm11
2877 movaps 0xa0(%rbp), %xmm12
2878 movaps 0xb0(%rbp), %xmm13
2879 movaps 0xc0(%rbp), %xmm14
2880 movaps 0xd0(%rbp), %xmm15
2881 lea 0xa0(%rbp), %rsp
2882___
2883$code.=<<___;
2884 mov 0x48(%rsp), %r15
2885 mov 0x50(%rsp), %r14
2886 mov 0x58(%rsp), %r13
2887 mov 0x60(%rsp), %r12
2888 mov 0x68(%rsp), %rbx
2889 mov 0x70(%rsp), %rax
2890 lea 0x78(%rsp), %rsp
2891 mov %rax, %rbp
2892.Lxts_dec_epilogue:
2893 ret
2894.size bsaes_xts_decrypt,.-bsaes_xts_decrypt
2895___
2896}
2897$code.=<<___;
2898.section .rodata
2899.type _bsaes_const,\@object
2900.align 64
2901_bsaes_const:
2902.LM0ISR: # InvShiftRows constants
2903 .quad 0x0a0e0206070b0f03, 0x0004080c0d010509
2904.LISRM0:
2905 .quad 0x01040b0e0205080f, 0x0306090c00070a0d
2906.LISR:
2907 .quad 0x0504070602010003, 0x0f0e0d0c080b0a09
2908.LBS0: # bit-slice constants
2909 .quad 0x5555555555555555, 0x5555555555555555
2910.LBS1:
2911 .quad 0x3333333333333333, 0x3333333333333333
2912.LBS2:
2913 .quad 0x0f0f0f0f0f0f0f0f, 0x0f0f0f0f0f0f0f0f
2914.LSR: # shiftrows constants
2915 .quad 0x0504070600030201, 0x0f0e0d0c0a09080b
2916.LSRM0:
2917 .quad 0x0304090e00050a0f, 0x01060b0c0207080d
2918.LM0SR:
2919 .quad 0x0a0e02060f03070b, 0x0004080c05090d01
2920.LSWPUP: # byte-swap upper dword
2921 .quad 0x0706050403020100, 0x0c0d0e0f0b0a0908
2922.LSWPUPM0SR:
2923 .quad 0x0a0d02060c03070b, 0x0004080f05090e01
2924.LADD1: # counter increment constants
2925 .quad 0x0000000000000000, 0x0000000100000000
2926.LADD2:
2927 .quad 0x0000000000000000, 0x0000000200000000
2928.LADD3:
2929 .quad 0x0000000000000000, 0x0000000300000000
2930.LADD4:
2931 .quad 0x0000000000000000, 0x0000000400000000
2932.LADD5:
2933 .quad 0x0000000000000000, 0x0000000500000000
2934.LADD6:
2935 .quad 0x0000000000000000, 0x0000000600000000
2936.LADD7:
2937 .quad 0x0000000000000000, 0x0000000700000000
2938.LADD8:
2939 .quad 0x0000000000000000, 0x0000000800000000
2940.Lxts_magic:
2941 .long 0x87,0,1,0
2942.Lmasks:
2943 .quad 0x0101010101010101, 0x0101010101010101
2944 .quad 0x0202020202020202, 0x0202020202020202
2945 .quad 0x0404040404040404, 0x0404040404040404
2946 .quad 0x0808080808080808, 0x0808080808080808
2947.LM0:
2948 .quad 0x02060a0e03070b0f, 0x0004080c0105090d
2949.L63:
2950 .quad 0x6363636363636363, 0x6363636363636363
2951.align 64
2952.size _bsaes_const,.-_bsaes_const
2953.text
2954___
2955
2956# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
2957# CONTEXT *context,DISPATCHER_CONTEXT *disp)
2958if ($win64) {
2959$rec="%rcx";
2960$frame="%rdx";
2961$context="%r8";
2962$disp="%r9";
2963
2964$code.=<<___;
2965.extern __imp_RtlVirtualUnwind
2966.type se_handler,\@abi-omnipotent
2967.align 16
2968se_handler:
2969 _CET_ENDBR
2970 push %rsi
2971 push %rdi
2972 push %rbx
2973 push %rbp
2974 push %r12
2975 push %r13
2976 push %r14
2977 push %r15
2978 pushfq
2979 sub \$64,%rsp
2980
2981 mov 120($context),%rax # pull context->Rax
2982 mov 248($context),%rbx # pull context->Rip
2983
2984 mov 8($disp),%rsi # disp->ImageBase
2985 mov 56($disp),%r11 # disp->HandlerData
2986
2987 mov 0(%r11),%r10d # HandlerData[0]
2988 lea (%rsi,%r10),%r10 # prologue label
2989 cmp %r10,%rbx # context->Rip<prologue label
2990 jb .Lin_prologue
2991
2992 mov 152($context),%rax # pull context->Rsp
2993
2994 mov 4(%r11),%r10d # HandlerData[1]
2995 lea (%rsi,%r10),%r10 # epilogue label
2996 cmp %r10,%rbx # context->Rip>=epilogue label
2997 jae .Lin_prologue
2998
2999 mov 160($context),%rax # pull context->Rbp
3000
3001 lea 0x40(%rax),%rsi # %xmm save area
3002 lea 512($context),%rdi # &context.Xmm6
3003 mov \$20,%ecx # 10*sizeof(%xmm0)/sizeof(%rax)
3004 .long 0xa548f3fc # cld; rep movsq
3005 lea 0xa0(%rax),%rax # adjust stack pointer
3006
3007 mov 0x70(%rax),%rbp
3008 mov 0x68(%rax),%rbx
3009 mov 0x60(%rax),%r12
3010 mov 0x58(%rax),%r13
3011 mov 0x50(%rax),%r14
3012 mov 0x48(%rax),%r15
3013 lea 0x78(%rax),%rax # adjust stack pointer
3014 mov %rbx,144($context) # restore context->Rbx
3015 mov %rbp,160($context) # restore context->Rbp
3016 mov %r12,216($context) # restore context->R12
3017 mov %r13,224($context) # restore context->R13
3018 mov %r14,232($context) # restore context->R14
3019 mov %r15,240($context) # restore context->R15
3020
3021.Lin_prologue:
3022 mov %rax,152($context) # restore context->Rsp
3023
3024 mov 40($disp),%rdi # disp->ContextRecord
3025 mov $context,%rsi # context
3026 mov \$`1232/8`,%ecx # sizeof(CONTEXT)
3027 .long 0xa548f3fc # cld; rep movsq
3028
3029 mov $disp,%rsi
3030 xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER
3031 mov 8(%rsi),%rdx # arg2, disp->ImageBase
3032 mov 0(%rsi),%r8 # arg3, disp->ControlPc
3033 mov 16(%rsi),%r9 # arg4, disp->FunctionEntry
3034 mov 40(%rsi),%r10 # disp->ContextRecord
3035 lea 56(%rsi),%r11 # &disp->HandlerData
3036 lea 24(%rsi),%r12 # &disp->EstablisherFrame
3037 mov %r10,32(%rsp) # arg5
3038 mov %r11,40(%rsp) # arg6
3039 mov %r12,48(%rsp) # arg7
3040 mov %rcx,56(%rsp) # arg8, (NULL)
3041 call *__imp_RtlVirtualUnwind(%rip)
3042
3043 mov \$1,%eax # ExceptionContinueSearch
3044 add \$64,%rsp
3045 popfq
3046 pop %r15
3047 pop %r14
3048 pop %r13
3049 pop %r12
3050 pop %rbp
3051 pop %rbx
3052 pop %rdi
3053 pop %rsi
3054 ret
3055.size se_handler,.-se_handler
3056
3057.section .pdata
3058.align 4
3059___
3060$code.=<<___ if ($ecb);
3061 .rva .Lecb_enc_prologue
3062 .rva .Lecb_enc_epilogue
3063 .rva .Lecb_enc_info
3064
3065 .rva .Lecb_dec_prologue
3066 .rva .Lecb_dec_epilogue
3067 .rva .Lecb_dec_info
3068___
3069$code.=<<___;
3070 .rva .Lcbc_dec_prologue
3071 .rva .Lcbc_dec_epilogue
3072 .rva .Lcbc_dec_info
3073
3074 .rva .Lctr_enc_prologue
3075 .rva .Lctr_enc_epilogue
3076 .rva .Lctr_enc_info
3077
3078 .rva .Lxts_enc_prologue
3079 .rva .Lxts_enc_epilogue
3080 .rva .Lxts_enc_info
3081
3082 .rva .Lxts_dec_prologue
3083 .rva .Lxts_dec_epilogue
3084 .rva .Lxts_dec_info
3085
3086.section .xdata
3087.align 8
3088___
3089$code.=<<___ if ($ecb);
3090.Lecb_enc_info:
3091 .byte 9,0,0,0
3092 .rva se_handler
3093 .rva .Lecb_enc_body,.Lecb_enc_epilogue # HandlerData[]
3094.Lecb_dec_info:
3095 .byte 9,0,0,0
3096 .rva se_handler
3097 .rva .Lecb_dec_body,.Lecb_dec_epilogue # HandlerData[]
3098___
3099$code.=<<___;
3100.Lcbc_dec_info:
3101 .byte 9,0,0,0
3102 .rva se_handler
3103 .rva .Lcbc_dec_body,.Lcbc_dec_epilogue # HandlerData[]
3104.Lctr_enc_info:
3105 .byte 9,0,0,0
3106 .rva se_handler
3107 .rva .Lctr_enc_body,.Lctr_enc_epilogue # HandlerData[]
3108.Lxts_enc_info:
3109 .byte 9,0,0,0
3110 .rva se_handler
3111 .rva .Lxts_enc_body,.Lxts_enc_epilogue # HandlerData[]
3112.Lxts_dec_info:
3113 .byte 9,0,0,0
3114 .rva se_handler
3115 .rva .Lxts_dec_body,.Lxts_dec_epilogue # HandlerData[]
3116___
3117}
3118
3119$code =~ s/\`([^\`]*)\`/eval($1)/gem;
3120
3121print $code;
3122
3123close STDOUT;
diff --git a/src/lib/libcrypto/aes/asm/vpaes-x86.pl b/src/lib/libcrypto/aes/asm/vpaes-x86.pl
deleted file mode 100644
index 6e7bd36d05..0000000000
--- a/src/lib/libcrypto/aes/asm/vpaes-x86.pl
+++ /dev/null
@@ -1,911 +0,0 @@
1#!/usr/bin/env perl
2
3######################################################################
4## Constant-time SSSE3 AES core implementation.
5## version 0.1
6##
7## By Mike Hamburg (Stanford University), 2009
8## Public domain.
9##
10## For details see http://shiftleft.org/papers/vector_aes/ and
11## http://crypto.stanford.edu/vpaes/.
12
13######################################################################
14# September 2011.
15#
16# Port vpaes-x86_64.pl as 32-bit "almost" drop-in replacement for
17# aes-586.pl. "Almost" refers to the fact that AES_cbc_encrypt
18# doesn't handle partial vectors (doesn't have to if called from
19# EVP only). "Drop-in" implies that this module doesn't share key
20# schedule structure with the original nor does it make assumption
21# about its alignment...
22#
23# Performance summary. aes-586.pl column lists large-block CBC
24# encrypt/decrypt/with-hyper-threading-off(*) results in cycles per
25# byte processed with 128-bit key, and vpaes-x86.pl column - [also
26# large-block CBC] encrypt/decrypt.
27#
28# aes-586.pl vpaes-x86.pl
29#
30# Core 2(**) 29.1/42.3/18.3 22.0/25.6(***)
31# Nehalem 27.9/40.4/18.1 10.3/12.0
32# Atom 102./119./60.1 64.5/85.3(***)
33#
34# (*) "Hyper-threading" in the context refers rather to cache shared
35# among multiple cores, than to specifically Intel HTT. As vast
36# majority of contemporary cores share cache, slower code path
37# is common place. In other words "with-hyper-threading-off"
38# results are presented mostly for reference purposes.
39#
40# (**) "Core 2" refers to initial 65nm design, a.k.a. Conroe.
41#
42# (***) Less impressive improvement on Core 2 and Atom is due to slow
43# pshufb, yet it's respectable +32%/65% improvement on Core 2
44# and +58%/40% on Atom (as implied, over "hyper-threading-safe"
45# code path).
46#
47# <appro@openssl.org>
48
49$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
50push(@INC,"${dir}","${dir}../../perlasm");
51require "x86asm.pl";
52
53&asm_init($ARGV[0],"vpaes-x86.pl",$x86only = $ARGV[$#ARGV] eq "386");
54
55$PREFIX="vpaes";
56
57my ($round, $base, $magic, $key, $const, $inp, $out)=
58 ("eax", "ebx", "ecx", "edx","ebp", "esi","edi");
59
60 &rodataseg();
61&static_label("_vpaes_consts");
62&static_label("_vpaes_schedule_low_round");
63
64&set_label("_vpaes_consts",64);
65$k_inv=-0x30; # inv, inva
66 &data_word(0x0D080180,0x0E05060F,0x0A0B0C02,0x04070309);
67 &data_word(0x0F0B0780,0x01040A06,0x02050809,0x030D0E0C);
68
69$k_s0F=-0x10; # s0F
70 &data_word(0x0F0F0F0F,0x0F0F0F0F,0x0F0F0F0F,0x0F0F0F0F);
71
72$k_ipt=0x00; # input transform (lo, hi)
73 &data_word(0x5A2A7000,0xC2B2E898,0x52227808,0xCABAE090);
74 &data_word(0x317C4D00,0x4C01307D,0xB0FDCC81,0xCD80B1FC);
75
76$k_sb1=0x20; # sb1u, sb1t
77 &data_word(0xCB503E00,0xB19BE18F,0x142AF544,0xA5DF7A6E);
78 &data_word(0xFAE22300,0x3618D415,0x0D2ED9EF,0x3BF7CCC1);
79$k_sb2=0x40; # sb2u, sb2t
80 &data_word(0x0B712400,0xE27A93C6,0xBC982FCD,0x5EB7E955);
81 &data_word(0x0AE12900,0x69EB8840,0xAB82234A,0xC2A163C8);
82$k_sbo=0x60; # sbou, sbot
83 &data_word(0x6FBDC700,0xD0D26D17,0xC502A878,0x15AABF7A);
84 &data_word(0x5FBB6A00,0xCFE474A5,0x412B35FA,0x8E1E90D1);
85
86$k_mc_forward=0x80; # mc_forward
87 &data_word(0x00030201,0x04070605,0x080B0A09,0x0C0F0E0D);
88 &data_word(0x04070605,0x080B0A09,0x0C0F0E0D,0x00030201);
89 &data_word(0x080B0A09,0x0C0F0E0D,0x00030201,0x04070605);
90 &data_word(0x0C0F0E0D,0x00030201,0x04070605,0x080B0A09);
91
92$k_mc_backward=0xc0; # mc_backward
93 &data_word(0x02010003,0x06050407,0x0A09080B,0x0E0D0C0F);
94 &data_word(0x0E0D0C0F,0x02010003,0x06050407,0x0A09080B);
95 &data_word(0x0A09080B,0x0E0D0C0F,0x02010003,0x06050407);
96 &data_word(0x06050407,0x0A09080B,0x0E0D0C0F,0x02010003);
97
98$k_sr=0x100; # sr
99 &data_word(0x03020100,0x07060504,0x0B0A0908,0x0F0E0D0C);
100 &data_word(0x0F0A0500,0x030E0904,0x07020D08,0x0B06010C);
101 &data_word(0x0B020900,0x0F060D04,0x030A0108,0x070E050C);
102 &data_word(0x070A0D00,0x0B0E0104,0x0F020508,0x0306090C);
103
104$k_rcon=0x140; # rcon
105 &data_word(0xAF9DEEB6,0x1F8391B9,0x4D7C7D81,0x702A9808);
106
107$k_s63=0x150; # s63: all equal to 0x63 transformed
108 &data_word(0x5B5B5B5B,0x5B5B5B5B,0x5B5B5B5B,0x5B5B5B5B);
109
110$k_opt=0x160; # output transform
111 &data_word(0xD6B66000,0xFF9F4929,0xDEBE6808,0xF7974121);
112 &data_word(0x50BCEC00,0x01EDBD51,0xB05C0CE0,0xE10D5DB1);
113
114$k_deskew=0x180; # deskew tables: inverts the sbox's "skew"
115 &data_word(0x47A4E300,0x07E4A340,0x5DBEF91A,0x1DFEB95A);
116 &data_word(0x83EA6900,0x5F36B5DC,0xF49D1E77,0x2841C2AB);
117##
118## Decryption stuff
119## Key schedule constants
120##
121$k_dksd=0x1a0; # decryption key schedule: invskew x*D
122 &data_word(0xA3E44700,0xFEB91A5D,0x5A1DBEF9,0x0740E3A4);
123 &data_word(0xB5368300,0x41C277F4,0xAB289D1E,0x5FDC69EA);
124$k_dksb=0x1c0; # decryption key schedule: invskew x*B
125 &data_word(0x8550D500,0x9A4FCA1F,0x1CC94C99,0x03D65386);
126 &data_word(0xB6FC4A00,0x115BEDA7,0x7E3482C8,0xD993256F);
127$k_dkse=0x1e0; # decryption key schedule: invskew x*E + 0x63
128 &data_word(0x1FC9D600,0xD5031CCA,0x994F5086,0x53859A4C);
129 &data_word(0x4FDC7BE8,0xA2319605,0x20B31487,0xCD5EF96A);
130$k_dks9=0x200; # decryption key schedule: invskew x*9
131 &data_word(0x7ED9A700,0xB6116FC8,0x82255BFC,0x4AED9334);
132 &data_word(0x27143300,0x45765162,0xE9DAFDCE,0x8BB89FAC);
133
134##
135## Decryption stuff
136## Round function constants
137##
138$k_dipt=0x220; # decryption input transform
139 &data_word(0x0B545F00,0x0F505B04,0x114E451A,0x154A411E);
140 &data_word(0x60056500,0x86E383E6,0xF491F194,0x12771772);
141
142$k_dsb9=0x240; # decryption sbox output *9*u, *9*t
143 &data_word(0x9A86D600,0x851C0353,0x4F994CC9,0xCAD51F50);
144 &data_word(0xECD74900,0xC03B1789,0xB2FBA565,0x725E2C9E);
145$k_dsbd=0x260; # decryption sbox output *D*u, *D*t
146 &data_word(0xE6B1A200,0x7D57CCDF,0x882A4439,0xF56E9B13);
147 &data_word(0x24C6CB00,0x3CE2FAF7,0x15DEEFD3,0x2931180D);
148$k_dsbb=0x280; # decryption sbox output *B*u, *B*t
149 &data_word(0x96B44200,0xD0226492,0xB0F2D404,0x602646F6);
150 &data_word(0xCD596700,0xC19498A6,0x3255AA6B,0xF3FF0C3E);
151$k_dsbe=0x2a0; # decryption sbox output *E*u, *E*t
152 &data_word(0x26D4D000,0x46F29296,0x64B4F6B0,0x22426004);
153 &data_word(0xFFAAC100,0x0C55A6CD,0x98593E32,0x9467F36B);
154$k_dsbo=0x2c0; # decryption sbox final output
155 &data_word(0x7EF94000,0x1387EA53,0xD4943E2D,0xC7AA6DB9);
156 &data_word(0x93441D00,0x12D7560F,0xD8C58E9C,0xCA4B8159);
157 &previous();
158
159&function_begin_B("_vpaes_preheat");
160 &movdqa ("xmm7",&QWP($k_inv,$const));
161 &movdqa ("xmm6",&QWP($k_s0F,$const));
162 &ret ();
163&function_end_B("_vpaes_preheat");
164
165##
166## _aes_encrypt_core
167##
168## AES-encrypt %xmm0.
169##
170## Inputs:
171## %xmm0 = input
172## %xmm6-%xmm7 as in _vpaes_preheat
173## (%edx) = scheduled keys
174##
175## Output in %xmm0
176## Clobbers %xmm1-%xmm5, %eax, %ebx, %ecx, %edx
177##
178##
179&function_begin_B("_vpaes_encrypt_core");
180 &mov ($magic,16);
181 &mov ($round,&DWP(240,$key));
182 &movdqa ("xmm1","xmm6")
183 &movdqa ("xmm2",&QWP($k_ipt,$const));
184 &pandn ("xmm1","xmm0");
185 &movdqu ("xmm5",&QWP(0,$key));
186 &psrld ("xmm1",4);
187 &pand ("xmm0","xmm6");
188 &pshufb ("xmm2","xmm0");
189 &movdqa ("xmm0",&QWP($k_ipt+16,$const));
190 &pshufb ("xmm0","xmm1");
191 &pxor ("xmm2","xmm5");
192 &pxor ("xmm0","xmm2");
193 &add ($key,16);
194 &lea ($base,&DWP($k_mc_backward,$const));
195 &jmp (&label("enc_entry"));
196
197
198&set_label("enc_loop",16);
199 # middle of middle round
200 &movdqa ("xmm4",&QWP($k_sb1,$const)); # 4 : sb1u
201 &pshufb ("xmm4","xmm2"); # 4 = sb1u
202 &pxor ("xmm4","xmm5"); # 4 = sb1u + k
203 &movdqa ("xmm0",&QWP($k_sb1+16,$const));# 0 : sb1t
204 &pshufb ("xmm0","xmm3"); # 0 = sb1t
205 &pxor ("xmm0","xmm4"); # 0 = A
206 &movdqa ("xmm5",&QWP($k_sb2,$const)); # 4 : sb2u
207 &pshufb ("xmm5","xmm2"); # 4 = sb2u
208 &movdqa ("xmm1",&QWP(-0x40,$base,$magic));# .Lk_mc_forward[]
209 &movdqa ("xmm2",&QWP($k_sb2+16,$const));# 2 : sb2t
210 &pshufb ("xmm2","xmm3"); # 2 = sb2t
211 &pxor ("xmm2","xmm5"); # 2 = 2A
212 &movdqa ("xmm4",&QWP(0,$base,$magic)); # .Lk_mc_backward[]
213 &movdqa ("xmm3","xmm0"); # 3 = A
214 &pshufb ("xmm0","xmm1"); # 0 = B
215 &add ($key,16); # next key
216 &pxor ("xmm0","xmm2"); # 0 = 2A+B
217 &pshufb ("xmm3","xmm4"); # 3 = D
218 &add ($magic,16); # next mc
219 &pxor ("xmm3","xmm0"); # 3 = 2A+B+D
220 &pshufb ("xmm0","xmm1"); # 0 = 2B+C
221 &and ($magic,0x30); # ... mod 4
222 &pxor ("xmm0","xmm3"); # 0 = 2A+3B+C+D
223 &sub ($round,1); # nr--
224
225&set_label("enc_entry");
226 # top of round
227 &movdqa ("xmm1","xmm6"); # 1 : i
228 &pandn ("xmm1","xmm0"); # 1 = i<<4
229 &psrld ("xmm1",4); # 1 = i
230 &pand ("xmm0","xmm6"); # 0 = k
231 &movdqa ("xmm5",&QWP($k_inv+16,$const));# 2 : a/k
232 &pshufb ("xmm5","xmm0"); # 2 = a/k
233 &pxor ("xmm0","xmm1"); # 0 = j
234 &movdqa ("xmm3","xmm7"); # 3 : 1/i
235 &pshufb ("xmm3","xmm1"); # 3 = 1/i
236 &pxor ("xmm3","xmm5"); # 3 = iak = 1/i + a/k
237 &movdqa ("xmm4","xmm7"); # 4 : 1/j
238 &pshufb ("xmm4","xmm0"); # 4 = 1/j
239 &pxor ("xmm4","xmm5"); # 4 = jak = 1/j + a/k
240 &movdqa ("xmm2","xmm7"); # 2 : 1/iak
241 &pshufb ("xmm2","xmm3"); # 2 = 1/iak
242 &pxor ("xmm2","xmm0"); # 2 = io
243 &movdqa ("xmm3","xmm7"); # 3 : 1/jak
244 &movdqu ("xmm5",&QWP(0,$key));
245 &pshufb ("xmm3","xmm4"); # 3 = 1/jak
246 &pxor ("xmm3","xmm1"); # 3 = jo
247 &jnz (&label("enc_loop"));
248
249 # middle of last round
250 &movdqa ("xmm4",&QWP($k_sbo,$const)); # 3 : sbou .Lk_sbo
251 &movdqa ("xmm0",&QWP($k_sbo+16,$const));# 3 : sbot .Lk_sbo+16
252 &pshufb ("xmm4","xmm2"); # 4 = sbou
253 &pxor ("xmm4","xmm5"); # 4 = sb1u + k
254 &pshufb ("xmm0","xmm3"); # 0 = sb1t
255 &movdqa ("xmm1",&QWP(0x40,$base,$magic));# .Lk_sr[]
256 &pxor ("xmm0","xmm4"); # 0 = A
257 &pshufb ("xmm0","xmm1");
258 &ret ();
259&function_end_B("_vpaes_encrypt_core");
260
261##
262## Decryption core
263##
264## Same API as encryption core.
265##
266&function_begin_B("_vpaes_decrypt_core");
267 &mov ($round,&DWP(240,$key));
268 &lea ($base,&DWP($k_dsbd,$const));
269 &movdqa ("xmm1","xmm6");
270 &movdqa ("xmm2",&QWP($k_dipt-$k_dsbd,$base));
271 &pandn ("xmm1","xmm0");
272 &mov ($magic,$round);
273 &psrld ("xmm1",4)
274 &movdqu ("xmm5",&QWP(0,$key));
275 &shl ($magic,4);
276 &pand ("xmm0","xmm6");
277 &pshufb ("xmm2","xmm0");
278 &movdqa ("xmm0",&QWP($k_dipt-$k_dsbd+16,$base));
279 &xor ($magic,0x30);
280 &pshufb ("xmm0","xmm1");
281 &and ($magic,0x30);
282 &pxor ("xmm2","xmm5");
283 &movdqa ("xmm5",&QWP($k_mc_forward+48,$const));
284 &pxor ("xmm0","xmm2");
285 &add ($key,16);
286 &lea ($magic,&DWP($k_sr-$k_dsbd,$base,$magic));
287 &jmp (&label("dec_entry"));
288
289&set_label("dec_loop",16);
290##
291## Inverse mix columns
292##
293 &movdqa ("xmm4",&QWP(-0x20,$base)); # 4 : sb9u
294 &pshufb ("xmm4","xmm2"); # 4 = sb9u
295 &pxor ("xmm4","xmm0");
296 &movdqa ("xmm0",&QWP(-0x10,$base)); # 0 : sb9t
297 &pshufb ("xmm0","xmm3"); # 0 = sb9t
298 &pxor ("xmm0","xmm4"); # 0 = ch
299 &add ($key,16); # next round key
300
301 &pshufb ("xmm0","xmm5"); # MC ch
302 &movdqa ("xmm4",&QWP(0,$base)); # 4 : sbdu
303 &pshufb ("xmm4","xmm2"); # 4 = sbdu
304 &pxor ("xmm4","xmm0"); # 4 = ch
305 &movdqa ("xmm0",&QWP(0x10,$base)); # 0 : sbdt
306 &pshufb ("xmm0","xmm3"); # 0 = sbdt
307 &pxor ("xmm0","xmm4"); # 0 = ch
308 &sub ($round,1); # nr--
309
310 &pshufb ("xmm0","xmm5"); # MC ch
311 &movdqa ("xmm4",&QWP(0x20,$base)); # 4 : sbbu
312 &pshufb ("xmm4","xmm2"); # 4 = sbbu
313 &pxor ("xmm4","xmm0"); # 4 = ch
314 &movdqa ("xmm0",&QWP(0x30,$base)); # 0 : sbbt
315 &pshufb ("xmm0","xmm3"); # 0 = sbbt
316 &pxor ("xmm0","xmm4"); # 0 = ch
317
318 &pshufb ("xmm0","xmm5"); # MC ch
319 &movdqa ("xmm4",&QWP(0x40,$base)); # 4 : sbeu
320 &pshufb ("xmm4","xmm2"); # 4 = sbeu
321 &pxor ("xmm4","xmm0"); # 4 = ch
322 &movdqa ("xmm0",&QWP(0x50,$base)); # 0 : sbet
323 &pshufb ("xmm0","xmm3"); # 0 = sbet
324 &pxor ("xmm0","xmm4"); # 0 = ch
325
326 &palignr("xmm5","xmm5",12);
327
328&set_label("dec_entry");
329 # top of round
330 &movdqa ("xmm1","xmm6"); # 1 : i
331 &pandn ("xmm1","xmm0"); # 1 = i<<4
332 &psrld ("xmm1",4); # 1 = i
333 &pand ("xmm0","xmm6"); # 0 = k
334 &movdqa ("xmm2",&QWP($k_inv+16,$const));# 2 : a/k
335 &pshufb ("xmm2","xmm0"); # 2 = a/k
336 &pxor ("xmm0","xmm1"); # 0 = j
337 &movdqa ("xmm3","xmm7"); # 3 : 1/i
338 &pshufb ("xmm3","xmm1"); # 3 = 1/i
339 &pxor ("xmm3","xmm2"); # 3 = iak = 1/i + a/k
340 &movdqa ("xmm4","xmm7"); # 4 : 1/j
341 &pshufb ("xmm4","xmm0"); # 4 = 1/j
342 &pxor ("xmm4","xmm2"); # 4 = jak = 1/j + a/k
343 &movdqa ("xmm2","xmm7"); # 2 : 1/iak
344 &pshufb ("xmm2","xmm3"); # 2 = 1/iak
345 &pxor ("xmm2","xmm0"); # 2 = io
346 &movdqa ("xmm3","xmm7"); # 3 : 1/jak
347 &pshufb ("xmm3","xmm4"); # 3 = 1/jak
348 &pxor ("xmm3","xmm1"); # 3 = jo
349 &movdqu ("xmm0",&QWP(0,$key));
350 &jnz (&label("dec_loop"));
351
352 # middle of last round
353 &movdqa ("xmm4",&QWP(0x60,$base)); # 3 : sbou
354 &pshufb ("xmm4","xmm2"); # 4 = sbou
355 &pxor ("xmm4","xmm0"); # 4 = sb1u + k
356 &movdqa ("xmm0",&QWP(0x70,$base)); # 0 : sbot
357 &movdqa ("xmm2",&QWP(0,$magic));
358 &pshufb ("xmm0","xmm3"); # 0 = sb1t
359 &pxor ("xmm0","xmm4"); # 0 = A
360 &pshufb ("xmm0","xmm2");
361 &ret ();
362&function_end_B("_vpaes_decrypt_core");
363
364########################################################
365## ##
366## AES key schedule ##
367## ##
368########################################################
369&function_begin_B("_vpaes_schedule_core");
370 &movdqu ("xmm0",&QWP(0,$inp)); # load key (unaligned)
371 &movdqa ("xmm2",&QWP($k_rcon,$const)); # load rcon
372
373 # input transform
374 &movdqa ("xmm3","xmm0");
375 &lea ($base,&DWP($k_ipt,$const));
376 &movdqa (&QWP(4,"esp"),"xmm2"); # xmm8
377 &call ("_vpaes_schedule_transform");
378 &movdqa ("xmm7","xmm0");
379
380 &test ($out,$out);
381 &jnz (&label("schedule_am_decrypting"));
382
383 # encrypting, output zeroth round key after transform
384 &movdqu (&QWP(0,$key),"xmm0");
385 &jmp (&label("schedule_go"));
386
387&set_label("schedule_am_decrypting");
388 # decrypting, output zeroth round key after shiftrows
389 &movdqa ("xmm1",&QWP($k_sr,$const,$magic));
390 &pshufb ("xmm3","xmm1");
391 &movdqu (&QWP(0,$key),"xmm3");
392 &xor ($magic,0x30);
393
394&set_label("schedule_go");
395 &cmp ($round,192);
396 &ja (&label("schedule_256"));
397 &je (&label("schedule_192"));
398 # 128: fall though
399
400##
401## .schedule_128
402##
403## 128-bit specific part of key schedule.
404##
405## This schedule is really simple, because all its parts
406## are accomplished by the subroutines.
407##
408&set_label("schedule_128");
409 &mov ($round,10);
410
411&set_label("loop_schedule_128");
412 &call ("_vpaes_schedule_round");
413 &dec ($round);
414 &jz (&label("schedule_mangle_last"));
415 &call ("_vpaes_schedule_mangle"); # write output
416 &jmp (&label("loop_schedule_128"));
417
418##
419## .aes_schedule_192
420##
421## 192-bit specific part of key schedule.
422##
423## The main body of this schedule is the same as the 128-bit
424## schedule, but with more smearing. The long, high side is
425## stored in %xmm7 as before, and the short, low side is in
426## the high bits of %xmm6.
427##
428## This schedule is somewhat nastier, however, because each
429## round produces 192 bits of key material, or 1.5 round keys.
430## Therefore, on each cycle we do 2 rounds and produce 3 round
431## keys.
432##
433&set_label("schedule_192",16);
434 &movdqu ("xmm0",&QWP(8,$inp)); # load key part 2 (very unaligned)
435 &call ("_vpaes_schedule_transform"); # input transform
436 &movdqa ("xmm6","xmm0"); # save short part
437 &pxor ("xmm4","xmm4"); # clear 4
438 &movhlps("xmm6","xmm4"); # clobber low side with zeros
439 &mov ($round,4);
440
441&set_label("loop_schedule_192");
442 &call ("_vpaes_schedule_round");
443 &palignr("xmm0","xmm6",8);
444 &call ("_vpaes_schedule_mangle"); # save key n
445 &call ("_vpaes_schedule_192_smear");
446 &call ("_vpaes_schedule_mangle"); # save key n+1
447 &call ("_vpaes_schedule_round");
448 &dec ($round);
449 &jz (&label("schedule_mangle_last"));
450 &call ("_vpaes_schedule_mangle"); # save key n+2
451 &call ("_vpaes_schedule_192_smear");
452 &jmp (&label("loop_schedule_192"));
453
454##
455## .aes_schedule_256
456##
457## 256-bit specific part of key schedule.
458##
459## The structure here is very similar to the 128-bit
460## schedule, but with an additional "low side" in
461## %xmm6. The low side's rounds are the same as the
462## high side's, except no rcon and no rotation.
463##
464&set_label("schedule_256",16);
465 &movdqu ("xmm0",&QWP(16,$inp)); # load key part 2 (unaligned)
466 &call ("_vpaes_schedule_transform"); # input transform
467 &mov ($round,7);
468
469&set_label("loop_schedule_256");
470 &call ("_vpaes_schedule_mangle"); # output low result
471 &movdqa ("xmm6","xmm0"); # save cur_lo in xmm6
472
473 # high round
474 &call ("_vpaes_schedule_round");
475 &dec ($round);
476 &jz (&label("schedule_mangle_last"));
477 &call ("_vpaes_schedule_mangle");
478
479 # low round. swap xmm7 and xmm6
480 &pshufd ("xmm0","xmm0",0xFF);
481 &movdqa (&QWP(20,"esp"),"xmm7");
482 &movdqa ("xmm7","xmm6");
483 &call ("_vpaes_schedule_low_round");
484 &movdqa ("xmm7",&QWP(20,"esp"));
485
486 &jmp (&label("loop_schedule_256"));
487
488##
489## .aes_schedule_mangle_last
490##
491## Mangler for last round of key schedule
492## Mangles %xmm0
493## when encrypting, outputs out(%xmm0) ^ 63
494## when decrypting, outputs unskew(%xmm0)
495##
496## Always called right before return... jumps to cleanup and exits
497##
498&set_label("schedule_mangle_last",16);
499 # schedule last round key from xmm0
500 &lea ($base,&DWP($k_deskew,$const));
501 &test ($out,$out);
502 &jnz (&label("schedule_mangle_last_dec"));
503
504 # encrypting
505 &movdqa ("xmm1",&QWP($k_sr,$const,$magic));
506 &pshufb ("xmm0","xmm1"); # output permute
507 &lea ($base,&DWP($k_opt,$const)); # prepare to output transform
508 &add ($key,32);
509
510&set_label("schedule_mangle_last_dec");
511 &add ($key,-16);
512 &pxor ("xmm0",&QWP($k_s63,$const));
513 &call ("_vpaes_schedule_transform"); # output transform
514 &movdqu (&QWP(0,$key),"xmm0"); # save last key
515
516 # cleanup
517 &pxor ("xmm0","xmm0");
518 &pxor ("xmm1","xmm1");
519 &pxor ("xmm2","xmm2");
520 &pxor ("xmm3","xmm3");
521 &pxor ("xmm4","xmm4");
522 &pxor ("xmm5","xmm5");
523 &pxor ("xmm6","xmm6");
524 &pxor ("xmm7","xmm7");
525 &ret ();
526&function_end_B("_vpaes_schedule_core");
527
528##
529## .aes_schedule_192_smear
530##
531## Smear the short, low side in the 192-bit key schedule.
532##
533## Inputs:
534## %xmm7: high side, b a x y
535## %xmm6: low side, d c 0 0
536## %xmm13: 0
537##
538## Outputs:
539## %xmm6: b+c+d b+c 0 0
540## %xmm0: b+c+d b+c b a
541##
542&function_begin_B("_vpaes_schedule_192_smear");
543 &pshufd ("xmm0","xmm6",0x80); # d c 0 0 -> c 0 0 0
544 &pxor ("xmm6","xmm0"); # -> c+d c 0 0
545 &pshufd ("xmm0","xmm7",0xFE); # b a _ _ -> b b b a
546 &pxor ("xmm6","xmm0"); # -> b+c+d b+c b a
547 &movdqa ("xmm0","xmm6");
548 &pxor ("xmm1","xmm1");
549 &movhlps("xmm6","xmm1"); # clobber low side with zeros
550 &ret ();
551&function_end_B("_vpaes_schedule_192_smear");
552
553##
554## .aes_schedule_round
555##
556## Runs one main round of the key schedule on %xmm0, %xmm7
557##
558## Specifically, runs subbytes on the high dword of %xmm0
559## then rotates it by one byte and xors into the low dword of
560## %xmm7.
561##
562## Adds rcon from low byte of %xmm8, then rotates %xmm8 for
563## next rcon.
564##
565## Smears the dwords of %xmm7 by xoring the low into the
566## second low, result into third, result into highest.
567##
568## Returns results in %xmm7 = %xmm0.
569## Clobbers %xmm1-%xmm5.
570##
571&function_begin_B("_vpaes_schedule_round");
572 # extract rcon from xmm8
573 &movdqa ("xmm2",&QWP(8,"esp")); # xmm8
574 &pxor ("xmm1","xmm1");
575 &palignr("xmm1","xmm2",15);
576 &palignr("xmm2","xmm2",15);
577 &pxor ("xmm7","xmm1");
578
579 # rotate
580 &pshufd ("xmm0","xmm0",0xFF);
581 &palignr("xmm0","xmm0",1);
582
583 # fall through...
584 &movdqa (&QWP(8,"esp"),"xmm2"); # xmm8
585
586 # low round: same as high round, but no rotation and no rcon.
587&set_label("_vpaes_schedule_low_round");
588 # smear xmm7
589 &movdqa ("xmm1","xmm7");
590 &pslldq ("xmm7",4);
591 &pxor ("xmm7","xmm1");
592 &movdqa ("xmm1","xmm7");
593 &pslldq ("xmm7",8);
594 &pxor ("xmm7","xmm1");
595 &pxor ("xmm7",&QWP($k_s63,$const));
596
597 # subbyte
598 &movdqa ("xmm4",&QWP($k_s0F,$const));
599 &movdqa ("xmm5",&QWP($k_inv,$const)); # 4 : 1/j
600 &movdqa ("xmm1","xmm4");
601 &pandn ("xmm1","xmm0");
602 &psrld ("xmm1",4); # 1 = i
603 &pand ("xmm0","xmm4"); # 0 = k
604 &movdqa ("xmm2",&QWP($k_inv+16,$const));# 2 : a/k
605 &pshufb ("xmm2","xmm0"); # 2 = a/k
606 &pxor ("xmm0","xmm1"); # 0 = j
607 &movdqa ("xmm3","xmm5"); # 3 : 1/i
608 &pshufb ("xmm3","xmm1"); # 3 = 1/i
609 &pxor ("xmm3","xmm2"); # 3 = iak = 1/i + a/k
610 &movdqa ("xmm4","xmm5"); # 4 : 1/j
611 &pshufb ("xmm4","xmm0"); # 4 = 1/j
612 &pxor ("xmm4","xmm2"); # 4 = jak = 1/j + a/k
613 &movdqa ("xmm2","xmm5"); # 2 : 1/iak
614 &pshufb ("xmm2","xmm3"); # 2 = 1/iak
615 &pxor ("xmm2","xmm0"); # 2 = io
616 &movdqa ("xmm3","xmm5"); # 3 : 1/jak
617 &pshufb ("xmm3","xmm4"); # 3 = 1/jak
618 &pxor ("xmm3","xmm1"); # 3 = jo
619 &movdqa ("xmm4",&QWP($k_sb1,$const)); # 4 : sbou
620 &pshufb ("xmm4","xmm2"); # 4 = sbou
621 &movdqa ("xmm0",&QWP($k_sb1+16,$const));# 0 : sbot
622 &pshufb ("xmm0","xmm3"); # 0 = sb1t
623 &pxor ("xmm0","xmm4"); # 0 = sbox output
624
625 # add in smeared stuff
626 &pxor ("xmm0","xmm7");
627 &movdqa ("xmm7","xmm0");
628 &ret ();
629&function_end_B("_vpaes_schedule_round");
630
631##
632## .aes_schedule_transform
633##
634## Linear-transform %xmm0 according to tables at (%ebx)
635##
636## Output in %xmm0
637## Clobbers %xmm1, %xmm2
638##
639&function_begin_B("_vpaes_schedule_transform");
640 &movdqa ("xmm2",&QWP($k_s0F,$const));
641 &movdqa ("xmm1","xmm2");
642 &pandn ("xmm1","xmm0");
643 &psrld ("xmm1",4);
644 &pand ("xmm0","xmm2");
645 &movdqa ("xmm2",&QWP(0,$base));
646 &pshufb ("xmm2","xmm0");
647 &movdqa ("xmm0",&QWP(16,$base));
648 &pshufb ("xmm0","xmm1");
649 &pxor ("xmm0","xmm2");
650 &ret ();
651&function_end_B("_vpaes_schedule_transform");
652
653##
654## .aes_schedule_mangle
655##
656## Mangle xmm0 from (basis-transformed) standard version
657## to our version.
658##
659## On encrypt,
660## xor with 0x63
661## multiply by circulant 0,1,1,1
662## apply shiftrows transform
663##
664## On decrypt,
665## xor with 0x63
666## multiply by "inverse mixcolumns" circulant E,B,D,9
667## deskew
668## apply shiftrows transform
669##
670##
671## Writes out to (%edx), and increments or decrements it
672## Keeps track of round number mod 4 in %ecx
673## Preserves xmm0
674## Clobbers xmm1-xmm5
675##
676&function_begin_B("_vpaes_schedule_mangle");
677 &movdqa ("xmm4","xmm0"); # save xmm0 for later
678 &movdqa ("xmm5",&QWP($k_mc_forward,$const));
679 &test ($out,$out);
680 &jnz (&label("schedule_mangle_dec"));
681
682 # encrypting
683 &add ($key,16);
684 &pxor ("xmm4",&QWP($k_s63,$const));
685 &pshufb ("xmm4","xmm5");
686 &movdqa ("xmm3","xmm4");
687 &pshufb ("xmm4","xmm5");
688 &pxor ("xmm3","xmm4");
689 &pshufb ("xmm4","xmm5");
690 &pxor ("xmm3","xmm4");
691
692 &jmp (&label("schedule_mangle_both"));
693
694&set_label("schedule_mangle_dec",16);
695 # inverse mix columns
696 &movdqa ("xmm2",&QWP($k_s0F,$const));
697 &lea ($inp,&DWP($k_dksd,$const));
698 &movdqa ("xmm1","xmm2");
699 &pandn ("xmm1","xmm4");
700 &psrld ("xmm1",4); # 1 = hi
701 &pand ("xmm4","xmm2"); # 4 = lo
702
703 &movdqa ("xmm2",&QWP(0,$inp));
704 &pshufb ("xmm2","xmm4");
705 &movdqa ("xmm3",&QWP(0x10,$inp));
706 &pshufb ("xmm3","xmm1");
707 &pxor ("xmm3","xmm2");
708 &pshufb ("xmm3","xmm5");
709
710 &movdqa ("xmm2",&QWP(0x20,$inp));
711 &pshufb ("xmm2","xmm4");
712 &pxor ("xmm2","xmm3");
713 &movdqa ("xmm3",&QWP(0x30,$inp));
714 &pshufb ("xmm3","xmm1");
715 &pxor ("xmm3","xmm2");
716 &pshufb ("xmm3","xmm5");
717
718 &movdqa ("xmm2",&QWP(0x40,$inp));
719 &pshufb ("xmm2","xmm4");
720 &pxor ("xmm2","xmm3");
721 &movdqa ("xmm3",&QWP(0x50,$inp));
722 &pshufb ("xmm3","xmm1");
723 &pxor ("xmm3","xmm2");
724 &pshufb ("xmm3","xmm5");
725
726 &movdqa ("xmm2",&QWP(0x60,$inp));
727 &pshufb ("xmm2","xmm4");
728 &pxor ("xmm2","xmm3");
729 &movdqa ("xmm3",&QWP(0x70,$inp));
730 &pshufb ("xmm3","xmm1");
731 &pxor ("xmm3","xmm2");
732
733 &add ($key,-16);
734
735&set_label("schedule_mangle_both");
736 &movdqa ("xmm1",&QWP($k_sr,$const,$magic));
737 &pshufb ("xmm3","xmm1");
738 &add ($magic,-16);
739 &and ($magic,0x30);
740 &movdqu (&QWP(0,$key),"xmm3");
741 &ret ();
742&function_end_B("_vpaes_schedule_mangle");
743
744#
745# Interface to OpenSSL
746#
747&function_begin("${PREFIX}_set_encrypt_key");
748 &mov ($inp,&wparam(0)); # inp
749 &lea ($base,&DWP(-56,"esp"));
750 &mov ($round,&wparam(1)); # bits
751 &and ($base,-16);
752 &mov ($key,&wparam(2)); # key
753 &xchg ($base,"esp"); # alloca
754 &mov (&DWP(48,"esp"),$base);
755
756 &mov ($base,$round);
757 &shr ($base,5);
758 &add ($base,5);
759 &mov (&DWP(240,$key),$base); # AES_KEY->rounds = nbits/32+5;
760 &mov ($magic,0x30);
761 &mov ($out,0);
762
763 &picsetup($const);
764 &picsymbol($const, &label("_vpaes_consts"), $const);
765 &lea ($const,&DWP(0x30,$const))
766
767 &call ("_vpaes_schedule_core");
768
769 &mov ("esp",&DWP(48,"esp"));
770 &xor ("eax","eax");
771&function_end("${PREFIX}_set_encrypt_key");
772
773&function_begin("${PREFIX}_set_decrypt_key");
774 &mov ($inp,&wparam(0)); # inp
775 &lea ($base,&DWP(-56,"esp"));
776 &mov ($round,&wparam(1)); # bits
777 &and ($base,-16);
778 &mov ($key,&wparam(2)); # key
779 &xchg ($base,"esp"); # alloca
780 &mov (&DWP(48,"esp"),$base);
781
782 &mov ($base,$round);
783 &shr ($base,5);
784 &add ($base,5);
785 &mov (&DWP(240,$key),$base); # AES_KEY->rounds = nbits/32+5;
786 &shl ($base,4);
787 &lea ($key,&DWP(16,$key,$base));
788
789 &mov ($out,1);
790 &mov ($magic,$round);
791 &shr ($magic,1);
792 &and ($magic,32);
793 &xor ($magic,32); # nbist==192?0:32;
794
795 &picsetup($const);
796 &picsymbol($const, &label("_vpaes_consts"), $const);
797 &lea ($const,&DWP(0x30,$const))
798
799 &call ("_vpaes_schedule_core");
800
801 &mov ("esp",&DWP(48,"esp"));
802 &xor ("eax","eax");
803&function_end("${PREFIX}_set_decrypt_key");
804
805&function_begin("${PREFIX}_encrypt");
806 &picsetup($const);
807 &picsymbol($const, &label("_vpaes_consts"), $const);
808 &lea ($const,&DWP(0x30,$const))
809
810 &call ("_vpaes_preheat");
811 &mov ($inp,&wparam(0)); # inp
812 &lea ($base,&DWP(-56,"esp"));
813 &mov ($out,&wparam(1)); # out
814 &and ($base,-16);
815 &mov ($key,&wparam(2)); # key
816 &xchg ($base,"esp"); # alloca
817 &mov (&DWP(48,"esp"),$base);
818
819 &movdqu ("xmm0",&QWP(0,$inp));
820 &call ("_vpaes_encrypt_core");
821 &movdqu (&QWP(0,$out),"xmm0");
822
823 &mov ("esp",&DWP(48,"esp"));
824&function_end("${PREFIX}_encrypt");
825
826&function_begin("${PREFIX}_decrypt");
827 &picsetup($const);
828 &picsymbol($const, &label("_vpaes_consts"), $const);
829 &lea ($const,&DWP(0x30,$const))
830
831 &call ("_vpaes_preheat");
832 &mov ($inp,&wparam(0)); # inp
833 &lea ($base,&DWP(-56,"esp"));
834 &mov ($out,&wparam(1)); # out
835 &and ($base,-16);
836 &mov ($key,&wparam(2)); # key
837 &xchg ($base,"esp"); # alloca
838 &mov (&DWP(48,"esp"),$base);
839
840 &movdqu ("xmm0",&QWP(0,$inp));
841 &call ("_vpaes_decrypt_core");
842 &movdqu (&QWP(0,$out),"xmm0");
843
844 &mov ("esp",&DWP(48,"esp"));
845&function_end("${PREFIX}_decrypt");
846
847&function_begin("${PREFIX}_cbc_encrypt");
848 &mov ($inp,&wparam(0)); # inp
849 &mov ($out,&wparam(1)); # out
850 &mov ($round,&wparam(2)); # len
851 &mov ($key,&wparam(3)); # key
852 &sub ($round,16);
853 &jc (&label("cbc_abort"));
854 &lea ($base,&DWP(-56,"esp"));
855 &mov ($const,&wparam(4)); # ivp
856 &and ($base,-16);
857 &mov ($magic,&wparam(5)); # enc
858 &xchg ($base,"esp"); # alloca
859 &movdqu ("xmm1",&QWP(0,$const)); # load IV
860 &sub ($out,$inp);
861 &mov (&DWP(48,"esp"),$base);
862
863 &mov (&DWP(0,"esp"),$out); # save out
864 &mov (&DWP(4,"esp"),$key) # save key
865 &mov (&DWP(8,"esp"),$const); # save ivp
866 &mov ($out,$round); # $out works as $len
867
868 &picsetup($const);
869 &picsymbol($const, &label("_vpaes_consts"), $const);
870 &lea ($const,&DWP(0x30,$const))
871
872 &call ("_vpaes_preheat");
873 &cmp ($magic,0);
874 &je (&label("cbc_dec_loop"));
875 &jmp (&label("cbc_enc_loop"));
876
877&set_label("cbc_enc_loop",16);
878 &movdqu ("xmm0",&QWP(0,$inp)); # load input
879 &pxor ("xmm0","xmm1"); # inp^=iv
880 &call ("_vpaes_encrypt_core");
881 &mov ($base,&DWP(0,"esp")); # restore out
882 &mov ($key,&DWP(4,"esp")); # restore key
883 &movdqa ("xmm1","xmm0");
884 &movdqu (&QWP(0,$base,$inp),"xmm0"); # write output
885 &lea ($inp,&DWP(16,$inp));
886 &sub ($out,16);
887 &jnc (&label("cbc_enc_loop"));
888 &jmp (&label("cbc_done"));
889
890&set_label("cbc_dec_loop",16);
891 &movdqu ("xmm0",&QWP(0,$inp)); # load input
892 &movdqa (&QWP(16,"esp"),"xmm1"); # save IV
893 &movdqa (&QWP(32,"esp"),"xmm0"); # save future IV
894 &call ("_vpaes_decrypt_core");
895 &mov ($base,&DWP(0,"esp")); # restore out
896 &mov ($key,&DWP(4,"esp")); # restore key
897 &pxor ("xmm0",&QWP(16,"esp")); # out^=iv
898 &movdqa ("xmm1",&QWP(32,"esp")); # load next IV
899 &movdqu (&QWP(0,$base,$inp),"xmm0"); # write output
900 &lea ($inp,&DWP(16,$inp));
901 &sub ($out,16);
902 &jnc (&label("cbc_dec_loop"));
903
904&set_label("cbc_done");
905 &mov ($base,&DWP(8,"esp")); # restore ivp
906 &mov ("esp",&DWP(48,"esp"));
907 &movdqu (&QWP(0,$base),"xmm1"); # write IV
908&set_label("cbc_abort");
909&function_end("${PREFIX}_cbc_encrypt");
910
911&asm_finish();
diff --git a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
deleted file mode 100644
index 7d92e8d8ca..0000000000
--- a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
+++ /dev/null
@@ -1,1222 +0,0 @@
1#!/usr/bin/env perl
2
3######################################################################
4## Constant-time SSSE3 AES core implementation.
5## version 0.1
6##
7## By Mike Hamburg (Stanford University), 2009
8## Public domain.
9##
10## For details see http://shiftleft.org/papers/vector_aes/ and
11## http://crypto.stanford.edu/vpaes/.
12
13######################################################################
14# September 2011.
15#
16# Interface to OpenSSL as "almost" drop-in replacement for
17# aes-x86_64.pl. "Almost" refers to the fact that AES_cbc_encrypt
18# doesn't handle partial vectors (doesn't have to if called from
19# EVP only). "Drop-in" implies that this module doesn't share key
20# schedule structure with the original nor does it make assumption
21# about its alignment...
22#
23# Performance summary. aes-x86_64.pl column lists large-block CBC
24# encrypt/decrypt/with-hyper-threading-off(*) results in cycles per
25# byte processed with 128-bit key, and vpaes-x86_64.pl column -
26# [also large-block CBC] encrypt/decrypt.
27#
28# aes-x86_64.pl vpaes-x86_64.pl
29#
30# Core 2(**) 30.5/43.7/14.3 21.8/25.7(***)
31# Nehalem 30.5/42.2/14.6 9.8/11.8
32# Atom 63.9/79.0/32.1 64.0/84.8(***)
33#
34# (*) "Hyper-threading" in the context refers rather to cache shared
35# among multiple cores, than to specifically Intel HTT. As vast
36# majority of contemporary cores share cache, slower code path
37# is common place. In other words "with-hyper-threading-off"
38# results are presented mostly for reference purposes.
39#
40# (**) "Core 2" refers to initial 65nm design, a.k.a. Conroe.
41#
42# (***) Less impressive improvement on Core 2 and Atom is due to slow
43# pshufb, yet it's respectable +40%/78% improvement on Core 2
44# (as implied, over "hyper-threading-safe" code path).
45#
46# <appro@openssl.org>
47
48$flavour = shift;
49$output = shift;
50if ($flavour =~ /\./) { $output = $flavour; undef $flavour; }
51
52$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
53
54$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
55( $xlate="${dir}x86_64-xlate.pl" and -f $xlate ) or
56( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
57die "can't locate x86_64-xlate.pl";
58
59open OUT,"| \"$^X\" $xlate $flavour $output";
60*STDOUT=*OUT;
61
62$PREFIX="vpaes";
63
64$code.=<<___;
65.text
66
67##
68## _aes_encrypt_core
69##
70## AES-encrypt %xmm0.
71##
72## Inputs:
73## %xmm0 = input
74## %xmm9-%xmm15 as in _vpaes_preheat
75## (%rdx) = scheduled keys
76##
77## Output in %xmm0
78## Clobbers %xmm1-%xmm5, %r9, %r10, %r11, %rax
79## Preserves %xmm6 - %xmm8 so you get some local vectors
80##
81##
82.type _vpaes_encrypt_core,\@abi-omnipotent
83.align 16
84_vpaes_encrypt_core:
85 _CET_ENDBR
86 mov %rdx, %r9
87 mov \$16, %r11
88 mov 240(%rdx),%eax
89 movdqa %xmm9, %xmm1
90 movdqa .Lk_ipt(%rip), %xmm2 # iptlo
91 pandn %xmm0, %xmm1
92 movdqu (%r9), %xmm5 # round0 key
93 psrld \$4, %xmm1
94 pand %xmm9, %xmm0
95 pshufb %xmm0, %xmm2
96 movdqa .Lk_ipt+16(%rip), %xmm0 # ipthi
97 pshufb %xmm1, %xmm0
98 pxor %xmm5, %xmm2
99 pxor %xmm2, %xmm0
100 add \$16, %r9
101 lea .Lk_mc_backward(%rip),%r10
102 jmp .Lenc_entry
103
104.align 16
105.Lenc_loop:
106 # middle of middle round
107 movdqa %xmm13, %xmm4 # 4 : sb1u
108 pshufb %xmm2, %xmm4 # 4 = sb1u
109 pxor %xmm5, %xmm4 # 4 = sb1u + k
110 movdqa %xmm12, %xmm0 # 0 : sb1t
111 pshufb %xmm3, %xmm0 # 0 = sb1t
112 pxor %xmm4, %xmm0 # 0 = A
113 movdqa %xmm15, %xmm5 # 4 : sb2u
114 pshufb %xmm2, %xmm5 # 4 = sb2u
115 movdqa -0x40(%r11,%r10), %xmm1 # .Lk_mc_forward[]
116 movdqa %xmm14, %xmm2 # 2 : sb2t
117 pshufb %xmm3, %xmm2 # 2 = sb2t
118 pxor %xmm5, %xmm2 # 2 = 2A
119 movdqa (%r11,%r10), %xmm4 # .Lk_mc_backward[]
120 movdqa %xmm0, %xmm3 # 3 = A
121 pshufb %xmm1, %xmm0 # 0 = B
122 add \$16, %r9 # next key
123 pxor %xmm2, %xmm0 # 0 = 2A+B
124 pshufb %xmm4, %xmm3 # 3 = D
125 add \$16, %r11 # next mc
126 pxor %xmm0, %xmm3 # 3 = 2A+B+D
127 pshufb %xmm1, %xmm0 # 0 = 2B+C
128 and \$0x30, %r11 # ... mod 4
129 pxor %xmm3, %xmm0 # 0 = 2A+3B+C+D
130 sub \$1,%rax # nr--
131
132.Lenc_entry:
133 # top of round
134 movdqa %xmm9, %xmm1 # 1 : i
135 pandn %xmm0, %xmm1 # 1 = i<<4
136 psrld \$4, %xmm1 # 1 = i
137 pand %xmm9, %xmm0 # 0 = k
138 movdqa %xmm11, %xmm5 # 2 : a/k
139 pshufb %xmm0, %xmm5 # 2 = a/k
140 pxor %xmm1, %xmm0 # 0 = j
141 movdqa %xmm10, %xmm3 # 3 : 1/i
142 pshufb %xmm1, %xmm3 # 3 = 1/i
143 pxor %xmm5, %xmm3 # 3 = iak = 1/i + a/k
144 movdqa %xmm10, %xmm4 # 4 : 1/j
145 pshufb %xmm0, %xmm4 # 4 = 1/j
146 pxor %xmm5, %xmm4 # 4 = jak = 1/j + a/k
147 movdqa %xmm10, %xmm2 # 2 : 1/iak
148 pshufb %xmm3, %xmm2 # 2 = 1/iak
149 pxor %xmm0, %xmm2 # 2 = io
150 movdqa %xmm10, %xmm3 # 3 : 1/jak
151 movdqu (%r9), %xmm5
152 pshufb %xmm4, %xmm3 # 3 = 1/jak
153 pxor %xmm1, %xmm3 # 3 = jo
154 jnz .Lenc_loop
155
156 # middle of last round
157 movdqa -0x60(%r10), %xmm4 # 3 : sbou .Lk_sbo
158 movdqa -0x50(%r10), %xmm0 # 0 : sbot .Lk_sbo+16
159 pshufb %xmm2, %xmm4 # 4 = sbou
160 pxor %xmm5, %xmm4 # 4 = sb1u + k
161 pshufb %xmm3, %xmm0 # 0 = sb1t
162 movdqa 0x40(%r11,%r10), %xmm1 # .Lk_sr[]
163 pxor %xmm4, %xmm0 # 0 = A
164 pshufb %xmm1, %xmm0
165 ret
166.size _vpaes_encrypt_core,.-_vpaes_encrypt_core
167
168##
169## Decryption core
170##
171## Same API as encryption core.
172##
173.type _vpaes_decrypt_core,\@abi-omnipotent
174.align 16
175_vpaes_decrypt_core:
176 _CET_ENDBR
177 mov %rdx, %r9 # load key
178 mov 240(%rdx),%eax
179 movdqa %xmm9, %xmm1
180 movdqa .Lk_dipt(%rip), %xmm2 # iptlo
181 pandn %xmm0, %xmm1
182 mov %rax, %r11
183 psrld \$4, %xmm1
184 movdqu (%r9), %xmm5 # round0 key
185 shl \$4, %r11
186 pand %xmm9, %xmm0
187 pshufb %xmm0, %xmm2
188 movdqa .Lk_dipt+16(%rip), %xmm0 # ipthi
189 xor \$0x30, %r11
190 lea .Lk_dsbd(%rip),%r10
191 pshufb %xmm1, %xmm0
192 and \$0x30, %r11
193 pxor %xmm5, %xmm2
194 movdqa .Lk_mc_forward+48(%rip), %xmm5
195 pxor %xmm2, %xmm0
196 add \$16, %r9
197 add %r10, %r11
198 jmp .Ldec_entry
199
200.align 16
201.Ldec_loop:
202##
203## Inverse mix columns
204##
205 movdqa -0x20(%r10),%xmm4 # 4 : sb9u
206 pshufb %xmm2, %xmm4 # 4 = sb9u
207 pxor %xmm0, %xmm4
208 movdqa -0x10(%r10),%xmm0 # 0 : sb9t
209 pshufb %xmm3, %xmm0 # 0 = sb9t
210 pxor %xmm4, %xmm0 # 0 = ch
211 add \$16, %r9 # next round key
212
213 pshufb %xmm5, %xmm0 # MC ch
214 movdqa 0x00(%r10),%xmm4 # 4 : sbdu
215 pshufb %xmm2, %xmm4 # 4 = sbdu
216 pxor %xmm0, %xmm4 # 4 = ch
217 movdqa 0x10(%r10),%xmm0 # 0 : sbdt
218 pshufb %xmm3, %xmm0 # 0 = sbdt
219 pxor %xmm4, %xmm0 # 0 = ch
220 sub \$1,%rax # nr--
221
222 pshufb %xmm5, %xmm0 # MC ch
223 movdqa 0x20(%r10),%xmm4 # 4 : sbbu
224 pshufb %xmm2, %xmm4 # 4 = sbbu
225 pxor %xmm0, %xmm4 # 4 = ch
226 movdqa 0x30(%r10),%xmm0 # 0 : sbbt
227 pshufb %xmm3, %xmm0 # 0 = sbbt
228 pxor %xmm4, %xmm0 # 0 = ch
229
230 pshufb %xmm5, %xmm0 # MC ch
231 movdqa 0x40(%r10),%xmm4 # 4 : sbeu
232 pshufb %xmm2, %xmm4 # 4 = sbeu
233 pxor %xmm0, %xmm4 # 4 = ch
234 movdqa 0x50(%r10),%xmm0 # 0 : sbet
235 pshufb %xmm3, %xmm0 # 0 = sbet
236 pxor %xmm4, %xmm0 # 0 = ch
237
238 palignr \$12, %xmm5, %xmm5
239
240.Ldec_entry:
241 # top of round
242 movdqa %xmm9, %xmm1 # 1 : i
243 pandn %xmm0, %xmm1 # 1 = i<<4
244 psrld \$4, %xmm1 # 1 = i
245 pand %xmm9, %xmm0 # 0 = k
246 movdqa %xmm11, %xmm2 # 2 : a/k
247 pshufb %xmm0, %xmm2 # 2 = a/k
248 pxor %xmm1, %xmm0 # 0 = j
249 movdqa %xmm10, %xmm3 # 3 : 1/i
250 pshufb %xmm1, %xmm3 # 3 = 1/i
251 pxor %xmm2, %xmm3 # 3 = iak = 1/i + a/k
252 movdqa %xmm10, %xmm4 # 4 : 1/j
253 pshufb %xmm0, %xmm4 # 4 = 1/j
254 pxor %xmm2, %xmm4 # 4 = jak = 1/j + a/k
255 movdqa %xmm10, %xmm2 # 2 : 1/iak
256 pshufb %xmm3, %xmm2 # 2 = 1/iak
257 pxor %xmm0, %xmm2 # 2 = io
258 movdqa %xmm10, %xmm3 # 3 : 1/jak
259 pshufb %xmm4, %xmm3 # 3 = 1/jak
260 pxor %xmm1, %xmm3 # 3 = jo
261 movdqu (%r9), %xmm0
262 jnz .Ldec_loop
263
264 # middle of last round
265 movdqa 0x60(%r10), %xmm4 # 3 : sbou
266 pshufb %xmm2, %xmm4 # 4 = sbou
267 pxor %xmm0, %xmm4 # 4 = sb1u + k
268 movdqa 0x70(%r10), %xmm0 # 0 : sbot
269 movdqa -0x160(%r11), %xmm2 # .Lk_sr-.Lk_dsbd=-0x160
270 pshufb %xmm3, %xmm0 # 0 = sb1t
271 pxor %xmm4, %xmm0 # 0 = A
272 pshufb %xmm2, %xmm0
273 ret
274.size _vpaes_decrypt_core,.-_vpaes_decrypt_core
275
276########################################################
277## ##
278## AES key schedule ##
279## ##
280########################################################
281.type _vpaes_schedule_core,\@abi-omnipotent
282.align 16
283_vpaes_schedule_core:
284 _CET_ENDBR
285 # rdi = key
286 # rsi = size in bits
287 # rdx = buffer
288 # rcx = direction. 0=encrypt, 1=decrypt
289
290 call _vpaes_preheat # load the tables
291 movdqa .Lk_rcon(%rip), %xmm8 # load rcon
292 movdqu (%rdi), %xmm0 # load key (unaligned)
293
294 # input transform
295 movdqa %xmm0, %xmm3
296 lea .Lk_ipt(%rip), %r11
297 call _vpaes_schedule_transform
298 movdqa %xmm0, %xmm7
299
300 lea .Lk_sr(%rip),%r10
301 test %rcx, %rcx
302 jnz .Lschedule_am_decrypting
303
304 # encrypting, output zeroth round key after transform
305 movdqu %xmm0, (%rdx)
306 jmp .Lschedule_go
307
308.Lschedule_am_decrypting:
309 # decrypting, output zeroth round key after shiftrows
310 movdqa (%r8,%r10),%xmm1
311 pshufb %xmm1, %xmm3
312 movdqu %xmm3, (%rdx)
313 xor \$0x30, %r8
314
315.Lschedule_go:
316 cmp \$192, %esi
317 ja .Lschedule_256
318 je .Lschedule_192
319 # 128: fall though
320
321##
322## .schedule_128
323##
324## 128-bit specific part of key schedule.
325##
326## This schedule is really simple, because all its parts
327## are accomplished by the subroutines.
328##
329.Lschedule_128:
330 mov \$10, %esi
331
332.Loop_schedule_128:
333 call _vpaes_schedule_round
334 dec %rsi
335 jz .Lschedule_mangle_last
336 call _vpaes_schedule_mangle # write output
337 jmp .Loop_schedule_128
338
339##
340## .aes_schedule_192
341##
342## 192-bit specific part of key schedule.
343##
344## The main body of this schedule is the same as the 128-bit
345## schedule, but with more smearing. The long, high side is
346## stored in %xmm7 as before, and the short, low side is in
347## the high bits of %xmm6.
348##
349## This schedule is somewhat nastier, however, because each
350## round produces 192 bits of key material, or 1.5 round keys.
351## Therefore, on each cycle we do 2 rounds and produce 3 round
352## keys.
353##
354.align 16
355.Lschedule_192:
356 movdqu 8(%rdi),%xmm0 # load key part 2 (very unaligned)
357 call _vpaes_schedule_transform # input transform
358 movdqa %xmm0, %xmm6 # save short part
359 pxor %xmm4, %xmm4 # clear 4
360 movhlps %xmm4, %xmm6 # clobber low side with zeros
361 mov \$4, %esi
362
363.Loop_schedule_192:
364 call _vpaes_schedule_round
365 palignr \$8,%xmm6,%xmm0
366 call _vpaes_schedule_mangle # save key n
367 call _vpaes_schedule_192_smear
368 call _vpaes_schedule_mangle # save key n+1
369 call _vpaes_schedule_round
370 dec %rsi
371 jz .Lschedule_mangle_last
372 call _vpaes_schedule_mangle # save key n+2
373 call _vpaes_schedule_192_smear
374 jmp .Loop_schedule_192
375
376##
377## .aes_schedule_256
378##
379## 256-bit specific part of key schedule.
380##
381## The structure here is very similar to the 128-bit
382## schedule, but with an additional "low side" in
383## %xmm6. The low side's rounds are the same as the
384## high side's, except no rcon and no rotation.
385##
386.align 16
387.Lschedule_256:
388 movdqu 16(%rdi),%xmm0 # load key part 2 (unaligned)
389 call _vpaes_schedule_transform # input transform
390 mov \$7, %esi
391
392.Loop_schedule_256:
393 call _vpaes_schedule_mangle # output low result
394 movdqa %xmm0, %xmm6 # save cur_lo in xmm6
395
396 # high round
397 call _vpaes_schedule_round
398 dec %rsi
399 jz .Lschedule_mangle_last
400 call _vpaes_schedule_mangle
401
402 # low round. swap xmm7 and xmm6
403 pshufd \$0xFF, %xmm0, %xmm0
404 movdqa %xmm7, %xmm5
405 movdqa %xmm6, %xmm7
406 call _vpaes_schedule_low_round
407 movdqa %xmm5, %xmm7
408
409 jmp .Loop_schedule_256
410
411
412##
413## .aes_schedule_mangle_last
414##
415## Mangler for last round of key schedule
416## Mangles %xmm0
417## when encrypting, outputs out(%xmm0) ^ 63
418## when decrypting, outputs unskew(%xmm0)
419##
420## Always called right before return... jumps to cleanup and exits
421##
422.align 16
423.Lschedule_mangle_last:
424 # schedule last round key from xmm0
425 lea .Lk_deskew(%rip),%r11 # prepare to deskew
426 test %rcx, %rcx
427 jnz .Lschedule_mangle_last_dec
428
429 # encrypting
430 movdqa (%r8,%r10),%xmm1
431 pshufb %xmm1, %xmm0 # output permute
432 lea .Lk_opt(%rip), %r11 # prepare to output transform
433 add \$32, %rdx
434
435.Lschedule_mangle_last_dec:
436 add \$-16, %rdx
437 pxor .Lk_s63(%rip), %xmm0
438 call _vpaes_schedule_transform # output transform
439 movdqu %xmm0, (%rdx) # save last key
440
441 # cleanup
442 pxor %xmm0, %xmm0
443 pxor %xmm1, %xmm1
444 pxor %xmm2, %xmm2
445 pxor %xmm3, %xmm3
446 pxor %xmm4, %xmm4
447 pxor %xmm5, %xmm5
448 pxor %xmm6, %xmm6
449 pxor %xmm7, %xmm7
450 ret
451.size _vpaes_schedule_core,.-_vpaes_schedule_core
452
453##
454## .aes_schedule_192_smear
455##
456## Smear the short, low side in the 192-bit key schedule.
457##
458## Inputs:
459## %xmm7: high side, b a x y
460## %xmm6: low side, d c 0 0
461## %xmm13: 0
462##
463## Outputs:
464## %xmm6: b+c+d b+c 0 0
465## %xmm0: b+c+d b+c b a
466##
467.type _vpaes_schedule_192_smear,\@abi-omnipotent
468.align 16
469_vpaes_schedule_192_smear:
470 _CET_ENDBR
471 pshufd \$0x80, %xmm6, %xmm0 # d c 0 0 -> c 0 0 0
472 pxor %xmm0, %xmm6 # -> c+d c 0 0
473 pshufd \$0xFE, %xmm7, %xmm0 # b a _ _ -> b b b a
474 pxor %xmm0, %xmm6 # -> b+c+d b+c b a
475 movdqa %xmm6, %xmm0
476 pxor %xmm1, %xmm1
477 movhlps %xmm1, %xmm6 # clobber low side with zeros
478 ret
479.size _vpaes_schedule_192_smear,.-_vpaes_schedule_192_smear
480
481##
482## .aes_schedule_round
483##
484## Runs one main round of the key schedule on %xmm0, %xmm7
485##
486## Specifically, runs subbytes on the high dword of %xmm0
487## then rotates it by one byte and xors into the low dword of
488## %xmm7.
489##
490## Adds rcon from low byte of %xmm8, then rotates %xmm8 for
491## next rcon.
492##
493## Smears the dwords of %xmm7 by xoring the low into the
494## second low, result into third, result into highest.
495##
496## Returns results in %xmm7 = %xmm0.
497## Clobbers %xmm1-%xmm4, %r11.
498##
499.type _vpaes_schedule_round,\@abi-omnipotent
500.align 16
501_vpaes_schedule_round:
502 _CET_ENDBR
503 # extract rcon from xmm8
504 pxor %xmm1, %xmm1
505 palignr \$15, %xmm8, %xmm1
506 palignr \$15, %xmm8, %xmm8
507 pxor %xmm1, %xmm7
508
509 # rotate
510 pshufd \$0xFF, %xmm0, %xmm0
511 palignr \$1, %xmm0, %xmm0
512
513 # fall through...
514
515 # low round: same as high round, but no rotation and no rcon.
516_vpaes_schedule_low_round:
517 # smear xmm7
518 movdqa %xmm7, %xmm1
519 pslldq \$4, %xmm7
520 pxor %xmm1, %xmm7
521 movdqa %xmm7, %xmm1
522 pslldq \$8, %xmm7
523 pxor %xmm1, %xmm7
524 pxor .Lk_s63(%rip), %xmm7
525
526 # subbytes
527 movdqa %xmm9, %xmm1
528 pandn %xmm0, %xmm1
529 psrld \$4, %xmm1 # 1 = i
530 pand %xmm9, %xmm0 # 0 = k
531 movdqa %xmm11, %xmm2 # 2 : a/k
532 pshufb %xmm0, %xmm2 # 2 = a/k
533 pxor %xmm1, %xmm0 # 0 = j
534 movdqa %xmm10, %xmm3 # 3 : 1/i
535 pshufb %xmm1, %xmm3 # 3 = 1/i
536 pxor %xmm2, %xmm3 # 3 = iak = 1/i + a/k
537 movdqa %xmm10, %xmm4 # 4 : 1/j
538 pshufb %xmm0, %xmm4 # 4 = 1/j
539 pxor %xmm2, %xmm4 # 4 = jak = 1/j + a/k
540 movdqa %xmm10, %xmm2 # 2 : 1/iak
541 pshufb %xmm3, %xmm2 # 2 = 1/iak
542 pxor %xmm0, %xmm2 # 2 = io
543 movdqa %xmm10, %xmm3 # 3 : 1/jak
544 pshufb %xmm4, %xmm3 # 3 = 1/jak
545 pxor %xmm1, %xmm3 # 3 = jo
546 movdqa %xmm13, %xmm4 # 4 : sbou
547 pshufb %xmm2, %xmm4 # 4 = sbou
548 movdqa %xmm12, %xmm0 # 0 : sbot
549 pshufb %xmm3, %xmm0 # 0 = sb1t
550 pxor %xmm4, %xmm0 # 0 = sbox output
551
552 # add in smeared stuff
553 pxor %xmm7, %xmm0
554 movdqa %xmm0, %xmm7
555 ret
556.size _vpaes_schedule_round,.-_vpaes_schedule_round
557
558##
559## .aes_schedule_transform
560##
561## Linear-transform %xmm0 according to tables at (%r11)
562##
563## Requires that %xmm9 = 0x0F0F... as in preheat
564## Output in %xmm0
565## Clobbers %xmm1, %xmm2
566##
567.type _vpaes_schedule_transform,\@abi-omnipotent
568.align 16
569_vpaes_schedule_transform:
570 _CET_ENDBR
571 movdqa %xmm9, %xmm1
572 pandn %xmm0, %xmm1
573 psrld \$4, %xmm1
574 pand %xmm9, %xmm0
575 movdqa (%r11), %xmm2 # lo
576 pshufb %xmm0, %xmm2
577 movdqa 16(%r11), %xmm0 # hi
578 pshufb %xmm1, %xmm0
579 pxor %xmm2, %xmm0
580 ret
581.size _vpaes_schedule_transform,.-_vpaes_schedule_transform
582
583##
584## .aes_schedule_mangle
585##
586## Mangle xmm0 from (basis-transformed) standard version
587## to our version.
588##
589## On encrypt,
590## xor with 0x63
591## multiply by circulant 0,1,1,1
592## apply shiftrows transform
593##
594## On decrypt,
595## xor with 0x63
596## multiply by "inverse mixcolumns" circulant E,B,D,9
597## deskew
598## apply shiftrows transform
599##
600##
601## Writes out to (%rdx), and increments or decrements it
602## Keeps track of round number mod 4 in %r8
603## Preserves xmm0
604## Clobbers xmm1-xmm5
605##
606.type _vpaes_schedule_mangle,\@abi-omnipotent
607.align 16
608_vpaes_schedule_mangle:
609 _CET_ENDBR
610 movdqa %xmm0, %xmm4 # save xmm0 for later
611 movdqa .Lk_mc_forward(%rip),%xmm5
612 test %rcx, %rcx
613 jnz .Lschedule_mangle_dec
614
615 # encrypting
616 add \$16, %rdx
617 pxor .Lk_s63(%rip),%xmm4
618 pshufb %xmm5, %xmm4
619 movdqa %xmm4, %xmm3
620 pshufb %xmm5, %xmm4
621 pxor %xmm4, %xmm3
622 pshufb %xmm5, %xmm4
623 pxor %xmm4, %xmm3
624
625 jmp .Lschedule_mangle_both
626.align 16
627.Lschedule_mangle_dec:
628 # inverse mix columns
629 lea .Lk_dksd(%rip),%r11
630 movdqa %xmm9, %xmm1
631 pandn %xmm4, %xmm1
632 psrld \$4, %xmm1 # 1 = hi
633 pand %xmm9, %xmm4 # 4 = lo
634
635 movdqa 0x00(%r11), %xmm2
636 pshufb %xmm4, %xmm2
637 movdqa 0x10(%r11), %xmm3
638 pshufb %xmm1, %xmm3
639 pxor %xmm2, %xmm3
640 pshufb %xmm5, %xmm3
641
642 movdqa 0x20(%r11), %xmm2
643 pshufb %xmm4, %xmm2
644 pxor %xmm3, %xmm2
645 movdqa 0x30(%r11), %xmm3
646 pshufb %xmm1, %xmm3
647 pxor %xmm2, %xmm3
648 pshufb %xmm5, %xmm3
649
650 movdqa 0x40(%r11), %xmm2
651 pshufb %xmm4, %xmm2
652 pxor %xmm3, %xmm2
653 movdqa 0x50(%r11), %xmm3
654 pshufb %xmm1, %xmm3
655 pxor %xmm2, %xmm3
656 pshufb %xmm5, %xmm3
657
658 movdqa 0x60(%r11), %xmm2
659 pshufb %xmm4, %xmm2
660 pxor %xmm3, %xmm2
661 movdqa 0x70(%r11), %xmm3
662 pshufb %xmm1, %xmm3
663 pxor %xmm2, %xmm3
664
665 add \$-16, %rdx
666
667.Lschedule_mangle_both:
668 movdqa (%r8,%r10),%xmm1
669 pshufb %xmm1,%xmm3
670 add \$-16, %r8
671 and \$0x30, %r8
672 movdqu %xmm3, (%rdx)
673 ret
674.size _vpaes_schedule_mangle,.-_vpaes_schedule_mangle
675
676#
677# Interface to OpenSSL
678#
679.globl ${PREFIX}_set_encrypt_key
680.type ${PREFIX}_set_encrypt_key,\@function,3
681.align 16
682${PREFIX}_set_encrypt_key:
683 _CET_ENDBR
684___
685$code.=<<___ if ($win64);
686 lea -0xb8(%rsp),%rsp
687 movaps %xmm6,0x10(%rsp)
688 movaps %xmm7,0x20(%rsp)
689 movaps %xmm8,0x30(%rsp)
690 movaps %xmm9,0x40(%rsp)
691 movaps %xmm10,0x50(%rsp)
692 movaps %xmm11,0x60(%rsp)
693 movaps %xmm12,0x70(%rsp)
694 movaps %xmm13,0x80(%rsp)
695 movaps %xmm14,0x90(%rsp)
696 movaps %xmm15,0xa0(%rsp)
697.Lenc_key_body:
698___
699$code.=<<___;
700 mov %esi,%eax
701 shr \$5,%eax
702 add \$5,%eax
703 mov %eax,240(%rdx) # AES_KEY->rounds = nbits/32+5;
704
705 mov \$0,%ecx
706 mov \$0x30,%r8d
707 call _vpaes_schedule_core
708___
709$code.=<<___ if ($win64);
710 movaps 0x10(%rsp),%xmm6
711 movaps 0x20(%rsp),%xmm7
712 movaps 0x30(%rsp),%xmm8
713 movaps 0x40(%rsp),%xmm9
714 movaps 0x50(%rsp),%xmm10
715 movaps 0x60(%rsp),%xmm11
716 movaps 0x70(%rsp),%xmm12
717 movaps 0x80(%rsp),%xmm13
718 movaps 0x90(%rsp),%xmm14
719 movaps 0xa0(%rsp),%xmm15
720 lea 0xb8(%rsp),%rsp
721.Lenc_key_epilogue:
722___
723$code.=<<___;
724 xor %eax,%eax
725 ret
726.size ${PREFIX}_set_encrypt_key,.-${PREFIX}_set_encrypt_key
727
728.globl ${PREFIX}_set_decrypt_key
729.type ${PREFIX}_set_decrypt_key,\@function,3
730.align 16
731${PREFIX}_set_decrypt_key:
732 _CET_ENDBR
733___
734$code.=<<___ if ($win64);
735 lea -0xb8(%rsp),%rsp
736 movaps %xmm6,0x10(%rsp)
737 movaps %xmm7,0x20(%rsp)
738 movaps %xmm8,0x30(%rsp)
739 movaps %xmm9,0x40(%rsp)
740 movaps %xmm10,0x50(%rsp)
741 movaps %xmm11,0x60(%rsp)
742 movaps %xmm12,0x70(%rsp)
743 movaps %xmm13,0x80(%rsp)
744 movaps %xmm14,0x90(%rsp)
745 movaps %xmm15,0xa0(%rsp)
746.Ldec_key_body:
747___
748$code.=<<___;
749 mov %esi,%eax
750 shr \$5,%eax
751 add \$5,%eax
752 mov %eax,240(%rdx) # AES_KEY->rounds = nbits/32+5;
753 shl \$4,%eax
754 lea 16(%rdx,%rax),%rdx
755
756 mov \$1,%ecx
757 mov %esi,%r8d
758 shr \$1,%r8d
759 and \$32,%r8d
760 xor \$32,%r8d # nbits==192?0:32
761 call _vpaes_schedule_core
762___
763$code.=<<___ if ($win64);
764 movaps 0x10(%rsp),%xmm6
765 movaps 0x20(%rsp),%xmm7
766 movaps 0x30(%rsp),%xmm8
767 movaps 0x40(%rsp),%xmm9
768 movaps 0x50(%rsp),%xmm10
769 movaps 0x60(%rsp),%xmm11
770 movaps 0x70(%rsp),%xmm12
771 movaps 0x80(%rsp),%xmm13
772 movaps 0x90(%rsp),%xmm14
773 movaps 0xa0(%rsp),%xmm15
774 lea 0xb8(%rsp),%rsp
775.Ldec_key_epilogue:
776___
777$code.=<<___;
778 xor %eax,%eax
779 ret
780.size ${PREFIX}_set_decrypt_key,.-${PREFIX}_set_decrypt_key
781
782.globl ${PREFIX}_encrypt
783.type ${PREFIX}_encrypt,\@function,3
784.align 16
785${PREFIX}_encrypt:
786 _CET_ENDBR
787___
788$code.=<<___ if ($win64);
789 lea -0xb8(%rsp),%rsp
790 movaps %xmm6,0x10(%rsp)
791 movaps %xmm7,0x20(%rsp)
792 movaps %xmm8,0x30(%rsp)
793 movaps %xmm9,0x40(%rsp)
794 movaps %xmm10,0x50(%rsp)
795 movaps %xmm11,0x60(%rsp)
796 movaps %xmm12,0x70(%rsp)
797 movaps %xmm13,0x80(%rsp)
798 movaps %xmm14,0x90(%rsp)
799 movaps %xmm15,0xa0(%rsp)
800.Lenc_body:
801___
802$code.=<<___;
803 movdqu (%rdi),%xmm0
804 call _vpaes_preheat
805 call _vpaes_encrypt_core
806 movdqu %xmm0,(%rsi)
807___
808$code.=<<___ if ($win64);
809 movaps 0x10(%rsp),%xmm6
810 movaps 0x20(%rsp),%xmm7
811 movaps 0x30(%rsp),%xmm8
812 movaps 0x40(%rsp),%xmm9
813 movaps 0x50(%rsp),%xmm10
814 movaps 0x60(%rsp),%xmm11
815 movaps 0x70(%rsp),%xmm12
816 movaps 0x80(%rsp),%xmm13
817 movaps 0x90(%rsp),%xmm14
818 movaps 0xa0(%rsp),%xmm15
819 lea 0xb8(%rsp),%rsp
820.Lenc_epilogue:
821___
822$code.=<<___;
823 ret
824.size ${PREFIX}_encrypt,.-${PREFIX}_encrypt
825
826.globl ${PREFIX}_decrypt
827.type ${PREFIX}_decrypt,\@function,3
828.align 16
829${PREFIX}_decrypt:
830 _CET_ENDBR
831___
832$code.=<<___ if ($win64);
833 lea -0xb8(%rsp),%rsp
834 movaps %xmm6,0x10(%rsp)
835 movaps %xmm7,0x20(%rsp)
836 movaps %xmm8,0x30(%rsp)
837 movaps %xmm9,0x40(%rsp)
838 movaps %xmm10,0x50(%rsp)
839 movaps %xmm11,0x60(%rsp)
840 movaps %xmm12,0x70(%rsp)
841 movaps %xmm13,0x80(%rsp)
842 movaps %xmm14,0x90(%rsp)
843 movaps %xmm15,0xa0(%rsp)
844.Ldec_body:
845___
846$code.=<<___;
847 movdqu (%rdi),%xmm0
848 call _vpaes_preheat
849 call _vpaes_decrypt_core
850 movdqu %xmm0,(%rsi)
851___
852$code.=<<___ if ($win64);
853 movaps 0x10(%rsp),%xmm6
854 movaps 0x20(%rsp),%xmm7
855 movaps 0x30(%rsp),%xmm8
856 movaps 0x40(%rsp),%xmm9
857 movaps 0x50(%rsp),%xmm10
858 movaps 0x60(%rsp),%xmm11
859 movaps 0x70(%rsp),%xmm12
860 movaps 0x80(%rsp),%xmm13
861 movaps 0x90(%rsp),%xmm14
862 movaps 0xa0(%rsp),%xmm15
863 lea 0xb8(%rsp),%rsp
864.Ldec_epilogue:
865___
866$code.=<<___;
867 ret
868.size ${PREFIX}_decrypt,.-${PREFIX}_decrypt
869___
870{
871my ($inp,$out,$len,$key,$ivp,$enc)=("%rdi","%rsi","%rdx","%rcx","%r8","%r9");
872# void AES_cbc_encrypt (const void char *inp, unsigned char *out,
873# size_t length, const AES_KEY *key,
874# unsigned char *ivp,const int enc);
875$code.=<<___;
876.globl ${PREFIX}_cbc_encrypt
877.type ${PREFIX}_cbc_encrypt,\@function,6
878.align 16
879${PREFIX}_cbc_encrypt:
880 _CET_ENDBR
881 xchg $key,$len
882___
883($len,$key)=($key,$len);
884$code.=<<___;
885 sub \$16,$len
886 jc .Lcbc_abort
887___
888$code.=<<___ if ($win64);
889 lea -0xb8(%rsp),%rsp
890 movaps %xmm6,0x10(%rsp)
891 movaps %xmm7,0x20(%rsp)
892 movaps %xmm8,0x30(%rsp)
893 movaps %xmm9,0x40(%rsp)
894 movaps %xmm10,0x50(%rsp)
895 movaps %xmm11,0x60(%rsp)
896 movaps %xmm12,0x70(%rsp)
897 movaps %xmm13,0x80(%rsp)
898 movaps %xmm14,0x90(%rsp)
899 movaps %xmm15,0xa0(%rsp)
900.Lcbc_body:
901___
902$code.=<<___;
903 movdqu ($ivp),%xmm6 # load IV
904 sub $inp,$out
905 call _vpaes_preheat
906 cmp \$0,${enc}d
907 je .Lcbc_dec_loop
908 jmp .Lcbc_enc_loop
909.align 16
910.Lcbc_enc_loop:
911 movdqu ($inp),%xmm0
912 pxor %xmm6,%xmm0
913 call _vpaes_encrypt_core
914 movdqa %xmm0,%xmm6
915 movdqu %xmm0,($out,$inp)
916 lea 16($inp),$inp
917 sub \$16,$len
918 jnc .Lcbc_enc_loop
919 jmp .Lcbc_done
920.align 16
921.Lcbc_dec_loop:
922 movdqu ($inp),%xmm0
923 movdqa %xmm0,%xmm7
924 call _vpaes_decrypt_core
925 pxor %xmm6,%xmm0
926 movdqa %xmm7,%xmm6
927 movdqu %xmm0,($out,$inp)
928 lea 16($inp),$inp
929 sub \$16,$len
930 jnc .Lcbc_dec_loop
931.Lcbc_done:
932 movdqu %xmm6,($ivp) # save IV
933___
934$code.=<<___ if ($win64);
935 movaps 0x10(%rsp),%xmm6
936 movaps 0x20(%rsp),%xmm7
937 movaps 0x30(%rsp),%xmm8
938 movaps 0x40(%rsp),%xmm9
939 movaps 0x50(%rsp),%xmm10
940 movaps 0x60(%rsp),%xmm11
941 movaps 0x70(%rsp),%xmm12
942 movaps 0x80(%rsp),%xmm13
943 movaps 0x90(%rsp),%xmm14
944 movaps 0xa0(%rsp),%xmm15
945 lea 0xb8(%rsp),%rsp
946.Lcbc_epilogue:
947___
948$code.=<<___;
949.Lcbc_abort:
950 ret
951.size ${PREFIX}_cbc_encrypt,.-${PREFIX}_cbc_encrypt
952___
953}
954$code.=<<___;
955##
956## _aes_preheat
957##
958## Fills register %r10 -> .aes_consts (so you can -fPIC)
959## and %xmm9-%xmm15 as specified below.
960##
961.type _vpaes_preheat,\@abi-omnipotent
962.align 16
963_vpaes_preheat:
964 _CET_ENDBR
965 lea .Lk_s0F(%rip), %r10
966 movdqa -0x20(%r10), %xmm10 # .Lk_inv
967 movdqa -0x10(%r10), %xmm11 # .Lk_inv+16
968 movdqa 0x00(%r10), %xmm9 # .Lk_s0F
969 movdqa 0x30(%r10), %xmm13 # .Lk_sb1
970 movdqa 0x40(%r10), %xmm12 # .Lk_sb1+16
971 movdqa 0x50(%r10), %xmm15 # .Lk_sb2
972 movdqa 0x60(%r10), %xmm14 # .Lk_sb2+16
973 ret
974.size _vpaes_preheat,.-_vpaes_preheat
975########################################################
976## ##
977## Constants ##
978## ##
979########################################################
980.section .rodata
981.type _vpaes_consts,\@object
982.align 64
983_vpaes_consts:
984.Lk_inv: # inv, inva
985 .quad 0x0E05060F0D080180, 0x040703090A0B0C02
986 .quad 0x01040A060F0B0780, 0x030D0E0C02050809
987
988.Lk_s0F: # s0F
989 .quad 0x0F0F0F0F0F0F0F0F, 0x0F0F0F0F0F0F0F0F
990
991.Lk_ipt: # input transform (lo, hi)
992 .quad 0xC2B2E8985A2A7000, 0xCABAE09052227808
993 .quad 0x4C01307D317C4D00, 0xCD80B1FCB0FDCC81
994
995.Lk_sb1: # sb1u, sb1t
996 .quad 0xB19BE18FCB503E00, 0xA5DF7A6E142AF544
997 .quad 0x3618D415FAE22300, 0x3BF7CCC10D2ED9EF
998.Lk_sb2: # sb2u, sb2t
999 .quad 0xE27A93C60B712400, 0x5EB7E955BC982FCD
1000 .quad 0x69EB88400AE12900, 0xC2A163C8AB82234A
1001.Lk_sbo: # sbou, sbot
1002 .quad 0xD0D26D176FBDC700, 0x15AABF7AC502A878
1003 .quad 0xCFE474A55FBB6A00, 0x8E1E90D1412B35FA
1004
1005.Lk_mc_forward: # mc_forward
1006 .quad 0x0407060500030201, 0x0C0F0E0D080B0A09
1007 .quad 0x080B0A0904070605, 0x000302010C0F0E0D
1008 .quad 0x0C0F0E0D080B0A09, 0x0407060500030201
1009 .quad 0x000302010C0F0E0D, 0x080B0A0904070605
1010
1011.Lk_mc_backward:# mc_backward
1012 .quad 0x0605040702010003, 0x0E0D0C0F0A09080B
1013 .quad 0x020100030E0D0C0F, 0x0A09080B06050407
1014 .quad 0x0E0D0C0F0A09080B, 0x0605040702010003
1015 .quad 0x0A09080B06050407, 0x020100030E0D0C0F
1016
1017.Lk_sr: # sr
1018 .quad 0x0706050403020100, 0x0F0E0D0C0B0A0908
1019 .quad 0x030E09040F0A0500, 0x0B06010C07020D08
1020 .quad 0x0F060D040B020900, 0x070E050C030A0108
1021 .quad 0x0B0E0104070A0D00, 0x0306090C0F020508
1022
1023.Lk_rcon: # rcon
1024 .quad 0x1F8391B9AF9DEEB6, 0x702A98084D7C7D81
1025
1026.Lk_s63: # s63: all equal to 0x63 transformed
1027 .quad 0x5B5B5B5B5B5B5B5B, 0x5B5B5B5B5B5B5B5B
1028
1029.Lk_opt: # output transform
1030 .quad 0xFF9F4929D6B66000, 0xF7974121DEBE6808
1031 .quad 0x01EDBD5150BCEC00, 0xE10D5DB1B05C0CE0
1032
1033.Lk_deskew: # deskew tables: inverts the sbox's "skew"
1034 .quad 0x07E4A34047A4E300, 0x1DFEB95A5DBEF91A
1035 .quad 0x5F36B5DC83EA6900, 0x2841C2ABF49D1E77
1036
1037##
1038## Decryption stuff
1039## Key schedule constants
1040##
1041.Lk_dksd: # decryption key schedule: invskew x*D
1042 .quad 0xFEB91A5DA3E44700, 0x0740E3A45A1DBEF9
1043 .quad 0x41C277F4B5368300, 0x5FDC69EAAB289D1E
1044.Lk_dksb: # decryption key schedule: invskew x*B
1045 .quad 0x9A4FCA1F8550D500, 0x03D653861CC94C99
1046 .quad 0x115BEDA7B6FC4A00, 0xD993256F7E3482C8
1047.Lk_dkse: # decryption key schedule: invskew x*E + 0x63
1048 .quad 0xD5031CCA1FC9D600, 0x53859A4C994F5086
1049 .quad 0xA23196054FDC7BE8, 0xCD5EF96A20B31487
1050.Lk_dks9: # decryption key schedule: invskew x*9
1051 .quad 0xB6116FC87ED9A700, 0x4AED933482255BFC
1052 .quad 0x4576516227143300, 0x8BB89FACE9DAFDCE
1053
1054##
1055## Decryption stuff
1056## Round function constants
1057##
1058.Lk_dipt: # decryption input transform
1059 .quad 0x0F505B040B545F00, 0x154A411E114E451A
1060 .quad 0x86E383E660056500, 0x12771772F491F194
1061
1062.Lk_dsb9: # decryption sbox output *9*u, *9*t
1063 .quad 0x851C03539A86D600, 0xCAD51F504F994CC9
1064 .quad 0xC03B1789ECD74900, 0x725E2C9EB2FBA565
1065.Lk_dsbd: # decryption sbox output *D*u, *D*t
1066 .quad 0x7D57CCDFE6B1A200, 0xF56E9B13882A4439
1067 .quad 0x3CE2FAF724C6CB00, 0x2931180D15DEEFD3
1068.Lk_dsbb: # decryption sbox output *B*u, *B*t
1069 .quad 0xD022649296B44200, 0x602646F6B0F2D404
1070 .quad 0xC19498A6CD596700, 0xF3FF0C3E3255AA6B
1071.Lk_dsbe: # decryption sbox output *E*u, *E*t
1072 .quad 0x46F2929626D4D000, 0x2242600464B4F6B0
1073 .quad 0x0C55A6CDFFAAC100, 0x9467F36B98593E32
1074.Lk_dsbo: # decryption sbox final output
1075 .quad 0x1387EA537EF94000, 0xC7AA6DB9D4943E2D
1076 .quad 0x12D7560F93441D00, 0xCA4B8159D8C58E9C
1077.align 64
1078.size _vpaes_consts,.-_vpaes_consts
1079.text
1080___
1081
1082if ($win64) {
1083# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
1084# CONTEXT *context,DISPATCHER_CONTEXT *disp)
1085$rec="%rcx";
1086$frame="%rdx";
1087$context="%r8";
1088$disp="%r9";
1089
1090$code.=<<___;
1091.extern __imp_RtlVirtualUnwind
1092.type se_handler,\@abi-omnipotent
1093.align 16
1094se_handler:
1095 _CET_ENDBR
1096 push %rsi
1097 push %rdi
1098 push %rbx
1099 push %rbp
1100 push %r12
1101 push %r13
1102 push %r14
1103 push %r15
1104 pushfq
1105 sub \$64,%rsp
1106
1107 mov 120($context),%rax # pull context->Rax
1108 mov 248($context),%rbx # pull context->Rip
1109
1110 mov 8($disp),%rsi # disp->ImageBase
1111 mov 56($disp),%r11 # disp->HandlerData
1112
1113 mov 0(%r11),%r10d # HandlerData[0]
1114 lea (%rsi,%r10),%r10 # prologue label
1115 cmp %r10,%rbx # context->Rip<prologue label
1116 jb .Lin_prologue
1117
1118 mov 152($context),%rax # pull context->Rsp
1119
1120 mov 4(%r11),%r10d # HandlerData[1]
1121 lea (%rsi,%r10),%r10 # epilogue label
1122 cmp %r10,%rbx # context->Rip>=epilogue label
1123 jae .Lin_prologue
1124
1125 lea 16(%rax),%rsi # %xmm save area
1126 lea 512($context),%rdi # &context.Xmm6
1127 mov \$20,%ecx # 10*sizeof(%xmm0)/sizeof(%rax)
1128 .long 0xa548f3fc # cld; rep movsq
1129 lea 0xb8(%rax),%rax # adjust stack pointer
1130
1131.Lin_prologue:
1132 mov 8(%rax),%rdi
1133 mov 16(%rax),%rsi
1134 mov %rax,152($context) # restore context->Rsp
1135 mov %rsi,168($context) # restore context->Rsi
1136 mov %rdi,176($context) # restore context->Rdi
1137
1138 mov 40($disp),%rdi # disp->ContextRecord
1139 mov $context,%rsi # context
1140 mov \$`1232/8`,%ecx # sizeof(CONTEXT)
1141 .long 0xa548f3fc # cld; rep movsq
1142
1143 mov $disp,%rsi
1144 xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER
1145 mov 8(%rsi),%rdx # arg2, disp->ImageBase
1146 mov 0(%rsi),%r8 # arg3, disp->ControlPc
1147 mov 16(%rsi),%r9 # arg4, disp->FunctionEntry
1148 mov 40(%rsi),%r10 # disp->ContextRecord
1149 lea 56(%rsi),%r11 # &disp->HandlerData
1150 lea 24(%rsi),%r12 # &disp->EstablisherFrame
1151 mov %r10,32(%rsp) # arg5
1152 mov %r11,40(%rsp) # arg6
1153 mov %r12,48(%rsp) # arg7
1154 mov %rcx,56(%rsp) # arg8, (NULL)
1155 call *__imp_RtlVirtualUnwind(%rip)
1156
1157 mov \$1,%eax # ExceptionContinueSearch
1158 add \$64,%rsp
1159 popfq
1160 pop %r15
1161 pop %r14
1162 pop %r13
1163 pop %r12
1164 pop %rbp
1165 pop %rbx
1166 pop %rdi
1167 pop %rsi
1168 ret
1169.size se_handler,.-se_handler
1170
1171.section .pdata
1172.align 4
1173 .rva .LSEH_begin_${PREFIX}_set_encrypt_key
1174 .rva .LSEH_end_${PREFIX}_set_encrypt_key
1175 .rva .LSEH_info_${PREFIX}_set_encrypt_key
1176
1177 .rva .LSEH_begin_${PREFIX}_set_decrypt_key
1178 .rva .LSEH_end_${PREFIX}_set_decrypt_key
1179 .rva .LSEH_info_${PREFIX}_set_decrypt_key
1180
1181 .rva .LSEH_begin_${PREFIX}_encrypt
1182 .rva .LSEH_end_${PREFIX}_encrypt
1183 .rva .LSEH_info_${PREFIX}_encrypt
1184
1185 .rva .LSEH_begin_${PREFIX}_decrypt
1186 .rva .LSEH_end_${PREFIX}_decrypt
1187 .rva .LSEH_info_${PREFIX}_decrypt
1188
1189 .rva .LSEH_begin_${PREFIX}_cbc_encrypt
1190 .rva .LSEH_end_${PREFIX}_cbc_encrypt
1191 .rva .LSEH_info_${PREFIX}_cbc_encrypt
1192
1193.section .xdata
1194.align 8
1195.LSEH_info_${PREFIX}_set_encrypt_key:
1196 .byte 9,0,0,0
1197 .rva se_handler
1198 .rva .Lenc_key_body,.Lenc_key_epilogue # HandlerData[]
1199.LSEH_info_${PREFIX}_set_decrypt_key:
1200 .byte 9,0,0,0
1201 .rva se_handler
1202 .rva .Ldec_key_body,.Ldec_key_epilogue # HandlerData[]
1203.LSEH_info_${PREFIX}_encrypt:
1204 .byte 9,0,0,0
1205 .rva se_handler
1206 .rva .Lenc_body,.Lenc_epilogue # HandlerData[]
1207.LSEH_info_${PREFIX}_decrypt:
1208 .byte 9,0,0,0
1209 .rva se_handler
1210 .rva .Ldec_body,.Ldec_epilogue # HandlerData[]
1211.LSEH_info_${PREFIX}_cbc_encrypt:
1212 .byte 9,0,0,0
1213 .rva se_handler
1214 .rva .Lcbc_body,.Lcbc_epilogue # HandlerData[]
1215___
1216}
1217
1218$code =~ s/\`([^\`]*)\`/eval($1)/gem;
1219
1220print $code;
1221
1222close STDOUT;
diff --git a/src/lib/libcrypto/arch/aarch64/Makefile.inc b/src/lib/libcrypto/arch/aarch64/Makefile.inc
index d93cb815ef..d1f22d87cd 100644
--- a/src/lib/libcrypto/arch/aarch64/Makefile.inc
+++ b/src/lib/libcrypto/arch/aarch64/Makefile.inc
@@ -1,9 +1,11 @@
1# $OpenBSD: Makefile.inc,v 1.16 2025/03/12 14:13:41 jsing Exp $ 1# $OpenBSD: Makefile.inc,v 1.17 2025/06/28 12:51:08 jsing Exp $
2 2
3# aarch64-specific libcrypto build rules 3# aarch64-specific libcrypto build rules
4 4
5SRCS += crypto_cpu_caps.c 5SRCS += crypto_cpu_caps.c
6 6
7SRCS += sha1_aarch64.c
8SRCS += sha1_aarch64_ce.S
7SRCS += sha256_aarch64.c 9SRCS += sha256_aarch64.c
8SRCS += sha256_aarch64_ce.S 10SRCS += sha256_aarch64_ce.S
9SRCS += sha512_aarch64.c 11SRCS += sha512_aarch64.c
diff --git a/src/lib/libcrypto/arch/aarch64/crypto_arch.h b/src/lib/libcrypto/arch/aarch64/crypto_arch.h
index 35ecba9394..51c8d79e2d 100644
--- a/src/lib/libcrypto/arch/aarch64/crypto_arch.h
+++ b/src/lib/libcrypto/arch/aarch64/crypto_arch.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto_arch.h,v 1.4 2025/03/12 14:13:41 jsing Exp $ */ 1/* $OpenBSD: crypto_arch.h,v 1.5 2025/06/28 12:51:08 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -35,6 +35,7 @@ extern uint64_t crypto_cpu_caps_aarch64;
35 35
36#ifndef OPENSSL_NO_ASM 36#ifndef OPENSSL_NO_ASM
37 37
38#define HAVE_SHA1_BLOCK_DATA_ORDER
38#define HAVE_SHA256_BLOCK_DATA_ORDER 39#define HAVE_SHA256_BLOCK_DATA_ORDER
39#define HAVE_SHA512_BLOCK_DATA_ORDER 40#define HAVE_SHA512_BLOCK_DATA_ORDER
40 41
diff --git a/src/lib/libcrypto/arch/aarch64/opensslconf.h b/src/lib/libcrypto/arch/aarch64/opensslconf.h
index 731b06aecc..868066c75e 100644
--- a/src/lib/libcrypto/arch/aarch64/opensslconf.h
+++ b/src/lib/libcrypto/arch/aarch64/opensslconf.h
@@ -1,9 +1,4 @@
1#include <openssl/opensslfeatures.h> 1#include <openssl/opensslfeatures.h>
2/* crypto/opensslconf.h.in */
3
4#if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR)
5#define OPENSSLDIR "/etc/ssl"
6#endif
7 2
8#undef OPENSSL_EXPORT_VAR_AS_FUNCTION 3#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
9 4
@@ -17,30 +12,7 @@
17#endif 12#endif
18#endif 13#endif
19 14
20#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
21#define IDEA_INT unsigned int
22#endif
23
24#if defined(HEADER_MD2_H) && !defined(MD2_INT)
25#define MD2_INT unsigned int
26#endif
27
28#if defined(HEADER_RC2_H) && !defined(RC2_INT)
29/* I need to put in a mod for the alpha - eay */
30#define RC2_INT unsigned int
31#endif
32
33#if defined(HEADER_RC4_H) 15#if defined(HEADER_RC4_H)
34#if !defined(RC4_INT)
35/* using int types make the structure larger but make the code faster
36 * on most boxes I have tested - up to %20 faster. */
37/*
38 * I don't know what does "most" mean, but declaring "int" is a must on:
39 * - Intel P6 because partial register stalls are very expensive;
40 * - elder Alpha because it lacks byte load/store instructions;
41 */
42#define RC4_INT unsigned int
43#endif
44#if !defined(RC4_CHUNK) 16#if !defined(RC4_CHUNK)
45/* 17/*
46 * This enables code handling data aligned at natural CPU word 18 * This enables code handling data aligned at natural CPU word
@@ -49,106 +21,3 @@
49#define RC4_CHUNK unsigned long 21#define RC4_CHUNK unsigned long
50#endif 22#endif
51#endif 23#endif
52
53#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
54/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
55 * %20 speed up (longs are 8 bytes, int's are 4). */
56#ifndef DES_LONG
57#define DES_LONG unsigned int
58#endif
59#endif
60
61#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
62#define CONFIG_HEADER_BN_H
63#undef BN_LLONG
64
65/* Should we define BN_DIV2W here? */
66
67/* Only one for the following should be defined */
68/* The prime number generation stuff may not work when
69 * EIGHT_BIT but I don't care since I've only used this mode
70 * for debugging the bignum libraries */
71#define SIXTY_FOUR_BIT_LONG
72#undef SIXTY_FOUR_BIT
73#undef THIRTY_TWO_BIT
74#undef SIXTEEN_BIT
75#undef EIGHT_BIT
76#endif
77
78#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
79#define CONFIG_HEADER_BF_LOCL_H
80#undef BF_PTR
81#endif /* HEADER_BF_LOCL_H */
82
83#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
84#define CONFIG_HEADER_DES_LOCL_H
85#ifndef DES_DEFAULT_OPTIONS
86/* the following is tweaked from a config script, that is why it is a
87 * protected undef/define */
88#ifndef DES_PTR
89#undef DES_PTR
90#endif
91
92/* This helps C compiler generate the correct code for multiple functional
93 * units. It reduces register dependencies at the expense of 2 more
94 * registers */
95#ifndef DES_RISC1
96#undef DES_RISC1
97#endif
98
99#ifndef DES_RISC2
100#undef DES_RISC2
101#endif
102
103#if defined(DES_RISC1) && defined(DES_RISC2)
104YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
105#endif
106
107/* Unroll the inner loop, this sometimes helps, sometimes hinders.
108 * Very much CPU dependent */
109#ifndef DES_UNROLL
110#define DES_UNROLL
111#endif
112
113/* These default values were supplied by
114 * Peter Gutman <pgut001@cs.auckland.ac.nz>
115 * They are only used if nothing else has been defined */
116#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
117/* Special defines which change the way the code is built depending on the
118 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
119 even newer MIPS CPU's, but at the moment one size fits all for
120 optimization options. Older Sparc's work better with only UNROLL, but
121 there's no way to tell at compile time what it is you're running on */
122
123#if defined( sun ) /* Newer Sparc's */
124# define DES_PTR
125# define DES_RISC1
126# define DES_UNROLL
127#elif defined( __ultrix ) /* Older MIPS */
128# define DES_PTR
129# define DES_RISC2
130# define DES_UNROLL
131#elif defined( __osf1__ ) /* Alpha */
132# define DES_PTR
133# define DES_RISC2
134#elif defined ( _AIX ) /* RS6000 */
135 /* Unknown */
136#elif defined( __hpux ) /* HP-PA */
137 /* Unknown */
138#elif defined( __aux ) /* 68K */
139 /* Unknown */
140#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
141# define DES_UNROLL
142#elif defined( __sgi ) /* Newer MIPS */
143# define DES_PTR
144# define DES_RISC2
145# define DES_UNROLL
146#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
147# define DES_PTR
148# define DES_RISC1
149# define DES_UNROLL
150#endif /* Systems-specific speed defines */
151#endif
152
153#endif /* DES_DEFAULT_OPTIONS */
154#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/alpha/opensslconf.h b/src/lib/libcrypto/arch/alpha/opensslconf.h
index 0ec9c25891..868066c75e 100644
--- a/src/lib/libcrypto/arch/alpha/opensslconf.h
+++ b/src/lib/libcrypto/arch/alpha/opensslconf.h
@@ -1,9 +1,4 @@
1#include <openssl/opensslfeatures.h> 1#include <openssl/opensslfeatures.h>
2/* crypto/opensslconf.h.in */
3
4#if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR)
5#define OPENSSLDIR "/etc/ssl"
6#endif
7 2
8#undef OPENSSL_EXPORT_VAR_AS_FUNCTION 3#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
9 4
@@ -17,30 +12,7 @@
17#endif 12#endif
18#endif 13#endif
19 14
20#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
21#define IDEA_INT unsigned int
22#endif
23
24#if defined(HEADER_MD2_H) && !defined(MD2_INT)
25#define MD2_INT unsigned int
26#endif
27
28#if defined(HEADER_RC2_H) && !defined(RC2_INT)
29/* I need to put in a mod for the alpha - eay */
30#define RC2_INT unsigned int
31#endif
32
33#if defined(HEADER_RC4_H) 15#if defined(HEADER_RC4_H)
34#if !defined(RC4_INT)
35/* using int types make the structure larger but make the code faster
36 * on most boxes I have tested - up to %20 faster. */
37/*
38 * I don't know what does "most" mean, but declaring "int" is a must on:
39 * - Intel P6 because partial register stalls are very expensive;
40 * - elder Alpha because it lacks byte load/store instructions;
41 */
42#define RC4_INT unsigned int
43#endif
44#if !defined(RC4_CHUNK) 16#if !defined(RC4_CHUNK)
45/* 17/*
46 * This enables code handling data aligned at natural CPU word 18 * This enables code handling data aligned at natural CPU word
@@ -49,104 +21,3 @@
49#define RC4_CHUNK unsigned long 21#define RC4_CHUNK unsigned long
50#endif 22#endif
51#endif 23#endif
52
53#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
54/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
55 * %20 speed up (longs are 8 bytes, int's are 4). */
56#ifndef DES_LONG
57#define DES_LONG unsigned int
58#endif
59#endif
60
61#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
62#define CONFIG_HEADER_BN_H
63#undef BN_LLONG
64
65/* Should we define BN_DIV2W here? */
66
67/* Only one for the following should be defined */
68/* The prime number generation stuff may not work when
69 * EIGHT_BIT but I don't care since I've only used this mode
70 * for debugging the bignum libraries */
71#define SIXTY_FOUR_BIT_LONG
72#undef SIXTY_FOUR_BIT
73#undef THIRTY_TWO_BIT
74#endif
75
76#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
77#define CONFIG_HEADER_BF_LOCL_H
78#define BF_PTR
79#endif /* HEADER_BF_LOCL_H */
80
81#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
82#define CONFIG_HEADER_DES_LOCL_H
83#ifndef DES_DEFAULT_OPTIONS
84/* the following is tweaked from a config script, that is why it is a
85 * protected undef/define */
86#ifndef DES_PTR
87#define DES_PTR
88#endif
89
90/* This helps C compiler generate the correct code for multiple functional
91 * units. It reduces register dependencies at the expense of 2 more
92 * registers */
93#ifndef DES_RISC1
94#undef DES_RISC1
95#endif
96
97#ifndef DES_RISC2
98#define DES_RISC2
99#endif
100
101#if defined(DES_RISC1) && defined(DES_RISC2)
102YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
103#endif
104
105/* Unroll the inner loop, this sometimes helps, sometimes hinders.
106 * Very much CPU dependent */
107#ifndef DES_UNROLL
108#undef DES_UNROLL
109#endif
110
111/* These default values were supplied by
112 * Peter Gutman <pgut001@cs.auckland.ac.nz>
113 * They are only used if nothing else has been defined */
114#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
115/* Special defines which change the way the code is built depending on the
116 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
117 even newer MIPS CPU's, but at the moment one size fits all for
118 optimization options. Older Sparc's work better with only UNROLL, but
119 there's no way to tell at compile time what it is you're running on */
120
121#if defined( sun ) /* Newer Sparc's */
122# define DES_PTR
123# define DES_RISC1
124# define DES_UNROLL
125#elif defined( __ultrix ) /* Older MIPS */
126# define DES_PTR
127# define DES_RISC2
128# define DES_UNROLL
129#elif defined( __osf1__ ) /* Alpha */
130# define DES_PTR
131# define DES_RISC2
132#elif defined ( _AIX ) /* RS6000 */
133 /* Unknown */
134#elif defined( __hpux ) /* HP-PA */
135 /* Unknown */
136#elif defined( __aux ) /* 68K */
137 /* Unknown */
138#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
139# define DES_UNROLL
140#elif defined( __sgi ) /* Newer MIPS */
141# define DES_PTR
142# define DES_RISC2
143# define DES_UNROLL
144#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
145# define DES_PTR
146# define DES_RISC1
147# define DES_UNROLL
148#endif /* Systems-specific speed defines */
149#endif
150
151#endif /* DES_DEFAULT_OPTIONS */
152#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/amd64/Makefile.inc b/src/lib/libcrypto/arch/amd64/Makefile.inc
index b1a6563931..649c507189 100644
--- a/src/lib/libcrypto/arch/amd64/Makefile.inc
+++ b/src/lib/libcrypto/arch/amd64/Makefile.inc
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile.inc,v 1.37 2025/02/14 12:01:58 jsing Exp $ 1# $OpenBSD: Makefile.inc,v 1.41 2025/06/28 12:39:10 jsing Exp $
2 2
3# amd64-specific libcrypto build rules 3# amd64-specific libcrypto build rules
4 4
@@ -10,13 +10,10 @@ SRCS += crypto_cpu_caps.c
10# aes 10# aes
11CFLAGS+= -DAES_ASM 11CFLAGS+= -DAES_ASM
12SSLASM+= aes aes-x86_64 12SSLASM+= aes aes-x86_64
13CFLAGS+= -DBSAES_ASM
14SSLASM+= aes bsaes-x86_64
15CFLAGS+= -DVPAES_ASM
16SSLASM+= aes vpaes-x86_64
17SSLASM+= aes aesni-x86_64 13SSLASM+= aes aesni-x86_64
14SRCS += aes_amd64.c
15
18# bn 16# bn
19CFLAGS+= -DOPENSSL_IA32_SSE2
20CFLAGS+= -DRSA_ASM 17CFLAGS+= -DRSA_ASM
21SSLASM+= bn modexp512-x86_64 18SSLASM+= bn modexp512-x86_64
22CFLAGS+= -DOPENSSL_BN_ASM_MONT 19CFLAGS+= -DOPENSSL_BN_ASM_MONT
@@ -41,11 +38,15 @@ SRCS += word_clz.S
41# md5 38# md5
42CFLAGS+= -DMD5_ASM 39CFLAGS+= -DMD5_ASM
43SRCS+= md5_amd64_generic.S 40SRCS+= md5_amd64_generic.S
41
44# modes 42# modes
45CFLAGS+= -DGHASH_ASM 43CFLAGS+= -DGHASH_ASM
46SSLASM+= modes ghash-x86_64 44SSLASM+= modes ghash-x86_64
45SRCS += gcm128_amd64.c
46
47# rc4 47# rc4
48SSLASM+= rc4 rc4-x86_64 48SSLASM+= rc4 rc4-x86_64
49
49# ripemd 50# ripemd
50# sha 51# sha
51SRCS+= sha1_amd64.c 52SRCS+= sha1_amd64.c
diff --git a/src/lib/libcrypto/arch/amd64/crypto_arch.h b/src/lib/libcrypto/arch/amd64/crypto_arch.h
index 951374250d..e869fbba35 100644
--- a/src/lib/libcrypto/arch/amd64/crypto_arch.h
+++ b/src/lib/libcrypto/arch/amd64/crypto_arch.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto_arch.h,v 1.5 2025/02/14 12:01:58 jsing Exp $ */ 1/* $OpenBSD: crypto_arch.h,v 1.13 2025/07/22 09:18:02 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -21,21 +21,28 @@
21#define HEADER_CRYPTO_ARCH_H 21#define HEADER_CRYPTO_ARCH_H
22 22
23#define HAVE_CRYPTO_CPU_CAPS_INIT 23#define HAVE_CRYPTO_CPU_CAPS_INIT
24#define HAVE_CRYPTO_CPU_CAPS_IA32
25 24
26#ifndef __ASSEMBLER__ 25#ifndef __ASSEMBLER__
27extern uint64_t crypto_cpu_caps_amd64; 26extern uint64_t crypto_cpu_caps_amd64;
28#endif 27#endif
29 28
30#define CRYPTO_CPU_CAPS_AMD64_SHA (1ULL << 0) 29#define CRYPTO_CPU_CAPS_AMD64_AES (1ULL << 0)
30#define CRYPTO_CPU_CAPS_AMD64_CLMUL (1ULL << 1)
31#define CRYPTO_CPU_CAPS_AMD64_SHA (1ULL << 2)
31 32
32#ifndef OPENSSL_NO_ASM 33#ifndef OPENSSL_NO_ASM
33 34
34#define HAVE_AES_CBC_ENCRYPT_INTERNAL
35#define HAVE_AES_SET_ENCRYPT_KEY_INTERNAL 35#define HAVE_AES_SET_ENCRYPT_KEY_INTERNAL
36#define HAVE_AES_SET_DECRYPT_KEY_INTERNAL 36#define HAVE_AES_SET_DECRYPT_KEY_INTERNAL
37#define HAVE_AES_ENCRYPT_INTERNAL 37#define HAVE_AES_ENCRYPT_INTERNAL
38#define HAVE_AES_DECRYPT_INTERNAL 38#define HAVE_AES_DECRYPT_INTERNAL
39#define HAVE_AES_CBC_ENCRYPT_INTERNAL
40#define HAVE_AES_CCM64_ENCRYPT_INTERNAL
41#define HAVE_AES_CTR32_ENCRYPT_INTERNAL
42#define HAVE_AES_ECB_ENCRYPT_INTERNAL
43#define HAVE_AES_XTS_ENCRYPT_INTERNAL
44
45#define HAVE_GCM128_INIT
39 46
40#define HAVE_RC4_INTERNAL 47#define HAVE_RC4_INTERNAL
41#define HAVE_RC4_SET_KEY_INTERNAL 48#define HAVE_RC4_SET_KEY_INTERNAL
diff --git a/src/lib/libcrypto/arch/amd64/crypto_cpu_caps.c b/src/lib/libcrypto/arch/amd64/crypto_cpu_caps.c
index 63b7b64cda..0bc440d34f 100644
--- a/src/lib/libcrypto/arch/amd64/crypto_cpu_caps.c
+++ b/src/lib/libcrypto/arch/amd64/crypto_cpu_caps.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto_cpu_caps.c,v 1.4 2024/11/16 13:05:35 jsing Exp $ */ 1/* $OpenBSD: crypto_cpu_caps.c,v 1.7 2025/07/22 09:18:02 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -98,10 +98,14 @@ crypto_cpu_caps_init(void)
98 if ((edx & IA32CAP_MASK0_SSE2) != 0) 98 if ((edx & IA32CAP_MASK0_SSE2) != 0)
99 caps |= CPUCAP_MASK_SSE2; 99 caps |= CPUCAP_MASK_SSE2;
100 100
101 if ((ecx & IA32CAP_MASK1_AESNI) != 0) 101 if ((ecx & IA32CAP_MASK1_AESNI) != 0) {
102 caps |= CPUCAP_MASK_AESNI; 102 caps |= CPUCAP_MASK_AESNI;
103 if ((ecx & IA32CAP_MASK1_PCLMUL) != 0) 103 crypto_cpu_caps_amd64 |= CRYPTO_CPU_CAPS_AMD64_AES;
104 }
105 if ((ecx & IA32CAP_MASK1_PCLMUL) != 0) {
104 caps |= CPUCAP_MASK_PCLMUL; 106 caps |= CPUCAP_MASK_PCLMUL;
107 crypto_cpu_caps_amd64 |= CRYPTO_CPU_CAPS_AMD64_CLMUL;
108 }
105 if ((ecx & IA32CAP_MASK1_SSSE3) != 0) 109 if ((ecx & IA32CAP_MASK1_SSSE3) != 0)
106 caps |= CPUCAP_MASK_SSSE3; 110 caps |= CPUCAP_MASK_SSSE3;
107 111
@@ -126,9 +130,3 @@ crypto_cpu_caps_init(void)
126 130
127 OPENSSL_ia32cap_P = caps; 131 OPENSSL_ia32cap_P = caps;
128} 132}
129
130uint64_t
131crypto_cpu_caps_ia32(void)
132{
133 return OPENSSL_ia32cap_P;
134}
diff --git a/src/lib/libcrypto/arch/amd64/opensslconf.h b/src/lib/libcrypto/arch/amd64/opensslconf.h
index cc193762f1..868066c75e 100644
--- a/src/lib/libcrypto/arch/amd64/opensslconf.h
+++ b/src/lib/libcrypto/arch/amd64/opensslconf.h
@@ -1,9 +1,4 @@
1#include <openssl/opensslfeatures.h> 1#include <openssl/opensslfeatures.h>
2/* crypto/opensslconf.h.in */
3
4#if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR)
5#define OPENSSLDIR "/etc/ssl"
6#endif
7 2
8#undef OPENSSL_EXPORT_VAR_AS_FUNCTION 3#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
9 4
@@ -17,30 +12,7 @@
17#endif 12#endif
18#endif 13#endif
19 14
20#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
21#define IDEA_INT unsigned int
22#endif
23
24#if defined(HEADER_MD2_H) && !defined(MD2_INT)
25#define MD2_INT unsigned int
26#endif
27
28#if defined(HEADER_RC2_H) && !defined(RC2_INT)
29/* I need to put in a mod for the alpha - eay */
30#define RC2_INT unsigned int
31#endif
32
33#if defined(HEADER_RC4_H) 15#if defined(HEADER_RC4_H)
34#if !defined(RC4_INT)
35/* using int types make the structure larger but make the code faster
36 * on most boxes I have tested - up to %20 faster. */
37/*
38 * I don't know what does "most" mean, but declaring "int" is a must on:
39 * - Intel P6 because partial register stalls are very expensive;
40 * - elder Alpha because it lacks byte load/store instructions;
41 */
42#define RC4_INT unsigned int
43#endif
44#if !defined(RC4_CHUNK) 16#if !defined(RC4_CHUNK)
45/* 17/*
46 * This enables code handling data aligned at natural CPU word 18 * This enables code handling data aligned at natural CPU word
@@ -49,101 +21,3 @@
49#define RC4_CHUNK unsigned long 21#define RC4_CHUNK unsigned long
50#endif 22#endif
51#endif 23#endif
52
53#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
54/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
55 * %20 speed up (longs are 8 bytes, int's are 4). */
56#ifndef DES_LONG
57#define DES_LONG unsigned int
58#endif
59#endif
60
61#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
62#define CONFIG_HEADER_BN_H
63#undef BN_LLONG
64
65/* Should we define BN_DIV2W here? */
66
67/* Only one for the following should be defined */
68#define SIXTY_FOUR_BIT_LONG
69#undef SIXTY_FOUR_BIT
70#undef THIRTY_TWO_BIT
71#endif
72
73#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
74#define CONFIG_HEADER_BF_LOCL_H
75#undef BF_PTR
76#endif /* HEADER_BF_LOCL_H */
77
78#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
79#define CONFIG_HEADER_DES_LOCL_H
80#ifndef DES_DEFAULT_OPTIONS
81/* the following is tweaked from a config script, that is why it is a
82 * protected undef/define */
83#ifndef DES_PTR
84#undef DES_PTR
85#endif
86
87/* This helps C compiler generate the correct code for multiple functional
88 * units. It reduces register dependencies at the expense of 2 more
89 * registers */
90#ifndef DES_RISC1
91#undef DES_RISC1
92#endif
93
94#ifndef DES_RISC2
95#undef DES_RISC2
96#endif
97
98#if defined(DES_RISC1) && defined(DES_RISC2)
99YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
100#endif
101
102/* Unroll the inner loop, this sometimes helps, sometimes hinders.
103 * Very much CPU dependent */
104#ifndef DES_UNROLL
105#define DES_UNROLL
106#endif
107
108/* These default values were supplied by
109 * Peter Gutman <pgut001@cs.auckland.ac.nz>
110 * They are only used if nothing else has been defined */
111#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
112/* Special defines which change the way the code is built depending on the
113 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
114 even newer MIPS CPU's, but at the moment one size fits all for
115 optimization options. Older Sparc's work better with only UNROLL, but
116 there's no way to tell at compile time what it is you're running on */
117
118#if defined( sun ) /* Newer Sparc's */
119# define DES_PTR
120# define DES_RISC1
121# define DES_UNROLL
122#elif defined( __ultrix ) /* Older MIPS */
123# define DES_PTR
124# define DES_RISC2
125# define DES_UNROLL
126#elif defined( __osf1__ ) /* Alpha */
127# define DES_PTR
128# define DES_RISC2
129#elif defined ( _AIX ) /* RS6000 */
130 /* Unknown */
131#elif defined( __hpux ) /* HP-PA */
132 /* Unknown */
133#elif defined( __aux ) /* 68K */
134 /* Unknown */
135#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
136# define DES_UNROLL
137#elif defined( __sgi ) /* Newer MIPS */
138# define DES_PTR
139# define DES_RISC2
140# define DES_UNROLL
141#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
142# define DES_PTR
143# define DES_RISC1
144# define DES_UNROLL
145#endif /* Systems-specific speed defines */
146#endif
147
148#endif /* DES_DEFAULT_OPTIONS */
149#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/arm/Makefile.inc b/src/lib/libcrypto/arch/arm/Makefile.inc
index e078c51d98..271dff04f6 100644
--- a/src/lib/libcrypto/arch/arm/Makefile.inc
+++ b/src/lib/libcrypto/arch/arm/Makefile.inc
@@ -1,28 +1,3 @@
1# $oPenBSD: Makefile.inc,v 1.2 2014/05/02 18:21:39 miod Exp $ 1# $OpenBSD: Makefile.inc,v 1.20 2025/05/24 07:07:18 jsing Exp $
2 2
3# arm-specific libcrypto build rules 3# arm-specific libcrypto build rules
4
5# aes
6CFLAGS+= -DAES_ASM
7SSLASM+= aes aes-armv4
8# bn
9CFLAGS+= -DOPENSSL_BN_ASM_MONT
10SSLASM+= bn armv4-mont
11# modes
12CFLAGS+= -DGHASH_ASM
13SSLASM+= modes ghash-armv4
14# sha
15SSLASM+= sha sha1-armv4-large
16SSLASM+= sha sha256-armv4
17SSLASM+= sha sha512-armv4
18
19.for dir f in ${SSLASM}
20SRCS+= ${f}.S
21GENERATED+=${f}.S
22${f}.S: ${LCRYPTO_SRC}/${dir}/asm/${f}.pl
23 /usr/bin/perl \
24 ${LCRYPTO_SRC}/${dir}/asm/${f}.pl void ${.TARGET} > ${.TARGET}
25.endfor
26
27CFLAGS+= -DOPENSSL_CPUID_OBJ
28SRCS+= armv4cpuid.S armcap.c
diff --git a/src/lib/libcrypto/arch/arm/arm_arch.h b/src/lib/libcrypto/arch/arm/arm_arch.h
deleted file mode 100644
index 5ac3b935f1..0000000000
--- a/src/lib/libcrypto/arch/arm/arm_arch.h
+++ /dev/null
@@ -1,59 +0,0 @@
1/* $OpenBSD: arm_arch.h,v 1.1 2022/03/23 15:13:31 tb Exp $ */
2#ifndef __ARM_ARCH_H__
3#define __ARM_ARCH_H__
4
5#if !defined(__ARM_ARCH__)
6# if defined(__CC_ARM)
7# define __ARM_ARCH__ __TARGET_ARCH_ARM
8# if defined(__BIG_ENDIAN)
9# define __ARMEB__
10# else
11# define __ARMEL__
12# endif
13# elif defined(__GNUC__)
14 /*
15 * Why doesn't gcc define __ARM_ARCH__? Instead it defines
16 * bunch of below macros. See all_architectures[] table in
17 * gcc/config/arm/arm.c. On a side note it defines
18 * __ARMEL__/__ARMEB__ for little-/big-endian.
19 */
20# if defined(__ARM_ARCH)
21# define __ARM_ARCH__ __ARM_ARCH
22# elif defined(__ARM_ARCH_8A__)
23# define __ARM_ARCH__ 8
24# elif defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || \
25 defined(__ARM_ARCH_7R__)|| defined(__ARM_ARCH_7M__) || \
26 defined(__ARM_ARCH_7EM__)
27# define __ARM_ARCH__ 7
28# elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || \
29 defined(__ARM_ARCH_6K__)|| defined(__ARM_ARCH_6M__) || \
30 defined(__ARM_ARCH_6Z__)|| defined(__ARM_ARCH_6ZK__) || \
31 defined(__ARM_ARCH_6T2__)
32# define __ARM_ARCH__ 6
33# elif defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) || \
34 defined(__ARM_ARCH_5E__)|| defined(__ARM_ARCH_5TE__) || \
35 defined(__ARM_ARCH_5TEJ__)
36# define __ARM_ARCH__ 5
37# elif defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)
38# define __ARM_ARCH__ 4
39# else
40# error "unsupported ARM architecture"
41# endif
42# endif
43#endif
44
45#if !defined(__ASSEMBLER__)
46extern unsigned int OPENSSL_armcap_P;
47
48#define ARMV7_NEON (1<<0)
49#define ARMV8_AES (1<<1)
50#define ARMV8_SHA1 (1<<2)
51#define ARMV8_SHA256 (1<<3)
52#define ARMV8_PMULL (1<<4)
53#endif
54
55#if defined(__OpenBSD__)
56#define __STRICT_ALIGNMENT
57#endif
58
59#endif
diff --git a/src/lib/libcrypto/arch/arm/armcap.c b/src/lib/libcrypto/arch/arm/armcap.c
deleted file mode 100644
index 0238195397..0000000000
--- a/src/lib/libcrypto/arch/arm/armcap.c
+++ /dev/null
@@ -1,88 +0,0 @@
1/* $OpenBSD: armcap.c,v 1.3 2024/08/29 03:30:05 deraadt Exp $ */
2#include <stdio.h>
3#include <stdlib.h>
4#include <string.h>
5#include <setjmp.h>
6#include <signal.h>
7#include <openssl/crypto.h>
8
9#include "arm_arch.h"
10
11unsigned int OPENSSL_armcap_P;
12
13#if __ARM_ARCH__ >= 7
14static sigset_t all_masked;
15
16static sigjmp_buf ill_jmp;
17
18static void
19ill_handler(int sig)
20{
21 siglongjmp(ill_jmp, sig);
22}
23
24/*
25 * Following subroutines could have been inlined, but it's not all
26 * ARM compilers support inline assembler...
27 */
28void _armv7_neon_probe(void);
29void _armv8_aes_probe(void);
30void _armv8_sha1_probe(void);
31void _armv8_sha256_probe(void);
32void _armv8_pmull_probe(void);
33#endif
34
35void
36OPENSSL_cpuid_setup(void)
37{
38#if __ARM_ARCH__ >= 7
39 struct sigaction ill_oact, ill_act;
40 sigset_t oset;
41#endif
42 static int trigger = 0;
43
44 if (trigger)
45 return;
46 trigger = 1;
47
48 OPENSSL_armcap_P = 0;
49
50#if __ARM_ARCH__ >= 7
51 sigfillset(&all_masked);
52 sigdelset(&all_masked, SIGILL);
53 sigdelset(&all_masked, SIGTRAP);
54 sigdelset(&all_masked, SIGFPE);
55 sigdelset(&all_masked, SIGBUS);
56 sigdelset(&all_masked, SIGSEGV);
57
58 memset(&ill_act, 0, sizeof(ill_act));
59 ill_act.sa_handler = ill_handler;
60 ill_act.sa_mask = all_masked;
61
62 sigprocmask(SIG_SETMASK, &ill_act.sa_mask, &oset);
63 sigaction(SIGILL, &ill_act, &ill_oact);
64
65 if (sigsetjmp(ill_jmp, 1) == 0) {
66 _armv7_neon_probe();
67 OPENSSL_armcap_P |= ARMV7_NEON;
68 if (sigsetjmp(ill_jmp, 1) == 0) {
69 _armv8_pmull_probe();
70 OPENSSL_armcap_P |= ARMV8_PMULL | ARMV8_AES;
71 } else if (sigsetjmp(ill_jmp, 1) == 0) {
72 _armv8_aes_probe();
73 OPENSSL_armcap_P |= ARMV8_AES;
74 }
75 if (sigsetjmp(ill_jmp, 1) == 0) {
76 _armv8_sha1_probe();
77 OPENSSL_armcap_P |= ARMV8_SHA1;
78 }
79 if (sigsetjmp(ill_jmp, 1) == 0) {
80 _armv8_sha256_probe();
81 OPENSSL_armcap_P |= ARMV8_SHA256;
82 }
83 }
84
85 sigaction (SIGILL, &ill_oact, NULL);
86 sigprocmask(SIG_SETMASK, &oset, NULL);
87#endif
88}
diff --git a/src/lib/libcrypto/arch/arm/armv4cpuid.S b/src/lib/libcrypto/arch/arm/armv4cpuid.S
deleted file mode 100644
index db0b54e496..0000000000
--- a/src/lib/libcrypto/arch/arm/armv4cpuid.S
+++ /dev/null
@@ -1,69 +0,0 @@
1#include "arm_arch.h"
2
3.text
4#if defined(__thumb2__) && !defined(__APPLE__)
5.syntax unified
6.thumb
7#else
8.code 32
9#undef __thumb2__
10#endif
11
12#if __ARM_ARCH__>=7
13.arch armv7-a
14.fpu neon
15
16.align 5
17.globl _armv7_neon_probe
18.type _armv7_neon_probe,%function
19_armv7_neon_probe:
20 vorr q0,q0,q0
21 bx lr
22.size _armv7_neon_probe,.-_armv7_neon_probe
23
24.globl _armv8_aes_probe
25.type _armv8_aes_probe,%function
26_armv8_aes_probe:
27#if defined(__thumb2__) && !defined(__APPLE__)
28.byte 0xb0,0xff,0x00,0x03 @ aese.8 q0,q0
29#else
30.byte 0x00,0x03,0xb0,0xf3 @ aese.8 q0,q0
31#endif
32 bx lr
33.size _armv8_aes_probe,.-_armv8_aes_probe
34
35.globl _armv8_sha1_probe
36.type _armv8_sha1_probe,%function
37_armv8_sha1_probe:
38#if defined(__thumb2__) && !defined(__APPLE__)
39.byte 0x00,0xef,0x40,0x0c @ sha1c.32 q0,q0,q0
40#else
41.byte 0x40,0x0c,0x00,0xf2 @ sha1c.32 q0,q0,q0
42#endif
43 bx lr
44.size _armv8_sha1_probe,.-_armv8_sha1_probe
45
46.globl _armv8_sha256_probe
47.type _armv8_sha256_probe,%function
48_armv8_sha256_probe:
49#if defined(__thumb2__) && !defined(__APPLE__)
50.byte 0x00,0xff,0x40,0x0c @ sha256h.32 q0,q0,q0
51#else
52.byte 0x40,0x0c,0x00,0xf3 @ sha256h.32 q0,q0,q0
53#endif
54 bx lr
55.size _armv8_sha256_probe,.-_armv8_sha256_probe
56.globl _armv8_pmull_probe
57.type _armv8_pmull_probe,%function
58_armv8_pmull_probe:
59#if defined(__thumb2__) && !defined(__APPLE__)
60.byte 0xa0,0xef,0x00,0x0e @ vmull.p64 q0,d0,d0
61#else
62.byte 0x00,0x0e,0xa0,0xf2 @ vmull.p64 q0,d0,d0
63#endif
64 bx lr
65.size _armv8_pmull_probe,.-_armv8_pmull_probe
66#endif
67
68.comm OPENSSL_armcap_P,4,4
69.hidden OPENSSL_armcap_P
diff --git a/src/lib/libcrypto/arch/arm/crypto_arch.h b/src/lib/libcrypto/arch/arm/crypto_arch.h
index 07d7829fe3..732a59cf72 100644
--- a/src/lib/libcrypto/arch/arm/crypto_arch.h
+++ b/src/lib/libcrypto/arch/arm/crypto_arch.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto_arch.h,v 1.2 2025/02/14 12:01:58 jsing Exp $ */ 1/* $OpenBSD: crypto_arch.h,v 1.3 2025/05/24 07:07:18 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -20,20 +20,6 @@
20 20
21#ifndef OPENSSL_NO_ASM 21#ifndef OPENSSL_NO_ASM
22 22
23#define HAVE_AES_SET_ENCRYPT_KEY_INTERNAL
24#define HAVE_AES_SET_DECRYPT_KEY_INTERNAL
25#define HAVE_AES_ENCRYPT_INTERNAL
26#define HAVE_AES_DECRYPT_INTERNAL
27
28#define HAVE_SHA1_BLOCK_DATA_ORDER
29#define HAVE_SHA1_BLOCK_GENERIC
30
31#define HAVE_SHA256_BLOCK_DATA_ORDER
32#define HAVE_SHA256_BLOCK_GENERIC
33
34#define HAVE_SHA512_BLOCK_DATA_ORDER
35#define HAVE_SHA512_BLOCK_GENERIC
36
37#endif 23#endif
38 24
39#endif 25#endif
diff --git a/src/lib/libcrypto/arch/arm/opensslconf.h b/src/lib/libcrypto/arch/arm/opensslconf.h
index a5d26b6fdc..dcbe113864 100644
--- a/src/lib/libcrypto/arch/arm/opensslconf.h
+++ b/src/lib/libcrypto/arch/arm/opensslconf.h
@@ -1,9 +1,4 @@
1#include <openssl/opensslfeatures.h> 1#include <openssl/opensslfeatures.h>
2/* crypto/opensslconf.h.in */
3
4#if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR)
5#define OPENSSLDIR "/etc/ssl"
6#endif
7 2
8#undef OPENSSL_EXPORT_VAR_AS_FUNCTION 3#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
9 4
@@ -17,30 +12,7 @@
17#endif 12#endif
18#endif 13#endif
19 14
20#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
21#define IDEA_INT unsigned int
22#endif
23
24#if defined(HEADER_MD2_H) && !defined(MD2_INT)
25#define MD2_INT unsigned int
26#endif
27
28#if defined(HEADER_RC2_H) && !defined(RC2_INT)
29/* I need to put in a mod for the alpha - eay */
30#define RC2_INT unsigned int
31#endif
32
33#if defined(HEADER_RC4_H) 15#if defined(HEADER_RC4_H)
34#if !defined(RC4_INT)
35/* using int types make the structure larger but make the code faster
36 * on most boxes I have tested - up to %20 faster. */
37/*
38 * I don't know what does "most" mean, but declaring "int" is a must on:
39 * - Intel P6 because partial register stalls are very expensive;
40 * - elder Alpha because it lacks byte load/store instructions;
41 */
42#define RC4_INT unsigned int
43#endif
44#if !defined(RC4_CHUNK) 16#if !defined(RC4_CHUNK)
45/* 17/*
46 * This enables code handling data aligned at natural CPU word 18 * This enables code handling data aligned at natural CPU word
@@ -49,106 +21,3 @@
49#undef RC4_CHUNK 21#undef RC4_CHUNK
50#endif 22#endif
51#endif 23#endif
52
53#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
54/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
55 * %20 speed up (longs are 8 bytes, int's are 4). */
56#ifndef DES_LONG
57#define DES_LONG unsigned int
58#endif
59#endif
60
61#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
62#define CONFIG_HEADER_BN_H
63#define BN_LLONG
64
65/* Should we define BN_DIV2W here? */
66
67/* Only one for the following should be defined */
68/* The prime number generation stuff may not work when
69 * EIGHT_BIT but I don't care since I've only used this mode
70 * for debugging the bignum libraries */
71#undef SIXTY_FOUR_BIT_LONG
72#undef SIXTY_FOUR_BIT
73#define THIRTY_TWO_BIT
74#undef SIXTEEN_BIT
75#undef EIGHT_BIT
76#endif
77
78#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
79#define CONFIG_HEADER_BF_LOCL_H
80#undef BF_PTR
81#endif /* HEADER_BF_LOCL_H */
82
83#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
84#define CONFIG_HEADER_DES_LOCL_H
85#ifndef DES_DEFAULT_OPTIONS
86/* the following is tweaked from a config script, that is why it is a
87 * protected undef/define */
88#ifndef DES_PTR
89#undef DES_PTR
90#endif
91
92/* This helps C compiler generate the correct code for multiple functional
93 * units. It reduces register dependencies at the expense of 2 more
94 * registers */
95#ifndef DES_RISC1
96#undef DES_RISC1
97#endif
98
99#ifndef DES_RISC2
100#undef DES_RISC2
101#endif
102
103#if defined(DES_RISC1) && defined(DES_RISC2)
104YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
105#endif
106
107/* Unroll the inner loop, this sometimes helps, sometimes hinders.
108 * Very much CPU dependent */
109#ifndef DES_UNROLL
110#define DES_UNROLL
111#endif
112
113/* These default values were supplied by
114 * Peter Gutman <pgut001@cs.auckland.ac.nz>
115 * They are only used if nothing else has been defined */
116#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
117/* Special defines which change the way the code is built depending on the
118 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
119 even newer MIPS CPU's, but at the moment one size fits all for
120 optimization options. Older Sparc's work better with only UNROLL, but
121 there's no way to tell at compile time what it is you're running on */
122
123#if defined( sun ) /* Newer Sparc's */
124# define DES_PTR
125# define DES_RISC1
126# define DES_UNROLL
127#elif defined( __ultrix ) /* Older MIPS */
128# define DES_PTR
129# define DES_RISC2
130# define DES_UNROLL
131#elif defined( __osf1__ ) /* Alpha */
132# define DES_PTR
133# define DES_RISC2
134#elif defined ( _AIX ) /* RS6000 */
135 /* Unknown */
136#elif defined( __hpux ) /* HP-PA */
137 /* Unknown */
138#elif defined( __aux ) /* 68K */
139 /* Unknown */
140#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
141# define DES_UNROLL
142#elif defined( __sgi ) /* Newer MIPS */
143# define DES_PTR
144# define DES_RISC2
145# define DES_UNROLL
146#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
147# define DES_PTR
148# define DES_RISC1
149# define DES_UNROLL
150#endif /* Systems-specific speed defines */
151#endif
152
153#endif /* DES_DEFAULT_OPTIONS */
154#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/hppa/opensslconf.h b/src/lib/libcrypto/arch/hppa/opensslconf.h
index a5d26b6fdc..dcbe113864 100644
--- a/src/lib/libcrypto/arch/hppa/opensslconf.h
+++ b/src/lib/libcrypto/arch/hppa/opensslconf.h
@@ -1,9 +1,4 @@
1#include <openssl/opensslfeatures.h> 1#include <openssl/opensslfeatures.h>
2/* crypto/opensslconf.h.in */
3
4#if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR)
5#define OPENSSLDIR "/etc/ssl"
6#endif
7 2
8#undef OPENSSL_EXPORT_VAR_AS_FUNCTION 3#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
9 4
@@ -17,30 +12,7 @@
17#endif 12#endif
18#endif 13#endif
19 14
20#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
21#define IDEA_INT unsigned int
22#endif
23
24#if defined(HEADER_MD2_H) && !defined(MD2_INT)
25#define MD2_INT unsigned int
26#endif
27
28#if defined(HEADER_RC2_H) && !defined(RC2_INT)
29/* I need to put in a mod for the alpha - eay */
30#define RC2_INT unsigned int
31#endif
32
33#if defined(HEADER_RC4_H) 15#if defined(HEADER_RC4_H)
34#if !defined(RC4_INT)
35/* using int types make the structure larger but make the code faster
36 * on most boxes I have tested - up to %20 faster. */
37/*
38 * I don't know what does "most" mean, but declaring "int" is a must on:
39 * - Intel P6 because partial register stalls are very expensive;
40 * - elder Alpha because it lacks byte load/store instructions;
41 */
42#define RC4_INT unsigned int
43#endif
44#if !defined(RC4_CHUNK) 16#if !defined(RC4_CHUNK)
45/* 17/*
46 * This enables code handling data aligned at natural CPU word 18 * This enables code handling data aligned at natural CPU word
@@ -49,106 +21,3 @@
49#undef RC4_CHUNK 21#undef RC4_CHUNK
50#endif 22#endif
51#endif 23#endif
52
53#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
54/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
55 * %20 speed up (longs are 8 bytes, int's are 4). */
56#ifndef DES_LONG
57#define DES_LONG unsigned int
58#endif
59#endif
60
61#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
62#define CONFIG_HEADER_BN_H
63#define BN_LLONG
64
65/* Should we define BN_DIV2W here? */
66
67/* Only one for the following should be defined */
68/* The prime number generation stuff may not work when
69 * EIGHT_BIT but I don't care since I've only used this mode
70 * for debugging the bignum libraries */
71#undef SIXTY_FOUR_BIT_LONG
72#undef SIXTY_FOUR_BIT
73#define THIRTY_TWO_BIT
74#undef SIXTEEN_BIT
75#undef EIGHT_BIT
76#endif
77
78#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
79#define CONFIG_HEADER_BF_LOCL_H
80#undef BF_PTR
81#endif /* HEADER_BF_LOCL_H */
82
83#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
84#define CONFIG_HEADER_DES_LOCL_H
85#ifndef DES_DEFAULT_OPTIONS
86/* the following is tweaked from a config script, that is why it is a
87 * protected undef/define */
88#ifndef DES_PTR
89#undef DES_PTR
90#endif
91
92/* This helps C compiler generate the correct code for multiple functional
93 * units. It reduces register dependencies at the expense of 2 more
94 * registers */
95#ifndef DES_RISC1
96#undef DES_RISC1
97#endif
98
99#ifndef DES_RISC2
100#undef DES_RISC2
101#endif
102
103#if defined(DES_RISC1) && defined(DES_RISC2)
104YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
105#endif
106
107/* Unroll the inner loop, this sometimes helps, sometimes hinders.
108 * Very much CPU dependent */
109#ifndef DES_UNROLL
110#define DES_UNROLL
111#endif
112
113/* These default values were supplied by
114 * Peter Gutman <pgut001@cs.auckland.ac.nz>
115 * They are only used if nothing else has been defined */
116#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
117/* Special defines which change the way the code is built depending on the
118 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
119 even newer MIPS CPU's, but at the moment one size fits all for
120 optimization options. Older Sparc's work better with only UNROLL, but
121 there's no way to tell at compile time what it is you're running on */
122
123#if defined( sun ) /* Newer Sparc's */
124# define DES_PTR
125# define DES_RISC1
126# define DES_UNROLL
127#elif defined( __ultrix ) /* Older MIPS */
128# define DES_PTR
129# define DES_RISC2
130# define DES_UNROLL
131#elif defined( __osf1__ ) /* Alpha */
132# define DES_PTR
133# define DES_RISC2
134#elif defined ( _AIX ) /* RS6000 */
135 /* Unknown */
136#elif defined( __hpux ) /* HP-PA */
137 /* Unknown */
138#elif defined( __aux ) /* 68K */
139 /* Unknown */
140#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
141# define DES_UNROLL
142#elif defined( __sgi ) /* Newer MIPS */
143# define DES_PTR
144# define DES_RISC2
145# define DES_UNROLL
146#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
147# define DES_PTR
148# define DES_RISC1
149# define DES_UNROLL
150#endif /* Systems-specific speed defines */
151#endif
152
153#endif /* DES_DEFAULT_OPTIONS */
154#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/i386/Makefile.inc b/src/lib/libcrypto/arch/i386/Makefile.inc
index 6989b35686..bfc701687e 100644
--- a/src/lib/libcrypto/arch/i386/Makefile.inc
+++ b/src/lib/libcrypto/arch/i386/Makefile.inc
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile.inc,v 1.27 2025/02/14 12:01:58 jsing Exp $ 1# $OpenBSD: Makefile.inc,v 1.31 2025/06/28 12:39:10 jsing Exp $
2 2
3# i386-specific libcrypto build rules 3# i386-specific libcrypto build rules
4 4
@@ -10,23 +10,27 @@ SRCS += crypto_cpu_caps.c
10# aes 10# aes
11CFLAGS+= -DAES_ASM 11CFLAGS+= -DAES_ASM
12SSLASM+= aes aes-586 12SSLASM+= aes aes-586
13CFLAGS+= -DVPAES_ASM
14SSLASM+= aes vpaes-x86
15SSLASM+= aes aesni-x86 13SSLASM+= aes aesni-x86
14SRCS += aes_i386.c
15
16# bn 16# bn
17CFLAGS+= -DOPENSSL_IA32_SSE2
18SSLASM+= bn bn-586 17SSLASM+= bn bn-586
19SSLASM+= bn co-586 18SSLASM+= bn co-586
20CFLAGS+= -DOPENSSL_BN_ASM_MONT 19CFLAGS+= -DOPENSSL_BN_ASM_MONT
21SSLASM+= bn x86-mont 20SSLASM+= bn x86-mont
21
22# md5 22# md5
23CFLAGS+= -DMD5_ASM 23CFLAGS+= -DMD5_ASM
24SSLASM+= md5 md5-586 24SSLASM+= md5 md5-586
25
25# modes 26# modes
26CFLAGS+= -DGHASH_ASM 27CFLAGS+= -DGHASH_ASM
27SSLASM+= modes ghash-x86 28SSLASM+= modes ghash-x86
29SRCS += gcm128_i386.c
30
28# rc4 31# rc4
29SSLASM+= rc4 rc4-586 32SSLASM+= rc4 rc4-586
33
30# sha 34# sha
31SSLASM+= sha sha1-586 35SSLASM+= sha sha1-586
32SSLASM+= sha sha256-586 36SSLASM+= sha sha256-586
diff --git a/src/lib/libcrypto/arch/i386/crypto_arch.h b/src/lib/libcrypto/arch/i386/crypto_arch.h
index 3df3963d0b..d2faa36e2e 100644
--- a/src/lib/libcrypto/arch/i386/crypto_arch.h
+++ b/src/lib/libcrypto/arch/i386/crypto_arch.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto_arch.h,v 1.4 2025/02/14 12:01:58 jsing Exp $ */ 1/* $OpenBSD: crypto_arch.h,v 1.12 2025/07/22 09:18:02 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -15,19 +15,34 @@
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 16 */
17 17
18#include <stdint.h>
19
18#ifndef HEADER_CRYPTO_ARCH_H 20#ifndef HEADER_CRYPTO_ARCH_H
19#define HEADER_CRYPTO_ARCH_H 21#define HEADER_CRYPTO_ARCH_H
20 22
21#define HAVE_CRYPTO_CPU_CAPS_INIT 23#define HAVE_CRYPTO_CPU_CAPS_INIT
22#define HAVE_CRYPTO_CPU_CAPS_IA32 24
25#ifndef __ASSEMBLER__
26extern uint64_t crypto_cpu_caps_i386;
27#endif
28
29#define CRYPTO_CPU_CAPS_I386_AES (1ULL << 0)
30#define CRYPTO_CPU_CAPS_I386_CLMUL (1ULL << 1)
31#define CRYPTO_CPU_CAPS_I386_MMX (1ULL << 2)
23 32
24#ifndef OPENSSL_NO_ASM 33#ifndef OPENSSL_NO_ASM
25 34
26#define HAVE_AES_CBC_ENCRYPT_INTERNAL
27#define HAVE_AES_SET_ENCRYPT_KEY_INTERNAL 35#define HAVE_AES_SET_ENCRYPT_KEY_INTERNAL
28#define HAVE_AES_SET_DECRYPT_KEY_INTERNAL 36#define HAVE_AES_SET_DECRYPT_KEY_INTERNAL
29#define HAVE_AES_ENCRYPT_INTERNAL 37#define HAVE_AES_ENCRYPT_INTERNAL
30#define HAVE_AES_DECRYPT_INTERNAL 38#define HAVE_AES_DECRYPT_INTERNAL
39#define HAVE_AES_CBC_ENCRYPT_INTERNAL
40#define HAVE_AES_CCM64_ENCRYPT_INTERNAL
41#define HAVE_AES_CTR32_ENCRYPT_INTERNAL
42#define HAVE_AES_ECB_ENCRYPT_INTERNAL
43#define HAVE_AES_XTS_ENCRYPT_INTERNAL
44
45#define HAVE_GCM128_INIT
31 46
32#define HAVE_RC4_INTERNAL 47#define HAVE_RC4_INTERNAL
33#define HAVE_RC4_SET_KEY_INTERNAL 48#define HAVE_RC4_SET_KEY_INTERNAL
diff --git a/src/lib/libcrypto/arch/i386/crypto_cpu_caps.c b/src/lib/libcrypto/arch/i386/crypto_cpu_caps.c
index 6bb77411af..07d60f9a3f 100644
--- a/src/lib/libcrypto/arch/i386/crypto_cpu_caps.c
+++ b/src/lib/libcrypto/arch/i386/crypto_cpu_caps.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto_cpu_caps.c,v 1.3 2024/11/12 13:14:57 jsing Exp $ */ 1/* $OpenBSD: crypto_cpu_caps.c,v 1.6 2025/07/22 09:18:02 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -19,11 +19,15 @@
19 19
20#include <openssl/crypto.h> 20#include <openssl/crypto.h>
21 21
22#include "crypto_arch.h"
22#include "x86_arch.h" 23#include "x86_arch.h"
23 24
24/* Legacy architecture specific capabilities, used by perlasm. */ 25/* Legacy architecture specific capabilities, used by perlasm. */
25uint64_t OPENSSL_ia32cap_P; 26uint64_t OPENSSL_ia32cap_P;
26 27
28/* Machine dependent CPU capabilities. */
29uint64_t crypto_cpu_caps_i386;
30
27/* Machine independent CPU capabilities. */ 31/* Machine independent CPU capabilities. */
28extern uint64_t crypto_cpu_caps; 32extern uint64_t crypto_cpu_caps;
29 33
@@ -85,17 +89,23 @@ crypto_cpu_caps_init(void)
85 caps |= CPUCAP_MASK_FXSR; 89 caps |= CPUCAP_MASK_FXSR;
86 if ((edx & IA32CAP_MASK0_HT) != 0) 90 if ((edx & IA32CAP_MASK0_HT) != 0)
87 caps |= CPUCAP_MASK_HT; 91 caps |= CPUCAP_MASK_HT;
88 if ((edx & IA32CAP_MASK0_MMX) != 0) 92 if ((edx & IA32CAP_MASK0_MMX) != 0) {
89 caps |= CPUCAP_MASK_MMX; 93 caps |= CPUCAP_MASK_MMX;
94 crypto_cpu_caps_i386 |= CRYPTO_CPU_CAPS_I386_MMX;
95 }
90 if ((edx & IA32CAP_MASK0_SSE) != 0) 96 if ((edx & IA32CAP_MASK0_SSE) != 0)
91 caps |= CPUCAP_MASK_SSE; 97 caps |= CPUCAP_MASK_SSE;
92 if ((edx & IA32CAP_MASK0_SSE2) != 0) 98 if ((edx & IA32CAP_MASK0_SSE2) != 0)
93 caps |= CPUCAP_MASK_SSE2; 99 caps |= CPUCAP_MASK_SSE2;
94 100
95 if ((ecx & IA32CAP_MASK1_AESNI) != 0) 101 if ((ecx & IA32CAP_MASK1_AESNI) != 0) {
96 caps |= CPUCAP_MASK_AESNI; 102 caps |= CPUCAP_MASK_AESNI;
97 if ((ecx & IA32CAP_MASK1_PCLMUL) != 0) 103 crypto_cpu_caps_i386 |= CRYPTO_CPU_CAPS_I386_AES;
104 }
105 if ((ecx & IA32CAP_MASK1_PCLMUL) != 0) {
98 caps |= CPUCAP_MASK_PCLMUL; 106 caps |= CPUCAP_MASK_PCLMUL;
107 crypto_cpu_caps_i386 |= CRYPTO_CPU_CAPS_I386_CLMUL;
108 }
99 if ((ecx & IA32CAP_MASK1_SSSE3) != 0) 109 if ((ecx & IA32CAP_MASK1_SSSE3) != 0)
100 caps |= CPUCAP_MASK_SSSE3; 110 caps |= CPUCAP_MASK_SSSE3;
101 111
@@ -112,9 +122,3 @@ crypto_cpu_caps_init(void)
112 122
113 OPENSSL_ia32cap_P = caps; 123 OPENSSL_ia32cap_P = caps;
114} 124}
115
116uint64_t
117crypto_cpu_caps_ia32(void)
118{
119 return OPENSSL_ia32cap_P;
120}
diff --git a/src/lib/libcrypto/arch/i386/opensslconf.h b/src/lib/libcrypto/arch/i386/opensslconf.h
index 03cf31b940..dcbe113864 100644
--- a/src/lib/libcrypto/arch/i386/opensslconf.h
+++ b/src/lib/libcrypto/arch/i386/opensslconf.h
@@ -1,9 +1,4 @@
1#include <openssl/opensslfeatures.h> 1#include <openssl/opensslfeatures.h>
2/* crypto/opensslconf.h.in */
3
4#if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR)
5#define OPENSSLDIR "/etc/ssl"
6#endif
7 2
8#undef OPENSSL_EXPORT_VAR_AS_FUNCTION 3#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
9 4
@@ -17,30 +12,7 @@
17#endif 12#endif
18#endif 13#endif
19 14
20#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
21#define IDEA_INT unsigned int
22#endif
23
24#if defined(HEADER_MD2_H) && !defined(MD2_INT)
25#define MD2_INT unsigned int
26#endif
27
28#if defined(HEADER_RC2_H) && !defined(RC2_INT)
29/* I need to put in a mod for the alpha - eay */
30#define RC2_INT unsigned int
31#endif
32
33#if defined(HEADER_RC4_H) 15#if defined(HEADER_RC4_H)
34#if !defined(RC4_INT)
35/* using int types make the structure larger but make the code faster
36 * on most boxes I have tested - up to %20 faster. */
37/*
38 * I don't know what does "most" mean, but declaring "int" is a must on:
39 * - Intel P6 because partial register stalls are very expensive;
40 * - elder Alpha because it lacks byte load/store instructions;
41 */
42#define RC4_INT unsigned int
43#endif
44#if !defined(RC4_CHUNK) 16#if !defined(RC4_CHUNK)
45/* 17/*
46 * This enables code handling data aligned at natural CPU word 18 * This enables code handling data aligned at natural CPU word
@@ -49,106 +21,3 @@
49#undef RC4_CHUNK 21#undef RC4_CHUNK
50#endif 22#endif
51#endif 23#endif
52
53#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
54/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
55 * %20 speed up (longs are 8 bytes, int's are 4). */
56#ifndef DES_LONG
57#define DES_LONG unsigned long
58#endif
59#endif
60
61#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
62#define CONFIG_HEADER_BN_H
63#define BN_LLONG
64
65/* Should we define BN_DIV2W here? */
66
67/* Only one for the following should be defined */
68/* The prime number generation stuff may not work when
69 * EIGHT_BIT but I don't care since I've only used this mode
70 * for debugging the bignum libraries */
71#undef SIXTY_FOUR_BIT_LONG
72#undef SIXTY_FOUR_BIT
73#define THIRTY_TWO_BIT
74#undef SIXTEEN_BIT
75#undef EIGHT_BIT
76#endif
77
78#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
79#define CONFIG_HEADER_BF_LOCL_H
80#undef BF_PTR
81#endif /* HEADER_BF_LOCL_H */
82
83#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
84#define CONFIG_HEADER_DES_LOCL_H
85#ifndef DES_DEFAULT_OPTIONS
86/* the following is tweaked from a config script, that is why it is a
87 * protected undef/define */
88#ifndef DES_PTR
89#define DES_PTR
90#endif
91
92/* This helps C compiler generate the correct code for multiple functional
93 * units. It reduces register dependencies at the expense of 2 more
94 * registers */
95#ifndef DES_RISC1
96#define DES_RISC1
97#endif
98
99#ifndef DES_RISC2
100#undef DES_RISC2
101#endif
102
103#if defined(DES_RISC1) && defined(DES_RISC2)
104YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
105#endif
106
107/* Unroll the inner loop, this sometimes helps, sometimes hinders.
108 * Very much CPU dependent */
109#ifndef DES_UNROLL
110#define DES_UNROLL
111#endif
112
113/* These default values were supplied by
114 * Peter Gutman <pgut001@cs.auckland.ac.nz>
115 * They are only used if nothing else has been defined */
116#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
117/* Special defines which change the way the code is built depending on the
118 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
119 even newer MIPS CPU's, but at the moment one size fits all for
120 optimization options. Older Sparc's work better with only UNROLL, but
121 there's no way to tell at compile time what it is you're running on */
122
123#if defined( sun ) /* Newer Sparc's */
124# define DES_PTR
125# define DES_RISC1
126# define DES_UNROLL
127#elif defined( __ultrix ) /* Older MIPS */
128# define DES_PTR
129# define DES_RISC2
130# define DES_UNROLL
131#elif defined( __osf1__ ) /* Alpha */
132# define DES_PTR
133# define DES_RISC2
134#elif defined ( _AIX ) /* RS6000 */
135 /* Unknown */
136#elif defined( __hpux ) /* HP-PA */
137 /* Unknown */
138#elif defined( __aux ) /* 68K */
139 /* Unknown */
140#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
141# define DES_UNROLL
142#elif defined( __sgi ) /* Newer MIPS */
143# define DES_PTR
144# define DES_RISC2
145# define DES_UNROLL
146#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
147# define DES_PTR
148# define DES_RISC1
149# define DES_UNROLL
150#endif /* Systems-specific speed defines */
151#endif
152
153#endif /* DES_DEFAULT_OPTIONS */
154#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/m88k/opensslconf.h b/src/lib/libcrypto/arch/m88k/opensslconf.h
index a5d26b6fdc..dcbe113864 100644
--- a/src/lib/libcrypto/arch/m88k/opensslconf.h
+++ b/src/lib/libcrypto/arch/m88k/opensslconf.h
@@ -1,9 +1,4 @@
1#include <openssl/opensslfeatures.h> 1#include <openssl/opensslfeatures.h>
2/* crypto/opensslconf.h.in */
3
4#if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR)
5#define OPENSSLDIR "/etc/ssl"
6#endif
7 2
8#undef OPENSSL_EXPORT_VAR_AS_FUNCTION 3#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
9 4
@@ -17,30 +12,7 @@
17#endif 12#endif
18#endif 13#endif
19 14
20#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
21#define IDEA_INT unsigned int
22#endif
23
24#if defined(HEADER_MD2_H) && !defined(MD2_INT)
25#define MD2_INT unsigned int
26#endif
27
28#if defined(HEADER_RC2_H) && !defined(RC2_INT)
29/* I need to put in a mod for the alpha - eay */
30#define RC2_INT unsigned int
31#endif
32
33#if defined(HEADER_RC4_H) 15#if defined(HEADER_RC4_H)
34#if !defined(RC4_INT)
35/* using int types make the structure larger but make the code faster
36 * on most boxes I have tested - up to %20 faster. */
37/*
38 * I don't know what does "most" mean, but declaring "int" is a must on:
39 * - Intel P6 because partial register stalls are very expensive;
40 * - elder Alpha because it lacks byte load/store instructions;
41 */
42#define RC4_INT unsigned int
43#endif
44#if !defined(RC4_CHUNK) 16#if !defined(RC4_CHUNK)
45/* 17/*
46 * This enables code handling data aligned at natural CPU word 18 * This enables code handling data aligned at natural CPU word
@@ -49,106 +21,3 @@
49#undef RC4_CHUNK 21#undef RC4_CHUNK
50#endif 22#endif
51#endif 23#endif
52
53#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
54/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
55 * %20 speed up (longs are 8 bytes, int's are 4). */
56#ifndef DES_LONG
57#define DES_LONG unsigned int
58#endif
59#endif
60
61#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
62#define CONFIG_HEADER_BN_H
63#define BN_LLONG
64
65/* Should we define BN_DIV2W here? */
66
67/* Only one for the following should be defined */
68/* The prime number generation stuff may not work when
69 * EIGHT_BIT but I don't care since I've only used this mode
70 * for debugging the bignum libraries */
71#undef SIXTY_FOUR_BIT_LONG
72#undef SIXTY_FOUR_BIT
73#define THIRTY_TWO_BIT
74#undef SIXTEEN_BIT
75#undef EIGHT_BIT
76#endif
77
78#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
79#define CONFIG_HEADER_BF_LOCL_H
80#undef BF_PTR
81#endif /* HEADER_BF_LOCL_H */
82
83#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
84#define CONFIG_HEADER_DES_LOCL_H
85#ifndef DES_DEFAULT_OPTIONS
86/* the following is tweaked from a config script, that is why it is a
87 * protected undef/define */
88#ifndef DES_PTR
89#undef DES_PTR
90#endif
91
92/* This helps C compiler generate the correct code for multiple functional
93 * units. It reduces register dependencies at the expense of 2 more
94 * registers */
95#ifndef DES_RISC1
96#undef DES_RISC1
97#endif
98
99#ifndef DES_RISC2
100#undef DES_RISC2
101#endif
102
103#if defined(DES_RISC1) && defined(DES_RISC2)
104YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
105#endif
106
107/* Unroll the inner loop, this sometimes helps, sometimes hinders.
108 * Very much CPU dependent */
109#ifndef DES_UNROLL
110#define DES_UNROLL
111#endif
112
113/* These default values were supplied by
114 * Peter Gutman <pgut001@cs.auckland.ac.nz>
115 * They are only used if nothing else has been defined */
116#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
117/* Special defines which change the way the code is built depending on the
118 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
119 even newer MIPS CPU's, but at the moment one size fits all for
120 optimization options. Older Sparc's work better with only UNROLL, but
121 there's no way to tell at compile time what it is you're running on */
122
123#if defined( sun ) /* Newer Sparc's */
124# define DES_PTR
125# define DES_RISC1
126# define DES_UNROLL
127#elif defined( __ultrix ) /* Older MIPS */
128# define DES_PTR
129# define DES_RISC2
130# define DES_UNROLL
131#elif defined( __osf1__ ) /* Alpha */
132# define DES_PTR
133# define DES_RISC2
134#elif defined ( _AIX ) /* RS6000 */
135 /* Unknown */
136#elif defined( __hpux ) /* HP-PA */
137 /* Unknown */
138#elif defined( __aux ) /* 68K */
139 /* Unknown */
140#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
141# define DES_UNROLL
142#elif defined( __sgi ) /* Newer MIPS */
143# define DES_PTR
144# define DES_RISC2
145# define DES_UNROLL
146#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
147# define DES_PTR
148# define DES_RISC1
149# define DES_UNROLL
150#endif /* Systems-specific speed defines */
151#endif
152
153#endif /* DES_DEFAULT_OPTIONS */
154#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/mips64/opensslconf.h b/src/lib/libcrypto/arch/mips64/opensslconf.h
index 36cdd2840b..868066c75e 100644
--- a/src/lib/libcrypto/arch/mips64/opensslconf.h
+++ b/src/lib/libcrypto/arch/mips64/opensslconf.h
@@ -1,9 +1,4 @@
1#include <openssl/opensslfeatures.h> 1#include <openssl/opensslfeatures.h>
2/* crypto/opensslconf.h.in */
3
4#if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR)
5#define OPENSSLDIR "/etc/ssl"
6#endif
7 2
8#undef OPENSSL_EXPORT_VAR_AS_FUNCTION 3#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
9 4
@@ -17,30 +12,7 @@
17#endif 12#endif
18#endif 13#endif
19 14
20#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
21#define IDEA_INT unsigned int
22#endif
23
24#if defined(HEADER_MD2_H) && !defined(MD2_INT)
25#define MD2_INT unsigned int
26#endif
27
28#if defined(HEADER_RC2_H) && !defined(RC2_INT)
29/* I need to put in a mod for the alpha - eay */
30#define RC2_INT unsigned int
31#endif
32
33#if defined(HEADER_RC4_H) 15#if defined(HEADER_RC4_H)
34#if !defined(RC4_INT)
35/* using int types make the structure larger but make the code faster
36 * on most boxes I have tested - up to %20 faster. */
37/*
38 * I don't know what does "most" mean, but declaring "int" is a must on:
39 * - Intel P6 because partial register stalls are very expensive;
40 * - elder Alpha because it lacks byte load/store instructions;
41 */
42#define RC4_INT unsigned int
43#endif
44#if !defined(RC4_CHUNK) 16#if !defined(RC4_CHUNK)
45/* 17/*
46 * This enables code handling data aligned at natural CPU word 18 * This enables code handling data aligned at natural CPU word
@@ -49,106 +21,3 @@
49#define RC4_CHUNK unsigned long 21#define RC4_CHUNK unsigned long
50#endif 22#endif
51#endif 23#endif
52
53#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
54/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
55 * %20 speed up (longs are 8 bytes, int's are 4). */
56#ifndef DES_LONG
57#define DES_LONG unsigned int
58#endif
59#endif
60
61#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
62#define CONFIG_HEADER_BN_H
63#undef BN_LLONG
64
65/* Should we define BN_DIV2W here? */
66
67/* Only one for the following should be defined */
68/* The prime number generation stuff may not work when
69 * EIGHT_BIT but I don't care since I've only used this mode
70 * for debugging the bignum libraries */
71#define SIXTY_FOUR_BIT_LONG
72#undef SIXTY_FOUR_BIT
73#undef THIRTY_TWO_BIT
74#undef SIXTEEN_BIT
75#undef EIGHT_BIT
76#endif
77
78#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
79#define CONFIG_HEADER_BF_LOCL_H
80#define BF_PTR
81#endif /* HEADER_BF_LOCL_H */
82
83#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
84#define CONFIG_HEADER_DES_LOCL_H
85#ifndef DES_DEFAULT_OPTIONS
86/* the following is tweaked from a config script, that is why it is a
87 * protected undef/define */
88#ifndef DES_PTR
89#define DES_PTR
90#endif
91
92/* This helps C compiler generate the correct code for multiple functional
93 * units. It reduces register dependencies at the expense of 2 more
94 * registers */
95#ifndef DES_RISC1
96#undef DES_RISC1
97#endif
98
99#ifndef DES_RISC2
100#define DES_RISC2
101#endif
102
103#if defined(DES_RISC1) && defined(DES_RISC2)
104YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
105#endif
106
107/* Unroll the inner loop, this sometimes helps, sometimes hinders.
108 * Very much CPU dependent */
109#ifndef DES_UNROLL
110#undef DES_UNROLL
111#endif
112
113/* These default values were supplied by
114 * Peter Gutman <pgut001@cs.auckland.ac.nz>
115 * They are only used if nothing else has been defined */
116#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
117/* Special defines which change the way the code is built depending on the
118 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
119 even newer MIPS CPU's, but at the moment one size fits all for
120 optimization options. Older Sparc's work better with only UNROLL, but
121 there's no way to tell at compile time what it is you're running on */
122
123#if defined( sun ) /* Newer Sparc's */
124# define DES_PTR
125# define DES_RISC1
126# define DES_UNROLL
127#elif defined( __ultrix ) /* Older MIPS */
128# define DES_PTR
129# define DES_RISC2
130# define DES_UNROLL
131#elif defined( __osf1__ ) /* Alpha */
132# define DES_PTR
133# define DES_RISC2
134#elif defined ( _AIX ) /* RS6000 */
135 /* Unknown */
136#elif defined( __hpux ) /* HP-PA */
137 /* Unknown */
138#elif defined( __aux ) /* 68K */
139 /* Unknown */
140#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
141# define DES_UNROLL
142#elif defined( __sgi ) /* Newer MIPS */
143# define DES_PTR
144# define DES_RISC2
145# define DES_UNROLL
146#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
147# define DES_PTR
148# define DES_RISC1
149# define DES_UNROLL
150#endif /* Systems-specific speed defines */
151#endif
152
153#endif /* DES_DEFAULT_OPTIONS */
154#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/powerpc/opensslconf.h b/src/lib/libcrypto/arch/powerpc/opensslconf.h
index a5d26b6fdc..dcbe113864 100644
--- a/src/lib/libcrypto/arch/powerpc/opensslconf.h
+++ b/src/lib/libcrypto/arch/powerpc/opensslconf.h
@@ -1,9 +1,4 @@
1#include <openssl/opensslfeatures.h> 1#include <openssl/opensslfeatures.h>
2/* crypto/opensslconf.h.in */
3
4#if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR)
5#define OPENSSLDIR "/etc/ssl"
6#endif
7 2
8#undef OPENSSL_EXPORT_VAR_AS_FUNCTION 3#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
9 4
@@ -17,30 +12,7 @@
17#endif 12#endif
18#endif 13#endif
19 14
20#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
21#define IDEA_INT unsigned int
22#endif
23
24#if defined(HEADER_MD2_H) && !defined(MD2_INT)
25#define MD2_INT unsigned int
26#endif
27
28#if defined(HEADER_RC2_H) && !defined(RC2_INT)
29/* I need to put in a mod for the alpha - eay */
30#define RC2_INT unsigned int
31#endif
32
33#if defined(HEADER_RC4_H) 15#if defined(HEADER_RC4_H)
34#if !defined(RC4_INT)
35/* using int types make the structure larger but make the code faster
36 * on most boxes I have tested - up to %20 faster. */
37/*
38 * I don't know what does "most" mean, but declaring "int" is a must on:
39 * - Intel P6 because partial register stalls are very expensive;
40 * - elder Alpha because it lacks byte load/store instructions;
41 */
42#define RC4_INT unsigned int
43#endif
44#if !defined(RC4_CHUNK) 16#if !defined(RC4_CHUNK)
45/* 17/*
46 * This enables code handling data aligned at natural CPU word 18 * This enables code handling data aligned at natural CPU word
@@ -49,106 +21,3 @@
49#undef RC4_CHUNK 21#undef RC4_CHUNK
50#endif 22#endif
51#endif 23#endif
52
53#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
54/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
55 * %20 speed up (longs are 8 bytes, int's are 4). */
56#ifndef DES_LONG
57#define DES_LONG unsigned int
58#endif
59#endif
60
61#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
62#define CONFIG_HEADER_BN_H
63#define BN_LLONG
64
65/* Should we define BN_DIV2W here? */
66
67/* Only one for the following should be defined */
68/* The prime number generation stuff may not work when
69 * EIGHT_BIT but I don't care since I've only used this mode
70 * for debugging the bignum libraries */
71#undef SIXTY_FOUR_BIT_LONG
72#undef SIXTY_FOUR_BIT
73#define THIRTY_TWO_BIT
74#undef SIXTEEN_BIT
75#undef EIGHT_BIT
76#endif
77
78#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
79#define CONFIG_HEADER_BF_LOCL_H
80#undef BF_PTR
81#endif /* HEADER_BF_LOCL_H */
82
83#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
84#define CONFIG_HEADER_DES_LOCL_H
85#ifndef DES_DEFAULT_OPTIONS
86/* the following is tweaked from a config script, that is why it is a
87 * protected undef/define */
88#ifndef DES_PTR
89#undef DES_PTR
90#endif
91
92/* This helps C compiler generate the correct code for multiple functional
93 * units. It reduces register dependencies at the expense of 2 more
94 * registers */
95#ifndef DES_RISC1
96#undef DES_RISC1
97#endif
98
99#ifndef DES_RISC2
100#undef DES_RISC2
101#endif
102
103#if defined(DES_RISC1) && defined(DES_RISC2)
104YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
105#endif
106
107/* Unroll the inner loop, this sometimes helps, sometimes hinders.
108 * Very much CPU dependent */
109#ifndef DES_UNROLL
110#define DES_UNROLL
111#endif
112
113/* These default values were supplied by
114 * Peter Gutman <pgut001@cs.auckland.ac.nz>
115 * They are only used if nothing else has been defined */
116#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
117/* Special defines which change the way the code is built depending on the
118 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
119 even newer MIPS CPU's, but at the moment one size fits all for
120 optimization options. Older Sparc's work better with only UNROLL, but
121 there's no way to tell at compile time what it is you're running on */
122
123#if defined( sun ) /* Newer Sparc's */
124# define DES_PTR
125# define DES_RISC1
126# define DES_UNROLL
127#elif defined( __ultrix ) /* Older MIPS */
128# define DES_PTR
129# define DES_RISC2
130# define DES_UNROLL
131#elif defined( __osf1__ ) /* Alpha */
132# define DES_PTR
133# define DES_RISC2
134#elif defined ( _AIX ) /* RS6000 */
135 /* Unknown */
136#elif defined( __hpux ) /* HP-PA */
137 /* Unknown */
138#elif defined( __aux ) /* 68K */
139 /* Unknown */
140#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
141# define DES_UNROLL
142#elif defined( __sgi ) /* Newer MIPS */
143# define DES_PTR
144# define DES_RISC2
145# define DES_UNROLL
146#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
147# define DES_PTR
148# define DES_RISC1
149# define DES_UNROLL
150#endif /* Systems-specific speed defines */
151#endif
152
153#endif /* DES_DEFAULT_OPTIONS */
154#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/powerpc64/opensslconf.h b/src/lib/libcrypto/arch/powerpc64/opensslconf.h
index cc193762f1..868066c75e 100644
--- a/src/lib/libcrypto/arch/powerpc64/opensslconf.h
+++ b/src/lib/libcrypto/arch/powerpc64/opensslconf.h
@@ -1,9 +1,4 @@
1#include <openssl/opensslfeatures.h> 1#include <openssl/opensslfeatures.h>
2/* crypto/opensslconf.h.in */
3
4#if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR)
5#define OPENSSLDIR "/etc/ssl"
6#endif
7 2
8#undef OPENSSL_EXPORT_VAR_AS_FUNCTION 3#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
9 4
@@ -17,30 +12,7 @@
17#endif 12#endif
18#endif 13#endif
19 14
20#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
21#define IDEA_INT unsigned int
22#endif
23
24#if defined(HEADER_MD2_H) && !defined(MD2_INT)
25#define MD2_INT unsigned int
26#endif
27
28#if defined(HEADER_RC2_H) && !defined(RC2_INT)
29/* I need to put in a mod for the alpha - eay */
30#define RC2_INT unsigned int
31#endif
32
33#if defined(HEADER_RC4_H) 15#if defined(HEADER_RC4_H)
34#if !defined(RC4_INT)
35/* using int types make the structure larger but make the code faster
36 * on most boxes I have tested - up to %20 faster. */
37/*
38 * I don't know what does "most" mean, but declaring "int" is a must on:
39 * - Intel P6 because partial register stalls are very expensive;
40 * - elder Alpha because it lacks byte load/store instructions;
41 */
42#define RC4_INT unsigned int
43#endif
44#if !defined(RC4_CHUNK) 16#if !defined(RC4_CHUNK)
45/* 17/*
46 * This enables code handling data aligned at natural CPU word 18 * This enables code handling data aligned at natural CPU word
@@ -49,101 +21,3 @@
49#define RC4_CHUNK unsigned long 21#define RC4_CHUNK unsigned long
50#endif 22#endif
51#endif 23#endif
52
53#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
54/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
55 * %20 speed up (longs are 8 bytes, int's are 4). */
56#ifndef DES_LONG
57#define DES_LONG unsigned int
58#endif
59#endif
60
61#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
62#define CONFIG_HEADER_BN_H
63#undef BN_LLONG
64
65/* Should we define BN_DIV2W here? */
66
67/* Only one for the following should be defined */
68#define SIXTY_FOUR_BIT_LONG
69#undef SIXTY_FOUR_BIT
70#undef THIRTY_TWO_BIT
71#endif
72
73#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
74#define CONFIG_HEADER_BF_LOCL_H
75#undef BF_PTR
76#endif /* HEADER_BF_LOCL_H */
77
78#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
79#define CONFIG_HEADER_DES_LOCL_H
80#ifndef DES_DEFAULT_OPTIONS
81/* the following is tweaked from a config script, that is why it is a
82 * protected undef/define */
83#ifndef DES_PTR
84#undef DES_PTR
85#endif
86
87/* This helps C compiler generate the correct code for multiple functional
88 * units. It reduces register dependencies at the expense of 2 more
89 * registers */
90#ifndef DES_RISC1
91#undef DES_RISC1
92#endif
93
94#ifndef DES_RISC2
95#undef DES_RISC2
96#endif
97
98#if defined(DES_RISC1) && defined(DES_RISC2)
99YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
100#endif
101
102/* Unroll the inner loop, this sometimes helps, sometimes hinders.
103 * Very much CPU dependent */
104#ifndef DES_UNROLL
105#define DES_UNROLL
106#endif
107
108/* These default values were supplied by
109 * Peter Gutman <pgut001@cs.auckland.ac.nz>
110 * They are only used if nothing else has been defined */
111#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
112/* Special defines which change the way the code is built depending on the
113 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
114 even newer MIPS CPU's, but at the moment one size fits all for
115 optimization options. Older Sparc's work better with only UNROLL, but
116 there's no way to tell at compile time what it is you're running on */
117
118#if defined( sun ) /* Newer Sparc's */
119# define DES_PTR
120# define DES_RISC1
121# define DES_UNROLL
122#elif defined( __ultrix ) /* Older MIPS */
123# define DES_PTR
124# define DES_RISC2
125# define DES_UNROLL
126#elif defined( __osf1__ ) /* Alpha */
127# define DES_PTR
128# define DES_RISC2
129#elif defined ( _AIX ) /* RS6000 */
130 /* Unknown */
131#elif defined( __hpux ) /* HP-PA */
132 /* Unknown */
133#elif defined( __aux ) /* 68K */
134 /* Unknown */
135#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
136# define DES_UNROLL
137#elif defined( __sgi ) /* Newer MIPS */
138# define DES_PTR
139# define DES_RISC2
140# define DES_UNROLL
141#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
142# define DES_PTR
143# define DES_RISC1
144# define DES_UNROLL
145#endif /* Systems-specific speed defines */
146#endif
147
148#endif /* DES_DEFAULT_OPTIONS */
149#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/riscv64/opensslconf.h b/src/lib/libcrypto/arch/riscv64/opensslconf.h
index 731b06aecc..868066c75e 100644
--- a/src/lib/libcrypto/arch/riscv64/opensslconf.h
+++ b/src/lib/libcrypto/arch/riscv64/opensslconf.h
@@ -1,9 +1,4 @@
1#include <openssl/opensslfeatures.h> 1#include <openssl/opensslfeatures.h>
2/* crypto/opensslconf.h.in */
3
4#if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR)
5#define OPENSSLDIR "/etc/ssl"
6#endif
7 2
8#undef OPENSSL_EXPORT_VAR_AS_FUNCTION 3#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
9 4
@@ -17,30 +12,7 @@
17#endif 12#endif
18#endif 13#endif
19 14
20#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
21#define IDEA_INT unsigned int
22#endif
23
24#if defined(HEADER_MD2_H) && !defined(MD2_INT)
25#define MD2_INT unsigned int
26#endif
27
28#if defined(HEADER_RC2_H) && !defined(RC2_INT)
29/* I need to put in a mod for the alpha - eay */
30#define RC2_INT unsigned int
31#endif
32
33#if defined(HEADER_RC4_H) 15#if defined(HEADER_RC4_H)
34#if !defined(RC4_INT)
35/* using int types make the structure larger but make the code faster
36 * on most boxes I have tested - up to %20 faster. */
37/*
38 * I don't know what does "most" mean, but declaring "int" is a must on:
39 * - Intel P6 because partial register stalls are very expensive;
40 * - elder Alpha because it lacks byte load/store instructions;
41 */
42#define RC4_INT unsigned int
43#endif
44#if !defined(RC4_CHUNK) 16#if !defined(RC4_CHUNK)
45/* 17/*
46 * This enables code handling data aligned at natural CPU word 18 * This enables code handling data aligned at natural CPU word
@@ -49,106 +21,3 @@
49#define RC4_CHUNK unsigned long 21#define RC4_CHUNK unsigned long
50#endif 22#endif
51#endif 23#endif
52
53#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
54/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
55 * %20 speed up (longs are 8 bytes, int's are 4). */
56#ifndef DES_LONG
57#define DES_LONG unsigned int
58#endif
59#endif
60
61#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
62#define CONFIG_HEADER_BN_H
63#undef BN_LLONG
64
65/* Should we define BN_DIV2W here? */
66
67/* Only one for the following should be defined */
68/* The prime number generation stuff may not work when
69 * EIGHT_BIT but I don't care since I've only used this mode
70 * for debugging the bignum libraries */
71#define SIXTY_FOUR_BIT_LONG
72#undef SIXTY_FOUR_BIT
73#undef THIRTY_TWO_BIT
74#undef SIXTEEN_BIT
75#undef EIGHT_BIT
76#endif
77
78#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
79#define CONFIG_HEADER_BF_LOCL_H
80#undef BF_PTR
81#endif /* HEADER_BF_LOCL_H */
82
83#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
84#define CONFIG_HEADER_DES_LOCL_H
85#ifndef DES_DEFAULT_OPTIONS
86/* the following is tweaked from a config script, that is why it is a
87 * protected undef/define */
88#ifndef DES_PTR
89#undef DES_PTR
90#endif
91
92/* This helps C compiler generate the correct code for multiple functional
93 * units. It reduces register dependencies at the expense of 2 more
94 * registers */
95#ifndef DES_RISC1
96#undef DES_RISC1
97#endif
98
99#ifndef DES_RISC2
100#undef DES_RISC2
101#endif
102
103#if defined(DES_RISC1) && defined(DES_RISC2)
104YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
105#endif
106
107/* Unroll the inner loop, this sometimes helps, sometimes hinders.
108 * Very much CPU dependent */
109#ifndef DES_UNROLL
110#define DES_UNROLL
111#endif
112
113/* These default values were supplied by
114 * Peter Gutman <pgut001@cs.auckland.ac.nz>
115 * They are only used if nothing else has been defined */
116#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
117/* Special defines which change the way the code is built depending on the
118 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
119 even newer MIPS CPU's, but at the moment one size fits all for
120 optimization options. Older Sparc's work better with only UNROLL, but
121 there's no way to tell at compile time what it is you're running on */
122
123#if defined( sun ) /* Newer Sparc's */
124# define DES_PTR
125# define DES_RISC1
126# define DES_UNROLL
127#elif defined( __ultrix ) /* Older MIPS */
128# define DES_PTR
129# define DES_RISC2
130# define DES_UNROLL
131#elif defined( __osf1__ ) /* Alpha */
132# define DES_PTR
133# define DES_RISC2
134#elif defined ( _AIX ) /* RS6000 */
135 /* Unknown */
136#elif defined( __hpux ) /* HP-PA */
137 /* Unknown */
138#elif defined( __aux ) /* 68K */
139 /* Unknown */
140#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
141# define DES_UNROLL
142#elif defined( __sgi ) /* Newer MIPS */
143# define DES_PTR
144# define DES_RISC2
145# define DES_UNROLL
146#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
147# define DES_PTR
148# define DES_RISC1
149# define DES_UNROLL
150#endif /* Systems-specific speed defines */
151#endif
152
153#endif /* DES_DEFAULT_OPTIONS */
154#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/sh/opensslconf.h b/src/lib/libcrypto/arch/sh/opensslconf.h
index a5d26b6fdc..dcbe113864 100644
--- a/src/lib/libcrypto/arch/sh/opensslconf.h
+++ b/src/lib/libcrypto/arch/sh/opensslconf.h
@@ -1,9 +1,4 @@
1#include <openssl/opensslfeatures.h> 1#include <openssl/opensslfeatures.h>
2/* crypto/opensslconf.h.in */
3
4#if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR)
5#define OPENSSLDIR "/etc/ssl"
6#endif
7 2
8#undef OPENSSL_EXPORT_VAR_AS_FUNCTION 3#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
9 4
@@ -17,30 +12,7 @@
17#endif 12#endif
18#endif 13#endif
19 14
20#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
21#define IDEA_INT unsigned int
22#endif
23
24#if defined(HEADER_MD2_H) && !defined(MD2_INT)
25#define MD2_INT unsigned int
26#endif
27
28#if defined(HEADER_RC2_H) && !defined(RC2_INT)
29/* I need to put in a mod for the alpha - eay */
30#define RC2_INT unsigned int
31#endif
32
33#if defined(HEADER_RC4_H) 15#if defined(HEADER_RC4_H)
34#if !defined(RC4_INT)
35/* using int types make the structure larger but make the code faster
36 * on most boxes I have tested - up to %20 faster. */
37/*
38 * I don't know what does "most" mean, but declaring "int" is a must on:
39 * - Intel P6 because partial register stalls are very expensive;
40 * - elder Alpha because it lacks byte load/store instructions;
41 */
42#define RC4_INT unsigned int
43#endif
44#if !defined(RC4_CHUNK) 16#if !defined(RC4_CHUNK)
45/* 17/*
46 * This enables code handling data aligned at natural CPU word 18 * This enables code handling data aligned at natural CPU word
@@ -49,106 +21,3 @@
49#undef RC4_CHUNK 21#undef RC4_CHUNK
50#endif 22#endif
51#endif 23#endif
52
53#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
54/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
55 * %20 speed up (longs are 8 bytes, int's are 4). */
56#ifndef DES_LONG
57#define DES_LONG unsigned int
58#endif
59#endif
60
61#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
62#define CONFIG_HEADER_BN_H
63#define BN_LLONG
64
65/* Should we define BN_DIV2W here? */
66
67/* Only one for the following should be defined */
68/* The prime number generation stuff may not work when
69 * EIGHT_BIT but I don't care since I've only used this mode
70 * for debugging the bignum libraries */
71#undef SIXTY_FOUR_BIT_LONG
72#undef SIXTY_FOUR_BIT
73#define THIRTY_TWO_BIT
74#undef SIXTEEN_BIT
75#undef EIGHT_BIT
76#endif
77
78#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
79#define CONFIG_HEADER_BF_LOCL_H
80#undef BF_PTR
81#endif /* HEADER_BF_LOCL_H */
82
83#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
84#define CONFIG_HEADER_DES_LOCL_H
85#ifndef DES_DEFAULT_OPTIONS
86/* the following is tweaked from a config script, that is why it is a
87 * protected undef/define */
88#ifndef DES_PTR
89#undef DES_PTR
90#endif
91
92/* This helps C compiler generate the correct code for multiple functional
93 * units. It reduces register dependencies at the expense of 2 more
94 * registers */
95#ifndef DES_RISC1
96#undef DES_RISC1
97#endif
98
99#ifndef DES_RISC2
100#undef DES_RISC2
101#endif
102
103#if defined(DES_RISC1) && defined(DES_RISC2)
104YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
105#endif
106
107/* Unroll the inner loop, this sometimes helps, sometimes hinders.
108 * Very much CPU dependent */
109#ifndef DES_UNROLL
110#define DES_UNROLL
111#endif
112
113/* These default values were supplied by
114 * Peter Gutman <pgut001@cs.auckland.ac.nz>
115 * They are only used if nothing else has been defined */
116#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
117/* Special defines which change the way the code is built depending on the
118 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
119 even newer MIPS CPU's, but at the moment one size fits all for
120 optimization options. Older Sparc's work better with only UNROLL, but
121 there's no way to tell at compile time what it is you're running on */
122
123#if defined( sun ) /* Newer Sparc's */
124# define DES_PTR
125# define DES_RISC1
126# define DES_UNROLL
127#elif defined( __ultrix ) /* Older MIPS */
128# define DES_PTR
129# define DES_RISC2
130# define DES_UNROLL
131#elif defined( __osf1__ ) /* Alpha */
132# define DES_PTR
133# define DES_RISC2
134#elif defined ( _AIX ) /* RS6000 */
135 /* Unknown */
136#elif defined( __hpux ) /* HP-PA */
137 /* Unknown */
138#elif defined( __aux ) /* 68K */
139 /* Unknown */
140#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
141# define DES_UNROLL
142#elif defined( __sgi ) /* Newer MIPS */
143# define DES_PTR
144# define DES_RISC2
145# define DES_UNROLL
146#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
147# define DES_PTR
148# define DES_RISC1
149# define DES_UNROLL
150#endif /* Systems-specific speed defines */
151#endif
152
153#endif /* DES_DEFAULT_OPTIONS */
154#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/sparc64/opensslconf.h b/src/lib/libcrypto/arch/sparc64/opensslconf.h
index 36cdd2840b..868066c75e 100644
--- a/src/lib/libcrypto/arch/sparc64/opensslconf.h
+++ b/src/lib/libcrypto/arch/sparc64/opensslconf.h
@@ -1,9 +1,4 @@
1#include <openssl/opensslfeatures.h> 1#include <openssl/opensslfeatures.h>
2/* crypto/opensslconf.h.in */
3
4#if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR)
5#define OPENSSLDIR "/etc/ssl"
6#endif
7 2
8#undef OPENSSL_EXPORT_VAR_AS_FUNCTION 3#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
9 4
@@ -17,30 +12,7 @@
17#endif 12#endif
18#endif 13#endif
19 14
20#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
21#define IDEA_INT unsigned int
22#endif
23
24#if defined(HEADER_MD2_H) && !defined(MD2_INT)
25#define MD2_INT unsigned int
26#endif
27
28#if defined(HEADER_RC2_H) && !defined(RC2_INT)
29/* I need to put in a mod for the alpha - eay */
30#define RC2_INT unsigned int
31#endif
32
33#if defined(HEADER_RC4_H) 15#if defined(HEADER_RC4_H)
34#if !defined(RC4_INT)
35/* using int types make the structure larger but make the code faster
36 * on most boxes I have tested - up to %20 faster. */
37/*
38 * I don't know what does "most" mean, but declaring "int" is a must on:
39 * - Intel P6 because partial register stalls are very expensive;
40 * - elder Alpha because it lacks byte load/store instructions;
41 */
42#define RC4_INT unsigned int
43#endif
44#if !defined(RC4_CHUNK) 16#if !defined(RC4_CHUNK)
45/* 17/*
46 * This enables code handling data aligned at natural CPU word 18 * This enables code handling data aligned at natural CPU word
@@ -49,106 +21,3 @@
49#define RC4_CHUNK unsigned long 21#define RC4_CHUNK unsigned long
50#endif 22#endif
51#endif 23#endif
52
53#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
54/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
55 * %20 speed up (longs are 8 bytes, int's are 4). */
56#ifndef DES_LONG
57#define DES_LONG unsigned int
58#endif
59#endif
60
61#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
62#define CONFIG_HEADER_BN_H
63#undef BN_LLONG
64
65/* Should we define BN_DIV2W here? */
66
67/* Only one for the following should be defined */
68/* The prime number generation stuff may not work when
69 * EIGHT_BIT but I don't care since I've only used this mode
70 * for debugging the bignum libraries */
71#define SIXTY_FOUR_BIT_LONG
72#undef SIXTY_FOUR_BIT
73#undef THIRTY_TWO_BIT
74#undef SIXTEEN_BIT
75#undef EIGHT_BIT
76#endif
77
78#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
79#define CONFIG_HEADER_BF_LOCL_H
80#define BF_PTR
81#endif /* HEADER_BF_LOCL_H */
82
83#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
84#define CONFIG_HEADER_DES_LOCL_H
85#ifndef DES_DEFAULT_OPTIONS
86/* the following is tweaked from a config script, that is why it is a
87 * protected undef/define */
88#ifndef DES_PTR
89#define DES_PTR
90#endif
91
92/* This helps C compiler generate the correct code for multiple functional
93 * units. It reduces register dependencies at the expense of 2 more
94 * registers */
95#ifndef DES_RISC1
96#undef DES_RISC1
97#endif
98
99#ifndef DES_RISC2
100#define DES_RISC2
101#endif
102
103#if defined(DES_RISC1) && defined(DES_RISC2)
104YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
105#endif
106
107/* Unroll the inner loop, this sometimes helps, sometimes hinders.
108 * Very much CPU dependent */
109#ifndef DES_UNROLL
110#undef DES_UNROLL
111#endif
112
113/* These default values were supplied by
114 * Peter Gutman <pgut001@cs.auckland.ac.nz>
115 * They are only used if nothing else has been defined */
116#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
117/* Special defines which change the way the code is built depending on the
118 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
119 even newer MIPS CPU's, but at the moment one size fits all for
120 optimization options. Older Sparc's work better with only UNROLL, but
121 there's no way to tell at compile time what it is you're running on */
122
123#if defined( sun ) /* Newer Sparc's */
124# define DES_PTR
125# define DES_RISC1
126# define DES_UNROLL
127#elif defined( __ultrix ) /* Older MIPS */
128# define DES_PTR
129# define DES_RISC2
130# define DES_UNROLL
131#elif defined( __osf1__ ) /* Alpha */
132# define DES_PTR
133# define DES_RISC2
134#elif defined ( _AIX ) /* RS6000 */
135 /* Unknown */
136#elif defined( __hpux ) /* HP-PA */
137 /* Unknown */
138#elif defined( __aux ) /* 68K */
139 /* Unknown */
140#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
141# define DES_UNROLL
142#elif defined( __sgi ) /* Newer MIPS */
143# define DES_PTR
144# define DES_RISC2
145# define DES_UNROLL
146#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
147# define DES_PTR
148# define DES_RISC1
149# define DES_UNROLL
150#endif /* Systems-specific speed defines */
151#endif
152
153#endif /* DES_DEFAULT_OPTIONS */
154#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/asn1/a_bitstr.c b/src/lib/libcrypto/asn1/a_bitstr.c
index d5d00c4d44..3d1e49c49a 100644
--- a/src/lib/libcrypto/asn1/a_bitstr.c
+++ b/src/lib/libcrypto/asn1/a_bitstr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_bitstr.c,v 1.43 2024/07/08 14:52:31 beck Exp $ */ 1/* $OpenBSD: a_bitstr.c,v 1.44 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -63,10 +63,10 @@
63#include <openssl/asn1.h> 63#include <openssl/asn1.h>
64#include <openssl/asn1t.h> 64#include <openssl/asn1t.h>
65#include <openssl/conf.h> 65#include <openssl/conf.h>
66#include <openssl/err.h>
67#include <openssl/x509v3.h> 66#include <openssl/x509v3.h>
68 67
69#include "bytestring.h" 68#include "bytestring.h"
69#include "err_local.h"
70 70
71const ASN1_ITEM ASN1_BIT_STRING_it = { 71const ASN1_ITEM ASN1_BIT_STRING_it = {
72 .itype = ASN1_ITYPE_PRIMITIVE, 72 .itype = ASN1_ITYPE_PRIMITIVE,
diff --git a/src/lib/libcrypto/asn1/a_enum.c b/src/lib/libcrypto/asn1/a_enum.c
index 5d3a3dd0c7..ac5033ea8a 100644
--- a/src/lib/libcrypto/asn1/a_enum.c
+++ b/src/lib/libcrypto/asn1/a_enum.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_enum.c,v 1.30 2024/07/08 14:52:31 beck Exp $ */ 1/* $OpenBSD: a_enum.c,v 1.31 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -63,10 +63,10 @@
63#include <openssl/asn1t.h> 63#include <openssl/asn1t.h>
64#include <openssl/bn.h> 64#include <openssl/bn.h>
65#include <openssl/buffer.h> 65#include <openssl/buffer.h>
66#include <openssl/err.h>
67 66
68#include "asn1_local.h" 67#include "asn1_local.h"
69#include "bytestring.h" 68#include "bytestring.h"
69#include "err_local.h"
70 70
71/* 71/*
72 * Code for ENUMERATED type: identical to INTEGER apart from a different tag. 72 * Code for ENUMERATED type: identical to INTEGER apart from a different tag.
diff --git a/src/lib/libcrypto/asn1/a_int.c b/src/lib/libcrypto/asn1/a_int.c
index 0d9b6577d7..f171e330f6 100644
--- a/src/lib/libcrypto/asn1/a_int.c
+++ b/src/lib/libcrypto/asn1/a_int.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_int.c,v 1.48 2024/07/08 14:52:31 beck Exp $ */ 1/* $OpenBSD: a_int.c,v 1.49 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -64,9 +64,9 @@
64#include <openssl/asn1t.h> 64#include <openssl/asn1t.h>
65#include <openssl/bn.h> 65#include <openssl/bn.h>
66#include <openssl/buffer.h> 66#include <openssl/buffer.h>
67#include <openssl/err.h>
68 67
69#include "bytestring.h" 68#include "bytestring.h"
69#include "err_local.h"
70 70
71const ASN1_ITEM ASN1_INTEGER_it = { 71const ASN1_ITEM ASN1_INTEGER_it = {
72 .itype = ASN1_ITYPE_PRIMITIVE, 72 .itype = ASN1_ITYPE_PRIMITIVE,
diff --git a/src/lib/libcrypto/asn1/a_mbstr.c b/src/lib/libcrypto/asn1/a_mbstr.c
index f050f97539..38398ad1d1 100644
--- a/src/lib/libcrypto/asn1/a_mbstr.c
+++ b/src/lib/libcrypto/asn1/a_mbstr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_mbstr.c,v 1.27 2023/07/05 21:23:36 beck Exp $ */ 1/* $OpenBSD: a_mbstr.c,v 1.28 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -61,9 +61,9 @@
61#include <string.h> 61#include <string.h>
62 62
63#include <openssl/asn1.h> 63#include <openssl/asn1.h>
64#include <openssl/err.h>
65 64
66#include "asn1_local.h" 65#include "asn1_local.h"
66#include "err_local.h"
67 67
68static int traverse_string(const unsigned char *p, int len, int inform, 68static int traverse_string(const unsigned char *p, int len, int inform,
69 int (*rfunc)(unsigned long value, void *in), void *arg); 69 int (*rfunc)(unsigned long value, void *in), void *arg);
diff --git a/src/lib/libcrypto/asn1/a_object.c b/src/lib/libcrypto/asn1/a_object.c
index 2f3ca1398f..333ac60348 100644
--- a/src/lib/libcrypto/asn1/a_object.c
+++ b/src/lib/libcrypto/asn1/a_object.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_object.c,v 1.55 2024/07/08 14:52:31 beck Exp $ */ 1/* $OpenBSD: a_object.c,v 1.56 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -62,11 +62,11 @@
62 62
63#include <openssl/asn1.h> 63#include <openssl/asn1.h>
64#include <openssl/asn1t.h> 64#include <openssl/asn1t.h>
65#include <openssl/err.h>
66#include <openssl/buffer.h> 65#include <openssl/buffer.h>
67#include <openssl/objects.h> 66#include <openssl/objects.h>
68 67
69#include "asn1_local.h" 68#include "asn1_local.h"
69#include "err_local.h"
70 70
71const ASN1_ITEM ASN1_OBJECT_it = { 71const ASN1_ITEM ASN1_OBJECT_it = {
72 .itype = ASN1_ITYPE_PRIMITIVE, 72 .itype = ASN1_ITYPE_PRIMITIVE,
diff --git a/src/lib/libcrypto/asn1/a_pkey.c b/src/lib/libcrypto/asn1/a_pkey.c
index a730728076..636b602377 100644
--- a/src/lib/libcrypto/asn1/a_pkey.c
+++ b/src/lib/libcrypto/asn1/a_pkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_pkey.c,v 1.8 2024/04/09 13:52:41 beck Exp $ */ 1/* $OpenBSD: a_pkey.c,v 1.9 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -62,12 +62,12 @@
62 62
63#include <openssl/asn1.h> 63#include <openssl/asn1.h>
64#include <openssl/bn.h> 64#include <openssl/bn.h>
65#include <openssl/err.h>
66#include <openssl/evp.h> 65#include <openssl/evp.h>
67#include <openssl/objects.h> 66#include <openssl/objects.h>
68#include <openssl/x509.h> 67#include <openssl/x509.h>
69 68
70#include "asn1_local.h" 69#include "asn1_local.h"
70#include "err_local.h"
71#include "evp_local.h" 71#include "evp_local.h"
72 72
73EVP_PKEY * 73EVP_PKEY *
diff --git a/src/lib/libcrypto/asn1/a_pubkey.c b/src/lib/libcrypto/asn1/a_pubkey.c
index 544f3d2cf0..f846b6cda5 100644
--- a/src/lib/libcrypto/asn1/a_pubkey.c
+++ b/src/lib/libcrypto/asn1/a_pubkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_pubkey.c,v 1.7 2024/04/09 13:52:41 beck Exp $ */ 1/* $OpenBSD: a_pubkey.c,v 1.8 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -62,7 +62,6 @@
62 62
63#include <openssl/asn1.h> 63#include <openssl/asn1.h>
64#include <openssl/bn.h> 64#include <openssl/bn.h>
65#include <openssl/err.h>
66#include <openssl/evp.h> 65#include <openssl/evp.h>
67#include <openssl/objects.h> 66#include <openssl/objects.h>
68 67
@@ -76,6 +75,7 @@
76#include <openssl/rsa.h> 75#include <openssl/rsa.h>
77#endif 76#endif
78 77
78#include "err_local.h"
79#include "evp_local.h" 79#include "evp_local.h"
80 80
81EVP_PKEY * 81EVP_PKEY *
diff --git a/src/lib/libcrypto/asn1/a_strex.c b/src/lib/libcrypto/asn1/a_strex.c
index 5523c22cc4..52e1b7db5d 100644
--- a/src/lib/libcrypto/asn1/a_strex.c
+++ b/src/lib/libcrypto/asn1/a_strex.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_strex.c,v 1.37 2025/03/09 15:17:22 tb Exp $ */ 1/* $OpenBSD: a_strex.c,v 1.38 2025/03/19 11:18:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -565,31 +565,6 @@ do_name_ex(char_io *io_ch, void *arg, const X509_NAME *n, int indent,
565 return outlen; 565 return outlen;
566} 566}
567 567
568/* NID with SN of 1-2 letters, which X509_NAME_print() historically included. */
569static int
570x509_name_entry_include(const X509_NAME_ENTRY *ne)
571{
572 int nid;
573
574 if ((nid = OBJ_obj2nid(ne->object)) == NID_undef)
575 return 0;
576
577 switch (nid) {
578 case NID_commonName:
579 case NID_surname:
580 case NID_countryName:
581 case NID_localityName:
582 case NID_stateOrProvinceName:
583 case NID_organizationName:
584 case NID_organizationalUnitName:
585 case NID_givenName:
586 case NID_domainComponent: /* XXX - doesn't really belong here */
587 return 1;
588 }
589
590 return 0;
591}
592
593static int 568static int
594X509_NAME_print(BIO *bio, const X509_NAME *name, int obase) 569X509_NAME_print(BIO *bio, const X509_NAME *name, int obase)
595{ 570{
@@ -607,9 +582,6 @@ X509_NAME_print(BIO *bio, const X509_NAME *name, int obase)
607 for (i = 0; i < sk_X509_NAME_ENTRY_num(name->entries); i++) { 582 for (i = 0; i < sk_X509_NAME_ENTRY_num(name->entries); i++) {
608 ne = sk_X509_NAME_ENTRY_value(name->entries, i); 583 ne = sk_X509_NAME_ENTRY_value(name->entries, i);
609 584
610 if (!x509_name_entry_include(ne))
611 continue;
612
613 if (started) { 585 if (started) {
614 if (!CBB_add_u8(&cbb, ',')) 586 if (!CBB_add_u8(&cbb, ','))
615 goto err; 587 goto err;
diff --git a/src/lib/libcrypto/asn1/a_string.c b/src/lib/libcrypto/asn1/a_string.c
index ec492e71f0..70e9c95f22 100644
--- a/src/lib/libcrypto/asn1/a_string.c
+++ b/src/lib/libcrypto/asn1/a_string.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_string.c,v 1.17 2023/08/15 18:05:15 tb Exp $ */ 1/* $OpenBSD: a_string.c,v 1.18 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -61,9 +61,9 @@
61#include <string.h> 61#include <string.h>
62 62
63#include <openssl/asn1.h> 63#include <openssl/asn1.h>
64#include <openssl/err.h>
65 64
66#include "asn1_local.h" 65#include "asn1_local.h"
66#include "err_local.h"
67 67
68ASN1_STRING * 68ASN1_STRING *
69ASN1_STRING_new(void) 69ASN1_STRING_new(void)
diff --git a/src/lib/libcrypto/asn1/a_strnid.c b/src/lib/libcrypto/asn1/a_strnid.c
index 5fa60b9ce7..3519d6725d 100644
--- a/src/lib/libcrypto/asn1/a_strnid.c
+++ b/src/lib/libcrypto/asn1/a_strnid.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_strnid.c,v 1.31 2024/03/02 08:54:02 tb Exp $ */ 1/* $OpenBSD: a_strnid.c,v 1.32 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -62,7 +62,6 @@
62#include <string.h> 62#include <string.h>
63 63
64#include <openssl/asn1.h> 64#include <openssl/asn1.h>
65#include <openssl/err.h>
66#include <openssl/objects.h> 65#include <openssl/objects.h>
67 66
68/* 67/*
diff --git a/src/lib/libcrypto/asn1/a_time.c b/src/lib/libcrypto/asn1/a_time.c
index 15ac1af5c4..3deff56eda 100644
--- a/src/lib/libcrypto/asn1/a_time.c
+++ b/src/lib/libcrypto/asn1/a_time.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_time.c,v 1.38 2024/07/08 14:52:31 beck Exp $ */ 1/* $OpenBSD: a_time.c,v 1.39 2025/05/10 05:54:38 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -65,7 +65,6 @@
65#include <time.h> 65#include <time.h>
66 66
67#include <openssl/asn1t.h> 67#include <openssl/asn1t.h>
68#include <openssl/err.h>
69 68
70#include "asn1_local.h" 69#include "asn1_local.h"
71 70
diff --git a/src/lib/libcrypto/asn1/a_time_tm.c b/src/lib/libcrypto/asn1/a_time_tm.c
index a1f329be96..dd2893167f 100644
--- a/src/lib/libcrypto/asn1/a_time_tm.c
+++ b/src/lib/libcrypto/asn1/a_time_tm.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_time_tm.c,v 1.42 2024/05/03 18:33:27 tb Exp $ */ 1/* $OpenBSD: a_time_tm.c,v 1.43 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2015 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2015 Bob Beck <beck@openbsd.org>
4 * 4 *
@@ -22,10 +22,10 @@
22#include <time.h> 22#include <time.h>
23 23
24#include <openssl/asn1t.h> 24#include <openssl/asn1t.h>
25#include <openssl/err.h>
26 25
27#include "bytestring.h"
28#include "asn1_local.h" 26#include "asn1_local.h"
27#include "bytestring.h"
28#include "err_local.h"
29 29
30#define RFC5280 0 30#define RFC5280 0
31#define GENTIME_LENGTH 15 31#define GENTIME_LENGTH 15
diff --git a/src/lib/libcrypto/asn1/a_type.c b/src/lib/libcrypto/asn1/a_type.c
index ef0a76e810..502db42a73 100644
--- a/src/lib/libcrypto/asn1/a_type.c
+++ b/src/lib/libcrypto/asn1/a_type.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_type.c,v 1.27 2023/07/28 10:00:10 tb Exp $ */ 1/* $OpenBSD: a_type.c,v 1.28 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -59,10 +59,10 @@
59#include <string.h> 59#include <string.h>
60 60
61#include <openssl/asn1t.h> 61#include <openssl/asn1t.h>
62#include <openssl/err.h>
63#include <openssl/objects.h> 62#include <openssl/objects.h>
64 63
65#include "asn1_local.h" 64#include "asn1_local.h"
65#include "err_local.h"
66 66
67typedef struct { 67typedef struct {
68 ASN1_INTEGER *num; 68 ASN1_INTEGER *num;
diff --git a/src/lib/libcrypto/asn1/asn1_gen.c b/src/lib/libcrypto/asn1/asn1_gen.c
index edd6743993..b409e83c7d 100644
--- a/src/lib/libcrypto/asn1/asn1_gen.c
+++ b/src/lib/libcrypto/asn1/asn1_gen.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1_gen.c,v 1.27 2025/03/06 07:25:01 tb Exp $ */ 1/* $OpenBSD: asn1_gen.c,v 1.28 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2002. 3 * project 2002.
4 */ 4 */
@@ -59,11 +59,11 @@
59#include <string.h> 59#include <string.h>
60 60
61#include <openssl/asn1.h> 61#include <openssl/asn1.h>
62#include <openssl/err.h>
63#include <openssl/x509v3.h> 62#include <openssl/x509v3.h>
64 63
65#include "asn1_local.h" 64#include "asn1_local.h"
66#include "conf_local.h" 65#include "conf_local.h"
66#include "err_local.h"
67#include "x509_local.h" 67#include "x509_local.h"
68 68
69#define ASN1_GEN_FLAG 0x10000 69#define ASN1_GEN_FLAG 0x10000
diff --git a/src/lib/libcrypto/asn1/asn1_item.c b/src/lib/libcrypto/asn1/asn1_item.c
index 86c800e3ad..621d65711b 100644
--- a/src/lib/libcrypto/asn1/asn1_item.c
+++ b/src/lib/libcrypto/asn1/asn1_item.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1_item.c,v 1.21 2024/04/09 13:55:02 beck Exp $ */ 1/* $OpenBSD: asn1_item.c,v 1.22 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -112,11 +112,11 @@
112#include <limits.h> 112#include <limits.h>
113 113
114#include <openssl/buffer.h> 114#include <openssl/buffer.h>
115#include <openssl/err.h>
116#include <openssl/evp.h> 115#include <openssl/evp.h>
117#include <openssl/x509.h> 116#include <openssl/x509.h>
118 117
119#include "asn1_local.h" 118#include "asn1_local.h"
119#include "err_local.h"
120#include "evp_local.h" 120#include "evp_local.h"
121#include "x509_local.h" 121#include "x509_local.h"
122 122
diff --git a/src/lib/libcrypto/asn1/asn1_old.c b/src/lib/libcrypto/asn1/asn1_old.c
index 7992fccdef..c47ea8e74a 100644
--- a/src/lib/libcrypto/asn1/asn1_old.c
+++ b/src/lib/libcrypto/asn1/asn1_old.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1_old.c,v 1.6 2024/04/10 14:55:12 beck Exp $ */ 1/* $OpenBSD: asn1_old.c,v 1.7 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -61,9 +61,9 @@
61 61
62#include <openssl/asn1.h> 62#include <openssl/asn1.h>
63#include <openssl/buffer.h> 63#include <openssl/buffer.h>
64#include <openssl/err.h>
65 64
66#include "asn1_local.h" 65#include "asn1_local.h"
66#include "err_local.h"
67 67
68#ifndef NO_OLD_ASN1 68#ifndef NO_OLD_ASN1
69 69
diff --git a/src/lib/libcrypto/asn1/asn1_old_lib.c b/src/lib/libcrypto/asn1/asn1_old_lib.c
index 80362ae689..541ac7b615 100644
--- a/src/lib/libcrypto/asn1/asn1_old_lib.c
+++ b/src/lib/libcrypto/asn1/asn1_old_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1_old_lib.c,v 1.6 2023/07/05 21:23:36 beck Exp $ */ 1/* $OpenBSD: asn1_old_lib.c,v 1.7 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -61,9 +61,9 @@
61#include <string.h> 61#include <string.h>
62 62
63#include <openssl/asn1.h> 63#include <openssl/asn1.h>
64#include <openssl/err.h>
65 64
66#include "asn1_local.h" 65#include "asn1_local.h"
66#include "err_local.h"
67 67
68static void asn1_put_length(unsigned char **pp, int length); 68static void asn1_put_length(unsigned char **pp, int length);
69 69
diff --git a/src/lib/libcrypto/asn1/asn_mime.c b/src/lib/libcrypto/asn1/asn_mime.c
index 3995fc547c..d42dd8663e 100644
--- a/src/lib/libcrypto/asn1/asn_mime.c
+++ b/src/lib/libcrypto/asn1/asn_mime.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn_mime.c,v 1.35 2025/01/17 05:02:18 tb Exp $ */ 1/* $OpenBSD: asn_mime.c,v 1.37 2025/06/02 12:18:21 jsg Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -59,10 +59,10 @@
59 59
60#include <openssl/asn1.h> 60#include <openssl/asn1.h>
61#include <openssl/asn1t.h> 61#include <openssl/asn1t.h>
62#include <openssl/err.h>
63#include <openssl/x509.h> 62#include <openssl/x509.h>
64 63
65#include "asn1_local.h" 64#include "asn1_local.h"
65#include "err_local.h"
66#include "evp_local.h" 66#include "evp_local.h"
67 67
68/* Generalised MIME like utilities for streaming ASN1. Although many 68/* Generalised MIME like utilities for streaming ASN1. Although many
@@ -507,8 +507,9 @@ SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it)
507 *bcont = sk_BIO_value(parts, 0); 507 *bcont = sk_BIO_value(parts, 0);
508 BIO_free(asnin); 508 BIO_free(asnin);
509 sk_BIO_free(parts); 509 sk_BIO_free(parts);
510 } else sk_BIO_pop_free(parts, BIO_vfree); 510 } else
511 return val; 511 sk_BIO_pop_free(parts, BIO_vfree);
512 return val;
512 } 513 }
513 514
514 /* OK, if not multipart/signed try opaque signature */ 515 /* OK, if not multipart/signed try opaque signature */
diff --git a/src/lib/libcrypto/asn1/asn_moid.c b/src/lib/libcrypto/asn1/asn_moid.c
index e3c7d09446..a9a752cc38 100644
--- a/src/lib/libcrypto/asn1/asn_moid.c
+++ b/src/lib/libcrypto/asn1/asn_moid.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn_moid.c,v 1.18 2024/08/31 09:26:18 tb Exp $ */ 1/* $OpenBSD: asn_moid.c,v 1.20 2025/05/10 11:51:01 tb Exp $ */
2/* Written by Stephen Henson (steve@openssl.org) for the OpenSSL 2/* Written by Stephen Henson (steve@openssl.org) for the OpenSSL
3 * project 2001. 3 * project 2001.
4 */ 4 */
@@ -60,13 +60,13 @@
60#include <stdio.h> 60#include <stdio.h>
61#include <string.h> 61#include <string.h>
62 62
63#include <openssl/err.h>
64#include <openssl/conf.h> 63#include <openssl/conf.h>
65#include <openssl/crypto.h> 64#include <openssl/crypto.h>
66#include <openssl/x509.h> 65#include <openssl/x509.h>
67 66
68#include "asn1_local.h" 67#include "asn1_local.h"
69#include "conf_local.h" 68#include "conf_local.h"
69#include "err_local.h"
70 70
71/* Simple ASN1 OID module: add all objects in a given section */ 71/* Simple ASN1 OID module: add all objects in a given section */
72 72
diff --git a/src/lib/libcrypto/asn1/bio_ndef.c b/src/lib/libcrypto/asn1/bio_ndef.c
index 98bb1cd197..d001ffb0ae 100644
--- a/src/lib/libcrypto/asn1/bio_ndef.c
+++ b/src/lib/libcrypto/asn1/bio_ndef.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_ndef.c,v 1.24 2023/07/28 09:58:30 tb Exp $ */ 1/* $OpenBSD: bio_ndef.c,v 1.25 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -57,9 +57,9 @@
57#include <openssl/asn1.h> 57#include <openssl/asn1.h>
58#include <openssl/asn1t.h> 58#include <openssl/asn1t.h>
59#include <openssl/bio.h> 59#include <openssl/bio.h>
60#include <openssl/err.h>
61 60
62#include "asn1_local.h" 61#include "asn1_local.h"
62#include "err_local.h"
63 63
64int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix, asn1_ps_func *prefix_free); 64int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix, asn1_ps_func *prefix_free);
65int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, asn1_ps_func *suffix_free); 65int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, asn1_ps_func *suffix_free);
diff --git a/src/lib/libcrypto/asn1/p5_pbe.c b/src/lib/libcrypto/asn1/p5_pbe.c
index 582d2d9a9b..668bf5d7c1 100644
--- a/src/lib/libcrypto/asn1/p5_pbe.c
+++ b/src/lib/libcrypto/asn1/p5_pbe.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p5_pbe.c,v 1.28 2024/07/08 14:48:49 beck Exp $ */ 1/* $OpenBSD: p5_pbe.c,v 1.30 2025/05/24 02:57:14 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -61,11 +61,14 @@
61#include <string.h> 61#include <string.h>
62 62
63#include <openssl/asn1t.h> 63#include <openssl/asn1t.h>
64#include <openssl/err.h>
65#include <openssl/x509.h> 64#include <openssl/x509.h>
66 65
66#include "err_local.h"
67#include "x509_local.h" 67#include "x509_local.h"
68 68
69/* RFC 8018, section 6.1 specifies an eight-octet salt for PBES1. */
70#define PKCS5_PBE1_SALT_LEN 8
71
69/* PKCS#5 password based encryption structure */ 72/* PKCS#5 password based encryption structure */
70 73
71static const ASN1_TEMPLATE PBEPARAM_seq_tt[] = { 74static const ASN1_TEMPLATE PBEPARAM_seq_tt[] = {
@@ -139,7 +142,7 @@ PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter,
139 goto err; 142 goto err;
140 } 143 }
141 if (!saltlen) 144 if (!saltlen)
142 saltlen = PKCS5_SALT_LEN; 145 saltlen = PKCS5_PBE1_SALT_LEN;
143 if (!ASN1_STRING_set(pbe->salt, NULL, saltlen)) { 146 if (!ASN1_STRING_set(pbe->salt, NULL, saltlen)) {
144 ASN1error(ERR_R_MALLOC_FAILURE); 147 ASN1error(ERR_R_MALLOC_FAILURE);
145 goto err; 148 goto err;
diff --git a/src/lib/libcrypto/asn1/p5_pbev2.c b/src/lib/libcrypto/asn1/p5_pbev2.c
index 76872a8dec..64924d9b38 100644
--- a/src/lib/libcrypto/asn1/p5_pbev2.c
+++ b/src/lib/libcrypto/asn1/p5_pbev2.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p5_pbev2.c,v 1.35 2024/03/26 07:03:10 tb Exp $ */ 1/* $OpenBSD: p5_pbev2.c,v 1.38 2025/05/24 02:57:14 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999-2004. 3 * project 1999-2004.
4 */ 4 */
@@ -61,12 +61,18 @@
61#include <string.h> 61#include <string.h>
62 62
63#include <openssl/asn1t.h> 63#include <openssl/asn1t.h>
64#include <openssl/err.h>
65#include <openssl/x509.h> 64#include <openssl/x509.h>
66 65
66#include "err_local.h"
67#include "evp_local.h" 67#include "evp_local.h"
68#include "x509_local.h" 68#include "x509_local.h"
69 69
70/*
71 * RFC 8018, sections 6.2 and 4 specify at least 64 bits for PBES2, apparently
72 * FIPS will require at least 128 bits in the future, OpenSSL does that.
73 */
74#define PKCS5_PBE2_SALT_LEN 16
75
70/* PKCS#5 v2.0 password based encryption structures */ 76/* PKCS#5 v2.0 password based encryption structures */
71 77
72static const ASN1_TEMPLATE PBE2PARAM_seq_tt[] = { 78static const ASN1_TEMPLATE PBE2PARAM_seq_tt[] = {
@@ -187,7 +193,7 @@ PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, unsigned char *salt,
187 int saltlen) 193 int saltlen)
188{ 194{
189 X509_ALGOR *scheme = NULL, *kalg = NULL, *ret = NULL; 195 X509_ALGOR *scheme = NULL, *kalg = NULL, *ret = NULL;
190 int prf_nid = NID_hmacWithSHA1; 196 int prf_nid = NID_hmacWithSHA256;
191 int alg_nid, keylen; 197 int alg_nid, keylen;
192 EVP_CIPHER_CTX ctx; 198 EVP_CIPHER_CTX ctx;
193 unsigned char iv[EVP_MAX_IV_LENGTH]; 199 unsigned char iv[EVP_MAX_IV_LENGTH];
@@ -292,7 +298,7 @@ PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen, int prf_nid,
292 kdf->salt->type = V_ASN1_OCTET_STRING; 298 kdf->salt->type = V_ASN1_OCTET_STRING;
293 299
294 if (!saltlen) 300 if (!saltlen)
295 saltlen = PKCS5_SALT_LEN; 301 saltlen = PKCS5_PBE2_SALT_LEN;
296 if (!(osalt->data = malloc (saltlen))) 302 if (!(osalt->data = malloc (saltlen)))
297 goto merr; 303 goto merr;
298 304
diff --git a/src/lib/libcrypto/asn1/t_crl.c b/src/lib/libcrypto/asn1/t_crl.c
index 6449e7f199..295ab6c050 100644
--- a/src/lib/libcrypto/asn1/t_crl.c
+++ b/src/lib/libcrypto/asn1/t_crl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t_crl.c,v 1.26 2024/05/03 02:52:00 tb Exp $ */ 1/* $OpenBSD: t_crl.c,v 1.27 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -61,11 +61,11 @@
61 61
62#include <openssl/bn.h> 62#include <openssl/bn.h>
63#include <openssl/buffer.h> 63#include <openssl/buffer.h>
64#include <openssl/err.h>
65#include <openssl/objects.h> 64#include <openssl/objects.h>
66#include <openssl/x509.h> 65#include <openssl/x509.h>
67#include <openssl/x509v3.h> 66#include <openssl/x509v3.h>
68 67
68#include "err_local.h"
69#include "x509_local.h" 69#include "x509_local.h"
70 70
71int 71int
diff --git a/src/lib/libcrypto/asn1/t_req.c b/src/lib/libcrypto/asn1/t_req.c
index 1d4be9865d..51e4b4f651 100644
--- a/src/lib/libcrypto/asn1/t_req.c
+++ b/src/lib/libcrypto/asn1/t_req.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t_req.c,v 1.28 2024/05/03 02:52:00 tb Exp $ */ 1/* $OpenBSD: t_req.c,v 1.29 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -62,7 +62,6 @@
62 62
63#include <openssl/bn.h> 63#include <openssl/bn.h>
64#include <openssl/buffer.h> 64#include <openssl/buffer.h>
65#include <openssl/err.h>
66#include <openssl/objects.h> 65#include <openssl/objects.h>
67#include <openssl/x509.h> 66#include <openssl/x509.h>
68#include <openssl/x509v3.h> 67#include <openssl/x509v3.h>
@@ -74,6 +73,7 @@
74#include <openssl/rsa.h> 73#include <openssl/rsa.h>
75#endif 74#endif
76 75
76#include "err_local.h"
77#include "x509_local.h" 77#include "x509_local.h"
78 78
79int 79int
diff --git a/src/lib/libcrypto/asn1/t_x509.c b/src/lib/libcrypto/asn1/t_x509.c
index 7cf4557314..71f97a8214 100644
--- a/src/lib/libcrypto/asn1/t_x509.c
+++ b/src/lib/libcrypto/asn1/t_x509.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t_x509.c,v 1.51 2025/02/08 03:41:36 tb Exp $ */ 1/* $OpenBSD: t_x509.c,v 1.54 2025/07/01 06:46:39 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -65,13 +65,13 @@
65 65
66#include <openssl/asn1.h> 66#include <openssl/asn1.h>
67#include <openssl/bio.h> 67#include <openssl/bio.h>
68#include <openssl/err.h>
69#include <openssl/evp.h> 68#include <openssl/evp.h>
70#include <openssl/objects.h> 69#include <openssl/objects.h>
71#include <openssl/sha.h> 70#include <openssl/sha.h>
72#include <openssl/x509.h> 71#include <openssl/x509.h>
73#include <openssl/x509v3.h> 72#include <openssl/x509v3.h>
74 73
74#include "err_local.h"
75#include "evp_local.h" 75#include "evp_local.h"
76#include "x509_local.h" 76#include "x509_local.h"
77 77
@@ -106,6 +106,28 @@ X509_print(BIO *bp, X509 *x)
106} 106}
107LCRYPTO_ALIAS(X509_print); 107LCRYPTO_ALIAS(X509_print);
108 108
109static int
110x509_print_uids(BIO *bp, const X509 *x, int indent)
111{
112 const ASN1_BIT_STRING *issuerUID = NULL, *subjectUID = NULL;
113
114 X509_get0_uids(x, &issuerUID, &subjectUID);
115 if (issuerUID != NULL) {
116 if (BIO_printf(bp, "%*sIssuer Unique ID: ", indent, "") <= 0)
117 return 0;
118 if (!X509_signature_dump(bp, issuerUID, indent + 4))
119 return 0;
120 }
121 if (subjectUID != NULL) {
122 if (BIO_printf(bp, "%*sSubject Unique ID: ", indent, "") <= 0)
123 return 0;
124 if (!X509_signature_dump(bp, subjectUID, indent + 4))
125 return 0;
126 }
127
128 return 1;
129}
130
109int 131int
110X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) 132X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
111{ 133{
@@ -127,9 +149,9 @@ X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
127 149
128 ci = x->cert_info; 150 ci = x->cert_info;
129 if (!(cflag & X509_FLAG_NO_HEADER)) { 151 if (!(cflag & X509_FLAG_NO_HEADER)) {
130 if (BIO_write(bp, "Certificate:\n", 13) <= 0) 152 if (BIO_printf(bp, "Certificate:\n") <= 0)
131 goto err; 153 goto err;
132 if (BIO_write(bp, " Data:\n", 10) <= 0) 154 if (BIO_printf(bp, " Data:\n") <= 0)
133 goto err; 155 goto err;
134 } 156 }
135 if (!(cflag & X509_FLAG_NO_VERSION)) { 157 if (!(cflag & X509_FLAG_NO_VERSION)) {
@@ -145,7 +167,7 @@ X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
145 } 167 }
146 } 168 }
147 if (!(cflag & X509_FLAG_NO_SERIAL)) { 169 if (!(cflag & X509_FLAG_NO_SERIAL)) {
148 if (BIO_write(bp, " Serial Number:", 22) <= 0) 170 if (BIO_printf(bp, " Serial Number:") <= 0)
149 goto err; 171 goto err;
150 172
151 bs = X509_get_serialNumber(x); 173 bs = X509_get_serialNumber(x);
@@ -196,21 +218,21 @@ X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
196 if (X509_NAME_print_ex(bp, X509_get_issuer_name(x), 218 if (X509_NAME_print_ex(bp, X509_get_issuer_name(x),
197 nmindent, nmflags) < (nmflags == X509_FLAG_COMPAT ? 1 : 0)) 219 nmindent, nmflags) < (nmflags == X509_FLAG_COMPAT ? 1 : 0))
198 goto err; 220 goto err;
199 if (BIO_write(bp, "\n", 1) <= 0) 221 if (BIO_printf(bp, "\n") <= 0)
200 goto err; 222 goto err;
201 } 223 }
202 if (!(cflag & X509_FLAG_NO_VALIDITY)) { 224 if (!(cflag & X509_FLAG_NO_VALIDITY)) {
203 if (BIO_write(bp, " Validity\n", 17) <= 0) 225 if (BIO_printf(bp, " Validity\n") <= 0)
204 goto err; 226 goto err;
205 if (BIO_write(bp, " Not Before: ", 24) <= 0) 227 if (BIO_printf(bp, " Not Before: ") <= 0)
206 goto err; 228 goto err;
207 if (!ASN1_TIME_print(bp, X509_get_notBefore(x))) 229 if (!ASN1_TIME_print(bp, X509_get_notBefore(x)))
208 goto err; 230 goto err;
209 if (BIO_write(bp, "\n Not After : ", 25) <= 0) 231 if (BIO_printf(bp, "\n Not After : ") <= 0)
210 goto err; 232 goto err;
211 if (!ASN1_TIME_print(bp, X509_get_notAfter(x))) 233 if (!ASN1_TIME_print(bp, X509_get_notAfter(x)))
212 goto err; 234 goto err;
213 if (BIO_write(bp, "\n", 1) <= 0) 235 if (BIO_printf(bp, "\n") <= 0)
214 goto err; 236 goto err;
215 } 237 }
216 if (!(cflag & X509_FLAG_NO_SUBJECT)) { 238 if (!(cflag & X509_FLAG_NO_SUBJECT)) {
@@ -219,12 +241,11 @@ X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
219 if (X509_NAME_print_ex(bp, X509_get_subject_name(x), 241 if (X509_NAME_print_ex(bp, X509_get_subject_name(x),
220 nmindent, nmflags) < (nmflags == X509_FLAG_COMPAT ? 1 : 0)) 242 nmindent, nmflags) < (nmflags == X509_FLAG_COMPAT ? 1 : 0))
221 goto err; 243 goto err;
222 if (BIO_write(bp, "\n", 1) <= 0) 244 if (BIO_printf(bp, "\n") <= 0)
223 goto err; 245 goto err;
224 } 246 }
225 if (!(cflag & X509_FLAG_NO_PUBKEY)) { 247 if (!(cflag & X509_FLAG_NO_PUBKEY)) {
226 if (BIO_write(bp, " Subject Public Key Info:\n", 248 if (BIO_printf(bp, " Subject Public Key Info:\n") <= 0)
227 33) <= 0)
228 goto err; 249 goto err;
229 if (BIO_printf(bp, "%12sPublic Key Algorithm: ", "") <= 0) 250 if (BIO_printf(bp, "%12sPublic Key Algorithm: ", "") <= 0)
230 goto err; 251 goto err;
@@ -243,6 +264,11 @@ X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
243 } 264 }
244 } 265 }
245 266
267 if (!(cflag & X509_FLAG_NO_IDS)) {
268 if (!x509_print_uids(bp, x, 8))
269 goto err;
270 }
271
246 if (!(cflag & X509_FLAG_NO_EXTENSIONS)) 272 if (!(cflag & X509_FLAG_NO_EXTENSIONS))
247 X509V3_extensions_print(bp, "X509v3 extensions", 273 X509V3_extensions_print(bp, "X509v3 extensions",
248 ci->extensions, cflag, 8); 274 ci->extensions, cflag, 8);
@@ -325,7 +351,7 @@ X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent)
325 s = sig->data; 351 s = sig->data;
326 for (i = 0; i < n; i++) { 352 for (i = 0; i < n; i++) {
327 if ((i % 18) == 0) { 353 if ((i % 18) == 0) {
328 if (BIO_write(bp, "\n", 1) <= 0) 354 if (BIO_printf(bp, "\n") <= 0)
329 return 0; 355 return 0;
330 if (BIO_indent(bp, indent, indent) <= 0) 356 if (BIO_indent(bp, indent, indent) <= 0)
331 return 0; 357 return 0;
@@ -334,7 +360,7 @@ X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent)
334 ((i + 1) == n) ? "" : ":") <= 0) 360 ((i + 1) == n) ? "" : ":") <= 0)
335 return 0; 361 return 0;
336 } 362 }
337 if (BIO_write(bp, "\n", 1) != 1) 363 if (BIO_printf(bp, "\n") != 1)
338 return 0; 364 return 0;
339 365
340 return 1; 366 return 1;
@@ -375,7 +401,7 @@ ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm)
375 return ASN1_UTCTIME_print(bp, tm); 401 return ASN1_UTCTIME_print(bp, tm);
376 if (tm->type == V_ASN1_GENERALIZEDTIME) 402 if (tm->type == V_ASN1_GENERALIZEDTIME)
377 return ASN1_GENERALIZEDTIME_print(bp, tm); 403 return ASN1_GENERALIZEDTIME_print(bp, tm);
378 BIO_write(bp, "Bad time value", 14); 404 BIO_printf(bp, "Bad time value");
379 return (0); 405 return (0);
380} 406}
381LCRYPTO_ALIAS(ASN1_TIME_print); 407LCRYPTO_ALIAS(ASN1_TIME_print);
@@ -435,7 +461,7 @@ ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
435 return (1); 461 return (1);
436 462
437 err: 463 err:
438 BIO_write(bp, "Bad time value", 14); 464 BIO_printf(bp, "Bad time value");
439 return (0); 465 return (0);
440} 466}
441LCRYPTO_ALIAS(ASN1_GENERALIZEDTIME_print); 467LCRYPTO_ALIAS(ASN1_GENERALIZEDTIME_print);
@@ -479,7 +505,7 @@ ASN1_UTCTIME_print(BIO *bp, const ASN1_UTCTIME *tm)
479 return (1); 505 return (1);
480 506
481 err: 507 err:
482 BIO_write(bp, "Bad time value", 14); 508 BIO_printf(bp, "Bad time value");
483 return (0); 509 return (0);
484} 510}
485LCRYPTO_ALIAS(ASN1_UTCTIME_print); 511LCRYPTO_ALIAS(ASN1_UTCTIME_print);
diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c
index 31b9efee54..1bffae8a94 100644
--- a/src/lib/libcrypto/asn1/tasn_dec.c
+++ b/src/lib/libcrypto/asn1/tasn_dec.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tasn_dec.c,v 1.88 2023/07/28 10:00:10 tb Exp $ */ 1/* $OpenBSD: tasn_dec.c,v 1.89 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -63,11 +63,11 @@
63#include <openssl/asn1.h> 63#include <openssl/asn1.h>
64#include <openssl/asn1t.h> 64#include <openssl/asn1t.h>
65#include <openssl/buffer.h> 65#include <openssl/buffer.h>
66#include <openssl/err.h>
67#include <openssl/objects.h> 66#include <openssl/objects.h>
68 67
69#include "asn1_local.h" 68#include "asn1_local.h"
70#include "bytestring.h" 69#include "bytestring.h"
70#include "err_local.h"
71 71
72/* 72/*
73 * Constructed types with a recursive definition (such as can be found in PKCS7) 73 * Constructed types with a recursive definition (such as can be found in PKCS7)
diff --git a/src/lib/libcrypto/asn1/tasn_enc.c b/src/lib/libcrypto/asn1/tasn_enc.c
index b71993a139..a65fb5b7e7 100644
--- a/src/lib/libcrypto/asn1/tasn_enc.c
+++ b/src/lib/libcrypto/asn1/tasn_enc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tasn_enc.c,v 1.33 2023/07/28 10:00:10 tb Exp $ */ 1/* $OpenBSD: tasn_enc.c,v 1.34 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -61,10 +61,10 @@
61 61
62#include <openssl/asn1.h> 62#include <openssl/asn1.h>
63#include <openssl/asn1t.h> 63#include <openssl/asn1t.h>
64#include <openssl/err.h>
65#include <openssl/objects.h> 64#include <openssl/objects.h>
66 65
67#include "asn1_local.h" 66#include "asn1_local.h"
67#include "err_local.h"
68 68
69static int asn1_i2d_ex_primitive(ASN1_VALUE **pval, unsigned char **out, 69static int asn1_i2d_ex_primitive(ASN1_VALUE **pval, unsigned char **out,
70 const ASN1_ITEM *it, int tag, int aclass); 70 const ASN1_ITEM *it, int tag, int aclass);
diff --git a/src/lib/libcrypto/asn1/tasn_new.c b/src/lib/libcrypto/asn1/tasn_new.c
index 10c1137dbf..e17810b832 100644
--- a/src/lib/libcrypto/asn1/tasn_new.c
+++ b/src/lib/libcrypto/asn1/tasn_new.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tasn_new.c,v 1.25 2023/07/28 10:00:10 tb Exp $ */ 1/* $OpenBSD: tasn_new.c,v 1.26 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -60,11 +60,11 @@
60#include <stddef.h> 60#include <stddef.h>
61#include <openssl/asn1.h> 61#include <openssl/asn1.h>
62#include <openssl/objects.h> 62#include <openssl/objects.h>
63#include <openssl/err.h>
64#include <openssl/asn1t.h> 63#include <openssl/asn1t.h>
65#include <string.h> 64#include <string.h>
66 65
67#include "asn1_local.h" 66#include "asn1_local.h"
67#include "err_local.h"
68 68
69static int asn1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it); 69static int asn1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
70static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it); 70static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
diff --git a/src/lib/libcrypto/asn1/tasn_prn.c b/src/lib/libcrypto/asn1/tasn_prn.c
index 07764fc091..4db6d61111 100644
--- a/src/lib/libcrypto/asn1/tasn_prn.c
+++ b/src/lib/libcrypto/asn1/tasn_prn.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tasn_prn.c,v 1.27 2024/03/02 09:04:07 tb Exp $ */ 1/* $OpenBSD: tasn_prn.c,v 1.29 2025/06/07 09:28:00 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -61,7 +61,6 @@
61#include <openssl/asn1.h> 61#include <openssl/asn1.h>
62#include <openssl/asn1t.h> 62#include <openssl/asn1t.h>
63#include <openssl/buffer.h> 63#include <openssl/buffer.h>
64#include <openssl/err.h>
65#include <openssl/objects.h> 64#include <openssl/objects.h>
66#include <openssl/x509v3.h> 65#include <openssl/x509v3.h>
67 66
@@ -411,7 +410,7 @@ asn1_primitive_print(BIO *out, ASN1_VALUE **fld, const ASN1_ITEM *it,
411 if (!asn1_print_fsname(out, indent, fname, sname, pctx)) 410 if (!asn1_print_fsname(out, indent, fname, sname, pctx))
412 return 0; 411 return 0;
413 412
414 if (it != NULL && it->funcs != NULL) { 413 if (it->funcs != NULL) {
415 const ASN1_PRIMITIVE_FUNCS *pf = it->funcs; 414 const ASN1_PRIMITIVE_FUNCS *pf = it->funcs;
416 415
417 if (pf->prim_print == NULL) 416 if (pf->prim_print == NULL)
diff --git a/src/lib/libcrypto/asn1/tasn_utl.c b/src/lib/libcrypto/asn1/tasn_utl.c
index ae546edd4b..178a364c89 100644
--- a/src/lib/libcrypto/asn1/tasn_utl.c
+++ b/src/lib/libcrypto/asn1/tasn_utl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tasn_utl.c,v 1.18 2022/12/26 07:18:51 jmc Exp $ */ 1/* $OpenBSD: tasn_utl.c,v 1.19 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -63,9 +63,9 @@
63#include <openssl/asn1.h> 63#include <openssl/asn1.h>
64#include <openssl/asn1t.h> 64#include <openssl/asn1t.h>
65#include <openssl/objects.h> 65#include <openssl/objects.h>
66#include <openssl/err.h>
67 66
68#include "bytestring.h" 67#include "bytestring.h"
68#include "err_local.h"
69 69
70/* Utility functions for manipulating fields and offsets */ 70/* Utility functions for manipulating fields and offsets */
71 71
diff --git a/src/lib/libcrypto/asn1/x_crl.c b/src/lib/libcrypto/asn1/x_crl.c
index 7ad8350f3d..19caf56cec 100644
--- a/src/lib/libcrypto/asn1/x_crl.c
+++ b/src/lib/libcrypto/asn1/x_crl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x_crl.c,v 1.48 2025/02/27 20:13:41 tb Exp $ */ 1/* $OpenBSD: x_crl.c,v 1.50 2025/07/10 18:48:31 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -61,11 +61,11 @@
61#include <openssl/opensslconf.h> 61#include <openssl/opensslconf.h>
62 62
63#include <openssl/asn1t.h> 63#include <openssl/asn1t.h>
64#include <openssl/err.h>
65#include <openssl/x509.h> 64#include <openssl/x509.h>
66#include <openssl/x509v3.h> 65#include <openssl/x509v3.h>
67 66
68#include "asn1_local.h" 67#include "asn1_local.h"
68#include "err_local.h"
69#include "x509_local.h" 69#include "x509_local.h"
70 70
71static void setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp); 71static void setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp);
@@ -540,6 +540,12 @@ LCRYPTO_ALIAS(X509_CRL_add0_revoked);
540int 540int
541X509_CRL_verify(X509_CRL *crl, EVP_PKEY *pkey) 541X509_CRL_verify(X509_CRL *crl, EVP_PKEY *pkey)
542{ 542{
543 /*
544 * The CertificateList's signature AlgorithmIdentifier must match
545 * the one inside the TBSCertList, see RFC 5280, 5.1.1.2, 5.1.2.2.
546 */
547 if (X509_ALGOR_cmp(crl->sig_alg, crl->crl->sig_alg) != 0)
548 return 0;
543 return ASN1_item_verify(&X509_CRL_INFO_it, crl->sig_alg, crl->signature, 549 return ASN1_item_verify(&X509_CRL_INFO_it, crl->sig_alg, crl->signature,
544 crl->crl, pkey); 550 crl->crl, pkey);
545} 551}
diff --git a/src/lib/libcrypto/asn1/x_info.c b/src/lib/libcrypto/asn1/x_info.c
deleted file mode 100644
index d2c4bcfe7a..0000000000
--- a/src/lib/libcrypto/asn1/x_info.c
+++ /dev/null
@@ -1,96 +0,0 @@
1/* $OpenBSD: x_info.c,v 1.22 2024/12/11 10:28:03 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60
61#include <openssl/asn1.h>
62#include <openssl/err.h>
63#include <openssl/x509.h>
64
65X509_INFO *
66X509_INFO_new(void)
67{
68 X509_INFO *ret;
69
70 if ((ret = calloc(1, sizeof(X509_INFO))) == NULL) {
71 ASN1error(ERR_R_MALLOC_FAILURE);
72 return NULL;
73 }
74 ret->references = 1;
75
76 return ret;
77}
78LCRYPTO_ALIAS(X509_INFO_new);
79
80void
81X509_INFO_free(X509_INFO *x)
82{
83 if (x == NULL)
84 return;
85
86 if (CRYPTO_add(&x->references, -1, CRYPTO_LOCK_X509_INFO) > 0)
87 return;
88
89 X509_free(x->x509);
90 X509_CRL_free(x->crl);
91 X509_PKEY_free(x->x_pkey);
92 free(x->enc_data);
93
94 free(x);
95}
96LCRYPTO_ALIAS(X509_INFO_free);
diff --git a/src/lib/libcrypto/asn1/x_long.c b/src/lib/libcrypto/asn1/x_long.c
index 5e673f4521..a72411f30c 100644
--- a/src/lib/libcrypto/asn1/x_long.c
+++ b/src/lib/libcrypto/asn1/x_long.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x_long.c,v 1.21 2024/07/08 16:24:22 beck Exp $ */ 1/* $OpenBSD: x_long.c,v 1.22 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -61,9 +61,9 @@
61 61
62#include <openssl/asn1t.h> 62#include <openssl/asn1t.h>
63#include <openssl/bn.h> 63#include <openssl/bn.h>
64#include <openssl/err.h>
65 64
66#include "asn1_local.h" 65#include "asn1_local.h"
66#include "err_local.h"
67 67
68/* 68/*
69 * Custom primitive type for long handling. This converts between an 69 * Custom primitive type for long handling. This converts between an
diff --git a/src/lib/libcrypto/asn1/x_name.c b/src/lib/libcrypto/asn1/x_name.c
index 7bacd83340..09536666fc 100644
--- a/src/lib/libcrypto/asn1/x_name.c
+++ b/src/lib/libcrypto/asn1/x_name.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x_name.c,v 1.44 2024/07/08 14:48:49 beck Exp $ */ 1/* $OpenBSD: x_name.c,v 1.46 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -61,10 +61,10 @@
61#include <string.h> 61#include <string.h>
62 62
63#include <openssl/asn1t.h> 63#include <openssl/asn1t.h>
64#include <openssl/err.h>
65#include <openssl/x509.h> 64#include <openssl/x509.h>
66 65
67#include "asn1_local.h" 66#include "asn1_local.h"
67#include "err_local.h"
68#include "x509_local.h" 68#include "x509_local.h"
69 69
70typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 70typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;
@@ -414,8 +414,10 @@ x509_name_encode(X509_NAME *a)
414 if (!entries) 414 if (!entries)
415 goto memerr; 415 goto memerr;
416 if (!sk_STACK_OF_X509_NAME_ENTRY_push(intname.s, 416 if (!sk_STACK_OF_X509_NAME_ENTRY_push(intname.s,
417 entries)) 417 entries)) {
418 sk_X509_NAME_ENTRY_free(entries);
418 goto memerr; 419 goto memerr;
420 }
419 set = entry->set; 421 set = entry->set;
420 } 422 }
421 if (entries == NULL /* if entry->set is bogusly -1 */ || 423 if (entries == NULL /* if entry->set is bogusly -1 */ ||
diff --git a/src/lib/libcrypto/asn1/x_pkey.c b/src/lib/libcrypto/asn1/x_pkey.c
deleted file mode 100644
index 5c96c13ab9..0000000000
--- a/src/lib/libcrypto/asn1/x_pkey.c
+++ /dev/null
@@ -1,123 +0,0 @@
1/* $OpenBSD: x_pkey.c,v 1.24 2024/04/09 13:55:02 beck Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <string.h>
61
62#include <openssl/err.h>
63#include <openssl/evp.h>
64#include <openssl/objects.h>
65#include <openssl/x509.h>
66
67X509_PKEY *
68X509_PKEY_new(void)
69{
70 X509_PKEY *ret = NULL;
71
72 if ((ret = malloc(sizeof(X509_PKEY))) == NULL) {
73 ASN1error(ERR_R_MALLOC_FAILURE);
74 goto err;
75 }
76 ret->version = 0;
77 if ((ret->enc_algor = X509_ALGOR_new()) == NULL) {
78 ASN1error(ERR_R_MALLOC_FAILURE);
79 goto err;
80 }
81 if ((ret->enc_pkey = ASN1_OCTET_STRING_new()) == NULL) {
82 ASN1error(ERR_R_MALLOC_FAILURE);
83 goto err;
84 }
85 ret->dec_pkey = NULL;
86 ret->key_length = 0;
87 ret->key_data = NULL;
88 ret->key_free = 0;
89 ret->cipher.cipher = NULL;
90 memset(ret->cipher.iv, 0, EVP_MAX_IV_LENGTH);
91 ret->references = 1;
92 return (ret);
93
94 err:
95 if (ret) {
96 X509_ALGOR_free(ret->enc_algor);
97 free(ret);
98 }
99 return NULL;
100}
101LCRYPTO_ALIAS(X509_PKEY_new);
102
103void
104X509_PKEY_free(X509_PKEY *x)
105{
106 int i;
107
108 if (x == NULL)
109 return;
110
111 i = CRYPTO_add(&x->references, -1, CRYPTO_LOCK_X509_PKEY);
112 if (i > 0)
113 return;
114
115 if (x->enc_algor != NULL)
116 X509_ALGOR_free(x->enc_algor);
117 ASN1_OCTET_STRING_free(x->enc_pkey);
118 EVP_PKEY_free(x->dec_pkey);
119 if ((x->key_data != NULL) && (x->key_free))
120 free(x->key_data);
121 free(x);
122}
123LCRYPTO_ALIAS(X509_PKEY_free);
diff --git a/src/lib/libcrypto/asn1/x_pubkey.c b/src/lib/libcrypto/asn1/x_pubkey.c
index 1e772a3458..ec847861ea 100644
--- a/src/lib/libcrypto/asn1/x_pubkey.c
+++ b/src/lib/libcrypto/asn1/x_pubkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x_pubkey.c,v 1.37 2024/07/08 14:48:49 beck Exp $ */ 1/* $OpenBSD: x_pubkey.c,v 1.38 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -61,7 +61,6 @@
61#include <openssl/opensslconf.h> 61#include <openssl/opensslconf.h>
62 62
63#include <openssl/asn1t.h> 63#include <openssl/asn1t.h>
64#include <openssl/err.h>
65#include <openssl/x509.h> 64#include <openssl/x509.h>
66 65
67#ifndef OPENSSL_NO_DSA 66#ifndef OPENSSL_NO_DSA
@@ -72,6 +71,7 @@
72#endif 71#endif
73 72
74#include "asn1_local.h" 73#include "asn1_local.h"
74#include "err_local.h"
75#include "evp_local.h" 75#include "evp_local.h"
76#include "x509_local.h" 76#include "x509_local.h"
77 77
diff --git a/src/lib/libcrypto/bf/bf_local.h b/src/lib/libcrypto/bf/bf_local.h
index 8fc5a5dbd8..2fe65eb85c 100644
--- a/src/lib/libcrypto/bf/bf_local.h
+++ b/src/lib/libcrypto/bf/bf_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: bf_local.h,v 1.3 2024/03/27 11:54:29 jsing Exp $ */ 1/* $OpenBSD: bf_local.h,v 1.4 2025/06/11 04:08:16 tb Exp $ */
2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -56,11 +56,11 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#include <openssl/opensslconf.h> /* BF_PTR */
60
61#ifndef HEADER_BF_LOCL_H 59#ifndef HEADER_BF_LOCL_H
62#define HEADER_BF_LOCL_H 60#define HEADER_BF_LOCL_H
63 61
62#include <openssl/opensslconf.h>
63
64/* NOTE - c is not incremented as per n2l */ 64/* NOTE - c is not incremented as per n2l */
65#define n2ln(c,l1,l2,n) { \ 65#define n2ln(c,l1,l2,n) { \
66 c+=n; \ 66 c+=n; \
@@ -104,46 +104,6 @@
104 *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ 104 *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \
105 *((c)++)=(unsigned char)(((l) )&0xff)) 105 *((c)++)=(unsigned char)(((l) )&0xff))
106 106
107/* This is actually a big endian algorithm, the most significant byte
108 * is used to lookup array 0 */
109
110#if defined(BF_PTR)
111
112#ifndef BF_LONG_LOG2
113#define BF_LONG_LOG2 2 /* default to BF_LONG being 32 bits */
114#endif
115#define BF_M (0xFF<<BF_LONG_LOG2)
116#define BF_0 (24-BF_LONG_LOG2)
117#define BF_1 (16-BF_LONG_LOG2)
118#define BF_2 ( 8-BF_LONG_LOG2)
119#define BF_3 BF_LONG_LOG2 /* left shift */
120
121/*
122 * This is normally very good on RISC platforms where normally you
123 * have to explicitly "multiply" array index by sizeof(BF_LONG)
124 * in order to calculate the effective address. This implementation
125 * excuses CPU from this extra work. Power[PC] uses should have most
126 * fun as (R>>BF_i)&BF_M gets folded into a single instruction, namely
127 * rlwinm. So let'em double-check if their compiler does it.
128 */
129
130#define BF_ENC(LL,R,S,P) ( \
131 LL^=P, \
132 LL^= (((*(BF_LONG *)((unsigned char *)&(S[ 0])+((R>>BF_0)&BF_M))+ \
133 *(BF_LONG *)((unsigned char *)&(S[256])+((R>>BF_1)&BF_M)))^ \
134 *(BF_LONG *)((unsigned char *)&(S[512])+((R>>BF_2)&BF_M)))+ \
135 *(BF_LONG *)((unsigned char *)&(S[768])+((R<<BF_3)&BF_M))) \
136 )
137#else
138
139/*
140 * This is a *generic* version. Seem to perform best on platforms that
141 * offer explicit support for extraction of 8-bit nibbles preferably
142 * complemented with "multiplying" of array index by sizeof(BF_LONG).
143 * For the moment of this writing the list comprises Alpha CPU featuring
144 * extbl and s[48]addq instructions.
145 */
146
147#define BF_ENC(LL,R,S,P) ( \ 107#define BF_ENC(LL,R,S,P) ( \
148 LL^=P, \ 108 LL^=P, \
149 LL^=((( S[ ((int)(R>>24)&0xff)] + \ 109 LL^=((( S[ ((int)(R>>24)&0xff)] + \
@@ -151,6 +111,5 @@
151 S[0x0200+((int)(R>> 8)&0xff)])+ \ 111 S[0x0200+((int)(R>> 8)&0xff)])+ \
152 S[0x0300+((int)(R )&0xff)])&0xffffffffL \ 112 S[0x0300+((int)(R )&0xff)])&0xffffffffL \
153 ) 113 )
154#endif
155 114
156#endif 115#endif
diff --git a/src/lib/libcrypto/bio/b_dump.c b/src/lib/libcrypto/bio/b_dump.c
index 4dcf710bbe..3f673205c1 100644
--- a/src/lib/libcrypto/bio/b_dump.c
+++ b/src/lib/libcrypto/bio/b_dump.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: b_dump.c,v 1.30 2024/03/02 09:21:24 tb Exp $ */ 1/* $OpenBSD: b_dump.c,v 1.31 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -62,7 +62,6 @@
62#include <string.h> 62#include <string.h>
63 63
64#include <openssl/bio.h> 64#include <openssl/bio.h>
65#include <openssl/err.h>
66 65
67#include "bytestring.h" 66#include "bytestring.h"
68 67
diff --git a/src/lib/libcrypto/bio/b_sock.c b/src/lib/libcrypto/bio/b_sock.c
index 00bbe9c37e..9ef9953b95 100644
--- a/src/lib/libcrypto/bio/b_sock.c
+++ b/src/lib/libcrypto/bio/b_sock.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: b_sock.c,v 1.71 2023/07/05 21:23:37 beck Exp $ */ 1/* $OpenBSD: b_sock.c,v 1.72 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2017 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2017 Bob Beck <beck@openbsd.org>
4 * 4 *
@@ -32,7 +32,8 @@
32 32
33#include <openssl/bio.h> 33#include <openssl/bio.h>
34#include <openssl/buffer.h> 34#include <openssl/buffer.h>
35#include <openssl/err.h> 35
36#include "err_local.h"
36 37
37int 38int
38BIO_get_host_ip(const char *str, unsigned char *ip) 39BIO_get_host_ip(const char *str, unsigned char *ip)
diff --git a/src/lib/libcrypto/bio/bf_buff.c b/src/lib/libcrypto/bio/bf_buff.c
index 226c16835a..36b6fabde3 100644
--- a/src/lib/libcrypto/bio/bf_buff.c
+++ b/src/lib/libcrypto/bio/bf_buff.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bf_buff.c,v 1.28 2023/07/05 21:23:37 beck Exp $ */ 1/* $OpenBSD: bf_buff.c,v 1.29 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -61,9 +61,9 @@
61#include <string.h> 61#include <string.h>
62 62
63#include <openssl/bio.h> 63#include <openssl/bio.h>
64#include <openssl/err.h>
65 64
66#include "bio_local.h" 65#include "bio_local.h"
66#include "err_local.h"
67 67
68static int buffer_write(BIO *h, const char *buf, int num); 68static int buffer_write(BIO *h, const char *buf, int num);
69static int buffer_read(BIO *h, char *buf, int size); 69static int buffer_read(BIO *h, char *buf, int size);
diff --git a/src/lib/libcrypto/bio/bio.h b/src/lib/libcrypto/bio/bio.h
index 8327ffc071..a8108054e7 100644
--- a/src/lib/libcrypto/bio/bio.h
+++ b/src/lib/libcrypto/bio/bio.h
@@ -1,25 +1,25 @@
1/* $OpenBSD: bio.h,v 1.64 2024/05/19 07:12:50 jsg Exp $ */ 1/* $OpenBSD: bio.h,v 1.65 2025/07/16 18:12:54 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * This package is an SSL implementation written 5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com). 6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL. 7 * The implementation was written so as to conform with Netscapes SSL.
8 * 8 *
9 * This library is free for commercial and non-commercial use as long as 9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions 10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA, 11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation 12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms 13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com). 14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 * 15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in 16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed. 17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution 18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used. 19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or 20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package. 21 * in documentation (online or textual) provided with the package.
22 * 22 *
23 * Redistribution and use in source and binary forms, with or without 23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions 24 * modification, are permitted provided that the following conditions
25 * are met: 25 * are met:
@@ -34,10 +34,10 @@
34 * Eric Young (eay@cryptsoft.com)" 34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library 35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-). 36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from 37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement: 38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 * 40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE. 51 * SUCH DAMAGE.
52 * 52 *
53 * The licence and distribution terms for any publically available version or 53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be 54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence 55 * copied and put under another distribution licence
@@ -96,8 +96,8 @@ extern "C" {
96#define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */ 96#define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */
97#define BIO_TYPE_LINEBUFFER (20|0x0200) /* filter */ 97#define BIO_TYPE_LINEBUFFER (20|0x0200) /* filter */
98#define BIO_TYPE_DGRAM (21|0x0400|0x0100) 98#define BIO_TYPE_DGRAM (21|0x0400|0x0100)
99#define BIO_TYPE_ASN1 (22|0x0200) /* filter */ 99#define BIO_TYPE_ASN1 (22|0x0200) /* filter */
100#define BIO_TYPE_COMP (23|0x0200) /* filter */ 100#define BIO_TYPE_COMP (23|0x0200) /* filter */
101 101
102#define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ 102#define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */
103#define BIO_TYPE_FILTER 0x0200 103#define BIO_TYPE_FILTER 0x0200
@@ -139,14 +139,14 @@ extern "C" {
139#define BIO_CTRL_DGRAM_CONNECT 31 /* BIO dgram special */ 139#define BIO_CTRL_DGRAM_CONNECT 31 /* BIO dgram special */
140#define BIO_CTRL_DGRAM_SET_CONNECTED 32 /* allow for an externally 140#define BIO_CTRL_DGRAM_SET_CONNECTED 32 /* allow for an externally
141 * connected socket to be 141 * connected socket to be
142 * passed in */ 142 * passed in */
143#define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33 /* setsockopt, essentially */ 143#define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33 /* setsockopt, essentially */
144#define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34 /* getsockopt, essentially */ 144#define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34 /* getsockopt, essentially */
145#define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35 /* setsockopt, essentially */ 145#define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35 /* setsockopt, essentially */
146#define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36 /* getsockopt, essentially */ 146#define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36 /* getsockopt, essentially */
147 147
148#define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37 /* flag whether the last */ 148#define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37 /* flag whether the last */
149#define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38 /* I/O operation tiemd out */ 149#define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38 /* I/O operation timed out */
150 150
151/* #ifdef IP_MTU_DISCOVER */ 151/* #ifdef IP_MTU_DISCOVER */
152#define BIO_CTRL_DGRAM_MTU_DISCOVER 39 /* set DF bit on egress packets */ 152#define BIO_CTRL_DGRAM_MTU_DISCOVER 39 /* set DF bit on egress packets */
@@ -232,7 +232,7 @@ void BIO_clear_flags(BIO *b, int flags);
232 232
233/* The next three are used in conjunction with the 233/* The next three are used in conjunction with the
234 * BIO_should_io_special() condition. After this returns true, 234 * BIO_should_io_special() condition. After this returns true,
235 * BIO *BIO_get_retry_BIO(BIO *bio, int *reason); will walk the BIO 235 * BIO *BIO_get_retry_BIO(BIO *bio, int *reason); will walk the BIO
236 * stack and return the 'reason' for the special and the offending BIO. 236 * stack and return the 'reason' for the special and the offending BIO.
237 * Given a BIO, BIO_get_retry_reason(bio) will return the code. */ 237 * Given a BIO, BIO_get_retry_reason(bio) will return the code. */
238/* Returned from the SSL bio when the certificate retrieval code had an error */ 238/* Returned from the SSL bio when the certificate retrieval code had an error */
@@ -380,7 +380,7 @@ int BIO_meth_set_callback_ctrl(BIO_METHOD *biom,
380#define BIO_set_conn_int_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,3,(char *)port) 380#define BIO_set_conn_int_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,3,(char *)port)
381#define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0) 381#define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0)
382#define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1) 382#define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1)
383#define BIO_get_conn_ip(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2) 383#define BIO_get_conn_ip(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2)
384#define BIO_get_conn_int_port(b) BIO_int_ctrl(b,BIO_C_GET_CONNECT,3,0) 384#define BIO_get_conn_int_port(b) BIO_int_ctrl(b,BIO_C_GET_CONNECT,3,0)
385 385
386 386
@@ -571,7 +571,6 @@ const BIO_METHOD *BIO_s_socket(void);
571const BIO_METHOD *BIO_s_connect(void); 571const BIO_METHOD *BIO_s_connect(void);
572const BIO_METHOD *BIO_s_accept(void); 572const BIO_METHOD *BIO_s_accept(void);
573const BIO_METHOD *BIO_s_fd(void); 573const BIO_METHOD *BIO_s_fd(void);
574const BIO_METHOD *BIO_s_log(void);
575const BIO_METHOD *BIO_s_bio(void); 574const BIO_METHOD *BIO_s_bio(void);
576const BIO_METHOD *BIO_s_null(void); 575const BIO_METHOD *BIO_s_null(void);
577const BIO_METHOD *BIO_f_null(void); 576const BIO_METHOD *BIO_f_null(void);
diff --git a/src/lib/libcrypto/bio/bio_cb.c b/src/lib/libcrypto/bio/bio_cb.c
index 18e9be8d68..990cb20708 100644
--- a/src/lib/libcrypto/bio/bio_cb.c
+++ b/src/lib/libcrypto/bio/bio_cb.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_cb.c,v 1.19 2023/07/05 21:23:37 beck Exp $ */ 1/* $OpenBSD: bio_cb.c,v 1.20 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -60,7 +60,6 @@
60#include <stdlib.h> 60#include <stdlib.h>
61#include <string.h> 61#include <string.h>
62 62
63#include <openssl/err.h>
64#include <openssl/bio.h> 63#include <openssl/bio.h>
65 64
66#include "bio_local.h" 65#include "bio_local.h"
diff --git a/src/lib/libcrypto/bio/bio_lib.c b/src/lib/libcrypto/bio/bio_lib.c
index 463d2ad23a..04e8f4c295 100644
--- a/src/lib/libcrypto/bio/bio_lib.c
+++ b/src/lib/libcrypto/bio/bio_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_lib.c,v 1.54 2024/07/09 06:14:59 beck Exp $ */ 1/* $OpenBSD: bio_lib.c,v 1.55 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -62,10 +62,10 @@
62 62
63#include <openssl/bio.h> 63#include <openssl/bio.h>
64#include <openssl/crypto.h> 64#include <openssl/crypto.h>
65#include <openssl/err.h>
66#include <openssl/stack.h> 65#include <openssl/stack.h>
67 66
68#include "bio_local.h" 67#include "bio_local.h"
68#include "err_local.h"
69 69
70/* 70/*
71 * Helper function to work out whether to call the new style callback or the old 71 * Helper function to work out whether to call the new style callback or the old
diff --git a/src/lib/libcrypto/bio/bss_acpt.c b/src/lib/libcrypto/bio/bss_acpt.c
index d74c710a7f..60e61100b1 100644
--- a/src/lib/libcrypto/bio/bss_acpt.c
+++ b/src/lib/libcrypto/bio/bss_acpt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bss_acpt.c,v 1.31 2023/07/05 21:23:37 beck Exp $ */ 1/* $OpenBSD: bss_acpt.c,v 1.33 2025/06/02 12:18:21 jsg Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -65,9 +65,9 @@
65 65
66#include <openssl/bio.h> 66#include <openssl/bio.h>
67#include <openssl/buffer.h> 67#include <openssl/buffer.h>
68#include <openssl/err.h>
69 68
70#include "bio_local.h" 69#include "bio_local.h"
70#include "err_local.h"
71 71
72#define SOCKET_PROTOCOL IPPROTO_TCP 72#define SOCKET_PROTOCOL IPPROTO_TCP
73 73
@@ -261,11 +261,12 @@ again:
261 if (c->bio_chain != NULL) { 261 if (c->bio_chain != NULL) {
262 if ((dbio = BIO_dup_chain(c->bio_chain)) == NULL) 262 if ((dbio = BIO_dup_chain(c->bio_chain)) == NULL)
263 goto err; 263 goto err;
264 if (!BIO_push(dbio, bio)) goto err; 264 if (!BIO_push(dbio, bio))
265 bio = dbio; 265 goto err;
266 bio = dbio;
266 } 267 }
267 if (BIO_push(b, bio) 268 if (BIO_push(b, bio) == NULL)
268 == NULL) goto err; 269 goto err;
269 270
270 c->state = ACPT_S_OK; 271 c->state = ACPT_S_OK;
271 return (1); 272 return (1);
diff --git a/src/lib/libcrypto/bio/bss_bio.c b/src/lib/libcrypto/bio/bss_bio.c
index 39d8d1e46c..f1d1bbeecd 100644
--- a/src/lib/libcrypto/bio/bss_bio.c
+++ b/src/lib/libcrypto/bio/bss_bio.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bss_bio.c,v 1.29 2024/07/09 06:14:59 beck Exp $ */ 1/* $OpenBSD: bss_bio.c,v 1.30 2025/05/10 05:54:38 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -81,10 +81,10 @@
81#include <sys/types.h> 81#include <sys/types.h>
82 82
83#include <openssl/bio.h> 83#include <openssl/bio.h>
84#include <openssl/err.h>
85#include <openssl/crypto.h> 84#include <openssl/crypto.h>
86 85
87#include "bio_local.h" 86#include "bio_local.h"
87#include "err_local.h"
88 88
89static int bio_new(BIO *bio); 89static int bio_new(BIO *bio);
90static int bio_free(BIO *bio); 90static int bio_free(BIO *bio);
diff --git a/src/lib/libcrypto/bio/bss_conn.c b/src/lib/libcrypto/bio/bss_conn.c
index 3b0e3d3bdd..14f410f59d 100644
--- a/src/lib/libcrypto/bio/bss_conn.c
+++ b/src/lib/libcrypto/bio/bss_conn.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bss_conn.c,v 1.41 2024/04/19 09:54:36 tb Exp $ */ 1/* $OpenBSD: bss_conn.c,v 1.43 2025/06/02 12:18:21 jsg Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -68,9 +68,9 @@
68 68
69#include <openssl/bio.h> 69#include <openssl/bio.h>
70#include <openssl/buffer.h> 70#include <openssl/buffer.h>
71#include <openssl/err.h>
72 71
73#include "bio_local.h" 72#include "bio_local.h"
73#include "err_local.h"
74 74
75#define SOCKET_PROTOCOL IPPROTO_TCP 75#define SOCKET_PROTOCOL IPPROTO_TCP
76 76
@@ -141,7 +141,7 @@ conn_state(BIO *b, BIO_CONNECT *c)
141 } 141 }
142 for (; *p != '\0'; p++) { 142 for (; *p != '\0'; p++) {
143 if ((*p == ':') || (*p == '/')) 143 if ((*p == ':') || (*p == '/'))
144 break; 144 break;
145 } 145 }
146 146
147 i= *p; 147 i= *p;
diff --git a/src/lib/libcrypto/bio/bss_file.c b/src/lib/libcrypto/bio/bss_file.c
index 9b6ca2bdd8..21f71718bb 100644
--- a/src/lib/libcrypto/bio/bss_file.c
+++ b/src/lib/libcrypto/bio/bss_file.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bss_file.c,v 1.35 2023/07/05 21:23:37 beck Exp $ */ 1/* $OpenBSD: bss_file.c,v 1.36 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -88,9 +88,9 @@
88#include <string.h> 88#include <string.h>
89 89
90#include <openssl/bio.h> 90#include <openssl/bio.h>
91#include <openssl/err.h>
92 91
93#include "bio_local.h" 92#include "bio_local.h"
93#include "err_local.h"
94 94
95static int file_write(BIO *h, const char *buf, int num); 95static int file_write(BIO *h, const char *buf, int num);
96static int file_read(BIO *h, char *buf, int size); 96static int file_read(BIO *h, char *buf, int size);
diff --git a/src/lib/libcrypto/bio/bss_log.c b/src/lib/libcrypto/bio/bss_log.c
deleted file mode 100644
index 9e2e882646..0000000000
--- a/src/lib/libcrypto/bio/bss_log.c
+++ /dev/null
@@ -1,216 +0,0 @@
1/* $OpenBSD: bss_log.c,v 1.24 2023/07/05 21:23:37 beck Exp $ */
2/* ====================================================================
3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * 3. All advertising materials mentioning features or use of this
18 * software must display the following acknowledgment:
19 * "This product includes software developed by the OpenSSL Project
20 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
21 *
22 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23 * endorse or promote products derived from this software without
24 * prior written permission. For written permission, please contact
25 * licensing@OpenSSL.org.
26 *
27 * 5. Products derived from this software may not be called "OpenSSL"
28 * nor may "OpenSSL" appear in their names without prior written
29 * permission of the OpenSSL Project.
30 *
31 * 6. Redistributions of any form whatsoever must retain the following
32 * acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
40 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 * ====================================================================
49 *
50 * This product includes cryptographic software written by Eric Young
51 * (eay@cryptsoft.com). This product includes software written by Tim
52 * Hudson (tjh@cryptsoft.com).
53 *
54 */
55
56/*
57 Why BIO_s_log?
58
59 BIO_s_log is useful for system daemons (or services under NT).
60 It is one-way BIO, it sends all stuff to syslogd (on system that
61 commonly use that), or event log (on NT), or OPCOM (on OpenVMS).
62
63*/
64
65#include <errno.h>
66#include <stdio.h>
67#include <string.h>
68#include <syslog.h>
69
70#include <openssl/buffer.h>
71#include <openssl/err.h>
72
73#include "bio_local.h"
74
75#ifndef NO_SYSLOG
76
77static int slg_write(BIO *h, const char *buf, int num);
78static int slg_puts(BIO *h, const char *str);
79static long slg_ctrl(BIO *h, int cmd, long arg1, void *arg2);
80static int slg_new(BIO *h);
81static int slg_free(BIO *data);
82static void xopenlog(BIO* bp, char* name, int level);
83static void xsyslog(BIO* bp, int priority, const char* string);
84static void xcloselog(BIO* bp);
85
86static const BIO_METHOD methods_slg = {
87 .type = BIO_TYPE_MEM,
88 .name = "syslog",
89 .bwrite = slg_write,
90 .bputs = slg_puts,
91 .ctrl = slg_ctrl,
92 .create = slg_new,
93 .destroy = slg_free
94};
95
96const BIO_METHOD *
97BIO_s_log(void)
98{
99 return (&methods_slg);
100}
101LCRYPTO_ALIAS(BIO_s_log);
102
103static int
104slg_new(BIO *bi)
105{
106 bi->init = 1;
107 bi->num = 0;
108 bi->ptr = NULL;
109 xopenlog(bi, "application", LOG_DAEMON);
110 return (1);
111}
112
113static int
114slg_free(BIO *a)
115{
116 if (a == NULL)
117 return (0);
118 xcloselog(a);
119 return (1);
120}
121
122static int
123slg_write(BIO *b, const char *in, int inl)
124{
125 int ret = inl;
126 char* buf;
127 char* pp;
128 int priority, i;
129 static const struct {
130 int strl;
131 char str[10];
132 int log_level;
133 }
134 mapping[] = {
135 { 6, "PANIC ", LOG_EMERG },
136 { 6, "EMERG ", LOG_EMERG },
137 { 4, "EMR ", LOG_EMERG },
138 { 6, "ALERT ", LOG_ALERT },
139 { 4, "ALR ", LOG_ALERT },
140 { 5, "CRIT ", LOG_CRIT },
141 { 4, "CRI ", LOG_CRIT },
142 { 6, "ERROR ", LOG_ERR },
143 { 4, "ERR ", LOG_ERR },
144 { 8, "WARNING ", LOG_WARNING },
145 { 5, "WARN ", LOG_WARNING },
146 { 4, "WAR ", LOG_WARNING },
147 { 7, "NOTICE ", LOG_NOTICE },
148 { 5, "NOTE ", LOG_NOTICE },
149 { 4, "NOT ", LOG_NOTICE },
150 { 5, "INFO ", LOG_INFO },
151 { 4, "INF ", LOG_INFO },
152 { 6, "DEBUG ", LOG_DEBUG },
153 { 4, "DBG ", LOG_DEBUG },
154 { 0, "", LOG_ERR } /* The default */
155 };
156
157 if ((buf = malloc(inl + 1)) == NULL) {
158 return (0);
159 }
160 strlcpy(buf, in, inl + 1);
161 i = 0;
162 while (strncmp(buf, mapping[i].str, mapping[i].strl) != 0)
163 i++;
164 priority = mapping[i].log_level;
165 pp = buf + mapping[i].strl;
166
167 xsyslog(b, priority, pp);
168
169 free(buf);
170 return (ret);
171}
172
173static long
174slg_ctrl(BIO *b, int cmd, long num, void *ptr)
175{
176 switch (cmd) {
177 case BIO_CTRL_SET:
178 xcloselog(b);
179 xopenlog(b, ptr, num);
180 break;
181 default:
182 break;
183 }
184 return (0);
185}
186
187static int
188slg_puts(BIO *bp, const char *str)
189{
190 int n, ret;
191
192 n = strlen(str);
193 ret = slg_write(bp, str, n);
194 return (ret);
195}
196
197
198static void
199xopenlog(BIO* bp, char* name, int level)
200{
201 openlog(name, LOG_PID|LOG_CONS, level);
202}
203
204static void
205xsyslog(BIO *bp, int priority, const char *string)
206{
207 syslog(priority, "%s", string);
208}
209
210static void
211xcloselog(BIO* bp)
212{
213 closelog();
214}
215
216#endif /* NO_SYSLOG */
diff --git a/src/lib/libcrypto/bio/bss_mem.c b/src/lib/libcrypto/bio/bss_mem.c
index 6d0d54db84..0fa6317a2b 100644
--- a/src/lib/libcrypto/bio/bss_mem.c
+++ b/src/lib/libcrypto/bio/bss_mem.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bss_mem.c,v 1.22 2023/07/05 21:23:37 beck Exp $ */ 1/* $OpenBSD: bss_mem.c,v 1.27 2025/05/31 11:31:16 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -62,10 +62,10 @@
62#include <string.h> 62#include <string.h>
63 63
64#include <openssl/bio.h> 64#include <openssl/bio.h>
65#include <openssl/err.h>
66#include <openssl/buffer.h> 65#include <openssl/buffer.h>
67 66
68#include "bio_local.h" 67#include "bio_local.h"
68#include "err_local.h"
69 69
70struct bio_mem { 70struct bio_mem {
71 BUF_MEM *buf; 71 BUF_MEM *buf;
@@ -140,6 +140,7 @@ BIO_new_mem_buf(const void *buf, int buf_len)
140 return NULL; 140 return NULL;
141 141
142 bm = bio->ptr; 142 bm = bio->ptr;
143 free(bm->buf->data);
143 bm->buf->data = (void *)buf; /* Trust in the BIO_FLAGS_MEM_RDONLY flag. */ 144 bm->buf->data = (void *)buf; /* Trust in the BIO_FLAGS_MEM_RDONLY flag. */
144 bm->buf->length = buf_len; 145 bm->buf->length = buf_len;
145 bm->buf->max = buf_len; 146 bm->buf->max = buf_len;
@@ -162,6 +163,12 @@ mem_new(BIO *bio)
162 free(bm); 163 free(bm);
163 return 0; 164 return 0;
164 } 165 }
166 if (BUF_MEM_grow_clean(bm->buf, 64) != 64) {
167 BUF_MEM_free(bm->buf);
168 free(bm);
169 return 0;
170 }
171 bm->buf->length = 0;
165 172
166 bio->shutdown = 1; 173 bio->shutdown = 1;
167 bio->init = 1; 174 bio->init = 1;
diff --git a/src/lib/libcrypto/bn/arch/amd64/bn_arch.c b/src/lib/libcrypto/bn/arch/amd64/bn_arch.c
index a377a05681..8eb3670def 100644
--- a/src/lib/libcrypto/bn/arch/amd64/bn_arch.c
+++ b/src/lib/libcrypto/bn/arch/amd64/bn_arch.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_arch.c,v 1.7 2023/06/24 16:01:44 jsing Exp $ */ 1/* $OpenBSD: bn_arch.c,v 1.8 2025/08/05 15:01:13 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -78,7 +78,7 @@ bn_mul_words(BN_ULONG *rd, const BN_ULONG *ad, int num, BN_ULONG w)
78 78
79#ifdef HAVE_BN_MUL_COMBA4 79#ifdef HAVE_BN_MUL_COMBA4
80void 80void
81bn_mul_comba4(BN_ULONG *rd, BN_ULONG *ad, BN_ULONG *bd) 81bn_mul_comba4(BN_ULONG *rd, const BN_ULONG *ad, const BN_ULONG *bd)
82{ 82{
83 /* XXX - consider using non-alt on CPUs that have the ADX extension. */ 83 /* XXX - consider using non-alt on CPUs that have the ADX extension. */
84 bignum_mul_4_8_alt((uint64_t *)rd, (uint64_t *)ad, (uint64_t *)bd); 84 bignum_mul_4_8_alt((uint64_t *)rd, (uint64_t *)ad, (uint64_t *)bd);
@@ -87,7 +87,7 @@ bn_mul_comba4(BN_ULONG *rd, BN_ULONG *ad, BN_ULONG *bd)
87 87
88#ifdef HAVE_BN_MUL_COMBA8 88#ifdef HAVE_BN_MUL_COMBA8
89void 89void
90bn_mul_comba8(BN_ULONG *rd, BN_ULONG *ad, BN_ULONG *bd) 90bn_mul_comba8(BN_ULONG *rd, const BN_ULONG *ad, const BN_ULONG *bd)
91{ 91{
92 /* XXX - consider using non-alt on CPUs that have the ADX extension. */ 92 /* XXX - consider using non-alt on CPUs that have the ADX extension. */
93 bignum_mul_8_16_alt((uint64_t *)rd, (uint64_t *)ad, (uint64_t *)bd); 93 bignum_mul_8_16_alt((uint64_t *)rd, (uint64_t *)ad, (uint64_t *)bd);
diff --git a/src/lib/libcrypto/bn/asm/bn-586.pl b/src/lib/libcrypto/bn/asm/bn-586.pl
index 71b775af8d..19a1afdbbe 100644
--- a/src/lib/libcrypto/bn/asm/bn-586.pl
+++ b/src/lib/libcrypto/bn/asm/bn-586.pl
@@ -6,8 +6,7 @@ require "x86asm.pl";
6 6
7&asm_init($ARGV[0],$0); 7&asm_init($ARGV[0],$0);
8 8
9$sse2=0; 9$sse2=1;
10for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); }
11 10
12&external_label("OPENSSL_ia32cap_P") if ($sse2); 11&external_label("OPENSSL_ia32cap_P") if ($sse2);
13 12
diff --git a/src/lib/libcrypto/bn/asm/x86-mont.pl b/src/lib/libcrypto/bn/asm/x86-mont.pl
index 6524651748..3be440f11f 100755
--- a/src/lib/libcrypto/bn/asm/x86-mont.pl
+++ b/src/lib/libcrypto/bn/asm/x86-mont.pl
@@ -32,8 +32,7 @@ require "x86asm.pl";
32 32
33&asm_init($ARGV[0],$0); 33&asm_init($ARGV[0],$0);
34 34
35$sse2=0; 35$sse2=1;
36for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); }
37 36
38&external_label("OPENSSL_ia32cap_P") if ($sse2); 37&external_label("OPENSSL_ia32cap_P") if ($sse2);
39 38
diff --git a/src/lib/libcrypto/bn/bn_add.c b/src/lib/libcrypto/bn/bn_add.c
index 86768a312a..81fa60e429 100644
--- a/src/lib/libcrypto/bn/bn_add.c
+++ b/src/lib/libcrypto/bn/bn_add.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_add.c,v 1.26 2023/07/08 12:21:58 beck Exp $ */ 1/* $OpenBSD: bn_add.c,v 1.29 2025/05/25 04:53:05 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -60,44 +60,10 @@
60#include <limits.h> 60#include <limits.h>
61#include <stdio.h> 61#include <stdio.h>
62 62
63#include <openssl/err.h>
64
65#include "bn_arch.h" 63#include "bn_arch.h"
66#include "bn_local.h" 64#include "bn_local.h"
67#include "bn_internal.h" 65#include "bn_internal.h"
68 66#include "err_local.h"
69/*
70 * bn_add_words() computes (carry:r[i]) = a[i] + b[i] + carry, where a and b
71 * are both arrays of words. Any carry resulting from the addition is returned.
72 */
73#ifndef HAVE_BN_ADD_WORDS
74BN_ULONG
75bn_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n)
76{
77 BN_ULONG carry = 0;
78
79 assert(n >= 0);
80 if (n <= 0)
81 return 0;
82
83 while (n & ~3) {
84 bn_qwaddqw(a[3], a[2], a[1], a[0], b[3], b[2], b[1], b[0],
85 carry, &carry, &r[3], &r[2], &r[1], &r[0]);
86 a += 4;
87 b += 4;
88 r += 4;
89 n -= 4;
90 }
91 while (n) {
92 bn_addw_addw(a[0], b[0], carry, &carry, &r[0]);
93 a++;
94 b++;
95 r++;
96 n--;
97 }
98 return carry;
99}
100#endif
101 67
102/* 68/*
103 * bn_add() computes (carry:r[i]) = a[i] + b[i] + carry, where a and b are both 69 * bn_add() computes (carry:r[i]) = a[i] + b[i] + carry, where a and b are both
@@ -147,40 +113,6 @@ bn_add(BN_ULONG *r, int r_len, const BN_ULONG *a, int a_len, const BN_ULONG *b,
147#endif 113#endif
148 114
149/* 115/*
150 * bn_sub_words() computes (borrow:r[i]) = a[i] - b[i] - borrow, where a and b
151 * are both arrays of words. Any borrow resulting from the subtraction is
152 * returned.
153 */
154#ifndef HAVE_BN_SUB_WORDS
155BN_ULONG
156bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n)
157{
158 BN_ULONG borrow = 0;
159
160 assert(n >= 0);
161 if (n <= 0)
162 return 0;
163
164 while (n & ~3) {
165 bn_qwsubqw(a[3], a[2], a[1], a[0], b[3], b[2], b[1], b[0],
166 borrow, &borrow, &r[3], &r[2], &r[1], &r[0]);
167 a += 4;
168 b += 4;
169 r += 4;
170 n -= 4;
171 }
172 while (n) {
173 bn_subw_subw(a[0], b[0], borrow, &borrow, &r[0]);
174 a++;
175 b++;
176 r++;
177 n--;
178 }
179 return borrow;
180}
181#endif
182
183/*
184 * bn_sub() computes (borrow:r[i]) = a[i] - b[i] - borrow, where a and b are both 116 * bn_sub() computes (borrow:r[i]) = a[i] - b[i] - borrow, where a and b are both
185 * arrays of words (r may be the same as a or b). The length of a and b may 117 * arrays of words (r may be the same as a or b). The length of a and b may
186 * differ, while r must be at least max(a_len, b_len) in length. Any borrow 118 * differ, while r must be at least max(a_len, b_len) in length. Any borrow
@@ -208,7 +140,7 @@ bn_sub(BN_ULONG *r, int r_len, const BN_ULONG *a, int a_len, const BN_ULONG *b,
208 /* XXX - consider doing four at a time to match bn_sub_words. */ 140 /* XXX - consider doing four at a time to match bn_sub_words. */
209 while (diff_len < 0) { 141 while (diff_len < 0) {
210 /* Compute r[0] = 0 - b[0] - borrow. */ 142 /* Compute r[0] = 0 - b[0] - borrow. */
211 bn_subw(0 - b[0], borrow, &borrow, &r[0]); 143 bn_subw_subw(0, b[0], borrow, &borrow, &r[0]);
212 diff_len++; 144 diff_len++;
213 b++; 145 b++;
214 r++; 146 r++;
@@ -217,7 +149,7 @@ bn_sub(BN_ULONG *r, int r_len, const BN_ULONG *a, int a_len, const BN_ULONG *b,
217 /* XXX - consider doing four at a time to match bn_sub_words. */ 149 /* XXX - consider doing four at a time to match bn_sub_words. */
218 while (diff_len > 0) { 150 while (diff_len > 0) {
219 /* Compute r[0] = a[0] - 0 - borrow. */ 151 /* Compute r[0] = a[0] - 0 - borrow. */
220 bn_subw(a[0], borrow, &borrow, &r[0]); 152 bn_subw_subw(a[0], 0, borrow, &borrow, &r[0]);
221 diff_len--; 153 diff_len--;
222 a++; 154 a++;
223 r++; 155 r++;
diff --git a/src/lib/libcrypto/bn/bn_add_sub.c b/src/lib/libcrypto/bn/bn_add_sub.c
new file mode 100644
index 0000000000..5c9d5a2b1a
--- /dev/null
+++ b/src/lib/libcrypto/bn/bn_add_sub.c
@@ -0,0 +1,178 @@
1/* $OpenBSD: bn_add_sub.c,v 1.1 2025/05/25 04:30:55 jsing Exp $ */
2/*
3 * Copyright (c) 2023,2024,2025 Joel Sing <jsing@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#include <openssl/bn.h>
19
20#include "bn_internal.h"
21
22/*
23 * bn_add_words() computes (carry:r[i]) = a[i] + b[i] + carry, where a and b
24 * are both arrays of words. Any carry resulting from the addition is returned.
25 */
26#ifndef HAVE_BN_ADD_WORDS
27BN_ULONG
28bn_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n)
29{
30 BN_ULONG carry = 0;
31
32 while (n >= 4) {
33 bn_qwaddqw(a[3], a[2], a[1], a[0], b[3], b[2], b[1], b[0],
34 carry, &carry, &r[3], &r[2], &r[1], &r[0]);
35 a += 4;
36 b += 4;
37 r += 4;
38 n -= 4;
39 }
40 while (n > 0) {
41 bn_addw_addw(a[0], b[0], carry, &carry, &r[0]);
42 a++;
43 b++;
44 r++;
45 n--;
46 }
47
48 return carry;
49}
50#endif
51
52/*
53 * bn_sub_words() computes (borrow:r[i]) = a[i] - b[i] - borrow, where a and b
54 * are both arrays of words. Any borrow resulting from the subtraction is
55 * returned.
56 */
57#ifndef HAVE_BN_SUB_WORDS
58BN_ULONG
59bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n)
60{
61 BN_ULONG borrow = 0;
62
63 while (n >= 4) {
64 bn_qwsubqw(a[3], a[2], a[1], a[0], b[3], b[2], b[1], b[0],
65 borrow, &borrow, &r[3], &r[2], &r[1], &r[0]);
66 a += 4;
67 b += 4;
68 r += 4;
69 n -= 4;
70 }
71 while (n > 0) {
72 bn_subw_subw(a[0], b[0], borrow, &borrow, &r[0]);
73 a++;
74 b++;
75 r++;
76 n--;
77 }
78
79 return borrow;
80}
81#endif
82
83/*
84 * bn_sub_borrow() computes a[i] - b[i], returning the resulting borrow only.
85 */
86#ifndef HAVE_BN_SUB_WORDS_BORROW
87BN_ULONG
88bn_sub_words_borrow(const BN_ULONG *a, const BN_ULONG *b, size_t n)
89{
90 BN_ULONG borrow = 0;
91 BN_ULONG r;
92
93 while (n >= 4) {
94 bn_qwsubqw(a[3], a[2], a[1], a[0], b[3], b[2], b[1], b[0],
95 borrow, &borrow, &r, &r, &r, &r);
96 a += 4;
97 b += 4;
98 n -= 4;
99 }
100 while (n > 0) {
101 bn_subw_subw(a[0], b[0], borrow, &borrow, &r);
102 a++;
103 b++;
104 n--;
105 }
106
107 return borrow;
108}
109#endif
110
111/*
112 * bn_add_words_masked() computes r[] = a[] + (b[] & mask), where a, b and r are
113 * arrays of words with length n (r may be the same as a or b).
114 */
115#ifndef HAVE_BN_ADD_WORDS_MASKED
116BN_ULONG
117bn_add_words_masked(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
118 BN_ULONG mask, size_t n)
119{
120 BN_ULONG carry = 0;
121
122 /* XXX - consider conditional/masked versions of bn_addw_addw/bn_qwaddqw. */
123
124 while (n >= 4) {
125 bn_qwaddqw(a[3], a[2], a[1], a[0], b[3] & mask, b[2] & mask,
126 b[1] & mask, b[0] & mask, carry, &carry, &r[3], &r[2],
127 &r[1], &r[0]);
128 a += 4;
129 b += 4;
130 r += 4;
131 n -= 4;
132 }
133 while (n > 0) {
134 bn_addw_addw(a[0], b[0] & mask, carry, &carry, &r[0]);
135 a++;
136 b++;
137 r++;
138 n--;
139 }
140
141 return carry;
142}
143#endif
144
145/*
146 * bn_sub_words_masked() computes r[] = a[] - (b[] & mask), where a, b and r are
147 * arrays of words with length n (r may be the same as a or b).
148 */
149#ifndef HAVE_BN_SUB_WORDS_MASKED
150BN_ULONG
151bn_sub_words_masked(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
152 BN_ULONG mask, size_t n)
153{
154 BN_ULONG borrow = 0;
155
156 /* XXX - consider conditional/masked versions of bn_subw_subw/bn_qwsubqw. */
157
158 /* Compute conditional r[i] = a[i] - b[i]. */
159 while (n >= 4) {
160 bn_qwsubqw(a[3], a[2], a[1], a[0], b[3] & mask, b[2] & mask,
161 b[1] & mask, b[0] & mask, borrow, &borrow, &r[3], &r[2],
162 &r[1], &r[0]);
163 a += 4;
164 b += 4;
165 r += 4;
166 n -= 4;
167 }
168 while (n > 0) {
169 bn_subw_subw(a[0], b[0] & mask, borrow, &borrow, &r[0]);
170 a++;
171 b++;
172 r++;
173 n--;
174 }
175
176 return borrow;
177}
178#endif
diff --git a/src/lib/libcrypto/bn/bn_convert.c b/src/lib/libcrypto/bn/bn_convert.c
index 6a6354f44e..ca5c7d7865 100644
--- a/src/lib/libcrypto/bn/bn_convert.c
+++ b/src/lib/libcrypto/bn/bn_convert.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_convert.c,v 1.23 2024/11/08 14:18:44 jsing Exp $ */ 1/* $OpenBSD: bn_convert.c,v 1.24 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -65,11 +65,11 @@
65 65
66#include <openssl/bio.h> 66#include <openssl/bio.h>
67#include <openssl/buffer.h> 67#include <openssl/buffer.h>
68#include <openssl/err.h>
69 68
70#include "bn_local.h" 69#include "bn_local.h"
71#include "bytestring.h" 70#include "bytestring.h"
72#include "crypto_internal.h" 71#include "crypto_internal.h"
72#include "err_local.h"
73 73
74static int bn_dec2bn_cbs(BIGNUM **bnp, CBS *cbs); 74static int bn_dec2bn_cbs(BIGNUM **bnp, CBS *cbs);
75static int bn_hex2bn_cbs(BIGNUM **bnp, CBS *cbs); 75static int bn_hex2bn_cbs(BIGNUM **bnp, CBS *cbs);
diff --git a/src/lib/libcrypto/bn/bn_ctx.c b/src/lib/libcrypto/bn/bn_ctx.c
index 129b9c9781..eda93dcaa4 100644
--- a/src/lib/libcrypto/bn/bn_ctx.c
+++ b/src/lib/libcrypto/bn/bn_ctx.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_ctx.c,v 1.22 2023/07/08 12:21:58 beck Exp $ */ 1/* $OpenBSD: bn_ctx.c,v 1.23 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -19,9 +19,9 @@
19#include <string.h> 19#include <string.h>
20 20
21#include <openssl/opensslconf.h> 21#include <openssl/opensslconf.h>
22#include <openssl/err.h>
23 22
24#include "bn_local.h" 23#include "bn_local.h"
24#include "err_local.h"
25 25
26#define BN_CTX_INITIAL_LEN 8 26#define BN_CTX_INITIAL_LEN 8
27 27
diff --git a/src/lib/libcrypto/bn/bn_div.c b/src/lib/libcrypto/bn/bn_div.c
index 09a8a364df..1026b43add 100644
--- a/src/lib/libcrypto/bn/bn_div.c
+++ b/src/lib/libcrypto/bn/bn_div.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_div.c,v 1.41 2024/04/10 14:58:06 beck Exp $ */ 1/* $OpenBSD: bn_div.c,v 1.42 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -62,11 +62,11 @@
62#include <openssl/opensslconf.h> 62#include <openssl/opensslconf.h>
63 63
64#include <openssl/bn.h> 64#include <openssl/bn.h>
65#include <openssl/err.h>
66 65
67#include "bn_arch.h" 66#include "bn_arch.h"
68#include "bn_local.h" 67#include "bn_local.h"
69#include "bn_internal.h" 68#include "bn_internal.h"
69#include "err_local.h"
70 70
71BN_ULONG bn_div_3_words(const BN_ULONG *m, BN_ULONG d1, BN_ULONG d0); 71BN_ULONG bn_div_3_words(const BN_ULONG *m, BN_ULONG d1, BN_ULONG d0);
72 72
diff --git a/src/lib/libcrypto/bn/bn_exp.c b/src/lib/libcrypto/bn/bn_exp.c
index e925d325d2..6a5c1c857a 100644
--- a/src/lib/libcrypto/bn/bn_exp.c
+++ b/src/lib/libcrypto/bn/bn_exp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_exp.c,v 1.58 2025/02/13 11:15:09 tb Exp $ */ 1/* $OpenBSD: bn_exp.c,v 1.59 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -112,10 +112,9 @@
112#include <stdlib.h> 112#include <stdlib.h>
113#include <string.h> 113#include <string.h>
114 114
115#include <openssl/err.h>
116
117#include "bn_local.h" 115#include "bn_local.h"
118#include "constant_time.h" 116#include "constant_time.h"
117#include "err_local.h"
119 118
120/* maximum precomputation table size for *variable* sliding windows */ 119/* maximum precomputation table size for *variable* sliding windows */
121#define TABLE_SIZE 32 120#define TABLE_SIZE 32
diff --git a/src/lib/libcrypto/bn/bn_gcd.c b/src/lib/libcrypto/bn/bn_gcd.c
index fa5d71a7f3..319d9ca390 100644
--- a/src/lib/libcrypto/bn/bn_gcd.c
+++ b/src/lib/libcrypto/bn/bn_gcd.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_gcd.c,v 1.29 2024/04/10 14:58:06 beck Exp $ */ 1/* $OpenBSD: bn_gcd.c,v 1.31 2025/06/02 12:40:10 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -109,9 +109,8 @@
109 * 109 *
110 */ 110 */
111 111
112#include <openssl/err.h>
113
114#include "bn_local.h" 112#include "bn_local.h"
113#include "err_local.h"
115 114
116static BIGNUM * 115static BIGNUM *
117euclid(BIGNUM *a, BIGNUM *b) 116euclid(BIGNUM *a, BIGNUM *b)
@@ -681,8 +680,10 @@ BN_mod_inverse_internal(BIGNUM *in, const BIGNUM *a, const BIGNUM *n, BN_CTX *ct
681 /* A >= 2*B, so D=2 or D=3 */ 680 /* A >= 2*B, so D=2 or D=3 */
682 if (!BN_sub(M, A, T)) 681 if (!BN_sub(M, A, T))
683 goto err; 682 goto err;
684 if (!BN_add(D,T,B)) goto err; /* use D (:= 3*B) as temp */ 683 /* use D (:= 3*B) as temp */
685 if (BN_ucmp(A, D) < 0) { 684 if (!BN_add(D, T, B))
685 goto err;
686 if (BN_ucmp(A, D) < 0) {
686 /* A < 3*B, so D=2 */ 687 /* A < 3*B, so D=2 */
687 if (!BN_set_word(D, 2)) 688 if (!BN_set_word(D, 2))
688 goto err; 689 goto err;
diff --git a/src/lib/libcrypto/bn/bn_internal.h b/src/lib/libcrypto/bn/bn_internal.h
index fd04bc9f8a..8b5145e225 100644
--- a/src/lib/libcrypto/bn/bn_internal.h
+++ b/src/lib/libcrypto/bn/bn_internal.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_internal.h,v 1.15 2023/06/25 11:42:26 jsing Exp $ */ 1/* $OpenBSD: bn_internal.h,v 1.20 2025/08/02 16:20:00 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -26,6 +26,30 @@ int bn_word_clz(BN_ULONG w);
26 26
27int bn_bitsize(const BIGNUM *bn); 27int bn_bitsize(const BIGNUM *bn);
28 28
29BN_ULONG bn_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
30 int num);
31BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
32 int num);
33BN_ULONG bn_sub_words_borrow(const BN_ULONG *a, const BN_ULONG *b, size_t n);
34BN_ULONG bn_add_words_masked(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
35 BN_ULONG mask, size_t n);
36BN_ULONG bn_sub_words_masked(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
37 BN_ULONG mask, size_t n);
38void bn_mod_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
39 const BN_ULONG *m, size_t n);
40void bn_mod_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
41 const BN_ULONG *m, size_t n);
42void bn_mod_mul_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
43 const BN_ULONG *m, BN_ULONG *t, BN_ULONG m0, size_t n);
44void bn_mod_sqr_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *m,
45 BN_ULONG *t, BN_ULONG m0, size_t n);
46
47void bn_montgomery_multiply_words(BN_ULONG *rp, const BN_ULONG *ap,
48 const BN_ULONG *bp, const BN_ULONG *np, BN_ULONG *tp, BN_ULONG n0,
49 int n_len);
50void bn_montgomery_reduce_words(BN_ULONG *r, BN_ULONG *a, const BN_ULONG *n,
51 BN_ULONG n0, int n_len);
52
29#ifndef HAVE_BN_CT_NE_ZERO 53#ifndef HAVE_BN_CT_NE_ZERO
30static inline int 54static inline int
31bn_ct_ne_zero(BN_ULONG w) 55bn_ct_ne_zero(BN_ULONG w)
diff --git a/src/lib/libcrypto/bn/bn_isqrt.c b/src/lib/libcrypto/bn/bn_isqrt.c
index 018d5f34bd..b725519e1a 100644
--- a/src/lib/libcrypto/bn/bn_isqrt.c
+++ b/src/lib/libcrypto/bn/bn_isqrt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_isqrt.c,v 1.10 2023/06/04 17:28:35 tb Exp $ */ 1/* $OpenBSD: bn_isqrt.c,v 1.11 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> 3 * Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
4 * 4 *
@@ -19,10 +19,10 @@
19#include <stdint.h> 19#include <stdint.h>
20 20
21#include <openssl/bn.h> 21#include <openssl/bn.h>
22#include <openssl/err.h>
23 22
24#include "bn_local.h" 23#include "bn_local.h"
25#include "crypto_internal.h" 24#include "crypto_internal.h"
25#include "err_local.h"
26 26
27/* 27/*
28 * Calculate integer square root of |n| using a variant of Newton's method. 28 * Calculate integer square root of |n| using a variant of Newton's method.
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c
index 72b988650c..3e451a6191 100644
--- a/src/lib/libcrypto/bn/bn_lib.c
+++ b/src/lib/libcrypto/bn/bn_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_lib.c,v 1.93 2024/04/16 13:07:14 jsing Exp $ */ 1/* $OpenBSD: bn_lib.c,v 1.94 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -63,10 +63,9 @@
63 63
64#include <openssl/opensslconf.h> 64#include <openssl/opensslconf.h>
65 65
66#include <openssl/err.h>
67
68#include "bn_local.h" 66#include "bn_local.h"
69#include "bn_internal.h" 67#include "bn_internal.h"
68#include "err_local.h"
70 69
71BIGNUM * 70BIGNUM *
72BN_new(void) 71BN_new(void)
diff --git a/src/lib/libcrypto/bn/bn_local.h b/src/lib/libcrypto/bn/bn_local.h
index 067ffab3d9..1bd4c16baf 100644
--- a/src/lib/libcrypto/bn/bn_local.h
+++ b/src/lib/libcrypto/bn/bn_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_local.h,v 1.50 2025/02/13 11:04:20 tb Exp $ */ 1/* $OpenBSD: bn_local.h,v 1.54 2025/08/05 15:08:13 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -240,10 +240,12 @@ BN_ULONG bn_sub(BN_ULONG *r, int r_len, const BN_ULONG *a, int a_len,
240 const BN_ULONG *b, int b_len); 240 const BN_ULONG *b, int b_len);
241 241
242void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb); 242void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb);
243void bn_mul_comba4(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b); 243void bn_mul_comba4(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b);
244void bn_mul_comba8(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b); 244void bn_mul_comba6(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b);
245void bn_mul_comba8(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b);
245 246
246void bn_sqr_comba4(BN_ULONG *r, const BN_ULONG *a); 247void bn_sqr_comba4(BN_ULONG *r, const BN_ULONG *a);
248void bn_sqr_comba6(BN_ULONG *r, const BN_ULONG *a);
247void bn_sqr_comba8(BN_ULONG *r, const BN_ULONG *a); 249void bn_sqr_comba8(BN_ULONG *r, const BN_ULONG *a);
248 250
249int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, 251int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
@@ -254,10 +256,6 @@ int bn_expand_bits(BIGNUM *a, size_t bits);
254int bn_expand_bytes(BIGNUM *a, size_t bytes); 256int bn_expand_bytes(BIGNUM *a, size_t bytes);
255int bn_wexpand(BIGNUM *a, int words); 257int bn_wexpand(BIGNUM *a, int words);
256 258
257BN_ULONG bn_add_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
258 int num);
259BN_ULONG bn_sub_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
260 int num);
261BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w); 259BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w);
262BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w); 260BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w);
263void bn_sqr_words(BN_ULONG *rp, const BN_ULONG *ap, int num); 261void bn_sqr_words(BN_ULONG *rp, const BN_ULONG *ap, int num);
diff --git a/src/lib/libcrypto/bn/bn_mod.c b/src/lib/libcrypto/bn/bn_mod.c
index 365f6fcf03..7198c02e3b 100644
--- a/src/lib/libcrypto/bn/bn_mod.c
+++ b/src/lib/libcrypto/bn/bn_mod.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_mod.c,v 1.22 2023/07/08 12:21:58 beck Exp $ */ 1/* $OpenBSD: bn_mod.c,v 1.23 2025/05/10 05:54:38 tb Exp $ */
2/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> 2/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de>
3 * for the OpenSSL project. */ 3 * for the OpenSSL project. */
4/* ==================================================================== 4/* ====================================================================
@@ -111,9 +111,8 @@
111 * [including the GNU Public Licence.] 111 * [including the GNU Public Licence.]
112 */ 112 */
113 113
114#include <openssl/err.h>
115
116#include "bn_local.h" 114#include "bn_local.h"
115#include "err_local.h"
117 116
118int 117int
119BN_mod_ct(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx) 118BN_mod_ct(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx)
diff --git a/src/lib/libcrypto/bn/bn_mod_sqrt.c b/src/lib/libcrypto/bn/bn_mod_sqrt.c
index 280002cc48..fc55f84317 100644
--- a/src/lib/libcrypto/bn/bn_mod_sqrt.c
+++ b/src/lib/libcrypto/bn/bn_mod_sqrt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_mod_sqrt.c,v 1.3 2023/08/03 18:53:55 tb Exp $ */ 1/* $OpenBSD: bn_mod_sqrt.c,v 1.4 2025/05/10 05:54:38 tb Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> 4 * Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
@@ -16,9 +16,8 @@
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 17 */
18 18
19#include <openssl/err.h>
20
21#include "bn_local.h" 19#include "bn_local.h"
20#include "err_local.h"
22 21
23/* 22/*
24 * Tonelli-Shanks according to H. Cohen "A Course in Computational Algebraic 23 * Tonelli-Shanks according to H. Cohen "A Course in Computational Algebraic
diff --git a/src/lib/libcrypto/bn/bn_mod_words.c b/src/lib/libcrypto/bn/bn_mod_words.c
new file mode 100644
index 0000000000..d9aee8701a
--- /dev/null
+++ b/src/lib/libcrypto/bn/bn_mod_words.c
@@ -0,0 +1,114 @@
1/* $OpenBSD: bn_mod_words.c,v 1.3 2025/08/05 15:15:54 jsing Exp $ */
2/*
3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#include "bn_local.h"
19#include "bn_internal.h"
20
21/*
22 * bn_mod_add_words() computes r[] = (a[] + b[]) mod m[], where a, b, r and
23 * m are arrays of words with length n (r may be the same as a or b).
24 */
25#ifndef HAVE_BN_MOD_ADD_WORDS
26void
27bn_mod_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
28 const BN_ULONG *m, size_t n)
29{
30 BN_ULONG carry, mask;
31
32 /*
33 * Compute a + b, then compute r - m to determine if r >= m, considering
34 * any carry that resulted from the addition. Finally complete a
35 * conditional subtraction of r - m.
36 */
37 /* XXX - change bn_add_words to use size_t. */
38 carry = bn_add_words(r, a, b, n);
39 mask = ~(carry - bn_sub_words_borrow(r, m, n));
40 bn_sub_words_masked(r, r, m, mask, n);
41}
42#endif
43
44/*
45 * bn_mod_sub_words() computes r[] = (a[] - b[]) mod m[], where a, b, r and
46 * m are arrays of words with length n (r may be the same as a or b).
47 */
48#ifndef HAVE_BN_MOD_SUB_WORDS
49void
50bn_mod_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
51 const BN_ULONG *m, size_t n)
52{
53 BN_ULONG borrow, mask;
54
55 /*
56 * Compute a - b, then complete a conditional addition of r + m
57 * based on the resulting borrow.
58 */
59 /* XXX - change bn_sub_words to use size_t. */
60 borrow = bn_sub_words(r, a, b, n);
61 mask = (0 - borrow);
62 bn_add_words_masked(r, r, m, mask, n);
63}
64#endif
65
66/*
67 * bn_mod_mul_words() computes r[] = (a[] * b[]) mod m[], where a, b, r and
68 * m are arrays of words with length n (r may be the same as a or b) in the
69 * Montgomery domain. The result remains in the Montgomery domain.
70 */
71#ifndef HAVE_BN_MOD_MUL_WORDS
72void
73bn_mod_mul_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
74 const BN_ULONG *m, BN_ULONG *t, BN_ULONG m0, size_t n)
75{
76 if (n == 4) {
77 bn_mul_comba4(t, a, b);
78 bn_montgomery_reduce_words(r, t, m, m0, n);
79 } else if (n == 6) {
80 bn_mul_comba6(t, a, b);
81 bn_montgomery_reduce_words(r, t, m, m0, n);
82 } else if (n == 8) {
83 bn_mul_comba8(t, a, b);
84 bn_montgomery_reduce_words(r, t, m, m0, n);
85 } else {
86 bn_montgomery_multiply_words(r, a, b, m, t, m0, n);
87 }
88}
89#endif
90
91/*
92 * bn_mod_sqr_words() computes r[] = (a[] * a[]) mod m[], where a, r and
93 * m are arrays of words with length n (r may be the same as a) in the
94 * Montgomery domain. The result remains in the Montgomery domain.
95 */
96#ifndef HAVE_BN_MOD_SQR_WORDS
97void
98bn_mod_sqr_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *m,
99 BN_ULONG *t, BN_ULONG m0, size_t n)
100{
101 if (n == 4) {
102 bn_sqr_comba4(t, a);
103 bn_montgomery_reduce_words(r, t, m, m0, n);
104 } else if (n == 6) {
105 bn_sqr_comba6(t, a);
106 bn_montgomery_reduce_words(r, t, m, m0, n);
107 } else if (n == 8) {
108 bn_sqr_comba8(t, a);
109 bn_montgomery_reduce_words(r, t, m, m0, n);
110 } else {
111 bn_montgomery_multiply_words(r, a, a, m, t, m0, n);
112 }
113}
114#endif
diff --git a/src/lib/libcrypto/bn/bn_mont.c b/src/lib/libcrypto/bn/bn_mont.c
index edd7bcd0c8..8280a8db27 100644
--- a/src/lib/libcrypto/bn/bn_mont.c
+++ b/src/lib/libcrypto/bn/bn_mont.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_mont.c,v 1.66 2025/03/09 15:22:40 tb Exp $ */ 1/* $OpenBSD: bn_mont.c,v 1.69 2025/08/03 10:33:46 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -116,6 +116,7 @@
116 * sections 3.8 and 4.2 in http://security.ece.orst.edu/koc/papers/r01rsasw.pdf 116 * sections 3.8 and 4.2 in http://security.ece.orst.edu/koc/papers/r01rsasw.pdf
117 */ 117 */
118 118
119#include <limits.h>
119#include <stdio.h> 120#include <stdio.h>
120#include <stdint.h> 121#include <stdint.h>
121#include <string.h> 122#include <string.h>
@@ -214,7 +215,7 @@ BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
214 goto err; 215 goto err;
215 mont->N.neg = 0; 216 mont->N.neg = 0;
216 mont->ri = ((BN_num_bits(mod) + BN_BITS2 - 1) / BN_BITS2) * BN_BITS2; 217 mont->ri = ((BN_num_bits(mod) + BN_BITS2 - 1) / BN_BITS2) * BN_BITS2;
217 if (mont->ri * 2 < mont->ri) 218 if (mont->ri > INT_MAX / 2)
218 goto err; 219 goto err;
219 220
220 /* 221 /*
@@ -316,6 +317,44 @@ BN_MONT_CTX_set_locked(BN_MONT_CTX **pmctx, int lock, const BIGNUM *mod,
316LCRYPTO_ALIAS(BN_MONT_CTX_set_locked); 317LCRYPTO_ALIAS(BN_MONT_CTX_set_locked);
317 318
318/* 319/*
320 * bn_montgomery_reduce_words() performs Montgomery reduction, reducing the input
321 * from its Montgomery form aR to a, returning the result in r. a must be twice
322 * the length of the modulus. Note that the input is mutated in the process of
323 * performing the reduction.
324 */
325void
326bn_montgomery_reduce_words(BN_ULONG *r, BN_ULONG *a, const BN_ULONG *n,
327 BN_ULONG n0, int n_len)
328{
329 BN_ULONG v, mask;
330 BN_ULONG carry = 0;
331 int i;
332
333 /* Add multiples of the modulus, so that it becomes divisible by R. */
334 for (i = 0; i < n_len; i++) {
335 v = bn_mul_add_words(&a[i], n, n_len, a[i] * n0);
336 bn_addw_addw(v, a[i + n_len], carry, &carry, &a[i + n_len]);
337 }
338
339 /* Divide by R (this is the equivalent of right shifting by n_len). */
340 a = &a[n_len];
341
342 /*
343 * The output is now in the range of [0, 2N). Attempt to reduce once by
344 * subtracting the modulus. If the reduction was necessary then the
345 * result is already in r, otherwise copy the value prior to reduction
346 * from the top half of a.
347 */
348 mask = carry - bn_sub_words(r, a, n, n_len);
349
350 for (i = 0; i < n_len; i++) {
351 *r = (*r & ~mask) | (*a & mask);
352 r++;
353 a++;
354 }
355}
356
357/*
319 * bn_montgomery_reduce() performs Montgomery reduction, reducing the input 358 * bn_montgomery_reduce() performs Montgomery reduction, reducing the input
320 * from its Montgomery form aR to a, returning the result in r. Note that the 359 * from its Montgomery form aR to a, returning the result in r. Note that the
321 * input is mutated in the process of performing the reduction, destroying its 360 * input is mutated in the process of performing the reduction, destroying its
@@ -325,7 +364,6 @@ static int
325bn_montgomery_reduce(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mctx) 364bn_montgomery_reduce(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mctx)
326{ 365{
327 BIGNUM *n; 366 BIGNUM *n;
328 BN_ULONG *ap, *rp, n0, v, carry, mask;
329 int i, max, n_len; 367 int i, max, n_len;
330 368
331 n = &mctx->N; 369 n = &mctx->N;
@@ -341,7 +379,8 @@ bn_montgomery_reduce(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mctx)
341 379
342 /* 380 /*
343 * Expand a to twice the length of the modulus, zero if necessary. 381 * Expand a to twice the length of the modulus, zero if necessary.
344 * XXX - make this a requirement of the caller. 382 * XXX - make this a requirement of the caller or use a temporary
383 * allocation.
345 */ 384 */
346 if ((max = 2 * n_len) < n_len) 385 if ((max = 2 * n_len) < n_len)
347 return 0; 386 return 0;
@@ -350,33 +389,8 @@ bn_montgomery_reduce(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mctx)
350 for (i = a->top; i < max; i++) 389 for (i = a->top; i < max; i++)
351 a->d[i] = 0; 390 a->d[i] = 0;
352 391
353 carry = 0; 392 bn_montgomery_reduce_words(r->d, a->d, n->d, mctx->n0[0], n_len);
354 n0 = mctx->n0[0];
355 393
356 /* Add multiples of the modulus, so that it becomes divisible by R. */
357 for (i = 0; i < n_len; i++) {
358 v = bn_mul_add_words(&a->d[i], n->d, n_len, a->d[i] * n0);
359 bn_addw_addw(v, a->d[i + n_len], carry, &carry,
360 &a->d[i + n_len]);
361 }
362
363 /* Divide by R (this is the equivalent of right shifting by n_len). */
364 ap = &a->d[n_len];
365
366 /*
367 * The output is now in the range of [0, 2N). Attempt to reduce once by
368 * subtracting the modulus. If the reduction was necessary then the
369 * result is already in r, otherwise copy the value prior to reduction
370 * from the top half of a.
371 */
372 mask = carry - bn_sub_words(r->d, ap, n->d, n_len);
373
374 rp = r->d;
375 for (i = 0; i < n_len; i++) {
376 *rp = (*rp & ~mask) | (*ap & mask);
377 rp++;
378 ap++;
379 }
380 r->top = n_len; 394 r->top = n_len;
381 395
382 bn_correct_top(r); 396 bn_correct_top(r);
@@ -417,7 +431,7 @@ bn_mod_mul_montgomery_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
417 return ret; 431 return ret;
418} 432}
419 433
420static void 434static inline void
421bn_montgomery_multiply_word(const BN_ULONG *ap, BN_ULONG b, const BN_ULONG *np, 435bn_montgomery_multiply_word(const BN_ULONG *ap, BN_ULONG b, const BN_ULONG *np,
422 BN_ULONG *tp, BN_ULONG w, BN_ULONG *carry_a, BN_ULONG *carry_n, int n_len) 436 BN_ULONG *tp, BN_ULONG w, BN_ULONG *carry_a, BN_ULONG *carry_n, int n_len)
423{ 437{
@@ -452,7 +466,7 @@ bn_montgomery_multiply_word(const BN_ULONG *ap, BN_ULONG b, const BN_ULONG *np,
452 * given word arrays. The caller must ensure that rp, ap, bp and np are all 466 * given word arrays. The caller must ensure that rp, ap, bp and np are all
453 * n_len words in length, while tp must be n_len * 2 + 2 words in length. 467 * n_len words in length, while tp must be n_len * 2 + 2 words in length.
454 */ 468 */
455static void 469void
456bn_montgomery_multiply_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, 470bn_montgomery_multiply_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
457 const BN_ULONG *np, BN_ULONG *tp, BN_ULONG n0, int n_len) 471 const BN_ULONG *np, BN_ULONG *tp, BN_ULONG n0, int n_len)
458{ 472{
diff --git a/src/lib/libcrypto/bn/bn_mul.c b/src/lib/libcrypto/bn/bn_mul.c
index bdeb9b0fe8..70f6534b8f 100644
--- a/src/lib/libcrypto/bn/bn_mul.c
+++ b/src/lib/libcrypto/bn/bn_mul.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_mul.c,v 1.39 2023/07/08 12:21:58 beck Exp $ */ 1/* $OpenBSD: bn_mul.c,v 1.42 2025/08/05 15:06:13 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -57,6 +57,7 @@
57 */ 57 */
58 58
59#include <assert.h> 59#include <assert.h>
60#include <limits.h>
60#include <stdio.h> 61#include <stdio.h>
61#include <string.h> 62#include <string.h>
62 63
@@ -73,7 +74,7 @@
73 */ 74 */
74#ifndef HAVE_BN_MUL_COMBA4 75#ifndef HAVE_BN_MUL_COMBA4
75void 76void
76bn_mul_comba4(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b) 77bn_mul_comba4(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b)
77{ 78{
78 BN_ULONG c0, c1, c2; 79 BN_ULONG c0, c1, c2;
79 80
@@ -103,13 +104,73 @@ bn_mul_comba4(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b)
103#endif 104#endif
104 105
105/* 106/*
107 * bn_mul_comba6() computes r[] = a[] * b[] using Comba multiplication
108 * (https://everything2.com/title/Comba+multiplication), where a and b are both
109 * six word arrays, producing a 12 word array result.
110 */
111#ifndef HAVE_BN_MUL_COMBA6
112void
113bn_mul_comba6(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b)
114{
115 BN_ULONG c0, c1, c2;
116
117 bn_mulw_addtw(a[0], b[0], 0, 0, 0, &c2, &c1, &r[0]);
118
119 bn_mulw_addtw(a[0], b[1], 0, c2, c1, &c2, &c1, &c0);
120 bn_mulw_addtw(a[1], b[0], c2, c1, c0, &c2, &c1, &r[1]);
121
122 bn_mulw_addtw(a[2], b[0], 0, c2, c1, &c2, &c1, &c0);
123 bn_mulw_addtw(a[1], b[1], c2, c1, c0, &c2, &c1, &c0);
124 bn_mulw_addtw(a[0], b[2], c2, c1, c0, &c2, &c1, &r[2]);
125
126 bn_mulw_addtw(a[0], b[3], 0, c2, c1, &c2, &c1, &c0);
127 bn_mulw_addtw(a[1], b[2], c2, c1, c0, &c2, &c1, &c0);
128 bn_mulw_addtw(a[2], b[1], c2, c1, c0, &c2, &c1, &c0);
129 bn_mulw_addtw(a[3], b[0], c2, c1, c0, &c2, &c1, &r[3]);
130
131 bn_mulw_addtw(a[4], b[0], 0, c2, c1, &c2, &c1, &c0);
132 bn_mulw_addtw(a[3], b[1], c2, c1, c0, &c2, &c1, &c0);
133 bn_mulw_addtw(a[2], b[2], c2, c1, c0, &c2, &c1, &c0);
134 bn_mulw_addtw(a[1], b[3], c2, c1, c0, &c2, &c1, &c0);
135 bn_mulw_addtw(a[0], b[4], c2, c1, c0, &c2, &c1, &r[4]);
136
137 bn_mulw_addtw(a[0], b[5], 0, c2, c1, &c2, &c1, &c0);
138 bn_mulw_addtw(a[1], b[4], c2, c1, c0, &c2, &c1, &c0);
139 bn_mulw_addtw(a[2], b[3], c2, c1, c0, &c2, &c1, &c0);
140 bn_mulw_addtw(a[3], b[2], c2, c1, c0, &c2, &c1, &c0);
141 bn_mulw_addtw(a[4], b[1], c2, c1, c0, &c2, &c1, &c0);
142 bn_mulw_addtw(a[5], b[0], c2, c1, c0, &c2, &c1, &r[5]);
143
144 bn_mulw_addtw(a[5], b[1], 0, c2, c1, &c2, &c1, &c0);
145 bn_mulw_addtw(a[4], b[2], c2, c1, c0, &c2, &c1, &c0);
146 bn_mulw_addtw(a[3], b[3], c2, c1, c0, &c2, &c1, &c0);
147 bn_mulw_addtw(a[2], b[4], c2, c1, c0, &c2, &c1, &c0);
148 bn_mulw_addtw(a[1], b[5], c2, c1, c0, &c2, &c1, &r[6]);
149
150 bn_mulw_addtw(a[2], b[5], 0, c2, c1, &c2, &c1, &c0);
151 bn_mulw_addtw(a[3], b[4], c2, c1, c0, &c2, &c1, &c0);
152 bn_mulw_addtw(a[4], b[3], c2, c1, c0, &c2, &c1, &c0);
153 bn_mulw_addtw(a[5], b[2], c2, c1, c0, &c2, &c1, &r[7]);
154
155 bn_mulw_addtw(a[5], b[3], 0, c2, c1, &c2, &c1, &c0);
156 bn_mulw_addtw(a[4], b[4], c2, c1, c0, &c2, &c1, &c0);
157 bn_mulw_addtw(a[3], b[5], c2, c1, c0, &c2, &c1, &r[8]);
158
159 bn_mulw_addtw(a[4], b[5], 0, c2, c1, &c2, &c1, &c0);
160 bn_mulw_addtw(a[5], b[4], c2, c1, c0, &c2, &c1, &r[9]);
161
162 bn_mulw_addtw(a[5], b[5], 0, c2, c1, &c2, &r[11], &r[10]);
163}
164#endif
165
166/*
106 * bn_mul_comba8() computes r[] = a[] * b[] using Comba multiplication 167 * bn_mul_comba8() computes r[] = a[] * b[] using Comba multiplication
107 * (https://everything2.com/title/Comba+multiplication), where a and b are both 168 * (https://everything2.com/title/Comba+multiplication), where a and b are both
108 * eight word arrays, producing a 16 word array result. 169 * eight word arrays, producing a 16 word array result.
109 */ 170 */
110#ifndef HAVE_BN_MUL_COMBA8 171#ifndef HAVE_BN_MUL_COMBA8
111void 172void
112bn_mul_comba8(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b) 173bn_mul_comba8(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b)
113{ 174{
114 BN_ULONG c0, c1, c2; 175 BN_ULONG c0, c1, c2;
115 176
@@ -338,9 +399,9 @@ BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
338 if (rr == NULL) 399 if (rr == NULL)
339 goto err; 400 goto err;
340 401
341 rn = a->top + b->top; 402 if (a->top > INT_MAX - b->top)
342 if (rn < a->top)
343 goto err; 403 goto err;
404 rn = a->top + b->top;
344 if (!bn_wexpand(rr, rn)) 405 if (!bn_wexpand(rr, rn))
345 goto err; 406 goto err;
346 407
diff --git a/src/lib/libcrypto/bn/bn_prime.c b/src/lib/libcrypto/bn/bn_prime.c
index 5a4aa50bf1..d85595e0dd 100644
--- a/src/lib/libcrypto/bn/bn_prime.c
+++ b/src/lib/libcrypto/bn/bn_prime.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_prime.c,v 1.34 2023/07/20 06:26:27 tb Exp $ */ 1/* $OpenBSD: bn_prime.c,v 1.35 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -112,9 +112,8 @@
112#include <stdio.h> 112#include <stdio.h>
113#include <time.h> 113#include <time.h>
114 114
115#include <openssl/err.h>
116
117#include "bn_local.h" 115#include "bn_local.h"
116#include "err_local.h"
118 117
119/* The quick sieve algorithm approach to weeding out primes is 118/* The quick sieve algorithm approach to weeding out primes is
120 * Philip Zimmermann's, as implemented in PGP. I have had a read of 119 * Philip Zimmermann's, as implemented in PGP. I have had a read of
diff --git a/src/lib/libcrypto/bn/bn_rand.c b/src/lib/libcrypto/bn/bn_rand.c
index 9cfcd8e2c0..d3b16f70a0 100644
--- a/src/lib/libcrypto/bn/bn_rand.c
+++ b/src/lib/libcrypto/bn/bn_rand.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_rand.c,v 1.30 2024/03/16 20:42:33 tb Exp $ */ 1/* $OpenBSD: bn_rand.c,v 1.31 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -115,9 +115,8 @@
115#include <string.h> 115#include <string.h>
116#include <time.h> 116#include <time.h>
117 117
118#include <openssl/err.h>
119
120#include "bn_local.h" 118#include "bn_local.h"
119#include "err_local.h"
121 120
122static int 121static int
123bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) 122bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
diff --git a/src/lib/libcrypto/bn/bn_recp.c b/src/lib/libcrypto/bn/bn_recp.c
index e3f22c52a9..ed5049b772 100644
--- a/src/lib/libcrypto/bn/bn_recp.c
+++ b/src/lib/libcrypto/bn/bn_recp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_recp.c,v 1.33 2025/02/04 20:22:20 tb Exp $ */ 1/* $OpenBSD: bn_recp.c,v 1.34 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -58,9 +58,8 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60 60
61#include <openssl/err.h>
62
63#include "bn_local.h" 61#include "bn_local.h"
62#include "err_local.h"
64 63
65struct bn_recp_ctx_st { 64struct bn_recp_ctx_st {
66 BIGNUM *N; /* the divisor */ 65 BIGNUM *N; /* the divisor */
diff --git a/src/lib/libcrypto/bn/bn_shift.c b/src/lib/libcrypto/bn/bn_shift.c
index 12edc7c0a0..b9f73cc322 100644
--- a/src/lib/libcrypto/bn/bn_shift.c
+++ b/src/lib/libcrypto/bn/bn_shift.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_shift.c,v 1.22 2023/07/08 12:21:58 beck Exp $ */ 1/* $OpenBSD: bn_shift.c,v 1.23 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2022, 2023 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2022, 2023 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -16,9 +16,9 @@
16 */ 16 */
17 17
18#include <openssl/bn.h> 18#include <openssl/bn.h>
19#include <openssl/err.h>
20 19
21#include "bn_local.h" 20#include "bn_local.h"
21#include "err_local.h"
22 22
23static inline int 23static inline int
24bn_lshift(BIGNUM *r, const BIGNUM *a, int n) 24bn_lshift(BIGNUM *r, const BIGNUM *a, int n)
diff --git a/src/lib/libcrypto/bn/bn_sqr.c b/src/lib/libcrypto/bn/bn_sqr.c
index 0dbccbf85d..ab1282e3b1 100644
--- a/src/lib/libcrypto/bn/bn_sqr.c
+++ b/src/lib/libcrypto/bn/bn_sqr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_sqr.c,v 1.36 2023/07/08 12:21:58 beck Exp $ */ 1/* $OpenBSD: bn_sqr.c,v 1.37 2025/08/05 15:08:13 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -97,6 +97,51 @@ bn_sqr_comba4(BN_ULONG *r, const BN_ULONG *a)
97#endif 97#endif
98 98
99/* 99/*
100 * bn_sqr_comba6() computes r[] = a[] * a[] using Comba multiplication
101 * (https://everything2.com/title/Comba+multiplication), where a is an
102 * six word array, producing an 12 word array result.
103 */
104#ifndef HAVE_BN_SQR_COMBA6
105void
106bn_sqr_comba6(BN_ULONG *r, const BN_ULONG *a)
107{
108 BN_ULONG c2, c1, c0;
109
110 bn_mulw_addtw(a[0], a[0], 0, 0, 0, &c2, &c1, &r[0]);
111
112 bn_mul2_mulw_addtw(a[1], a[0], 0, c2, c1, &c2, &c1, &r[1]);
113
114 bn_mulw_addtw(a[1], a[1], 0, c2, c1, &c2, &c1, &c0);
115 bn_mul2_mulw_addtw(a[2], a[0], c2, c1, c0, &c2, &c1, &r[2]);
116
117 bn_mul2_mulw_addtw(a[3], a[0], 0, c2, c1, &c2, &c1, &c0);
118 bn_mul2_mulw_addtw(a[2], a[1], c2, c1, c0, &c2, &c1, &r[3]);
119
120 bn_mulw_addtw(a[2], a[2], 0, c2, c1, &c2, &c1, &c0);
121 bn_mul2_mulw_addtw(a[3], a[1], c2, c1, c0, &c2, &c1, &c0);
122 bn_mul2_mulw_addtw(a[4], a[0], c2, c1, c0, &c2, &c1, &r[4]);
123
124 bn_mul2_mulw_addtw(a[5], a[0], 0, c2, c1, &c2, &c1, &c0);
125 bn_mul2_mulw_addtw(a[4], a[1], c2, c1, c0, &c2, &c1, &c0);
126 bn_mul2_mulw_addtw(a[3], a[2], c2, c1, c0, &c2, &c1, &r[5]);
127
128 bn_mulw_addtw(a[3], a[3], 0, c2, c1, &c2, &c1, &c0);
129 bn_mul2_mulw_addtw(a[4], a[2], c2, c1, c0, &c2, &c1, &c0);
130 bn_mul2_mulw_addtw(a[5], a[1], c2, c1, c0, &c2, &c1, &r[6]);
131
132 bn_mul2_mulw_addtw(a[5], a[2], 0, c2, c1, &c2, &c1, &c0);
133 bn_mul2_mulw_addtw(a[4], a[3], c2, c1, c0, &c2, &c1, &r[7]);
134
135 bn_mulw_addtw(a[4], a[4], 0, c2, c1, &c2, &c1, &c0);
136 bn_mul2_mulw_addtw(a[5], a[3], c2, c1, c0, &c2, &c1, &r[8]);
137
138 bn_mul2_mulw_addtw(a[5], a[4], 0, c2, c1, &c2, &c1, &r[9]);
139
140 bn_mulw_addtw(a[5], a[5], 0, c2, c1, &c2, &r[11], &r[10]);
141}
142#endif
143
144/*
100 * bn_sqr_comba8() computes r[] = a[] * a[] using Comba multiplication 145 * bn_sqr_comba8() computes r[] = a[] * a[] using Comba multiplication
101 * (https://everything2.com/title/Comba+multiplication), where a is an 146 * (https://everything2.com/title/Comba+multiplication), where a is an
102 * eight word array, producing an 16 word array result. 147 * eight word array, producing an 16 word array result.
diff --git a/src/lib/libcrypto/buffer/buffer.c b/src/lib/libcrypto/buffer/buffer.c
index 51ce90ff80..4a0c17c598 100644
--- a/src/lib/libcrypto/buffer/buffer.c
+++ b/src/lib/libcrypto/buffer/buffer.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: buffer.c,v 1.28 2023/07/08 08:26:26 beck Exp $ */ 1/* $OpenBSD: buffer.c,v 1.29 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -61,7 +61,8 @@
61#include <string.h> 61#include <string.h>
62 62
63#include <openssl/buffer.h> 63#include <openssl/buffer.h>
64#include <openssl/err.h> 64
65#include "err_local.h"
65 66
66/* 67/*
67 * LIMIT_BEFORE_EXPANSION is the maximum n such that (n + 3) / 3 * 4 < 2**31. 68 * LIMIT_BEFORE_EXPANSION is the maximum n such that (n + 3) / 3 * 4 < 2**31.
diff --git a/src/lib/libcrypto/bytestring/bs_ber.c b/src/lib/libcrypto/bytestring/bs_ber.c
index eb1eed6185..6d7daaf77f 100644
--- a/src/lib/libcrypto/bytestring/bs_ber.c
+++ b/src/lib/libcrypto/bytestring/bs_ber.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bs_ber.c,v 1.3 2024/05/25 15:12:47 tb Exp $ */ 1/* $OpenBSD: bs_ber.c,v 1.4 2025/03/28 12:13:03 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2014, Google Inc. 3 * Copyright (c) 2014, Google Inc.
4 * 4 *
@@ -161,7 +161,7 @@ cbs_convert_indefinite(CBS *in, CBB *out, char squash_header,
161 * This is a hack, but it sufficies to handle 161 * This is a hack, but it sufficies to handle
162 * NSS's output. If we find an indefinite 162 * NSS's output. If we find an indefinite
163 * length, context-specific tag with a definite, 163 * length, context-specific tag with a definite,
164 * primtive tag inside it, then we assume that 164 * primitive tag inside it, then we assume that
165 * the context-specific tag is implicit and the 165 * the context-specific tag is implicit and the
166 * tags within are fragments of a primitive type 166 * tags within are fragments of a primitive type
167 * that need to be concatenated. 167 * that need to be concatenated.
diff --git a/src/lib/libcrypto/cert.pem b/src/lib/libcrypto/cert.pem
index 4d4d9f82b3..aadf2deb9b 100644
--- a/src/lib/libcrypto/cert.pem
+++ b/src/lib/libcrypto/cert.pem
@@ -1,4 +1,4 @@
1# $OpenBSD: cert.pem,v 1.30 2024/11/01 11:30:12 tb Exp $ 1# $OpenBSD: cert.pem,v 1.32 2025/08/06 09:45:53 sthen Exp $
2### /C=ES/CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 2### /C=ES/CN=Autoridad de Certificacion Firmaprofesional CIF A62634068
3 3
4=== /C=ES/CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 4=== /C=ES/CN=Autoridad de Certificacion Firmaprofesional CIF A62634068
@@ -960,49 +960,6 @@ AgEGMAoGCCqGSM49BAMDA2gAMGUCMBq8W9f+qdJUDkpd0m2xQNz0Q9XSSpkZElaA
96043j4ptZLvZuHjw/l1lOWqzzIQNph91Oj9w== 96043j4ptZLvZuHjw/l1lOWqzzIQNph91Oj9w==
961-----END CERTIFICATE----- 961-----END CERTIFICATE-----
962 962
963### Baltimore
964
965=== /C=IE/O=Baltimore/OU=CyberTrust/CN=Baltimore CyberTrust Root
966Certificate:
967 Data:
968 Version: 3 (0x2)
969 Serial Number: 33554617 (0x20000b9)
970 Signature Algorithm: sha1WithRSAEncryption
971 Validity
972 Not Before: May 12 18:46:00 2000 GMT
973 Not After : May 12 23:59:00 2025 GMT
974 Subject: C=IE, O=Baltimore, OU=CyberTrust, CN=Baltimore CyberTrust Root
975 X509v3 extensions:
976 X509v3 Subject Key Identifier:
977 E5:9D:59:30:82:47:58:CC:AC:FA:08:54:36:86:7B:3A:B5:04:4D:F0
978 X509v3 Basic Constraints: critical
979 CA:TRUE, pathlen:3
980 X509v3 Key Usage: critical
981 Certificate Sign, CRL Sign
982SHA1 Fingerprint=D4:DE:20:D0:5E:66:FC:53:FE:1A:50:88:2C:78:DB:28:52:CA:E4:74
983SHA256 Fingerprint=16:AF:57:A9:F6:76:B0:AB:12:60:95:AA:5E:BA:DE:F2:2A:B3:11:19:D6:44:AC:95:CD:4B:93:DB:F3:F2:6A:EB
984-----BEGIN CERTIFICATE-----
985MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJ
986RTESMBAGA1UEChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYD
987VQQDExlCYWx0aW1vcmUgQ3liZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoX
988DTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMCSUUxEjAQBgNVBAoTCUJhbHRpbW9y
989ZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFsdGltb3JlIEN5YmVy
990VHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKMEuyKr
991mD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjr
992IZ3AQSsBUnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeK
993mpYcqWe4PwzV9/lSEy/CG9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSu
994XmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9XbIGevOF6uvUA65ehD5f/xXtabz5OTZy
995dc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjprl3RjM71oGDHweI12v/ye
996jl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoIVDaGezq1
997BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3
998DQEBBQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT92
9999hkTI7gQCvlYpNRhcL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3Wgx
1000jkzSswF07r51XgdIGn9w/xZchMB5hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0
1001Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsaY71k5h+3zvDyny67G7fyUIhz
1002ksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9HRCwBXbsdtTLS
1003R9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
1004-----END CERTIFICATE-----
1005
1006### Buypass AS-983163327 963### Buypass AS-983163327
1007 964
1008=== /C=NO/O=Buypass AS-983163327/CN=Buypass Class 2 Root CA 965=== /C=NO/O=Buypass AS-983163327/CN=Buypass Class 2 Root CA
@@ -1728,61 +1685,6 @@ v64fG9PiO/yzcnMcmyiQiRM9HcEARwmWmjgb3bHPDcK0RPOWlc4yOo80nOAXx17O
1728rg3bhzjlP1v9mxnhMUF6cKojawHhRUzNlM47ni3niAIi9G7oyOzWPPO5std3eqx7 1685rg3bhzjlP1v9mxnhMUF6cKojawHhRUzNlM47ni3niAIi9G7oyOzWPPO5std3eqx7
1729-----END CERTIFICATE----- 1686-----END CERTIFICATE-----
1730 1687
1731### Comodo CA Limited
1732
1733=== /C=GB/ST=Greater Manchester/L=Salford/O=Comodo CA Limited/CN=AAA Certificate Services
1734Certificate:
1735 Data:
1736 Version: 3 (0x2)
1737 Serial Number: 1 (0x1)
1738 Signature Algorithm: sha1WithRSAEncryption
1739 Validity
1740 Not Before: Jan 1 00:00:00 2004 GMT
1741 Not After : Dec 31 23:59:59 2028 GMT
1742 Subject: C=GB, ST=Greater Manchester, L=Salford, O=Comodo CA Limited, CN=AAA Certificate Services
1743 X509v3 extensions:
1744 X509v3 Subject Key Identifier:
1745 A0:11:0A:23:3E:96:F1:07:EC:E2:AF:29:EF:82:A5:7F:D0:30:A4:B4
1746 X509v3 Key Usage: critical
1747 Certificate Sign, CRL Sign
1748 X509v3 Basic Constraints: critical
1749 CA:TRUE
1750 X509v3 CRL Distribution Points:
1751
1752 Full Name:
1753 URI:http://crl.comodoca.com/AAACertificateServices.crl
1754
1755 Full Name:
1756 URI:http://crl.comodo.net/AAACertificateServices.crl
1757
1758SHA1 Fingerprint=D1:EB:23:A4:6D:17:D6:8F:D9:25:64:C2:F1:F1:60:17:64:D8:E3:49
1759SHA256 Fingerprint=D7:A7:A0:FB:5D:7E:27:31:D7:71:E9:48:4E:BC:DE:F7:1D:5F:0C:3E:0A:29:48:78:2B:C8:3E:E0:EA:69:9E:F4
1760-----BEGIN CERTIFICATE-----
1761MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEb
1762MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow
1763GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmlj
1764YXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAwMFoXDTI4MTIzMTIzNTk1OVowezEL
1765MAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE
1766BwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNVBAMM
1767GEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP
1768ADCCAQoCggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQua
1769BtDFcCLNSS1UY8y2bmhGC1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe
17703M/vg4aijJRPn2jymJBGhCfHdr/jzDUsi14HZGWCwEiwqJH5YZ92IFCokcdmtet4
1771YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszWY19zjNoFmag4qMsXeDZR
1772rOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjHYpy+g8cm
1773ez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQU
1774oBEKIz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
1775MAMBAf8wewYDVR0fBHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20v
1776QUFBQ2VydGlmaWNhdGVTZXJ2aWNlcy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29t
1777b2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2VzLmNybDANBgkqhkiG9w0BAQUF
1778AAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm7l3sAg9g1o1Q
1779GE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
1780Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2
1781G9w84FoVxp7Z8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsi
1782l2D4kF501KKaU73yqWjgom7C12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3
1783smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
1784-----END CERTIFICATE-----
1785
1786### Cybertrust Japan Co., Ltd. 1688### Cybertrust Japan Co., Ltd.
1787 1689
1788=== /C=JP/O=Cybertrust Japan Co., Ltd./CN=SecureSign Root CA12 1690=== /C=JP/O=Cybertrust Japan Co., Ltd./CN=SecureSign Root CA12
@@ -1961,6 +1863,64 @@ PQQDAwNpADBmAjEAlJAtE/rhY/hhY+ithXhUkZy4kzg+GkHaQBZTQgjKL47xPoFW
1961wKrY7RjEsK70PvomAjEA8yjixtsrmfu3Ubgko6SUeho/5jbiA1czijDLgsfWFBHV 1863wKrY7RjEsK70PvomAjEA8yjixtsrmfu3Ubgko6SUeho/5jbiA1czijDLgsfWFBHV
1962dWNbFJWcHwHP2NVypw87 1864dWNbFJWcHwHP2NVypw87
1963-----END CERTIFICATE----- 1865-----END CERTIFICATE-----
1866=== /C=DE/O=D-Trust GmbH/CN=D-TRUST BR Root CA 2 2023
1867Certificate:
1868 Data:
1869 Version: 3 (0x2)
1870 Serial Number:
1871 73:3b:30:04:48:5b:d9:4d:78:2e:73:4b:c9:a1:dc:66
1872 Signature Algorithm: sha512WithRSAEncryption
1873 Validity
1874 Not Before: May 9 08:56:31 2023 GMT
1875 Not After : May 9 08:56:30 2038 GMT
1876 Subject: C=DE, O=D-Trust GmbH, CN=D-TRUST BR Root CA 2 2023
1877 X509v3 extensions:
1878 X509v3 Basic Constraints: critical
1879 CA:TRUE
1880 X509v3 Subject Key Identifier:
1881 67:90:F0:D6:DE:B5:18:D5:46:29:7E:5C:AB:F8:9E:08:BC:64:95:10
1882 X509v3 Key Usage: critical
1883 Certificate Sign, CRL Sign
1884 X509v3 CRL Distribution Points:
1885
1886 Full Name:
1887 URI:http://crl.d-trust.net/crl/d-trust_br_root_ca_2_2023.crl
1888
1889SHA1 Fingerprint=2D:B0:70:EE:71:94:AF:69:68:17:DB:79:CE:58:9F:A0:6B:96:F7:87
1890SHA256 Fingerprint=05:52:E6:F8:3F:DF:65:E8:FA:96:70:E6:66:DF:28:A4:E2:13:40:B5:10:CB:E5:25:66:F9:7C:4F:B9:4B:2B:D1
1891-----BEGIN CERTIFICATE-----
1892MIIFqTCCA5GgAwIBAgIQczswBEhb2U14LnNLyaHcZjANBgkqhkiG9w0BAQ0FADBI
1893MQswCQYDVQQGEwJERTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlE
1894LVRSVVNUIEJSIFJvb3QgQ0EgMiAyMDIzMB4XDTIzMDUwOTA4NTYzMVoXDTM4MDUw
1895OTA4NTYzMFowSDELMAkGA1UEBhMCREUxFTATBgNVBAoTDEQtVHJ1c3QgR21iSDEi
1896MCAGA1UEAxMZRC1UUlVTVCBCUiBSb290IENBIDIgMjAyMzCCAiIwDQYJKoZIhvcN
1897AQEBBQADggIPADCCAgoCggIBAK7/CVmRgApKaOYkP7in5Mg6CjoWzckjYaCTcfKr
1898i3OPoGdlYNJUa2NRb0kz4HIHE304zQaSBylSa053bATTlfrdTIzZXcFhfUvnKLNE
1899gXtRr90zsWh81k5M/itoucpmacTsXld/9w3HnDY25QdgrMBM6ghs7wZ8T1soegj8
1900k12b9py0i4a6Ibn08OhZWiihNIQaJZG2tY/vsvmA+vk9PBFy2OMvhnbFeSzBqZCT
1901Rphny4NqoFAjpzv2gTng7fC5v2Xx2Mt6++9zA84A9H3X4F07ZrjcjrqDy4d2A/wl
19022ecjbwb9Z/Pg/4S8R7+1FhhGaRTMBffb00msa8yr5LULQyReS2tNZ9/WtT5PeB+U
1903cSTq3nD88ZP+npNa5JRal1QMNXtfbO4AHyTsA7oC9Xb0n9Sa7YUsOCIvx9gvdhFP
1904/Wxc6PWOJ4d/GUohR5AdeY0cW/jPSoXk7bNbjb7EZChdQcRurDhaTyN0dKkSw/bS
1905uREVMweR2Ds3OmMwBtHFIjYoYiMQ4EbMl6zWK11kJNXuHA7e+whadSr2Y23OC0K+
19060bpwHJwh5Q8xaRfX/Aq03u2AnMuStIv13lmiWAmlY0cL4UEyNEHZmrHZqLAbWt4N
1907DfTisl01gLmB1IRpkQLLddCNxbU9CZEJjxShFHR5PtbJFR2kWVki3PaKRT08EtY+
1908XTIvAgMBAAGjgY4wgYswDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUZ5Dw1t61
1909GNVGKX5cq/ieCLxklRAwDgYDVR0PAQH/BAQDAgEGMEkGA1UdHwRCMEAwPqA8oDqG
1910OGh0dHA6Ly9jcmwuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3RfYnJfcm9vdF9jYV8y
1911XzIwMjMuY3JsMA0GCSqGSIb3DQEBDQUAA4ICAQA097N3U9swFrktpSHxQCF16+tI
1912FoE9c+CeJyrrd6kTpGoKWloUMz1oH4Guaf2Mn2VsNELZLdB/eBaxOqwjMa1ef67n
1913riv6uvw8l5VAk1/DLQOj7aRvU9f6QA4w9QAgLABMjDu0ox+2v5Eyq6+SmNMW5tTR
1914VFxDWy6u71cqqLRvpO8NVhTaIasgdp4D/Ca4nj8+AybmTNudX0KEPUUDAxxZiMrc
1915LmEkWqTqJwtzEr5SswrPMhfiHocaFpVIbVrg0M8JkiZmkdijYQ6qgYF/6FKC0ULn
19164B0Y+qSFNueG4A3rvNTJ1jxD8V1Jbn6Bm2m1iWKPiFLY1/4nwSPFyysCu7Ff/vtD
1917hQNGvl3GyiEm/9cCnnRK3PgTFbGBVzbLZVzRHTF36SXDw7IyN9XxmAnkbWOACKsG
1918koHU6XCPpz+y7YaMgmo1yEJagtFSGkUPFaUA8JR7ZSdXOUPPfH/mvTWze/EZTN46
1919ls/pdu4D58JDUjxqgejBWoC9EV2Ta/vH5mQ/u2kc6d0li690yVRAysuTEwrt+2aS
1920Ecr1wPrYg1UDfNPFIkZ1cGt5SAYqgpq/5usWDiJFAbzdNpQ0qTUmiteXue4Icr80
1921knCDgKs4qllo3UCkGJCy89UDyibK79XH4I9TjvAA46jtn/mtd+ArY0+ew+43u3gJ
1922hJ65bvspmZDogNOfJA==
1923-----END CERTIFICATE-----
1964=== /C=DE/O=D-Trust GmbH/CN=D-TRUST EV Root CA 1 2020 1924=== /C=DE/O=D-Trust GmbH/CN=D-TRUST EV Root CA 1 2020
1965Certificate: 1925Certificate:
1966 Data: 1926 Data:
@@ -2007,6 +1967,64 @@ PQQDAwNpADBmAjEAyjzGKnXCXnViOTYAYFqLwZOZzNnbQTs7h5kXO9XMT8oi96CA
2007y/m0sRtW9XLS/BnRAjEAkfcwkz8QRitxpNA7RJvAKQIFskF3UfN5Wp6OFKBOQtJb 1967y/m0sRtW9XLS/BnRAjEAkfcwkz8QRitxpNA7RJvAKQIFskF3UfN5Wp6OFKBOQtJb
2008gfM0agPnIjhQW+0ZT0MW 1968gfM0agPnIjhQW+0ZT0MW
2009-----END CERTIFICATE----- 1969-----END CERTIFICATE-----
1970=== /C=DE/O=D-Trust GmbH/CN=D-TRUST EV Root CA 2 2023
1971Certificate:
1972 Data:
1973 Version: 3 (0x2)
1974 Serial Number:
1975 69:26:09:7e:80:4b:4c:a0:a7:8c:78:62:53:5f:5a:6f
1976 Signature Algorithm: sha512WithRSAEncryption
1977 Validity
1978 Not Before: May 9 09:10:33 2023 GMT
1979 Not After : May 9 09:10:32 2038 GMT
1980 Subject: C=DE, O=D-Trust GmbH, CN=D-TRUST EV Root CA 2 2023
1981 X509v3 extensions:
1982 X509v3 Basic Constraints: critical
1983 CA:TRUE
1984 X509v3 Subject Key Identifier:
1985 AA:FC:91:10:1B:87:91:5F:16:B9:BF:4F:4B:91:5E:00:1C:B1:32:80
1986 X509v3 Key Usage: critical
1987 Certificate Sign, CRL Sign
1988 X509v3 CRL Distribution Points:
1989
1990 Full Name:
1991 URI:http://crl.d-trust.net/crl/d-trust_ev_root_ca_2_2023.crl
1992
1993SHA1 Fingerprint=A5:5B:D8:47:6C:8F:19:F7:4C:F4:6D:6B:B6:C2:79:82:22:DF:54:8B
1994SHA256 Fingerprint=8E:82:21:B2:E7:D4:00:78:36:A1:67:2F:0D:CC:29:9C:33:BC:07:D3:16:F1:32:FA:1A:20:6D:58:71:50:F1:CE
1995-----BEGIN CERTIFICATE-----
1996MIIFqTCCA5GgAwIBAgIQaSYJfoBLTKCnjHhiU19abzANBgkqhkiG9w0BAQ0FADBI
1997MQswCQYDVQQGEwJERTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlE
1998LVRSVVNUIEVWIFJvb3QgQ0EgMiAyMDIzMB4XDTIzMDUwOTA5MTAzM1oXDTM4MDUw
1999OTA5MTAzMlowSDELMAkGA1UEBhMCREUxFTATBgNVBAoTDEQtVHJ1c3QgR21iSDEi
2000MCAGA1UEAxMZRC1UUlVTVCBFViBSb290IENBIDIgMjAyMzCCAiIwDQYJKoZIhvcN
2001AQEBBQADggIPADCCAgoCggIBANiOo4mAC7JXUtypU0w3uX9jFxPvp1sjW2l1sJkK
2002F8GLxNuo4MwxusLyzV3pt/gdr2rElYfXR8mV2IIEUD2BCP/kPbOx1sWy/YgJ25yE
20037CUXFId/MHibaljJtnMoPDT3mfd/06b4HEV8rSyMlD/YZxBTfiLNTiVR8CUkNRFe
2004EMbsh2aJgWi6zCudR3Mfvc2RpHJqnKIbGKBv7FD0fUDCqDDPvXPIEysQEx6Lmqg6
2005lHPTGGkKSv/BAQP/eX+1SH977ugpbzZMlWGG2Pmic4ruri+W7mjNPU0oQvlFKzIb
2006RlUWaqZLKfm7lVa/Rh3sHZMdwGWyH6FDrlaeoLGPaxK3YG14C8qKXO0elg6DpkiV
2007jTujIcSuWMYAsoS0I6SWhjW42J7YrDRJmGOVxcttSEfi8i4YHtAxq9107PncjLgc
2008jmgjutDzUNzPZY9zOjLHfP7KgiJPvo5iR2blzYfi6NUPGJ/lBHJLRjwQ8kTCZFZx
2009TnXonMkmdMV9WdEKWw9t/p51HBjGGjp82A0EzM23RWV6sY+4roRIPrN6TagD4uJ+
2010ARZZaBhDM7DS3LAaQzXupdqpRlyuhoFBAUp0JuyfBr/CBTdkdXgpaP3F9ev+R/nk
2011hbDhezGdpn9yo7nELC7MmVcOIQxFAZRl62UJxmMiCzNJkkg8/M3OsD6Onov4/knF
2012NXJHAgMBAAGjgY4wgYswDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUqvyREBuH
2013kV8Wub9PS5FeAByxMoAwDgYDVR0PAQH/BAQDAgEGMEkGA1UdHwRCMEAwPqA8oDqG
2014OGh0dHA6Ly9jcmwuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3RfZXZfcm9vdF9jYV8y
2015XzIwMjMuY3JsMA0GCSqGSIb3DQEBDQUAA4ICAQCTy6UfmRHsmg1fLBWTxj++EI14
2016QvBukEdHjqOSMo1wj/Zbjb6JzkcBahsgIIlbyIIQbODnmaprxiqgYzWRaoUlrRc4
2017pZt+UPJ26oUFKidBK7GB0aL2QHWpDsvxVUjY7NHss+jOFKE17MJeNRqrphYBBo7q
20183C+jisosketSjl8MmxfPy3MHGcRqwnNU73xDUmPBEcrCRbH0O1P1aa4846XerOhU
2019t7KR/aypH/KH5BfGSah82ApB9PI+53c0BFLd6IHyTS9URZ0V4U/M5d40VxDJI3IX
2020cI1QcB9WbMy5/zpaT2N6w25lBx2Eof+pDGOJbbJAiDnXH3dotfyc1dZnaVuodNv8
2021ifYbMvekJKZ2t0dT741Jj6m2g1qllpBFYfXeA08mD6iL8AOWsKwV0HFaanuU5nCT
20222vFp4LJiTZ6P/4mdm13NRemUAiKN4DV/6PEEeXFsVIP4M7kFMhtYVRFP0OUnR3Hs
20237dpn1mKmS00PaaLJvOwiS5THaJQXfuKOKD62xur1NGyfN4gHONuGcfrNlUhDbqNP
2024gofXNJhuS5N5YHVpD/Aa1VP6IQzCP+k/HxiMkl14p3ZnGbuy6n/pcAlWVqOwDAst
2025Nl7F6cTVg8uGF5csbBNvh1qvSaYd2804BC5f4ko1Di1L+KIkBI3Y4WNeApI02phh
2026XBxvWHZks/wCuPWdCg==
2027-----END CERTIFICATE-----
2010=== /C=DE/O=D-Trust GmbH/CN=D-TRUST Root Class 3 CA 2 2009 2028=== /C=DE/O=D-Trust GmbH/CN=D-TRUST Root Class 3 CA 2 2009
2011Certificate: 2029Certificate:
2012 Data: 2030 Data:
@@ -2900,62 +2918,6 @@ BBYEFLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVC
2900R98crlOZF7ZvHH3hvxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nX 2918R98crlOZF7ZvHH3hvxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nX
2901hTcGtXsI/esni0qU+eH6p44mCOh8kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G 2919hTcGtXsI/esni0qU+eH6p44mCOh8kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
2902-----END CERTIFICATE----- 2920-----END CERTIFICATE-----
2903=== /C=US/O=Entrust, Inc./OU=See www.entrust.net/legal-terms/OU=(c) 2015 Entrust, Inc. - for authorized use only/CN=Entrust Root Certification Authority - G4
2904Certificate:
2905 Data:
2906 Version: 3 (0x2)
2907 Serial Number:
2908 d9:b5:43:7f:af:a9:39:0f:00:00:00:00:55:65:ad:58
2909 Signature Algorithm: sha256WithRSAEncryption
2910 Validity
2911 Not Before: May 27 11:11:16 2015 GMT
2912 Not After : Dec 27 11:41:16 2037 GMT
2913 Subject: C=US, O=Entrust, Inc., OU=See www.entrust.net/legal-terms, OU=(c) 2015 Entrust, Inc. - for authorized use only, CN=Entrust Root Certification Authority - G4
2914 X509v3 extensions:
2915 X509v3 Basic Constraints: critical
2916 CA:TRUE
2917 X509v3 Key Usage: critical
2918 Certificate Sign, CRL Sign
2919 X509v3 Subject Key Identifier:
2920 9F:38:C4:56:23:C3:39:E8:A0:71:6C:E8:54:4C:E4:E8:3A:B1:BF:67
2921SHA1 Fingerprint=14:88:4E:86:26:37:B0:26:AF:59:62:5C:40:77:EC:35:29:BA:96:01
2922SHA256 Fingerprint=DB:35:17:D1:F6:73:2A:2D:5A:B9:7C:53:3E:C7:07:79:EE:32:70:A6:2F:B4:AC:42:38:37:24:60:E6:F0:1E:88
2923-----BEGIN CERTIFICATE-----
2924MIIGSzCCBDOgAwIBAgIRANm1Q3+vqTkPAAAAAFVlrVgwDQYJKoZIhvcNAQELBQAw
2925gb4xCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQL
2926Ex9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykg
2927MjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMjAw
2928BgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEc0
2929MB4XDTE1MDUyNzExMTExNloXDTM3MTIyNzExNDExNlowgb4xCzAJBgNVBAYTAlVT
2930MRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1
2931c3QubmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNSBFbnRydXN0LCBJ
2932bmMuIC0gZm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMjAwBgNVBAMTKUVudHJ1c3Qg
2933Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEc0MIICIjANBgkqhkiG9w0B
2934AQEFAAOCAg8AMIICCgKCAgEAsewsQu7i0TD/pZJH4i3DumSXbcr3DbVZwbPLqGgZ
29352K+EbTBwXX7zLtJTmeH+H17ZSK9dE43b/2MzTdMAArzE+NEGCJR5WIoV3imz/f3E
2936T+iq4qA7ec2/a0My3dl0ELn39GjUu9CH1apLiipvKgS1sqbHoHrmSKvS0VnM1n4j
29375pds8ELl3FFLFUHtSUrJ3hCX1nbB76W1NhSXNdh4IjVS70O92yfbYVaCNNzLiGAM
2938C1rlLAHGVK/XqsEQe9IFWrhAnoanw5CGAlZSCXqc0ieCU0plUmr1POeo8pyvi73T
2939DtTUXm6Hnmo9RR3RXRv06QqsYJn7ibT/mCzPfB3pAqoEmh643IhuJbNsZvc8kPNX
2940wbMv9W3y+8qh+CmdRouzavbmZwe+LGcKKh9asj5XxNMhIWNlUpEbsZmOeX7m640A
29412Vqq6nPopIICR5b+W45UYaPrL0swsIsjdXJ8ITzI9vF01Bx7owVV7rtNOzK+mndm
2942nqxpkCIHH2E6lr7lmk/MBTwoWdPBDFSoWWG9yHJM6Nyfh3+9nEg2XpWjDrk4JFX8
2943dWbrAuMINClKxuMrLzOg2qOGpRKX/YAr2hRC45K9PvJdXmd0LhyIRyk0X+IyqJwl
2944N4y6mACXi0mWHv0liqzc2thddG5msP9E36EYxr5ILzeUePiVSj9/E15dWf10hkNj
2945c0kCAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD
2946VR0OBBYEFJ84xFYjwznooHFs6FRM5Og6sb9nMA0GCSqGSIb3DQEBCwUAA4ICAQAS
29475UKme4sPDORGpbZgQIeMJX6tuGguW8ZAdjwD+MlZ9POrYs4QjbRaZIxowLByQzTS
2948Gwv2LFPSypBLhmb8qoMi9IsabyZIrHZ3CL/FmFz0Jomee8O5ZDIBf9PD3Vht7LGr
2949hFV0d4QEJ1JrhkzO3bll/9bGXp+aEJlLdWr+aumXIOTkdnrG0CSqkM0gkLpHZPt/
2950B7NTeLUKYvJzQ85BK4FqLoUWlFPUa19yIqtRLULVAJyZv967lDtX/Zr1hstWO1uI
2951AeV8KEsD+UmDfLJ/fOPtjqF/YFOOVZ1QNBIPt5d7bIdKROf1beyAN/BYGW5KaHbw
2952H5Lk6rWS02FREAutp9lfx1/cH6NcjKF+m7ee01ZvZl4HliDtC3T7Zk6LERXpgUl+
2953b7DUUH8i119lAg2m9IUe2K4GS0qn0jFmwvjO5QimpAKWRGhXxNUzzxkvFMSUHHuk
29542fCfDrGA4tGeEWSpiBE6doLlYsKA2KSD7ZPvfC+QsDJMlhVoSFLUmQjAJOgc47Ol
2955IQ6SwJAfzyBfyjs4x7dtOvPmRLgOMWuIjnDrnBdSqEGULoe256YSxXXfW8AKbnuk
29565F6G+TaU33fD6Q3AOfF5u0aOq0NZJ7cguyPpVkAh7DE9ZapD8j3fcEThuk0mEDuY
2957n/PIjhs4ViFqUZPTkcpG2om3PVODLAgfi49T3f+sHw==
2958-----END CERTIFICATE-----
2959=== /C=US/O=Entrust, Inc./OU=www.entrust.net/CPS is incorporated by reference/OU=(c) 2006 Entrust, Inc./CN=Entrust Root Certification Authority 2921=== /C=US/O=Entrust, Inc./OU=www.entrust.net/CPS is incorporated by reference/OU=(c) 2006 Entrust, Inc./CN=Entrust Root Certification Authority
2960Certificate: 2922Certificate:
2961 Data: 2923 Data:
@@ -3010,53 +2972,6 @@ eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0tHuu2guQOHXvgR1m
30100vdXcDazv/wor3ElhVsT/h5/WrQ8 29720vdXcDazv/wor3ElhVsT/h5/WrQ8
3011-----END CERTIFICATE----- 2973-----END CERTIFICATE-----
3012 2974
3013### Entrust.net
3014
3015=== /O=Entrust.net/OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.)/OU=(c) 1999 Entrust.net Limited/CN=Entrust.net Certification Authority (2048)
3016Certificate:
3017 Data:
3018 Version: 3 (0x2)
3019 Serial Number: 946069240 (0x3863def8)
3020 Signature Algorithm: sha1WithRSAEncryption
3021 Validity
3022 Not Before: Dec 24 17:50:51 1999 GMT
3023 Not After : Jul 24 14:15:12 2029 GMT
3024 Subject: O=Entrust.net, OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.), OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Certification Authority (2048)
3025 X509v3 extensions:
3026 X509v3 Key Usage: critical
3027 Certificate Sign, CRL Sign
3028 X509v3 Basic Constraints: critical
3029 CA:TRUE
3030 X509v3 Subject Key Identifier:
3031 55:E4:81:D1:11:80:BE:D8:89:B9:08:A3:31:F9:A1:24:09:16:B9:70
3032SHA1 Fingerprint=50:30:06:09:1D:97:D4:F5:AE:39:F7:CB:E7:92:7D:7D:65:2D:34:31
3033SHA256 Fingerprint=6D:C4:71:72:E0:1C:BC:B0:BF:62:58:0D:89:5F:E2:B8:AC:9A:D4:F8:73:80:1E:0C:10:B9:C8:37:D2:1E:B1:77
3034-----BEGIN CERTIFICATE-----
3035MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChML
3036RW50cnVzdC5uZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBp
3037bmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5
3038IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNVBAMTKkVudHJ1c3QubmV0IENlcnRp
3039ZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQxNzUwNTFaFw0yOTA3
3040MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3d3d3
3041LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxp
3042YWIuKTElMCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEG
3043A1UEAxMqRW50cnVzdC5uZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgp
3044MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArU1LqRKGsuqjIAcVFmQq
3045K0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOLGp18EzoOH1u3Hs/lJBQe
3046sYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSrhRSGlVuX
3047MlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVT
3048XTzWnLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/
3049HoZdenoVve8AjhUiVBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH
30504QIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV
3051HQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJKoZIhvcNAQEFBQADggEBADub
3052j1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPyT/4xmf3IDExo
3053U8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
3054zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5b
3055u/8j72gZyxKTJ1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+
3056bYQLCIt+jerXmCHG8+c8eS9enNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/Er
3057fF6adulZkMV8gzURZVE=
3058-----END CERTIFICATE-----
3059
3060### FNMT-RCM 2975### FNMT-RCM
3061 2976
3062=== /C=ES/O=FNMT-RCM/OU=AC RAIZ FNMT-RCM 2977=== /C=ES/O=FNMT-RCM/OU=AC RAIZ FNMT-RCM
@@ -3125,7 +3040,7 @@ Certificate:
3125 Validity 3040 Validity
3126 Not Before: Dec 20 09:37:33 2018 GMT 3041 Not Before: Dec 20 09:37:33 2018 GMT
3127 Not After : Dec 20 09:37:33 2043 GMT 3042 Not After : Dec 20 09:37:33 2043 GMT
3128 Subject: C=ES, O=FNMT-RCM, OU=Ceres/2.5.4.97=VATES-Q2826004J, CN=AC RAIZ FNMT-RCM SERVIDORES SEGUROS 3043 Subject: C=ES, O=FNMT-RCM, OU=Ceres, 2.5.4.97=VATES-Q2826004J, CN=AC RAIZ FNMT-RCM SERVIDORES SEGUROS
3129 X509v3 extensions: 3044 X509v3 extensions:
3130 X509v3 Basic Constraints: critical 3045 X509v3 Basic Constraints: critical
3131 CA:TRUE 3046 CA:TRUE
@@ -3164,7 +3079,7 @@ Certificate:
3164 Validity 3079 Validity
3165 Not Before: Apr 6 09:01:36 2022 GMT 3080 Not Before: Apr 6 09:01:36 2022 GMT
3166 Not After : Mar 31 09:01:36 2047 GMT 3081 Not After : Mar 31 09:01:36 2047 GMT
3167 Subject: C=ES, O=Firmaprofesional SA/2.5.4.97=VATES-A62634068, CN=FIRMAPROFESIONAL CA ROOT-A WEB 3082 Subject: C=ES, O=Firmaprofesional SA, 2.5.4.97=VATES-A62634068, CN=FIRMAPROFESIONAL CA ROOT-A WEB
3168 X509v3 extensions: 3083 X509v3 extensions:
3169 X509v3 Basic Constraints: critical 3084 X509v3 Basic Constraints: critical
3170 CA:TRUE 3085 CA:TRUE
@@ -3499,47 +3414,6 @@ u+YfjyW6hY0XHgL+XVAEV8/+LbzvXMAaq7afJMbfc2hIkCwU9D9SGuTSyxTDYWnP
3499N3ec592kD3ZDZopD8p/7DEJ4Y9HiD2971KE9dJeFt0g5QdYg/NA6s/rob8SKunE3 3414N3ec592kD3ZDZopD8p/7DEJ4Y9HiD2971KE9dJeFt0g5QdYg/NA6s/rob8SKunE3
3500vouXsXgxT7PntgMTzlSdriVZzH81Xwj3QEUxeCp6 3415vouXsXgxT7PntgMTzlSdriVZzH81Xwj3QEUxeCp6
3501-----END CERTIFICATE----- 3416-----END CERTIFICATE-----
3502=== /C=BE/O=GlobalSign nv-sa/OU=Root CA/CN=GlobalSign Root CA
3503Certificate:
3504 Data:
3505 Version: 3 (0x2)
3506 Serial Number:
3507 04:00:00:00:00:01:15:4b:5a:c3:94
3508 Signature Algorithm: sha1WithRSAEncryption
3509 Validity
3510 Not Before: Sep 1 12:00:00 1998 GMT
3511 Not After : Jan 28 12:00:00 2028 GMT
3512 Subject: C=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA
3513 X509v3 extensions:
3514 X509v3 Key Usage: critical
3515 Certificate Sign, CRL Sign
3516 X509v3 Basic Constraints: critical
3517 CA:TRUE
3518 X509v3 Subject Key Identifier:
3519 60:7B:66:1A:45:0D:97:CA:89:50:2F:7D:04:CD:34:A8:FF:FC:FD:4B
3520SHA1 Fingerprint=B1:BC:96:8B:D4:F4:9D:62:2A:A8:9A:81:F2:15:01:52:A4:1D:82:9C
3521SHA256 Fingerprint=EB:D4:10:40:E4:BB:3E:C7:42:C9:E3:81:D3:1E:F2:A4:1A:48:B6:68:5C:96:E7:CE:F3:C1:DF:6C:D4:33:1C:99
3522-----BEGIN CERTIFICATE-----
3523MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG
3524A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv
3525b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw
3526MDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i
3527YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT
3528aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ
3529jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp
3530xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp
35311Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG
3532snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ
3533U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8
35349iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E
3535BTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B
3536AQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOz
3537yj1hTdNGCbM+w6DjY1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE
353838NflNUVyRRBnMRddWQVDf9VMOyGj/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymP
3539AbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhHhm4qxFYxldBniYUr+WymXUad
3540DKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveCX4XSQRjbgbME
3541HMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
3542-----END CERTIFICATE-----
3543 3417
3544### GoDaddy.com, Inc. 3418### GoDaddy.com, Inc.
3545 3419
@@ -4253,49 +4127,6 @@ tL4ndQavEi51mI38AjEAi/V3bNTIZargCyzuFJ0nN6T5U6VR5CmD1/iQMVtCnwr1
4253/q4AaOeMSQ+2b1tbFfLn 4127/q4AaOeMSQ+2b1tbFfLn
4254-----END CERTIFICATE----- 4128-----END CERTIFICATE-----
4255 4129
4256### Japan Certification Services, Inc.
4257
4258=== /C=JP/O=Japan Certification Services, Inc./CN=SecureSign RootCA11
4259Certificate:
4260 Data:
4261 Version: 3 (0x2)
4262 Serial Number: 1 (0x1)
4263 Signature Algorithm: sha1WithRSAEncryption
4264 Validity
4265 Not Before: Apr 8 04:56:47 2009 GMT
4266 Not After : Apr 8 04:56:47 2029 GMT
4267 Subject: C=JP, O=Japan Certification Services, Inc., CN=SecureSign RootCA11
4268 X509v3 extensions:
4269 X509v3 Subject Key Identifier:
4270 5B:F8:4D:4F:B2:A5:86:D4:3A:D2:F1:63:9A:A0:BE:09:F6:57:B7:DE
4271 X509v3 Key Usage: critical
4272 Certificate Sign, CRL Sign
4273 X509v3 Basic Constraints: critical
4274 CA:TRUE
4275SHA1 Fingerprint=3B:C4:9F:48:F8:F3:73:A0:9C:1E:BD:F8:5B:B1:C3:65:C7:D8:11:B3
4276SHA256 Fingerprint=BF:0F:EE:FB:9E:3A:58:1A:D5:F9:E9:DB:75:89:98:57:43:D2:61:08:5C:4D:31:4F:6F:5D:72:59:AA:42:16:12
4277-----BEGIN CERTIFICATE-----
4278MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDEr
4279MCkGA1UEChMiSmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoG
4280A1UEAxMTU2VjdXJlU2lnbiBSb290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0
4281MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSswKQYDVQQKEyJKYXBhbiBDZXJ0aWZp
4282Y2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1cmVTaWduIFJvb3RD
4283QTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvLTJsz
4284i1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8
4285h9uuywGOwvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOV
4286MdrAG/LuYpmGYz+/3ZMqg6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9
4287UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rPO7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni
42888McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitAbpSACW22s293bzUIUPsC
4289h8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZXt94wDgYD
4290VR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEB
4291AKChOBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xm
4292KbabfSVSSUOrTC4rbnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQ
4293X5Ucv+2rIrVls4W6ng+4reV6G4pQOh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWr
4294QbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01y8hSyn+B/tlr0/cR7SXf+Of5
4295pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061lgeLKBObjBmN
4296QSdJQO7e5iNEOdyhIta6A/I=
4297-----END CERTIFICATE-----
4298
4299### Krajowa Izba Rozliczeniowa S.A. 4130### Krajowa Izba Rozliczeniowa S.A.
4300 4131
4301=== /C=PL/O=Krajowa Izba Rozliczeniowa S.A./CN=SZAFIR ROOT CA2 4132=== /C=PL/O=Krajowa Izba Rozliczeniowa S.A./CN=SZAFIR ROOT CA2
@@ -4352,7 +4183,7 @@ Certificate:
4352 Validity 4183 Validity
4353 Not Before: Aug 22 12:07:06 2017 GMT 4184 Not Before: Aug 22 12:07:06 2017 GMT
4354 Not After : Aug 22 12:07:06 2042 GMT 4185 Not After : Aug 22 12:07:06 2042 GMT
4355 Subject: C=HU, L=Budapest, O=Microsec Ltd./2.5.4.97=VATHU-23584497, CN=e-Szigno Root CA 2017 4186 Subject: C=HU, L=Budapest, O=Microsec Ltd., 2.5.4.97=VATHU-23584497, CN=e-Szigno Root CA 2017
4356 X509v3 extensions: 4187 X509v3 extensions:
4357 X509v3 Basic Constraints: critical 4188 X509v3 Basic Constraints: critical
4358 CA:TRUE 4189 CA:TRUE
@@ -4390,7 +4221,7 @@ Certificate:
4390 Validity 4221 Validity
4391 Not Before: Jun 16 11:30:18 2009 GMT 4222 Not Before: Jun 16 11:30:18 2009 GMT
4392 Not After : Dec 30 11:30:18 2029 GMT 4223 Not After : Dec 30 11:30:18 2029 GMT
4393 Subject: C=HU, L=Budapest, O=Microsec Ltd., CN=Microsec e-Szigno Root CA 2009/emailAddress=info@e-szigno.hu 4224 Subject: C=HU, L=Budapest, O=Microsec Ltd., CN=Microsec e-Szigno Root CA 2009, emailAddress=info@e-szigno.hu
4394 X509v3 extensions: 4225 X509v3 extensions:
4395 X509v3 Basic Constraints: critical 4226 X509v3 Basic Constraints: critical
4396 CA:TRUE 4227 CA:TRUE
@@ -4944,58 +4775,6 @@ BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjAVXUI9/Lbu
49449zuxNuie9sRGKEkz0FhDKmMpzE2xtHqiuQ04pV1IKv3LsnNdo4gIxwwCMQDAqy0O 47759zuxNuie9sRGKEkz0FhDKmMpzE2xtHqiuQ04pV1IKv3LsnNdo4gIxwwCMQDAqy0O
4945be0YottT6SXbVQjgUMzfRGEWgqtJsLKB7HOHeLRMsmIbEvoWTSVLY70eN9k= 4776be0YottT6SXbVQjgUMzfRGEWgqtJsLKB7HOHeLRMsmIbEvoWTSVLY70eN9k=
4946-----END CERTIFICATE----- 4777-----END CERTIFICATE-----
4947=== /C=JP/O=SECOM Trust Systems CO.,LTD./CN=Security Communication RootCA3
4948Certificate:
4949 Data:
4950 Version: 3 (0x2)
4951 Serial Number:
4952 e1:7c:37:40:fd:1b:fe:67
4953 Signature Algorithm: sha384WithRSAEncryption
4954 Validity
4955 Not Before: Jun 16 06:17:16 2016 GMT
4956 Not After : Jan 18 06:17:16 2038 GMT
4957 Subject: C=JP, O=SECOM Trust Systems CO.,LTD., CN=Security Communication RootCA3
4958 X509v3 extensions:
4959 X509v3 Subject Key Identifier:
4960 64:14:7C:FC:58:72:16:A6:0A:29:34:15:6F:2A:CB:BC:FC:AF:A8:AB
4961 X509v3 Key Usage: critical
4962 Certificate Sign, CRL Sign
4963 X509v3 Basic Constraints: critical
4964 CA:TRUE
4965SHA1 Fingerprint=C3:03:C8:22:74:92:E5:61:A2:9C:5F:79:91:2B:1E:44:13:91:30:3A
4966SHA256 Fingerprint=24:A5:5C:2A:B0:51:44:2D:06:17:76:65:41:23:9A:4A:D0:32:D7:C5:51:75:AA:34:FF:DE:2F:BC:4F:5C:52:94
4967-----BEGIN CERTIFICATE-----
4968MIIFfzCCA2egAwIBAgIJAOF8N0D9G/5nMA0GCSqGSIb3DQEBDAUAMF0xCzAJBgNV
4969BAYTAkpQMSUwIwYDVQQKExxTRUNPTSBUcnVzdCBTeXN0ZW1zIENPLixMVEQuMScw
4970JQYDVQQDEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTMwHhcNMTYwNjE2
4971MDYxNzE2WhcNMzgwMTE4MDYxNzE2WjBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
4972U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UEAxMeU2VjdXJpdHkg
4973Q29tbXVuaWNhdGlvbiBSb290Q0EzMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC
4974CgKCAgEA48lySfcw3gl8qUCBWNO0Ot26YQ+TUG5pPDXC7ltzkBtnTCHsXzW7OT4r
4975CmDvu20rhvtxosis5FaU+cmvsXLUIKx00rgVrVH+hXShuRD+BYD5UpOzQD11EKzA
4976lrenfna84xtSGc4RHwsENPXY9Wk8d/Nk9A2qhd7gCVAEF5aEt8iKvE1y/By7z/MG
4977TfmfZPd+pmaGNXHIEYBMwXFAWB6+oHP2/D5Q4eAvJj1+XCO1eXDe+uDRpdYMQXF7
49789+qMHIjH7Iv10S9VlkZ8WjtYO/u62C21Jdp6Ts9EriGmnpjKIG58u4iFW/vAEGK7
49798vknR+/RiTlDxN/e4UG/VHMgly1s2vPUB6PmudhvrvyMGS7TZ2crldtYXLVqAvO4
4980g160a75BflcJdURQVc1aEWEhCmHCqYj9E7wtiS/NYeCVvsq1e+F7NGcLH7YMx3we
4981GVPKp7FKFSBWFHA9K4IsD50VHUeAR/94mQ4xr28+j+2GaR57GIgUssL8gjMunEst
4982+3A7caoreyYn8xrC3PsXuKHqy6C0rtOUfnrQq8PsOC0RLoi/1D+tEjtCrI8Cbn3M
49830V9hvqG8OmpI6iZVIhZdXw3/JzOfGAN0iltSIEdrRU0id4xVJ/CvHozJgyJUt5rQ
4984T9nO/NkuHJYosQLTA70lUhw0Zk8jq/R3gpYd0VcwCBEF/VfR2ccCAwEAAaNCMEAw
4985HQYDVR0OBBYEFGQUfPxYchamCik0FW8qy7z8r6irMA4GA1UdDwEB/wQEAwIBBjAP
4986BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBDAUAA4ICAQDcAiMI4u8hOscNtybS
4987YpOnpSNyByCCYN8Y11StaSWSntkUz5m5UoHPrmyKO1o5yGwBQ8IibQLwYs1OY0PA
4988FNr0Y/Dq9HHuTofjcan0yVflLl8cebsjqodEV+m9NU1Bu0soo5iyG9kLFwfl9+qd
49899XbXv8S2gVj/yP9kaWJ5rW4OH3/uHWnlt3Jxs/6lATWUVCvAUm2PVcTJ0rjLyjQI
4990UYWg9by0F1jqClx6vWPGOi//lkkZhOpn2ASxYfQAW0q3nHE3GYV5v4GwxxMOdnE+
4991OoAGrgYWp421wsTL/0ClXI2lyTrtcoHKXJg80jQDdwj98ClZXSEIx2C/pHF7uNke
4992gr4Jr2VvKKu/S7XuPghHJ6APbw+LP6yVGPO5DtxnVW5inkYO0QR4ynKudtml+LLf
4993iAlhi+8kTtFZP1rUPcmTPCtk9YENFpb3ksP+MW/oKjJ0DvRMmEoYDjBU1cXrvMUV
4994nuiZIesnKwkK2/HmcBhWuwzkvvnoEKQTkrgc4NtnHVMDpCKn3F2SEDzq//wbEBrD
49952NCcnWXL0CsnMQMeNuE9dnUM/0Umud1RvCPHX9jYhxBAEg09ODfnRDwYwFMJZI//
49961ZqmfHAuc1Uh6N//g7kdPjIe1qZ9LPFm6Vwdp6POXiUyK+OVrCoHzrQoeIY8Laad
4997TdJ0MN1kURXbg4NR16/9M51NZg==
4998-----END CERTIFICATE-----
4999=== /C=JP/O=SECOM Trust Systems CO.,LTD./OU=Security Communication RootCA2 4778=== /C=JP/O=SECOM Trust Systems CO.,LTD./OU=Security Communication RootCA2
5000Certificate: 4779Certificate:
5001 Data: 4780 Data:
@@ -5516,52 +5295,6 @@ CPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
5516 5295
5517### Starfield Technologies, Inc. 5296### Starfield Technologies, Inc.
5518 5297
5519=== /C=US/O=Starfield Technologies, Inc./OU=Starfield Class 2 Certification Authority
5520Certificate:
5521 Data:
5522 Version: 3 (0x2)
5523 Serial Number: 0 (0x0)
5524 Signature Algorithm: sha1WithRSAEncryption
5525 Validity
5526 Not Before: Jun 29 17:39:16 2004 GMT
5527 Not After : Jun 29 17:39:16 2034 GMT
5528 Subject: C=US, O=Starfield Technologies, Inc., OU=Starfield Class 2 Certification Authority
5529 X509v3 extensions:
5530 X509v3 Subject Key Identifier:
5531 BF:5F:B7:D1:CE:DD:1F:86:F4:5B:55:AC:DC:D7:10:C2:0E:A9:88:E7
5532 X509v3 Authority Key Identifier:
5533 keyid:BF:5F:B7:D1:CE:DD:1F:86:F4:5B:55:AC:DC:D7:10:C2:0E:A9:88:E7
5534 DirName:/C=US/O=Starfield Technologies, Inc./OU=Starfield Class 2 Certification Authority
5535 serial:00
5536
5537 X509v3 Basic Constraints:
5538 CA:TRUE
5539SHA1 Fingerprint=AD:7E:1C:28:B0:64:EF:8F:60:03:40:20:14:C3:D0:E3:37:0E:B5:8A
5540SHA256 Fingerprint=14:65:FA:20:53:97:B8:76:FA:A6:F0:A9:95:8E:55:90:E4:0F:CC:7F:AA:4F:B7:C2:C8:67:75:21:FB:5F:B6:58
5541-----BEGIN CERTIFICATE-----
5542MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzEl
5543MCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMp
5544U3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQw
5545NjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBoMQswCQYDVQQGEwJVUzElMCMGA1UE
5546ChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZp
5547ZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqGSIb3
5548DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf
55498MOh2tTYbitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN
5550+lq2cwQlZut3f+dZxkqZJRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0
5551X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVmepsZGD3/cVE8MC5fvj13c7JdBmzDI1aa
5552K4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSNF4Azbl5KXZnJHoe0nRrA
55531W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HFMIHCMB0G
5554A1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fR
5555zt0fhvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0
5556YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBD
5557bGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8w
5558DQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGsafPzWdqbAYcaT1epoXkJKtv3
5559L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLMPUxA2IGvd56D
5560eruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
5561xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynp
5562VSJYACPq4xJDKVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEY
5563WQPJIrSPnNVeKtelttQKbfi3QBFGmh95DmK/D5fs4C8fF5Q=
5564-----END CERTIFICATE-----
5565=== /C=US/ST=Arizona/L=Scottsdale/O=Starfield Technologies, Inc./CN=Starfield Root Certificate Authority - G2 5298=== /C=US/ST=Arizona/L=Scottsdale/O=Starfield Technologies, Inc./CN=Starfield Root Certificate Authority - G2
5566Certificate: 5299Certificate:
5567 Data: 5300 Data:
@@ -5710,65 +5443,6 @@ Ld6leNcG2mqeSz53OiATIgHQv2ieY2BrNU0LbbqhPcCT4H8js1WtciVORvnSFu+w
5710ZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6LqjviOvrv1vA+ACOzB2+htt 5443ZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6LqjviOvrv1vA+ACOzB2+htt
5711Qc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ 5444Qc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
5712-----END CERTIFICATE----- 5445-----END CERTIFICATE-----
5713=== /C=CH/O=SwissSign AG/CN=SwissSign Silver CA - G2
5714Certificate:
5715 Data:
5716 Version: 3 (0x2)
5717 Serial Number: 5700383053117599563 (0x4f1bd42f54bb2f4b)
5718 Signature Algorithm: sha1WithRSAEncryption
5719 Validity
5720 Not Before: Oct 25 08:32:46 2006 GMT
5721 Not After : Oct 25 08:32:46 2036 GMT
5722 Subject: C=CH, O=SwissSign AG, CN=SwissSign Silver CA - G2
5723 X509v3 extensions:
5724 X509v3 Key Usage: critical
5725 Certificate Sign, CRL Sign
5726 X509v3 Basic Constraints: critical
5727 CA:TRUE
5728 X509v3 Subject Key Identifier:
5729 17:A0:CD:C1:E4:41:B6:3A:5B:3B:CB:45:9D:BD:1C:C2:98:FA:86:58
5730 X509v3 Authority Key Identifier:
5731 keyid:17:A0:CD:C1:E4:41:B6:3A:5B:3B:CB:45:9D:BD:1C:C2:98:FA:86:58
5732
5733 X509v3 Certificate Policies:
5734 Policy: 2.16.756.1.89.1.3.1.1
5735 CPS: http://repository.swisssign.com/
5736
5737SHA1 Fingerprint=9B:AA:E5:9F:56:EE:21:CB:43:5A:BE:25:93:DF:A7:F0:40:D1:1D:CB
5738SHA256 Fingerprint=BE:6C:4D:A2:BB:B9:BA:59:B6:F3:93:97:68:37:42:46:C3:C0:05:99:3F:A9:8F:02:0D:1D:ED:BE:D4:8A:81:D5
5739-----BEGIN CERTIFICATE-----
5740MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UE
5741BhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWdu
5742IFNpbHZlciBDQSAtIEcyMB4XDTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0Nlow
5743RzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMY
5744U3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
5745MIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644N0Mv
5746Fz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7br
5747YT7QbNHm+/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieF
5748nbAVlDLaYQ1HTWBCrpJH6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH
57496ATK72oxh9TAtvmUcXtnZLi2kUpCe2UuMGoM9ZDulebyzYLs2aFK7PayS+VFheZt
5750eJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5hqAaEuSh6XzjZG6k4sIN/
5751c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5FZGkECwJ
5752MoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRH
5753HTBsROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTf
5754jNFusB3hB48IHpmccelM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb6
57555i/4z3GcRm25xBWNOHkDRUjvxF3XCO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOB
5756rDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU
5757F6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRBtjpbO8tFnb0c
5758wpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
5759cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIB
5760AHPGgeAn0i0P4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShp
5761WJHckRE1qTodvBqlYJ7YH39FkWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9
5762xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L3XWgwF15kIwb4FDm3jH+mHtwX6WQ
57632K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx/uNncqCxv1yL5PqZ
5764IseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFaDGi8
5765aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2X
5766em1ZqSqPe97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQR
5767dAtq/gsD/KNVV4n+SsuuWxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/
5768OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJDIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+
5769hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ubDgEj8Z+7fNzcbBGXJbLy
5770tGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
5771-----END CERTIFICATE-----
5772 5446
5773### T-Systems Enterprise Services GmbH 5447### T-Systems Enterprise Services GmbH
5774 5448
@@ -6114,55 +5788,6 @@ HL/EVlP6Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVx
6114SK236thZiNSQvxaz2emsWWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY= 5788SK236thZiNSQvxaz2emsWWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
6115-----END CERTIFICATE----- 5789-----END CERTIFICATE-----
6116 5790
6117### The Go Daddy Group, Inc.
6118
6119=== /C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority
6120Certificate:
6121 Data:
6122 Version: 3 (0x2)
6123 Serial Number: 0 (0x0)
6124 Signature Algorithm: sha1WithRSAEncryption
6125 Validity
6126 Not Before: Jun 29 17:06:20 2004 GMT
6127 Not After : Jun 29 17:06:20 2034 GMT
6128 Subject: C=US, O=The Go Daddy Group, Inc., OU=Go Daddy Class 2 Certification Authority
6129 X509v3 extensions:
6130 X509v3 Subject Key Identifier:
6131 D2:C4:B0:D2:91:D4:4C:11:71:B3:61:CB:3D:A1:FE:DD:A8:6A:D4:E3
6132 X509v3 Authority Key Identifier:
6133 keyid:D2:C4:B0:D2:91:D4:4C:11:71:B3:61:CB:3D:A1:FE:DD:A8:6A:D4:E3
6134 DirName:/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority
6135 serial:00
6136
6137 X509v3 Basic Constraints:
6138 CA:TRUE
6139SHA1 Fingerprint=27:96:BA:E6:3F:18:01:E2:77:26:1B:A0:D7:77:70:02:8F:20:EE:E4
6140SHA256 Fingerprint=C3:84:6B:F2:4B:9E:93:CA:64:27:4C:0E:C6:7C:1E:CC:5E:02:4F:FC:AC:D2:D7:40:19:35:0E:81:FE:54:6A:E4
6141-----BEGIN CERTIFICATE-----
6142MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEh
6143MB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBE
6144YWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3
6145MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkGA1UEBhMCVVMxITAfBgNVBAoTGFRo
6146ZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28gRGFkZHkgQ2xhc3Mg
6147MiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQADggEN
6148ADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCA
6149PVYYYwhv2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6w
6150wdhFJ2+qN1j3hybX2C32qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXi
6151EqITLdiOr18SPaAIBQi2XKVlOARFmR6jYGB0xUGlcmIbYsUfb18aQr4CUWWoriMY
6152avx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmYvLEHZ6IVDd2gWMZEewo+
6153YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0OBBYEFNLE
6154sNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h
6155/t2oatTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5
6156IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmlj
6157YXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQAD
6158ggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wimPQoZ+YeAEW5p5JYXMP80kWNy
6159OO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKtI3lpjbi2Tc7P
6160TMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
6161HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mER
6162dEr/VxqHD3VILs9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5Cuf
6163ReYNnyicsbkqWletNw+vHX/bvZ8=
6164-----END CERTIFICATE-----
6165
6166### The USERTRUST Network 5791### The USERTRUST Network
6167 5792
6168=== /C=US/ST=New Jersey/L=Jersey City/O=The USERTRUST Network/CN=USERTrust ECC Certification Authority 5793=== /C=US/ST=New Jersey/L=Jersey City/O=The USERTRUST Network/CN=USERTrust ECC Certification Authority
@@ -6763,63 +6388,6 @@ rYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0EAwMDaAAwZQIwJsdpW9zV
6763Mgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9 6388Mgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9
6764-----END CERTIFICATE----- 6389-----END CERTIFICATE-----
6765 6390
6766### XRamp Security Services Inc
6767
6768=== /C=US/OU=www.xrampsecurity.com/O=XRamp Security Services Inc/CN=XRamp Global Certification Authority
6769Certificate:
6770 Data:
6771 Version: 3 (0x2)
6772 Serial Number:
6773 50:94:6c:ec:18:ea:d5:9c:4d:d5:97:ef:75:8f:a0:ad
6774 Signature Algorithm: sha1WithRSAEncryption
6775 Validity
6776 Not Before: Nov 1 17:14:04 2004 GMT
6777 Not After : Jan 1 05:37:19 2035 GMT
6778 Subject: C=US, OU=www.xrampsecurity.com, O=XRamp Security Services Inc, CN=XRamp Global Certification Authority
6779 X509v3 extensions:
6780 1.3.6.1.4.1.311.20.2:
6781 ...C.A
6782 X509v3 Key Usage:
6783 Digital Signature, Certificate Sign, CRL Sign
6784 X509v3 Basic Constraints: critical
6785 CA:TRUE
6786 X509v3 Subject Key Identifier:
6787 C6:4F:A2:3D:06:63:84:09:9C:CE:62:E4:04:AC:8D:5C:B5:E9:B6:1B
6788 X509v3 CRL Distribution Points:
6789
6790 Full Name:
6791 URI:http://crl.xrampsecurity.com/XGCA.crl
6792
6793 1.3.6.1.4.1.311.21.1:
6794 ...
6795SHA1 Fingerprint=B8:01:86:D1:EB:9C:86:A5:41:04:CF:30:54:F3:4C:52:B7:E5:58:C6
6796SHA256 Fingerprint=CE:CD:DC:90:50:99:D8:DA:DF:C5:B1:D2:09:B7:37:CB:E2:C1:8C:FB:2C:10:C0:FF:0B:CF:0D:32:86:FC:1A:A2
6797-----BEGIN CERTIFICATE-----
6798MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCB
6799gjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEk
6800MCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRY
6801UmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQxMTAxMTcx
6802NDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3
6803dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2Vy
6804dmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
6805dXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS6
680638eMpSe2OAtp87ZOqCwuIR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCP
6807KZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMxfoArtYzAQDsRhtDLooY2YKTVMIJt2W7Q
6808DxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FEzG+gSqmUsE3a56k0enI4
6809qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqsAxcZZPRa
6810JSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNVi
6811PvryxS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0P
6812BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASs
6813jVy16bYbMDYGA1UdHwQvMC0wK6ApoCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0
6814eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQEwDQYJKoZIhvcNAQEFBQAD
6815ggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc/Kh4ZzXxHfAR
6816vbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
6817qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLa
6818IR9NmXmd4c8nnxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSy
6819i6mx5O+aGtA9aZnuqCij4Tyz8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQ
6820O+7ETPTsJ3xCwnR8gooJybQDJbw=
6821-----END CERTIFICATE-----
6822
6823### certSIGN 6391### certSIGN
6824 6392
6825=== /C=RO/O=certSIGN/OU=certSIGN ROOT CA 6393=== /C=RO/O=certSIGN/OU=certSIGN ROOT CA
@@ -6862,6 +6430,64 @@ i/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7NzTogVZ96edhBiIL5VaZVDADlN
68629u6wWk5JRFRYX0KD 64309u6wWk5JRFRYX0KD
6863-----END CERTIFICATE----- 6431-----END CERTIFICATE-----
6864 6432
6433### e-commerce monitoring GmbH
6434
6435=== /C=AT/O=e-commerce monitoring GmbH/CN=GLOBALTRUST 2020
6436Certificate:
6437 Data:
6438 Version: 3 (0x2)
6439 Serial Number:
6440 5a:4b:bd:5a:fb:4f:8a:5b:fa:65:e5
6441 Signature Algorithm: sha256WithRSAEncryption
6442 Validity
6443 Not Before: Feb 10 00:00:00 2020 GMT
6444 Not After : Jun 10 00:00:00 2040 GMT
6445 Subject: C=AT, O=e-commerce monitoring GmbH, CN=GLOBALTRUST 2020
6446 X509v3 extensions:
6447 X509v3 Basic Constraints: critical
6448 CA:TRUE
6449 X509v3 Key Usage: critical
6450 Certificate Sign, CRL Sign
6451 X509v3 Subject Key Identifier:
6452 DC:2E:1F:D1:61:37:79:E4:AB:D5:D5:B3:12:71:68:3D:6A:68:9C:22
6453 X509v3 Authority Key Identifier:
6454 keyid:DC:2E:1F:D1:61:37:79:E4:AB:D5:D5:B3:12:71:68:3D:6A:68:9C:22
6455
6456SHA1 Fingerprint=D0:67:C1:13:51:01:0C:AA:D0:C7:6A:65:37:31:16:26:4F:53:71:A2
6457SHA256 Fingerprint=9A:29:6A:51:82:D1:D4:51:A2:E3:7F:43:9B:74:DA:AF:A2:67:52:33:29:F9:0F:9A:0D:20:07:C3:34:E2:3C:9A
6458-----BEGIN CERTIFICATE-----
6459MIIFgjCCA2qgAwIBAgILWku9WvtPilv6ZeUwDQYJKoZIhvcNAQELBQAwTTELMAkG
6460A1UEBhMCQVQxIzAhBgNVBAoTGmUtY29tbWVyY2UgbW9uaXRvcmluZyBHbWJIMRkw
6461FwYDVQQDExBHTE9CQUxUUlVTVCAyMDIwMB4XDTIwMDIxMDAwMDAwMFoXDTQwMDYx
6462MDAwMDAwMFowTTELMAkGA1UEBhMCQVQxIzAhBgNVBAoTGmUtY29tbWVyY2UgbW9u
6463aXRvcmluZyBHbWJIMRkwFwYDVQQDExBHTE9CQUxUUlVTVCAyMDIwMIICIjANBgkq
6464hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAri5WrRsc7/aVj6B3GyvTY4+ETUWiD59b
6465RatZe1E0+eyLinjF3WuvvcTfk0Uev5E4C64OFudBc/jbu9G4UeDLgztzOG53ig9Z
6466YybNpyrOVPu44sB8R85gfD+yc/LAGbaKkoc1DZAoouQVBGM+uq/ufF7MpotQsjj3
6467QWPKzv9pj2gOlTblzLmMCcpL3TGQlsjMH/1WljTbjhzqLL6FLmPdqqmV0/0plRPw
6468yJiT2S0WR5ARg6I6IqIoV6Lr/sCMKKCmfecqQjuCgGOlYx8ZzHyyZqjC0203b+J+
6469BlHZRYQfEs4kUmSFC0iAToexIiIwquuuvuAC4EDosEKAA1GqtH6qRNdDYfOiaxaJ
6470SaSjpCuKAsR49GiKweR6NrFvG5Ybd0mN1MkGco/PU+PcF4UgStyYJ9ORJitHHmkH
6471r96i5OTUawuzXnzUJIBHKWk7buis/UDr2O1xcSvy6Fgd60GXIsUf1DnQJ4+H4xj0
64724KlGDfV0OoIu0G4skaMxXDtG6nsEEFZegB31pWXogvziB4xiRfUg3kZwhqG8k9Me
6473dKZssCz3AwyIDMvUclOGvGBG85hqwvG/Q/lwIHfKN0F5VVJjjVsSn8VoxIidrPIw
6474q7ejMZdnrY8XD2zHc+0klGvIg5rQmjdJBKuxFshsSUktq6HQjJLyQUp5ISXbY9e2
6475nKd+Qmn7OmMCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
6476AQYwHQYDVR0OBBYEFNwuH9FhN3nkq9XVsxJxaD1qaJwiMB8GA1UdIwQYMBaAFNwu
6477H9FhN3nkq9XVsxJxaD1qaJwiMA0GCSqGSIb3DQEBCwUAA4ICAQCR8EICaEDuw2jA
6478VC/f7GLDw56KoDEoqoOOpFaWEhCGVrqXctJUMHytGdUdaG/7FELYjQ7ztdGl4wJC
6479XtzoRlgHNQIw4Lx0SsFDKv/bGtCwr2zD/cuz9X9tAy5ZVp0tLTWMstZDFyySCstd
64806IwPS3BD0IL/qMy/pJTAvoe9iuOTe8aPmxadJ2W8esVCgmxcB9CpwYhgROmYhRZf
6481+I/KARDOJcP5YBugxZfD0yyIMaK9MOzQ0MAS8cE54+X1+NZK3TTN+2/BT+MAi1bi
6482kvcoskJ3ciNnxz8RFbLEAwW+uxF7Cr+obuf/WEPPm2eggAe2HcqtbepBEX4tdJP7
6483wry+UUTF72glJ4DjyKDUEuzZpTcdN3y0kcra1LGWge9oXHYQSa9+pTeAsRxSvTOB
6484TI/53WXZFM2KJVj04sWDpQmQ1GwUY7VA3+vA/MRYfg0UFodUJ25W5HCEuGwyEn6C
6485MUO+1918oa2u1qsgEu8KwxCMSZY13At1XrFP1U80DhEgB3VDRemjEdqso5nCtnkn
64864rnvyOL2NSl6dPrFf4IFYqYK6miyeUcGbvJXqBUzxvd4Sj1Ce2t+/vdG6tHrju+I
6487aFvowdlxfv1k7/9nR4hYJS8+hge9+6jlgqispdNpQ80xiEmEU5LAsTkbOYMBMMTy
6488qfrQA71yN2BWHzZ8vTmR9W0Nv3vXkg==
6489-----END CERTIFICATE-----
6490
6865### eMudhra Inc 6491### eMudhra Inc
6866 6492
6867=== /C=US/OU=emSign PKI/O=eMudhra Inc/CN=emSign ECC Root CA - C3 6493=== /C=US/OU=emSign PKI/O=eMudhra Inc/CN=emSign ECC Root CA - C3
diff --git a/src/lib/libcrypto/cms/cms_dd.c b/src/lib/libcrypto/cms/cms_dd.c
index 0a357094c5..daccbcd988 100644
--- a/src/lib/libcrypto/cms/cms_dd.c
+++ b/src/lib/libcrypto/cms/cms_dd.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms_dd.c,v 1.17 2023/10/26 09:08:57 tb Exp $ */ 1/* $OpenBSD: cms_dd.c,v 1.18 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
4 * project. 4 * project.
@@ -56,11 +56,11 @@
56 56
57#include <openssl/asn1.h> 57#include <openssl/asn1.h>
58#include <openssl/cms.h> 58#include <openssl/cms.h>
59#include <openssl/err.h>
60#include <openssl/evp.h> 59#include <openssl/evp.h>
61#include <openssl/objects.h> 60#include <openssl/objects.h>
62 61
63#include "cms_local.h" 62#include "cms_local.h"
63#include "err_local.h"
64#include "x509_local.h" 64#include "x509_local.h"
65 65
66/* CMS DigestedData Utilities */ 66/* CMS DigestedData Utilities */
diff --git a/src/lib/libcrypto/cms/cms_enc.c b/src/lib/libcrypto/cms/cms_enc.c
index ef6925dbd6..928b396815 100644
--- a/src/lib/libcrypto/cms/cms_enc.c
+++ b/src/lib/libcrypto/cms/cms_enc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms_enc.c,v 1.25 2024/11/01 18:34:06 tb Exp $ */ 1/* $OpenBSD: cms_enc.c,v 1.26 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
4 * project. 4 * project.
@@ -58,12 +58,12 @@
58#include <openssl/asn1.h> 58#include <openssl/asn1.h>
59#include <openssl/bio.h> 59#include <openssl/bio.h>
60#include <openssl/cms.h> 60#include <openssl/cms.h>
61#include <openssl/err.h>
62#include <openssl/evp.h> 61#include <openssl/evp.h>
63#include <openssl/objects.h> 62#include <openssl/objects.h>
64#include <openssl/x509.h> 63#include <openssl/x509.h>
65 64
66#include "cms_local.h" 65#include "cms_local.h"
66#include "err_local.h"
67#include "evp_local.h" 67#include "evp_local.h"
68 68
69/* CMS EncryptedData Utilities */ 69/* CMS EncryptedData Utilities */
diff --git a/src/lib/libcrypto/cms/cms_env.c b/src/lib/libcrypto/cms/cms_env.c
index 629d23215e..7fa578466d 100644
--- a/src/lib/libcrypto/cms/cms_env.c
+++ b/src/lib/libcrypto/cms/cms_env.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms_env.c,v 1.28 2024/11/01 18:42:10 tb Exp $ */ 1/* $OpenBSD: cms_env.c,v 1.29 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
4 * project. 4 * project.
@@ -59,12 +59,12 @@
59#include <openssl/asn1.h> 59#include <openssl/asn1.h>
60#include <openssl/bio.h> 60#include <openssl/bio.h>
61#include <openssl/cms.h> 61#include <openssl/cms.h>
62#include <openssl/err.h>
63#include <openssl/evp.h> 62#include <openssl/evp.h>
64#include <openssl/objects.h> 63#include <openssl/objects.h>
65#include <openssl/x509.h> 64#include <openssl/x509.h>
66 65
67#include "cms_local.h" 66#include "cms_local.h"
67#include "err_local.h"
68#include "evp_local.h" 68#include "evp_local.h"
69 69
70/* CMS EnvelopedData Utilities */ 70/* CMS EnvelopedData Utilities */
diff --git a/src/lib/libcrypto/cms/cms_ess.c b/src/lib/libcrypto/cms/cms_ess.c
index f01dcf73ed..5435fa404c 100644
--- a/src/lib/libcrypto/cms/cms_ess.c
+++ b/src/lib/libcrypto/cms/cms_ess.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms_ess.c,v 1.26 2024/11/01 18:53:35 tb Exp $ */ 1/* $OpenBSD: cms_ess.c,v 1.27 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
4 * project. 4 * project.
@@ -57,13 +57,13 @@
57 57
58#include <openssl/asn1.h> 58#include <openssl/asn1.h>
59#include <openssl/cms.h> 59#include <openssl/cms.h>
60#include <openssl/err.h>
61#include <openssl/evp.h> 60#include <openssl/evp.h>
62#include <openssl/objects.h> 61#include <openssl/objects.h>
63#include <openssl/x509.h> 62#include <openssl/x509.h>
64#include <openssl/x509v3.h> 63#include <openssl/x509v3.h>
65 64
66#include "cms_local.h" 65#include "cms_local.h"
66#include "err_local.h"
67 67
68CMS_ReceiptRequest * 68CMS_ReceiptRequest *
69d2i_CMS_ReceiptRequest(CMS_ReceiptRequest **a, const unsigned char **in, long len) 69d2i_CMS_ReceiptRequest(CMS_ReceiptRequest **a, const unsigned char **in, long len)
diff --git a/src/lib/libcrypto/cms/cms_io.c b/src/lib/libcrypto/cms/cms_io.c
index 84ada47c49..a9be5461a3 100644
--- a/src/lib/libcrypto/cms/cms_io.c
+++ b/src/lib/libcrypto/cms/cms_io.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms_io.c,v 1.21 2024/03/30 01:53:05 joshua Exp $ */ 1/* $OpenBSD: cms_io.c,v 1.22 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
4 * project. 4 * project.
@@ -54,12 +54,12 @@
54 54
55#include <openssl/asn1t.h> 55#include <openssl/asn1t.h>
56#include <openssl/cms.h> 56#include <openssl/cms.h>
57#include <openssl/err.h>
58#include <openssl/pem.h> 57#include <openssl/pem.h>
59#include <openssl/x509.h> 58#include <openssl/x509.h>
60 59
61#include "asn1_local.h" 60#include "asn1_local.h"
62#include "cms_local.h" 61#include "cms_local.h"
62#include "err_local.h"
63 63
64int 64int
65CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms) 65CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms)
diff --git a/src/lib/libcrypto/cms/cms_kari.c b/src/lib/libcrypto/cms/cms_kari.c
index 86b1ad9e83..c23da18058 100644
--- a/src/lib/libcrypto/cms/cms_kari.c
+++ b/src/lib/libcrypto/cms/cms_kari.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms_kari.c,v 1.17 2024/11/01 18:34:06 tb Exp $ */ 1/* $OpenBSD: cms_kari.c,v 1.18 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
4 * project. 4 * project.
@@ -57,10 +57,10 @@
57 57
58#include <openssl/asn1.h> 58#include <openssl/asn1.h>
59#include <openssl/cms.h> 59#include <openssl/cms.h>
60#include <openssl/err.h>
61#include <openssl/evp.h> 60#include <openssl/evp.h>
62 61
63#include "cms_local.h" 62#include "cms_local.h"
63#include "err_local.h"
64 64
65/* Key Agreement Recipient Info (KARI) routines */ 65/* Key Agreement Recipient Info (KARI) routines */
66 66
diff --git a/src/lib/libcrypto/cms/cms_lib.c b/src/lib/libcrypto/cms/cms_lib.c
index 2d7a8d9f21..b9fc5c21c7 100644
--- a/src/lib/libcrypto/cms/cms_lib.c
+++ b/src/lib/libcrypto/cms/cms_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms_lib.c,v 1.26 2024/11/01 18:53:35 tb Exp $ */ 1/* $OpenBSD: cms_lib.c,v 1.27 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
4 * project. 4 * project.
@@ -57,13 +57,13 @@
57#include <openssl/asn1.h> 57#include <openssl/asn1.h>
58#include <openssl/bio.h> 58#include <openssl/bio.h>
59#include <openssl/cms.h> 59#include <openssl/cms.h>
60#include <openssl/err.h>
61#include <openssl/evp.h> 60#include <openssl/evp.h>
62#include <openssl/objects.h> 61#include <openssl/objects.h>
63#include <openssl/x509.h> 62#include <openssl/x509.h>
64#include <openssl/x509v3.h> 63#include <openssl/x509v3.h>
65 64
66#include "cms_local.h" 65#include "cms_local.h"
66#include "err_local.h"
67#include "x509_local.h" 67#include "x509_local.h"
68 68
69CMS_ContentInfo * 69CMS_ContentInfo *
diff --git a/src/lib/libcrypto/cms/cms_pwri.c b/src/lib/libcrypto/cms/cms_pwri.c
index b6fe5df961..1f64fc71f7 100644
--- a/src/lib/libcrypto/cms/cms_pwri.c
+++ b/src/lib/libcrypto/cms/cms_pwri.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms_pwri.c,v 1.31 2024/01/14 18:40:24 tb Exp $ */ 1/* $OpenBSD: cms_pwri.c,v 1.32 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
4 * project. 4 * project.
@@ -58,13 +58,13 @@
58#include <string.h> 58#include <string.h>
59 59
60#include <openssl/asn1.h> 60#include <openssl/asn1.h>
61#include <openssl/err.h>
62#include <openssl/evp.h> 61#include <openssl/evp.h>
63#include <openssl/cms.h> 62#include <openssl/cms.h>
64#include <openssl/objects.h> 63#include <openssl/objects.h>
65#include <openssl/x509.h> 64#include <openssl/x509.h>
66 65
67#include "cms_local.h" 66#include "cms_local.h"
67#include "err_local.h"
68#include "evp_local.h" 68#include "evp_local.h"
69#include "x509_local.h" 69#include "x509_local.h"
70 70
diff --git a/src/lib/libcrypto/cms/cms_sd.c b/src/lib/libcrypto/cms/cms_sd.c
index 9cdd4ce143..abcac83e47 100644
--- a/src/lib/libcrypto/cms/cms_sd.c
+++ b/src/lib/libcrypto/cms/cms_sd.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms_sd.c,v 1.33 2024/04/20 10:11:55 tb Exp $ */ 1/* $OpenBSD: cms_sd.c,v 1.36 2025/07/31 02:24:21 tb Exp $ */
2/* 2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
4 * project. 4 * project.
@@ -57,7 +57,6 @@
57 57
58#include <openssl/asn1.h> 58#include <openssl/asn1.h>
59#include <openssl/bio.h> 59#include <openssl/bio.h>
60#include <openssl/err.h>
61#include <openssl/evp.h> 60#include <openssl/evp.h>
62#include <openssl/cms.h> 61#include <openssl/cms.h>
63#include <openssl/objects.h> 62#include <openssl/objects.h>
@@ -66,6 +65,7 @@
66 65
67#include "asn1_local.h" 66#include "asn1_local.h"
68#include "cms_local.h" 67#include "cms_local.h"
68#include "err_local.h"
69#include "evp_local.h" 69#include "evp_local.h"
70#include "x509_local.h" 70#include "x509_local.h"
71 71
@@ -484,35 +484,6 @@ CMS_add1_signer(CMS_ContentInfo *cms, X509 *signer, EVP_PKEY *pk,
484} 484}
485LCRYPTO_ALIAS(CMS_add1_signer); 485LCRYPTO_ALIAS(CMS_add1_signer);
486 486
487static int
488cms_add1_signingTime(CMS_SignerInfo *si, ASN1_TIME *t)
489{
490 ASN1_TIME *tt;
491 int r = 0;
492
493 if (t)
494 tt = t;
495 else
496 tt = X509_gmtime_adj(NULL, 0);
497
498 if (!tt)
499 goto merr;
500
501 if (CMS_signed_add1_attr_by_NID(si, NID_pkcs9_signingTime,
502 tt->type, tt, -1) <= 0)
503 goto merr;
504
505 r = 1;
506
507 merr:
508 if (!t)
509 ASN1_TIME_free(tt);
510 if (!r)
511 CMSerror(ERR_R_MALLOC_FAILURE);
512
513 return r;
514}
515
516EVP_PKEY_CTX * 487EVP_PKEY_CTX *
517CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si) 488CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si)
518{ 489{
@@ -778,6 +749,7 @@ cms_SignedData_final(CMS_ContentInfo *cms, BIO *chain)
778int 749int
779CMS_SignerInfo_sign(CMS_SignerInfo *si) 750CMS_SignerInfo_sign(CMS_SignerInfo *si)
780{ 751{
752 ASN1_TIME *at = NULL;
781 const EVP_MD *md; 753 const EVP_MD *md;
782 unsigned char *buf = NULL, *sig = NULL; 754 unsigned char *buf = NULL, *sig = NULL;
783 int buf_len = 0; 755 int buf_len = 0;
@@ -788,7 +760,12 @@ CMS_SignerInfo_sign(CMS_SignerInfo *si)
788 goto err; 760 goto err;
789 761
790 if (CMS_signed_get_attr_by_NID(si, NID_pkcs9_signingTime, -1) < 0) { 762 if (CMS_signed_get_attr_by_NID(si, NID_pkcs9_signingTime, -1) < 0) {
791 if (!cms_add1_signingTime(si, NULL)) 763 if ((at = X509_gmtime_adj(NULL, 0)) == NULL) {
764 CMSerror(ERR_R_MALLOC_FAILURE);
765 goto err;
766 }
767 if (!CMS_signed_add1_attr_by_NID(si, NID_pkcs9_signingTime,
768 at->type, at, -1))
792 goto err; 769 goto err;
793 } 770 }
794 771
@@ -828,6 +805,7 @@ CMS_SignerInfo_sign(CMS_SignerInfo *si)
828 ret = 1; 805 ret = 1;
829 806
830 err: 807 err:
808 ASN1_TIME_free(at);
831 (void)EVP_MD_CTX_reset(si->mctx); 809 (void)EVP_MD_CTX_reset(si->mctx);
832 freezero(buf, buf_len); 810 freezero(buf, buf_len);
833 freezero(sig, sig_len); 811 freezero(sig, sig_len);
@@ -1012,6 +990,8 @@ LCRYPTO_ALIAS(CMS_add_smimecap);
1012 * Add AlgorithmIdentifier OID of type |nid| to the SMIMECapability attribute 990 * Add AlgorithmIdentifier OID of type |nid| to the SMIMECapability attribute
1013 * set |*out_algs| (see RFC 3851, section 2.5.2). If keysize > 0, the OID has 991 * set |*out_algs| (see RFC 3851, section 2.5.2). If keysize > 0, the OID has
1014 * an integer parameter of value |keysize|, otherwise parameters are omitted. 992 * an integer parameter of value |keysize|, otherwise parameters are omitted.
993 *
994 * See also PKCS7_simple_smimecap().
1015 */ 995 */
1016int 996int
1017CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **out_algs, int nid, int keysize) 997CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **out_algs, int nid, int keysize)
diff --git a/src/lib/libcrypto/cms/cms_smime.c b/src/lib/libcrypto/cms/cms_smime.c
index 5a194748d9..85a0e6f6e5 100644
--- a/src/lib/libcrypto/cms/cms_smime.c
+++ b/src/lib/libcrypto/cms/cms_smime.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms_smime.c,v 1.28 2023/12/22 10:23:11 tb Exp $ */ 1/* $OpenBSD: cms_smime.c,v 1.29 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
4 * project. 4 * project.
@@ -59,7 +59,6 @@
59#include <openssl/asn1.h> 59#include <openssl/asn1.h>
60#include <openssl/bio.h> 60#include <openssl/bio.h>
61#include <openssl/cms.h> 61#include <openssl/cms.h>
62#include <openssl/err.h>
63#include <openssl/evp.h> 62#include <openssl/evp.h>
64#include <openssl/objects.h> 63#include <openssl/objects.h>
65#include <openssl/pkcs7.h> 64#include <openssl/pkcs7.h>
@@ -67,6 +66,7 @@
67#include <openssl/x509_vfy.h> 66#include <openssl/x509_vfy.h>
68 67
69#include "cms_local.h" 68#include "cms_local.h"
69#include "err_local.h"
70 70
71static BIO * 71static BIO *
72cms_get_text_bio(BIO *out, unsigned int flags) 72cms_get_text_bio(BIO *out, unsigned int flags)
diff --git a/src/lib/libcrypto/conf/README b/src/lib/libcrypto/conf/README
deleted file mode 100644
index 96e53b34ed..0000000000
--- a/src/lib/libcrypto/conf/README
+++ /dev/null
@@ -1,73 +0,0 @@
1Configuration modules. These are a set of modules which can perform
2various configuration functions.
3
4Currently the routines should be called at most once when an application
5starts up: that is before it starts any threads.
6
7The routines read a configuration file set up like this:
8
9-----
10#default section
11openssl_conf=init_section
12
13[init_section]
14
15module1=value1
16#Second instance of module1
17module1.1=valueX
18module2=value2
19module3=dso_literal
20module4=dso_section
21
22[dso_section]
23
24path=/some/path/to/some/dso.so
25other_stuff=other_value
26----
27
28When this file is loaded a configuration module with the specified string
29(module* in the above example) is looked up and its init function called as:
30
31int conf_init_func(CONF_IMODULE *md, CONF *cnf);
32
33The function can then take whatever action is appropriate, for example further
34lookups based on the value. Multiple instances of the same config module can be
35loaded.
36
37When the application closes down the modules are cleaned up by calling an
38optional finish function:
39
40void conf_finish_func(CONF_IMODULE *md);
41
42The finish functions are called in reverse order: that is the last module
43loaded is the first one cleaned up.
44
45If no module exists with a given name then an attempt is made to load a DSO
46with the supplied name. This might mean that "module3" attempts to load a DSO
47called libmodule3.so or module3.dll for example. An explicit DSO name can be
48given by including a separate section as in the module4 example above.
49
50The DSO is expected to at least contain an initialization function:
51
52int OPENSSL_init(CONF_IMODULE *md, CONF *cnf);
53
54and may also include a finish function:
55
56void OPENSSL_finish(CONF_IMODULE *md);
57
58Static modules can also be added using,
59
60int CONF_module_add(char *name, dso_mod_init_func *ifunc, dso_mod_finish_func
61*ffunc);
62
63where "name" is the name in the configuration file this function corresponds
64to.
65
66A set of builtin modules (currently only an ASN1 non functional test module)
67can be added by calling OPENSSL_load_builtin_modules().
68
69The function OPENSSL_config() is intended as a simple configuration function
70that any application can call to perform various default configuration tasks.
71It uses the file openssl.cnf in the usual locations.
72
73
diff --git a/src/lib/libcrypto/conf/conf_def.c b/src/lib/libcrypto/conf/conf_def.c
index 0173a7117c..fe9391685d 100644
--- a/src/lib/libcrypto/conf/conf_def.c
+++ b/src/lib/libcrypto/conf/conf_def.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: conf_def.c,v 1.44 2024/08/31 09:46:17 tb Exp $ */ 1/* $OpenBSD: conf_def.c,v 1.45 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -63,12 +63,12 @@
63 63
64#include <openssl/buffer.h> 64#include <openssl/buffer.h>
65#include <openssl/conf.h> 65#include <openssl/conf.h>
66#include <openssl/err.h>
67#include <openssl/lhash.h> 66#include <openssl/lhash.h>
68#include <openssl/stack.h> 67#include <openssl/stack.h>
69 68
70#include "conf_def.h" 69#include "conf_def.h"
71#include "conf_local.h" 70#include "conf_local.h"
71#include "err_local.h"
72 72
73#define MAX_CONF_VALUE_LENGTH 65536 73#define MAX_CONF_VALUE_LENGTH 65536
74 74
diff --git a/src/lib/libcrypto/conf/conf_lib.c b/src/lib/libcrypto/conf/conf_lib.c
index 863e1c9475..84b4f8b0a7 100644
--- a/src/lib/libcrypto/conf/conf_lib.c
+++ b/src/lib/libcrypto/conf/conf_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: conf_lib.c,v 1.25 2025/03/08 09:35:53 tb Exp $ */ 1/* $OpenBSD: conf_lib.c,v 1.26 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL 2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -58,11 +58,11 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include <openssl/crypto.h> 60#include <openssl/crypto.h>
61#include <openssl/err.h>
62#include <openssl/conf.h> 61#include <openssl/conf.h>
63#include <openssl/lhash.h> 62#include <openssl/lhash.h>
64 63
65#include "conf_local.h" 64#include "conf_local.h"
65#include "err_local.h"
66 66
67static const CONF_METHOD *default_CONF_method = NULL; 67static const CONF_METHOD *default_CONF_method = NULL;
68 68
diff --git a/src/lib/libcrypto/conf/conf_mod.c b/src/lib/libcrypto/conf/conf_mod.c
index 0e07bb3ea5..6e697cc478 100644
--- a/src/lib/libcrypto/conf/conf_mod.c
+++ b/src/lib/libcrypto/conf/conf_mod.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: conf_mod.c,v 1.40 2024/10/10 06:51:22 tb Exp $ */ 1/* $OpenBSD: conf_mod.c,v 1.41 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Stephen Henson (steve@openssl.org) for the OpenSSL 2/* Written by Stephen Henson (steve@openssl.org) for the OpenSSL
3 * project 2001. 3 * project 2001.
4 */ 4 */
@@ -63,9 +63,10 @@
63 63
64#include <openssl/conf.h> 64#include <openssl/conf.h>
65#include <openssl/crypto.h> 65#include <openssl/crypto.h>
66#include <openssl/err.h>
67#include <openssl/x509.h> 66#include <openssl/x509.h>
68 67
68#include "err_local.h"
69
69/* This structure contains data about supported modules. */ 70/* This structure contains data about supported modules. */
70struct conf_module_st { 71struct conf_module_st {
71 /* Name of the module */ 72 /* Name of the module */
diff --git a/src/lib/libcrypto/crypto_ex_data.c b/src/lib/libcrypto/crypto_ex_data.c
index ceb3a92e51..233905f888 100644
--- a/src/lib/libcrypto/crypto_ex_data.c
+++ b/src/lib/libcrypto/crypto_ex_data.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto_ex_data.c,v 1.4 2024/08/03 07:45:26 tb Exp $ */ 1/* $OpenBSD: crypto_ex_data.c,v 1.6 2025/06/15 15:58:56 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -52,7 +52,7 @@ crypto_ex_data_classes_init(void)
52 return 1; 52 return 1;
53 53
54 if ((classes_new = calloc(CRYPTO_EX_INDEX__COUNT, 54 if ((classes_new = calloc(CRYPTO_EX_INDEX__COUNT,
55 sizeof(struct crypto_ex_data_index))) == NULL) 55 sizeof(*classes_new))) == NULL)
56 return 0; 56 return 0;
57 57
58 CRYPTO_w_lock(CRYPTO_LOCK_EX_DATA); 58 CRYPTO_w_lock(CRYPTO_LOCK_EX_DATA);
@@ -100,11 +100,10 @@ CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,
100 goto err; 100 goto err;
101 101
102 if ((class = classes[class_index]) == NULL) { 102 if ((class = classes[class_index]) == NULL) {
103 if ((new_class = calloc(1, 103 if ((new_class = calloc(1, sizeof(*new_class))) == NULL)
104 sizeof(struct crypto_ex_data_class))) == NULL)
105 goto err; 104 goto err;
106 if ((new_class->indexes = calloc(CRYPTO_EX_DATA_MAX_INDEX, 105 if ((new_class->indexes = calloc(CRYPTO_EX_DATA_MAX_INDEX,
107 sizeof(struct crypto_ex_data_index *))) == NULL) 106 sizeof(*new_class->indexes))) == NULL)
108 goto err; 107 goto err;
109 new_class->indexes_len = CRYPTO_EX_DATA_MAX_INDEX; 108 new_class->indexes_len = CRYPTO_EX_DATA_MAX_INDEX;
110 new_class->next_index = 1; 109 new_class->next_index = 1;
@@ -119,7 +118,7 @@ CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,
119 class = classes[class_index]; 118 class = classes[class_index];
120 } 119 }
121 120
122 if ((index = calloc(1, sizeof(struct crypto_ex_data_index))) == NULL) 121 if ((index = calloc(1, sizeof(*index))) == NULL)
123 goto err; 122 goto err;
124 123
125 index->new_func = new_func; 124 index->new_func = new_func;
@@ -200,12 +199,12 @@ crypto_ex_data_init(CRYPTO_EX_DATA *exdata)
200 if (exdata->sk != NULL) 199 if (exdata->sk != NULL)
201 goto err; 200 goto err;
202 201
203 if ((ced = calloc(1, sizeof(struct crypto_ex_data))) == NULL) 202 if ((ced = calloc(1, sizeof(*ced))) == NULL)
204 goto err; 203 goto err;
205 204
206 ced->class_index = -1; 205 ced->class_index = -1;
207 206
208 if ((ced->slots = calloc(CRYPTO_EX_DATA_MAX_INDEX, sizeof(void *))) == NULL) 207 if ((ced->slots = calloc(CRYPTO_EX_DATA_MAX_INDEX, sizeof(*ced->slots))) == NULL)
209 goto err; 208 goto err;
210 ced->slots_len = CRYPTO_EX_DATA_MAX_INDEX; 209 ced->slots_len = CRYPTO_EX_DATA_MAX_INDEX;
211 210
diff --git a/src/lib/libcrypto/crypto_init.c b/src/lib/libcrypto/crypto_init.c
index 6016d1ae40..ae4914e358 100644
--- a/src/lib/libcrypto/crypto_init.c
+++ b/src/lib/libcrypto/crypto_init.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto_init.c,v 1.22 2024/10/17 14:27:57 jsing Exp $ */ 1/* $OpenBSD: crypto_init.c,v 1.26 2025/06/11 07:41:12 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2018 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2018 Bob Beck <beck@openbsd.org>
4 * 4 *
@@ -22,12 +22,12 @@
22 22
23#include <openssl/asn1.h> 23#include <openssl/asn1.h>
24#include <openssl/conf.h> 24#include <openssl/conf.h>
25#include <openssl/err.h>
26#include <openssl/evp.h> 25#include <openssl/evp.h>
27#include <openssl/objects.h> 26#include <openssl/objects.h>
28#include <openssl/x509v3.h> 27#include <openssl/x509v3.h>
29 28
30#include "crypto_internal.h" 29#include "crypto_internal.h"
30#include "err_local.h"
31#include "x509_issuer_cache.h" 31#include "x509_issuer_cache.h"
32 32
33int OpenSSL_config(const char *); 33int OpenSSL_config(const char *);
@@ -37,6 +37,30 @@ static pthread_once_t crypto_init_once = PTHREAD_ONCE_INIT;
37static pthread_t crypto_init_thread; 37static pthread_t crypto_init_thread;
38static int crypto_init_cleaned_up; 38static int crypto_init_cleaned_up;
39 39
40void openssl_init_crypto_constructor(void) __attribute__((constructor));
41
42#ifndef HAVE_CRYPTO_CPU_CAPS_INIT
43void
44crypto_cpu_caps_init(void)
45{
46}
47#endif
48
49/*
50 * This function is invoked as a constructor when the library is loaded. The
51 * code run from here must not allocate memory or trigger signals. The only
52 * safe code is to read data and update global variables.
53 */
54void
55openssl_init_crypto_constructor(void)
56{
57 crypto_cpu_caps_init();
58}
59
60/*
61 * This is used by various configure scripts to check availability of libcrypto,
62 * so we need to keep it.
63 */
40void 64void
41OPENSSL_init(void) 65OPENSSL_init(void)
42{ 66{
@@ -48,8 +72,6 @@ OPENSSL_init_crypto_internal(void)
48{ 72{
49 crypto_init_thread = pthread_self(); 73 crypto_init_thread = pthread_self();
50 74
51 crypto_cpu_caps_init();
52
53 ERR_load_crypto_strings(); 75 ERR_load_crypto_strings();
54} 76}
55 77
diff --git a/src/lib/libcrypto/crypto_internal.h b/src/lib/libcrypto/crypto_internal.h
index 09ae7fa466..058245e95e 100644
--- a/src/lib/libcrypto/crypto_internal.h
+++ b/src/lib/libcrypto/crypto_internal.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto_internal.h,v 1.15 2025/01/19 07:51:41 jsing Exp $ */ 1/* $OpenBSD: crypto_internal.h,v 1.16 2025/07/22 09:18:02 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -300,6 +300,4 @@ crypto_ror_u64(uint64_t v, size_t shift)
300 300
301void crypto_cpu_caps_init(void); 301void crypto_cpu_caps_init(void);
302 302
303uint64_t crypto_cpu_caps_ia32(void);
304
305#endif 303#endif
diff --git a/src/lib/libcrypto/crypto_legacy.c b/src/lib/libcrypto/crypto_legacy.c
index d864fc4c3f..dcaa63236c 100644
--- a/src/lib/libcrypto/crypto_legacy.c
+++ b/src/lib/libcrypto/crypto_legacy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto_legacy.c,v 1.6 2024/11/06 04:18:42 tb Exp $ */ 1/* $OpenBSD: crypto_legacy.c,v 1.9 2025/07/22 09:18:02 jsing Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -123,10 +123,10 @@
123 123
124#include <openssl/opensslconf.h> 124#include <openssl/opensslconf.h>
125#include <openssl/crypto.h> 125#include <openssl/crypto.h>
126#include <openssl/err.h>
127 126
128#include "crypto_internal.h" 127#include "crypto_internal.h"
129#include "crypto_local.h" 128#include "crypto_local.h"
129#include "err_local.h"
130#include "x86_arch.h" 130#include "x86_arch.h"
131 131
132/* Machine independent capabilities. */ 132/* Machine independent capabilities. */
@@ -306,29 +306,6 @@ void
306} 306}
307LCRYPTO_ALIAS(CRYPTO_get_dynlock_destroy_callback); 307LCRYPTO_ALIAS(CRYPTO_get_dynlock_destroy_callback);
308 308
309#if !defined(OPENSSL_CPUID_SETUP) && !defined(OPENSSL_CPUID_OBJ)
310void
311OPENSSL_cpuid_setup(void)
312{
313}
314#endif
315
316#ifndef HAVE_CRYPTO_CPU_CAPS_INIT
317void
318crypto_cpu_caps_init(void)
319{
320 OPENSSL_cpuid_setup();
321}
322#endif
323
324#ifndef HAVE_CRYPTO_CPU_CAPS_IA32
325uint64_t
326crypto_cpu_caps_ia32(void)
327{
328 return 0;
329}
330#endif
331
332uint64_t 309uint64_t
333OPENSSL_cpu_caps(void) 310OPENSSL_cpu_caps(void)
334{ 311{
diff --git a/src/lib/libcrypto/crypto_local.h b/src/lib/libcrypto/crypto_local.h
index 2b4c74552f..606f17cefb 100644
--- a/src/lib/libcrypto/crypto_local.h
+++ b/src/lib/libcrypto/crypto_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto_local.h,v 1.4 2024/11/05 10:11:58 tb Exp $ */ 1/* $OpenBSD: crypto_local.h,v 1.6 2025/06/09 14:37:48 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -65,6 +65,10 @@
65extern "C" { 65extern "C" {
66#endif 66#endif
67 67
68#ifndef OPENSSLDIR
69#define OPENSSLDIR "/etc/ssl"
70#endif
71
68#define X509_CERT_AREA OPENSSLDIR 72#define X509_CERT_AREA OPENSSLDIR
69#define X509_CERT_DIR OPENSSLDIR "/certs" 73#define X509_CERT_DIR OPENSSLDIR "/certs"
70#define X509_CERT_FILE OPENSSLDIR "/cert.pem" 74#define X509_CERT_FILE OPENSSLDIR "/cert.pem"
@@ -75,8 +79,6 @@ extern "C" {
75#define CTLOG_FILE OPENSSLDIR "/ct_log_list.cnf" 79#define CTLOG_FILE OPENSSLDIR "/ct_log_list.cnf"
76#define CTLOG_FILE_EVP "CTLOG_FILE" 80#define CTLOG_FILE_EVP "CTLOG_FILE"
77 81
78void OPENSSL_cpuid_setup(void);
79
80#ifdef __cplusplus 82#ifdef __cplusplus
81} 83}
82#endif 84#endif
diff --git a/src/lib/libcrypto/ct/ct_b64.c b/src/lib/libcrypto/ct/ct_b64.c
index 101cd1e2b1..e6e0532add 100644
--- a/src/lib/libcrypto/ct/ct_b64.c
+++ b/src/lib/libcrypto/ct/ct_b64.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ct_b64.c,v 1.7 2023/07/08 07:22:58 beck Exp $ */ 1/* $OpenBSD: ct_b64.c,v 1.8 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Written by Rob Stradling (rob@comodo.com) and Stephen Henson 3 * Written by Rob Stradling (rob@comodo.com) and Stephen Henson
4 * (steve@openssl.org) for the OpenSSL project 2014. 4 * (steve@openssl.org) for the OpenSSL project 2014.
@@ -61,11 +61,11 @@
61#include <string.h> 61#include <string.h>
62 62
63#include <openssl/ct.h> 63#include <openssl/ct.h>
64#include <openssl/err.h>
65#include <openssl/evp.h> 64#include <openssl/evp.h>
66 65
67#include "bytestring.h" 66#include "bytestring.h"
68#include "ct_local.h" 67#include "ct_local.h"
68#include "err_local.h"
69 69
70/* 70/*
71 * Decodes the base64 string |in| into |out|. 71 * Decodes the base64 string |in| into |out|.
diff --git a/src/lib/libcrypto/ct/ct_log.c b/src/lib/libcrypto/ct/ct_log.c
index 72045477ac..48611df979 100644
--- a/src/lib/libcrypto/ct/ct_log.c
+++ b/src/lib/libcrypto/ct/ct_log.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ct_log.c,v 1.9 2024/11/05 09:35:40 tb Exp $ */ 1/* $OpenBSD: ct_log.c,v 1.10 2025/05/10 05:54:38 tb Exp $ */
2/* Author: Adam Eijdenberg <adam.eijdenberg@gmail.com>. */ 2/* Author: Adam Eijdenberg <adam.eijdenberg@gmail.com>. */
3/* ==================================================================== 3/* ====================================================================
4 * Copyright (c) 1998-2016 The OpenSSL Project. All rights reserved. 4 * Copyright (c) 1998-2016 The OpenSSL Project. All rights reserved.
@@ -65,13 +65,13 @@
65#include <openssl/asn1.h> 65#include <openssl/asn1.h>
66#include <openssl/conf.h> 66#include <openssl/conf.h>
67#include <openssl/ct.h> 67#include <openssl/ct.h>
68#include <openssl/err.h>
69#include <openssl/evp.h> 68#include <openssl/evp.h>
70#include <openssl/sha.h> 69#include <openssl/sha.h>
71#include <openssl/x509.h> 70#include <openssl/x509.h>
72 71
73#include "conf_local.h" 72#include "conf_local.h"
74#include "crypto_local.h" 73#include "crypto_local.h"
74#include "err_local.h"
75 75
76 76
77/* 77/*
diff --git a/src/lib/libcrypto/ct/ct_oct.c b/src/lib/libcrypto/ct/ct_oct.c
index 1f5e5c75d0..686d845f11 100644
--- a/src/lib/libcrypto/ct/ct_oct.c
+++ b/src/lib/libcrypto/ct/ct_oct.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ct_oct.c,v 1.9 2023/07/08 07:22:58 beck Exp $ */ 1/* $OpenBSD: ct_oct.c,v 1.10 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Written by Rob Stradling (rob@comodo.com) and Stephen Henson 3 * Written by Rob Stradling (rob@comodo.com) and Stephen Henson
4 * (steve@openssl.org) for the OpenSSL project 2014. 4 * (steve@openssl.org) for the OpenSSL project 2014.
@@ -67,10 +67,10 @@
67#include <openssl/asn1.h> 67#include <openssl/asn1.h>
68#include <openssl/buffer.h> 68#include <openssl/buffer.h>
69#include <openssl/ct.h> 69#include <openssl/ct.h>
70#include <openssl/err.h>
71 70
72#include "bytestring.h" 71#include "bytestring.h"
73#include "ct_local.h" 72#include "ct_local.h"
73#include "err_local.h"
74 74
75int 75int
76o2i_SCT_signature(SCT *sct, CBS *cbs) 76o2i_SCT_signature(SCT *sct, CBS *cbs)
diff --git a/src/lib/libcrypto/ct/ct_policy.c b/src/lib/libcrypto/ct/ct_policy.c
index eb2b312019..a242b0d8f8 100644
--- a/src/lib/libcrypto/ct/ct_policy.c
+++ b/src/lib/libcrypto/ct/ct_policy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ct_policy.c,v 1.6 2023/07/08 07:22:58 beck Exp $ */ 1/* $OpenBSD: ct_policy.c,v 1.7 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Implementations of Certificate Transparency SCT policies. 3 * Implementations of Certificate Transparency SCT policies.
4 * Written by Rob Percival (robpercival@google.com) for the OpenSSL project. 4 * Written by Rob Percival (robpercival@google.com) for the OpenSSL project.
@@ -56,11 +56,12 @@
56# error "CT is disabled" 56# error "CT is disabled"
57#endif 57#endif
58 58
59#include <openssl/ct.h>
60#include <openssl/err.h>
61#include <time.h> 59#include <time.h>
62 60
61#include <openssl/ct.h>
62
63#include "ct_local.h" 63#include "ct_local.h"
64#include "err_local.h"
64 65
65/* 66/*
66 * Number of seconds in the future that an SCT timestamp can be, by default, 67 * Number of seconds in the future that an SCT timestamp can be, by default,
diff --git a/src/lib/libcrypto/ct/ct_sct.c b/src/lib/libcrypto/ct/ct_sct.c
index 4b2716e734..d647e34d92 100644
--- a/src/lib/libcrypto/ct/ct_sct.c
+++ b/src/lib/libcrypto/ct/ct_sct.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ct_sct.c,v 1.10 2023/07/22 17:02:49 tb Exp $ */ 1/* $OpenBSD: ct_sct.c,v 1.11 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Written by Rob Stradling (rob@comodo.com), Stephen Henson (steve@openssl.org) 3 * Written by Rob Stradling (rob@comodo.com), Stephen Henson (steve@openssl.org)
4 * and Adam Eijdenberg (adam.eijdenberg@gmail.com) for the OpenSSL project 2016. 4 * and Adam Eijdenberg (adam.eijdenberg@gmail.com) for the OpenSSL project 2016.
@@ -67,11 +67,11 @@
67 67
68#include <openssl/asn1.h> 68#include <openssl/asn1.h>
69#include <openssl/ct.h> 69#include <openssl/ct.h>
70#include <openssl/err.h>
71#include <openssl/objects.h> 70#include <openssl/objects.h>
72#include <openssl/x509.h> 71#include <openssl/x509.h>
73 72
74#include "ct_local.h" 73#include "ct_local.h"
74#include "err_local.h"
75 75
76SCT * 76SCT *
77SCT_new(void) 77SCT_new(void)
diff --git a/src/lib/libcrypto/ct/ct_sct_ctx.c b/src/lib/libcrypto/ct/ct_sct_ctx.c
index b2b6d4e269..930c7df59b 100644
--- a/src/lib/libcrypto/ct/ct_sct_ctx.c
+++ b/src/lib/libcrypto/ct/ct_sct_ctx.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ct_sct_ctx.c,v 1.6 2022/06/30 11:14:47 tb Exp $ */ 1/* $OpenBSD: ct_sct_ctx.c,v 1.7 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Written by Rob Stradling (rob@comodo.com) and Stephen Henson 3 * Written by Rob Stradling (rob@comodo.com) and Stephen Henson
4 * (steve@openssl.org) for the OpenSSL project 2014. 4 * (steve@openssl.org) for the OpenSSL project 2014.
@@ -64,11 +64,11 @@
64#include <stddef.h> 64#include <stddef.h>
65#include <string.h> 65#include <string.h>
66 66
67#include <openssl/err.h>
68#include <openssl/objects.h> 67#include <openssl/objects.h>
69#include <openssl/x509.h> 68#include <openssl/x509.h>
70 69
71#include "ct_local.h" 70#include "ct_local.h"
71#include "err_local.h"
72 72
73SCT_CTX * 73SCT_CTX *
74SCT_CTX_new(void) 74SCT_CTX_new(void)
diff --git a/src/lib/libcrypto/ct/ct_vfy.c b/src/lib/libcrypto/ct/ct_vfy.c
index 424117263a..5dbb2096e1 100644
--- a/src/lib/libcrypto/ct/ct_vfy.c
+++ b/src/lib/libcrypto/ct/ct_vfy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ct_vfy.c,v 1.6 2022/01/06 14:34:40 jsing Exp $ */ 1/* $OpenBSD: ct_vfy.c,v 1.7 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Written by Rob Stradling (rob@comodo.com) and Stephen Henson 3 * Written by Rob Stradling (rob@comodo.com) and Stephen Henson
4 * (steve@openssl.org) for the OpenSSL project 2014. 4 * (steve@openssl.org) for the OpenSSL project 2014.
@@ -60,11 +60,11 @@
60#include <string.h> 60#include <string.h>
61 61
62#include <openssl/ct.h> 62#include <openssl/ct.h>
63#include <openssl/err.h>
64#include <openssl/evp.h> 63#include <openssl/evp.h>
65#include <openssl/x509.h> 64#include <openssl/x509.h>
66 65
67#include "ct_local.h" 66#include "ct_local.h"
67#include "err_local.h"
68 68
69typedef enum sct_signature_type_t { 69typedef enum sct_signature_type_t {
70 SIGNATURE_TYPE_NOT_SET = -1, 70 SIGNATURE_TYPE_NOT_SET = -1,
diff --git a/src/lib/libcrypto/curve25519/curve25519.c b/src/lib/libcrypto/curve25519/curve25519.c
index 4e644c4280..0aa3d2855b 100644
--- a/src/lib/libcrypto/curve25519/curve25519.c
+++ b/src/lib/libcrypto/curve25519/curve25519.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: curve25519.c,v 1.16 2023/07/08 15:12:49 beck Exp $ */ 1/* $OpenBSD: curve25519.c,v 1.18 2025/07/29 10:52:20 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2015, Google Inc. 3 * Copyright (c) 2015, Google Inc.
4 * 4 *
@@ -3781,6 +3781,17 @@ ge_double_scalarmult_vartime(ge_p2 *r, const uint8_t *a,
3781 } 3781 }
3782} 3782}
3783 3783
3784/*
3785 * int64_lshift21 returns |a << 21| but is defined when shifting bits into the
3786 * sign bit. This works around a language flaw in C.
3787 *
3788 * XXX: This is a hack to avoid undefined behavior when shifting into the sign bit.
3789 * We match BoringSSL's implementation here.
3790 */
3791static inline int64_t int64_lshift21(int64_t a) {
3792 return (int64_t)((uint64_t)a << 21);
3793}
3794
3784/* The set of scalars is \Z/l 3795/* The set of scalars is \Z/l
3785 * where l = 2^252 + 27742317777372353535851937790883648493. */ 3796 * where l = 2^252 + 27742317777372353535851937790883648493. */
3786 3797
@@ -3885,38 +3896,38 @@ x25519_sc_reduce(uint8_t *s) {
3885 3896
3886 carry6 = (s6 + (1 << 20)) >> 21; 3897 carry6 = (s6 + (1 << 20)) >> 21;
3887 s7 += carry6; 3898 s7 += carry6;
3888 s6 -= carry6 << 21; 3899 s6 -= int64_lshift21(carry6);
3889 carry8 = (s8 + (1 << 20)) >> 21; 3900 carry8 = (s8 + (1 << 20)) >> 21;
3890 s9 += carry8; 3901 s9 += carry8;
3891 s8 -= carry8 << 21; 3902 s8 -= int64_lshift21(carry8);
3892 carry10 = (s10 + (1 << 20)) >> 21; 3903 carry10 = (s10 + (1 << 20)) >> 21;
3893 s11 += carry10; 3904 s11 += carry10;
3894 s10 -= carry10 << 21; 3905 s10 -= int64_lshift21(carry10);
3895 carry12 = (s12 + (1 << 20)) >> 21; 3906 carry12 = (s12 + (1 << 20)) >> 21;
3896 s13 += carry12; 3907 s13 += carry12;
3897 s12 -= carry12 << 21; 3908 s12 -= int64_lshift21(carry12);
3898 carry14 = (s14 + (1 << 20)) >> 21; 3909 carry14 = (s14 + (1 << 20)) >> 21;
3899 s15 += carry14; 3910 s15 += carry14;
3900 s14 -= carry14 << 21; 3911 s14 -= int64_lshift21(carry14);
3901 carry16 = (s16 + (1 << 20)) >> 21; 3912 carry16 = (s16 + (1 << 20)) >> 21;
3902 s17 += carry16; 3913 s17 += carry16;
3903 s16 -= carry16 << 21; 3914 s16 -= int64_lshift21(carry16);
3904 3915
3905 carry7 = (s7 + (1 << 20)) >> 21; 3916 carry7 = (s7 + (1 << 20)) >> 21;
3906 s8 += carry7; 3917 s8 += carry7;
3907 s7 -= carry7 << 21; 3918 s7 -= int64_lshift21(carry7);
3908 carry9 = (s9 + (1 << 20)) >> 21; 3919 carry9 = (s9 + (1 << 20)) >> 21;
3909 s10 += carry9; 3920 s10 += carry9;
3910 s9 -= carry9 << 21; 3921 s9 -= int64_lshift21(carry9);
3911 carry11 = (s11 + (1 << 20)) >> 21; 3922 carry11 = (s11 + (1 << 20)) >> 21;
3912 s12 += carry11; 3923 s12 += carry11;
3913 s11 -= carry11 << 21; 3924 s11 -= int64_lshift21(carry11);
3914 carry13 = (s13 + (1 << 20)) >> 21; 3925 carry13 = (s13 + (1 << 20)) >> 21;
3915 s14 += carry13; 3926 s14 += carry13;
3916 s13 -= carry13 << 21; 3927 s13 -= int64_lshift21(carry13);
3917 carry15 = (s15 + (1 << 20)) >> 21; 3928 carry15 = (s15 + (1 << 20)) >> 21;
3918 s16 += carry15; 3929 s16 += carry15;
3919 s15 -= carry15 << 21; 3930 s15 -= int64_lshift21(carry15);
3920 3931
3921 s5 += s17 * 666643; 3932 s5 += s17 * 666643;
3922 s6 += s17 * 470296; 3933 s6 += s17 * 470296;
@@ -3968,41 +3979,41 @@ x25519_sc_reduce(uint8_t *s) {
3968 3979
3969 carry0 = (s0 + (1 << 20)) >> 21; 3980 carry0 = (s0 + (1 << 20)) >> 21;
3970 s1 += carry0; 3981 s1 += carry0;
3971 s0 -= carry0 << 21; 3982 s0 -= int64_lshift21(carry0);
3972 carry2 = (s2 + (1 << 20)) >> 21; 3983 carry2 = (s2 + (1 << 20)) >> 21;
3973 s3 += carry2; 3984 s3 += carry2;
3974 s2 -= carry2 << 21; 3985 s2 -= int64_lshift21(carry2);
3975 carry4 = (s4 + (1 << 20)) >> 21; 3986 carry4 = (s4 + (1 << 20)) >> 21;
3976 s5 += carry4; 3987 s5 += carry4;
3977 s4 -= carry4 << 21; 3988 s4 -= int64_lshift21(carry4);
3978 carry6 = (s6 + (1 << 20)) >> 21; 3989 carry6 = (s6 + (1 << 20)) >> 21;
3979 s7 += carry6; 3990 s7 += carry6;
3980 s6 -= carry6 << 21; 3991 s6 -= int64_lshift21(carry6);
3981 carry8 = (s8 + (1 << 20)) >> 21; 3992 carry8 = (s8 + (1 << 20)) >> 21;
3982 s9 += carry8; 3993 s9 += carry8;
3983 s8 -= carry8 << 21; 3994 s8 -= int64_lshift21(carry8);
3984 carry10 = (s10 + (1 << 20)) >> 21; 3995 carry10 = (s10 + (1 << 20)) >> 21;
3985 s11 += carry10; 3996 s11 += carry10;
3986 s10 -= carry10 << 21; 3997 s10 -= int64_lshift21(carry10);
3987 3998
3988 carry1 = (s1 + (1 << 20)) >> 21; 3999 carry1 = (s1 + (1 << 20)) >> 21;
3989 s2 += carry1; 4000 s2 += carry1;
3990 s1 -= carry1 << 21; 4001 s1 -= int64_lshift21(carry1);
3991 carry3 = (s3 + (1 << 20)) >> 21; 4002 carry3 = (s3 + (1 << 20)) >> 21;
3992 s4 += carry3; 4003 s4 += carry3;
3993 s3 -= carry3 << 21; 4004 s3 -= int64_lshift21(carry3);
3994 carry5 = (s5 + (1 << 20)) >> 21; 4005 carry5 = (s5 + (1 << 20)) >> 21;
3995 s6 += carry5; 4006 s6 += carry5;
3996 s5 -= carry5 << 21; 4007 s5 -= int64_lshift21(carry5);
3997 carry7 = (s7 + (1 << 20)) >> 21; 4008 carry7 = (s7 + (1 << 20)) >> 21;
3998 s8 += carry7; 4009 s8 += carry7;
3999 s7 -= carry7 << 21; 4010 s7 -= int64_lshift21(carry7);
4000 carry9 = (s9 + (1 << 20)) >> 21; 4011 carry9 = (s9 + (1 << 20)) >> 21;
4001 s10 += carry9; 4012 s10 += carry9;
4002 s9 -= carry9 << 21; 4013 s9 -= int64_lshift21(carry9);
4003 carry11 = (s11 + (1 << 20)) >> 21; 4014 carry11 = (s11 + (1 << 20)) >> 21;
4004 s12 += carry11; 4015 s12 += carry11;
4005 s11 -= carry11 << 21; 4016 s11 -= int64_lshift21(carry11);
4006 4017
4007 s0 += s12 * 666643; 4018 s0 += s12 * 666643;
4008 s1 += s12 * 470296; 4019 s1 += s12 * 470296;
@@ -4014,40 +4025,40 @@ x25519_sc_reduce(uint8_t *s) {
4014 4025
4015 carry0 = s0 >> 21; 4026 carry0 = s0 >> 21;
4016 s1 += carry0; 4027 s1 += carry0;
4017 s0 -= carry0 << 21; 4028 s0 -= int64_lshift21(carry0);
4018 carry1 = s1 >> 21; 4029 carry1 = s1 >> 21;
4019 s2 += carry1; 4030 s2 += carry1;
4020 s1 -= carry1 << 21; 4031 s1 -= int64_lshift21(carry1);
4021 carry2 = s2 >> 21; 4032 carry2 = s2 >> 21;
4022 s3 += carry2; 4033 s3 += carry2;
4023 s2 -= carry2 << 21; 4034 s2 -= int64_lshift21(carry2);
4024 carry3 = s3 >> 21; 4035 carry3 = s3 >> 21;
4025 s4 += carry3; 4036 s4 += carry3;
4026 s3 -= carry3 << 21; 4037 s3 -= int64_lshift21(carry3);
4027 carry4 = s4 >> 21; 4038 carry4 = s4 >> 21;
4028 s5 += carry4; 4039 s5 += carry4;
4029 s4 -= carry4 << 21; 4040 s4 -= int64_lshift21(carry4);
4030 carry5 = s5 >> 21; 4041 carry5 = s5 >> 21;
4031 s6 += carry5; 4042 s6 += carry5;
4032 s5 -= carry5 << 21; 4043 s5 -= int64_lshift21(carry5);
4033 carry6 = s6 >> 21; 4044 carry6 = s6 >> 21;
4034 s7 += carry6; 4045 s7 += carry6;
4035 s6 -= carry6 << 21; 4046 s6 -= int64_lshift21(carry6);
4036 carry7 = s7 >> 21; 4047 carry7 = s7 >> 21;
4037 s8 += carry7; 4048 s8 += carry7;
4038 s7 -= carry7 << 21; 4049 s7 -= int64_lshift21(carry7);
4039 carry8 = s8 >> 21; 4050 carry8 = s8 >> 21;
4040 s9 += carry8; 4051 s9 += carry8;
4041 s8 -= carry8 << 21; 4052 s8 -= int64_lshift21(carry8);
4042 carry9 = s9 >> 21; 4053 carry9 = s9 >> 21;
4043 s10 += carry9; 4054 s10 += carry9;
4044 s9 -= carry9 << 21; 4055 s9 -= int64_lshift21(carry9);
4045 carry10 = s10 >> 21; 4056 carry10 = s10 >> 21;
4046 s11 += carry10; 4057 s11 += carry10;
4047 s10 -= carry10 << 21; 4058 s10 -= int64_lshift21(carry10);
4048 carry11 = s11 >> 21; 4059 carry11 = s11 >> 21;
4049 s12 += carry11; 4060 s12 += carry11;
4050 s11 -= carry11 << 21; 4061 s11 -= int64_lshift21(carry11);
4051 4062
4052 s0 += s12 * 666643; 4063 s0 += s12 * 666643;
4053 s1 += s12 * 470296; 4064 s1 += s12 * 470296;
@@ -4059,37 +4070,37 @@ x25519_sc_reduce(uint8_t *s) {
4059 4070
4060 carry0 = s0 >> 21; 4071 carry0 = s0 >> 21;
4061 s1 += carry0; 4072 s1 += carry0;
4062 s0 -= carry0 << 21; 4073 s0 -= int64_lshift21(carry0);
4063 carry1 = s1 >> 21; 4074 carry1 = s1 >> 21;
4064 s2 += carry1; 4075 s2 += carry1;
4065 s1 -= carry1 << 21; 4076 s1 -= int64_lshift21(carry1);
4066 carry2 = s2 >> 21; 4077 carry2 = s2 >> 21;
4067 s3 += carry2; 4078 s3 += carry2;
4068 s2 -= carry2 << 21; 4079 s2 -= int64_lshift21(carry2);
4069 carry3 = s3 >> 21; 4080 carry3 = s3 >> 21;
4070 s4 += carry3; 4081 s4 += carry3;
4071 s3 -= carry3 << 21; 4082 s3 -= int64_lshift21(carry3);
4072 carry4 = s4 >> 21; 4083 carry4 = s4 >> 21;
4073 s5 += carry4; 4084 s5 += carry4;
4074 s4 -= carry4 << 21; 4085 s4 -= int64_lshift21(carry4);
4075 carry5 = s5 >> 21; 4086 carry5 = s5 >> 21;
4076 s6 += carry5; 4087 s6 += carry5;
4077 s5 -= carry5 << 21; 4088 s5 -= int64_lshift21(carry5);
4078 carry6 = s6 >> 21; 4089 carry6 = s6 >> 21;
4079 s7 += carry6; 4090 s7 += carry6;
4080 s6 -= carry6 << 21; 4091 s6 -= int64_lshift21(carry6);
4081 carry7 = s7 >> 21; 4092 carry7 = s7 >> 21;
4082 s8 += carry7; 4093 s8 += carry7;
4083 s7 -= carry7 << 21; 4094 s7 -= int64_lshift21(carry7);
4084 carry8 = s8 >> 21; 4095 carry8 = s8 >> 21;
4085 s9 += carry8; 4096 s9 += carry8;
4086 s8 -= carry8 << 21; 4097 s8 -= int64_lshift21(carry8);
4087 carry9 = s9 >> 21; 4098 carry9 = s9 >> 21;
4088 s10 += carry9; 4099 s10 += carry9;
4089 s9 -= carry9 << 21; 4100 s9 -= int64_lshift21(carry9);
4090 carry10 = s10 >> 21; 4101 carry10 = s10 >> 21;
4091 s11 += carry10; 4102 s11 += carry10;
4092 s10 -= carry10 << 21; 4103 s10 -= int64_lshift21(carry10);
4093 4104
4094 s[0] = s0 >> 0; 4105 s[0] = s0 >> 0;
4095 s[1] = s0 >> 8; 4106 s[1] = s0 >> 8;
@@ -4257,74 +4268,74 @@ sc_muladd(uint8_t *s, const uint8_t *a, const uint8_t *b,
4257 4268
4258 carry0 = (s0 + (1 << 20)) >> 21; 4269 carry0 = (s0 + (1 << 20)) >> 21;
4259 s1 += carry0; 4270 s1 += carry0;
4260 s0 -= carry0 << 21; 4271 s0 -= int64_lshift21(carry0);
4261 carry2 = (s2 + (1 << 20)) >> 21; 4272 carry2 = (s2 + (1 << 20)) >> 21;
4262 s3 += carry2; 4273 s3 += carry2;
4263 s2 -= carry2 << 21; 4274 s2 -= int64_lshift21(carry2);
4264 carry4 = (s4 + (1 << 20)) >> 21; 4275 carry4 = (s4 + (1 << 20)) >> 21;
4265 s5 += carry4; 4276 s5 += carry4;
4266 s4 -= carry4 << 21; 4277 s4 -= int64_lshift21(carry4);
4267 carry6 = (s6 + (1 << 20)) >> 21; 4278 carry6 = (s6 + (1 << 20)) >> 21;
4268 s7 += carry6; 4279 s7 += carry6;
4269 s6 -= carry6 << 21; 4280 s6 -= int64_lshift21(carry6);
4270 carry8 = (s8 + (1 << 20)) >> 21; 4281 carry8 = (s8 + (1 << 20)) >> 21;
4271 s9 += carry8; 4282 s9 += carry8;
4272 s8 -= carry8 << 21; 4283 s8 -= int64_lshift21(carry8);
4273 carry10 = (s10 + (1 << 20)) >> 21; 4284 carry10 = (s10 + (1 << 20)) >> 21;
4274 s11 += carry10; 4285 s11 += carry10;
4275 s10 -= carry10 << 21; 4286 s10 -= int64_lshift21(carry10);
4276 carry12 = (s12 + (1 << 20)) >> 21; 4287 carry12 = (s12 + (1 << 20)) >> 21;
4277 s13 += carry12; 4288 s13 += carry12;
4278 s12 -= carry12 << 21; 4289 s12 -= int64_lshift21(carry12);
4279 carry14 = (s14 + (1 << 20)) >> 21; 4290 carry14 = (s14 + (1 << 20)) >> 21;
4280 s15 += carry14; 4291 s15 += carry14;
4281 s14 -= carry14 << 21; 4292 s14 -= int64_lshift21(carry14);
4282 carry16 = (s16 + (1 << 20)) >> 21; 4293 carry16 = (s16 + (1 << 20)) >> 21;
4283 s17 += carry16; 4294 s17 += carry16;
4284 s16 -= carry16 << 21; 4295 s16 -= int64_lshift21(carry16);
4285 carry18 = (s18 + (1 << 20)) >> 21; 4296 carry18 = (s18 + (1 << 20)) >> 21;
4286 s19 += carry18; 4297 s19 += carry18;
4287 s18 -= carry18 << 21; 4298 s18 -= int64_lshift21(carry18);
4288 carry20 = (s20 + (1 << 20)) >> 21; 4299 carry20 = (s20 + (1 << 20)) >> 21;
4289 s21 += carry20; 4300 s21 += carry20;
4290 s20 -= carry20 << 21; 4301 s20 -= int64_lshift21(carry20);
4291 carry22 = (s22 + (1 << 20)) >> 21; 4302 carry22 = (s22 + (1 << 20)) >> 21;
4292 s23 += carry22; 4303 s23 += carry22;
4293 s22 -= carry22 << 21; 4304 s22 -= int64_lshift21(carry22);
4294 4305
4295 carry1 = (s1 + (1 << 20)) >> 21; 4306 carry1 = (s1 + (1 << 20)) >> 21;
4296 s2 += carry1; 4307 s2 += carry1;
4297 s1 -= carry1 << 21; 4308 s1 -= int64_lshift21(carry1);
4298 carry3 = (s3 + (1 << 20)) >> 21; 4309 carry3 = (s3 + (1 << 20)) >> 21;
4299 s4 += carry3; 4310 s4 += carry3;
4300 s3 -= carry3 << 21; 4311 s3 -= int64_lshift21(carry3);
4301 carry5 = (s5 + (1 << 20)) >> 21; 4312 carry5 = (s5 + (1 << 20)) >> 21;
4302 s6 += carry5; 4313 s6 += carry5;
4303 s5 -= carry5 << 21; 4314 s5 -= int64_lshift21(carry5);
4304 carry7 = (s7 + (1 << 20)) >> 21; 4315 carry7 = (s7 + (1 << 20)) >> 21;
4305 s8 += carry7; 4316 s8 += carry7;
4306 s7 -= carry7 << 21; 4317 s7 -= int64_lshift21(carry7);
4307 carry9 = (s9 + (1 << 20)) >> 21; 4318 carry9 = (s9 + (1 << 20)) >> 21;
4308 s10 += carry9; 4319 s10 += carry9;
4309 s9 -= carry9 << 21; 4320 s9 -= int64_lshift21(carry9);
4310 carry11 = (s11 + (1 << 20)) >> 21; 4321 carry11 = (s11 + (1 << 20)) >> 21;
4311 s12 += carry11; 4322 s12 += carry11;
4312 s11 -= carry11 << 21; 4323 s11 -= int64_lshift21(carry11);
4313 carry13 = (s13 + (1 << 20)) >> 21; 4324 carry13 = (s13 + (1 << 20)) >> 21;
4314 s14 += carry13; 4325 s14 += carry13;
4315 s13 -= carry13 << 21; 4326 s13 -= int64_lshift21(carry13);
4316 carry15 = (s15 + (1 << 20)) >> 21; 4327 carry15 = (s15 + (1 << 20)) >> 21;
4317 s16 += carry15; 4328 s16 += carry15;
4318 s15 -= carry15 << 21; 4329 s15 -= int64_lshift21(carry15);
4319 carry17 = (s17 + (1 << 20)) >> 21; 4330 carry17 = (s17 + (1 << 20)) >> 21;
4320 s18 += carry17; 4331 s18 += carry17;
4321 s17 -= carry17 << 21; 4332 s17 -= int64_lshift21(carry17);
4322 carry19 = (s19 + (1 << 20)) >> 21; 4333 carry19 = (s19 + (1 << 20)) >> 21;
4323 s20 += carry19; 4334 s20 += carry19;
4324 s19 -= carry19 << 21; 4335 s19 -= int64_lshift21(carry19);
4325 carry21 = (s21 + (1 << 20)) >> 21; 4336 carry21 = (s21 + (1 << 20)) >> 21;
4326 s22 += carry21; 4337 s22 += carry21;
4327 s21 -= carry21 << 21; 4338 s21 -= int64_lshift21(carry21);
4328 4339
4329 s11 += s23 * 666643; 4340 s11 += s23 * 666643;
4330 s12 += s23 * 470296; 4341 s12 += s23 * 470296;
@@ -4376,38 +4387,38 @@ sc_muladd(uint8_t *s, const uint8_t *a, const uint8_t *b,
4376 4387
4377 carry6 = (s6 + (1 << 20)) >> 21; 4388 carry6 = (s6 + (1 << 20)) >> 21;
4378 s7 += carry6; 4389 s7 += carry6;
4379 s6 -= carry6 << 21; 4390 s6 -= int64_lshift21(carry6);
4380 carry8 = (s8 + (1 << 20)) >> 21; 4391 carry8 = (s8 + (1 << 20)) >> 21;
4381 s9 += carry8; 4392 s9 += carry8;
4382 s8 -= carry8 << 21; 4393 s8 -= int64_lshift21(carry8);
4383 carry10 = (s10 + (1 << 20)) >> 21; 4394 carry10 = (s10 + (1 << 20)) >> 21;
4384 s11 += carry10; 4395 s11 += carry10;
4385 s10 -= carry10 << 21; 4396 s10 -= int64_lshift21(carry10);
4386 carry12 = (s12 + (1 << 20)) >> 21; 4397 carry12 = (s12 + (1 << 20)) >> 21;
4387 s13 += carry12; 4398 s13 += carry12;
4388 s12 -= carry12 << 21; 4399 s12 -= int64_lshift21(carry12);
4389 carry14 = (s14 + (1 << 20)) >> 21; 4400 carry14 = (s14 + (1 << 20)) >> 21;
4390 s15 += carry14; 4401 s15 += carry14;
4391 s14 -= carry14 << 21; 4402 s14 -= int64_lshift21(carry14);
4392 carry16 = (s16 + (1 << 20)) >> 21; 4403 carry16 = (s16 + (1 << 20)) >> 21;
4393 s17 += carry16; 4404 s17 += carry16;
4394 s16 -= carry16 << 21; 4405 s16 -= int64_lshift21(carry16);
4395 4406
4396 carry7 = (s7 + (1 << 20)) >> 21; 4407 carry7 = (s7 + (1 << 20)) >> 21;
4397 s8 += carry7; 4408 s8 += carry7;
4398 s7 -= carry7 << 21; 4409 s7 -= int64_lshift21(carry7);
4399 carry9 = (s9 + (1 << 20)) >> 21; 4410 carry9 = (s9 + (1 << 20)) >> 21;
4400 s10 += carry9; 4411 s10 += carry9;
4401 s9 -= carry9 << 21; 4412 s9 -= int64_lshift21(carry9);
4402 carry11 = (s11 + (1 << 20)) >> 21; 4413 carry11 = (s11 + (1 << 20)) >> 21;
4403 s12 += carry11; 4414 s12 += carry11;
4404 s11 -= carry11 << 21; 4415 s11 -= int64_lshift21(carry11);
4405 carry13 = (s13 + (1 << 20)) >> 21; 4416 carry13 = (s13 + (1 << 20)) >> 21;
4406 s14 += carry13; 4417 s14 += carry13;
4407 s13 -= carry13 << 21; 4418 s13 -= int64_lshift21(carry13);
4408 carry15 = (s15 + (1 << 20)) >> 21; 4419 carry15 = (s15 + (1 << 20)) >> 21;
4409 s16 += carry15; 4420 s16 += carry15;
4410 s15 -= carry15 << 21; 4421 s15 -= int64_lshift21(carry15);
4411 4422
4412 s5 += s17 * 666643; 4423 s5 += s17 * 666643;
4413 s6 += s17 * 470296; 4424 s6 += s17 * 470296;
@@ -4459,41 +4470,41 @@ sc_muladd(uint8_t *s, const uint8_t *a, const uint8_t *b,
4459 4470
4460 carry0 = (s0 + (1 << 20)) >> 21; 4471 carry0 = (s0 + (1 << 20)) >> 21;
4461 s1 += carry0; 4472 s1 += carry0;
4462 s0 -= carry0 << 21; 4473 s0 -= int64_lshift21(carry0);
4463 carry2 = (s2 + (1 << 20)) >> 21; 4474 carry2 = (s2 + (1 << 20)) >> 21;
4464 s3 += carry2; 4475 s3 += carry2;
4465 s2 -= carry2 << 21; 4476 s2 -= int64_lshift21(carry2);
4466 carry4 = (s4 + (1 << 20)) >> 21; 4477 carry4 = (s4 + (1 << 20)) >> 21;
4467 s5 += carry4; 4478 s5 += carry4;
4468 s4 -= carry4 << 21; 4479 s4 -= int64_lshift21(carry4);
4469 carry6 = (s6 + (1 << 20)) >> 21; 4480 carry6 = (s6 + (1 << 20)) >> 21;
4470 s7 += carry6; 4481 s7 += carry6;
4471 s6 -= carry6 << 21; 4482 s6 -= int64_lshift21(carry6);
4472 carry8 = (s8 + (1 << 20)) >> 21; 4483 carry8 = (s8 + (1 << 20)) >> 21;
4473 s9 += carry8; 4484 s9 += carry8;
4474 s8 -= carry8 << 21; 4485 s8 -= int64_lshift21(carry8);
4475 carry10 = (s10 + (1 << 20)) >> 21; 4486 carry10 = (s10 + (1 << 20)) >> 21;
4476 s11 += carry10; 4487 s11 += carry10;
4477 s10 -= carry10 << 21; 4488 s10 -= int64_lshift21(carry10);
4478 4489
4479 carry1 = (s1 + (1 << 20)) >> 21; 4490 carry1 = (s1 + (1 << 20)) >> 21;
4480 s2 += carry1; 4491 s2 += carry1;
4481 s1 -= carry1 << 21; 4492 s1 -= int64_lshift21(carry1);
4482 carry3 = (s3 + (1 << 20)) >> 21; 4493 carry3 = (s3 + (1 << 20)) >> 21;
4483 s4 += carry3; 4494 s4 += carry3;
4484 s3 -= carry3 << 21; 4495 s3 -= int64_lshift21(carry3);
4485 carry5 = (s5 + (1 << 20)) >> 21; 4496 carry5 = (s5 + (1 << 20)) >> 21;
4486 s6 += carry5; 4497 s6 += carry5;
4487 s5 -= carry5 << 21; 4498 s5 -= int64_lshift21(carry5);
4488 carry7 = (s7 + (1 << 20)) >> 21; 4499 carry7 = (s7 + (1 << 20)) >> 21;
4489 s8 += carry7; 4500 s8 += carry7;
4490 s7 -= carry7 << 21; 4501 s7 -= int64_lshift21(carry7);
4491 carry9 = (s9 + (1 << 20)) >> 21; 4502 carry9 = (s9 + (1 << 20)) >> 21;
4492 s10 += carry9; 4503 s10 += carry9;
4493 s9 -= carry9 << 21; 4504 s9 -= int64_lshift21(carry9);
4494 carry11 = (s11 + (1 << 20)) >> 21; 4505 carry11 = (s11 + (1 << 20)) >> 21;
4495 s12 += carry11; 4506 s12 += carry11;
4496 s11 -= carry11 << 21; 4507 s11 -= int64_lshift21(carry11);
4497 4508
4498 s0 += s12 * 666643; 4509 s0 += s12 * 666643;
4499 s1 += s12 * 470296; 4510 s1 += s12 * 470296;
@@ -4505,40 +4516,40 @@ sc_muladd(uint8_t *s, const uint8_t *a, const uint8_t *b,
4505 4516
4506 carry0 = s0 >> 21; 4517 carry0 = s0 >> 21;
4507 s1 += carry0; 4518 s1 += carry0;
4508 s0 -= carry0 << 21; 4519 s0 -= int64_lshift21(carry0);
4509 carry1 = s1 >> 21; 4520 carry1 = s1 >> 21;
4510 s2 += carry1; 4521 s2 += carry1;
4511 s1 -= carry1 << 21; 4522 s1 -= int64_lshift21(carry1);
4512 carry2 = s2 >> 21; 4523 carry2 = s2 >> 21;
4513 s3 += carry2; 4524 s3 += carry2;
4514 s2 -= carry2 << 21; 4525 s2 -= int64_lshift21(carry2);
4515 carry3 = s3 >> 21; 4526 carry3 = s3 >> 21;
4516 s4 += carry3; 4527 s4 += carry3;
4517 s3 -= carry3 << 21; 4528 s3 -= int64_lshift21(carry3);
4518 carry4 = s4 >> 21; 4529 carry4 = s4 >> 21;
4519 s5 += carry4; 4530 s5 += carry4;
4520 s4 -= carry4 << 21; 4531 s4 -= int64_lshift21(carry4);
4521 carry5 = s5 >> 21; 4532 carry5 = s5 >> 21;
4522 s6 += carry5; 4533 s6 += carry5;
4523 s5 -= carry5 << 21; 4534 s5 -= int64_lshift21(carry5);
4524 carry6 = s6 >> 21; 4535 carry6 = s6 >> 21;
4525 s7 += carry6; 4536 s7 += carry6;
4526 s6 -= carry6 << 21; 4537 s6 -= int64_lshift21(carry6);
4527 carry7 = s7 >> 21; 4538 carry7 = s7 >> 21;
4528 s8 += carry7; 4539 s8 += carry7;
4529 s7 -= carry7 << 21; 4540 s7 -= int64_lshift21(carry7);
4530 carry8 = s8 >> 21; 4541 carry8 = s8 >> 21;
4531 s9 += carry8; 4542 s9 += carry8;
4532 s8 -= carry8 << 21; 4543 s8 -= int64_lshift21(carry8);
4533 carry9 = s9 >> 21; 4544 carry9 = s9 >> 21;
4534 s10 += carry9; 4545 s10 += carry9;
4535 s9 -= carry9 << 21; 4546 s9 -= int64_lshift21(carry9);
4536 carry10 = s10 >> 21; 4547 carry10 = s10 >> 21;
4537 s11 += carry10; 4548 s11 += carry10;
4538 s10 -= carry10 << 21; 4549 s10 -= int64_lshift21(carry10);
4539 carry11 = s11 >> 21; 4550 carry11 = s11 >> 21;
4540 s12 += carry11; 4551 s12 += carry11;
4541 s11 -= carry11 << 21; 4552 s11 -= int64_lshift21(carry11);
4542 4553
4543 s0 += s12 * 666643; 4554 s0 += s12 * 666643;
4544 s1 += s12 * 470296; 4555 s1 += s12 * 470296;
@@ -4550,37 +4561,37 @@ sc_muladd(uint8_t *s, const uint8_t *a, const uint8_t *b,
4550 4561
4551 carry0 = s0 >> 21; 4562 carry0 = s0 >> 21;
4552 s1 += carry0; 4563 s1 += carry0;
4553 s0 -= carry0 << 21; 4564 s0 -= int64_lshift21(carry0);
4554 carry1 = s1 >> 21; 4565 carry1 = s1 >> 21;
4555 s2 += carry1; 4566 s2 += carry1;
4556 s1 -= carry1 << 21; 4567 s1 -= int64_lshift21(carry1);
4557 carry2 = s2 >> 21; 4568 carry2 = s2 >> 21;
4558 s3 += carry2; 4569 s3 += carry2;
4559 s2 -= carry2 << 21; 4570 s2 -= int64_lshift21(carry2);
4560 carry3 = s3 >> 21; 4571 carry3 = s3 >> 21;
4561 s4 += carry3; 4572 s4 += carry3;
4562 s3 -= carry3 << 21; 4573 s3 -= int64_lshift21(carry3);
4563 carry4 = s4 >> 21; 4574 carry4 = s4 >> 21;
4564 s5 += carry4; 4575 s5 += carry4;
4565 s4 -= carry4 << 21; 4576 s4 -= int64_lshift21(carry4);
4566 carry5 = s5 >> 21; 4577 carry5 = s5 >> 21;
4567 s6 += carry5; 4578 s6 += carry5;
4568 s5 -= carry5 << 21; 4579 s5 -= int64_lshift21(carry5);
4569 carry6 = s6 >> 21; 4580 carry6 = s6 >> 21;
4570 s7 += carry6; 4581 s7 += carry6;
4571 s6 -= carry6 << 21; 4582 s6 -= int64_lshift21(carry6);
4572 carry7 = s7 >> 21; 4583 carry7 = s7 >> 21;
4573 s8 += carry7; 4584 s8 += carry7;
4574 s7 -= carry7 << 21; 4585 s7 -= int64_lshift21(carry7);
4575 carry8 = s8 >> 21; 4586 carry8 = s8 >> 21;
4576 s9 += carry8; 4587 s9 += carry8;
4577 s8 -= carry8 << 21; 4588 s8 -= int64_lshift21(carry8);
4578 carry9 = s9 >> 21; 4589 carry9 = s9 >> 21;
4579 s10 += carry9; 4590 s10 += carry9;
4580 s9 -= carry9 << 21; 4591 s9 -= int64_lshift21(carry9);
4581 carry10 = s10 >> 21; 4592 carry10 = s10 >> 21;
4582 s11 += carry10; 4593 s11 += carry10;
4583 s10 -= carry10 << 21; 4594 s10 -= int64_lshift21(carry10);
4584 4595
4585 s[0] = s0 >> 0; 4596 s[0] = s0 >> 0;
4586 s[1] = s0 >> 8; 4597 s[1] = s0 >> 8;
diff --git a/src/lib/libcrypto/des/des.h b/src/lib/libcrypto/des/des.h
index 2d957a192c..ad7a418c01 100644
--- a/src/lib/libcrypto/des/des.h
+++ b/src/lib/libcrypto/des/des.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: des.h,v 1.23 2025/01/25 17:59:44 tb Exp $ */ 1/* $OpenBSD: des.h,v 1.26 2025/06/09 17:49:45 tb Exp $ */
2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -56,11 +56,20 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef HEADER_NEW_DES_H 59#ifndef HEADER_DES_H
60#define HEADER_NEW_DES_H 60#define HEADER_DES_H
61 61
62#include <openssl/opensslconf.h> 62#include <openssl/opensslconf.h>
63 63
64#ifndef DES_LONG
65/* XXX - typedef to unsigned int everywhere. */
66#ifdef __i386__
67#define DES_LONG unsigned long
68#else
69#define DES_LONG unsigned int
70#endif
71#endif
72
64#ifdef __cplusplus 73#ifdef __cplusplus
65extern "C" { 74extern "C" {
66#endif 75#endif
diff --git a/src/lib/libcrypto/des/des_enc.c b/src/lib/libcrypto/des/des_enc.c
index deec50bffb..cb89784fb0 100644
--- a/src/lib/libcrypto/des/des_enc.c
+++ b/src/lib/libcrypto/des/des_enc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: des_enc.c,v 1.20 2024/08/31 16:17:13 jsing Exp $ */ 1/* $OpenBSD: des_enc.c,v 1.21 2025/07/27 13:26:24 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -210,10 +210,8 @@ void
210DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc) 210DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc)
211{ 211{
212 DES_LONG l, r, t, u; 212 DES_LONG l, r, t, u;
213#ifndef DES_UNROLL
214 int i;
215#endif
216 DES_LONG *s; 213 DES_LONG *s;
214 int i;
217 215
218 r = data[0]; 216 r = data[0];
219 l = data[1]; 217 l = data[1];
@@ -231,56 +229,21 @@ DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc)
231 l = ROTATE(l, 29) & 0xffffffffL; 229 l = ROTATE(l, 29) & 0xffffffffL;
232 230
233 s = ks->ks->deslong; 231 s = ks->ks->deslong;
234 /* I don't know if it is worth the effort of loop unrolling the 232
235 * inner loop */
236 if (enc) { 233 if (enc) {
237#ifdef DES_UNROLL 234 for (i = 0; i < 32; i += 8) {
238 D_ENCRYPT(l, r, 0); /* 1 */ 235 D_ENCRYPT(l, r, i + 0);
239 D_ENCRYPT(r, l, 2); /* 2 */ 236 D_ENCRYPT(r, l, i + 2);
240 D_ENCRYPT(l, r, 4); /* 3 */ 237 D_ENCRYPT(l, r, i + 4);
241 D_ENCRYPT(r, l, 6); /* 4 */ 238 D_ENCRYPT(r, l, i + 6);
242 D_ENCRYPT(l, r, 8); /* 5 */
243 D_ENCRYPT(r, l, 10); /* 6 */
244 D_ENCRYPT(l, r, 12); /* 7 */
245 D_ENCRYPT(r, l, 14); /* 8 */
246 D_ENCRYPT(l, r, 16); /* 9 */
247 D_ENCRYPT(r, l, 18); /* 10 */
248 D_ENCRYPT(l, r, 20); /* 11 */
249 D_ENCRYPT(r, l, 22); /* 12 */
250 D_ENCRYPT(l, r, 24); /* 13 */
251 D_ENCRYPT(r, l, 26); /* 14 */
252 D_ENCRYPT(l, r, 28); /* 15 */
253 D_ENCRYPT(r, l, 30); /* 16 */
254#else
255 for (i = 0; i < 32; i += 4) {
256 D_ENCRYPT(l, r, i + 0); /* 1 */
257 D_ENCRYPT(r, l, i + 2); /* 2 */
258 } 239 }
259#endif
260 } else { 240 } else {
261#ifdef DES_UNROLL 241 for (i = 32; i > 0; i -= 8) {
262 D_ENCRYPT(l, r, 30); /* 16 */ 242 D_ENCRYPT(l, r, i - 2);
263 D_ENCRYPT(r, l, 28); /* 15 */ 243 D_ENCRYPT(r, l, i - 4);
264 D_ENCRYPT(l, r, 26); /* 14 */ 244 D_ENCRYPT(l, r, i - 6);
265 D_ENCRYPT(r, l, 24); /* 13 */ 245 D_ENCRYPT(r, l, i - 8);
266 D_ENCRYPT(l, r, 22); /* 12 */
267 D_ENCRYPT(r, l, 20); /* 11 */
268 D_ENCRYPT(l, r, 18); /* 10 */
269 D_ENCRYPT(r, l, 16); /* 9 */
270 D_ENCRYPT(l, r, 14); /* 8 */
271 D_ENCRYPT(r, l, 12); /* 7 */
272 D_ENCRYPT(l, r, 10); /* 6 */
273 D_ENCRYPT(r, l, 8); /* 5 */
274 D_ENCRYPT(l, r, 6); /* 4 */
275 D_ENCRYPT(r, l, 4); /* 3 */
276 D_ENCRYPT(l, r, 2); /* 2 */
277 D_ENCRYPT(r, l, 0); /* 1 */
278#else
279 for (i = 30; i > 0; i -= 4) {
280 D_ENCRYPT(l, r, i - 0); /* 16 */
281 D_ENCRYPT(r, l, i - 2); /* 15 */
282 } 246 }
283#endif
284 } 247 }
285 248
286 /* rotate and clear the top bits on machines with 8byte longs */ 249 /* rotate and clear the top bits on machines with 8byte longs */
@@ -298,10 +261,8 @@ void
298DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc) 261DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc)
299{ 262{
300 DES_LONG l, r, t, u; 263 DES_LONG l, r, t, u;
301#ifndef DES_UNROLL
302 int i;
303#endif
304 DES_LONG *s; 264 DES_LONG *s;
265 int i;
305 266
306 r = data[0]; 267 r = data[0];
307 l = data[1]; 268 l = data[1];
@@ -320,53 +281,19 @@ DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc)
320 /* I don't know if it is worth the effort of loop unrolling the 281 /* I don't know if it is worth the effort of loop unrolling the
321 * inner loop */ 282 * inner loop */
322 if (enc) { 283 if (enc) {
323#ifdef DES_UNROLL 284 for (i = 0; i < 32; i += 8) {
324 D_ENCRYPT(l, r, 0); /* 1 */ 285 D_ENCRYPT(l, r, i + 0);
325 D_ENCRYPT(r, l, 2); /* 2 */ 286 D_ENCRYPT(r, l, i + 2);
326 D_ENCRYPT(l, r, 4); /* 3 */ 287 D_ENCRYPT(l, r, i + 4);
327 D_ENCRYPT(r, l, 6); /* 4 */ 288 D_ENCRYPT(r, l, i + 6);
328 D_ENCRYPT(l, r, 8); /* 5 */
329 D_ENCRYPT(r, l, 10); /* 6 */
330 D_ENCRYPT(l, r, 12); /* 7 */
331 D_ENCRYPT(r, l, 14); /* 8 */
332 D_ENCRYPT(l, r, 16); /* 9 */
333 D_ENCRYPT(r, l, 18); /* 10 */
334 D_ENCRYPT(l, r, 20); /* 11 */
335 D_ENCRYPT(r, l, 22); /* 12 */
336 D_ENCRYPT(l, r, 24); /* 13 */
337 D_ENCRYPT(r, l, 26); /* 14 */
338 D_ENCRYPT(l, r, 28); /* 15 */
339 D_ENCRYPT(r, l, 30); /* 16 */
340#else
341 for (i = 0; i < 32; i += 4) {
342 D_ENCRYPT(l, r, i + 0); /* 1 */
343 D_ENCRYPT(r, l, i + 2); /* 2 */
344 } 289 }
345#endif
346 } else { 290 } else {
347#ifdef DES_UNROLL 291 for (i = 32; i > 0; i -= 8) {
348 D_ENCRYPT(l, r, 30); /* 16 */ 292 D_ENCRYPT(l, r, i - 2);
349 D_ENCRYPT(r, l, 28); /* 15 */ 293 D_ENCRYPT(r, l, i - 4);
350 D_ENCRYPT(l, r, 26); /* 14 */ 294 D_ENCRYPT(l, r, i - 6);
351 D_ENCRYPT(r, l, 24); /* 13 */ 295 D_ENCRYPT(r, l, i - 8);
352 D_ENCRYPT(l, r, 22); /* 12 */
353 D_ENCRYPT(r, l, 20); /* 11 */
354 D_ENCRYPT(l, r, 18); /* 10 */
355 D_ENCRYPT(r, l, 16); /* 9 */
356 D_ENCRYPT(l, r, 14); /* 8 */
357 D_ENCRYPT(r, l, 12); /* 7 */
358 D_ENCRYPT(l, r, 10); /* 6 */
359 D_ENCRYPT(r, l, 8); /* 5 */
360 D_ENCRYPT(l, r, 6); /* 4 */
361 D_ENCRYPT(r, l, 4); /* 3 */
362 D_ENCRYPT(l, r, 2); /* 2 */
363 D_ENCRYPT(r, l, 0); /* 1 */
364#else
365 for (i = 30; i > 0; i -= 4) {
366 D_ENCRYPT(l, r, i - 0); /* 16 */
367 D_ENCRYPT(r, l, i - 2); /* 15 */
368 } 296 }
369#endif
370 } 297 }
371 /* rotate and clear the top bits on machines with 8byte longs */ 298 /* rotate and clear the top bits on machines with 8byte longs */
372 data[0] = ROTATE(l, 3) & 0xffffffffL; 299 data[0] = ROTATE(l, 3) & 0xffffffffL;
diff --git a/src/lib/libcrypto/des/des_fcrypt.c b/src/lib/libcrypto/des/des_fcrypt.c
index b33b1240c2..2dd071f5d0 100644
--- a/src/lib/libcrypto/des/des_fcrypt.c
+++ b/src/lib/libcrypto/des/des_fcrypt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: des_fcrypt.c,v 1.4 2024/08/31 16:22:18 jsing Exp $ */ 1/* $OpenBSD: des_fcrypt.c,v 1.5 2025/07/27 13:26:24 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -90,8 +90,8 @@ fcrypt_body(DES_LONG *out, DES_key_schedule *ks, DES_LONG Eswap0,
90{ 90{
91 DES_LONG l, r, t, u; 91 DES_LONG l, r, t, u;
92 DES_LONG *s; 92 DES_LONG *s;
93 int j;
94 DES_LONG E0, E1; 93 DES_LONG E0, E1;
94 int i, j;
95 95
96 l = 0; 96 l = 0;
97 r = 0; 97 r = 0;
@@ -101,32 +101,12 @@ fcrypt_body(DES_LONG *out, DES_key_schedule *ks, DES_LONG Eswap0,
101 E1 = Eswap1; 101 E1 = Eswap1;
102 102
103 for (j = 0; j < 25; j++) { 103 for (j = 0; j < 25; j++) {
104#ifndef DES_UNROLL 104 for (i = 0; i < 32; i += 8) {
105 int i; 105 D_ENCRYPT(l, r, i + 0);
106 106 D_ENCRYPT(r, l, i + 2);
107 for (i = 0; i < 32; i += 4) { 107 D_ENCRYPT(l, r, i + 4);
108 D_ENCRYPT(l, r, i + 0); /* 1 */ 108 D_ENCRYPT(r, l, i + 6);
109 D_ENCRYPT(r, l, i + 2); /* 2 */
110 } 109 }
111#else
112 D_ENCRYPT(l, r, 0); /* 1 */
113 D_ENCRYPT(r, l, 2); /* 2 */
114 D_ENCRYPT(l, r, 4); /* 3 */
115 D_ENCRYPT(r, l, 6); /* 4 */
116 D_ENCRYPT(l, r, 8); /* 5 */
117 D_ENCRYPT(r, l, 10); /* 6 */
118 D_ENCRYPT(l, r, 12); /* 7 */
119 D_ENCRYPT(r, l, 14); /* 8 */
120 D_ENCRYPT(l, r, 16); /* 9 */
121 D_ENCRYPT(r, l, 18); /* 10 */
122 D_ENCRYPT(l, r, 20); /* 11 */
123 D_ENCRYPT(r, l, 22); /* 12 */
124 D_ENCRYPT(l, r, 24); /* 13 */
125 D_ENCRYPT(r, l, 26); /* 14 */
126 D_ENCRYPT(l, r, 28); /* 15 */
127 D_ENCRYPT(r, l, 30); /* 16 */
128#endif
129
130 t = l; 110 t = l;
131 l = r; 111 l = r;
132 r = t; 112 r = t;
diff --git a/src/lib/libcrypto/des/des_local.h b/src/lib/libcrypto/des/des_local.h
index 61bfde7520..077c03139f 100644
--- a/src/lib/libcrypto/des/des_local.h
+++ b/src/lib/libcrypto/des/des_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: des_local.h,v 1.5 2024/08/31 16:22:18 jsing Exp $ */ 1/* $OpenBSD: des_local.h,v 1.6 2025/04/23 10:08:20 jsing Exp $ */
2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -217,10 +217,6 @@ ROTATE(uint32_t a, uint32_t n)
217 217
218extern const DES_LONG DES_SPtrans[8][64]; 218extern const DES_LONG DES_SPtrans[8][64];
219 219
220#ifdef OPENSSL_SMALL_FOOTPRINT
221#undef DES_UNROLL
222#endif
223
224__END_HIDDEN_DECLS 220__END_HIDDEN_DECLS
225 221
226#endif 222#endif
diff --git a/src/lib/libcrypto/dh/dh_ameth.c b/src/lib/libcrypto/dh/dh_ameth.c
index 289307bfd6..ec59245b9c 100644
--- a/src/lib/libcrypto/dh/dh_ameth.c
+++ b/src/lib/libcrypto/dh/dh_ameth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh_ameth.c,v 1.42 2025/01/17 05:04:25 tb Exp $ */ 1/* $OpenBSD: dh_ameth.c,v 1.43 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -61,12 +61,12 @@
61#include <openssl/asn1.h> 61#include <openssl/asn1.h>
62#include <openssl/bn.h> 62#include <openssl/bn.h>
63#include <openssl/dh.h> 63#include <openssl/dh.h>
64#include <openssl/err.h>
65#include <openssl/x509.h> 64#include <openssl/x509.h>
66 65
67#include "asn1_local.h" 66#include "asn1_local.h"
68#include "bn_local.h" 67#include "bn_local.h"
69#include "dh_local.h" 68#include "dh_local.h"
69#include "err_local.h"
70#include "evp_local.h" 70#include "evp_local.h"
71 71
72static void 72static void
diff --git a/src/lib/libcrypto/dh/dh_check.c b/src/lib/libcrypto/dh/dh_check.c
index a880f9fca1..1ba85bc824 100644
--- a/src/lib/libcrypto/dh/dh_check.c
+++ b/src/lib/libcrypto/dh/dh_check.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh_check.c,v 1.30 2024/11/29 15:59:57 tb Exp $ */ 1/* $OpenBSD: dh_check.c,v 1.31 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -60,7 +60,6 @@
60 60
61#include <openssl/bn.h> 61#include <openssl/bn.h>
62#include <openssl/dh.h> 62#include <openssl/dh.h>
63#include <openssl/err.h>
64 63
65#include "bn_local.h" 64#include "bn_local.h"
66#include "dh_local.h" 65#include "dh_local.h"
diff --git a/src/lib/libcrypto/dh/dh_gen.c b/src/lib/libcrypto/dh/dh_gen.c
index 3ffa5d80f1..f28f75909c 100644
--- a/src/lib/libcrypto/dh/dh_gen.c
+++ b/src/lib/libcrypto/dh/dh_gen.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh_gen.c,v 1.21 2023/07/08 15:29:03 beck Exp $ */ 1/* $OpenBSD: dh_gen.c,v 1.22 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -60,10 +60,10 @@
60 60
61#include <openssl/bn.h> 61#include <openssl/bn.h>
62#include <openssl/dh.h> 62#include <openssl/dh.h>
63#include <openssl/err.h>
64 63
65#include "bn_local.h" 64#include "bn_local.h"
66#include "dh_local.h" 65#include "dh_local.h"
66#include "err_local.h"
67 67
68static int dh_builtin_genparams(DH *ret, int prime_len, int generator, 68static int dh_builtin_genparams(DH *ret, int prime_len, int generator,
69 BN_GENCB *cb); 69 BN_GENCB *cb);
diff --git a/src/lib/libcrypto/dh/dh_key.c b/src/lib/libcrypto/dh/dh_key.c
index 93b04f398f..89a02c8309 100644
--- a/src/lib/libcrypto/dh/dh_key.c
+++ b/src/lib/libcrypto/dh/dh_key.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh_key.c,v 1.42 2024/05/09 20:43:36 tb Exp $ */ 1/* $OpenBSD: dh_key.c,v 1.43 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -60,10 +60,10 @@
60 60
61#include <openssl/bn.h> 61#include <openssl/bn.h>
62#include <openssl/dh.h> 62#include <openssl/dh.h>
63#include <openssl/err.h>
64 63
65#include "bn_local.h" 64#include "bn_local.h"
66#include "dh_local.h" 65#include "dh_local.h"
66#include "err_local.h"
67 67
68static int 68static int
69generate_key(DH *dh) 69generate_key(DH *dh)
diff --git a/src/lib/libcrypto/dh/dh_lib.c b/src/lib/libcrypto/dh/dh_lib.c
index 803aca6421..db76244550 100644
--- a/src/lib/libcrypto/dh/dh_lib.c
+++ b/src/lib/libcrypto/dh/dh_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh_lib.c,v 1.46 2024/11/29 15:59:57 tb Exp $ */ 1/* $OpenBSD: dh_lib.c,v 1.47 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -63,9 +63,9 @@
63 63
64#include <openssl/bn.h> 64#include <openssl/bn.h>
65#include <openssl/dh.h> 65#include <openssl/dh.h>
66#include <openssl/err.h>
67 66
68#include "dh_local.h" 67#include "dh_local.h"
68#include "err_local.h"
69 69
70static const DH_METHOD *default_DH_method = NULL; 70static const DH_METHOD *default_DH_method = NULL;
71 71
diff --git a/src/lib/libcrypto/dh/dh_pmeth.c b/src/lib/libcrypto/dh/dh_pmeth.c
index 1e5327b11f..18517b0cde 100644
--- a/src/lib/libcrypto/dh/dh_pmeth.c
+++ b/src/lib/libcrypto/dh/dh_pmeth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh_pmeth.c,v 1.17 2024/08/26 22:00:47 op Exp $ */ 1/* $OpenBSD: dh_pmeth.c,v 1.18 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -64,12 +64,12 @@
64#include <openssl/asn1t.h> 64#include <openssl/asn1t.h>
65#include <openssl/bn.h> 65#include <openssl/bn.h>
66#include <openssl/dh.h> 66#include <openssl/dh.h>
67#include <openssl/err.h>
68#include <openssl/evp.h> 67#include <openssl/evp.h>
69#include <openssl/x509.h> 68#include <openssl/x509.h>
70 69
71#include "bn_local.h" 70#include "bn_local.h"
72#include "dh_local.h" 71#include "dh_local.h"
72#include "err_local.h"
73#include "evp_local.h" 73#include "evp_local.h"
74 74
75/* DH pkey context structure */ 75/* DH pkey context structure */
diff --git a/src/lib/libcrypto/dsa/dsa_ameth.c b/src/lib/libcrypto/dsa/dsa_ameth.c
index 866e5ec476..8e65cf68f7 100644
--- a/src/lib/libcrypto/dsa/dsa_ameth.c
+++ b/src/lib/libcrypto/dsa/dsa_ameth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dsa_ameth.c,v 1.59 2024/04/13 14:02:51 tb Exp $ */ 1/* $OpenBSD: dsa_ameth.c,v 1.60 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -64,12 +64,12 @@
64#include <openssl/bn.h> 64#include <openssl/bn.h>
65#include <openssl/cms.h> 65#include <openssl/cms.h>
66#include <openssl/dsa.h> 66#include <openssl/dsa.h>
67#include <openssl/err.h>
68#include <openssl/x509.h> 67#include <openssl/x509.h>
69 68
70#include "asn1_local.h" 69#include "asn1_local.h"
71#include "bn_local.h" 70#include "bn_local.h"
72#include "dsa_local.h" 71#include "dsa_local.h"
72#include "err_local.h"
73#include "evp_local.h" 73#include "evp_local.h"
74#include "x509_local.h" 74#include "x509_local.h"
75 75
diff --git a/src/lib/libcrypto/dsa/dsa_asn1.c b/src/lib/libcrypto/dsa/dsa_asn1.c
index de6ec46195..e8957a99ff 100644
--- a/src/lib/libcrypto/dsa/dsa_asn1.c
+++ b/src/lib/libcrypto/dsa/dsa_asn1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dsa_asn1.c,v 1.33 2024/07/08 17:11:05 beck Exp $ */ 1/* $OpenBSD: dsa_asn1.c,v 1.34 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -63,9 +63,9 @@
63#include <openssl/asn1t.h> 63#include <openssl/asn1t.h>
64#include <openssl/bn.h> 64#include <openssl/bn.h>
65#include <openssl/dsa.h> 65#include <openssl/dsa.h>
66#include <openssl/err.h>
67 66
68#include "dsa_local.h" 67#include "dsa_local.h"
68#include "err_local.h"
69 69
70/* Override the default new methods */ 70/* Override the default new methods */
71static int 71static int
diff --git a/src/lib/libcrypto/dsa/dsa_lib.c b/src/lib/libcrypto/dsa/dsa_lib.c
index daf2fa135b..ecd517cf8a 100644
--- a/src/lib/libcrypto/dsa/dsa_lib.c
+++ b/src/lib/libcrypto/dsa/dsa_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dsa_lib.c,v 1.48 2024/03/27 01:49:31 tb Exp $ */ 1/* $OpenBSD: dsa_lib.c,v 1.49 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -65,7 +65,6 @@
65#include <openssl/asn1.h> 65#include <openssl/asn1.h>
66#include <openssl/bn.h> 66#include <openssl/bn.h>
67#include <openssl/dsa.h> 67#include <openssl/dsa.h>
68#include <openssl/err.h>
69 68
70#ifndef OPENSSL_NO_DH 69#ifndef OPENSSL_NO_DH
71#include <openssl/dh.h> 70#include <openssl/dh.h>
@@ -73,6 +72,7 @@
73 72
74#include "dh_local.h" 73#include "dh_local.h"
75#include "dsa_local.h" 74#include "dsa_local.h"
75#include "err_local.h"
76 76
77static const DSA_METHOD *default_DSA_method = NULL; 77static const DSA_METHOD *default_DSA_method = NULL;
78 78
diff --git a/src/lib/libcrypto/dsa/dsa_meth.c b/src/lib/libcrypto/dsa/dsa_meth.c
index c84b5287e1..c961bb13b4 100644
--- a/src/lib/libcrypto/dsa/dsa_meth.c
+++ b/src/lib/libcrypto/dsa/dsa_meth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dsa_meth.c,v 1.7 2023/07/08 14:28:15 beck Exp $ */ 1/* $OpenBSD: dsa_meth.c,v 1.8 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> 3 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
4 * 4 *
@@ -19,9 +19,9 @@
19#include <string.h> 19#include <string.h>
20 20
21#include <openssl/dsa.h> 21#include <openssl/dsa.h>
22#include <openssl/err.h>
23 22
24#include "dsa_local.h" 23#include "dsa_local.h"
24#include "err_local.h"
25 25
26DSA_METHOD * 26DSA_METHOD *
27DSA_meth_new(const char *name, int flags) 27DSA_meth_new(const char *name, int flags)
diff --git a/src/lib/libcrypto/dsa/dsa_ossl.c b/src/lib/libcrypto/dsa/dsa_ossl.c
index c53c8b9001..6d1546f4fc 100644
--- a/src/lib/libcrypto/dsa/dsa_ossl.c
+++ b/src/lib/libcrypto/dsa/dsa_ossl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dsa_ossl.c,v 1.56 2024/05/11 06:43:50 tb Exp $ */ 1/* $OpenBSD: dsa_ossl.c,v 1.57 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -63,11 +63,11 @@
63#include <openssl/asn1.h> 63#include <openssl/asn1.h>
64#include <openssl/bn.h> 64#include <openssl/bn.h>
65#include <openssl/dsa.h> 65#include <openssl/dsa.h>
66#include <openssl/err.h>
67#include <openssl/sha.h> 66#include <openssl/sha.h>
68 67
69#include "bn_local.h" 68#include "bn_local.h"
70#include "dsa_local.h" 69#include "dsa_local.h"
70#include "err_local.h"
71 71
72/* 72/*
73 * Since DSA parameters are entirely arbitrary and checking them to be 73 * Since DSA parameters are entirely arbitrary and checking them to be
diff --git a/src/lib/libcrypto/dsa/dsa_pmeth.c b/src/lib/libcrypto/dsa/dsa_pmeth.c
index adc7319731..73889a8307 100644
--- a/src/lib/libcrypto/dsa/dsa_pmeth.c
+++ b/src/lib/libcrypto/dsa/dsa_pmeth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dsa_pmeth.c,v 1.21 2024/10/19 14:39:44 tb Exp $ */ 1/* $OpenBSD: dsa_pmeth.c,v 1.22 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -63,12 +63,12 @@
63 63
64#include <openssl/asn1t.h> 64#include <openssl/asn1t.h>
65#include <openssl/bn.h> 65#include <openssl/bn.h>
66#include <openssl/err.h>
67#include <openssl/evp.h> 66#include <openssl/evp.h>
68#include <openssl/x509.h> 67#include <openssl/x509.h>
69 68
70#include "bn_local.h" 69#include "bn_local.h"
71#include "dsa_local.h" 70#include "dsa_local.h"
71#include "err_local.h"
72#include "evp_local.h" 72#include "evp_local.h"
73 73
74/* DSA pkey context structure */ 74/* DSA pkey context structure */
diff --git a/src/lib/libcrypto/dsa/dsa_prn.c b/src/lib/libcrypto/dsa/dsa_prn.c
index f276d82482..058b7d9ffd 100644
--- a/src/lib/libcrypto/dsa/dsa_prn.c
+++ b/src/lib/libcrypto/dsa/dsa_prn.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dsa_prn.c,v 1.10 2023/07/08 14:28:15 beck Exp $ */ 1/* $OpenBSD: dsa_prn.c,v 1.11 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -59,9 +59,10 @@
59#include <stdio.h> 59#include <stdio.h>
60 60
61#include <openssl/dsa.h> 61#include <openssl/dsa.h>
62#include <openssl/err.h>
63#include <openssl/evp.h> 62#include <openssl/evp.h>
64 63
64#include "err_local.h"
65
65int 66int
66DSA_print_fp(FILE *fp, const DSA *x, int off) 67DSA_print_fp(FILE *fp, const DSA *x, int off)
67{ 68{
diff --git a/src/lib/libcrypto/ec/ec_ameth.c b/src/lib/libcrypto/ec/ec_ameth.c
index 903b18a8db..ddc8adea1e 100644
--- a/src/lib/libcrypto/ec/ec_ameth.c
+++ b/src/lib/libcrypto/ec/ec_ameth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_ameth.c,v 1.73 2024/11/25 06:51:39 tb Exp $ */ 1/* $OpenBSD: ec_ameth.c,v 1.74 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -66,7 +66,6 @@
66#include <openssl/bn.h> 66#include <openssl/bn.h>
67#include <openssl/cms.h> 67#include <openssl/cms.h>
68#include <openssl/ec.h> 68#include <openssl/ec.h>
69#include <openssl/err.h>
70#include <openssl/evp.h> 69#include <openssl/evp.h>
71#include <openssl/pkcs7.h> 70#include <openssl/pkcs7.h>
72#include <openssl/objects.h> 71#include <openssl/objects.h>
@@ -74,6 +73,7 @@
74 73
75#include "asn1_local.h" 74#include "asn1_local.h"
76#include "bn_local.h" 75#include "bn_local.h"
76#include "err_local.h"
77#include "evp_local.h" 77#include "evp_local.h"
78#include "x509_local.h" 78#include "x509_local.h"
79 79
diff --git a/src/lib/libcrypto/ec/ec_asn1.c b/src/lib/libcrypto/ec/ec_asn1.c
index ef318f8d43..35f4f5b0ba 100644
--- a/src/lib/libcrypto/ec/ec_asn1.c
+++ b/src/lib/libcrypto/ec/ec_asn1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_asn1.c,v 1.111 2025/03/13 10:31:12 tb Exp $ */ 1/* $OpenBSD: ec_asn1.c,v 1.112 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Written by Nils Larsch for the OpenSSL project. 3 * Written by Nils Larsch for the OpenSSL project.
4 */ 4 */
@@ -66,12 +66,12 @@
66#include <openssl/asn1.h> 66#include <openssl/asn1.h>
67#include <openssl/bn.h> 67#include <openssl/bn.h>
68#include <openssl/ec.h> 68#include <openssl/ec.h>
69#include <openssl/err.h>
70#include <openssl/asn1t.h> 69#include <openssl/asn1t.h>
71#include <openssl/objects.h> 70#include <openssl/objects.h>
72 71
73#include "asn1_local.h" 72#include "asn1_local.h"
74#include "ec_local.h" 73#include "ec_local.h"
74#include "err_local.h"
75 75
76int 76int
77EC_GROUP_get_basis_type(const EC_GROUP *group) 77EC_GROUP_get_basis_type(const EC_GROUP *group)
diff --git a/src/lib/libcrypto/ec/ec_convert.c b/src/lib/libcrypto/ec/ec_convert.c
index a18bc49132..84641a4e72 100644
--- a/src/lib/libcrypto/ec/ec_convert.c
+++ b/src/lib/libcrypto/ec/ec_convert.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_convert.c,v 1.14 2025/01/05 16:07:08 tb Exp $ */ 1/* $OpenBSD: ec_convert.c,v 1.15 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Originally written by Bodo Moeller for the OpenSSL project. 3 * Originally written by Bodo Moeller for the OpenSSL project.
4 */ 4 */
@@ -64,10 +64,10 @@
64#include <string.h> 64#include <string.h>
65 65
66#include <openssl/asn1.h> 66#include <openssl/asn1.h>
67#include <openssl/err.h>
68 67
69#include "asn1_local.h" 68#include "asn1_local.h"
70#include "ec_local.h" 69#include "ec_local.h"
70#include "err_local.h"
71 71
72/* 72/*
73 * Internal handling of the point conversion octet 73 * Internal handling of the point conversion octet
diff --git a/src/lib/libcrypto/ec/ec_curve.c b/src/lib/libcrypto/ec/ec_curve.c
index a3ec2de7fb..2cfb219b50 100644
--- a/src/lib/libcrypto/ec/ec_curve.c
+++ b/src/lib/libcrypto/ec/ec_curve.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_curve.c,v 1.54 2025/03/09 17:53:11 tb Exp $ */ 1/* $OpenBSD: ec_curve.c,v 1.58 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Written by Nils Larsch for the OpenSSL project. 3 * Written by Nils Larsch for the OpenSSL project.
4 */ 4 */
@@ -78,10 +78,10 @@
78 78
79#include <openssl/bn.h> 79#include <openssl/bn.h>
80#include <openssl/ec.h> 80#include <openssl/ec.h>
81#include <openssl/err.h>
82#include <openssl/objects.h> 81#include <openssl/objects.h>
83 82
84#include "ec_local.h" 83#include "ec_local.h"
84#include "err_local.h"
85 85
86static const struct { 86static const struct {
87 uint8_t seed[20]; 87 uint8_t seed[20];
@@ -130,6 +130,57 @@ static const struct {
130 130
131static const struct { 131static const struct {
132 uint8_t seed[20]; 132 uint8_t seed[20];
133 uint8_t p[32];
134 uint8_t a[32];
135 uint8_t b[32];
136 uint8_t x[32];
137 uint8_t y[32];
138 uint8_t order[32];
139} _EC_NIST_PRIME_256 = {
140 .seed = {
141 0xc4, 0x9d, 0x36, 0x08, 0x86, 0xe7, 0x04, 0x93, 0x6a, 0x66,
142 0x78, 0xe1, 0x13, 0x9d, 0x26, 0xb7, 0x81, 0x9f, 0x7e, 0x90,
143 },
144 .p = {
145 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
146 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
147 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
148 0xff, 0xff,
149 },
150 .a = {
151 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
152 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
153 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
154 0xff, 0xfc,
155 },
156 .b = {
157 0x5a, 0xc6, 0x35, 0xd8, 0xaa, 0x3a, 0x93, 0xe7, 0xb3, 0xeb,
158 0xbd, 0x55, 0x76, 0x98, 0x86, 0xbc, 0x65, 0x1d, 0x06, 0xb0,
159 0xcc, 0x53, 0xb0, 0xf6, 0x3b, 0xce, 0x3c, 0x3e, 0x27, 0xd2,
160 0x60, 0x4b,
161 },
162 .x = {
163 0x6b, 0x17, 0xd1, 0xf2, 0xe1, 0x2c, 0x42, 0x47, 0xf8, 0xbc,
164 0xe6, 0xe5, 0x63, 0xa4, 0x40, 0xf2, 0x77, 0x03, 0x7d, 0x81,
165 0x2d, 0xeb, 0x33, 0xa0, 0xf4, 0xa1, 0x39, 0x45, 0xd8, 0x98,
166 0xc2, 0x96,
167 },
168 .y = {
169 0x4f, 0xe3, 0x42, 0xe2, 0xfe, 0x1a, 0x7f, 0x9b, 0x8e, 0xe7,
170 0xeb, 0x4a, 0x7c, 0x0f, 0x9e, 0x16, 0x2b, 0xce, 0x33, 0x57,
171 0x6b, 0x31, 0x5e, 0xce, 0xcb, 0xb6, 0x40, 0x68, 0x37, 0xbf,
172 0x51, 0xf5,
173 },
174 .order = {
175 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
176 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbc, 0xe6, 0xfa, 0xad,
177 0xa7, 0x17, 0x9e, 0x84, 0xf3, 0xb9, 0xca, 0xc2, 0xfc, 0x63,
178 0x25, 0x51,
179 },
180};
181
182static const struct {
183 uint8_t seed[20];
133 uint8_t p[48]; 184 uint8_t p[48];
134 uint8_t a[48]; 185 uint8_t a[48];
135 uint8_t b[48]; 186 uint8_t b[48];
@@ -255,192 +306,6 @@ static const struct {
255}; 306};
256 307
257static const struct { 308static const struct {
258 uint8_t seed[20];
259 uint8_t p[30];
260 uint8_t a[30];
261 uint8_t b[30];
262 uint8_t x[30];
263 uint8_t y[30];
264 uint8_t order[30];
265} _EC_X9_62_PRIME_239V1 = {
266 .seed = {
267 0xe4, 0x3b, 0xb4, 0x60, 0xf0, 0xb8, 0x0c, 0xc0, 0xc0, 0xb0,
268 0x75, 0x79, 0x8e, 0x94, 0x80, 0x60, 0xf8, 0x32, 0x1b, 0x7d,
269 },
270 .p = {
271 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
272 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00,
273 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff,
274 },
275 .a = {
276 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
277 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00,
278 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xfc,
279 },
280 .b = {
281 0x6b, 0x01, 0x6c, 0x3b, 0xdc, 0xf1, 0x89, 0x41, 0xd0, 0xd6,
282 0x54, 0x92, 0x14, 0x75, 0xca, 0x71, 0xa9, 0xdb, 0x2f, 0xb2,
283 0x7d, 0x1d, 0x37, 0x79, 0x61, 0x85, 0xc2, 0x94, 0x2c, 0x0a,
284 },
285 .x = {
286 0x0f, 0xfa, 0x96, 0x3c, 0xdc, 0xa8, 0x81, 0x6c, 0xcc, 0x33,
287 0xb8, 0x64, 0x2b, 0xed, 0xf9, 0x05, 0xc3, 0xd3, 0x58, 0x57,
288 0x3d, 0x3f, 0x27, 0xfb, 0xbd, 0x3b, 0x3c, 0xb9, 0xaa, 0xaf,
289 },
290 .y = {
291 0x7d, 0xeb, 0xe8, 0xe4, 0xe9, 0x0a, 0x5d, 0xae, 0x6e, 0x40,
292 0x54, 0xca, 0x53, 0x0b, 0xa0, 0x46, 0x54, 0xb3, 0x68, 0x18,
293 0xce, 0x22, 0x6b, 0x39, 0xfc, 0xcb, 0x7b, 0x02, 0xf1, 0xae,
294 },
295 .order = {
296 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
297 0xff, 0xff, 0x7f, 0xff, 0xff, 0x9e, 0x5e, 0x9a, 0x9f, 0x5d,
298 0x90, 0x71, 0xfb, 0xd1, 0x52, 0x26, 0x88, 0x90, 0x9d, 0x0b,
299 },
300};
301
302static const struct {
303 uint8_t seed[20];
304 uint8_t p[30];
305 uint8_t a[30];
306 uint8_t b[30];
307 uint8_t x[30];
308 uint8_t y[30];
309 uint8_t order[30];
310} _EC_X9_62_PRIME_239V2 = {
311 .seed = {
312 0xe8, 0xb4, 0x01, 0x16, 0x04, 0x09, 0x53, 0x03, 0xca, 0x3b,
313 0x80, 0x99, 0x98, 0x2b, 0xe0, 0x9f, 0xcb, 0x9a, 0xe6, 0x16,
314 },
315 .p = {
316 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
317 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00,
318 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff,
319 },
320 .a = {
321 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
322 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00,
323 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xfc,
324 },
325 .b = {
326 0x61, 0x7f, 0xab, 0x68, 0x32, 0x57, 0x6c, 0xbb, 0xfe, 0xd5,
327 0x0d, 0x99, 0xf0, 0x24, 0x9c, 0x3f, 0xee, 0x58, 0xb9, 0x4b,
328 0xa0, 0x03, 0x8c, 0x7a, 0xe8, 0x4c, 0x8c, 0x83, 0x2f, 0x2c,
329 },
330 .x = {
331 0x38, 0xaf, 0x09, 0xd9, 0x87, 0x27, 0x70, 0x51, 0x20, 0xc9,
332 0x21, 0xbb, 0x5e, 0x9e, 0x26, 0x29, 0x6a, 0x3c, 0xdc, 0xf2,
333 0xf3, 0x57, 0x57, 0xa0, 0xea, 0xfd, 0x87, 0xb8, 0x30, 0xe7,
334 },
335 .y = {
336 0x5b, 0x01, 0x25, 0xe4, 0xdb, 0xea, 0x0e, 0xc7, 0x20, 0x6d,
337 0xa0, 0xfc, 0x01, 0xd9, 0xb0, 0x81, 0x32, 0x9f, 0xb5, 0x55,
338 0xde, 0x6e, 0xf4, 0x60, 0x23, 0x7d, 0xff, 0x8b, 0xe4, 0xba,
339 },
340 .order = {
341 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
342 0xff, 0xff, 0x80, 0x00, 0x00, 0xcf, 0xa7, 0xe8, 0x59, 0x43,
343 0x77, 0xd4, 0x14, 0xc0, 0x38, 0x21, 0xbc, 0x58, 0x20, 0x63,
344 },
345};
346
347static const struct {
348 uint8_t seed[20];
349 uint8_t p[30];
350 uint8_t a[30];
351 uint8_t b[30];
352 uint8_t x[30];
353 uint8_t y[30];
354 uint8_t order[30];
355} _EC_X9_62_PRIME_239V3 = {
356 .seed = {
357 0x7d, 0x73, 0x74, 0x16, 0x8f, 0xfe, 0x34, 0x71, 0xb6, 0x0a,
358 0x85, 0x76, 0x86, 0xa1, 0x94, 0x75, 0xd3, 0xbf, 0xa2, 0xff,
359 },
360 .p = {
361 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
362 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00,
363 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff,
364 },
365 .a = {
366 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
367 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00,
368 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xfc,
369 },
370 .b = {
371 0x25, 0x57, 0x05, 0xfa, 0x2a, 0x30, 0x66, 0x54, 0xb1, 0xf4,
372 0xcb, 0x03, 0xd6, 0xa7, 0x50, 0xa3, 0x0c, 0x25, 0x01, 0x02,
373 0xd4, 0x98, 0x87, 0x17, 0xd9, 0xba, 0x15, 0xab, 0x6d, 0x3e,
374 },
375 .x = {
376 0x67, 0x68, 0xae, 0x8e, 0x18, 0xbb, 0x92, 0xcf, 0xcf, 0x00,
377 0x5c, 0x94, 0x9a, 0xa2, 0xc6, 0xd9, 0x48, 0x53, 0xd0, 0xe6,
378 0x60, 0xbb, 0xf8, 0x54, 0xb1, 0xc9, 0x50, 0x5f, 0xe9, 0x5a,
379 },
380 .y = {
381 0x16, 0x07, 0xe6, 0x89, 0x8f, 0x39, 0x0c, 0x06, 0xbc, 0x1d,
382 0x55, 0x2b, 0xad, 0x22, 0x6f, 0x3b, 0x6f, 0xcf, 0xe4, 0x8b,
383 0x6e, 0x81, 0x84, 0x99, 0xaf, 0x18, 0xe3, 0xed, 0x6c, 0xf3,
384 },
385 .order = {
386 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
387 0xff, 0xff, 0x7f, 0xff, 0xff, 0x97, 0x5d, 0xeb, 0x41, 0xb3,
388 0xa6, 0x05, 0x7c, 0x3c, 0x43, 0x21, 0x46, 0x52, 0x65, 0x51,
389 },
390};
391
392static const struct {
393 uint8_t seed[20];
394 uint8_t p[32];
395 uint8_t a[32];
396 uint8_t b[32];
397 uint8_t x[32];
398 uint8_t y[32];
399 uint8_t order[32];
400} _EC_X9_62_PRIME_256V1 = {
401 .seed = {
402 0xc4, 0x9d, 0x36, 0x08, 0x86, 0xe7, 0x04, 0x93, 0x6a, 0x66,
403 0x78, 0xe1, 0x13, 0x9d, 0x26, 0xb7, 0x81, 0x9f, 0x7e, 0x90,
404 },
405 .p = {
406 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
407 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
408 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
409 0xff, 0xff,
410 },
411 .a = {
412 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
413 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
414 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
415 0xff, 0xfc,
416 },
417 .b = {
418 0x5a, 0xc6, 0x35, 0xd8, 0xaa, 0x3a, 0x93, 0xe7, 0xb3, 0xeb,
419 0xbd, 0x55, 0x76, 0x98, 0x86, 0xbc, 0x65, 0x1d, 0x06, 0xb0,
420 0xcc, 0x53, 0xb0, 0xf6, 0x3b, 0xce, 0x3c, 0x3e, 0x27, 0xd2,
421 0x60, 0x4b,
422 },
423 .x = {
424 0x6b, 0x17, 0xd1, 0xf2, 0xe1, 0x2c, 0x42, 0x47, 0xf8, 0xbc,
425 0xe6, 0xe5, 0x63, 0xa4, 0x40, 0xf2, 0x77, 0x03, 0x7d, 0x81,
426 0x2d, 0xeb, 0x33, 0xa0, 0xf4, 0xa1, 0x39, 0x45, 0xd8, 0x98,
427 0xc2, 0x96,
428 },
429 .y = {
430 0x4f, 0xe3, 0x42, 0xe2, 0xfe, 0x1a, 0x7f, 0x9b, 0x8e, 0xe7,
431 0xeb, 0x4a, 0x7c, 0x0f, 0x9e, 0x16, 0x2b, 0xce, 0x33, 0x57,
432 0x6b, 0x31, 0x5e, 0xce, 0xcb, 0xb6, 0x40, 0x68, 0x37, 0xbf,
433 0x51, 0xf5,
434 },
435 .order = {
436 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
437 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbc, 0xe6, 0xfa, 0xad,
438 0xa7, 0x17, 0x9e, 0x84, 0xf3, 0xb9, 0xca, 0xc2, 0xfc, 0x63,
439 0x25, 0x51,
440 },
441};
442
443static const struct {
444 uint8_t p[29]; 309 uint8_t p[29];
445 uint8_t a[29]; 310 uint8_t a[29];
446 uint8_t b[29]; 311 uint8_t b[29];
@@ -1121,7 +986,21 @@ static const struct ec_curve {
1121 .order = _EC_SECG_PRIME_256K1.order, 986 .order = _EC_SECG_PRIME_256K1.order,
1122 .cofactor = 1, 987 .cofactor = 1,
1123 }, 988 },
1124 /* SECG secp256r1 is the same as X9.62 prime256v1 and hence omitted */ 989 {
990 /* Everyone except OpenSSL calls this secp256r1 or P-256. */
991 .comment = "X9.62/SECG curve prime256v1",
992 .nid = NID_X9_62_prime256v1,
993 .seed_len = sizeof(_EC_NIST_PRIME_256.seed),
994 .param_len = sizeof(_EC_NIST_PRIME_256.p),
995 .seed = _EC_NIST_PRIME_256.seed,
996 .p = _EC_NIST_PRIME_256.p,
997 .a = _EC_NIST_PRIME_256.a,
998 .b = _EC_NIST_PRIME_256.b,
999 .x = _EC_NIST_PRIME_256.x,
1000 .y = _EC_NIST_PRIME_256.y,
1001 .order = _EC_NIST_PRIME_256.order,
1002 .cofactor = 1,
1003 },
1125 { 1004 {
1126 .comment = "NIST/SECG curve secp384r1", 1005 .comment = "NIST/SECG curve secp384r1",
1127 .nid = NID_secp384r1, 1006 .nid = NID_secp384r1,
@@ -1150,63 +1029,6 @@ static const struct ec_curve {
1150 .order = _EC_NIST_PRIME_521.order, 1029 .order = _EC_NIST_PRIME_521.order,
1151 .cofactor = 1, 1030 .cofactor = 1,
1152 }, 1031 },
1153 /* X9.62 curves */
1154 {
1155 .comment = "X9.62 curve prime239v1",
1156 .nid = NID_X9_62_prime239v1,
1157 .seed_len = sizeof(_EC_X9_62_PRIME_239V1.seed),
1158 .param_len = sizeof(_EC_X9_62_PRIME_239V1.p),
1159 .seed = _EC_X9_62_PRIME_239V1.seed,
1160 .p = _EC_X9_62_PRIME_239V1.p,
1161 .a = _EC_X9_62_PRIME_239V1.a,
1162 .b = _EC_X9_62_PRIME_239V1.b,
1163 .x = _EC_X9_62_PRIME_239V1.x,
1164 .y = _EC_X9_62_PRIME_239V1.y,
1165 .order = _EC_X9_62_PRIME_239V1.order,
1166 .cofactor = 1,
1167 },
1168 {
1169 .comment = "X9.62 curve prime239v2",
1170 .nid = NID_X9_62_prime239v2,
1171 .seed_len = sizeof(_EC_X9_62_PRIME_239V2.seed),
1172 .param_len = sizeof(_EC_X9_62_PRIME_239V2.p),
1173 .seed = _EC_X9_62_PRIME_239V2.seed,
1174 .p = _EC_X9_62_PRIME_239V2.p,
1175 .a = _EC_X9_62_PRIME_239V2.a,
1176 .b = _EC_X9_62_PRIME_239V2.b,
1177 .x = _EC_X9_62_PRIME_239V2.x,
1178 .y = _EC_X9_62_PRIME_239V2.y,
1179 .order = _EC_X9_62_PRIME_239V2.order,
1180 .cofactor = 1,
1181 },
1182 {
1183 .comment = "X9.62 curve prime239v3",
1184 .nid = NID_X9_62_prime239v3,
1185 .seed_len = sizeof(_EC_X9_62_PRIME_239V3.seed),
1186 .param_len = sizeof(_EC_X9_62_PRIME_239V3.p),
1187 .seed = _EC_X9_62_PRIME_239V3.seed,
1188 .p = _EC_X9_62_PRIME_239V3.p,
1189 .a = _EC_X9_62_PRIME_239V3.a,
1190 .b = _EC_X9_62_PRIME_239V3.b,
1191 .x = _EC_X9_62_PRIME_239V3.x,
1192 .y = _EC_X9_62_PRIME_239V3.y,
1193 .order = _EC_X9_62_PRIME_239V3.order,
1194 .cofactor = 1,
1195 },
1196 {
1197 .comment = "X9.62/SECG curve prime256v1",
1198 .nid = NID_X9_62_prime256v1,
1199 .seed_len = sizeof(_EC_X9_62_PRIME_256V1.seed),
1200 .param_len = sizeof(_EC_X9_62_PRIME_256V1.p),
1201 .seed = _EC_X9_62_PRIME_256V1.seed,
1202 .p = _EC_X9_62_PRIME_256V1.p,
1203 .a = _EC_X9_62_PRIME_256V1.a,
1204 .b = _EC_X9_62_PRIME_256V1.b,
1205 .x = _EC_X9_62_PRIME_256V1.x,
1206 .y = _EC_X9_62_PRIME_256V1.y,
1207 .order = _EC_X9_62_PRIME_256V1.order,
1208 .cofactor = 1,
1209 },
1210 /* RFC 5639 curves */ 1032 /* RFC 5639 curves */
1211 { 1033 {
1212 .comment = "RFC 5639 curve brainpoolP224r1", 1034 .comment = "RFC 5639 curve brainpoolP224r1",
@@ -1221,7 +1043,7 @@ static const struct ec_curve {
1221 .cofactor = 1, 1043 .cofactor = 1,
1222 }, 1044 },
1223 { 1045 {
1224 .comment = "RFC 5639 curve brainpoolP224r2", 1046 .comment = "RFC 5639 curve brainpoolP224t1",
1225 .nid = NID_brainpoolP224t1, 1047 .nid = NID_brainpoolP224t1,
1226 .param_len = sizeof(_EC_brainpoolP224t1.p), 1048 .param_len = sizeof(_EC_brainpoolP224t1.p),
1227 .p = _EC_brainpoolP224t1.p, 1049 .p = _EC_brainpoolP224t1.p,
diff --git a/src/lib/libcrypto/ec/ec_field.c b/src/lib/libcrypto/ec/ec_field.c
new file mode 100644
index 0000000000..6576526e77
--- /dev/null
+++ b/src/lib/libcrypto/ec/ec_field.c
@@ -0,0 +1,202 @@
1/* $OpenBSD: ec_field.c,v 1.3 2025/08/02 16:20:00 jsing Exp $ */
2/*
3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#include <string.h>
19
20#include <openssl/ec.h>
21
22#include "bn_local.h"
23#include "bn_internal.h"
24#include "ec_local.h"
25#include "ec_internal.h"
26
27int
28ec_field_modulus_from_bn(EC_FIELD_MODULUS *fm, const BIGNUM *bn, BN_CTX *ctx)
29{
30 BN_MONT_CTX *mctx = NULL;
31 size_t i;
32 int ret = 0;
33
34 if (BN_is_negative(bn))
35 goto err;
36 if (BN_num_bits(bn) > EC_FIELD_ELEMENT_MAX_BITS)
37 goto err;
38
39 memset(fm, 0, sizeof(*fm));
40
41 fm->n = (BN_num_bits(bn) + BN_BITS2 - 1) / BN_BITS2;
42
43 for (i = 0; i < bn->top; i++)
44 fm->m.w[i] = bn->d[i];
45
46 /* XXX - implement this without BN_MONT_CTX. */
47 if ((mctx = BN_MONT_CTX_new()) == NULL)
48 goto err;
49 if (!BN_MONT_CTX_set(mctx, bn, ctx))
50 goto err;
51
52 for (i = 0; i < mctx->RR.top; i++)
53 fm->rr.w[i] = mctx->RR.d[i];
54
55 fm->minv0 = mctx->n0[0];
56
57 ret = 1;
58
59 err:
60 BN_MONT_CTX_free(mctx);
61
62 return ret;
63}
64
65int
66ec_field_element_from_bn(const EC_FIELD_MODULUS *fm, const EC_GROUP *group,
67 EC_FIELD_ELEMENT *fe, const BIGNUM *bn, BN_CTX *ctx)
68{
69 BN_ULONG t[EC_FIELD_ELEMENT_MAX_WORDS * 2 + 2];
70 BIGNUM *tmp;
71 size_t i;
72 int ret = 0;
73
74 BN_CTX_start(ctx);
75
76 if ((tmp = BN_CTX_get(ctx)) == NULL)
77 goto err;
78
79 /* XXX - enforce 0 <= n < p. */
80
81 if (BN_num_bits(bn) > EC_FIELD_ELEMENT_MAX_BITS)
82 goto err;
83
84 /* XXX - do this without BN. */
85 if (!BN_nnmod(tmp, bn, group->p, ctx))
86 goto err;
87
88 if (BN_num_bits(tmp) > EC_FIELD_ELEMENT_MAX_BITS)
89 abort();
90
91 memset(fe->w, 0, sizeof(fe->w));
92
93 for (i = 0; i < tmp->top; i++)
94 fe->w[i] = tmp->d[i];
95
96 bn_mod_mul_words(fe->w, fe->w, fm->rr.w, fm->m.w, t, fm->minv0, fm->n);
97
98 ret = 1;
99
100 err:
101 BN_CTX_end(ctx);
102
103 return ret;
104}
105
106int
107ec_field_element_to_bn(const EC_FIELD_MODULUS *fm, const EC_FIELD_ELEMENT *fe,
108 BIGNUM *bn, BN_CTX *ctx)
109{
110 BN_ULONG t[EC_FIELD_ELEMENT_MAX_WORDS * 2 + 2];
111 size_t i;
112
113 if (!bn_wexpand(bn, fm->n))
114 return 0;
115
116 memset(t, 0, sizeof(t));
117 for (i = 0; i < fm->n; i++)
118 t[i] = fe->w[i];
119
120 bn_montgomery_reduce_words(bn->d, t, fm->m.w, fm->minv0, fm->n);
121
122 bn->top = fm->n;
123 bn_correct_top(bn);
124
125 return 1;
126}
127
128void
129ec_field_element_copy(EC_FIELD_ELEMENT *dst, const EC_FIELD_ELEMENT *src)
130{
131 memcpy(dst, src, sizeof(EC_FIELD_ELEMENT));
132}
133
134void
135ec_field_element_select(const EC_FIELD_MODULUS *fm, EC_FIELD_ELEMENT *r,
136 const EC_FIELD_ELEMENT *a, const EC_FIELD_ELEMENT *b, int conditional)
137{
138 BN_ULONG mask;
139 int i;
140
141 mask = bn_ct_eq_zero_mask(conditional);
142
143 for (i = 0; i < fm->n; i++)
144 r->w[i] = (a->w[i] & mask) | (b->w[i] & ~mask);
145}
146
147int
148ec_field_element_equal(const EC_FIELD_MODULUS *fm, const EC_FIELD_ELEMENT *a,
149 const EC_FIELD_ELEMENT *b)
150{
151 BN_ULONG v = 0;
152 int i;
153
154 for (i = 0; i < fm->n; i++)
155 v |= a->w[i] ^ b->w[i];
156
157 return bn_ct_eq_zero(v);
158}
159
160int
161ec_field_element_is_zero(const EC_FIELD_MODULUS *fm, const EC_FIELD_ELEMENT *fe)
162{
163 BN_ULONG v = 0;
164 int i;
165
166 for (i = 0; i < fm->n; i++)
167 v |= fe->w[i];
168
169 return bn_ct_eq_zero(v);
170}
171
172void
173ec_field_element_add(const EC_FIELD_MODULUS *m, EC_FIELD_ELEMENT *r,
174 const EC_FIELD_ELEMENT *a, const EC_FIELD_ELEMENT *b)
175{
176 bn_mod_add_words(r->w, a->w, b->w, m->m.w, m->n);
177}
178
179void
180ec_field_element_sub(const EC_FIELD_MODULUS *m, EC_FIELD_ELEMENT *r,
181 const EC_FIELD_ELEMENT *a, const EC_FIELD_ELEMENT *b)
182{
183 bn_mod_sub_words(r->w, a->w, b->w, m->m.w, m->n);
184}
185
186void
187ec_field_element_mul(const EC_FIELD_MODULUS *m, EC_FIELD_ELEMENT *r,
188 const EC_FIELD_ELEMENT *a, const EC_FIELD_ELEMENT *b)
189{
190 BN_ULONG t[EC_FIELD_ELEMENT_MAX_WORDS * 2 + 2];
191
192 bn_mod_mul_words(r->w, a->w, b->w, m->m.w, t, m->minv0, m->n);
193}
194
195void
196ec_field_element_sqr(const EC_FIELD_MODULUS *m, EC_FIELD_ELEMENT *r,
197 const EC_FIELD_ELEMENT *a)
198{
199 BN_ULONG t[EC_FIELD_ELEMENT_MAX_WORDS * 2 + 2];
200
201 bn_mod_sqr_words(r->w, a->w, m->m.w, t, m->minv0, m->n);
202}
diff --git a/src/lib/libcrypto/ec/ec_internal.h b/src/lib/libcrypto/ec/ec_internal.h
new file mode 100644
index 0000000000..327d9ea94d
--- /dev/null
+++ b/src/lib/libcrypto/ec/ec_internal.h
@@ -0,0 +1,65 @@
1/* $OpenBSD: ec_internal.h,v 1.2 2025/08/02 15:44:09 jsing Exp $ */
2/*
3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#include <openssl/bn.h>
19
20#ifndef HEADER_EC_INTERNAL_H
21#define HEADER_EC_INTERNAL_H
22
23#define EC_FIELD_ELEMENT_MAX_BITS 521
24#define EC_FIELD_ELEMENT_MAX_BYTES \
25 (EC_FIELD_ELEMENT_MAX_BITS + 7) / 8
26#define EC_FIELD_ELEMENT_MAX_WORDS \
27 ((EC_FIELD_ELEMENT_MAX_BYTES + BN_BYTES - 1) / BN_BYTES)
28
29typedef struct {
30 BN_ULONG w[EC_FIELD_ELEMENT_MAX_WORDS];
31} EC_FIELD_ELEMENT;
32
33typedef struct {
34 size_t n;
35 EC_FIELD_ELEMENT m;
36 EC_FIELD_ELEMENT rr;
37 BN_ULONG minv0;
38} EC_FIELD_MODULUS;
39
40int ec_field_modulus_from_bn(EC_FIELD_MODULUS *fm, const BIGNUM *bn,
41 BN_CTX *ctx);
42
43int ec_field_element_from_bn(const EC_FIELD_MODULUS *fm, const EC_GROUP *group,
44 EC_FIELD_ELEMENT *fe, const BIGNUM *bn, BN_CTX *ctx);
45int ec_field_element_to_bn(const EC_FIELD_MODULUS *fm, const EC_FIELD_ELEMENT *fe,
46 BIGNUM *bn, BN_CTX *ctx);
47
48void ec_field_element_copy(EC_FIELD_ELEMENT *dst, const EC_FIELD_ELEMENT *src);
49void ec_field_element_select(const EC_FIELD_MODULUS *fm, EC_FIELD_ELEMENT *r,
50 const EC_FIELD_ELEMENT *a, const EC_FIELD_ELEMENT *b, int conditional);
51
52int ec_field_element_equal(const EC_FIELD_MODULUS *fm, const EC_FIELD_ELEMENT *a,
53 const EC_FIELD_ELEMENT *b);
54int ec_field_element_is_zero(const EC_FIELD_MODULUS *fm, const EC_FIELD_ELEMENT *fe);
55
56void ec_field_element_add(const EC_FIELD_MODULUS *m, EC_FIELD_ELEMENT *r,
57 const EC_FIELD_ELEMENT *a, const EC_FIELD_ELEMENT *b);
58void ec_field_element_sub(const EC_FIELD_MODULUS *m, EC_FIELD_ELEMENT *r,
59 const EC_FIELD_ELEMENT *a, const EC_FIELD_ELEMENT *b);
60void ec_field_element_mul(const EC_FIELD_MODULUS *m, EC_FIELD_ELEMENT *r,
61 const EC_FIELD_ELEMENT *a, const EC_FIELD_ELEMENT *b);
62void ec_field_element_sqr(const EC_FIELD_MODULUS *m, EC_FIELD_ELEMENT *r,
63 const EC_FIELD_ELEMENT *a);
64
65#endif
diff --git a/src/lib/libcrypto/ec/ec_key.c b/src/lib/libcrypto/ec/ec_key.c
index 6257d67cd1..e9777019c8 100644
--- a/src/lib/libcrypto/ec/ec_key.c
+++ b/src/lib/libcrypto/ec/ec_key.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_key.c,v 1.51 2025/01/25 10:34:36 tb Exp $ */ 1/* $OpenBSD: ec_key.c,v 1.52 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Written by Nils Larsch for the OpenSSL project. 3 * Written by Nils Larsch for the OpenSSL project.
4 */ 4 */
@@ -66,11 +66,11 @@
66#include <openssl/opensslconf.h> 66#include <openssl/opensslconf.h>
67 67
68#include <openssl/ec.h> 68#include <openssl/ec.h>
69#include <openssl/err.h>
70 69
71#include "bn_local.h" 70#include "bn_local.h"
72#include "ec_local.h" 71#include "ec_local.h"
73#include "ecdsa_local.h" 72#include "ecdsa_local.h"
73#include "err_local.h"
74 74
75EC_KEY * 75EC_KEY *
76EC_KEY_new(void) 76EC_KEY_new(void)
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c
index 315a8130cf..36f42ecc05 100644
--- a/src/lib/libcrypto/ec/ec_lib.c
+++ b/src/lib/libcrypto/ec/ec_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_lib.c,v 1.121 2025/03/09 15:42:19 tb Exp $ */ 1/* $OpenBSD: ec_lib.c,v 1.126 2025/08/02 15:47:27 jsing Exp $ */
2/* 2/*
3 * Originally written by Bodo Moeller for the OpenSSL project. 3 * Originally written by Bodo Moeller for the OpenSSL project.
4 */ 4 */
@@ -68,12 +68,12 @@
68 68
69#include <openssl/bn.h> 69#include <openssl/bn.h>
70#include <openssl/ec.h> 70#include <openssl/ec.h>
71#include <openssl/err.h>
72#include <openssl/objects.h> 71#include <openssl/objects.h>
73#include <openssl/opensslv.h> 72#include <openssl/opensslv.h>
74 73
75#include "bn_local.h" 74#include "bn_local.h"
76#include "ec_local.h" 75#include "ec_local.h"
76#include "err_local.h"
77 77
78EC_GROUP * 78EC_GROUP *
79EC_GROUP_new(const EC_METHOD *meth) 79EC_GROUP_new(const EC_METHOD *meth)
@@ -165,6 +165,10 @@ EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src)
165 165
166 dst->a_is_minus3 = src->a_is_minus3; 166 dst->a_is_minus3 = src->a_is_minus3;
167 167
168 memcpy(&dst->fm, &src->fm, sizeof(src->fm));
169 memcpy(&dst->fe_a, &src->fe_a, sizeof(src->fe_a));
170 memcpy(&dst->fe_b, &src->fe_b, sizeof(src->fe_b));
171
168 BN_MONT_CTX_free(dst->mont_ctx); 172 BN_MONT_CTX_free(dst->mont_ctx);
169 dst->mont_ctx = NULL; 173 dst->mont_ctx = NULL;
170 if (src->mont_ctx != NULL) { 174 if (src->mont_ctx != NULL) {
@@ -860,6 +864,10 @@ EC_POINT_copy(EC_POINT *dst, const EC_POINT *src)
860 return 0; 864 return 0;
861 dst->Z_is_one = src->Z_is_one; 865 dst->Z_is_one = src->Z_is_one;
862 866
867 memcpy(&dst->fe_x, &src->fe_x, sizeof(dst->fe_x));
868 memcpy(&dst->fe_y, &src->fe_y, sizeof(dst->fe_y));
869 memcpy(&dst->fe_z, &src->fe_z, sizeof(dst->fe_z));
870
863 return 1; 871 return 1;
864} 872}
865LCRYPTO_ALIAS(EC_POINT_copy); 873LCRYPTO_ALIAS(EC_POINT_copy);
@@ -894,11 +902,7 @@ EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point)
894 ECerror(EC_R_INCOMPATIBLE_OBJECTS); 902 ECerror(EC_R_INCOMPATIBLE_OBJECTS);
895 return 0; 903 return 0;
896 } 904 }
897 905 return point->meth->point_set_to_infinity(group, point);
898 BN_zero(point->Z);
899 point->Z_is_one = 0;
900
901 return 1;
902} 906}
903LCRYPTO_ALIAS(EC_POINT_set_to_infinity); 907LCRYPTO_ALIAS(EC_POINT_set_to_infinity);
904 908
@@ -1200,8 +1204,7 @@ EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *point)
1200 ECerror(EC_R_INCOMPATIBLE_OBJECTS); 1204 ECerror(EC_R_INCOMPATIBLE_OBJECTS);
1201 return 0; 1205 return 0;
1202 } 1206 }
1203 1207 return point->meth->point_is_at_infinity(group, point);
1204 return BN_is_zero(point->Z);
1205} 1208}
1206LCRYPTO_ALIAS(EC_POINT_is_at_infinity); 1209LCRYPTO_ALIAS(EC_POINT_is_at_infinity);
1207 1210
@@ -1319,6 +1322,11 @@ EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar,
1319 goto err; 1322 goto err;
1320 } 1323 }
1321 1324
1325 if (g_scalar != NULL && group->generator == NULL) {
1326 ECerror(EC_R_UNDEFINED_GENERATOR);
1327 goto err;
1328 }
1329
1322 if (g_scalar != NULL && point == NULL && p_scalar == NULL) { 1330 if (g_scalar != NULL && point == NULL && p_scalar == NULL) {
1323 /* 1331 /*
1324 * In this case we want to compute g_scalar * GeneratorPoint: 1332 * In this case we want to compute g_scalar * GeneratorPoint:
@@ -1328,8 +1336,8 @@ EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar,
1328 * secret. This is why we ignore if BN_FLG_CONSTTIME is actually 1336 * secret. This is why we ignore if BN_FLG_CONSTTIME is actually
1329 * set and we always call the constant time version. 1337 * set and we always call the constant time version.
1330 */ 1338 */
1331 ret = group->meth->mul_single_ct(group, r, g_scalar, 1339 ret = group->meth->mul_single_ct(group, r,
1332 group->generator, ctx); 1340 g_scalar, group->generator, ctx);
1333 } else if (g_scalar == NULL && point != NULL && p_scalar != NULL) { 1341 } else if (g_scalar == NULL && point != NULL && p_scalar != NULL) {
1334 /* 1342 /*
1335 * In this case we want to compute p_scalar * GenericPoint: 1343 * In this case we want to compute p_scalar * GenericPoint:
@@ -1347,8 +1355,8 @@ EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar,
1347 * this codepath is reached most prominently by ECDSA signature 1355 * this codepath is reached most prominently by ECDSA signature
1348 * verification. So we call the non-ct version. 1356 * verification. So we call the non-ct version.
1349 */ 1357 */
1350 ret = group->meth->mul_double_nonct(group, r, g_scalar, 1358 ret = group->meth->mul_double_nonct(group, r,
1351 p_scalar, point, ctx); 1359 g_scalar, group->generator, p_scalar, point, ctx);
1352 } else { 1360 } else {
1353 /* Anything else is an error. */ 1361 /* Anything else is an error. */
1354 ECerror(ERR_R_EC_LIB); 1362 ECerror(ERR_R_EC_LIB);
diff --git a/src/lib/libcrypto/ec/ec_local.h b/src/lib/libcrypto/ec/ec_local.h
index 9c188c0197..eac9e6d26c 100644
--- a/src/lib/libcrypto/ec/ec_local.h
+++ b/src/lib/libcrypto/ec/ec_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_local.h,v 1.66 2025/03/09 15:33:35 tb Exp $ */ 1/* $OpenBSD: ec_local.h,v 1.70 2025/08/03 15:07:57 jsing Exp $ */
2/* 2/*
3 * Originally written by Bodo Moeller for the OpenSSL project. 3 * Originally written by Bodo Moeller for the OpenSSL project.
4 */ 4 */
@@ -76,6 +76,7 @@
76#include <openssl/objects.h> 76#include <openssl/objects.h>
77 77
78#include "bn_local.h" 78#include "bn_local.h"
79#include "ec_internal.h"
79 80
80__BEGIN_HIDDEN_DECLS 81__BEGIN_HIDDEN_DECLS
81 82
@@ -85,6 +86,9 @@ typedef struct ec_method_st {
85 int (*group_get_curve)(const EC_GROUP *, BIGNUM *p, BIGNUM *a, 86 int (*group_get_curve)(const EC_GROUP *, BIGNUM *p, BIGNUM *a,
86 BIGNUM *b, BN_CTX *); 87 BIGNUM *b, BN_CTX *);
87 88
89 int (*point_set_to_infinity)(const EC_GROUP *, EC_POINT *);
90 int (*point_is_at_infinity)(const EC_GROUP *, const EC_POINT *);
91
88 int (*point_is_on_curve)(const EC_GROUP *, const EC_POINT *, BN_CTX *); 92 int (*point_is_on_curve)(const EC_GROUP *, const EC_POINT *, BN_CTX *);
89 int (*point_cmp)(const EC_GROUP *, const EC_POINT *a, const EC_POINT *b, 93 int (*point_cmp)(const EC_GROUP *, const EC_POINT *a, const EC_POINT *b,
90 BN_CTX *); 94 BN_CTX *);
@@ -106,8 +110,8 @@ typedef struct ec_method_st {
106 int (*mul_single_ct)(const EC_GROUP *group, EC_POINT *r, 110 int (*mul_single_ct)(const EC_GROUP *group, EC_POINT *r,
107 const BIGNUM *scalar, const EC_POINT *point, BN_CTX *); 111 const BIGNUM *scalar, const EC_POINT *point, BN_CTX *);
108 int (*mul_double_nonct)(const EC_GROUP *group, EC_POINT *r, 112 int (*mul_double_nonct)(const EC_GROUP *group, EC_POINT *r,
109 const BIGNUM *g_scalar, const BIGNUM *p_scalar, 113 const BIGNUM *scalar1, const EC_POINT *point1,
110 const EC_POINT *point, BN_CTX *); 114 const BIGNUM *scalar2, const EC_POINT *point2, BN_CTX *);
111 115
112 /* 116 /*
113 * These can be used by 'add' and 'dbl' so that the same implementations 117 * These can be used by 'add' and 'dbl' so that the same implementations
@@ -155,6 +159,10 @@ struct ec_group_st {
155 159
156 /* Montgomery context used by EC_GFp_mont_method. */ 160 /* Montgomery context used by EC_GFp_mont_method. */
157 BN_MONT_CTX *mont_ctx; 161 BN_MONT_CTX *mont_ctx;
162
163 EC_FIELD_MODULUS fm;
164 EC_FIELD_ELEMENT fe_a;
165 EC_FIELD_ELEMENT fe_b;
158} /* EC_GROUP */; 166} /* EC_GROUP */;
159 167
160struct ec_point_st { 168struct ec_point_st {
@@ -168,14 +176,20 @@ struct ec_point_st {
168 BIGNUM *Y; 176 BIGNUM *Y;
169 BIGNUM *Z; 177 BIGNUM *Z;
170 int Z_is_one; /* enable optimized point arithmetics for special case */ 178 int Z_is_one; /* enable optimized point arithmetics for special case */
179
180 EC_FIELD_ELEMENT fe_x;
181 EC_FIELD_ELEMENT fe_y;
182 EC_FIELD_ELEMENT fe_z;
171} /* EC_POINT */; 183} /* EC_POINT */;
172 184
173const EC_METHOD *EC_GFp_simple_method(void); 185const EC_METHOD *EC_GFp_simple_method(void);
174const EC_METHOD *EC_GFp_mont_method(void); 186const EC_METHOD *EC_GFp_mont_method(void);
187const EC_METHOD *EC_GFp_homogeneous_projective_method(void);
175 188
176/* Compute r = generator * m + point * n in non-constant time. */ 189/* Compute r = scalar1 * point1 + scalar2 * point2 in non-constant time. */
177int ec_wnaf_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *m, 190int ec_wnaf_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar1,
178 const EC_POINT *point, const BIGNUM *n, BN_CTX *ctx); 191 const EC_POINT *point1, const BIGNUM *scalar2, const EC_POINT *point2,
192 BN_CTX *ctx);
179 193
180int ec_group_is_builtin_curve(const EC_GROUP *group, int *out_nid); 194int ec_group_is_builtin_curve(const EC_GROUP *group, int *out_nid);
181 195
diff --git a/src/lib/libcrypto/ec/ec_mult.c b/src/lib/libcrypto/ec/ec_mult.c
index 68061ffd67..d74c89cfe2 100644
--- a/src/lib/libcrypto/ec/ec_mult.c
+++ b/src/lib/libcrypto/ec/ec_mult.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_mult.c,v 1.57 2025/01/11 13:58:31 tb Exp $ */ 1/* $OpenBSD: ec_mult.c,v 1.59 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Originally written by Bodo Moeller and Nils Larsch for the OpenSSL project. 3 * Originally written by Bodo Moeller and Nils Larsch for the OpenSSL project.
4 */ 4 */
@@ -67,9 +67,9 @@
67 67
68#include <openssl/bn.h> 68#include <openssl/bn.h>
69#include <openssl/ec.h> 69#include <openssl/ec.h>
70#include <openssl/err.h>
71 70
72#include "ec_local.h" 71#include "ec_local.h"
72#include "err_local.h"
73 73
74/* Holds the wNAF digits of bn and the corresponding odd multiples of point. */ 74/* Holds the wNAF digits of bn and the corresponding odd multiples of point. */
75struct ec_wnaf { 75struct ec_wnaf {
@@ -259,7 +259,7 @@ ec_wnaf_free(struct ec_wnaf *wnaf)
259 */ 259 */
260 260
261static struct ec_wnaf * 261static struct ec_wnaf *
262ec_wnaf_new(const EC_GROUP *group, const EC_POINT *point, const BIGNUM *bn, 262ec_wnaf_new(const EC_GROUP *group, const BIGNUM *scalar, const EC_POINT *point,
263 BN_CTX *ctx) 263 BN_CTX *ctx)
264{ 264{
265 struct ec_wnaf *wnaf; 265 struct ec_wnaf *wnaf;
@@ -267,15 +267,15 @@ ec_wnaf_new(const EC_GROUP *group, const EC_POINT *point, const BIGNUM *bn,
267 if ((wnaf = calloc(1, sizeof(*wnaf))) == NULL) 267 if ((wnaf = calloc(1, sizeof(*wnaf))) == NULL)
268 goto err; 268 goto err;
269 269
270 wnaf->num_digits = BN_num_bits(bn) + 1; 270 wnaf->num_digits = BN_num_bits(scalar) + 1;
271 if ((wnaf->digits = calloc(wnaf->num_digits, 271 if ((wnaf->digits = calloc(wnaf->num_digits,
272 sizeof(*wnaf->digits))) == NULL) 272 sizeof(*wnaf->digits))) == NULL)
273 goto err; 273 goto err;
274 274
275 if (!ec_compute_wnaf(bn, wnaf->digits, wnaf->num_digits)) 275 if (!ec_compute_wnaf(scalar, wnaf->digits, wnaf->num_digits))
276 goto err; 276 goto err;
277 277
278 wnaf->num_multiples = 1ULL << (ec_window_bits(bn) - 1); 278 wnaf->num_multiples = 1ULL << (ec_window_bits(scalar) - 1);
279 if ((wnaf->multiples = calloc(wnaf->num_multiples, 279 if ((wnaf->multiples = calloc(wnaf->num_multiples,
280 sizeof(*wnaf->multiples))) == NULL) 280 sizeof(*wnaf->multiples))) == NULL)
281 goto err; 281 goto err;
@@ -313,38 +313,34 @@ ec_wnaf_multiple(struct ec_wnaf *wnaf, signed char digit)
313} 313}
314 314
315/* 315/*
316 * Compute r = generator * m + point * n in non-constant time. 316 * Compute r = scalar1 * point1 + scalar2 * point2 in non-constant time.
317 */ 317 */
318 318
319int 319int
320ec_wnaf_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *m, 320ec_wnaf_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar1,
321 const EC_POINT *point, const BIGNUM *n, BN_CTX *ctx) 321 const EC_POINT *point1, const BIGNUM *scalar2, const EC_POINT *point2,
322 BN_CTX *ctx)
322{ 323{
323 struct ec_wnaf *wnaf[2] = { NULL, NULL }; 324 struct ec_wnaf *wnaf[2] = { NULL, NULL };
324 const EC_POINT *generator;
325 size_t i; 325 size_t i;
326 int k; 326 int k;
327 int r_is_inverted = 0; 327 int r_is_inverted = 0;
328 size_t num_digits; 328 size_t num_digits;
329 int ret = 0; 329 int ret = 0;
330 330
331 if (m == NULL || n == NULL) { 331 if (scalar1 == NULL || scalar2 == NULL) {
332 ECerror(ERR_R_PASSED_NULL_PARAMETER); 332 ECerror(ERR_R_PASSED_NULL_PARAMETER);
333 goto err; 333 goto err;
334 } 334 }
335 if (group->meth != r->meth || group->meth != point->meth) { 335 if (group->meth != r->meth || group->meth != point1->meth ||
336 group->meth != point2->meth) {
336 ECerror(EC_R_INCOMPATIBLE_OBJECTS); 337 ECerror(EC_R_INCOMPATIBLE_OBJECTS);
337 goto err; 338 goto err;
338 } 339 }
339 340
340 if ((generator = EC_GROUP_get0_generator(group)) == NULL) { 341 if ((wnaf[0] = ec_wnaf_new(group, scalar1, point1, ctx)) == NULL)
341 ECerror(EC_R_UNDEFINED_GENERATOR);
342 goto err;
343 }
344
345 if ((wnaf[0] = ec_wnaf_new(group, generator, m, ctx)) == NULL)
346 goto err; 342 goto err;
347 if ((wnaf[1] = ec_wnaf_new(group, point, n, ctx)) == NULL) 343 if ((wnaf[1] = ec_wnaf_new(group, scalar2, point2, ctx)) == NULL)
348 goto err; 344 goto err;
349 345
350 if (!ec_normalize_points(group, wnaf[0], wnaf[1], ctx)) 346 if (!ec_normalize_points(group, wnaf[0], wnaf[1], ctx))
@@ -357,8 +353,8 @@ ec_wnaf_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *m,
357 /* 353 /*
358 * Set r to the neutral element. Scan through the wNAF representations 354 * Set r to the neutral element. Scan through the wNAF representations
359 * of m and n, starting at the most significant digit. Double r and for 355 * of m and n, starting at the most significant digit. Double r and for
360 * each wNAF digit of m add the digit times the generator, and for each 356 * each wNAF digit of scalar1 add the digit times point1, and for each
361 * wNAF digit of n add the digit times the point, adjusting the signs 357 * wNAF digit of scalar2 add the digit times point2, adjusting the signs
362 * as appropriate. 358 * as appropriate.
363 */ 359 */
364 360
diff --git a/src/lib/libcrypto/ec/ec_pmeth.c b/src/lib/libcrypto/ec/ec_pmeth.c
index 85ac4822d1..69bf7e741a 100644
--- a/src/lib/libcrypto/ec/ec_pmeth.c
+++ b/src/lib/libcrypto/ec/ec_pmeth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_pmeth.c,v 1.26 2025/03/13 10:39:51 tb Exp $ */ 1/* $OpenBSD: ec_pmeth.c,v 1.27 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -62,12 +62,12 @@
62 62
63#include <openssl/asn1t.h> 63#include <openssl/asn1t.h>
64#include <openssl/ec.h> 64#include <openssl/ec.h>
65#include <openssl/err.h>
66#include <openssl/evp.h> 65#include <openssl/evp.h>
67#include <openssl/x509.h> 66#include <openssl/x509.h>
68 67
69#include "bn_local.h" 68#include "bn_local.h"
70#include "ec_local.h" 69#include "ec_local.h"
70#include "err_local.h"
71#include "evp_local.h" 71#include "evp_local.h"
72 72
73/* EC pkey context structure */ 73/* EC pkey context structure */
diff --git a/src/lib/libcrypto/ec/eck_prn.c b/src/lib/libcrypto/ec/eck_prn.c
index c40a64966a..ed5fdce9c1 100644
--- a/src/lib/libcrypto/ec/eck_prn.c
+++ b/src/lib/libcrypto/ec/eck_prn.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: eck_prn.c,v 1.41 2025/01/25 10:30:17 tb Exp $ */ 1/* $OpenBSD: eck_prn.c,v 1.42 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Written by Nils Larsch for the OpenSSL project. 3 * Written by Nils Larsch for the OpenSSL project.
4 */ 4 */
@@ -66,12 +66,12 @@
66#include <openssl/bio.h> 66#include <openssl/bio.h>
67#include <openssl/bn.h> 67#include <openssl/bn.h>
68#include <openssl/ec.h> 68#include <openssl/ec.h>
69#include <openssl/err.h>
70#include <openssl/evp.h> 69#include <openssl/evp.h>
71#include <openssl/objects.h> 70#include <openssl/objects.h>
72 71
73#include "bn_local.h" 72#include "bn_local.h"
74#include "ec_local.h" 73#include "ec_local.h"
74#include "err_local.h"
75 75
76int 76int
77EC_KEY_print(BIO *bio, const EC_KEY *ec_key, int off) 77EC_KEY_print(BIO *bio, const EC_KEY *ec_key, int off)
diff --git a/src/lib/libcrypto/ec/ecp_hp_methods.c b/src/lib/libcrypto/ec/ecp_hp_methods.c
new file mode 100644
index 0000000000..0b34a55b9d
--- /dev/null
+++ b/src/lib/libcrypto/ec/ecp_hp_methods.c
@@ -0,0 +1,943 @@
1/* $OpenBSD: ecp_hp_methods.c,v 1.5 2025/08/03 15:44:00 jsing Exp $ */
2/*
3 * Copyright (c) 2024-2025 Joel Sing <jsing@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#include <string.h>
19
20#include <openssl/bn.h>
21#include <openssl/ec.h>
22#include <openssl/err.h>
23
24#include "bn_internal.h"
25#include "crypto_internal.h"
26#include "ec_local.h"
27#include "ec_internal.h"
28#include "err_local.h"
29
30static int
31ec_group_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a,
32 const BIGNUM *b, BN_CTX *ctx)
33{
34 BIGNUM *t;
35 int ret = 0;
36
37 BN_CTX_start(ctx);
38
39 /* XXX - p must be a prime > 3. */
40
41 if (!bn_copy(group->p, p))
42 goto err;
43 if (!bn_copy(group->a, a))
44 goto err;
45 if (!bn_copy(group->b, b))
46 goto err;
47
48 /* XXX */
49 BN_set_negative(group->p, 0);
50
51 /* XXX */
52 if (!BN_nnmod(group->a, group->a, group->p, ctx))
53 goto err;
54 if (!BN_nnmod(group->b, group->b, group->p, ctx))
55 goto err;
56
57 if ((t = BN_CTX_get(ctx)) == NULL)
58 goto err;
59 if (!BN_set_word(t, 3))
60 goto err;
61 if (!BN_mod_add(t, t, a, group->p, ctx))
62 goto err;
63
64 group->a_is_minus3 = BN_is_zero(t);
65
66 if (!ec_field_modulus_from_bn(&group->fm, group->p, ctx))
67 goto err;
68 if (!ec_field_element_from_bn(&group->fm, group, &group->fe_a, group->a, ctx))
69 goto err;
70 if (!ec_field_element_from_bn(&group->fm, group, &group->fe_b, group->b, ctx))
71 goto err;
72
73 ret = 1;
74
75 err:
76 BN_CTX_end(ctx);
77
78 return ret;
79}
80
81static int
82ec_group_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a,
83 BIGNUM *b, BN_CTX *ctx)
84{
85 if (p != NULL) {
86 if (!bn_copy(p, group->p))
87 return 0;
88 }
89 if (a != NULL) {
90 if (!bn_copy(a, group->a))
91 return 0;
92 }
93 if (b != NULL) {
94 if (!bn_copy(b, group->b))
95 return 0;
96 }
97 return 1;
98}
99
100static int
101ec_point_is_at_infinity(const EC_GROUP *group, const EC_POINT *point)
102{
103 /* Check if Z is equal to zero. */
104 return ec_field_element_is_zero(&group->fm, &point->fe_z);
105}
106
107static int
108ec_point_set_to_infinity(const EC_GROUP *group, EC_POINT *point)
109{
110 /* Infinity is (x = 0, y = 1, z = 0). */
111
112 memset(&point->fe_x, 0, sizeof(point->fe_x));
113 memset(&point->fe_y, 0, sizeof(point->fe_y));
114 memset(&point->fe_z, 0, sizeof(point->fe_z));
115
116 point->fe_y.w[0] = 1;
117
118 return 1;
119}
120
121static int
122ec_point_set_affine_coordinates(const EC_GROUP *group, EC_POINT *point,
123 const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx)
124{
125 if (x == NULL || y == NULL) {
126 ECerror(ERR_R_PASSED_NULL_PARAMETER);
127 return 0;
128 }
129
130 if (!bn_copy(point->X, x))
131 return 0;
132 if (!bn_copy(point->Y, y))
133 return 0;
134 if (!BN_one(point->Z))
135 return 0;
136
137 /* XXX */
138 if (!BN_nnmod(point->X, point->X, group->p, ctx))
139 return 0;
140 if (!BN_nnmod(point->Y, point->Y, group->p, ctx))
141 return 0;
142
143 if (!ec_field_element_from_bn(&group->fm, group, &point->fe_x, point->X, ctx))
144 return 0;
145 if (!ec_field_element_from_bn(&group->fm, group, &point->fe_y, point->Y, ctx))
146 return 0;
147 if (!ec_field_element_from_bn(&group->fm, group, &point->fe_z, point->Z, ctx))
148 return 0;
149
150 return 1;
151}
152
153static int
154ec_point_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *point,
155 BIGNUM *x, BIGNUM *y, BN_CTX *ctx)
156{
157 BIGNUM *zinv;
158 int ret = 0;
159
160 /*
161 * Convert homogeneous projective coordinates (XZ, YZ, Z) to affine
162 * coordinates (x = X/Z, y = Y/Z).
163 */
164 if (!ec_field_element_to_bn(&group->fm, &point->fe_x, point->X, ctx))
165 return 0;
166 if (!ec_field_element_to_bn(&group->fm, &point->fe_y, point->Y, ctx))
167 return 0;
168 if (!ec_field_element_to_bn(&group->fm, &point->fe_z, point->Z, ctx))
169 return 0;
170
171 BN_CTX_start(ctx);
172
173 if ((zinv = BN_CTX_get(ctx)) == NULL)
174 goto err;
175
176 if (BN_mod_inverse_ct(zinv, point->Z, group->p, ctx) == NULL)
177 goto err;
178
179 if (x != NULL) {
180 if (!BN_mod_mul(x, point->X, zinv, group->p, ctx))
181 goto err;
182 }
183 if (y != NULL) {
184 if (!BN_mod_mul(y, point->Y, zinv, group->p, ctx))
185 goto err;
186 }
187
188 ret = 1;
189
190 err:
191 BN_CTX_end(ctx);
192
193 return ret;
194}
195
196static int
197ec_point_add_a1(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
198 const EC_POINT *b, BN_CTX *ctx)
199{
200 EC_FIELD_ELEMENT X1, Y1, Z1, X2, Y2, Z2, X3, Y3, Z3;
201 EC_FIELD_ELEMENT b3, t0, t1, t2, t3, t4, t5;
202 EC_FIELD_ELEMENT ga, gb;
203
204 /*
205 * Complete, projective point addition for arbitrary prime order short
206 * Weierstrass curves with arbitrary a - see
207 * https://eprint.iacr.org/2015/1060, algorithm 1 and appendix A.1.
208 */
209
210 ec_field_element_copy(&ga, &group->fe_a);
211 ec_field_element_copy(&gb, &group->fe_b);
212
213 ec_field_element_copy(&X1, &a->fe_x);
214 ec_field_element_copy(&Y1, &a->fe_y);
215 ec_field_element_copy(&Z1, &a->fe_z);
216
217 ec_field_element_copy(&X2, &b->fe_x);
218 ec_field_element_copy(&Y2, &b->fe_y);
219 ec_field_element_copy(&Z2, &b->fe_z);
220
221 /* b3 := 3 * b ; */
222 ec_field_element_add(&group->fm, &b3, &gb, &gb);
223 ec_field_element_add(&group->fm, &b3, &b3, &gb);
224
225 /* t0 := X1 * X2 ; t1 := Y1 * Y2 ; t2 := Z1 * Z2 ; */
226 ec_field_element_mul(&group->fm, &t0, &X1, &X2);
227 ec_field_element_mul(&group->fm, &t1, &Y1, &Y2);
228 ec_field_element_mul(&group->fm, &t2, &Z1, &Z2);
229
230 /* t3 := X1 + Y1 ; t4 := X2 + Y2 ; t3 := t3 * t4 ; */
231 ec_field_element_add(&group->fm, &t3, &X1, &Y1);
232 ec_field_element_add(&group->fm, &t4, &X2, &Y2);
233 ec_field_element_mul(&group->fm, &t3, &t3, &t4);
234
235 /* t4 := t0 + t1 ; t3 := t3 - t4 ; t4 := X1 + Z1 ; */
236 ec_field_element_add(&group->fm, &t4, &t0, &t1);
237 ec_field_element_sub(&group->fm, &t3, &t3, &t4);
238 ec_field_element_add(&group->fm, &t4, &X1, &Z1);
239
240 /* t5 := X2 + Z2 ; t4 := t4 * t5 ; t5 := t0 + t2 ; */
241 ec_field_element_add(&group->fm, &t5, &X2, &Z2);
242 ec_field_element_mul(&group->fm, &t4, &t4, &t5);
243 ec_field_element_add(&group->fm, &t5, &t0, &t2);
244
245 /* t4 := t4 - t5 ; t5 := Y1 + Z1 ; X3 := Y2 + Z2 ; */
246 ec_field_element_sub(&group->fm, &t4, &t4, &t5);
247 ec_field_element_add(&group->fm, &t5, &Y1, &Z1);
248 ec_field_element_add(&group->fm, &X3, &Y2, &Z2);
249
250 /* t5 := t5 * X3 ; X3 := t1 + t2 ; t5 := t5 - X3 ; */
251 ec_field_element_mul(&group->fm, &t5, &t5, &X3);
252 ec_field_element_add(&group->fm, &X3, &t1, &t2);
253 ec_field_element_sub(&group->fm, &t5, &t5, &X3);
254
255 /* Z3 := a * t4 ; X3 := b3 * t2 ; Z3 := X3 + Z3 ; */
256 ec_field_element_mul(&group->fm, &Z3, &ga, &t4);
257 ec_field_element_mul(&group->fm, &X3, &b3, &t2);
258 ec_field_element_add(&group->fm, &Z3, &X3, &Z3);
259
260 /* X3 := t1 - Z3 ; Z3 := t1 + Z3 ; Y3 := X3 * Z3 ; */
261 ec_field_element_sub(&group->fm, &X3, &t1, &Z3);
262 ec_field_element_add(&group->fm, &Z3, &t1, &Z3);
263 ec_field_element_mul(&group->fm, &Y3, &X3, &Z3);
264
265 /* t1 := t0 + t0 ; t1 := t1 + t0 ; t2 := a * t2 ; */
266 ec_field_element_add(&group->fm, &t1, &t0, &t0);
267 ec_field_element_add(&group->fm, &t1, &t1, &t0);
268 ec_field_element_mul(&group->fm, &t2, &ga, &t2);
269
270 /* t4 := b3 * t4 ; t1 := t1 + t2 ; t2 := t0 - t2 ; */
271 ec_field_element_mul(&group->fm, &t4, &b3, &t4);
272 ec_field_element_add(&group->fm, &t1, &t1, &t2);
273 ec_field_element_sub(&group->fm, &t2, &t0, &t2);
274
275 /* t2 := a * t2 ; t4 := t4 + t2 ; t0 := t1 * t4 ; */
276 ec_field_element_mul(&group->fm, &t2, &ga, &t2);
277 ec_field_element_add(&group->fm, &t4, &t4, &t2);
278 ec_field_element_mul(&group->fm, &t0, &t1, &t4);
279
280 /* Y3 := Y3 + t0 ; t0 := t5 * t4 ; X3 := t3 * X3 ; */
281 ec_field_element_add(&group->fm, &Y3, &Y3, &t0);
282 ec_field_element_mul(&group->fm, &t0, &t5, &t4);
283 ec_field_element_mul(&group->fm, &X3, &t3, &X3);
284
285 /* X3 := X3 - t0 ; t0 := t3 * t1 ; Z3 := t5 * Z3 ; */
286 ec_field_element_sub(&group->fm, &X3, &X3, &t0);
287 ec_field_element_mul(&group->fm, &t0, &t3, &t1);
288 ec_field_element_mul(&group->fm, &Z3, &t5, &Z3);
289
290 /* Z3 := Z3 + t0 ; */
291 ec_field_element_add(&group->fm, &Z3, &Z3, &t0);
292
293 ec_field_element_copy(&r->fe_x, &X3);
294 ec_field_element_copy(&r->fe_y, &Y3);
295 ec_field_element_copy(&r->fe_z, &Z3);
296
297 return 1;
298}
299
300static int
301ec_point_add_a2(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
302 const EC_POINT *b, BN_CTX *ctx)
303{
304 EC_FIELD_ELEMENT X1, Y1, Z1, X2, Y2, Z2, X3, Y3, Z3;
305 EC_FIELD_ELEMENT t0, t1, t2, t3, t4;
306 EC_FIELD_ELEMENT gb;
307
308 /*
309 * Complete, projective point addition for arbitrary prime order short
310 * Weierstrass curves with a = -3 - see https://eprint.iacr.org/2015/1060,
311 * algorithm 4 and appendix A.2.
312 */
313
314 ec_field_element_copy(&gb, &group->fe_b);
315
316 ec_field_element_copy(&X1, &a->fe_x);
317 ec_field_element_copy(&Y1, &a->fe_y);
318 ec_field_element_copy(&Z1, &a->fe_z);
319
320 ec_field_element_copy(&X2, &b->fe_x);
321 ec_field_element_copy(&Y2, &b->fe_y);
322 ec_field_element_copy(&Z2, &b->fe_z);
323
324 /* t0 := X1 * X2 ; t1 := Y1 * Y2 ; t2 := Z1 * Z2 ; */
325 ec_field_element_mul(&group->fm, &t0, &X1, &X2);
326 ec_field_element_mul(&group->fm, &t1, &Y1, &Y2);
327 ec_field_element_mul(&group->fm, &t2, &Z1, &Z2);
328
329 /* t3 := X1 + Y1 ; t4 := X2 + Y2 ; t3 := t3 * t4 ; */
330 ec_field_element_add(&group->fm, &t3, &X1, &Y1);
331 ec_field_element_add(&group->fm, &t4, &X2, &Y2);
332 ec_field_element_mul(&group->fm, &t3, &t3, &t4);
333
334 /* t4 := t0 + t1 ; t3 := t3 - t4 ; t4 := Y1 + Z1 ; */
335 ec_field_element_add(&group->fm, &t4, &t0, &t1);
336 ec_field_element_sub(&group->fm, &t3, &t3, &t4);
337 ec_field_element_add(&group->fm, &t4, &Y1, &Z1);
338
339 /* X3 := Y2 + Z2 ; t4 := t4 * X3 ; X3 := t1 + t2 ; */
340 ec_field_element_add(&group->fm, &X3, &Y2, &Z2);
341 ec_field_element_mul(&group->fm, &t4, &t4, &X3);
342 ec_field_element_add(&group->fm, &X3, &t1, &t2);
343
344 /* t4 := t4 - X3 ; X3 := X1 + Z1 ; Y3 := X2 + Z2 ; */
345 ec_field_element_sub(&group->fm, &t4, &t4, &X3);
346 ec_field_element_add(&group->fm, &X3, &X1, &Z1);
347 ec_field_element_add(&group->fm, &Y3, &X2, &Z2);
348
349 /* X3 := X3 * Y3 ; Y3 := t0 + t2 ; Y3 := X3 - Y3 ; */
350 ec_field_element_mul(&group->fm, &X3, &X3, &Y3);
351 ec_field_element_add(&group->fm, &Y3, &t0, &t2);
352 ec_field_element_sub(&group->fm, &Y3, &X3, &Y3);
353
354 /* Z3 := b * t2 ; X3 := Y3 - Z3 ; Z3 := X3 + X3 ; */
355 ec_field_element_mul(&group->fm, &Z3, &gb, &t2);
356 ec_field_element_sub(&group->fm, &X3, &Y3, &Z3);
357 ec_field_element_add(&group->fm, &Z3, &X3, &X3);
358
359 /* X3 := X3 + Z3 ; Z3 := t1 - X3 ; X3 := t1 + X3 ; */
360 ec_field_element_add(&group->fm, &X3, &X3, &Z3);
361 ec_field_element_sub(&group->fm, &Z3, &t1, &X3);
362 ec_field_element_add(&group->fm, &X3, &t1, &X3);
363
364 /* Y3 := b * Y3 ; t1 := t2 + t2 ; t2 := t1 + t2 ; */
365 ec_field_element_mul(&group->fm, &Y3, &gb, &Y3);
366 ec_field_element_add(&group->fm, &t1, &t2, &t2);
367 ec_field_element_add(&group->fm, &t2, &t1, &t2);
368
369 /* Y3 := Y3 - t2 ; Y3 := Y3 - t0 ; t1 := Y3 + Y3 ; */
370 ec_field_element_sub(&group->fm, &Y3, &Y3, &t2);
371 ec_field_element_sub(&group->fm, &Y3, &Y3, &t0);
372 ec_field_element_add(&group->fm, &t1, &Y3, &Y3);
373
374 /* Y3 := t1 + Y3 ; t1 := t0 + t0 ; t0 := t1 + t0 ; */
375 ec_field_element_add(&group->fm, &Y3, &t1, &Y3);
376 ec_field_element_add(&group->fm, &t1, &t0, &t0);
377 ec_field_element_add(&group->fm, &t0, &t1, &t0);
378
379 /* t0 := t0 - t2 ; t1 := t4 * Y3 ; t2 := t0 * Y3 ; */
380 ec_field_element_sub(&group->fm, &t0, &t0, &t2);
381 ec_field_element_mul(&group->fm, &t1, &t4, &Y3);
382 ec_field_element_mul(&group->fm, &t2, &t0, &Y3);
383
384 /* Y3 := X3 * Z3 ; Y3 := Y3 + t2 ; X3 := t3 * X3 ; */
385 ec_field_element_mul(&group->fm, &Y3, &X3, &Z3);
386 ec_field_element_add(&group->fm, &Y3, &Y3, &t2);
387 ec_field_element_mul(&group->fm, &X3, &t3, &X3);
388
389 /* X3 := X3 - t1 ; Z3 := t4 * Z3 ; t1 := t3 * t0 ; */
390 ec_field_element_sub(&group->fm, &X3, &X3, &t1);
391 ec_field_element_mul(&group->fm, &Z3, &t4, &Z3);
392 ec_field_element_mul(&group->fm, &t1, &t3, &t0);
393
394 /* Z3 := Z3 + t1 ; */
395 ec_field_element_add(&group->fm, &Z3, &Z3, &t1);
396
397 ec_field_element_copy(&r->fe_x, &X3);
398 ec_field_element_copy(&r->fe_y, &Y3);
399 ec_field_element_copy(&r->fe_z, &Z3);
400
401 return 1;
402}
403
404static int
405ec_point_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
406 const EC_POINT *b, BN_CTX *ctx)
407{
408 if (group->a_is_minus3)
409 return ec_point_add_a2(group, r, a, b, ctx);
410
411 return ec_point_add_a1(group, r, a, b, ctx);
412}
413
414static int
415ec_point_dbl_a1(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx)
416{
417 EC_FIELD_ELEMENT X1, Y1, Z1, X3, Y3, Z3;
418 EC_FIELD_ELEMENT b3, t0, t1, t2, t3;
419 EC_FIELD_ELEMENT ga, gb;
420
421 /*
422 * Exception-free point doubling for arbitrary prime order short
423 * Weierstrass curves with arbitrary a - see
424 * https://eprint.iacr.org/2015/1060, algorithm 3 and appendix A.1.
425 */
426
427 ec_field_element_copy(&ga, &group->fe_a);
428 ec_field_element_copy(&gb, &group->fe_b);
429
430 ec_field_element_copy(&X1, &a->fe_x);
431 ec_field_element_copy(&Y1, &a->fe_y);
432 ec_field_element_copy(&Z1, &a->fe_z);
433
434 /* b3 := 3 * b ; */
435 ec_field_element_add(&group->fm, &b3, &gb, &gb);
436 ec_field_element_add(&group->fm, &b3, &b3, &gb);
437
438 /* t0 := X^2; t1 := Y^2; t2 := Z^2 ; */
439 ec_field_element_sqr(&group->fm, &t0, &X1);
440 ec_field_element_sqr(&group->fm, &t1, &Y1);
441 ec_field_element_sqr(&group->fm, &t2, &Z1);
442
443 /* t3 := X * Y ; t3 := t3 + t3 ; Z3 := X * Z ; */
444 ec_field_element_mul(&group->fm, &t3, &X1, &Y1);
445 ec_field_element_add(&group->fm, &t3, &t3, &t3);
446 ec_field_element_mul(&group->fm, &Z3, &X1, &Z1);
447
448 /* Z3 := Z3 + Z3 ; X3 := a * Z3 ; Y3 := b3 * t2 ; */
449 ec_field_element_add(&group->fm, &Z3, &Z3, &Z3);
450 ec_field_element_mul(&group->fm, &X3, &ga, &Z3);
451 ec_field_element_mul(&group->fm, &Y3, &b3, &t2);
452
453 /* Y3 := X3 + Y3 ; X3 := t1 - Y3 ; Y3 := t1 + Y3 ; */
454 ec_field_element_add(&group->fm, &Y3, &X3, &Y3);
455 ec_field_element_sub(&group->fm, &X3, &t1, &Y3);
456 ec_field_element_add(&group->fm, &Y3, &t1, &Y3);
457
458 /* Y3 := X3 * Y3 ; X3 := t3 * X3 ; Z3 := b3 * Z3 ; */
459 ec_field_element_mul(&group->fm, &Y3, &X3, &Y3);
460 ec_field_element_mul(&group->fm, &X3, &t3, &X3);
461 ec_field_element_mul(&group->fm, &Z3, &b3, &Z3);
462
463 /* t2 := a * t2 ; t3 := t0 - t2 ; t3 := a * t3 ; */
464 ec_field_element_mul(&group->fm, &t2, &ga, &t2);
465 ec_field_element_sub(&group->fm, &t3, &t0, &t2);
466 ec_field_element_mul(&group->fm, &t3, &ga, &t3);
467
468 /* t3 := t3 + Z3 ; Z3 := t0 + t0 ; t0 := Z3 + t0 ; */
469 ec_field_element_add(&group->fm, &t3, &t3, &Z3);
470 ec_field_element_add(&group->fm, &Z3, &t0, &t0);
471 ec_field_element_add(&group->fm, &t0, &Z3, &t0);
472
473 /* t0 := t0 + t2 ; t0 := t0 * t3 ; Y3 := Y3 + t0 ; */
474 ec_field_element_add(&group->fm, &t0, &t0, &t2);
475 ec_field_element_mul(&group->fm, &t0, &t0, &t3);
476 ec_field_element_add(&group->fm, &Y3, &Y3, &t0);
477
478 /* t2 := Y * Z ; t2 := t2 + t2 ; t0 := t2 * t3 ; */
479 ec_field_element_mul(&group->fm, &t2, &Y1, &Z1);
480 ec_field_element_add(&group->fm, &t2, &t2, &t2);
481 ec_field_element_mul(&group->fm, &t0, &t2, &t3);
482
483 /* X3 := X3 - t0 ; Z3 := t2 * t1 ; Z3 := Z3 + Z3 ; */
484 ec_field_element_sub(&group->fm, &X3, &X3, &t0);
485 ec_field_element_mul(&group->fm, &Z3, &t2, &t1);
486 ec_field_element_add(&group->fm, &Z3, &Z3, &Z3);
487
488 /* Z3 := Z3 + Z3 ; */
489 ec_field_element_add(&group->fm, &Z3, &Z3, &Z3);
490
491 ec_field_element_copy(&r->fe_x, &X3);
492 ec_field_element_copy(&r->fe_y, &Y3);
493 ec_field_element_copy(&r->fe_z, &Z3);
494
495 return 1;
496}
497
498static int
499ec_point_dbl_a2(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx)
500{
501 EC_FIELD_ELEMENT X1, Y1, Z1, X3, Y3, Z3;
502 EC_FIELD_ELEMENT t0, t1, t2, t3;
503 EC_FIELD_ELEMENT ga, gb;
504
505 /*
506 * Exception-free point doubling for arbitrary prime order short
507 * Weierstrass curves with a = -3 - see https://eprint.iacr.org/2015/1060,
508 * algorithm 6 and appendix A.2.
509 */
510
511 ec_field_element_copy(&ga, &group->fe_a);
512 ec_field_element_copy(&gb, &group->fe_b);
513
514 ec_field_element_copy(&X1, &a->fe_x);
515 ec_field_element_copy(&Y1, &a->fe_y);
516 ec_field_element_copy(&Z1, &a->fe_z);
517
518 /* t0 := X^2; t1 := Y^2; t2 := Z^2 ; */
519 ec_field_element_sqr(&group->fm, &t0, &X1);
520 ec_field_element_sqr(&group->fm, &t1, &Y1);
521 ec_field_element_sqr(&group->fm, &t2, &Z1);
522
523 /* t3 := X * Y ; t3 := t3 + t3 ; Z3 := X * Z ; */
524 ec_field_element_mul(&group->fm, &t3, &X1, &Y1);
525 ec_field_element_add(&group->fm, &t3, &t3, &t3);
526 ec_field_element_mul(&group->fm, &Z3, &X1, &Z1);
527
528 /* Z3 := Z3 + Z3 ; Y3 := b * t2 ; Y3 := Y3 - Z3 ; */
529 ec_field_element_add(&group->fm, &Z3, &Z3, &Z3);
530 ec_field_element_mul(&group->fm, &Y3, &gb, &t2);
531 ec_field_element_sub(&group->fm, &Y3, &Y3, &Z3);
532
533 /* X3 := Y3 + Y3 ; Y3 := X3 + Y3 ; X3 := t1 - Y3 ; */
534 ec_field_element_add(&group->fm, &X3, &Y3, &Y3);
535 ec_field_element_add(&group->fm, &Y3, &X3, &Y3);
536 ec_field_element_sub(&group->fm, &X3, &t1, &Y3);
537
538 /* Y3 := t1 + Y3 ; Y3 := X3 * Y3 ; X3 := X3 * t3 ; */
539 ec_field_element_add(&group->fm, &Y3, &t1, &Y3);
540 ec_field_element_mul(&group->fm, &Y3, &X3, &Y3);
541 ec_field_element_mul(&group->fm, &X3, &X3, &t3);
542
543 /* t3 := t2 + t2 ; t2 := t2 + t3 ; Z3 := b * Z3 ; */
544 ec_field_element_add(&group->fm, &t3, &t2, &t2);
545 ec_field_element_add(&group->fm, &t2, &t2, &t3);
546 ec_field_element_mul(&group->fm, &Z3, &gb, &Z3);
547
548 /* Z3 := Z3 - t2 ; Z3 := Z3 - t0 ; t3 := Z3 + Z3 ; */
549 ec_field_element_sub(&group->fm, &Z3, &Z3, &t2);
550 ec_field_element_sub(&group->fm, &Z3, &Z3, &t0);
551 ec_field_element_add(&group->fm, &t3, &Z3, &Z3);
552
553 /* Z3 := Z3 + t3 ; t3 := t0 + t0 ; t0 := t3 + t0 ; */
554 ec_field_element_add(&group->fm, &Z3, &Z3, &t3);
555 ec_field_element_add(&group->fm, &t3, &t0, &t0);
556 ec_field_element_add(&group->fm, &t0, &t3, &t0);
557
558 /* t0 := t0 - t2 ; t0 := t0 * Z3 ; Y3 := Y3 + t0 ; */
559 ec_field_element_sub(&group->fm, &t0, &t0, &t2);
560 ec_field_element_mul(&group->fm, &t0, &t0, &Z3);
561 ec_field_element_add(&group->fm, &Y3, &Y3, &t0);
562
563 /* t0 := Y * Z ; t0 := t0 + t0 ; Z3 := t0 * Z3 ; */
564 ec_field_element_mul(&group->fm, &t0, &Y1, &Z1);
565 ec_field_element_add(&group->fm, &t0, &t0, &t0);
566 ec_field_element_mul(&group->fm, &Z3, &t0, &Z3);
567
568 /* X3 := X3 - Z3 ; Z3 := t0 * t1 ; Z3 := Z3 + Z3 ; */
569 ec_field_element_sub(&group->fm, &X3, &X3, &Z3);
570 ec_field_element_mul(&group->fm, &Z3, &t0, &t1);
571 ec_field_element_add(&group->fm, &Z3, &Z3, &Z3);
572
573 /* Z3 := Z3 + Z3 ; */
574 ec_field_element_add(&group->fm, &Z3, &Z3, &Z3);
575
576 ec_field_element_copy(&r->fe_x, &X3);
577 ec_field_element_copy(&r->fe_y, &Y3);
578 ec_field_element_copy(&r->fe_z, &Z3);
579
580 return 1;
581}
582
583static int
584ec_point_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx)
585{
586 if (group->a_is_minus3)
587 return ec_point_dbl_a2(group, r, a, ctx);
588
589 return ec_point_dbl_a1(group, r, a, ctx);
590}
591
592static int
593ec_point_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx)
594{
595 EC_FIELD_ELEMENT y;
596 BN_ULONG mask;
597 int i;
598
599 /*
600 * Invert the point by setting Y = p - Y, if Y is non-zero and the point
601 * is not at infinity.
602 */
603
604 mask = ~(0 - (ec_point_is_at_infinity(group, point) |
605 ec_field_element_is_zero(&group->fm, &point->fe_y)));
606
607 /* XXX - masked/conditional subtraction? */
608 ec_field_element_sub(&group->fm, &y, &group->fm.m, &point->fe_y);
609
610 for (i = 0; i < group->fm.n; i++)
611 point->fe_y.w[i] = (point->fe_y.w[i] & ~mask) | (y.w[i] & mask);
612
613 return 1;
614}
615
616static int
617ec_point_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx)
618{
619 EC_FIELD_ELEMENT sum, axz2, bz3, x3, y2z, z2;
620
621 /*
622 * Curve is defined by a Weierstrass equation y^2 = x^3 + a*x + b.
623 * The given point is in homogeneous projective coordinates
624 * (x = X/Z, y = Y/Z). Substitute and multiply by Z^3 in order to
625 * evaluate as zy^2 = x^3 + axz^2 + bz^3.
626 */
627
628 ec_field_element_sqr(&group->fm, &z2, &point->fe_z);
629
630 ec_field_element_sqr(&group->fm, &y2z, &point->fe_y);
631 ec_field_element_mul(&group->fm, &y2z, &y2z, &point->fe_z);
632
633 ec_field_element_sqr(&group->fm, &x3, &point->fe_x);
634 ec_field_element_mul(&group->fm, &x3, &x3, &point->fe_x);
635
636 ec_field_element_mul(&group->fm, &axz2, &group->fe_a, &point->fe_x);
637 ec_field_element_mul(&group->fm, &axz2, &axz2, &z2);
638
639 ec_field_element_mul(&group->fm, &bz3, &group->fe_b, &point->fe_z);
640 ec_field_element_mul(&group->fm, &bz3, &bz3, &z2);
641
642 ec_field_element_add(&group->fm, &sum, &x3, &axz2);
643 ec_field_element_add(&group->fm, &sum, &sum, &bz3);
644
645 return ec_field_element_equal(&group->fm, &y2z, &sum) |
646 ec_point_is_at_infinity(group, point);
647}
648
649static int
650ec_point_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx)
651{
652 EC_FIELD_ELEMENT ax, ay, bx, by;
653
654 /*
655 * Compare two points that have homogeneous projection coordinates, that
656 * is (X_a/Z_a, Y_a/Z_a) == (X_b/Z_b, Y_b/Z_b). Return -1 on error, 0 on
657 * equality and 1 on inequality.
658 *
659 * If a and b are both at infinity, Z_a and Z_b will both be zero,
660 * resulting in all values becoming zero, resulting in equality. If a is
661 * at infinity and b is not, then Y_a will be one and Z_b will be
662 * non-zero, hence Y_a * Z_b will be non-zero. Z_a will be zero, hence
663 * Y_b * Z_a will be zero, resulting in inequality. The same applies if
664 * b is at infinity and a is not.
665 */
666
667 ec_field_element_mul(&group->fm, &ax, &a->fe_x, &b->fe_z);
668 ec_field_element_mul(&group->fm, &ay, &a->fe_y, &b->fe_z);
669 ec_field_element_mul(&group->fm, &bx, &b->fe_x, &a->fe_z);
670 ec_field_element_mul(&group->fm, &by, &b->fe_y, &a->fe_z);
671
672 return 1 - (ec_field_element_equal(&group->fm, &ax, &bx) &
673 ec_field_element_equal(&group->fm, &ay, &by));
674}
675
676#if 0
677static int
678ec_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[],
679 BN_CTX *ctx)
680{
681 size_t i;
682
683 /* XXX */
684 for (i = 0; i < num; i++) {
685 if (!EC_POINT_make_affine(group, points[0], ctx))
686 return 0;
687 }
688
689 return 1;
690}
691#else
692
693static int
694ec_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[],
695 BN_CTX *ctx)
696{
697 BIGNUM **prod_Z = NULL;
698 BIGNUM *tmp, *tmp_Z;
699 size_t i;
700 int ret = 0;
701
702 if (num == 0)
703 return 1;
704
705 BN_CTX_start(ctx);
706
707 if ((tmp = BN_CTX_get(ctx)) == NULL)
708 goto err;
709 if ((tmp_Z = BN_CTX_get(ctx)) == NULL)
710 goto err;
711
712 if ((prod_Z = calloc(num, sizeof *prod_Z)) == NULL)
713 goto err;
714 for (i = 0; i < num; i++) {
715 if ((prod_Z[i] = BN_CTX_get(ctx)) == NULL)
716 goto err;
717 }
718
719 if (!BN_is_zero(points[0]->Z)) {
720 if (!bn_copy(prod_Z[0], points[0]->Z))
721 goto err;
722 } else {
723 if (!BN_one(prod_Z[0]))
724 goto err;
725 }
726
727 for (i = 1; i < num; i++) {
728 if (!BN_is_zero(points[i]->Z)) {
729 if (!BN_mod_mul(prod_Z[i], prod_Z[i - 1], points[i]->Z,
730 group->p, ctx))
731 goto err;
732 } else {
733 if (!bn_copy(prod_Z[i], prod_Z[i - 1]))
734 goto err;
735 }
736 }
737
738 if (!BN_mod_inverse_nonct(tmp, prod_Z[num - 1], group->p, ctx)) {
739 ECerror(ERR_R_BN_LIB);
740 goto err;
741 }
742
743 for (i = num - 1; i > 0; i--) {
744 if (BN_is_zero(points[i]->Z))
745 continue;
746
747 if (!BN_mod_mul(tmp_Z, prod_Z[i - 1], tmp, group->p, ctx))
748 goto err;
749 if (!BN_mod_mul(tmp, tmp, points[i]->Z, group->p, ctx))
750 goto err;
751 if (!bn_copy(points[i]->Z, tmp_Z))
752 goto err;
753 }
754
755 for (i = 0; i < num; i++) {
756 EC_POINT *p = points[i];
757
758 if (BN_is_zero(p->Z))
759 continue;
760
761 if (!BN_mod_mul(p->X, p->X, p->Z, group->p, ctx))
762 goto err;
763 if (!BN_mod_mul(p->Y, p->Y, p->Z, group->p, ctx))
764 goto err;
765
766 if (!BN_one(p->Z))
767 goto err;
768 }
769
770 ret = 1;
771
772 err:
773 BN_CTX_end(ctx);
774 free(prod_Z);
775
776 return ret;
777}
778#endif
779
780static void
781ec_point_select(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
782 const EC_POINT *b, int conditional)
783{
784 ec_field_element_select(&group->fm, &r->fe_x, &a->fe_x, &b->fe_x, conditional);
785 ec_field_element_select(&group->fm, &r->fe_y, &a->fe_y, &b->fe_y, conditional);
786 ec_field_element_select(&group->fm, &r->fe_z, &a->fe_z, &b->fe_z, conditional);
787}
788
789static int
790ec_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, const EC_POINT *point,
791 BN_CTX *ctx)
792{
793 BIGNUM *cardinality;
794 EC_POINT *multiples[15];
795 EC_POINT *rr = NULL, *t = NULL;
796 uint8_t *scalar_bytes = NULL;
797 int scalar_len = 0;
798 uint8_t j, wv;
799 int conditional, i;
800 int ret = 0;
801
802 memset(multiples, 0, sizeof(multiples));
803
804 BN_CTX_start(ctx);
805
806 /* XXX - consider blinding. */
807
808 if ((cardinality = BN_CTX_get(ctx)) == NULL)
809 goto err;
810 if (!BN_mul(cardinality, group->order, group->cofactor, ctx))
811 goto err;
812
813 /* XXX - handle scalar > cardinality and/or negative. */
814
815 /* Convert scalar into big endian bytes. */
816 scalar_len = BN_num_bytes(cardinality);
817 if ((scalar_bytes = calloc(1, scalar_len)) == NULL)
818 goto err;
819 if (!BN_bn2binpad(scalar, scalar_bytes, scalar_len))
820 goto err;
821
822 /* Compute multiples of point. */
823 if ((multiples[0] = EC_POINT_dup(point, group)) == NULL)
824 goto err;
825 for (i = 1; i < 15; i += 2) {
826 if ((multiples[i] = EC_POINT_new(group)) == NULL)
827 goto err;
828 if (!EC_POINT_dbl(group, multiples[i], multiples[i / 2], ctx))
829 goto err;
830 if ((multiples[i + 1] = EC_POINT_new(group)) == NULL)
831 goto err;
832 if (!EC_POINT_add(group, multiples[i + 1], multiples[i], point, ctx))
833 goto err;
834 }
835
836 if ((rr = EC_POINT_new(group)) == NULL)
837 goto err;
838 if ((t = EC_POINT_new(group)) == NULL)
839 goto err;
840
841 if (!EC_POINT_set_to_infinity(group, rr))
842 goto err;
843
844 for (i = 0; i < scalar_len; i++) {
845 if (i != 0) {
846 if (!EC_POINT_dbl(group, rr, rr, ctx))
847 goto err;
848 if (!EC_POINT_dbl(group, rr, rr, ctx))
849 goto err;
850 if (!EC_POINT_dbl(group, rr, rr, ctx))
851 goto err;
852 if (!EC_POINT_dbl(group, rr, rr, ctx))
853 goto err;
854 }
855
856 if (!EC_POINT_set_to_infinity(group, t))
857 goto err;
858
859 wv = scalar_bytes[i] >> 4;
860 for (j = 1; j < 16; j++) {
861 conditional = crypto_ct_eq_u8(j, wv);
862 ec_point_select(group, t, t, multiples[j - 1], conditional);
863 }
864 if (!EC_POINT_add(group, rr, rr, t, ctx))
865 goto err;
866
867 if (!EC_POINT_dbl(group, rr, rr, ctx))
868 goto err;
869 if (!EC_POINT_dbl(group, rr, rr, ctx))
870 goto err;
871 if (!EC_POINT_dbl(group, rr, rr, ctx))
872 goto err;
873 if (!EC_POINT_dbl(group, rr, rr, ctx))
874 goto err;
875
876 if (!EC_POINT_set_to_infinity(group, t))
877 goto err;
878
879 wv = scalar_bytes[i] & 0xf;
880 for (j = 1; j < 16; j++) {
881 conditional = crypto_ct_eq_u8(j, wv);
882 ec_point_select(group, t, t, multiples[j - 1], conditional);
883 }
884 if (!EC_POINT_add(group, rr, rr, t, ctx))
885 goto err;
886 }
887
888 if (!EC_POINT_copy(r, rr))
889 goto err;
890
891 ret = 1;
892
893 err:
894 for (i = 0; i < 15; i++)
895 EC_POINT_free(multiples[i]);
896
897 EC_POINT_free(rr);
898 EC_POINT_free(t);
899
900 freezero(scalar_bytes, scalar_len);
901
902 BN_CTX_end(ctx);
903
904 return ret;
905}
906
907static int
908ec_mul_single_ct(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
909 const EC_POINT *point, BN_CTX *ctx)
910{
911 return ec_mul(group, r, scalar, point, ctx);
912}
913
914static int
915ec_mul_double_nonct(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar1,
916 const EC_POINT *point1, const BIGNUM *scalar2, const EC_POINT *point2,
917 BN_CTX *ctx)
918{
919 return ec_wnaf_mul(group, r, scalar1, point1, scalar2, point2, ctx);
920}
921
922static const EC_METHOD ec_GFp_homogeneous_projective_method = {
923 .group_set_curve = ec_group_set_curve,
924 .group_get_curve = ec_group_get_curve,
925 .point_set_to_infinity = ec_point_set_to_infinity,
926 .point_is_at_infinity = ec_point_is_at_infinity,
927 .point_set_affine_coordinates = ec_point_set_affine_coordinates,
928 .point_get_affine_coordinates = ec_point_get_affine_coordinates,
929 .add = ec_point_add,
930 .dbl = ec_point_dbl,
931 .invert = ec_point_invert,
932 .point_is_on_curve = ec_point_is_on_curve,
933 .point_cmp = ec_point_cmp,
934 .points_make_affine = ec_points_make_affine,
935 .mul_single_ct = ec_mul_single_ct,
936 .mul_double_nonct = ec_mul_double_nonct,
937};
938
939const EC_METHOD *
940EC_GFp_homogeneous_projective_method(void)
941{
942 return &ec_GFp_homogeneous_projective_method;
943}
diff --git a/src/lib/libcrypto/ec/ecp_methods.c b/src/lib/libcrypto/ec/ecp_methods.c
index 544c2be4d4..fcb48d9e33 100644
--- a/src/lib/libcrypto/ec/ecp_methods.c
+++ b/src/lib/libcrypto/ec/ecp_methods.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecp_methods.c,v 1.44 2025/03/09 15:33:35 tb Exp $ */ 1/* $OpenBSD: ecp_methods.c,v 1.47 2025/05/24 08:25:58 jsing Exp $ */
2/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> 2/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de>
3 * for the OpenSSL project. 3 * for the OpenSSL project.
4 * Includes code written by Bodo Moeller for the OpenSSL project. 4 * Includes code written by Bodo Moeller for the OpenSSL project.
@@ -66,11 +66,11 @@
66 66
67#include <openssl/bn.h> 67#include <openssl/bn.h>
68#include <openssl/ec.h> 68#include <openssl/ec.h>
69#include <openssl/err.h>
70#include <openssl/objects.h> 69#include <openssl/objects.h>
71 70
72#include "bn_local.h" 71#include "bn_local.h"
73#include "ec_local.h" 72#include "ec_local.h"
73#include "err_local.h"
74 74
75/* 75/*
76 * Most method functions in this file are designed to work with non-trivial 76 * Most method functions in this file are designed to work with non-trivial
@@ -180,6 +180,21 @@ ec_group_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b,
180} 180}
181 181
182static int 182static int
183ec_point_set_to_infinity(const EC_GROUP *group, EC_POINT *point)
184{
185 BN_zero(point->Z);
186 point->Z_is_one = 0;
187
188 return 1;
189}
190
191static int
192ec_point_is_at_infinity(const EC_GROUP *group, const EC_POINT *point)
193{
194 return BN_is_zero(point->Z);
195}
196
197static int
183ec_point_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx) 198ec_point_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx)
184{ 199{
185 BIGNUM *rh, *tmp, *Z4, *Z6; 200 BIGNUM *rh, *tmp, *Z4, *Z6;
@@ -1194,10 +1209,11 @@ ec_mul_single_ct(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
1194} 1209}
1195 1210
1196static int 1211static int
1197ec_mul_double_nonct(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, 1212ec_mul_double_nonct(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar1,
1198 const BIGNUM *p_scalar, const EC_POINT *point, BN_CTX *ctx) 1213 const EC_POINT *point1, const BIGNUM *scalar2, const EC_POINT *point2,
1214 BN_CTX *ctx)
1199{ 1215{
1200 return ec_wnaf_mul(group, r, g_scalar, point, p_scalar, ctx); 1216 return ec_wnaf_mul(group, r, scalar1, point1, scalar2, point2, ctx);
1201} 1217}
1202 1218
1203static int 1219static int
@@ -1280,6 +1296,8 @@ ec_mont_field_decode(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a,
1280static const EC_METHOD ec_GFp_simple_method = { 1296static const EC_METHOD ec_GFp_simple_method = {
1281 .group_set_curve = ec_group_set_curve, 1297 .group_set_curve = ec_group_set_curve,
1282 .group_get_curve = ec_group_get_curve, 1298 .group_get_curve = ec_group_get_curve,
1299 .point_set_to_infinity = ec_point_set_to_infinity,
1300 .point_is_at_infinity = ec_point_is_at_infinity,
1283 .point_is_on_curve = ec_point_is_on_curve, 1301 .point_is_on_curve = ec_point_is_on_curve,
1284 .point_cmp = ec_point_cmp, 1302 .point_cmp = ec_point_cmp,
1285 .point_set_affine_coordinates = ec_point_set_affine_coordinates, 1303 .point_set_affine_coordinates = ec_point_set_affine_coordinates,
@@ -1303,6 +1321,8 @@ EC_GFp_simple_method(void)
1303static const EC_METHOD ec_GFp_mont_method = { 1321static const EC_METHOD ec_GFp_mont_method = {
1304 .group_set_curve = ec_mont_group_set_curve, 1322 .group_set_curve = ec_mont_group_set_curve,
1305 .group_get_curve = ec_group_get_curve, 1323 .group_get_curve = ec_group_get_curve,
1324 .point_set_to_infinity = ec_point_set_to_infinity,
1325 .point_is_at_infinity = ec_point_is_at_infinity,
1306 .point_is_on_curve = ec_point_is_on_curve, 1326 .point_is_on_curve = ec_point_is_on_curve,
1307 .point_cmp = ec_point_cmp, 1327 .point_cmp = ec_point_cmp,
1308 .point_set_affine_coordinates = ec_point_set_affine_coordinates, 1328 .point_set_affine_coordinates = ec_point_set_affine_coordinates,
diff --git a/src/lib/libcrypto/ec/ecx_methods.c b/src/lib/libcrypto/ec/ecx_methods.c
index 6b5759d4fa..b08456d03b 100644
--- a/src/lib/libcrypto/ec/ecx_methods.c
+++ b/src/lib/libcrypto/ec/ecx_methods.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecx_methods.c,v 1.14 2024/08/28 07:15:04 tb Exp $ */ 1/* $OpenBSD: ecx_methods.c,v 1.15 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2022 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2022 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -20,13 +20,13 @@
20#include <openssl/cms.h> 20#include <openssl/cms.h>
21#include <openssl/curve25519.h> 21#include <openssl/curve25519.h>
22#include <openssl/ec.h> 22#include <openssl/ec.h>
23#include <openssl/err.h>
24#include <openssl/evp.h> 23#include <openssl/evp.h>
25#include <openssl/x509.h> 24#include <openssl/x509.h>
26 25
27#include "asn1_local.h" 26#include "asn1_local.h"
28#include "bytestring.h" 27#include "bytestring.h"
29#include "curve25519_internal.h" 28#include "curve25519_internal.h"
29#include "err_local.h"
30#include "evp_local.h" 30#include "evp_local.h"
31#include "x509_local.h" 31#include "x509_local.h"
32 32
diff --git a/src/lib/libcrypto/ecdh/ecdh.c b/src/lib/libcrypto/ecdh/ecdh.c
index dbb91f1991..c3affed682 100644
--- a/src/lib/libcrypto/ecdh/ecdh.c
+++ b/src/lib/libcrypto/ecdh/ecdh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecdh.c,v 1.11 2025/02/17 09:25:45 tb Exp $ */ 1/* $OpenBSD: ecdh.c,v 1.12 2025/05/10 05:54:38 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. 3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
4 * 4 *
@@ -73,10 +73,10 @@
73 73
74#include <openssl/bn.h> 74#include <openssl/bn.h>
75#include <openssl/ec.h> 75#include <openssl/ec.h>
76#include <openssl/err.h>
77#include <openssl/evp.h> 76#include <openssl/evp.h>
78 77
79#include "ec_local.h" 78#include "ec_local.h"
79#include "err_local.h"
80 80
81/* 81/*
82 * Key derivation function from X9.63/SECG. 82 * Key derivation function from X9.63/SECG.
diff --git a/src/lib/libcrypto/ecdsa/ecdsa.c b/src/lib/libcrypto/ecdsa/ecdsa.c
index 5abc3586e3..4e00eb5ec8 100644
--- a/src/lib/libcrypto/ecdsa/ecdsa.c
+++ b/src/lib/libcrypto/ecdsa/ecdsa.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecdsa.c,v 1.19 2024/04/15 15:49:37 tb Exp $ */ 1/* $OpenBSD: ecdsa.c,v 1.20 2025/05/10 05:54:38 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2000-2002 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2000-2002 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -61,11 +61,11 @@
61#include <openssl/asn1t.h> 61#include <openssl/asn1t.h>
62#include <openssl/bn.h> 62#include <openssl/bn.h>
63#include <openssl/ec.h> 63#include <openssl/ec.h>
64#include <openssl/err.h>
65 64
66#include "bn_local.h" 65#include "bn_local.h"
67#include "ec_local.h" 66#include "ec_local.h"
68#include "ecdsa_local.h" 67#include "ecdsa_local.h"
68#include "err_local.h"
69 69
70static const ASN1_TEMPLATE ECDSA_SIG_seq_tt[] = { 70static const ASN1_TEMPLATE ECDSA_SIG_seq_tt[] = {
71 { 71 {
diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c
index 25fbb03875..a60769fc2a 100644
--- a/src/lib/libcrypto/err/err.c
+++ b/src/lib/libcrypto/err/err.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: err.c,v 1.75 2024/11/02 12:46:36 tb Exp $ */ 1/* $OpenBSD: err.c,v 1.78 2025/06/10 08:53:37 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -484,33 +484,27 @@ err_build_SYS_str_reasons(void)
484{ 484{
485 /* malloc cannot be used here, use static storage instead */ 485 /* malloc cannot be used here, use static storage instead */
486 static char strerror_tab[NUM_SYS_STR_REASONS][LEN_SYS_STR_REASON]; 486 static char strerror_tab[NUM_SYS_STR_REASONS][LEN_SYS_STR_REASON];
487 const char *errstr;
487 int save_errno; 488 int save_errno;
488 int i; 489 int i;
489 490
490 /* strerror(3) will set errno to EINVAL when i is an unknown errno. */ 491 /* strerror(3) will set errno to EINVAL when i is an unknown errno. */
491 save_errno = errno; 492 save_errno = errno;
492 for (i = 1; i <= NUM_SYS_STR_REASONS; i++) { 493 for (i = 0; i < NUM_SYS_STR_REASONS; i++) {
493 ERR_STRING_DATA *str = &SYS_str_reasons[i - 1]; 494 ERR_STRING_DATA *str = &SYS_str_reasons[i];
494 495
495 str->error = (unsigned long)i; 496 str->error = i + 1;
496 if (str->string == NULL) { 497 str->string = "unknown";
497 char (*dest)[LEN_SYS_STR_REASON] = 498
498 &(strerror_tab[i - 1]); 499 if ((errstr = strerror((int)str->error)) != NULL) {
499 const char *src = strerror(i); 500 strlcpy(strerror_tab[i], errstr, sizeof(strerror_tab[i]));
500 if (src != NULL) { 501 str->string = strerror_tab[i];
501 strlcpy(*dest, src, sizeof *dest);
502 str->string = *dest;
503 }
504 } 502 }
505 if (str->string == NULL)
506 str->string = "unknown";
507 } 503 }
508 errno = save_errno; 504 errno = save_errno;
509 505
510 /* 506 SYS_str_reasons[NUM_SYS_STR_REASONS].error = 0;
511 * Now we still have SYS_str_reasons[NUM_SYS_STR_REASONS] = {0, NULL}, 507 SYS_str_reasons[NUM_SYS_STR_REASONS].string = NULL;
512 * as required by ERR_load_strings.
513 */
514} 508}
515#endif 509#endif
516 510
@@ -830,7 +824,7 @@ err_clear_last_constant_time(int clear)
830 824
831 es = ERR_get_state(); 825 es = ERR_get_state();
832 if (es == NULL) 826 if (es == NULL)
833 return; 827 return;
834 828
835 top = es->top; 829 top = es->top;
836 830
diff --git a/src/lib/libcrypto/err/err.h b/src/lib/libcrypto/err/err.h
index fe6c34dd0a..093db4316e 100644
--- a/src/lib/libcrypto/err/err.h
+++ b/src/lib/libcrypto/err/err.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: err.h,v 1.36 2025/03/09 15:12:18 tb Exp $ */ 1/* $OpenBSD: err.h,v 1.38 2025/05/10 06:17:09 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -192,80 +192,9 @@ extern "C" {
192#define ERR_LIB_USER 128 192#define ERR_LIB_USER 128
193 193
194#ifndef LIBRESSL_INTERNAL 194#ifndef LIBRESSL_INTERNAL
195#define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) 195#define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
196#define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),OPENSSL_FILE,OPENSSL_LINE) 196#define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
197#define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) 197#define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
198#define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
199#define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
200#define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
201#define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
202#define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
203#define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
204#define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
205#define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
206#define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
207#define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
208#define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
209#define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
210#define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
211#define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
212#define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
213#define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
214#define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
215#define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
216#define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
217#define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
218#define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
219#define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
220#define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
221#define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
222#define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
223#define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
224#define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
225#define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
226#define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
227#define GOSTerr(f,r) ERR_PUT_error(ERR_LIB_GOST,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
228#define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
229#define CTerr(f, r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
230#define KDFerr(f, r) ERR_PUT_error(ERR_LIB_KDF,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
231#endif
232
233#ifdef LIBRESSL_INTERNAL
234#define SYSerror(r) ERR_PUT_error(ERR_LIB_SYS,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
235#define BNerror(r) ERR_PUT_error(ERR_LIB_BN,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
236#define RSAerror(r) ERR_PUT_error(ERR_LIB_RSA,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
237#define DHerror(r) ERR_PUT_error(ERR_LIB_DH,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
238#define EVPerror(r) ERR_PUT_error(ERR_LIB_EVP,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
239#define BUFerror(r) ERR_PUT_error(ERR_LIB_BUF,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
240#define OBJerror(r) ERR_PUT_error(ERR_LIB_OBJ,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
241#define PEMerror(r) ERR_PUT_error(ERR_LIB_PEM,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
242#define DSAerror(r) ERR_PUT_error(ERR_LIB_DSA,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
243#define X509error(r) ERR_PUT_error(ERR_LIB_X509,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
244#define ASN1error(r) ERR_PUT_error(ERR_LIB_ASN1,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
245#define CONFerror(r) ERR_PUT_error(ERR_LIB_CONF,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
246#define CRYPTOerror(r) ERR_PUT_error(ERR_LIB_CRYPTO,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
247#define ECerror(r) ERR_PUT_error(ERR_LIB_EC,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
248#define BIOerror(r) ERR_PUT_error(ERR_LIB_BIO,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
249#define PKCS7error(r) ERR_PUT_error(ERR_LIB_PKCS7,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
250#define X509V3error(r) ERR_PUT_error(ERR_LIB_X509V3,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
251#define PKCS12error(r) ERR_PUT_error(ERR_LIB_PKCS12,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
252#define RANDerror(r) ERR_PUT_error(ERR_LIB_RAND,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
253#define DSOerror(r) ERR_PUT_error(ERR_LIB_DSO,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
254#define ENGINEerror(r) ERR_PUT_error(ERR_LIB_ENGINE,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
255#define OCSPerror(r) ERR_PUT_error(ERR_LIB_OCSP,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
256#define UIerror(r) ERR_PUT_error(ERR_LIB_UI,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
257#define COMPerror(r) ERR_PUT_error(ERR_LIB_COMP,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
258#define ECDSAerror(r) ERR_PUT_error(ERR_LIB_ECDSA,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
259#define ECDHerror(r) ERR_PUT_error(ERR_LIB_ECDH,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
260#define STOREerror(r) ERR_PUT_error(ERR_LIB_STORE,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
261#define FIPSerror(r) ERR_PUT_error(ERR_LIB_FIPS,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
262#define CMSerror(r) ERR_PUT_error(ERR_LIB_CMS,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
263#define TSerror(r) ERR_PUT_error(ERR_LIB_TS,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
264#define HMACerror(r) ERR_PUT_error(ERR_LIB_HMAC,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
265#define JPAKEerror(r) ERR_PUT_error(ERR_LIB_JPAKE,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
266#define GOSTerror(r) ERR_PUT_error(ERR_LIB_GOST,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
267#define CTerror(r) ERR_PUT_error(ERR_LIB_CT,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
268#define KDFerror(r) ERR_PUT_error(ERR_LIB_KDF,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
269#endif 198#endif
270 199
271#define ERR_PACK(l,f,r) (((((unsigned long)l)&0xffL)<<24L)| \ 200#define ERR_PACK(l,f,r) (((((unsigned long)l)&0xffL)<<24L)| \
diff --git a/src/lib/libcrypto/err/err_local.h b/src/lib/libcrypto/err/err_local.h
index d091b979cc..87cd40f4a8 100644
--- a/src/lib/libcrypto/err/err_local.h
+++ b/src/lib/libcrypto/err/err_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: err_local.h,v 1.1 2024/06/24 06:43:22 tb Exp $ */ 1/* $OpenBSD: err_local.h,v 1.5 2025/05/10 06:45:46 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -118,6 +118,34 @@ __BEGIN_HIDDEN_DECLS
118 118
119void ERR_load_const_strings(const ERR_STRING_DATA *str); 119void ERR_load_const_strings(const ERR_STRING_DATA *str);
120 120
121#define ERR_PUT_ERROR(l, r) ERR_PUT_error((l), 0xfff, (r), OPENSSL_FILE, OPENSSL_LINE)
122
123#define ASN1error(r) ERR_PUT_ERROR(ERR_LIB_ASN1, (r))
124#define BIOerror(r) ERR_PUT_ERROR(ERR_LIB_BIO, (r))
125#define BNerror(r) ERR_PUT_ERROR(ERR_LIB_BN, (r))
126#define BUFerror(r) ERR_PUT_ERROR(ERR_LIB_BUF, (r))
127#define CMSerror(r) ERR_PUT_ERROR(ERR_LIB_CMS, (r))
128#define CONFerror(r) ERR_PUT_ERROR(ERR_LIB_CONF, (r))
129#define CRYPTOerror(r) ERR_PUT_ERROR(ERR_LIB_CRYPTO, (r))
130#define CTerror(r) ERR_PUT_ERROR(ERR_LIB_CT, (r))
131#define DHerror(r) ERR_PUT_ERROR(ERR_LIB_DH, (r))
132#define DSAerror(r) ERR_PUT_ERROR(ERR_LIB_DSA, (r))
133#define ECerror(r) ERR_PUT_ERROR(ERR_LIB_EC, (r))
134#define EVPerror(r) ERR_PUT_ERROR(ERR_LIB_EVP, (r))
135#define KDFerror(r) ERR_PUT_ERROR(ERR_LIB_KDF, (r))
136#define OBJerror(r) ERR_PUT_ERROR(ERR_LIB_OBJ, (r))
137#define OCSPerror(r) ERR_PUT_ERROR(ERR_LIB_OCSP, (r))
138#define PEMerror(r) ERR_PUT_ERROR(ERR_LIB_PEM, (r))
139#define PKCS12error(r) ERR_PUT_ERROR(ERR_LIB_PKCS12, (r))
140#define PKCS7error(r) ERR_PUT_ERROR(ERR_LIB_PKCS7, (r))
141#define RANDerror(r) ERR_PUT_ERROR(ERR_LIB_RAND, (r))
142#define RSAerror(r) ERR_PUT_ERROR(ERR_LIB_RSA, (r))
143#define SYSerror(r) ERR_PUT_ERROR(ERR_LIB_SYS, (r))
144#define TSerror(r) ERR_PUT_ERROR(ERR_LIB_TS, (r))
145#define UIerror(r) ERR_PUT_ERROR(ERR_LIB_UI, (r))
146#define X509V3error(r) ERR_PUT_ERROR(ERR_LIB_X509V3, (r))
147#define X509error(r) ERR_PUT_ERROR(ERR_LIB_X509, (r))
148
121__END_HIDDEN_DECLS 149__END_HIDDEN_DECLS
122 150
123#endif /* HEADER_ERR_LOCAL_H */ 151#endif /* HEADER_ERR_LOCAL_H */
diff --git a/src/lib/libcrypto/evp/e_aes.c b/src/lib/libcrypto/evp/e_aes.c
index 7753c18c15..e1ae1e9a5b 100644
--- a/src/lib/libcrypto/evp/e_aes.c
+++ b/src/lib/libcrypto/evp/e_aes.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_aes.c,v 1.59 2024/09/06 09:57:32 tb Exp $ */ 1/* $OpenBSD: e_aes.c,v 1.83 2025/07/22 09:31:09 jsing Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -59,19 +59,15 @@
59 59
60#ifndef OPENSSL_NO_AES 60#ifndef OPENSSL_NO_AES
61#include <openssl/aes.h> 61#include <openssl/aes.h>
62#include <openssl/err.h>
63#include <openssl/evp.h> 62#include <openssl/evp.h>
64 63
64#include "aes_local.h"
65#include "err_local.h"
65#include "evp_local.h" 66#include "evp_local.h"
66#include "modes_local.h" 67#include "modes_local.h"
67 68
68typedef struct { 69typedef struct {
69 AES_KEY ks; 70 AES_KEY ks;
70 block128_f block;
71 union {
72 cbc128_f cbc;
73 ctr128_f ctr;
74 } stream;
75} EVP_AES_KEY; 71} EVP_AES_KEY;
76 72
77typedef struct { 73typedef struct {
@@ -84,15 +80,11 @@ typedef struct {
84 int taglen; 80 int taglen;
85 int iv_gen; /* It is OK to generate IVs */ 81 int iv_gen; /* It is OK to generate IVs */
86 int tls_aad_len; /* TLS AAD length */ 82 int tls_aad_len; /* TLS AAD length */
87 ctr128_f ctr;
88} EVP_AES_GCM_CTX; 83} EVP_AES_GCM_CTX;
89 84
90typedef struct { 85typedef struct {
91 AES_KEY ks1, ks2; /* AES key schedules to use */ 86 AES_KEY ks1, ks2; /* AES key schedules to use */
92 XTS128_CONTEXT xts; 87 XTS128_CONTEXT xts; /* XXX - replace with flags. */
93 void (*stream)(const unsigned char *in, unsigned char *out,
94 size_t length, const AES_KEY *key1, const AES_KEY *key2,
95 const unsigned char iv[16]);
96} EVP_AES_XTS_CTX; 88} EVP_AES_XTS_CTX;
97 89
98typedef struct { 90typedef struct {
@@ -103,131 +95,17 @@ typedef struct {
103 int len_set; /* Set if message length set */ 95 int len_set; /* Set if message length set */
104 int L, M; /* L and M parameters from RFC3610 */ 96 int L, M; /* L and M parameters from RFC3610 */
105 CCM128_CONTEXT ccm; 97 CCM128_CONTEXT ccm;
106 ccm128_f str;
107} EVP_AES_CCM_CTX; 98} EVP_AES_CCM_CTX;
108 99
109#define MAXBITCHUNK ((size_t)1<<(sizeof(size_t)*8-4)) 100#define MAXBITCHUNK ((size_t)1<<(sizeof(size_t)*8-4))
110 101
111#ifdef VPAES_ASM
112int vpaes_set_encrypt_key(const unsigned char *userKey, int bits,
113 AES_KEY *key);
114int vpaes_set_decrypt_key(const unsigned char *userKey, int bits,
115 AES_KEY *key);
116
117void vpaes_encrypt(const unsigned char *in, unsigned char *out,
118 const AES_KEY *key);
119void vpaes_decrypt(const unsigned char *in, unsigned char *out,
120 const AES_KEY *key);
121
122void vpaes_cbc_encrypt(const unsigned char *in, unsigned char *out,
123 size_t length, const AES_KEY *key, unsigned char *ivec, int enc);
124#endif
125#ifdef BSAES_ASM
126void bsaes_cbc_encrypt(const unsigned char *in, unsigned char *out,
127 size_t length, const AES_KEY *key, unsigned char ivec[16], int enc);
128void bsaes_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out,
129 size_t len, const AES_KEY *key, const unsigned char ivec[16]);
130void bsaes_xts_encrypt(const unsigned char *inp, unsigned char *out,
131 size_t len, const AES_KEY *key1, const AES_KEY *key2,
132 const unsigned char iv[16]);
133void bsaes_xts_decrypt(const unsigned char *inp, unsigned char *out,
134 size_t len, const AES_KEY *key1, const AES_KEY *key2,
135 const unsigned char iv[16]);
136#endif
137#ifdef AES_CTR_ASM
138void AES_ctr32_encrypt(const unsigned char *in, unsigned char *out,
139 size_t blocks, const AES_KEY *key,
140 const unsigned char ivec[AES_BLOCK_SIZE]);
141#endif
142#ifdef AES_XTS_ASM
143void AES_xts_encrypt(const char *inp, char *out, size_t len,
144 const AES_KEY *key1, const AES_KEY *key2, const unsigned char iv[16]);
145void AES_xts_decrypt(const char *inp, char *out, size_t len,
146 const AES_KEY *key1, const AES_KEY *key2, const unsigned char iv[16]);
147#endif
148
149#if defined(AES_ASM) && ( \
150 ((defined(__i386) || defined(__i386__) || \
151 defined(_M_IX86)) && defined(OPENSSL_IA32_SSE2))|| \
152 defined(__x86_64) || defined(__x86_64__) || \
153 defined(_M_AMD64) || defined(_M_X64) || \
154 defined(__INTEL__) )
155
156#include "x86_arch.h"
157
158#ifdef VPAES_ASM
159#define VPAES_CAPABLE (crypto_cpu_caps_ia32() & CPUCAP_MASK_SSSE3)
160#endif
161#ifdef BSAES_ASM
162#define BSAES_CAPABLE VPAES_CAPABLE
163#endif
164/*
165 * AES-NI section
166 */
167#define AESNI_CAPABLE (crypto_cpu_caps_ia32() & CPUCAP_MASK_AESNI)
168
169int aesni_set_encrypt_key(const unsigned char *userKey, int bits,
170 AES_KEY *key);
171int aesni_set_decrypt_key(const unsigned char *userKey, int bits,
172 AES_KEY *key);
173
174void aesni_encrypt(const unsigned char *in, unsigned char *out,
175 const AES_KEY *key);
176void aesni_decrypt(const unsigned char *in, unsigned char *out,
177 const AES_KEY *key);
178
179void aesni_ecb_encrypt(const unsigned char *in, unsigned char *out,
180 size_t length, const AES_KEY *key, int enc);
181void aesni_cbc_encrypt(const unsigned char *in, unsigned char *out,
182 size_t length, const AES_KEY *key, unsigned char *ivec, int enc);
183
184void aesni_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out,
185 size_t blocks, const void *key, const unsigned char *ivec);
186
187void aesni_xts_encrypt(const unsigned char *in, unsigned char *out,
188 size_t length, const AES_KEY *key1, const AES_KEY *key2,
189 const unsigned char iv[16]);
190
191void aesni_xts_decrypt(const unsigned char *in, unsigned char *out,
192 size_t length, const AES_KEY *key1, const AES_KEY *key2,
193 const unsigned char iv[16]);
194
195void aesni_ccm64_encrypt_blocks (const unsigned char *in, unsigned char *out,
196 size_t blocks, const void *key, const unsigned char ivec[16],
197 unsigned char cmac[16]);
198
199void aesni_ccm64_decrypt_blocks (const unsigned char *in, unsigned char *out,
200 size_t blocks, const void *key, const unsigned char ivec[16],
201 unsigned char cmac[16]);
202
203static int 102static int
204aesni_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 103aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
205 const unsigned char *iv, int enc) 104 const unsigned char *iv, int enc)
206{ 105{
207 int ret, mode; 106 EVP_AES_KEY *eak = ctx->cipher_data;
208 EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data;
209
210 mode = ctx->cipher->flags & EVP_CIPH_MODE;
211 if ((mode == EVP_CIPH_ECB_MODE || mode == EVP_CIPH_CBC_MODE) &&
212 !enc) {
213 ret = aesni_set_decrypt_key(key, ctx->key_len * 8,
214 ctx->cipher_data);
215 dat->block = (block128_f)aesni_decrypt;
216 dat->stream.cbc = mode == EVP_CIPH_CBC_MODE ?
217 (cbc128_f)aesni_cbc_encrypt : NULL;
218 } else {
219 ret = aesni_set_encrypt_key(key, ctx->key_len * 8,
220 ctx->cipher_data);
221 dat->block = (block128_f)aesni_encrypt;
222 if (mode == EVP_CIPH_CBC_MODE)
223 dat->stream.cbc = (cbc128_f)aesni_cbc_encrypt;
224 else if (mode == EVP_CIPH_CTR_MODE)
225 dat->stream.ctr = (ctr128_f)aesni_ctr32_encrypt_blocks;
226 else
227 dat->stream.cbc = NULL;
228 }
229 107
230 if (ret < 0) { 108 if (AES_set_encrypt_key(key, ctx->key_len * 8, &eak->ks) < 0) {
231 EVPerror(EVP_R_AES_KEY_SETUP_FAILED); 109 EVPerror(EVP_R_AES_KEY_SETUP_FAILED);
232 return 0; 110 return 0;
233 } 111 }
@@ -236,213 +114,54 @@ aesni_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
236} 114}
237 115
238static int 116static int
239aesni_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 117aes_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
240 const unsigned char *in, size_t len) 118 const unsigned char *iv, int encrypt)
241{
242 aesni_cbc_encrypt(in, out, len, ctx->cipher_data, ctx->iv,
243 ctx->encrypt);
244
245 return 1;
246}
247
248static int
249aesni_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
250 const unsigned char *in, size_t len)
251{ 119{
252 size_t bl = ctx->cipher->block_size; 120 EVP_AES_KEY *eak = ctx->cipher_data;
253 121
254 if (len < bl) 122 if (encrypt) {
255 return 1; 123 if (AES_set_encrypt_key(key, ctx->key_len * 8, &eak->ks) < 0) {
256 124 EVPerror(EVP_R_AES_KEY_SETUP_FAILED);
257 aesni_ecb_encrypt(in, out, len, ctx->cipher_data, ctx->encrypt); 125 return 0;
258
259 return 1;
260}
261
262static int
263aesni_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
264 const unsigned char *iv, int enc)
265{
266 EVP_AES_GCM_CTX *gctx = ctx->cipher_data;
267
268 if (!iv && !key)
269 return 1;
270 if (key) {
271 aesni_set_encrypt_key(key, ctx->key_len * 8, &gctx->ks);
272 CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks,
273 (block128_f)aesni_encrypt);
274 gctx->ctr = (ctr128_f)aesni_ctr32_encrypt_blocks;
275 /* If we have an iv can set it directly, otherwise use
276 * saved IV.
277 */
278 if (iv == NULL && gctx->iv_set)
279 iv = gctx->iv;
280 if (iv) {
281 CRYPTO_gcm128_setiv(&gctx->gcm, iv, gctx->ivlen);
282 gctx->iv_set = 1;
283 } 126 }
284 gctx->key_set = 1;
285 } else { 127 } else {
286 /* If key set use IV, otherwise copy */ 128 if (AES_set_decrypt_key(key, ctx->key_len * 8, &eak->ks) < 0) {
287 if (gctx->key_set) 129 EVPerror(EVP_R_AES_KEY_SETUP_FAILED);
288 CRYPTO_gcm128_setiv(&gctx->gcm, iv, gctx->ivlen); 130 return 0;
289 else
290 memcpy(gctx->iv, iv, gctx->ivlen);
291 gctx->iv_set = 1;
292 gctx->iv_gen = 0;
293 }
294 return 1;
295}
296
297static int
298aesni_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
299 const unsigned char *iv, int enc)
300{
301 EVP_AES_XTS_CTX *xctx = ctx->cipher_data;
302
303 if (!iv && !key)
304 return 1;
305
306 if (key) {
307 /* key_len is two AES keys */
308 if (enc) {
309 aesni_set_encrypt_key(key, ctx->key_len * 4,
310 &xctx->ks1);
311 xctx->xts.block1 = (block128_f)aesni_encrypt;
312 xctx->stream = aesni_xts_encrypt;
313 } else {
314 aesni_set_decrypt_key(key, ctx->key_len * 4,
315 &xctx->ks1);
316 xctx->xts.block1 = (block128_f)aesni_decrypt;
317 xctx->stream = aesni_xts_decrypt;
318 } 131 }
319
320 aesni_set_encrypt_key(key + ctx->key_len / 2,
321 ctx->key_len * 4, &xctx->ks2);
322 xctx->xts.block2 = (block128_f)aesni_encrypt;
323
324 xctx->xts.key1 = &xctx->ks1;
325 }
326
327 if (iv) {
328 xctx->xts.key2 = &xctx->ks2;
329 memcpy(ctx->iv, iv, 16);
330 } 132 }
331 133
332 return 1; 134 return 1;
333} 135}
334 136
335static int 137static int
336aesni_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 138aes_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
337 const unsigned char *iv, int enc) 139 const unsigned char *in, size_t len)
338{
339 EVP_AES_CCM_CTX *cctx = ctx->cipher_data;
340
341 if (!iv && !key)
342 return 1;
343 if (key) {
344 aesni_set_encrypt_key(key, ctx->key_len * 8, &cctx->ks);
345 CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L,
346 &cctx->ks, (block128_f)aesni_encrypt);
347 cctx->str = enc ? (ccm128_f)aesni_ccm64_encrypt_blocks :
348 (ccm128_f)aesni_ccm64_decrypt_blocks;
349 cctx->key_set = 1;
350 }
351 if (iv) {
352 memcpy(ctx->iv, iv, 15 - cctx->L);
353 cctx->iv_set = 1;
354 }
355 return 1;
356}
357
358#endif
359
360static int
361aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
362 const unsigned char *iv, int enc)
363{ 140{
364 int ret, mode; 141 EVP_AES_KEY *eak = ctx->cipher_data;
365 EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data;
366
367 mode = ctx->cipher->flags & EVP_CIPH_MODE;
368 if ((mode == EVP_CIPH_ECB_MODE || mode == EVP_CIPH_CBC_MODE) &&
369 !enc)
370#ifdef BSAES_CAPABLE
371 if (BSAES_CAPABLE && mode == EVP_CIPH_CBC_MODE) {
372 ret = AES_set_decrypt_key(key, ctx->key_len * 8,
373 &dat->ks);
374 dat->block = (block128_f)AES_decrypt;
375 dat->stream.cbc = (cbc128_f)bsaes_cbc_encrypt;
376 } else
377#endif
378#ifdef VPAES_CAPABLE
379 if (VPAES_CAPABLE) {
380 ret = vpaes_set_decrypt_key(key, ctx->key_len * 8,
381 &dat->ks);
382 dat->block = (block128_f)vpaes_decrypt;
383 dat->stream.cbc = mode == EVP_CIPH_CBC_MODE ?
384 (cbc128_f)vpaes_cbc_encrypt : NULL;
385 } else
386#endif
387 {
388 ret = AES_set_decrypt_key(key, ctx->key_len * 8,
389 &dat->ks);
390 dat->block = (block128_f)AES_decrypt;
391 dat->stream.cbc = mode == EVP_CIPH_CBC_MODE ?
392 (cbc128_f)AES_cbc_encrypt : NULL;
393 } else
394#ifdef BSAES_CAPABLE
395 if (BSAES_CAPABLE && mode == EVP_CIPH_CTR_MODE) {
396 ret = AES_set_encrypt_key(key, ctx->key_len * 8,
397 &dat->ks);
398 dat->block = (block128_f)AES_encrypt;
399 dat->stream.ctr = (ctr128_f)bsaes_ctr32_encrypt_blocks;
400 } else
401#endif
402#ifdef VPAES_CAPABLE
403 if (VPAES_CAPABLE) {
404 ret = vpaes_set_encrypt_key(key, ctx->key_len * 8,
405 &dat->ks);
406 dat->block = (block128_f)vpaes_encrypt;
407 dat->stream.cbc = mode == EVP_CIPH_CBC_MODE ?
408 (cbc128_f)vpaes_cbc_encrypt : NULL;
409 } else
410#endif
411 {
412 ret = AES_set_encrypt_key(key, ctx->key_len * 8,
413 &dat->ks);
414 dat->block = (block128_f)AES_encrypt;
415 dat->stream.cbc = mode == EVP_CIPH_CBC_MODE ?
416 (cbc128_f)AES_cbc_encrypt : NULL;
417#ifdef AES_CTR_ASM
418 if (mode == EVP_CIPH_CTR_MODE)
419 dat->stream.ctr = (ctr128_f)AES_ctr32_encrypt;
420#endif
421 }
422 142
423 if (ret < 0) { 143 AES_cbc_encrypt(in, out, len, &eak->ks, ctx->iv, ctx->encrypt);
424 EVPerror(EVP_R_AES_KEY_SETUP_FAILED);
425 return 0;
426 }
427 144
428 return 1; 145 return 1;
429} 146}
430 147
431static int 148static int
432aes_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 149aes_ecb_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
433 const unsigned char *in, size_t len) 150 const unsigned char *iv, int encrypt)
434{ 151{
435 EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data; 152 EVP_AES_KEY *eak = ctx->cipher_data;
436 153
437 if (dat->stream.cbc) 154 if (encrypt) {
438 (*dat->stream.cbc)(in, out, len, &dat->ks, ctx->iv, 155 if (AES_set_encrypt_key(key, ctx->key_len * 8, &eak->ks) < 0) {
439 ctx->encrypt); 156 EVPerror(EVP_R_AES_KEY_SETUP_FAILED);
440 else if (ctx->encrypt) 157 return 0;
441 CRYPTO_cbc128_encrypt(in, out, len, &dat->ks, ctx->iv, 158 }
442 dat->block); 159 } else {
443 else 160 if (AES_set_decrypt_key(key, ctx->key_len * 8, &eak->ks) < 0) {
444 CRYPTO_cbc128_decrypt(in, out, len, &dat->ks, ctx->iv, 161 EVPerror(EVP_R_AES_KEY_SETUP_FAILED);
445 dat->block); 162 return 0;
163 }
164 }
446 165
447 return 1; 166 return 1;
448} 167}
@@ -451,15 +170,9 @@ static int
451aes_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 170aes_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
452 const unsigned char *in, size_t len) 171 const unsigned char *in, size_t len)
453{ 172{
454 size_t bl = ctx->cipher->block_size; 173 EVP_AES_KEY *eak = ctx->cipher_data;
455 size_t i;
456 EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data;
457
458 if (len < bl)
459 return 1;
460 174
461 for (i = 0, len -= bl; i <= len; i += bl) 175 aes_ecb_encrypt_internal(in, out, len, &eak->ks, ctx->encrypt);
462 (*dat->block)(in + i, out + i, &dat->ks);
463 176
464 return 1; 177 return 1;
465} 178}
@@ -468,10 +181,10 @@ static int
468aes_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 181aes_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
469 const unsigned char *in, size_t len) 182 const unsigned char *in, size_t len)
470{ 183{
471 EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data; 184 EVP_AES_KEY *eak = ctx->cipher_data;
185
186 AES_ofb128_encrypt(in, out, len, &eak->ks, ctx->iv, &ctx->num);
472 187
473 CRYPTO_ofb128_encrypt(in, out, len, &dat->ks, ctx->iv, &ctx->num,
474 dat->block);
475 return 1; 188 return 1;
476} 189}
477 190
@@ -479,10 +192,11 @@ static int
479aes_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 192aes_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
480 const unsigned char *in, size_t len) 193 const unsigned char *in, size_t len)
481{ 194{
482 EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data; 195 EVP_AES_KEY *eak = ctx->cipher_data;
196
197 AES_cfb128_encrypt(in, out, len, &eak->ks, ctx->iv, &ctx->num,
198 ctx->encrypt);
483 199
484 CRYPTO_cfb128_encrypt(in, out, len, &dat->ks, ctx->iv, &ctx->num,
485 ctx->encrypt, dat->block);
486 return 1; 200 return 1;
487} 201}
488 202
@@ -490,10 +204,11 @@ static int
490aes_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 204aes_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
491 const unsigned char *in, size_t len) 205 const unsigned char *in, size_t len)
492{ 206{
493 EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data; 207 EVP_AES_KEY *eak = ctx->cipher_data;
208
209 AES_cfb8_encrypt(in, out, len, &eak->ks, ctx->iv, &ctx->num,
210 ctx->encrypt);
494 211
495 CRYPTO_cfb128_8_encrypt(in, out, len, &dat->ks, ctx->iv, &ctx->num,
496 ctx->encrypt, dat->block);
497 return 1; 212 return 1;
498} 213}
499 214
@@ -501,24 +216,25 @@ static int
501aes_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 216aes_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
502 const unsigned char *in, size_t len) 217 const unsigned char *in, size_t len)
503{ 218{
504 EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data; 219 EVP_AES_KEY *eak = ctx->cipher_data;
505 220
506 if (ctx->flags&EVP_CIPH_FLAG_LENGTH_BITS) { 221 if ((ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) != 0) {
507 CRYPTO_cfb128_1_encrypt(in, out, len, &dat->ks, ctx->iv, 222 AES_cfb1_encrypt(in, out, len, &eak->ks, ctx->iv, &ctx->num,
508 &ctx->num, ctx->encrypt, dat->block); 223 ctx->encrypt);
509 return 1; 224 return 1;
510 } 225 }
511 226
512 while (len >= MAXBITCHUNK) { 227 while (len >= MAXBITCHUNK) {
513 CRYPTO_cfb128_1_encrypt(in, out, MAXBITCHUNK*8, &dat->ks, 228 AES_cfb1_encrypt(in, out, MAXBITCHUNK * 8, &eak->ks, ctx->iv,
514 ctx->iv, &ctx->num, ctx->encrypt, dat->block); 229 &ctx->num, ctx->encrypt);
515 len -= MAXBITCHUNK; 230 len -= MAXBITCHUNK;
516 in += MAXBITCHUNK; 231 in += MAXBITCHUNK;
517 out += MAXBITCHUNK; 232 out += MAXBITCHUNK;
518 } 233 }
519 if (len) 234 if (len > 0) {
520 CRYPTO_cfb128_1_encrypt(in, out, len*8, &dat->ks, 235 AES_cfb1_encrypt(in, out, len * 8, &eak->ks, ctx->iv, &ctx->num,
521 ctx->iv, &ctx->num, ctx->encrypt, dat->block); 236 ctx->encrypt);
237 }
522 238
523 return 1; 239 return 1;
524} 240}
@@ -527,40 +243,23 @@ static int
527aes_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 243aes_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
528 const unsigned char *in, size_t len) 244 const unsigned char *in, size_t len)
529{ 245{
246 EVP_AES_KEY *eak = ctx->cipher_data;
530 unsigned int num = ctx->num; 247 unsigned int num = ctx->num;
531 EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data;
532 248
533 if (dat->stream.ctr) 249 AES_ctr128_encrypt(in, out, len, &eak->ks, ctx->iv, ctx->buf, &num);
534 CRYPTO_ctr128_encrypt_ctr32(in, out, len, &dat->ks, 250
535 ctx->iv, ctx->buf, &num, dat->stream.ctr);
536 else
537 CRYPTO_ctr128_encrypt(in, out, len, &dat->ks,
538 ctx->iv, ctx->buf, &num, dat->block);
539 ctx->num = (size_t)num; 251 ctx->num = (size_t)num;
252
540 return 1; 253 return 1;
541} 254}
542 255
543
544#ifdef AESNI_CAPABLE
545static const EVP_CIPHER aesni_128_cbc = {
546 .nid = NID_aes_128_cbc,
547 .block_size = 16,
548 .key_len = 16,
549 .iv_len = 16,
550 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE,
551 .init = aesni_init_key,
552 .do_cipher = aesni_cbc_cipher,
553 .ctx_size = sizeof(EVP_AES_KEY),
554};
555#endif
556
557static const EVP_CIPHER aes_128_cbc = { 256static const EVP_CIPHER aes_128_cbc = {
558 .nid = NID_aes_128_cbc, 257 .nid = NID_aes_128_cbc,
559 .block_size = 16, 258 .block_size = 16,
560 .key_len = 16, 259 .key_len = 16,
561 .iv_len = 16, 260 .iv_len = 16,
562 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE, 261 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE,
563 .init = aes_init_key, 262 .init = aes_cbc_init_key,
564 .do_cipher = aes_cbc_cipher, 263 .do_cipher = aes_cbc_cipher,
565 .ctx_size = sizeof(EVP_AES_KEY), 264 .ctx_size = sizeof(EVP_AES_KEY),
566}; 265};
@@ -568,34 +267,17 @@ static const EVP_CIPHER aes_128_cbc = {
568const EVP_CIPHER * 267const EVP_CIPHER *
569EVP_aes_128_cbc(void) 268EVP_aes_128_cbc(void)
570{ 269{
571#ifdef AESNI_CAPABLE
572 return AESNI_CAPABLE ? &aesni_128_cbc : &aes_128_cbc;
573#else
574 return &aes_128_cbc; 270 return &aes_128_cbc;
575#endif
576} 271}
577LCRYPTO_ALIAS(EVP_aes_128_cbc); 272LCRYPTO_ALIAS(EVP_aes_128_cbc);
578 273
579#ifdef AESNI_CAPABLE
580static const EVP_CIPHER aesni_128_ecb = {
581 .nid = NID_aes_128_ecb,
582 .block_size = 16,
583 .key_len = 16,
584 .iv_len = 0,
585 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE,
586 .init = aesni_init_key,
587 .do_cipher = aesni_ecb_cipher,
588 .ctx_size = sizeof(EVP_AES_KEY),
589};
590#endif
591
592static const EVP_CIPHER aes_128_ecb = { 274static const EVP_CIPHER aes_128_ecb = {
593 .nid = NID_aes_128_ecb, 275 .nid = NID_aes_128_ecb,
594 .block_size = 16, 276 .block_size = 16,
595 .key_len = 16, 277 .key_len = 16,
596 .iv_len = 0, 278 .iv_len = 0,
597 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE, 279 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE,
598 .init = aes_init_key, 280 .init = aes_ecb_init_key,
599 .do_cipher = aes_ecb_cipher, 281 .do_cipher = aes_ecb_cipher,
600 .ctx_size = sizeof(EVP_AES_KEY), 282 .ctx_size = sizeof(EVP_AES_KEY),
601}; 283};
@@ -603,27 +285,10 @@ static const EVP_CIPHER aes_128_ecb = {
603const EVP_CIPHER * 285const EVP_CIPHER *
604EVP_aes_128_ecb(void) 286EVP_aes_128_ecb(void)
605{ 287{
606#ifdef AESNI_CAPABLE
607 return AESNI_CAPABLE ? &aesni_128_ecb : &aes_128_ecb;
608#else
609 return &aes_128_ecb; 288 return &aes_128_ecb;
610#endif
611} 289}
612LCRYPTO_ALIAS(EVP_aes_128_ecb); 290LCRYPTO_ALIAS(EVP_aes_128_ecb);
613 291
614#ifdef AESNI_CAPABLE
615static const EVP_CIPHER aesni_128_ofb = {
616 .nid = NID_aes_128_ofb128,
617 .block_size = 1,
618 .key_len = 16,
619 .iv_len = 16,
620 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_OFB_MODE,
621 .init = aesni_init_key,
622 .do_cipher = aes_ofb_cipher,
623 .ctx_size = sizeof(EVP_AES_KEY),
624};
625#endif
626
627static const EVP_CIPHER aes_128_ofb = { 292static const EVP_CIPHER aes_128_ofb = {
628 .nid = NID_aes_128_ofb128, 293 .nid = NID_aes_128_ofb128,
629 .block_size = 1, 294 .block_size = 1,
@@ -638,27 +303,10 @@ static const EVP_CIPHER aes_128_ofb = {
638const EVP_CIPHER * 303const EVP_CIPHER *
639EVP_aes_128_ofb(void) 304EVP_aes_128_ofb(void)
640{ 305{
641#ifdef AESNI_CAPABLE
642 return AESNI_CAPABLE ? &aesni_128_ofb : &aes_128_ofb;
643#else
644 return &aes_128_ofb; 306 return &aes_128_ofb;
645#endif
646} 307}
647LCRYPTO_ALIAS(EVP_aes_128_ofb); 308LCRYPTO_ALIAS(EVP_aes_128_ofb);
648 309
649#ifdef AESNI_CAPABLE
650static const EVP_CIPHER aesni_128_cfb = {
651 .nid = NID_aes_128_cfb128,
652 .block_size = 1,
653 .key_len = 16,
654 .iv_len = 16,
655 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CFB_MODE,
656 .init = aesni_init_key,
657 .do_cipher = aes_cfb_cipher,
658 .ctx_size = sizeof(EVP_AES_KEY),
659};
660#endif
661
662static const EVP_CIPHER aes_128_cfb = { 310static const EVP_CIPHER aes_128_cfb = {
663 .nid = NID_aes_128_cfb128, 311 .nid = NID_aes_128_cfb128,
664 .block_size = 1, 312 .block_size = 1,
@@ -673,27 +321,10 @@ static const EVP_CIPHER aes_128_cfb = {
673const EVP_CIPHER * 321const EVP_CIPHER *
674EVP_aes_128_cfb128(void) 322EVP_aes_128_cfb128(void)
675{ 323{
676#ifdef AESNI_CAPABLE
677 return AESNI_CAPABLE ? &aesni_128_cfb : &aes_128_cfb;
678#else
679 return &aes_128_cfb; 324 return &aes_128_cfb;
680#endif
681} 325}
682LCRYPTO_ALIAS(EVP_aes_128_cfb128); 326LCRYPTO_ALIAS(EVP_aes_128_cfb128);
683 327
684#ifdef AESNI_CAPABLE
685static const EVP_CIPHER aesni_128_cfb1 = {
686 .nid = NID_aes_128_cfb1,
687 .block_size = 1,
688 .key_len = 16,
689 .iv_len = 16,
690 .flags = EVP_CIPH_CFB_MODE,
691 .init = aesni_init_key,
692 .do_cipher = aes_cfb1_cipher,
693 .ctx_size = sizeof(EVP_AES_KEY),
694};
695#endif
696
697static const EVP_CIPHER aes_128_cfb1 = { 328static const EVP_CIPHER aes_128_cfb1 = {
698 .nid = NID_aes_128_cfb1, 329 .nid = NID_aes_128_cfb1,
699 .block_size = 1, 330 .block_size = 1,
@@ -708,27 +339,10 @@ static const EVP_CIPHER aes_128_cfb1 = {
708const EVP_CIPHER * 339const EVP_CIPHER *
709EVP_aes_128_cfb1(void) 340EVP_aes_128_cfb1(void)
710{ 341{
711#ifdef AESNI_CAPABLE
712 return AESNI_CAPABLE ? &aesni_128_cfb1 : &aes_128_cfb1;
713#else
714 return &aes_128_cfb1; 342 return &aes_128_cfb1;
715#endif
716} 343}
717LCRYPTO_ALIAS(EVP_aes_128_cfb1); 344LCRYPTO_ALIAS(EVP_aes_128_cfb1);
718 345
719#ifdef AESNI_CAPABLE
720static const EVP_CIPHER aesni_128_cfb8 = {
721 .nid = NID_aes_128_cfb8,
722 .block_size = 1,
723 .key_len = 16,
724 .iv_len = 16,
725 .flags = EVP_CIPH_CFB_MODE,
726 .init = aesni_init_key,
727 .do_cipher = aes_cfb8_cipher,
728 .ctx_size = sizeof(EVP_AES_KEY),
729};
730#endif
731
732static const EVP_CIPHER aes_128_cfb8 = { 346static const EVP_CIPHER aes_128_cfb8 = {
733 .nid = NID_aes_128_cfb8, 347 .nid = NID_aes_128_cfb8,
734 .block_size = 1, 348 .block_size = 1,
@@ -743,27 +357,10 @@ static const EVP_CIPHER aes_128_cfb8 = {
743const EVP_CIPHER * 357const EVP_CIPHER *
744EVP_aes_128_cfb8(void) 358EVP_aes_128_cfb8(void)
745{ 359{
746#ifdef AESNI_CAPABLE
747 return AESNI_CAPABLE ? &aesni_128_cfb8 : &aes_128_cfb8;
748#else
749 return &aes_128_cfb8; 360 return &aes_128_cfb8;
750#endif
751} 361}
752LCRYPTO_ALIAS(EVP_aes_128_cfb8); 362LCRYPTO_ALIAS(EVP_aes_128_cfb8);
753 363
754#ifdef AESNI_CAPABLE
755static const EVP_CIPHER aesni_128_ctr = {
756 .nid = NID_aes_128_ctr,
757 .block_size = 1,
758 .key_len = 16,
759 .iv_len = 16,
760 .flags = EVP_CIPH_CTR_MODE,
761 .init = aesni_init_key,
762 .do_cipher = aes_ctr_cipher,
763 .ctx_size = sizeof(EVP_AES_KEY),
764};
765#endif
766
767static const EVP_CIPHER aes_128_ctr = { 364static const EVP_CIPHER aes_128_ctr = {
768 .nid = NID_aes_128_ctr, 365 .nid = NID_aes_128_ctr,
769 .block_size = 1, 366 .block_size = 1,
@@ -778,35 +375,17 @@ static const EVP_CIPHER aes_128_ctr = {
778const EVP_CIPHER * 375const EVP_CIPHER *
779EVP_aes_128_ctr(void) 376EVP_aes_128_ctr(void)
780{ 377{
781#ifdef AESNI_CAPABLE
782 return AESNI_CAPABLE ? &aesni_128_ctr : &aes_128_ctr;
783#else
784 return &aes_128_ctr; 378 return &aes_128_ctr;
785#endif
786} 379}
787LCRYPTO_ALIAS(EVP_aes_128_ctr); 380LCRYPTO_ALIAS(EVP_aes_128_ctr);
788 381
789
790#ifdef AESNI_CAPABLE
791static const EVP_CIPHER aesni_192_cbc = {
792 .nid = NID_aes_192_cbc,
793 .block_size = 16,
794 .key_len = 24,
795 .iv_len = 16,
796 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE,
797 .init = aesni_init_key,
798 .do_cipher = aesni_cbc_cipher,
799 .ctx_size = sizeof(EVP_AES_KEY),
800};
801#endif
802
803static const EVP_CIPHER aes_192_cbc = { 382static const EVP_CIPHER aes_192_cbc = {
804 .nid = NID_aes_192_cbc, 383 .nid = NID_aes_192_cbc,
805 .block_size = 16, 384 .block_size = 16,
806 .key_len = 24, 385 .key_len = 24,
807 .iv_len = 16, 386 .iv_len = 16,
808 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE, 387 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE,
809 .init = aes_init_key, 388 .init = aes_cbc_init_key,
810 .do_cipher = aes_cbc_cipher, 389 .do_cipher = aes_cbc_cipher,
811 .ctx_size = sizeof(EVP_AES_KEY), 390 .ctx_size = sizeof(EVP_AES_KEY),
812}; 391};
@@ -814,34 +393,17 @@ static const EVP_CIPHER aes_192_cbc = {
814const EVP_CIPHER * 393const EVP_CIPHER *
815EVP_aes_192_cbc(void) 394EVP_aes_192_cbc(void)
816{ 395{
817#ifdef AESNI_CAPABLE
818 return AESNI_CAPABLE ? &aesni_192_cbc : &aes_192_cbc;
819#else
820 return &aes_192_cbc; 396 return &aes_192_cbc;
821#endif
822} 397}
823LCRYPTO_ALIAS(EVP_aes_192_cbc); 398LCRYPTO_ALIAS(EVP_aes_192_cbc);
824 399
825#ifdef AESNI_CAPABLE
826static const EVP_CIPHER aesni_192_ecb = {
827 .nid = NID_aes_192_ecb,
828 .block_size = 16,
829 .key_len = 24,
830 .iv_len = 0,
831 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE,
832 .init = aesni_init_key,
833 .do_cipher = aesni_ecb_cipher,
834 .ctx_size = sizeof(EVP_AES_KEY),
835};
836#endif
837
838static const EVP_CIPHER aes_192_ecb = { 400static const EVP_CIPHER aes_192_ecb = {
839 .nid = NID_aes_192_ecb, 401 .nid = NID_aes_192_ecb,
840 .block_size = 16, 402 .block_size = 16,
841 .key_len = 24, 403 .key_len = 24,
842 .iv_len = 0, 404 .iv_len = 0,
843 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE, 405 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE,
844 .init = aes_init_key, 406 .init = aes_ecb_init_key,
845 .do_cipher = aes_ecb_cipher, 407 .do_cipher = aes_ecb_cipher,
846 .ctx_size = sizeof(EVP_AES_KEY), 408 .ctx_size = sizeof(EVP_AES_KEY),
847}; 409};
@@ -849,27 +411,10 @@ static const EVP_CIPHER aes_192_ecb = {
849const EVP_CIPHER * 411const EVP_CIPHER *
850EVP_aes_192_ecb(void) 412EVP_aes_192_ecb(void)
851{ 413{
852#ifdef AESNI_CAPABLE
853 return AESNI_CAPABLE ? &aesni_192_ecb : &aes_192_ecb;
854#else
855 return &aes_192_ecb; 414 return &aes_192_ecb;
856#endif
857} 415}
858LCRYPTO_ALIAS(EVP_aes_192_ecb); 416LCRYPTO_ALIAS(EVP_aes_192_ecb);
859 417
860#ifdef AESNI_CAPABLE
861static const EVP_CIPHER aesni_192_ofb = {
862 .nid = NID_aes_192_ofb128,
863 .block_size = 1,
864 .key_len = 24,
865 .iv_len = 16,
866 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_OFB_MODE,
867 .init = aesni_init_key,
868 .do_cipher = aes_ofb_cipher,
869 .ctx_size = sizeof(EVP_AES_KEY),
870};
871#endif
872
873static const EVP_CIPHER aes_192_ofb = { 418static const EVP_CIPHER aes_192_ofb = {
874 .nid = NID_aes_192_ofb128, 419 .nid = NID_aes_192_ofb128,
875 .block_size = 1, 420 .block_size = 1,
@@ -884,27 +429,10 @@ static const EVP_CIPHER aes_192_ofb = {
884const EVP_CIPHER * 429const EVP_CIPHER *
885EVP_aes_192_ofb(void) 430EVP_aes_192_ofb(void)
886{ 431{
887#ifdef AESNI_CAPABLE
888 return AESNI_CAPABLE ? &aesni_192_ofb : &aes_192_ofb;
889#else
890 return &aes_192_ofb; 432 return &aes_192_ofb;
891#endif
892} 433}
893LCRYPTO_ALIAS(EVP_aes_192_ofb); 434LCRYPTO_ALIAS(EVP_aes_192_ofb);
894 435
895#ifdef AESNI_CAPABLE
896static const EVP_CIPHER aesni_192_cfb = {
897 .nid = NID_aes_192_cfb128,
898 .block_size = 1,
899 .key_len = 24,
900 .iv_len = 16,
901 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CFB_MODE,
902 .init = aesni_init_key,
903 .do_cipher = aes_cfb_cipher,
904 .ctx_size = sizeof(EVP_AES_KEY),
905};
906#endif
907
908static const EVP_CIPHER aes_192_cfb = { 436static const EVP_CIPHER aes_192_cfb = {
909 .nid = NID_aes_192_cfb128, 437 .nid = NID_aes_192_cfb128,
910 .block_size = 1, 438 .block_size = 1,
@@ -919,27 +447,10 @@ static const EVP_CIPHER aes_192_cfb = {
919const EVP_CIPHER * 447const EVP_CIPHER *
920EVP_aes_192_cfb128(void) 448EVP_aes_192_cfb128(void)
921{ 449{
922#ifdef AESNI_CAPABLE
923 return AESNI_CAPABLE ? &aesni_192_cfb : &aes_192_cfb;
924#else
925 return &aes_192_cfb; 450 return &aes_192_cfb;
926#endif
927} 451}
928LCRYPTO_ALIAS(EVP_aes_192_cfb128); 452LCRYPTO_ALIAS(EVP_aes_192_cfb128);
929 453
930#ifdef AESNI_CAPABLE
931static const EVP_CIPHER aesni_192_cfb1 = {
932 .nid = NID_aes_192_cfb1,
933 .block_size = 1,
934 .key_len = 24,
935 .iv_len = 16,
936 .flags = EVP_CIPH_CFB_MODE,
937 .init = aesni_init_key,
938 .do_cipher = aes_cfb1_cipher,
939 .ctx_size = sizeof(EVP_AES_KEY),
940};
941#endif
942
943static const EVP_CIPHER aes_192_cfb1 = { 454static const EVP_CIPHER aes_192_cfb1 = {
944 .nid = NID_aes_192_cfb1, 455 .nid = NID_aes_192_cfb1,
945 .block_size = 1, 456 .block_size = 1,
@@ -954,27 +465,10 @@ static const EVP_CIPHER aes_192_cfb1 = {
954const EVP_CIPHER * 465const EVP_CIPHER *
955EVP_aes_192_cfb1(void) 466EVP_aes_192_cfb1(void)
956{ 467{
957#ifdef AESNI_CAPABLE
958 return AESNI_CAPABLE ? &aesni_192_cfb1 : &aes_192_cfb1;
959#else
960 return &aes_192_cfb1; 468 return &aes_192_cfb1;
961#endif
962} 469}
963LCRYPTO_ALIAS(EVP_aes_192_cfb1); 470LCRYPTO_ALIAS(EVP_aes_192_cfb1);
964 471
965#ifdef AESNI_CAPABLE
966static const EVP_CIPHER aesni_192_cfb8 = {
967 .nid = NID_aes_192_cfb8,
968 .block_size = 1,
969 .key_len = 24,
970 .iv_len = 16,
971 .flags = EVP_CIPH_CFB_MODE,
972 .init = aesni_init_key,
973 .do_cipher = aes_cfb8_cipher,
974 .ctx_size = sizeof(EVP_AES_KEY),
975};
976#endif
977
978static const EVP_CIPHER aes_192_cfb8 = { 472static const EVP_CIPHER aes_192_cfb8 = {
979 .nid = NID_aes_192_cfb8, 473 .nid = NID_aes_192_cfb8,
980 .block_size = 1, 474 .block_size = 1,
@@ -989,27 +483,10 @@ static const EVP_CIPHER aes_192_cfb8 = {
989const EVP_CIPHER * 483const EVP_CIPHER *
990EVP_aes_192_cfb8(void) 484EVP_aes_192_cfb8(void)
991{ 485{
992#ifdef AESNI_CAPABLE
993 return AESNI_CAPABLE ? &aesni_192_cfb8 : &aes_192_cfb8;
994#else
995 return &aes_192_cfb8; 486 return &aes_192_cfb8;
996#endif
997} 487}
998LCRYPTO_ALIAS(EVP_aes_192_cfb8); 488LCRYPTO_ALIAS(EVP_aes_192_cfb8);
999 489
1000#ifdef AESNI_CAPABLE
1001static const EVP_CIPHER aesni_192_ctr = {
1002 .nid = NID_aes_192_ctr,
1003 .block_size = 1,
1004 .key_len = 24,
1005 .iv_len = 16,
1006 .flags = EVP_CIPH_CTR_MODE,
1007 .init = aesni_init_key,
1008 .do_cipher = aes_ctr_cipher,
1009 .ctx_size = sizeof(EVP_AES_KEY),
1010};
1011#endif
1012
1013static const EVP_CIPHER aes_192_ctr = { 490static const EVP_CIPHER aes_192_ctr = {
1014 .nid = NID_aes_192_ctr, 491 .nid = NID_aes_192_ctr,
1015 .block_size = 1, 492 .block_size = 1,
@@ -1024,35 +501,17 @@ static const EVP_CIPHER aes_192_ctr = {
1024const EVP_CIPHER * 501const EVP_CIPHER *
1025EVP_aes_192_ctr(void) 502EVP_aes_192_ctr(void)
1026{ 503{
1027#ifdef AESNI_CAPABLE
1028 return AESNI_CAPABLE ? &aesni_192_ctr : &aes_192_ctr;
1029#else
1030 return &aes_192_ctr; 504 return &aes_192_ctr;
1031#endif
1032} 505}
1033LCRYPTO_ALIAS(EVP_aes_192_ctr); 506LCRYPTO_ALIAS(EVP_aes_192_ctr);
1034 507
1035
1036#ifdef AESNI_CAPABLE
1037static const EVP_CIPHER aesni_256_cbc = {
1038 .nid = NID_aes_256_cbc,
1039 .block_size = 16,
1040 .key_len = 32,
1041 .iv_len = 16,
1042 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE,
1043 .init = aesni_init_key,
1044 .do_cipher = aesni_cbc_cipher,
1045 .ctx_size = sizeof(EVP_AES_KEY),
1046};
1047#endif
1048
1049static const EVP_CIPHER aes_256_cbc = { 508static const EVP_CIPHER aes_256_cbc = {
1050 .nid = NID_aes_256_cbc, 509 .nid = NID_aes_256_cbc,
1051 .block_size = 16, 510 .block_size = 16,
1052 .key_len = 32, 511 .key_len = 32,
1053 .iv_len = 16, 512 .iv_len = 16,
1054 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE, 513 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE,
1055 .init = aes_init_key, 514 .init = aes_cbc_init_key,
1056 .do_cipher = aes_cbc_cipher, 515 .do_cipher = aes_cbc_cipher,
1057 .ctx_size = sizeof(EVP_AES_KEY), 516 .ctx_size = sizeof(EVP_AES_KEY),
1058}; 517};
@@ -1060,34 +519,17 @@ static const EVP_CIPHER aes_256_cbc = {
1060const EVP_CIPHER * 519const EVP_CIPHER *
1061EVP_aes_256_cbc(void) 520EVP_aes_256_cbc(void)
1062{ 521{
1063#ifdef AESNI_CAPABLE
1064 return AESNI_CAPABLE ? &aesni_256_cbc : &aes_256_cbc;
1065#else
1066 return &aes_256_cbc; 522 return &aes_256_cbc;
1067#endif
1068} 523}
1069LCRYPTO_ALIAS(EVP_aes_256_cbc); 524LCRYPTO_ALIAS(EVP_aes_256_cbc);
1070 525
1071#ifdef AESNI_CAPABLE
1072static const EVP_CIPHER aesni_256_ecb = {
1073 .nid = NID_aes_256_ecb,
1074 .block_size = 16,
1075 .key_len = 32,
1076 .iv_len = 0,
1077 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE,
1078 .init = aesni_init_key,
1079 .do_cipher = aesni_ecb_cipher,
1080 .ctx_size = sizeof(EVP_AES_KEY),
1081};
1082#endif
1083
1084static const EVP_CIPHER aes_256_ecb = { 526static const EVP_CIPHER aes_256_ecb = {
1085 .nid = NID_aes_256_ecb, 527 .nid = NID_aes_256_ecb,
1086 .block_size = 16, 528 .block_size = 16,
1087 .key_len = 32, 529 .key_len = 32,
1088 .iv_len = 0, 530 .iv_len = 0,
1089 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE, 531 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE,
1090 .init = aes_init_key, 532 .init = aes_ecb_init_key,
1091 .do_cipher = aes_ecb_cipher, 533 .do_cipher = aes_ecb_cipher,
1092 .ctx_size = sizeof(EVP_AES_KEY), 534 .ctx_size = sizeof(EVP_AES_KEY),
1093}; 535};
@@ -1095,27 +537,10 @@ static const EVP_CIPHER aes_256_ecb = {
1095const EVP_CIPHER * 537const EVP_CIPHER *
1096EVP_aes_256_ecb(void) 538EVP_aes_256_ecb(void)
1097{ 539{
1098#ifdef AESNI_CAPABLE
1099 return AESNI_CAPABLE ? &aesni_256_ecb : &aes_256_ecb;
1100#else
1101 return &aes_256_ecb; 540 return &aes_256_ecb;
1102#endif
1103} 541}
1104LCRYPTO_ALIAS(EVP_aes_256_ecb); 542LCRYPTO_ALIAS(EVP_aes_256_ecb);
1105 543
1106#ifdef AESNI_CAPABLE
1107static const EVP_CIPHER aesni_256_ofb = {
1108 .nid = NID_aes_256_ofb128,
1109 .block_size = 1,
1110 .key_len = 32,
1111 .iv_len = 16,
1112 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_OFB_MODE,
1113 .init = aesni_init_key,
1114 .do_cipher = aes_ofb_cipher,
1115 .ctx_size = sizeof(EVP_AES_KEY),
1116};
1117#endif
1118
1119static const EVP_CIPHER aes_256_ofb = { 544static const EVP_CIPHER aes_256_ofb = {
1120 .nid = NID_aes_256_ofb128, 545 .nid = NID_aes_256_ofb128,
1121 .block_size = 1, 546 .block_size = 1,
@@ -1130,27 +555,10 @@ static const EVP_CIPHER aes_256_ofb = {
1130const EVP_CIPHER * 555const EVP_CIPHER *
1131EVP_aes_256_ofb(void) 556EVP_aes_256_ofb(void)
1132{ 557{
1133#ifdef AESNI_CAPABLE
1134 return AESNI_CAPABLE ? &aesni_256_ofb : &aes_256_ofb;
1135#else
1136 return &aes_256_ofb; 558 return &aes_256_ofb;
1137#endif
1138} 559}
1139LCRYPTO_ALIAS(EVP_aes_256_ofb); 560LCRYPTO_ALIAS(EVP_aes_256_ofb);
1140 561
1141#ifdef AESNI_CAPABLE
1142static const EVP_CIPHER aesni_256_cfb = {
1143 .nid = NID_aes_256_cfb128,
1144 .block_size = 1,
1145 .key_len = 32,
1146 .iv_len = 16,
1147 .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CFB_MODE,
1148 .init = aesni_init_key,
1149 .do_cipher = aes_cfb_cipher,
1150 .ctx_size = sizeof(EVP_AES_KEY),
1151};
1152#endif
1153
1154static const EVP_CIPHER aes_256_cfb = { 562static const EVP_CIPHER aes_256_cfb = {
1155 .nid = NID_aes_256_cfb128, 563 .nid = NID_aes_256_cfb128,
1156 .block_size = 1, 564 .block_size = 1,
@@ -1165,27 +573,10 @@ static const EVP_CIPHER aes_256_cfb = {
1165const EVP_CIPHER * 573const EVP_CIPHER *
1166EVP_aes_256_cfb128(void) 574EVP_aes_256_cfb128(void)
1167{ 575{
1168#ifdef AESNI_CAPABLE
1169 return AESNI_CAPABLE ? &aesni_256_cfb : &aes_256_cfb;
1170#else
1171 return &aes_256_cfb; 576 return &aes_256_cfb;
1172#endif
1173} 577}
1174LCRYPTO_ALIAS(EVP_aes_256_cfb128); 578LCRYPTO_ALIAS(EVP_aes_256_cfb128);
1175 579
1176#ifdef AESNI_CAPABLE
1177static const EVP_CIPHER aesni_256_cfb1 = {
1178 .nid = NID_aes_256_cfb1,
1179 .block_size = 1,
1180 .key_len = 32,
1181 .iv_len = 16,
1182 .flags = EVP_CIPH_CFB_MODE,
1183 .init = aesni_init_key,
1184 .do_cipher = aes_cfb1_cipher,
1185 .ctx_size = sizeof(EVP_AES_KEY),
1186};
1187#endif
1188
1189static const EVP_CIPHER aes_256_cfb1 = { 580static const EVP_CIPHER aes_256_cfb1 = {
1190 .nid = NID_aes_256_cfb1, 581 .nid = NID_aes_256_cfb1,
1191 .block_size = 1, 582 .block_size = 1,
@@ -1200,27 +591,10 @@ static const EVP_CIPHER aes_256_cfb1 = {
1200const EVP_CIPHER * 591const EVP_CIPHER *
1201EVP_aes_256_cfb1(void) 592EVP_aes_256_cfb1(void)
1202{ 593{
1203#ifdef AESNI_CAPABLE
1204 return AESNI_CAPABLE ? &aesni_256_cfb1 : &aes_256_cfb1;
1205#else
1206 return &aes_256_cfb1; 594 return &aes_256_cfb1;
1207#endif
1208} 595}
1209LCRYPTO_ALIAS(EVP_aes_256_cfb1); 596LCRYPTO_ALIAS(EVP_aes_256_cfb1);
1210 597
1211#ifdef AESNI_CAPABLE
1212static const EVP_CIPHER aesni_256_cfb8 = {
1213 .nid = NID_aes_256_cfb8,
1214 .block_size = 1,
1215 .key_len = 32,
1216 .iv_len = 16,
1217 .flags = EVP_CIPH_CFB_MODE,
1218 .init = aesni_init_key,
1219 .do_cipher = aes_cfb8_cipher,
1220 .ctx_size = sizeof(EVP_AES_KEY),
1221};
1222#endif
1223
1224static const EVP_CIPHER aes_256_cfb8 = { 598static const EVP_CIPHER aes_256_cfb8 = {
1225 .nid = NID_aes_256_cfb8, 599 .nid = NID_aes_256_cfb8,
1226 .block_size = 1, 600 .block_size = 1,
@@ -1235,27 +609,10 @@ static const EVP_CIPHER aes_256_cfb8 = {
1235const EVP_CIPHER * 609const EVP_CIPHER *
1236EVP_aes_256_cfb8(void) 610EVP_aes_256_cfb8(void)
1237{ 611{
1238#ifdef AESNI_CAPABLE
1239 return AESNI_CAPABLE ? &aesni_256_cfb8 : &aes_256_cfb8;
1240#else
1241 return &aes_256_cfb8; 612 return &aes_256_cfb8;
1242#endif
1243} 613}
1244LCRYPTO_ALIAS(EVP_aes_256_cfb8); 614LCRYPTO_ALIAS(EVP_aes_256_cfb8);
1245 615
1246#ifdef AESNI_CAPABLE
1247static const EVP_CIPHER aesni_256_ctr = {
1248 .nid = NID_aes_256_ctr,
1249 .block_size = 1,
1250 .key_len = 32,
1251 .iv_len = 16,
1252 .flags = EVP_CIPH_CTR_MODE,
1253 .init = aesni_init_key,
1254 .do_cipher = aes_ctr_cipher,
1255 .ctx_size = sizeof(EVP_AES_KEY),
1256};
1257#endif
1258
1259static const EVP_CIPHER aes_256_ctr = { 616static const EVP_CIPHER aes_256_ctr = {
1260 .nid = NID_aes_256_ctr, 617 .nid = NID_aes_256_ctr,
1261 .block_size = 1, 618 .block_size = 1,
@@ -1270,11 +627,7 @@ static const EVP_CIPHER aes_256_ctr = {
1270const EVP_CIPHER * 627const EVP_CIPHER *
1271EVP_aes_256_ctr(void) 628EVP_aes_256_ctr(void)
1272{ 629{
1273#ifdef AESNI_CAPABLE
1274 return AESNI_CAPABLE ? &aesni_256_ctr : &aes_256_ctr;
1275#else
1276 return &aes_256_ctr; 630 return &aes_256_ctr;
1277#endif
1278} 631}
1279LCRYPTO_ALIAS(EVP_aes_256_ctr); 632LCRYPTO_ALIAS(EVP_aes_256_ctr);
1280 633
@@ -1455,35 +808,6 @@ aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
1455 } 808 }
1456} 809}
1457 810
1458static ctr128_f
1459aes_gcm_set_key(AES_KEY *aes_key, GCM128_CONTEXT *gcm_ctx,
1460 const unsigned char *key, size_t key_len)
1461{
1462#ifdef BSAES_CAPABLE
1463 if (BSAES_CAPABLE) {
1464 AES_set_encrypt_key(key, key_len * 8, aes_key);
1465 CRYPTO_gcm128_init(gcm_ctx, aes_key, (block128_f)AES_encrypt);
1466 return (ctr128_f)bsaes_ctr32_encrypt_blocks;
1467 } else
1468#endif
1469#ifdef VPAES_CAPABLE
1470 if (VPAES_CAPABLE) {
1471 vpaes_set_encrypt_key(key, key_len * 8, aes_key);
1472 CRYPTO_gcm128_init(gcm_ctx, aes_key, (block128_f)vpaes_encrypt);
1473 return NULL;
1474 } else
1475#endif
1476 (void)0; /* terminate potentially open 'else' */
1477
1478 AES_set_encrypt_key(key, key_len * 8, aes_key);
1479 CRYPTO_gcm128_init(gcm_ctx, aes_key, (block128_f)AES_encrypt);
1480#ifdef AES_CTR_ASM
1481 return (ctr128_f)AES_ctr32_encrypt;
1482#else
1483 return NULL;
1484#endif
1485}
1486
1487static int 811static int
1488aes_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 812aes_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
1489 const unsigned char *iv, int enc) 813 const unsigned char *iv, int enc)
@@ -1493,8 +817,8 @@ aes_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
1493 if (!iv && !key) 817 if (!iv && !key)
1494 return 1; 818 return 1;
1495 if (key) { 819 if (key) {
1496 gctx->ctr = aes_gcm_set_key(&gctx->ks, &gctx->gcm, 820 AES_set_encrypt_key(key, ctx->key_len * 8, &gctx->ks);
1497 key, ctx->key_len); 821 CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks, aes_encrypt_block128);
1498 822
1499 /* If we have an iv can set it directly, otherwise use 823 /* If we have an iv can set it directly, otherwise use
1500 * saved IV. 824 * saved IV.
@@ -1554,14 +878,9 @@ aes_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
1554 len -= EVP_GCM_TLS_EXPLICIT_IV_LEN + EVP_GCM_TLS_TAG_LEN; 878 len -= EVP_GCM_TLS_EXPLICIT_IV_LEN + EVP_GCM_TLS_TAG_LEN;
1555 if (ctx->encrypt) { 879 if (ctx->encrypt) {
1556 /* Encrypt payload */ 880 /* Encrypt payload */
1557 if (gctx->ctr) { 881 if (CRYPTO_gcm128_encrypt_ctr32(&gctx->gcm, in, out, len,
1558 if (CRYPTO_gcm128_encrypt_ctr32(&gctx->gcm, in, out, 882 aes_ctr32_encrypt_ctr128f))
1559 len, gctx->ctr)) 883 goto err;
1560 goto err;
1561 } else {
1562 if (CRYPTO_gcm128_encrypt(&gctx->gcm, in, out, len))
1563 goto err;
1564 }
1565 out += len; 884 out += len;
1566 885
1567 /* Finally write tag */ 886 /* Finally write tag */
@@ -1569,19 +888,15 @@ aes_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
1569 rv = len + EVP_GCM_TLS_EXPLICIT_IV_LEN + EVP_GCM_TLS_TAG_LEN; 888 rv = len + EVP_GCM_TLS_EXPLICIT_IV_LEN + EVP_GCM_TLS_TAG_LEN;
1570 } else { 889 } else {
1571 /* Decrypt */ 890 /* Decrypt */
1572 if (gctx->ctr) { 891 if (CRYPTO_gcm128_decrypt_ctr32(&gctx->gcm, in, out, len,
1573 if (CRYPTO_gcm128_decrypt_ctr32(&gctx->gcm, in, out, 892 aes_ctr32_encrypt_ctr128f))
1574 len, gctx->ctr)) 893 goto err;
1575 goto err; 894
1576 } else {
1577 if (CRYPTO_gcm128_decrypt(&gctx->gcm, in, out, len))
1578 goto err;
1579 }
1580 /* Retrieve tag */ 895 /* Retrieve tag */
1581 CRYPTO_gcm128_tag(&gctx->gcm, ctx->buf, EVP_GCM_TLS_TAG_LEN); 896 CRYPTO_gcm128_tag(&gctx->gcm, ctx->buf, EVP_GCM_TLS_TAG_LEN);
1582 897
1583 /* If tag mismatch wipe buffer */ 898 /* If tag mismatch wipe buffer */
1584 if (memcmp(ctx->buf, in + len, EVP_GCM_TLS_TAG_LEN)) { 899 if (timingsafe_memcmp(ctx->buf, in + len, EVP_GCM_TLS_TAG_LEN) != 0) {
1585 explicit_bzero(out, len); 900 explicit_bzero(out, len);
1586 goto err; 901 goto err;
1587 } 902 }
@@ -1615,25 +930,13 @@ aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
1615 if (CRYPTO_gcm128_aad(&gctx->gcm, in, len)) 930 if (CRYPTO_gcm128_aad(&gctx->gcm, in, len))
1616 return -1; 931 return -1;
1617 } else if (ctx->encrypt) { 932 } else if (ctx->encrypt) {
1618 if (gctx->ctr) { 933 if (CRYPTO_gcm128_encrypt_ctr32(&gctx->gcm,
1619 if (CRYPTO_gcm128_encrypt_ctr32(&gctx->gcm, 934 in, out, len, aes_ctr32_encrypt_ctr128f))
1620 in, out, len, gctx->ctr)) 935 return -1;
1621 return -1;
1622 } else {
1623 if (CRYPTO_gcm128_encrypt(&gctx->gcm,
1624 in, out, len))
1625 return -1;
1626 }
1627 } else { 936 } else {
1628 if (gctx->ctr) { 937 if (CRYPTO_gcm128_decrypt_ctr32(&gctx->gcm,
1629 if (CRYPTO_gcm128_decrypt_ctr32(&gctx->gcm, 938 in, out, len, aes_ctr32_encrypt_ctr128f))
1630 in, out, len, gctx->ctr)) 939 return -1;
1631 return -1;
1632 } else {
1633 if (CRYPTO_gcm128_decrypt(&gctx->gcm,
1634 in, out, len))
1635 return -1;
1636 }
1637 } 940 }
1638 return len; 941 return len;
1639 } else { 942 } else {
@@ -1662,22 +965,6 @@ aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
1662 EVP_CIPH_FLAG_CUSTOM_CIPHER | EVP_CIPH_ALWAYS_CALL_INIT | \ 965 EVP_CIPH_FLAG_CUSTOM_CIPHER | EVP_CIPH_ALWAYS_CALL_INIT | \
1663 EVP_CIPH_CTRL_INIT | EVP_CIPH_CUSTOM_COPY ) 966 EVP_CIPH_CTRL_INIT | EVP_CIPH_CUSTOM_COPY )
1664 967
1665
1666#ifdef AESNI_CAPABLE
1667static const EVP_CIPHER aesni_128_gcm = {
1668 .nid = NID_aes_128_gcm,
1669 .block_size = 1,
1670 .key_len = 16,
1671 .iv_len = 12,
1672 .flags = EVP_CIPH_FLAG_AEAD_CIPHER|CUSTOM_FLAGS | EVP_CIPH_GCM_MODE,
1673 .init = aesni_gcm_init_key,
1674 .do_cipher = aes_gcm_cipher,
1675 .cleanup = aes_gcm_cleanup,
1676 .ctx_size = sizeof(EVP_AES_GCM_CTX),
1677 .ctrl = aes_gcm_ctrl,
1678};
1679#endif
1680
1681static const EVP_CIPHER aes_128_gcm = { 968static const EVP_CIPHER aes_128_gcm = {
1682 .nid = NID_aes_128_gcm, 969 .nid = NID_aes_128_gcm,
1683 .block_size = 1, 970 .block_size = 1,
@@ -1694,29 +981,10 @@ static const EVP_CIPHER aes_128_gcm = {
1694const EVP_CIPHER * 981const EVP_CIPHER *
1695EVP_aes_128_gcm(void) 982EVP_aes_128_gcm(void)
1696{ 983{
1697#ifdef AESNI_CAPABLE
1698 return AESNI_CAPABLE ? &aesni_128_gcm : &aes_128_gcm;
1699#else
1700 return &aes_128_gcm; 984 return &aes_128_gcm;
1701#endif
1702} 985}
1703LCRYPTO_ALIAS(EVP_aes_128_gcm); 986LCRYPTO_ALIAS(EVP_aes_128_gcm);
1704 987
1705#ifdef AESNI_CAPABLE
1706static const EVP_CIPHER aesni_192_gcm = {
1707 .nid = NID_aes_192_gcm,
1708 .block_size = 1,
1709 .key_len = 24,
1710 .iv_len = 12,
1711 .flags = EVP_CIPH_FLAG_AEAD_CIPHER|CUSTOM_FLAGS | EVP_CIPH_GCM_MODE,
1712 .init = aesni_gcm_init_key,
1713 .do_cipher = aes_gcm_cipher,
1714 .cleanup = aes_gcm_cleanup,
1715 .ctx_size = sizeof(EVP_AES_GCM_CTX),
1716 .ctrl = aes_gcm_ctrl,
1717};
1718#endif
1719
1720static const EVP_CIPHER aes_192_gcm = { 988static const EVP_CIPHER aes_192_gcm = {
1721 .nid = NID_aes_192_gcm, 989 .nid = NID_aes_192_gcm,
1722 .block_size = 1, 990 .block_size = 1,
@@ -1733,29 +1001,10 @@ static const EVP_CIPHER aes_192_gcm = {
1733const EVP_CIPHER * 1001const EVP_CIPHER *
1734EVP_aes_192_gcm(void) 1002EVP_aes_192_gcm(void)
1735{ 1003{
1736#ifdef AESNI_CAPABLE
1737 return AESNI_CAPABLE ? &aesni_192_gcm : &aes_192_gcm;
1738#else
1739 return &aes_192_gcm; 1004 return &aes_192_gcm;
1740#endif
1741} 1005}
1742LCRYPTO_ALIAS(EVP_aes_192_gcm); 1006LCRYPTO_ALIAS(EVP_aes_192_gcm);
1743 1007
1744#ifdef AESNI_CAPABLE
1745static const EVP_CIPHER aesni_256_gcm = {
1746 .nid = NID_aes_256_gcm,
1747 .block_size = 1,
1748 .key_len = 32,
1749 .iv_len = 12,
1750 .flags = EVP_CIPH_FLAG_AEAD_CIPHER|CUSTOM_FLAGS | EVP_CIPH_GCM_MODE,
1751 .init = aesni_gcm_init_key,
1752 .do_cipher = aes_gcm_cipher,
1753 .cleanup = aes_gcm_cleanup,
1754 .ctx_size = sizeof(EVP_AES_GCM_CTX),
1755 .ctrl = aes_gcm_ctrl,
1756};
1757#endif
1758
1759static const EVP_CIPHER aes_256_gcm = { 1008static const EVP_CIPHER aes_256_gcm = {
1760 .nid = NID_aes_256_gcm, 1009 .nid = NID_aes_256_gcm,
1761 .block_size = 1, 1010 .block_size = 1,
@@ -1772,11 +1021,7 @@ static const EVP_CIPHER aes_256_gcm = {
1772const EVP_CIPHER * 1021const EVP_CIPHER *
1773EVP_aes_256_gcm(void) 1022EVP_aes_256_gcm(void)
1774{ 1023{
1775#ifdef AESNI_CAPABLE
1776 return AESNI_CAPABLE ? &aesni_256_gcm : &aes_256_gcm;
1777#else
1778 return &aes_256_gcm; 1024 return &aes_256_gcm;
1779#endif
1780} 1025}
1781LCRYPTO_ALIAS(EVP_aes_256_gcm); 1026LCRYPTO_ALIAS(EVP_aes_256_gcm);
1782 1027
@@ -1818,64 +1063,24 @@ aes_xts_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
1818 1063
1819static int 1064static int
1820aes_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 1065aes_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
1821 const unsigned char *iv, int enc) 1066 const unsigned char *iv, int encrypt)
1822{ 1067{
1823 EVP_AES_XTS_CTX *xctx = ctx->cipher_data; 1068 EVP_AES_XTS_CTX *xctx = ctx->cipher_data;
1824 1069
1825 if (!iv && !key) 1070 if (key != NULL) {
1826 return 1;
1827
1828 if (key) do {
1829#ifdef AES_XTS_ASM
1830 xctx->stream = enc ? AES_xts_encrypt : AES_xts_decrypt;
1831#else
1832 xctx->stream = NULL;
1833#endif
1834 /* key_len is two AES keys */ 1071 /* key_len is two AES keys */
1835#ifdef BSAES_CAPABLE 1072 if (encrypt)
1836 if (BSAES_CAPABLE)
1837 xctx->stream = enc ? bsaes_xts_encrypt :
1838 bsaes_xts_decrypt;
1839 else
1840#endif
1841#ifdef VPAES_CAPABLE
1842 if (VPAES_CAPABLE) {
1843 if (enc) {
1844 vpaes_set_encrypt_key(key, ctx->key_len * 4,
1845 &xctx->ks1);
1846 xctx->xts.block1 = (block128_f)vpaes_encrypt;
1847 } else {
1848 vpaes_set_decrypt_key(key, ctx->key_len * 4,
1849 &xctx->ks1);
1850 xctx->xts.block1 = (block128_f)vpaes_decrypt;
1851 }
1852
1853 vpaes_set_encrypt_key(key + ctx->key_len / 2,
1854 ctx->key_len * 4, &xctx->ks2);
1855 xctx->xts.block2 = (block128_f)vpaes_encrypt;
1856
1857 xctx->xts.key1 = &xctx->ks1;
1858 break;
1859 } else
1860#endif
1861 (void)0; /* terminate potentially open 'else' */
1862
1863 if (enc) {
1864 AES_set_encrypt_key(key, ctx->key_len * 4, &xctx->ks1); 1073 AES_set_encrypt_key(key, ctx->key_len * 4, &xctx->ks1);
1865 xctx->xts.block1 = (block128_f)AES_encrypt; 1074 else
1866 } else {
1867 AES_set_decrypt_key(key, ctx->key_len * 4, &xctx->ks1); 1075 AES_set_decrypt_key(key, ctx->key_len * 4, &xctx->ks1);
1868 xctx->xts.block1 = (block128_f)AES_decrypt;
1869 }
1870 1076
1871 AES_set_encrypt_key(key + ctx->key_len / 2, 1077 AES_set_encrypt_key(key + ctx->key_len / 2, ctx->key_len * 4,
1872 ctx->key_len * 4, &xctx->ks2); 1078 &xctx->ks2);
1873 xctx->xts.block2 = (block128_f)AES_encrypt;
1874 1079
1875 xctx->xts.key1 = &xctx->ks1; 1080 xctx->xts.key1 = &xctx->ks1;
1876 } while (0); 1081 }
1877 1082
1878 if (iv) { 1083 if (iv != NULL) {
1879 xctx->xts.key2 = &xctx->ks2; 1084 xctx->xts.key2 = &xctx->ks2;
1880 memcpy(ctx->iv, iv, 16); 1085 memcpy(ctx->iv, iv, 16);
1881 } 1086 }
@@ -1889,17 +1094,15 @@ aes_xts_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
1889{ 1094{
1890 EVP_AES_XTS_CTX *xctx = ctx->cipher_data; 1095 EVP_AES_XTS_CTX *xctx = ctx->cipher_data;
1891 1096
1892 if (!xctx->xts.key1 || !xctx->xts.key2) 1097 if (xctx->xts.key1 == NULL || xctx->xts.key2 == NULL)
1893 return 0;
1894 if (!out || !in || len < AES_BLOCK_SIZE)
1895 return 0; 1098 return 0;
1896 1099
1897 if (xctx->stream) 1100 if (out == NULL || in == NULL || len < AES_BLOCK_SIZE)
1898 (*xctx->stream)(in, out, len, xctx->xts.key1, xctx->xts.key2,
1899 ctx->iv);
1900 else if (CRYPTO_xts128_encrypt(&xctx->xts, ctx->iv, in, out, len,
1901 ctx->encrypt))
1902 return 0; 1101 return 0;
1102
1103 aes_xts_encrypt_internal(in, out, len, xctx->xts.key1, xctx->xts.key2,
1104 ctx->iv, ctx->encrypt);
1105
1903 return 1; 1106 return 1;
1904} 1107}
1905 1108
@@ -1907,22 +1110,6 @@ aes_xts_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
1907 ( EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CUSTOM_IV | \ 1110 ( EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CUSTOM_IV | \
1908 EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CTRL_INIT | EVP_CIPH_CUSTOM_COPY ) 1111 EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CTRL_INIT | EVP_CIPH_CUSTOM_COPY )
1909 1112
1910
1911#ifdef AESNI_CAPABLE
1912static const EVP_CIPHER aesni_128_xts = {
1913 .nid = NID_aes_128_xts,
1914 .block_size = 1,
1915 .key_len = 2 * 16,
1916 .iv_len = 16,
1917 .flags = XTS_FLAGS | EVP_CIPH_XTS_MODE,
1918 .init = aesni_xts_init_key,
1919 .do_cipher = aes_xts_cipher,
1920 .cleanup = NULL,
1921 .ctx_size = sizeof(EVP_AES_XTS_CTX),
1922 .ctrl = aes_xts_ctrl,
1923};
1924#endif
1925
1926static const EVP_CIPHER aes_128_xts = { 1113static const EVP_CIPHER aes_128_xts = {
1927 .nid = NID_aes_128_xts, 1114 .nid = NID_aes_128_xts,
1928 .block_size = 1, 1115 .block_size = 1,
@@ -1939,29 +1126,10 @@ static const EVP_CIPHER aes_128_xts = {
1939const EVP_CIPHER * 1126const EVP_CIPHER *
1940EVP_aes_128_xts(void) 1127EVP_aes_128_xts(void)
1941{ 1128{
1942#ifdef AESNI_CAPABLE
1943 return AESNI_CAPABLE ? &aesni_128_xts : &aes_128_xts;
1944#else
1945 return &aes_128_xts; 1129 return &aes_128_xts;
1946#endif
1947} 1130}
1948LCRYPTO_ALIAS(EVP_aes_128_xts); 1131LCRYPTO_ALIAS(EVP_aes_128_xts);
1949 1132
1950#ifdef AESNI_CAPABLE
1951static const EVP_CIPHER aesni_256_xts = {
1952 .nid = NID_aes_256_xts,
1953 .block_size = 1,
1954 .key_len = 2 * 32,
1955 .iv_len = 16,
1956 .flags = XTS_FLAGS | EVP_CIPH_XTS_MODE,
1957 .init = aesni_xts_init_key,
1958 .do_cipher = aes_xts_cipher,
1959 .cleanup = NULL,
1960 .ctx_size = sizeof(EVP_AES_XTS_CTX),
1961 .ctrl = aes_xts_ctrl,
1962};
1963#endif
1964
1965static const EVP_CIPHER aes_256_xts = { 1133static const EVP_CIPHER aes_256_xts = {
1966 .nid = NID_aes_256_xts, 1134 .nid = NID_aes_256_xts,
1967 .block_size = 1, 1135 .block_size = 1,
@@ -1978,11 +1146,7 @@ static const EVP_CIPHER aes_256_xts = {
1978const EVP_CIPHER * 1146const EVP_CIPHER *
1979EVP_aes_256_xts(void) 1147EVP_aes_256_xts(void)
1980{ 1148{
1981#ifdef AESNI_CAPABLE
1982 return AESNI_CAPABLE ? &aesni_256_xts : &aes_256_xts;
1983#else
1984 return &aes_256_xts; 1149 return &aes_256_xts;
1985#endif
1986} 1150}
1987LCRYPTO_ALIAS(EVP_aes_256_xts); 1151LCRYPTO_ALIAS(EVP_aes_256_xts);
1988 1152
@@ -2062,23 +1226,12 @@ aes_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
2062 1226
2063 if (!iv && !key) 1227 if (!iv && !key)
2064 return 1; 1228 return 1;
2065 if (key) do { 1229 if (key) {
2066#ifdef VPAES_CAPABLE
2067 if (VPAES_CAPABLE) {
2068 vpaes_set_encrypt_key(key, ctx->key_len*8, &cctx->ks);
2069 CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L,
2070 &cctx->ks, (block128_f)vpaes_encrypt);
2071 cctx->str = NULL;
2072 cctx->key_set = 1;
2073 break;
2074 }
2075#endif
2076 AES_set_encrypt_key(key, ctx->key_len * 8, &cctx->ks); 1230 AES_set_encrypt_key(key, ctx->key_len * 8, &cctx->ks);
2077 CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, 1231 CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L,
2078 &cctx->ks, (block128_f)AES_encrypt); 1232 &cctx->ks, aes_encrypt_block128);
2079 cctx->str = NULL;
2080 cctx->key_set = 1; 1233 cctx->key_set = 1;
2081 } while (0); 1234 }
2082 if (iv) { 1235 if (iv) {
2083 memcpy(ctx->iv, iv, 15 - cctx->L); 1236 memcpy(ctx->iv, iv, 15 - cctx->L);
2084 cctx->iv_set = 1; 1237 cctx->iv_set = 1;
@@ -2094,7 +1247,14 @@ aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
2094 CCM128_CONTEXT *ccm = &cctx->ccm; 1247 CCM128_CONTEXT *ccm = &cctx->ccm;
2095 1248
2096 /* If not set up, return error */ 1249 /* If not set up, return error */
2097 if (!cctx->iv_set && !cctx->key_set) 1250 if (!cctx->key_set)
1251 return -1;
1252
1253 /* EVP_*Final() doesn't return any data */
1254 if (in == NULL && out != NULL)
1255 return 0;
1256
1257 if (!cctx->iv_set)
2098 return -1; 1258 return -1;
2099 if (!ctx->encrypt && !cctx->tag_set) 1259 if (!ctx->encrypt && !cctx->tag_set)
2100 return -1; 1260 return -1;
@@ -2113,9 +1273,7 @@ aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
2113 CRYPTO_ccm128_aad(ccm, in, len); 1273 CRYPTO_ccm128_aad(ccm, in, len);
2114 return len; 1274 return len;
2115 } 1275 }
2116 /* EVP_*Final() doesn't return any data */ 1276
2117 if (!in)
2118 return 0;
2119 /* If not set length yet do it */ 1277 /* If not set length yet do it */
2120 if (!cctx->len_set) { 1278 if (!cctx->len_set) {
2121 if (CRYPTO_ccm128_setiv(ccm, ctx->iv, 15 - cctx->L, len)) 1279 if (CRYPTO_ccm128_setiv(ccm, ctx->iv, 15 - cctx->L, len))
@@ -2123,18 +1281,18 @@ aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
2123 cctx->len_set = 1; 1281 cctx->len_set = 1;
2124 } 1282 }
2125 if (ctx->encrypt) { 1283 if (ctx->encrypt) {
2126 if (cctx->str ? CRYPTO_ccm128_encrypt_ccm64(ccm, in, out, len, 1284 if (CRYPTO_ccm128_encrypt_ccm64(ccm, in, out, len,
2127 cctx->str) : CRYPTO_ccm128_encrypt(ccm, in, out, len)) 1285 aes_ccm64_encrypt_ccm128f) != 0)
2128 return -1; 1286 return -1;
2129 cctx->tag_set = 1; 1287 cctx->tag_set = 1;
2130 return len; 1288 return len;
2131 } else { 1289 } else {
2132 int rv = -1; 1290 int rv = -1;
2133 if (cctx->str ? !CRYPTO_ccm128_decrypt_ccm64(ccm, in, out, len, 1291 if (CRYPTO_ccm128_decrypt_ccm64(ccm, in, out, len,
2134 cctx->str) : !CRYPTO_ccm128_decrypt(ccm, in, out, len)) { 1292 aes_ccm64_decrypt_ccm128f) == 0) {
2135 unsigned char tag[16]; 1293 unsigned char tag[16];
2136 if (CRYPTO_ccm128_tag(ccm, tag, cctx->M)) { 1294 if (CRYPTO_ccm128_tag(ccm, tag, cctx->M)) {
2137 if (!memcmp(tag, ctx->buf, cctx->M)) 1295 if (timingsafe_memcmp(tag, ctx->buf, cctx->M) == 0)
2138 rv = len; 1296 rv = len;
2139 } 1297 }
2140 } 1298 }
@@ -2145,24 +1303,8 @@ aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
2145 cctx->len_set = 0; 1303 cctx->len_set = 0;
2146 return rv; 1304 return rv;
2147 } 1305 }
2148
2149} 1306}
2150 1307
2151#ifdef AESNI_CAPABLE
2152static const EVP_CIPHER aesni_128_ccm = {
2153 .nid = NID_aes_128_ccm,
2154 .block_size = 1,
2155 .key_len = 16,
2156 .iv_len = 12,
2157 .flags = CUSTOM_FLAGS | EVP_CIPH_CCM_MODE,
2158 .init = aesni_ccm_init_key,
2159 .do_cipher = aes_ccm_cipher,
2160 .cleanup = NULL,
2161 .ctx_size = sizeof(EVP_AES_CCM_CTX),
2162 .ctrl = aes_ccm_ctrl,
2163};
2164#endif
2165
2166static const EVP_CIPHER aes_128_ccm = { 1308static const EVP_CIPHER aes_128_ccm = {
2167 .nid = NID_aes_128_ccm, 1309 .nid = NID_aes_128_ccm,
2168 .block_size = 1, 1310 .block_size = 1,
@@ -2179,29 +1321,10 @@ static const EVP_CIPHER aes_128_ccm = {
2179const EVP_CIPHER * 1321const EVP_CIPHER *
2180EVP_aes_128_ccm(void) 1322EVP_aes_128_ccm(void)
2181{ 1323{
2182#ifdef AESNI_CAPABLE
2183 return AESNI_CAPABLE ? &aesni_128_ccm : &aes_128_ccm;
2184#else
2185 return &aes_128_ccm; 1324 return &aes_128_ccm;
2186#endif
2187} 1325}
2188LCRYPTO_ALIAS(EVP_aes_128_ccm); 1326LCRYPTO_ALIAS(EVP_aes_128_ccm);
2189 1327
2190#ifdef AESNI_CAPABLE
2191static const EVP_CIPHER aesni_192_ccm = {
2192 .nid = NID_aes_192_ccm,
2193 .block_size = 1,
2194 .key_len = 24,
2195 .iv_len = 12,
2196 .flags = CUSTOM_FLAGS | EVP_CIPH_CCM_MODE,
2197 .init = aesni_ccm_init_key,
2198 .do_cipher = aes_ccm_cipher,
2199 .cleanup = NULL,
2200 .ctx_size = sizeof(EVP_AES_CCM_CTX),
2201 .ctrl = aes_ccm_ctrl,
2202};
2203#endif
2204
2205static const EVP_CIPHER aes_192_ccm = { 1328static const EVP_CIPHER aes_192_ccm = {
2206 .nid = NID_aes_192_ccm, 1329 .nid = NID_aes_192_ccm,
2207 .block_size = 1, 1330 .block_size = 1,
@@ -2218,29 +1341,10 @@ static const EVP_CIPHER aes_192_ccm = {
2218const EVP_CIPHER * 1341const EVP_CIPHER *
2219EVP_aes_192_ccm(void) 1342EVP_aes_192_ccm(void)
2220{ 1343{
2221#ifdef AESNI_CAPABLE
2222 return AESNI_CAPABLE ? &aesni_192_ccm : &aes_192_ccm;
2223#else
2224 return &aes_192_ccm; 1344 return &aes_192_ccm;
2225#endif
2226} 1345}
2227LCRYPTO_ALIAS(EVP_aes_192_ccm); 1346LCRYPTO_ALIAS(EVP_aes_192_ccm);
2228 1347
2229#ifdef AESNI_CAPABLE
2230static const EVP_CIPHER aesni_256_ccm = {
2231 .nid = NID_aes_256_ccm,
2232 .block_size = 1,
2233 .key_len = 32,
2234 .iv_len = 12,
2235 .flags = CUSTOM_FLAGS | EVP_CIPH_CCM_MODE,
2236 .init = aesni_ccm_init_key,
2237 .do_cipher = aes_ccm_cipher,
2238 .cleanup = NULL,
2239 .ctx_size = sizeof(EVP_AES_CCM_CTX),
2240 .ctrl = aes_ccm_ctrl,
2241};
2242#endif
2243
2244static const EVP_CIPHER aes_256_ccm = { 1348static const EVP_CIPHER aes_256_ccm = {
2245 .nid = NID_aes_256_ccm, 1349 .nid = NID_aes_256_ccm,
2246 .block_size = 1, 1350 .block_size = 1,
@@ -2257,11 +1361,7 @@ static const EVP_CIPHER aes_256_ccm = {
2257const EVP_CIPHER * 1361const EVP_CIPHER *
2258EVP_aes_256_ccm(void) 1362EVP_aes_256_ccm(void)
2259{ 1363{
2260#ifdef AESNI_CAPABLE
2261 return AESNI_CAPABLE ? &aesni_256_ccm : &aes_256_ccm;
2262#else
2263 return &aes_256_ccm; 1364 return &aes_256_ccm;
2264#endif
2265} 1365}
2266LCRYPTO_ALIAS(EVP_aes_256_ccm); 1366LCRYPTO_ALIAS(EVP_aes_256_ccm);
2267 1367
@@ -2273,7 +1373,6 @@ struct aead_aes_gcm_ctx {
2273 AES_KEY ks; 1373 AES_KEY ks;
2274 } ks; 1374 } ks;
2275 GCM128_CONTEXT gcm; 1375 GCM128_CONTEXT gcm;
2276 ctr128_f ctr;
2277 unsigned char tag_len; 1376 unsigned char tag_len;
2278}; 1377};
2279 1378
@@ -2301,18 +1400,8 @@ aead_aes_gcm_init(EVP_AEAD_CTX *ctx, const unsigned char *key, size_t key_len,
2301 if ((gcm_ctx = calloc(1, sizeof(struct aead_aes_gcm_ctx))) == NULL) 1400 if ((gcm_ctx = calloc(1, sizeof(struct aead_aes_gcm_ctx))) == NULL)
2302 return 0; 1401 return 0;
2303 1402
2304#ifdef AESNI_CAPABLE 1403 AES_set_encrypt_key(key, key_bits, &gcm_ctx->ks.ks);
2305 if (AESNI_CAPABLE) { 1404 CRYPTO_gcm128_init(&gcm_ctx->gcm, &gcm_ctx->ks.ks, aes_encrypt_block128);
2306 aesni_set_encrypt_key(key, key_bits, &gcm_ctx->ks.ks);
2307 CRYPTO_gcm128_init(&gcm_ctx->gcm, &gcm_ctx->ks.ks,
2308 (block128_f)aesni_encrypt);
2309 gcm_ctx->ctr = (ctr128_f) aesni_ctr32_encrypt_blocks;
2310 } else
2311#endif
2312 {
2313 gcm_ctx->ctr = aes_gcm_set_key(&gcm_ctx->ks.ks, &gcm_ctx->gcm,
2314 key, key_len);
2315 }
2316 gcm_ctx->tag_len = tag_len; 1405 gcm_ctx->tag_len = tag_len;
2317 ctx->aead_state = gcm_ctx; 1406 ctx->aead_state = gcm_ctx;
2318 1407
@@ -2353,15 +1442,9 @@ aead_aes_gcm_seal(const EVP_AEAD_CTX *ctx, unsigned char *out, size_t *out_len,
2353 if (ad_len > 0 && CRYPTO_gcm128_aad(&gcm, ad, ad_len)) 1442 if (ad_len > 0 && CRYPTO_gcm128_aad(&gcm, ad, ad_len))
2354 return 0; 1443 return 0;
2355 1444
2356 if (gcm_ctx->ctr) { 1445 if (CRYPTO_gcm128_encrypt_ctr32(&gcm, in + bulk, out + bulk,
2357 if (CRYPTO_gcm128_encrypt_ctr32(&gcm, in + bulk, out + bulk, 1446 in_len - bulk, aes_ctr32_encrypt_ctr128f))
2358 in_len - bulk, gcm_ctx->ctr)) 1447 return 0;
2359 return 0;
2360 } else {
2361 if (CRYPTO_gcm128_encrypt(&gcm, in + bulk, out + bulk,
2362 in_len - bulk))
2363 return 0;
2364 }
2365 1448
2366 CRYPTO_gcm128_tag(&gcm, out + in_len, gcm_ctx->tag_len); 1449 CRYPTO_gcm128_tag(&gcm, out + in_len, gcm_ctx->tag_len);
2367 *out_len = in_len + gcm_ctx->tag_len; 1450 *out_len = in_len + gcm_ctx->tag_len;
@@ -2404,15 +1487,9 @@ aead_aes_gcm_open(const EVP_AEAD_CTX *ctx, unsigned char *out, size_t *out_len,
2404 if (CRYPTO_gcm128_aad(&gcm, ad, ad_len)) 1487 if (CRYPTO_gcm128_aad(&gcm, ad, ad_len))
2405 return 0; 1488 return 0;
2406 1489
2407 if (gcm_ctx->ctr) { 1490 if (CRYPTO_gcm128_decrypt_ctr32(&gcm, in + bulk, out + bulk,
2408 if (CRYPTO_gcm128_decrypt_ctr32(&gcm, in + bulk, out + bulk, 1491 in_len - bulk - gcm_ctx->tag_len, aes_ctr32_encrypt_ctr128f))
2409 in_len - bulk - gcm_ctx->tag_len, gcm_ctx->ctr)) 1492 return 0;
2410 return 0;
2411 } else {
2412 if (CRYPTO_gcm128_decrypt(&gcm, in + bulk, out + bulk,
2413 in_len - bulk - gcm_ctx->tag_len))
2414 return 0;
2415 }
2416 1493
2417 CRYPTO_gcm128_tag(&gcm, tag, gcm_ctx->tag_len); 1494 CRYPTO_gcm128_tag(&gcm, tag, gcm_ctx->tag_len);
2418 if (timingsafe_memcmp(tag, in + plaintext_len, gcm_ctx->tag_len) != 0) { 1495 if (timingsafe_memcmp(tag, in + plaintext_len, gcm_ctx->tag_len) != 0) {
diff --git a/src/lib/libcrypto/evp/e_bf.c b/src/lib/libcrypto/evp/e_bf.c
index 4f3799975b..8c32a5658e 100644
--- a/src/lib/libcrypto/evp/e_bf.c
+++ b/src/lib/libcrypto/evp/e_bf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_bf.c,v 1.19 2024/04/09 13:52:41 beck Exp $ */ 1/* $OpenBSD: e_bf.c,v 1.20 2025/05/27 03:58:12 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -162,13 +162,14 @@ static const EVP_CIPHER bf_cbc = {
162 .block_size = 8, 162 .block_size = 8,
163 .key_len = 16, 163 .key_len = 16,
164 .iv_len = 8, 164 .iv_len = 8,
165 .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CBC_MODE, 165 .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CBC_MODE |
166 EVP_CIPH_FLAG_DEFAULT_ASN1,
166 .init = bf_init_key, 167 .init = bf_init_key,
167 .do_cipher = bf_cbc_cipher, 168 .do_cipher = bf_cbc_cipher,
168 .cleanup = NULL, 169 .cleanup = NULL,
169 .ctx_size = sizeof(EVP_BF_KEY), 170 .ctx_size = sizeof(EVP_BF_KEY),
170 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 171 .set_asn1_parameters = NULL,
171 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 172 .get_asn1_parameters = NULL,
172 .ctrl = NULL, 173 .ctrl = NULL,
173}; 174};
174 175
@@ -184,13 +185,14 @@ static const EVP_CIPHER bf_cfb64 = {
184 .block_size = 1, 185 .block_size = 1,
185 .key_len = 16, 186 .key_len = 16,
186 .iv_len = 8, 187 .iv_len = 8,
187 .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CFB_MODE, 188 .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CFB_MODE |
189 EVP_CIPH_FLAG_DEFAULT_ASN1,
188 .init = bf_init_key, 190 .init = bf_init_key,
189 .do_cipher = bf_cfb64_cipher, 191 .do_cipher = bf_cfb64_cipher,
190 .cleanup = NULL, 192 .cleanup = NULL,
191 .ctx_size = sizeof(EVP_BF_KEY), 193 .ctx_size = sizeof(EVP_BF_KEY),
192 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 194 .set_asn1_parameters = NULL,
193 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 195 .get_asn1_parameters = NULL,
194 .ctrl = NULL, 196 .ctrl = NULL,
195}; 197};
196 198
@@ -206,13 +208,14 @@ static const EVP_CIPHER bf_ofb = {
206 .block_size = 1, 208 .block_size = 1,
207 .key_len = 16, 209 .key_len = 16,
208 .iv_len = 8, 210 .iv_len = 8,
209 .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_OFB_MODE, 211 .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_OFB_MODE |
212 EVP_CIPH_FLAG_DEFAULT_ASN1,
210 .init = bf_init_key, 213 .init = bf_init_key,
211 .do_cipher = bf_ofb_cipher, 214 .do_cipher = bf_ofb_cipher,
212 .cleanup = NULL, 215 .cleanup = NULL,
213 .ctx_size = sizeof(EVP_BF_KEY), 216 .ctx_size = sizeof(EVP_BF_KEY),
214 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 217 .set_asn1_parameters = NULL,
215 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 218 .get_asn1_parameters = NULL,
216 .ctrl = NULL, 219 .ctrl = NULL,
217}; 220};
218 221
@@ -228,13 +231,14 @@ static const EVP_CIPHER bf_ecb = {
228 .block_size = 8, 231 .block_size = 8,
229 .key_len = 16, 232 .key_len = 16,
230 .iv_len = 0, 233 .iv_len = 0,
231 .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_ECB_MODE, 234 .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_ECB_MODE |
235 EVP_CIPH_FLAG_DEFAULT_ASN1,
232 .init = bf_init_key, 236 .init = bf_init_key,
233 .do_cipher = bf_ecb_cipher, 237 .do_cipher = bf_ecb_cipher,
234 .cleanup = NULL, 238 .cleanup = NULL,
235 .ctx_size = sizeof(EVP_BF_KEY), 239 .ctx_size = sizeof(EVP_BF_KEY),
236 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 240 .set_asn1_parameters = NULL,
237 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 241 .get_asn1_parameters = NULL,
238 .ctrl = NULL, 242 .ctrl = NULL,
239}; 243};
240 244
diff --git a/src/lib/libcrypto/evp/e_camellia.c b/src/lib/libcrypto/evp/e_camellia.c
index 55dcc79922..8da46275a3 100644
--- a/src/lib/libcrypto/evp/e_camellia.c
+++ b/src/lib/libcrypto/evp/e_camellia.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_camellia.c,v 1.20 2024/04/09 13:52:41 beck Exp $ */ 1/* $OpenBSD: e_camellia.c,v 1.22 2025/05/27 03:58:12 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2006 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -59,9 +59,9 @@
59 59
60#ifndef OPENSSL_NO_CAMELLIA 60#ifndef OPENSSL_NO_CAMELLIA
61#include <openssl/evp.h> 61#include <openssl/evp.h>
62#include <openssl/err.h>
63#include <openssl/camellia.h> 62#include <openssl/camellia.h>
64 63
64#include "err_local.h"
65#include "evp_local.h" 65#include "evp_local.h"
66 66
67/* Camellia subkey Structure */ 67/* Camellia subkey Structure */
@@ -163,13 +163,13 @@ static const EVP_CIPHER camellia_128_cbc = {
163 .block_size = 16, 163 .block_size = 16,
164 .key_len = 16, 164 .key_len = 16,
165 .iv_len = 16, 165 .iv_len = 16,
166 .flags = 0 | EVP_CIPH_CBC_MODE, 166 .flags = EVP_CIPH_CBC_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1,
167 .init = camellia_init_key, 167 .init = camellia_init_key,
168 .do_cipher = camellia_128_cbc_cipher, 168 .do_cipher = camellia_128_cbc_cipher,
169 .cleanup = NULL, 169 .cleanup = NULL,
170 .ctx_size = sizeof(EVP_CAMELLIA_KEY), 170 .ctx_size = sizeof(EVP_CAMELLIA_KEY),
171 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 171 .set_asn1_parameters = NULL,
172 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 172 .get_asn1_parameters = NULL,
173 .ctrl = NULL, 173 .ctrl = NULL,
174}; 174};
175 175
@@ -185,13 +185,13 @@ static const EVP_CIPHER camellia_128_cfb128 = {
185 .block_size = 1, 185 .block_size = 1,
186 .key_len = 16, 186 .key_len = 16,
187 .iv_len = 16, 187 .iv_len = 16,
188 .flags = 0 | EVP_CIPH_CFB_MODE, 188 .flags = EVP_CIPH_CFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1,
189 .init = camellia_init_key, 189 .init = camellia_init_key,
190 .do_cipher = camellia_128_cfb128_cipher, 190 .do_cipher = camellia_128_cfb128_cipher,
191 .cleanup = NULL, 191 .cleanup = NULL,
192 .ctx_size = sizeof(EVP_CAMELLIA_KEY), 192 .ctx_size = sizeof(EVP_CAMELLIA_KEY),
193 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 193 .set_asn1_parameters = NULL,
194 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 194 .get_asn1_parameters = NULL,
195 .ctrl = NULL, 195 .ctrl = NULL,
196}; 196};
197 197
@@ -207,13 +207,13 @@ static const EVP_CIPHER camellia_128_ofb = {
207 .block_size = 1, 207 .block_size = 1,
208 .key_len = 16, 208 .key_len = 16,
209 .iv_len = 16, 209 .iv_len = 16,
210 .flags = 0 | EVP_CIPH_OFB_MODE, 210 .flags = EVP_CIPH_OFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1,
211 .init = camellia_init_key, 211 .init = camellia_init_key,
212 .do_cipher = camellia_128_ofb_cipher, 212 .do_cipher = camellia_128_ofb_cipher,
213 .cleanup = NULL, 213 .cleanup = NULL,
214 .ctx_size = sizeof(EVP_CAMELLIA_KEY), 214 .ctx_size = sizeof(EVP_CAMELLIA_KEY),
215 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 215 .set_asn1_parameters = NULL,
216 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 216 .get_asn1_parameters = NULL,
217 .ctrl = NULL, 217 .ctrl = NULL,
218}; 218};
219 219
@@ -229,13 +229,13 @@ static const EVP_CIPHER camellia_128_ecb = {
229 .block_size = 16, 229 .block_size = 16,
230 .key_len = 16, 230 .key_len = 16,
231 .iv_len = 0, 231 .iv_len = 0,
232 .flags = 0 | EVP_CIPH_ECB_MODE, 232 .flags = EVP_CIPH_ECB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1,
233 .init = camellia_init_key, 233 .init = camellia_init_key,
234 .do_cipher = camellia_128_ecb_cipher, 234 .do_cipher = camellia_128_ecb_cipher,
235 .cleanup = NULL, 235 .cleanup = NULL,
236 .ctx_size = sizeof(EVP_CAMELLIA_KEY), 236 .ctx_size = sizeof(EVP_CAMELLIA_KEY),
237 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 237 .set_asn1_parameters = NULL,
238 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 238 .get_asn1_parameters = NULL,
239 .ctrl = NULL, 239 .ctrl = NULL,
240}; 240};
241 241
@@ -321,13 +321,13 @@ static const EVP_CIPHER camellia_192_cbc = {
321 .block_size = 16, 321 .block_size = 16,
322 .key_len = 24, 322 .key_len = 24,
323 .iv_len = 16, 323 .iv_len = 16,
324 .flags = 0 | EVP_CIPH_CBC_MODE, 324 .flags = EVP_CIPH_CBC_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1,
325 .init = camellia_init_key, 325 .init = camellia_init_key,
326 .do_cipher = camellia_192_cbc_cipher, 326 .do_cipher = camellia_192_cbc_cipher,
327 .cleanup = NULL, 327 .cleanup = NULL,
328 .ctx_size = sizeof(EVP_CAMELLIA_KEY), 328 .ctx_size = sizeof(EVP_CAMELLIA_KEY),
329 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 329 .set_asn1_parameters = NULL,
330 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 330 .get_asn1_parameters = NULL,
331 .ctrl = NULL, 331 .ctrl = NULL,
332}; 332};
333 333
@@ -343,13 +343,13 @@ static const EVP_CIPHER camellia_192_cfb128 = {
343 .block_size = 1, 343 .block_size = 1,
344 .key_len = 24, 344 .key_len = 24,
345 .iv_len = 16, 345 .iv_len = 16,
346 .flags = 0 | EVP_CIPH_CFB_MODE, 346 .flags = EVP_CIPH_CFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1,
347 .init = camellia_init_key, 347 .init = camellia_init_key,
348 .do_cipher = camellia_192_cfb128_cipher, 348 .do_cipher = camellia_192_cfb128_cipher,
349 .cleanup = NULL, 349 .cleanup = NULL,
350 .ctx_size = sizeof(EVP_CAMELLIA_KEY), 350 .ctx_size = sizeof(EVP_CAMELLIA_KEY),
351 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 351 .set_asn1_parameters = NULL,
352 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 352 .get_asn1_parameters = NULL,
353 .ctrl = NULL, 353 .ctrl = NULL,
354}; 354};
355 355
@@ -365,13 +365,13 @@ static const EVP_CIPHER camellia_192_ofb = {
365 .block_size = 1, 365 .block_size = 1,
366 .key_len = 24, 366 .key_len = 24,
367 .iv_len = 16, 367 .iv_len = 16,
368 .flags = 0 | EVP_CIPH_OFB_MODE, 368 .flags = EVP_CIPH_OFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1,
369 .init = camellia_init_key, 369 .init = camellia_init_key,
370 .do_cipher = camellia_192_ofb_cipher, 370 .do_cipher = camellia_192_ofb_cipher,
371 .cleanup = NULL, 371 .cleanup = NULL,
372 .ctx_size = sizeof(EVP_CAMELLIA_KEY), 372 .ctx_size = sizeof(EVP_CAMELLIA_KEY),
373 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 373 .set_asn1_parameters = NULL,
374 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 374 .get_asn1_parameters = NULL,
375 .ctrl = NULL, 375 .ctrl = NULL,
376}; 376};
377 377
@@ -387,13 +387,13 @@ static const EVP_CIPHER camellia_192_ecb = {
387 .block_size = 16, 387 .block_size = 16,
388 .key_len = 24, 388 .key_len = 24,
389 .iv_len = 0, 389 .iv_len = 0,
390 .flags = 0 | EVP_CIPH_ECB_MODE, 390 .flags = EVP_CIPH_ECB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1,
391 .init = camellia_init_key, 391 .init = camellia_init_key,
392 .do_cipher = camellia_192_ecb_cipher, 392 .do_cipher = camellia_192_ecb_cipher,
393 .cleanup = NULL, 393 .cleanup = NULL,
394 .ctx_size = sizeof(EVP_CAMELLIA_KEY), 394 .ctx_size = sizeof(EVP_CAMELLIA_KEY),
395 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 395 .set_asn1_parameters = NULL,
396 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 396 .get_asn1_parameters = NULL,
397 .ctrl = NULL, 397 .ctrl = NULL,
398}; 398};
399 399
@@ -479,13 +479,13 @@ static const EVP_CIPHER camellia_256_cbc = {
479 .block_size = 16, 479 .block_size = 16,
480 .key_len = 32, 480 .key_len = 32,
481 .iv_len = 16, 481 .iv_len = 16,
482 .flags = 0 | EVP_CIPH_CBC_MODE, 482 .flags = EVP_CIPH_CBC_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1,
483 .init = camellia_init_key, 483 .init = camellia_init_key,
484 .do_cipher = camellia_256_cbc_cipher, 484 .do_cipher = camellia_256_cbc_cipher,
485 .cleanup = NULL, 485 .cleanup = NULL,
486 .ctx_size = sizeof(EVP_CAMELLIA_KEY), 486 .ctx_size = sizeof(EVP_CAMELLIA_KEY),
487 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 487 .set_asn1_parameters = NULL,
488 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 488 .get_asn1_parameters = NULL,
489 .ctrl = NULL, 489 .ctrl = NULL,
490}; 490};
491 491
@@ -501,13 +501,13 @@ static const EVP_CIPHER camellia_256_cfb128 = {
501 .block_size = 1, 501 .block_size = 1,
502 .key_len = 32, 502 .key_len = 32,
503 .iv_len = 16, 503 .iv_len = 16,
504 .flags = 0 | EVP_CIPH_CFB_MODE, 504 .flags = EVP_CIPH_CFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1,
505 .init = camellia_init_key, 505 .init = camellia_init_key,
506 .do_cipher = camellia_256_cfb128_cipher, 506 .do_cipher = camellia_256_cfb128_cipher,
507 .cleanup = NULL, 507 .cleanup = NULL,
508 .ctx_size = sizeof(EVP_CAMELLIA_KEY), 508 .ctx_size = sizeof(EVP_CAMELLIA_KEY),
509 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 509 .set_asn1_parameters = NULL,
510 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 510 .get_asn1_parameters = NULL,
511 .ctrl = NULL, 511 .ctrl = NULL,
512}; 512};
513 513
@@ -523,13 +523,13 @@ static const EVP_CIPHER camellia_256_ofb = {
523 .block_size = 1, 523 .block_size = 1,
524 .key_len = 32, 524 .key_len = 32,
525 .iv_len = 16, 525 .iv_len = 16,
526 .flags = 0 | EVP_CIPH_OFB_MODE, 526 .flags = EVP_CIPH_OFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1,
527 .init = camellia_init_key, 527 .init = camellia_init_key,
528 .do_cipher = camellia_256_ofb_cipher, 528 .do_cipher = camellia_256_ofb_cipher,
529 .cleanup = NULL, 529 .cleanup = NULL,
530 .ctx_size = sizeof(EVP_CAMELLIA_KEY), 530 .ctx_size = sizeof(EVP_CAMELLIA_KEY),
531 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 531 .set_asn1_parameters = NULL,
532 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 532 .get_asn1_parameters = NULL,
533 .ctrl = NULL, 533 .ctrl = NULL,
534}; 534};
535 535
@@ -545,13 +545,13 @@ static const EVP_CIPHER camellia_256_ecb = {
545 .block_size = 16, 545 .block_size = 16,
546 .key_len = 32, 546 .key_len = 32,
547 .iv_len = 0, 547 .iv_len = 0,
548 .flags = 0 | EVP_CIPH_ECB_MODE, 548 .flags = EVP_CIPH_ECB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1,
549 .init = camellia_init_key, 549 .init = camellia_init_key,
550 .do_cipher = camellia_256_ecb_cipher, 550 .do_cipher = camellia_256_ecb_cipher,
551 .cleanup = NULL, 551 .cleanup = NULL,
552 .ctx_size = sizeof(EVP_CAMELLIA_KEY), 552 .ctx_size = sizeof(EVP_CAMELLIA_KEY),
553 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 553 .set_asn1_parameters = NULL,
554 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 554 .get_asn1_parameters = NULL,
555 .ctrl = NULL, 555 .ctrl = NULL,
556}; 556};
557 557
@@ -589,13 +589,13 @@ static const EVP_CIPHER camellia_128_cfb1 = {
589 .block_size = 1, 589 .block_size = 1,
590 .key_len = 128/8, 590 .key_len = 128/8,
591 .iv_len = 16, 591 .iv_len = 16,
592 .flags = 0 | EVP_CIPH_CFB_MODE, 592 .flags = EVP_CIPH_CFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1,
593 .init = camellia_init_key, 593 .init = camellia_init_key,
594 .do_cipher = camellia_128_cfb1_cipher, 594 .do_cipher = camellia_128_cfb1_cipher,
595 .cleanup = NULL, 595 .cleanup = NULL,
596 .ctx_size = sizeof(EVP_CAMELLIA_KEY), 596 .ctx_size = sizeof(EVP_CAMELLIA_KEY),
597 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 597 .set_asn1_parameters = NULL,
598 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 598 .get_asn1_parameters = NULL,
599 .ctrl = NULL, 599 .ctrl = NULL,
600}; 600};
601 601
@@ -633,13 +633,13 @@ static const EVP_CIPHER camellia_192_cfb1 = {
633 .block_size = 1, 633 .block_size = 1,
634 .key_len = 192/8, 634 .key_len = 192/8,
635 .iv_len = 16, 635 .iv_len = 16,
636 .flags = 0 | EVP_CIPH_CFB_MODE, 636 .flags = EVP_CIPH_CFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1,
637 .init = camellia_init_key, 637 .init = camellia_init_key,
638 .do_cipher = camellia_192_cfb1_cipher, 638 .do_cipher = camellia_192_cfb1_cipher,
639 .cleanup = NULL, 639 .cleanup = NULL,
640 .ctx_size = sizeof(EVP_CAMELLIA_KEY), 640 .ctx_size = sizeof(EVP_CAMELLIA_KEY),
641 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 641 .set_asn1_parameters = NULL,
642 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 642 .get_asn1_parameters = NULL,
643 .ctrl = NULL, 643 .ctrl = NULL,
644}; 644};
645 645
@@ -677,13 +677,13 @@ static const EVP_CIPHER camellia_256_cfb1 = {
677 .block_size = 1, 677 .block_size = 1,
678 .key_len = 256/8, 678 .key_len = 256/8,
679 .iv_len = 16, 679 .iv_len = 16,
680 .flags = 0 | EVP_CIPH_CFB_MODE, 680 .flags = EVP_CIPH_CFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1,
681 .init = camellia_init_key, 681 .init = camellia_init_key,
682 .do_cipher = camellia_256_cfb1_cipher, 682 .do_cipher = camellia_256_cfb1_cipher,
683 .cleanup = NULL, 683 .cleanup = NULL,
684 .ctx_size = sizeof(EVP_CAMELLIA_KEY), 684 .ctx_size = sizeof(EVP_CAMELLIA_KEY),
685 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 685 .set_asn1_parameters = NULL,
686 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 686 .get_asn1_parameters = NULL,
687 .ctrl = NULL, 687 .ctrl = NULL,
688}; 688};
689 689
@@ -720,13 +720,13 @@ static const EVP_CIPHER camellia_128_cfb8 = {
720 .block_size = 1, 720 .block_size = 1,
721 .key_len = 128/8, 721 .key_len = 128/8,
722 .iv_len = 16, 722 .iv_len = 16,
723 .flags = 0 | EVP_CIPH_CFB_MODE, 723 .flags = EVP_CIPH_CFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1,
724 .init = camellia_init_key, 724 .init = camellia_init_key,
725 .do_cipher = camellia_128_cfb8_cipher, 725 .do_cipher = camellia_128_cfb8_cipher,
726 .cleanup = NULL, 726 .cleanup = NULL,
727 .ctx_size = sizeof(EVP_CAMELLIA_KEY), 727 .ctx_size = sizeof(EVP_CAMELLIA_KEY),
728 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 728 .set_asn1_parameters = NULL,
729 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 729 .get_asn1_parameters = NULL,
730 .ctrl = NULL, 730 .ctrl = NULL,
731}; 731};
732 732
@@ -762,13 +762,13 @@ static const EVP_CIPHER camellia_192_cfb8 = {
762 .block_size = 1, 762 .block_size = 1,
763 .key_len = 192/8, 763 .key_len = 192/8,
764 .iv_len = 16, 764 .iv_len = 16,
765 .flags = 0 | EVP_CIPH_CFB_MODE, 765 .flags = EVP_CIPH_CFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1,
766 .init = camellia_init_key, 766 .init = camellia_init_key,
767 .do_cipher = camellia_192_cfb8_cipher, 767 .do_cipher = camellia_192_cfb8_cipher,
768 .cleanup = NULL, 768 .cleanup = NULL,
769 .ctx_size = sizeof(EVP_CAMELLIA_KEY), 769 .ctx_size = sizeof(EVP_CAMELLIA_KEY),
770 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 770 .set_asn1_parameters = NULL,
771 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 771 .get_asn1_parameters = NULL,
772 .ctrl = NULL, 772 .ctrl = NULL,
773}; 773};
774 774
@@ -804,13 +804,13 @@ static const EVP_CIPHER camellia_256_cfb8 = {
804 .block_size = 1, 804 .block_size = 1,
805 .key_len = 256/8, 805 .key_len = 256/8,
806 .iv_len = 16, 806 .iv_len = 16,
807 .flags = 0 | EVP_CIPH_CFB_MODE, 807 .flags = EVP_CIPH_CFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1,
808 .init = camellia_init_key, 808 .init = camellia_init_key,
809 .do_cipher = camellia_256_cfb8_cipher, 809 .do_cipher = camellia_256_cfb8_cipher,
810 .cleanup = NULL, 810 .cleanup = NULL,
811 .ctx_size = sizeof(EVP_CAMELLIA_KEY), 811 .ctx_size = sizeof(EVP_CAMELLIA_KEY),
812 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 812 .set_asn1_parameters = NULL,
813 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 813 .get_asn1_parameters = NULL,
814 .ctrl = NULL, 814 .ctrl = NULL,
815}; 815};
816 816
diff --git a/src/lib/libcrypto/evp/e_cast.c b/src/lib/libcrypto/evp/e_cast.c
index 1575a7a5bb..283cb8cf63 100644
--- a/src/lib/libcrypto/evp/e_cast.c
+++ b/src/lib/libcrypto/evp/e_cast.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_cast.c,v 1.18 2024/04/09 13:52:41 beck Exp $ */ 1/* $OpenBSD: e_cast.c,v 1.19 2025/05/27 03:58:12 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -162,13 +162,14 @@ static const EVP_CIPHER cast5_cbc = {
162 .block_size = 8, 162 .block_size = 8,
163 .key_len = CAST_KEY_LENGTH, 163 .key_len = CAST_KEY_LENGTH,
164 .iv_len = 8, 164 .iv_len = 8,
165 .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CBC_MODE, 165 .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CBC_MODE |
166 EVP_CIPH_FLAG_DEFAULT_ASN1,
166 .init = cast_init_key, 167 .init = cast_init_key,
167 .do_cipher = cast5_cbc_cipher, 168 .do_cipher = cast5_cbc_cipher,
168 .cleanup = NULL, 169 .cleanup = NULL,
169 .ctx_size = sizeof(EVP_CAST_KEY), 170 .ctx_size = sizeof(EVP_CAST_KEY),
170 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 171 .set_asn1_parameters = NULL,
171 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 172 .get_asn1_parameters = NULL,
172 .ctrl = NULL, 173 .ctrl = NULL,
173}; 174};
174 175
@@ -184,13 +185,14 @@ static const EVP_CIPHER cast5_cfb64 = {
184 .block_size = 1, 185 .block_size = 1,
185 .key_len = CAST_KEY_LENGTH, 186 .key_len = CAST_KEY_LENGTH,
186 .iv_len = 8, 187 .iv_len = 8,
187 .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CFB_MODE, 188 .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CFB_MODE |
189 EVP_CIPH_FLAG_DEFAULT_ASN1,
188 .init = cast_init_key, 190 .init = cast_init_key,
189 .do_cipher = cast5_cfb64_cipher, 191 .do_cipher = cast5_cfb64_cipher,
190 .cleanup = NULL, 192 .cleanup = NULL,
191 .ctx_size = sizeof(EVP_CAST_KEY), 193 .ctx_size = sizeof(EVP_CAST_KEY),
192 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 194 .set_asn1_parameters = NULL,
193 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 195 .get_asn1_parameters = NULL,
194 .ctrl = NULL, 196 .ctrl = NULL,
195}; 197};
196 198
@@ -206,13 +208,14 @@ static const EVP_CIPHER cast5_ofb = {
206 .block_size = 1, 208 .block_size = 1,
207 .key_len = CAST_KEY_LENGTH, 209 .key_len = CAST_KEY_LENGTH,
208 .iv_len = 8, 210 .iv_len = 8,
209 .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_OFB_MODE, 211 .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_OFB_MODE |
212 EVP_CIPH_FLAG_DEFAULT_ASN1,
210 .init = cast_init_key, 213 .init = cast_init_key,
211 .do_cipher = cast5_ofb_cipher, 214 .do_cipher = cast5_ofb_cipher,
212 .cleanup = NULL, 215 .cleanup = NULL,
213 .ctx_size = sizeof(EVP_CAST_KEY), 216 .ctx_size = sizeof(EVP_CAST_KEY),
214 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 217 .set_asn1_parameters = NULL,
215 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 218 .get_asn1_parameters = NULL,
216 .ctrl = NULL, 219 .ctrl = NULL,
217}; 220};
218 221
@@ -228,13 +231,14 @@ static const EVP_CIPHER cast5_ecb = {
228 .block_size = 8, 231 .block_size = 8,
229 .key_len = CAST_KEY_LENGTH, 232 .key_len = CAST_KEY_LENGTH,
230 .iv_len = 0, 233 .iv_len = 0,
231 .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_ECB_MODE, 234 .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_ECB_MODE |
235 EVP_CIPH_FLAG_DEFAULT_ASN1,
232 .init = cast_init_key, 236 .init = cast_init_key,
233 .do_cipher = cast5_ecb_cipher, 237 .do_cipher = cast5_ecb_cipher,
234 .cleanup = NULL, 238 .cleanup = NULL,
235 .ctx_size = sizeof(EVP_CAST_KEY), 239 .ctx_size = sizeof(EVP_CAST_KEY),
236 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 240 .set_asn1_parameters = NULL,
237 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 241 .get_asn1_parameters = NULL,
238 .ctrl = NULL, 242 .ctrl = NULL,
239}; 243};
240 244
diff --git a/src/lib/libcrypto/evp/e_chacha20poly1305.c b/src/lib/libcrypto/evp/e_chacha20poly1305.c
index d176569f90..d3a1e44875 100644
--- a/src/lib/libcrypto/evp/e_chacha20poly1305.c
+++ b/src/lib/libcrypto/evp/e_chacha20poly1305.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_chacha20poly1305.c,v 1.37 2024/12/20 20:05:29 schwarze Exp $ */ 1/* $OpenBSD: e_chacha20poly1305.c,v 1.38 2025/05/10 05:54:38 tb Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2022 Joel Sing <jsing@openbsd.org> 4 * Copyright (c) 2022 Joel Sing <jsing@openbsd.org>
@@ -26,12 +26,12 @@
26 26
27#if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305) 27#if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305)
28 28
29#include <openssl/err.h>
30#include <openssl/evp.h> 29#include <openssl/evp.h>
31#include <openssl/chacha.h> 30#include <openssl/chacha.h>
32#include <openssl/poly1305.h> 31#include <openssl/poly1305.h>
33 32
34#include "bytestring.h" 33#include "bytestring.h"
34#include "err_local.h"
35#include "evp_local.h" 35#include "evp_local.h"
36 36
37#define POLY1305_TAG_LEN 16 37#define POLY1305_TAG_LEN 16
diff --git a/src/lib/libcrypto/evp/e_des.c b/src/lib/libcrypto/evp/e_des.c
index fb335e95b1..680f77a723 100644
--- a/src/lib/libcrypto/evp/e_des.c
+++ b/src/lib/libcrypto/evp/e_des.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_des.c,v 1.24 2024/04/09 13:52:41 beck Exp $ */ 1/* $OpenBSD: e_des.c,v 1.25 2025/05/27 03:58:12 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -226,13 +226,14 @@ static const EVP_CIPHER des_cbc = {
226 .block_size = 8, 226 .block_size = 8,
227 .key_len = 8, 227 .key_len = 8,
228 .iv_len = 8, 228 .iv_len = 8,
229 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CBC_MODE, 229 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CBC_MODE |
230 EVP_CIPH_FLAG_DEFAULT_ASN1,
230 .init = des_init_key, 231 .init = des_init_key,
231 .do_cipher = des_cbc_cipher, 232 .do_cipher = des_cbc_cipher,
232 .cleanup = NULL, 233 .cleanup = NULL,
233 .ctx_size = sizeof(DES_key_schedule), 234 .ctx_size = sizeof(DES_key_schedule),
234 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 235 .set_asn1_parameters = NULL,
235 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 236 .get_asn1_parameters = NULL,
236 .ctrl = des_ctrl, 237 .ctrl = des_ctrl,
237}; 238};
238 239
@@ -248,13 +249,14 @@ static const EVP_CIPHER des_cfb64 = {
248 .block_size = 1, 249 .block_size = 1,
249 .key_len = 8, 250 .key_len = 8,
250 .iv_len = 8, 251 .iv_len = 8,
251 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE, 252 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE |
253 EVP_CIPH_FLAG_DEFAULT_ASN1,
252 .init = des_init_key, 254 .init = des_init_key,
253 .do_cipher = des_cfb64_cipher, 255 .do_cipher = des_cfb64_cipher,
254 .cleanup = NULL, 256 .cleanup = NULL,
255 .ctx_size = sizeof(DES_key_schedule), 257 .ctx_size = sizeof(DES_key_schedule),
256 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 258 .set_asn1_parameters = NULL,
257 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 259 .get_asn1_parameters = NULL,
258 .ctrl = des_ctrl, 260 .ctrl = des_ctrl,
259}; 261};
260 262
@@ -270,13 +272,14 @@ static const EVP_CIPHER des_ofb = {
270 .block_size = 1, 272 .block_size = 1,
271 .key_len = 8, 273 .key_len = 8,
272 .iv_len = 8, 274 .iv_len = 8,
273 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_OFB_MODE, 275 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_OFB_MODE |
276 EVP_CIPH_FLAG_DEFAULT_ASN1,
274 .init = des_init_key, 277 .init = des_init_key,
275 .do_cipher = des_ofb_cipher, 278 .do_cipher = des_ofb_cipher,
276 .cleanup = NULL, 279 .cleanup = NULL,
277 .ctx_size = sizeof(DES_key_schedule), 280 .ctx_size = sizeof(DES_key_schedule),
278 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 281 .set_asn1_parameters = NULL,
279 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 282 .get_asn1_parameters = NULL,
280 .ctrl = des_ctrl, 283 .ctrl = des_ctrl,
281}; 284};
282 285
@@ -292,13 +295,14 @@ static const EVP_CIPHER des_ecb = {
292 .block_size = 8, 295 .block_size = 8,
293 .key_len = 8, 296 .key_len = 8,
294 .iv_len = 0, 297 .iv_len = 0,
295 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_ECB_MODE, 298 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_ECB_MODE |
299 EVP_CIPH_FLAG_DEFAULT_ASN1,
296 .init = des_init_key, 300 .init = des_init_key,
297 .do_cipher = des_ecb_cipher, 301 .do_cipher = des_ecb_cipher,
298 .cleanup = NULL, 302 .cleanup = NULL,
299 .ctx_size = sizeof(DES_key_schedule), 303 .ctx_size = sizeof(DES_key_schedule),
300 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 304 .set_asn1_parameters = NULL,
301 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 305 .get_asn1_parameters = NULL,
302 .ctrl = des_ctrl, 306 .ctrl = des_ctrl,
303}; 307};
304 308
@@ -314,13 +318,14 @@ static const EVP_CIPHER des_cfb1 = {
314 .block_size = 1, 318 .block_size = 1,
315 .key_len = 8, 319 .key_len = 8,
316 .iv_len = 8, 320 .iv_len = 8,
317 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE, 321 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE |
322 EVP_CIPH_FLAG_DEFAULT_ASN1,
318 .init = des_init_key, 323 .init = des_init_key,
319 .do_cipher = des_cfb1_cipher, 324 .do_cipher = des_cfb1_cipher,
320 .cleanup = NULL, 325 .cleanup = NULL,
321 .ctx_size = sizeof(DES_key_schedule), 326 .ctx_size = sizeof(DES_key_schedule),
322 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 327 .set_asn1_parameters = NULL,
323 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 328 .get_asn1_parameters = NULL,
324 .ctrl = des_ctrl, 329 .ctrl = des_ctrl,
325}; 330};
326 331
@@ -336,13 +341,14 @@ static const EVP_CIPHER des_cfb8 = {
336 .block_size = 1, 341 .block_size = 1,
337 .key_len = 8, 342 .key_len = 8,
338 .iv_len = 8, 343 .iv_len = 8,
339 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE, 344 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE |
345 EVP_CIPH_FLAG_DEFAULT_ASN1,
340 .init = des_init_key, 346 .init = des_init_key,
341 .do_cipher = des_cfb8_cipher, 347 .do_cipher = des_cfb8_cipher,
342 .cleanup = NULL, 348 .cleanup = NULL,
343 .ctx_size = sizeof(DES_key_schedule), 349 .ctx_size = sizeof(DES_key_schedule),
344 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 350 .set_asn1_parameters = NULL,
345 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 351 .get_asn1_parameters = NULL,
346 .ctrl = des_ctrl, 352 .ctrl = des_ctrl,
347}; 353};
348 354
diff --git a/src/lib/libcrypto/evp/e_des3.c b/src/lib/libcrypto/evp/e_des3.c
index 48fbcdb366..f3eb4cce1b 100644
--- a/src/lib/libcrypto/evp/e_des3.c
+++ b/src/lib/libcrypto/evp/e_des3.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_des3.c,v 1.30 2024/04/09 13:52:41 beck Exp $ */ 1/* $OpenBSD: e_des3.c,v 1.31 2025/05/27 03:58:12 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -258,13 +258,14 @@ static const EVP_CIPHER des_ede_cbc = {
258 .block_size = 8, 258 .block_size = 8,
259 .key_len = 16, 259 .key_len = 16,
260 .iv_len = 8, 260 .iv_len = 8,
261 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CBC_MODE, 261 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CBC_MODE |
262 EVP_CIPH_FLAG_DEFAULT_ASN1,
262 .init = des_ede_init_key, 263 .init = des_ede_init_key,
263 .do_cipher = des_ede_cbc_cipher, 264 .do_cipher = des_ede_cbc_cipher,
264 .cleanup = NULL, 265 .cleanup = NULL,
265 .ctx_size = sizeof(DES_EDE_KEY), 266 .ctx_size = sizeof(DES_EDE_KEY),
266 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 267 .set_asn1_parameters = NULL,
267 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 268 .get_asn1_parameters = NULL,
268 .ctrl = des3_ctrl, 269 .ctrl = des3_ctrl,
269}; 270};
270 271
@@ -280,13 +281,14 @@ static const EVP_CIPHER des_ede_cfb64 = {
280 .block_size = 1, 281 .block_size = 1,
281 .key_len = 16, 282 .key_len = 16,
282 .iv_len = 8, 283 .iv_len = 8,
283 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE, 284 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE |
285 EVP_CIPH_FLAG_DEFAULT_ASN1,
284 .init = des_ede_init_key, 286 .init = des_ede_init_key,
285 .do_cipher = des_ede_cfb64_cipher, 287 .do_cipher = des_ede_cfb64_cipher,
286 .cleanup = NULL, 288 .cleanup = NULL,
287 .ctx_size = sizeof(DES_EDE_KEY), 289 .ctx_size = sizeof(DES_EDE_KEY),
288 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 290 .set_asn1_parameters = NULL,
289 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 291 .get_asn1_parameters = NULL,
290 .ctrl = des3_ctrl, 292 .ctrl = des3_ctrl,
291}; 293};
292 294
@@ -307,8 +309,8 @@ static const EVP_CIPHER des_ede_ofb = {
307 .do_cipher = des_ede_ofb_cipher, 309 .do_cipher = des_ede_ofb_cipher,
308 .cleanup = NULL, 310 .cleanup = NULL,
309 .ctx_size = sizeof(DES_EDE_KEY), 311 .ctx_size = sizeof(DES_EDE_KEY),
310 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 312 .set_asn1_parameters = NULL,
311 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 313 .get_asn1_parameters = NULL,
312 .ctrl = des3_ctrl, 314 .ctrl = des3_ctrl,
313}; 315};
314 316
@@ -324,13 +326,14 @@ static const EVP_CIPHER des_ede_ecb = {
324 .block_size = 8, 326 .block_size = 8,
325 .key_len = 16, 327 .key_len = 16,
326 .iv_len = 0, 328 .iv_len = 0,
327 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_ECB_MODE, 329 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_ECB_MODE |
330 EVP_CIPH_FLAG_DEFAULT_ASN1,
328 .init = des_ede_init_key, 331 .init = des_ede_init_key,
329 .do_cipher = des_ede_ecb_cipher, 332 .do_cipher = des_ede_ecb_cipher,
330 .cleanup = NULL, 333 .cleanup = NULL,
331 .ctx_size = sizeof(DES_EDE_KEY), 334 .ctx_size = sizeof(DES_EDE_KEY),
332 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 335 .set_asn1_parameters = NULL,
333 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 336 .get_asn1_parameters = NULL,
334 .ctrl = des3_ctrl, 337 .ctrl = des3_ctrl,
335}; 338};
336 339
@@ -352,13 +355,14 @@ static const EVP_CIPHER des_ede3_cbc = {
352 .block_size = 8, 355 .block_size = 8,
353 .key_len = 24, 356 .key_len = 24,
354 .iv_len = 8, 357 .iv_len = 8,
355 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CBC_MODE, 358 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CBC_MODE |
359 EVP_CIPH_FLAG_DEFAULT_ASN1,
356 .init = des_ede3_init_key, 360 .init = des_ede3_init_key,
357 .do_cipher = des_ede3_cbc_cipher, 361 .do_cipher = des_ede3_cbc_cipher,
358 .cleanup = NULL, 362 .cleanup = NULL,
359 .ctx_size = sizeof(DES_EDE_KEY), 363 .ctx_size = sizeof(DES_EDE_KEY),
360 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 364 .set_asn1_parameters = NULL,
361 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 365 .get_asn1_parameters = NULL,
362 .ctrl = des3_ctrl, 366 .ctrl = des3_ctrl,
363}; 367};
364 368
@@ -374,13 +378,14 @@ static const EVP_CIPHER des_ede3_cfb64 = {
374 .block_size = 1, 378 .block_size = 1,
375 .key_len = 24, 379 .key_len = 24,
376 .iv_len = 8, 380 .iv_len = 8,
377 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE, 381 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE |
382 EVP_CIPH_FLAG_DEFAULT_ASN1,
378 .init = des_ede3_init_key, 383 .init = des_ede3_init_key,
379 .do_cipher = des_ede3_cfb64_cipher, 384 .do_cipher = des_ede3_cfb64_cipher,
380 .cleanup = NULL, 385 .cleanup = NULL,
381 .ctx_size = sizeof(DES_EDE_KEY), 386 .ctx_size = sizeof(DES_EDE_KEY),
382 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 387 .set_asn1_parameters = NULL,
383 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 388 .get_asn1_parameters = NULL,
384 .ctrl = des3_ctrl, 389 .ctrl = des3_ctrl,
385}; 390};
386 391
@@ -396,13 +401,14 @@ static const EVP_CIPHER des_ede3_ofb = {
396 .block_size = 1, 401 .block_size = 1,
397 .key_len = 24, 402 .key_len = 24,
398 .iv_len = 8, 403 .iv_len = 8,
399 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_OFB_MODE, 404 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_OFB_MODE |
405 EVP_CIPH_FLAG_DEFAULT_ASN1,
400 .init = des_ede3_init_key, 406 .init = des_ede3_init_key,
401 .do_cipher = des_ede3_ofb_cipher, 407 .do_cipher = des_ede3_ofb_cipher,
402 .cleanup = NULL, 408 .cleanup = NULL,
403 .ctx_size = sizeof(DES_EDE_KEY), 409 .ctx_size = sizeof(DES_EDE_KEY),
404 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 410 .set_asn1_parameters = NULL,
405 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 411 .get_asn1_parameters = NULL,
406 .ctrl = des3_ctrl, 412 .ctrl = des3_ctrl,
407}; 413};
408 414
@@ -418,13 +424,14 @@ static const EVP_CIPHER des_ede3_ecb = {
418 .block_size = 8, 424 .block_size = 8,
419 .key_len = 24, 425 .key_len = 24,
420 .iv_len = 0, 426 .iv_len = 0,
421 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_ECB_MODE, 427 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_ECB_MODE |
428 EVP_CIPH_FLAG_DEFAULT_ASN1,
422 .init = des_ede3_init_key, 429 .init = des_ede3_init_key,
423 .do_cipher = des_ede3_ecb_cipher, 430 .do_cipher = des_ede3_ecb_cipher,
424 .cleanup = NULL, 431 .cleanup = NULL,
425 .ctx_size = sizeof(DES_EDE_KEY), 432 .ctx_size = sizeof(DES_EDE_KEY),
426 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 433 .set_asn1_parameters = NULL,
427 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 434 .get_asn1_parameters = NULL,
428 .ctrl = des3_ctrl, 435 .ctrl = des3_ctrl,
429}; 436};
430 437
@@ -441,13 +448,14 @@ static const EVP_CIPHER des_ede3_cfb1 = {
441 .block_size = 1, 448 .block_size = 1,
442 .key_len = 24, 449 .key_len = 24,
443 .iv_len = 8, 450 .iv_len = 8,
444 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE, 451 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE |
452 EVP_CIPH_FLAG_DEFAULT_ASN1,
445 .init = des_ede3_init_key, 453 .init = des_ede3_init_key,
446 .do_cipher = des_ede3_cfb1_cipher, 454 .do_cipher = des_ede3_cfb1_cipher,
447 .cleanup = NULL, 455 .cleanup = NULL,
448 .ctx_size = sizeof(DES_EDE_KEY), 456 .ctx_size = sizeof(DES_EDE_KEY),
449 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 457 .set_asn1_parameters = NULL,
450 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 458 .get_asn1_parameters = NULL,
451 .ctrl = des3_ctrl, 459 .ctrl = des3_ctrl,
452}; 460};
453 461
@@ -464,13 +472,14 @@ static const EVP_CIPHER des_ede3_cfb8 = {
464 .block_size = 1, 472 .block_size = 1,
465 .key_len = 24, 473 .key_len = 24,
466 .iv_len = 8, 474 .iv_len = 8,
467 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE, 475 .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE |
476 EVP_CIPH_FLAG_DEFAULT_ASN1,
468 .init = des_ede3_init_key, 477 .init = des_ede3_init_key,
469 .do_cipher = des_ede3_cfb8_cipher, 478 .do_cipher = des_ede3_cfb8_cipher,
470 .cleanup = NULL, 479 .cleanup = NULL,
471 .ctx_size = sizeof(DES_EDE_KEY), 480 .ctx_size = sizeof(DES_EDE_KEY),
472 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 481 .set_asn1_parameters = NULL,
473 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 482 .get_asn1_parameters = NULL,
474 .ctrl = des3_ctrl, 483 .ctrl = des3_ctrl,
475}; 484};
476 485
diff --git a/src/lib/libcrypto/evp/e_idea.c b/src/lib/libcrypto/evp/e_idea.c
index 86cf77602a..5d33a110fd 100644
--- a/src/lib/libcrypto/evp/e_idea.c
+++ b/src/lib/libcrypto/evp/e_idea.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_idea.c,v 1.22 2024/04/09 13:52:41 beck Exp $ */ 1/* $OpenBSD: e_idea.c,v 1.23 2025/05/27 03:58:12 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -181,13 +181,13 @@ static const EVP_CIPHER idea_cbc = {
181 .block_size = 8, 181 .block_size = 8,
182 .key_len = 16, 182 .key_len = 16,
183 .iv_len = 8, 183 .iv_len = 8,
184 .flags = 0 | EVP_CIPH_CBC_MODE, 184 .flags = EVP_CIPH_CBC_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1,
185 .init = idea_init_key, 185 .init = idea_init_key,
186 .do_cipher = idea_cbc_cipher, 186 .do_cipher = idea_cbc_cipher,
187 .cleanup = NULL, 187 .cleanup = NULL,
188 .ctx_size = sizeof(IDEA_KEY_SCHEDULE), 188 .ctx_size = sizeof(IDEA_KEY_SCHEDULE),
189 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 189 .set_asn1_parameters = NULL,
190 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 190 .get_asn1_parameters = NULL,
191 .ctrl = NULL, 191 .ctrl = NULL,
192}; 192};
193 193
@@ -203,13 +203,13 @@ static const EVP_CIPHER idea_cfb64 = {
203 .block_size = 1, 203 .block_size = 1,
204 .key_len = 16, 204 .key_len = 16,
205 .iv_len = 8, 205 .iv_len = 8,
206 .flags = 0 | EVP_CIPH_CFB_MODE, 206 .flags = EVP_CIPH_CFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1,
207 .init = idea_init_key, 207 .init = idea_init_key,
208 .do_cipher = idea_cfb64_cipher, 208 .do_cipher = idea_cfb64_cipher,
209 .cleanup = NULL, 209 .cleanup = NULL,
210 .ctx_size = sizeof(IDEA_KEY_SCHEDULE), 210 .ctx_size = sizeof(IDEA_KEY_SCHEDULE),
211 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 211 .set_asn1_parameters = NULL,
212 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 212 .get_asn1_parameters = NULL,
213 .ctrl = NULL, 213 .ctrl = NULL,
214}; 214};
215 215
@@ -225,13 +225,13 @@ static const EVP_CIPHER idea_ofb = {
225 .block_size = 1, 225 .block_size = 1,
226 .key_len = 16, 226 .key_len = 16,
227 .iv_len = 8, 227 .iv_len = 8,
228 .flags = 0 | EVP_CIPH_OFB_MODE, 228 .flags = EVP_CIPH_OFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1,
229 .init = idea_init_key, 229 .init = idea_init_key,
230 .do_cipher = idea_ofb_cipher, 230 .do_cipher = idea_ofb_cipher,
231 .cleanup = NULL, 231 .cleanup = NULL,
232 .ctx_size = sizeof(IDEA_KEY_SCHEDULE), 232 .ctx_size = sizeof(IDEA_KEY_SCHEDULE),
233 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 233 .set_asn1_parameters = NULL,
234 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 234 .get_asn1_parameters = NULL,
235 .ctrl = NULL, 235 .ctrl = NULL,
236}; 236};
237 237
@@ -247,13 +247,13 @@ static const EVP_CIPHER idea_ecb = {
247 .block_size = 8, 247 .block_size = 8,
248 .key_len = 16, 248 .key_len = 16,
249 .iv_len = 0, 249 .iv_len = 0,
250 .flags = 0 | EVP_CIPH_ECB_MODE, 250 .flags = EVP_CIPH_ECB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1,
251 .init = idea_init_key, 251 .init = idea_init_key,
252 .do_cipher = idea_ecb_cipher, 252 .do_cipher = idea_ecb_cipher,
253 .cleanup = NULL, 253 .cleanup = NULL,
254 .ctx_size = sizeof(IDEA_KEY_SCHEDULE), 254 .ctx_size = sizeof(IDEA_KEY_SCHEDULE),
255 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 255 .set_asn1_parameters = NULL,
256 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 256 .get_asn1_parameters = NULL,
257 .ctrl = NULL, 257 .ctrl = NULL,
258}; 258};
259 259
diff --git a/src/lib/libcrypto/evp/e_rc2.c b/src/lib/libcrypto/evp/e_rc2.c
index dc404cff20..b7ba60297a 100644
--- a/src/lib/libcrypto/evp/e_rc2.c
+++ b/src/lib/libcrypto/evp/e_rc2.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_rc2.c,v 1.29 2024/04/09 13:52:41 beck Exp $ */ 1/* $OpenBSD: e_rc2.c,v 1.30 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -63,11 +63,11 @@
63 63
64#ifndef OPENSSL_NO_RC2 64#ifndef OPENSSL_NO_RC2
65 65
66#include <openssl/err.h>
67#include <openssl/evp.h> 66#include <openssl/evp.h>
68#include <openssl/objects.h> 67#include <openssl/objects.h>
69#include <openssl/rc2.h> 68#include <openssl/rc2.h>
70 69
70#include "err_local.h"
71#include "evp_local.h" 71#include "evp_local.h"
72 72
73static int rc2_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 73static int rc2_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
diff --git a/src/lib/libcrypto/evp/e_xcbc_d.c b/src/lib/libcrypto/evp/e_xcbc_d.c
index 1e3bee0791..1c5e6c32b2 100644
--- a/src/lib/libcrypto/evp/e_xcbc_d.c
+++ b/src/lib/libcrypto/evp/e_xcbc_d.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_xcbc_d.c,v 1.18 2024/04/09 13:52:41 beck Exp $ */ 1/* $OpenBSD: e_xcbc_d.c,v 1.19 2025/05/27 03:58:12 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -88,13 +88,13 @@ static const EVP_CIPHER d_xcbc_cipher = {
88 .block_size = 8, 88 .block_size = 8,
89 .key_len = 24, 89 .key_len = 24,
90 .iv_len = 8, 90 .iv_len = 8,
91 .flags = EVP_CIPH_CBC_MODE, 91 .flags = EVP_CIPH_CBC_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1,
92 .init = desx_cbc_init_key, 92 .init = desx_cbc_init_key,
93 .do_cipher = desx_cbc_cipher, 93 .do_cipher = desx_cbc_cipher,
94 .cleanup = NULL, 94 .cleanup = NULL,
95 .ctx_size = sizeof(DESX_CBC_KEY), 95 .ctx_size = sizeof(DESX_CBC_KEY),
96 .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, 96 .set_asn1_parameters = NULL,
97 .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, 97 .get_asn1_parameters = NULL,
98 .ctrl = NULL, 98 .ctrl = NULL,
99}; 99};
100 100
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h
index c2b81d0576..94295e1262 100644
--- a/src/lib/libcrypto/evp/evp.h
+++ b/src/lib/libcrypto/evp/evp.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp.h,v 1.137 2024/08/31 10:38:49 tb Exp $ */ 1/* $OpenBSD: evp.h,v 1.138 2025/07/02 06:36:52 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -778,28 +778,24 @@ void *EVP_PKEY_get0(const EVP_PKEY *pkey);
778const unsigned char *EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len); 778const unsigned char *EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len);
779 779
780#ifndef OPENSSL_NO_RSA 780#ifndef OPENSSL_NO_RSA
781struct rsa_st; 781RSA *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey);
782struct rsa_st *EVP_PKEY_get0_RSA(EVP_PKEY *pkey); 782RSA *EVP_PKEY_get1_RSA(const EVP_PKEY *pkey);
783struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); 783int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, RSA *key);
784int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key);
785#endif 784#endif
786#ifndef OPENSSL_NO_DSA 785#ifndef OPENSSL_NO_DSA
787struct dsa_st; 786DSA *EVP_PKEY_get0_DSA(const EVP_PKEY *pkey);
788struct dsa_st *EVP_PKEY_get0_DSA(EVP_PKEY *pkey); 787DSA *EVP_PKEY_get1_DSA(const EVP_PKEY *pkey);
789struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); 788int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, DSA *key);
790int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, struct dsa_st *key);
791#endif 789#endif
792#ifndef OPENSSL_NO_DH 790#ifndef OPENSSL_NO_DH
793struct dh_st; 791DH *EVP_PKEY_get0_DH(const EVP_PKEY *pkey);
794struct dh_st *EVP_PKEY_get0_DH(EVP_PKEY *pkey); 792DH *EVP_PKEY_get1_DH(const EVP_PKEY *pkey);
795struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); 793int EVP_PKEY_set1_DH(EVP_PKEY *pkey, DH *key);
796int EVP_PKEY_set1_DH(EVP_PKEY *pkey, struct dh_st *key);
797#endif 794#endif
798#ifndef OPENSSL_NO_EC 795#ifndef OPENSSL_NO_EC
799struct ec_key_st; 796EC_KEY *EVP_PKEY_get0_EC_KEY(const EVP_PKEY *pkey);
800struct ec_key_st *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey); 797EC_KEY *EVP_PKEY_get1_EC_KEY(const EVP_PKEY *pkey);
801struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); 798int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, EC_KEY *key);
802int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, struct ec_key_st *key);
803#endif 799#endif
804 800
805EVP_PKEY *EVP_PKEY_new(void); 801EVP_PKEY *EVP_PKEY_new(void);
diff --git a/src/lib/libcrypto/evp/evp_aead.c b/src/lib/libcrypto/evp/evp_aead.c
index b35f5157ed..fdac082217 100644
--- a/src/lib/libcrypto/evp/evp_aead.c
+++ b/src/lib/libcrypto/evp/evp_aead.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_aead.c,v 1.11 2024/04/09 13:52:41 beck Exp $ */ 1/* $OpenBSD: evp_aead.c,v 1.12 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2014, Google Inc. 3 * Copyright (c) 2014, Google Inc.
4 * 4 *
@@ -19,8 +19,8 @@
19#include <string.h> 19#include <string.h>
20 20
21#include <openssl/evp.h> 21#include <openssl/evp.h>
22#include <openssl/err.h>
23 22
23#include "err_local.h"
24#include "evp_local.h" 24#include "evp_local.h"
25 25
26size_t 26size_t
diff --git a/src/lib/libcrypto/evp/evp_cipher.c b/src/lib/libcrypto/evp/evp_cipher.c
index e9c266d1b9..04e0e1c0b0 100644
--- a/src/lib/libcrypto/evp/evp_cipher.c
+++ b/src/lib/libcrypto/evp/evp_cipher.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_cipher.c,v 1.23 2024/04/10 15:00:38 beck Exp $ */ 1/* $OpenBSD: evp_cipher.c,v 1.28 2025/07/02 06:19:46 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -115,10 +115,10 @@
115#include <string.h> 115#include <string.h>
116 116
117#include <openssl/asn1.h> 117#include <openssl/asn1.h>
118#include <openssl/err.h>
119#include <openssl/evp.h> 118#include <openssl/evp.h>
120 119
121#include "asn1_local.h" 120#include "asn1_local.h"
121#include "err_local.h"
122#include "evp_local.h" 122#include "evp_local.h"
123 123
124int 124int
@@ -167,7 +167,7 @@ EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *engine,
167 } 167 }
168 168
169 if ((ctx->cipher->flags & EVP_CIPH_CTRL_INIT) != 0) { 169 if ((ctx->cipher->flags & EVP_CIPH_CTRL_INIT) != 0) {
170 if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_INIT, 0, NULL)) { 170 if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_INIT, 0, NULL) <= 0) {
171 EVPerror(EVP_R_INITIALIZATION_ERROR); 171 EVPerror(EVP_R_INITIALIZATION_ERROR);
172 return 0; 172 return 0;
173 } 173 }
@@ -944,14 +944,20 @@ EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx)
944LCRYPTO_ALIAS(EVP_CIPHER_CTX_flags); 944LCRYPTO_ALIAS(EVP_CIPHER_CTX_flags);
945 945
946/* 946/*
947 * Used by CMS and its predecessors. Only GOST and RC2 have a custom method. 947 * Used by CMS and its predecessors. Only RC2 has a custom method.
948 */ 948 */
949 949
950int 950int
951EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) 951EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
952{ 952{
953 int iv_len; 953 int iv_len;
954 954
955 if (ctx->cipher->get_asn1_parameters != NULL)
956 return ctx->cipher->get_asn1_parameters(ctx, type);
957
958 if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) == 0)
959 return -1;
960
955 if (type == NULL) 961 if (type == NULL)
956 return 0; 962 return 0;
957 963
@@ -970,21 +976,15 @@ EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
970} 976}
971 977
972int 978int
973EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) 979EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
974{ 980{
975 if (ctx->cipher->get_asn1_parameters != NULL) 981 int iv_len;
976 return ctx->cipher->get_asn1_parameters(ctx, type);
977
978 if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) != 0)
979 return EVP_CIPHER_get_asn1_iv(ctx, type);
980 982
981 return -1; 983 if (ctx->cipher->set_asn1_parameters != NULL)
982} 984 return ctx->cipher->set_asn1_parameters(ctx, type);
983 985
984int 986 if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) == 0)
985EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) 987 return -1;
986{
987 int iv_len;
988 988
989 if (type == NULL) 989 if (type == NULL)
990 return 0; 990 return 0;
@@ -998,18 +998,6 @@ EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
998 return ASN1_TYPE_set_octetstring(type, ctx->oiv, iv_len); 998 return ASN1_TYPE_set_octetstring(type, ctx->oiv, iv_len);
999} 999}
1000 1000
1001int
1002EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
1003{
1004 if (ctx->cipher->set_asn1_parameters != NULL)
1005 return ctx->cipher->set_asn1_parameters(ctx, type);
1006
1007 if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) != 0)
1008 return EVP_CIPHER_set_asn1_iv(ctx, type);
1009
1010 return -1;
1011}
1012
1013/* Convert the various cipher NIDs and dummies to a proper OID NID */ 1001/* Convert the various cipher NIDs and dummies to a proper OID NID */
1014int 1002int
1015EVP_CIPHER_type(const EVP_CIPHER *cipher) 1003EVP_CIPHER_type(const EVP_CIPHER *cipher)
diff --git a/src/lib/libcrypto/evp/evp_digest.c b/src/lib/libcrypto/evp/evp_digest.c
index 0a97d25c7d..8bd6691fbf 100644
--- a/src/lib/libcrypto/evp/evp_digest.c
+++ b/src/lib/libcrypto/evp/evp_digest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_digest.c,v 1.14 2024/04/10 15:00:38 beck Exp $ */ 1/* $OpenBSD: evp_digest.c,v 1.15 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -114,10 +114,10 @@
114 114
115#include <openssl/opensslconf.h> 115#include <openssl/opensslconf.h>
116 116
117#include <openssl/err.h>
118#include <openssl/evp.h> 117#include <openssl/evp.h>
119#include <openssl/objects.h> 118#include <openssl/objects.h>
120 119
120#include "err_local.h"
121#include "evp_local.h" 121#include "evp_local.h"
122 122
123int 123int
diff --git a/src/lib/libcrypto/evp/evp_key.c b/src/lib/libcrypto/evp/evp_key.c
index e7c7ec3294..128bec0ac3 100644
--- a/src/lib/libcrypto/evp/evp_key.c
+++ b/src/lib/libcrypto/evp/evp_key.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_key.c,v 1.36 2024/04/09 13:52:41 beck Exp $ */ 1/* $OpenBSD: evp_key.c,v 1.37 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -59,12 +59,12 @@
59#include <stdio.h> 59#include <stdio.h>
60#include <string.h> 60#include <string.h>
61 61
62#include <openssl/err.h>
63#include <openssl/evp.h> 62#include <openssl/evp.h>
64#include <openssl/objects.h> 63#include <openssl/objects.h>
65#include <openssl/ui.h> 64#include <openssl/ui.h>
66#include <openssl/x509.h> 65#include <openssl/x509.h>
67 66
67#include "err_local.h"
68#include "evp_local.h" 68#include "evp_local.h"
69 69
70/* should be init to zeros. */ 70/* should be init to zeros. */
diff --git a/src/lib/libcrypto/evp/evp_local.h b/src/lib/libcrypto/evp/evp_local.h
index 54cd65d0af..76465643c6 100644
--- a/src/lib/libcrypto/evp/evp_local.h
+++ b/src/lib/libcrypto/evp/evp_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_local.h,v 1.25 2024/08/29 16:58:19 tb Exp $ */ 1/* $OpenBSD: evp_local.h,v 1.26 2025/05/27 03:58:12 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -353,9 +353,7 @@ struct evp_aead_ctx_st {
353}; 353};
354 354
355/* Legacy EVP_CIPHER methods used by CMS and its predecessors. */ 355/* Legacy EVP_CIPHER methods used by CMS and its predecessors. */
356int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *cipher, ASN1_TYPE *type);
357int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *cipher, ASN1_TYPE *type); 356int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *cipher, ASN1_TYPE *type);
358int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *cipher, ASN1_TYPE *type);
359int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *cipher, ASN1_TYPE *type); 357int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *cipher, ASN1_TYPE *type);
360 358
361int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, 359int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
diff --git a/src/lib/libcrypto/evp/evp_names.c b/src/lib/libcrypto/evp/evp_names.c
index 817d33602c..8757d191dd 100644
--- a/src/lib/libcrypto/evp/evp_names.c
+++ b/src/lib/libcrypto/evp/evp_names.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_names.c,v 1.18 2024/08/31 10:38:49 tb Exp $ */ 1/* $OpenBSD: evp_names.c,v 1.19 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Theo Buehler <tb@openbsd.org> 3 * Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
4 * 4 *
@@ -15,7 +15,6 @@
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 16 */
17 17
18#include <openssl/err.h>
19#include <openssl/evp.h> 18#include <openssl/evp.h>
20#include <openssl/objects.h> 19#include <openssl/objects.h>
21 20
diff --git a/src/lib/libcrypto/evp/evp_pbe.c b/src/lib/libcrypto/evp/evp_pbe.c
index 88ceb14033..cb2ace1fd0 100644
--- a/src/lib/libcrypto/evp/evp_pbe.c
+++ b/src/lib/libcrypto/evp/evp_pbe.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_pbe.c,v 1.50 2024/04/09 13:52:41 beck Exp $ */ 1/* $OpenBSD: evp_pbe.c,v 1.51 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -60,13 +60,13 @@
60#include <string.h> 60#include <string.h>
61 61
62#include <openssl/asn1.h> 62#include <openssl/asn1.h>
63#include <openssl/err.h>
64#include <openssl/evp.h> 63#include <openssl/evp.h>
65#include <openssl/hmac.h> 64#include <openssl/hmac.h>
66#include <openssl/objects.h> 65#include <openssl/objects.h>
67#include <openssl/pkcs12.h> 66#include <openssl/pkcs12.h>
68#include <openssl/x509.h> 67#include <openssl/x509.h>
69 68
69#include "err_local.h"
70#include "evp_local.h" 70#include "evp_local.h"
71#include "hmac_local.h" 71#include "hmac_local.h"
72#include "pkcs12_local.h" 72#include "pkcs12_local.h"
diff --git a/src/lib/libcrypto/evp/evp_pkey.c b/src/lib/libcrypto/evp/evp_pkey.c
index a1e127352a..1c0b8b41e9 100644
--- a/src/lib/libcrypto/evp/evp_pkey.c
+++ b/src/lib/libcrypto/evp/evp_pkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_pkey.c,v 1.33 2025/02/04 04:51:34 tb Exp $ */ 1/* $OpenBSD: evp_pkey.c,v 1.34 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -60,10 +60,10 @@
60#include <stdlib.h> 60#include <stdlib.h>
61#include <string.h> 61#include <string.h>
62 62
63#include <openssl/err.h>
64#include <openssl/x509.h> 63#include <openssl/x509.h>
65 64
66#include "asn1_local.h" 65#include "asn1_local.h"
66#include "err_local.h"
67#include "evp_local.h" 67#include "evp_local.h"
68 68
69/* Extract a private key from a PKCS8 structure */ 69/* Extract a private key from a PKCS8 structure */
diff --git a/src/lib/libcrypto/evp/m_sigver.c b/src/lib/libcrypto/evp/m_sigver.c
index a3353854f1..66e4752242 100644
--- a/src/lib/libcrypto/evp/m_sigver.c
+++ b/src/lib/libcrypto/evp/m_sigver.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: m_sigver.c,v 1.27 2024/04/09 13:52:41 beck Exp $ */ 1/* $OpenBSD: m_sigver.c,v 1.28 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -58,11 +58,11 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60 60
61#include <openssl/err.h>
62#include <openssl/evp.h> 61#include <openssl/evp.h>
63#include <openssl/objects.h> 62#include <openssl/objects.h>
64#include <openssl/x509.h> 63#include <openssl/x509.h>
65 64
65#include "err_local.h"
66#include "evp_local.h" 66#include "evp_local.h"
67 67
68static int 68static int
diff --git a/src/lib/libcrypto/evp/p_legacy.c b/src/lib/libcrypto/evp/p_legacy.c
index 01cfdbcd6a..7c958a16e3 100644
--- a/src/lib/libcrypto/evp/p_legacy.c
+++ b/src/lib/libcrypto/evp/p_legacy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p_legacy.c,v 1.6 2024/04/09 13:52:41 beck Exp $ */ 1/* $OpenBSD: p_legacy.c,v 1.7 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -59,10 +59,10 @@
59#include <stdlib.h> 59#include <stdlib.h>
60 60
61#include <openssl/evp.h> 61#include <openssl/evp.h>
62#include <openssl/err.h>
63 62
64#include <openssl/rsa.h> 63#include <openssl/rsa.h>
65 64
65#include "err_local.h"
66#include "evp_local.h" 66#include "evp_local.h"
67 67
68int 68int
diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c
index 95c7721303..3f88185737 100644
--- a/src/lib/libcrypto/evp/p_lib.c
+++ b/src/lib/libcrypto/evp/p_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p_lib.c,v 1.61 2024/08/22 12:24:24 tb Exp $ */ 1/* $OpenBSD: p_lib.c,v 1.63 2025/07/02 06:36:52 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -111,7 +111,6 @@
111#include <openssl/bio.h> 111#include <openssl/bio.h>
112#include <openssl/cmac.h> 112#include <openssl/cmac.h>
113#include <openssl/crypto.h> 113#include <openssl/crypto.h>
114#include <openssl/err.h>
115#include <openssl/evp.h> 114#include <openssl/evp.h>
116#include <openssl/objects.h> 115#include <openssl/objects.h>
117#include <openssl/x509.h> 116#include <openssl/x509.h>
@@ -129,6 +128,7 @@
129#include <openssl/rsa.h> 128#include <openssl/rsa.h>
130#endif 129#endif
131 130
131#include "err_local.h"
132#include "evp_local.h" 132#include "evp_local.h"
133 133
134extern const EVP_PKEY_ASN1_METHOD cmac_asn1_meth; 134extern const EVP_PKEY_ASN1_METHOD cmac_asn1_meth;
@@ -628,7 +628,7 @@ LCRYPTO_ALIAS(EVP_PKEY_get0_hmac);
628 628
629#ifndef OPENSSL_NO_RSA 629#ifndef OPENSSL_NO_RSA
630RSA * 630RSA *
631EVP_PKEY_get0_RSA(EVP_PKEY *pkey) 631EVP_PKEY_get0_RSA(const EVP_PKEY *pkey)
632{ 632{
633 if (pkey->type == EVP_PKEY_RSA || pkey->type == EVP_PKEY_RSA_PSS) 633 if (pkey->type == EVP_PKEY_RSA || pkey->type == EVP_PKEY_RSA_PSS)
634 return pkey->pkey.rsa; 634 return pkey->pkey.rsa;
@@ -639,7 +639,7 @@ EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
639LCRYPTO_ALIAS(EVP_PKEY_get0_RSA); 639LCRYPTO_ALIAS(EVP_PKEY_get0_RSA);
640 640
641RSA * 641RSA *
642EVP_PKEY_get1_RSA(EVP_PKEY *pkey) 642EVP_PKEY_get1_RSA(const EVP_PKEY *pkey)
643{ 643{
644 RSA *rsa; 644 RSA *rsa;
645 645
@@ -665,7 +665,7 @@ LCRYPTO_ALIAS(EVP_PKEY_set1_RSA);
665 665
666#ifndef OPENSSL_NO_DSA 666#ifndef OPENSSL_NO_DSA
667DSA * 667DSA *
668EVP_PKEY_get0_DSA(EVP_PKEY *pkey) 668EVP_PKEY_get0_DSA(const EVP_PKEY *pkey)
669{ 669{
670 if (pkey->type != EVP_PKEY_DSA) { 670 if (pkey->type != EVP_PKEY_DSA) {
671 EVPerror(EVP_R_EXPECTING_A_DSA_KEY); 671 EVPerror(EVP_R_EXPECTING_A_DSA_KEY);
@@ -676,7 +676,7 @@ EVP_PKEY_get0_DSA(EVP_PKEY *pkey)
676LCRYPTO_ALIAS(EVP_PKEY_get0_DSA); 676LCRYPTO_ALIAS(EVP_PKEY_get0_DSA);
677 677
678DSA * 678DSA *
679EVP_PKEY_get1_DSA(EVP_PKEY *pkey) 679EVP_PKEY_get1_DSA(const EVP_PKEY *pkey)
680{ 680{
681 DSA *dsa; 681 DSA *dsa;
682 682
@@ -702,7 +702,7 @@ LCRYPTO_ALIAS(EVP_PKEY_set1_DSA);
702 702
703#ifndef OPENSSL_NO_EC 703#ifndef OPENSSL_NO_EC
704EC_KEY * 704EC_KEY *
705EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey) 705EVP_PKEY_get0_EC_KEY(const EVP_PKEY *pkey)
706{ 706{
707 if (pkey->type != EVP_PKEY_EC) { 707 if (pkey->type != EVP_PKEY_EC) {
708 EVPerror(EVP_R_EXPECTING_A_EC_KEY); 708 EVPerror(EVP_R_EXPECTING_A_EC_KEY);
@@ -713,7 +713,7 @@ EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey)
713LCRYPTO_ALIAS(EVP_PKEY_get0_EC_KEY); 713LCRYPTO_ALIAS(EVP_PKEY_get0_EC_KEY);
714 714
715EC_KEY * 715EC_KEY *
716EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey) 716EVP_PKEY_get1_EC_KEY(const EVP_PKEY *pkey)
717{ 717{
718 EC_KEY *key; 718 EC_KEY *key;
719 719
@@ -740,7 +740,7 @@ LCRYPTO_ALIAS(EVP_PKEY_set1_EC_KEY);
740 740
741#ifndef OPENSSL_NO_DH 741#ifndef OPENSSL_NO_DH
742DH * 742DH *
743EVP_PKEY_get0_DH(EVP_PKEY *pkey) 743EVP_PKEY_get0_DH(const EVP_PKEY *pkey)
744{ 744{
745 if (pkey->type != EVP_PKEY_DH) { 745 if (pkey->type != EVP_PKEY_DH) {
746 EVPerror(EVP_R_EXPECTING_A_DH_KEY); 746 EVPerror(EVP_R_EXPECTING_A_DH_KEY);
@@ -751,7 +751,7 @@ EVP_PKEY_get0_DH(EVP_PKEY *pkey)
751LCRYPTO_ALIAS(EVP_PKEY_get0_DH); 751LCRYPTO_ALIAS(EVP_PKEY_get0_DH);
752 752
753DH * 753DH *
754EVP_PKEY_get1_DH(EVP_PKEY *pkey) 754EVP_PKEY_get1_DH(const EVP_PKEY *pkey)
755{ 755{
756 DH *dh; 756 DH *dh;
757 757
diff --git a/src/lib/libcrypto/evp/p_sign.c b/src/lib/libcrypto/evp/p_sign.c
index 7f472ea716..775cf78d62 100644
--- a/src/lib/libcrypto/evp/p_sign.c
+++ b/src/lib/libcrypto/evp/p_sign.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p_sign.c,v 1.22 2024/04/09 13:52:41 beck Exp $ */ 1/* $OpenBSD: p_sign.c,v 1.23 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -58,7 +58,6 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60 60
61#include <openssl/err.h>
62#include <openssl/evp.h> 61#include <openssl/evp.h>
63#include <openssl/objects.h> 62#include <openssl/objects.h>
64#include <openssl/x509.h> 63#include <openssl/x509.h>
diff --git a/src/lib/libcrypto/evp/p_verify.c b/src/lib/libcrypto/evp/p_verify.c
index 02132e2c38..cd7482df55 100644
--- a/src/lib/libcrypto/evp/p_verify.c
+++ b/src/lib/libcrypto/evp/p_verify.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p_verify.c,v 1.21 2024/04/09 13:52:41 beck Exp $ */ 1/* $OpenBSD: p_verify.c,v 1.22 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -58,7 +58,6 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60 60
61#include <openssl/err.h>
62#include <openssl/evp.h> 61#include <openssl/evp.h>
63#include <openssl/objects.h> 62#include <openssl/objects.h>
64#include <openssl/x509.h> 63#include <openssl/x509.h>
diff --git a/src/lib/libcrypto/evp/pmeth_fn.c b/src/lib/libcrypto/evp/pmeth_fn.c
index 308c434f0d..ad6c04dabb 100644
--- a/src/lib/libcrypto/evp/pmeth_fn.c
+++ b/src/lib/libcrypto/evp/pmeth_fn.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pmeth_fn.c,v 1.11 2024/04/12 09:41:39 tb Exp $ */ 1/* $OpenBSD: pmeth_fn.c,v 1.12 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -59,10 +59,10 @@
59#include <stdio.h> 59#include <stdio.h>
60#include <stdlib.h> 60#include <stdlib.h>
61 61
62#include <openssl/err.h>
63#include <openssl/evp.h> 62#include <openssl/evp.h>
64#include <openssl/objects.h> 63#include <openssl/objects.h>
65 64
65#include "err_local.h"
66#include "evp_local.h" 66#include "evp_local.h"
67 67
68#define M_check_autoarg(ctx, arg, arglen, err) \ 68#define M_check_autoarg(ctx, arg, arglen, err) \
diff --git a/src/lib/libcrypto/evp/pmeth_gn.c b/src/lib/libcrypto/evp/pmeth_gn.c
index bc1c5bd7d2..fa5b446124 100644
--- a/src/lib/libcrypto/evp/pmeth_gn.c
+++ b/src/lib/libcrypto/evp/pmeth_gn.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pmeth_gn.c,v 1.21 2024/08/31 09:14:21 tb Exp $ */ 1/* $OpenBSD: pmeth_gn.c,v 1.22 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -60,12 +60,12 @@
60#include <stdlib.h> 60#include <stdlib.h>
61 61
62#include <openssl/bn.h> 62#include <openssl/bn.h>
63#include <openssl/err.h>
64#include <openssl/evp.h> 63#include <openssl/evp.h>
65#include <openssl/objects.h> 64#include <openssl/objects.h>
66 65
67#include "asn1_local.h" 66#include "asn1_local.h"
68#include "bn_local.h" 67#include "bn_local.h"
68#include "err_local.h"
69#include "evp_local.h" 69#include "evp_local.h"
70 70
71int 71int
diff --git a/src/lib/libcrypto/evp/pmeth_lib.c b/src/lib/libcrypto/evp/pmeth_lib.c
index fbf4057c38..ce6beecad6 100644
--- a/src/lib/libcrypto/evp/pmeth_lib.c
+++ b/src/lib/libcrypto/evp/pmeth_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pmeth_lib.c,v 1.42 2025/01/20 12:57:28 tb Exp $ */ 1/* $OpenBSD: pmeth_lib.c,v 1.43 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -63,12 +63,12 @@
63 63
64#include <openssl/opensslconf.h> 64#include <openssl/opensslconf.h>
65 65
66#include <openssl/err.h>
67#include <openssl/evp.h> 66#include <openssl/evp.h>
68#include <openssl/objects.h> 67#include <openssl/objects.h>
69#include <openssl/x509v3.h> 68#include <openssl/x509v3.h>
70 69
71#include "asn1_local.h" 70#include "asn1_local.h"
71#include "err_local.h"
72#include "evp_local.h" 72#include "evp_local.h"
73 73
74extern const EVP_PKEY_METHOD cmac_pkey_meth; 74extern const EVP_PKEY_METHOD cmac_pkey_meth;
diff --git a/src/lib/libcrypto/format-pem.pl b/src/lib/libcrypto/format-pem.pl
index 5a96fe5b1d..fba3470344 100644
--- a/src/lib/libcrypto/format-pem.pl
+++ b/src/lib/libcrypto/format-pem.pl
@@ -1,5 +1,5 @@
1#!/usr/bin/perl 1#!/usr/bin/perl
2# $OpenBSD: format-pem.pl,v 1.7 2024/11/01 11:19:13 sthen Exp $ 2# $OpenBSD: format-pem.pl,v 1.8 2025/06/16 10:24:55 sthen Exp $
3# 3#
4# Copyright (c) 2016 Stuart Henderson <sthen@openbsd.org> 4# Copyright (c) 2016 Stuart Henderson <sthen@openbsd.org>
5# 5#
@@ -99,6 +99,7 @@ while(<>) {
99 99
100 my $verify = qx/openssl verify -CAfile $t $t 2>&1/; 100 my $verify = qx/openssl verify -CAfile $t $t 2>&1/;
101 if (not $verify =~ /^$t: OK$/) { 101 if (not $verify =~ /^$t: OK$/) {
102 $verify =~ s,$t: ,,;
102 print STDERR "ERROR: '$subj' cannot be verified with libressl\n---\n$verify---\n"; 103 print STDERR "ERROR: '$subj' cannot be verified with libressl\n---\n$verify---\n";
103 $ca{$o}{$subj}{'valid'} = 0; 104 $ca{$o}{$subj}{'valid'} = 0;
104 } 105 }
diff --git a/src/lib/libcrypto/hidden/openssl/bio.h b/src/lib/libcrypto/hidden/openssl/bio.h
index 03da75a795..69651cf3cb 100644
--- a/src/lib/libcrypto/hidden/openssl/bio.h
+++ b/src/lib/libcrypto/hidden/openssl/bio.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio.h,v 1.8 2024/07/09 06:14:59 beck Exp $ */ 1/* $OpenBSD: bio.h,v 1.9 2025/07/16 15:59:26 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2023 Bob Beck <beck@openbsd.org>
4 * 4 *
@@ -103,7 +103,6 @@ LCRYPTO_USED(BIO_s_socket);
103LCRYPTO_USED(BIO_s_connect); 103LCRYPTO_USED(BIO_s_connect);
104LCRYPTO_USED(BIO_s_accept); 104LCRYPTO_USED(BIO_s_accept);
105LCRYPTO_USED(BIO_s_fd); 105LCRYPTO_USED(BIO_s_fd);
106LCRYPTO_USED(BIO_s_log);
107LCRYPTO_USED(BIO_s_bio); 106LCRYPTO_USED(BIO_s_bio);
108LCRYPTO_USED(BIO_s_null); 107LCRYPTO_USED(BIO_s_null);
109LCRYPTO_USED(BIO_f_null); 108LCRYPTO_USED(BIO_f_null);
diff --git a/src/lib/libcrypto/hidden/openssl/pem.h b/src/lib/libcrypto/hidden/openssl/pem.h
index 5838f07f4d..233fd8859b 100644
--- a/src/lib/libcrypto/hidden/openssl/pem.h
+++ b/src/lib/libcrypto/hidden/openssl/pem.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: pem.h,v 1.2 2023/07/07 19:37:54 beck Exp $ */ 1/* $OpenBSD: pem.h,v 1.3 2025/07/16 15:59:26 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2023 Bob Beck <beck@openbsd.org>
4 * 4 *
@@ -33,12 +33,10 @@ LCRYPTO_USED(PEM_bytes_read_bio);
33LCRYPTO_USED(PEM_ASN1_read_bio); 33LCRYPTO_USED(PEM_ASN1_read_bio);
34LCRYPTO_USED(PEM_ASN1_write_bio); 34LCRYPTO_USED(PEM_ASN1_write_bio);
35LCRYPTO_USED(PEM_X509_INFO_read_bio); 35LCRYPTO_USED(PEM_X509_INFO_read_bio);
36LCRYPTO_USED(PEM_X509_INFO_write_bio);
37LCRYPTO_USED(PEM_read); 36LCRYPTO_USED(PEM_read);
38LCRYPTO_USED(PEM_write); 37LCRYPTO_USED(PEM_write);
39LCRYPTO_USED(PEM_ASN1_read); 38LCRYPTO_USED(PEM_ASN1_read);
40LCRYPTO_USED(PEM_ASN1_write); 39LCRYPTO_USED(PEM_ASN1_write);
41LCRYPTO_USED(PEM_X509_INFO_read);
42LCRYPTO_USED(PEM_SignInit); 40LCRYPTO_USED(PEM_SignInit);
43LCRYPTO_USED(PEM_SignUpdate); 41LCRYPTO_USED(PEM_SignUpdate);
44LCRYPTO_USED(PEM_SignFinal); 42LCRYPTO_USED(PEM_SignFinal);
diff --git a/src/lib/libcrypto/hidden/openssl/x509.h b/src/lib/libcrypto/hidden/openssl/x509.h
index e6104cd451..5e78f7af97 100644
--- a/src/lib/libcrypto/hidden/openssl/x509.h
+++ b/src/lib/libcrypto/hidden/openssl/x509.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509.h,v 1.15 2025/03/09 15:17:22 tb Exp $ */ 1/* $OpenBSD: x509.h,v 1.16 2025/07/16 15:59:26 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2022 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2022 Bob Beck <beck@openbsd.org>
4 * 4 *
@@ -401,8 +401,6 @@ LCRYPTO_USED(i2d_X509_CRL);
401LCRYPTO_USED(X509_CRL_add0_revoked); 401LCRYPTO_USED(X509_CRL_add0_revoked);
402LCRYPTO_USED(X509_CRL_get0_by_serial); 402LCRYPTO_USED(X509_CRL_get0_by_serial);
403LCRYPTO_USED(X509_CRL_get0_by_cert); 403LCRYPTO_USED(X509_CRL_get0_by_cert);
404LCRYPTO_USED(X509_PKEY_new);
405LCRYPTO_USED(X509_PKEY_free);
406LCRYPTO_USED(NETSCAPE_SPKI_new); 404LCRYPTO_USED(NETSCAPE_SPKI_new);
407LCRYPTO_USED(NETSCAPE_SPKI_free); 405LCRYPTO_USED(NETSCAPE_SPKI_free);
408LCRYPTO_USED(d2i_NETSCAPE_SPKI); 406LCRYPTO_USED(d2i_NETSCAPE_SPKI);
diff --git a/src/lib/libcrypto/hkdf/hkdf.c b/src/lib/libcrypto/hkdf/hkdf.c
index 6104ef0cc7..f68df4bea4 100644
--- a/src/lib/libcrypto/hkdf/hkdf.c
+++ b/src/lib/libcrypto/hkdf/hkdf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: hkdf.c,v 1.11 2024/03/25 13:09:13 jsing Exp $ */ 1/* $OpenBSD: hkdf.c,v 1.12 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2014, Google Inc. 3 * Copyright (c) 2014, Google Inc.
4 * 4 *
@@ -19,10 +19,10 @@
19 19
20#include <string.h> 20#include <string.h>
21 21
22#include <openssl/err.h>
23#include <openssl/hmac.h> 22#include <openssl/hmac.h>
24 23
25#include "bytestring.h" 24#include "bytestring.h"
25#include "err_local.h"
26#include "evp_local.h" 26#include "evp_local.h"
27#include "hmac_local.h" 27#include "hmac_local.h"
28 28
diff --git a/src/lib/libcrypto/hmac/hmac.c b/src/lib/libcrypto/hmac/hmac.c
index dc1614d3ce..e3d5664143 100644
--- a/src/lib/libcrypto/hmac/hmac.c
+++ b/src/lib/libcrypto/hmac/hmac.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: hmac.c,v 1.36 2024/08/31 10:42:21 tb Exp $ */ 1/* $OpenBSD: hmac.c,v 1.37 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -60,9 +60,9 @@
60#include <stdlib.h> 60#include <stdlib.h>
61#include <string.h> 61#include <string.h>
62 62
63#include <openssl/err.h>
64#include <openssl/hmac.h> 63#include <openssl/hmac.h>
65 64
65#include "err_local.h"
66#include "evp_local.h" 66#include "evp_local.h"
67#include "hmac_local.h" 67#include "hmac_local.h"
68 68
diff --git a/src/lib/libcrypto/idea/idea.h b/src/lib/libcrypto/idea/idea.h
index 2bdd3647fd..fccef8fc73 100644
--- a/src/lib/libcrypto/idea/idea.h
+++ b/src/lib/libcrypto/idea/idea.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: idea.h,v 1.13 2025/01/25 17:59:44 tb Exp $ */ 1/* $OpenBSD: idea.h,v 1.14 2025/06/09 14:37:49 tb Exp $ */
2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -59,7 +59,12 @@
59#ifndef HEADER_IDEA_H 59#ifndef HEADER_IDEA_H
60#define HEADER_IDEA_H 60#define HEADER_IDEA_H
61 61
62#include <openssl/opensslconf.h> /* IDEA_INT, OPENSSL_NO_IDEA */ 62#include <openssl/opensslconf.h> /* OPENSSL_NO_IDEA */
63
64#ifndef IDEA_INT
65/* XXX - typedef */
66#define IDEA_INT unsigned int
67#endif
63 68
64#define IDEA_ENCRYPT 1 69#define IDEA_ENCRYPT 1
65#define IDEA_DECRYPT 0 70#define IDEA_DECRYPT 0
diff --git a/src/lib/libcrypto/kdf/hkdf_evp.c b/src/lib/libcrypto/kdf/hkdf_evp.c
index b33e2e0a26..dee6e35d82 100644
--- a/src/lib/libcrypto/kdf/hkdf_evp.c
+++ b/src/lib/libcrypto/kdf/hkdf_evp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: hkdf_evp.c,v 1.20 2023/06/26 08:57:17 tb Exp $ */ 1/* $OpenBSD: hkdf_evp.c,v 1.22 2025/05/21 03:53:20 kenjiro Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2016-2018 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2016-2018 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -50,12 +50,11 @@
50#include <stdlib.h> 50#include <stdlib.h>
51#include <string.h> 51#include <string.h>
52 52
53#include <openssl/err.h>
54#include <openssl/evp.h>
55#include <openssl/hmac.h> 53#include <openssl/hmac.h>
56#include <openssl/hkdf.h> 54#include <openssl/hkdf.h>
57#include <openssl/kdf.h> 55#include <openssl/kdf.h>
58 56
57#include "err_local.h"
59#include "evp_local.h" 58#include "evp_local.h"
60 59
61#define HKDF_MAXBUF 1024 60#define HKDF_MAXBUF 1024
@@ -91,6 +90,9 @@ pkey_hkdf_cleanup(EVP_PKEY_CTX *ctx)
91{ 90{
92 HKDF_PKEY_CTX *kctx = ctx->data; 91 HKDF_PKEY_CTX *kctx = ctx->data;
93 92
93 if (kctx == NULL)
94 return;
95
94 freezero(kctx->salt, kctx->salt_len); 96 freezero(kctx->salt, kctx->salt_len);
95 freezero(kctx->key, kctx->key_len); 97 freezero(kctx->key, kctx->key_len);
96 freezero(kctx, sizeof(*kctx)); 98 freezero(kctx, sizeof(*kctx));
diff --git a/src/lib/libcrypto/kdf/tls1_prf.c b/src/lib/libcrypto/kdf/tls1_prf.c
index 7d6231e3c7..2b86ff744f 100644
--- a/src/lib/libcrypto/kdf/tls1_prf.c
+++ b/src/lib/libcrypto/kdf/tls1_prf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls1_prf.c,v 1.40 2024/07/10 06:53:27 tb Exp $ */ 1/* $OpenBSD: tls1_prf.c,v 1.42 2025/05/21 03:53:20 kenjiro Exp $ */
2/* 2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project 3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
4 * 2016. 4 * 2016.
@@ -61,10 +61,10 @@
61#include <stdio.h> 61#include <stdio.h>
62#include <string.h> 62#include <string.h>
63 63
64#include <openssl/err.h>
65#include <openssl/evp.h> 64#include <openssl/evp.h>
66#include <openssl/kdf.h> 65#include <openssl/kdf.h>
67 66
67#include "err_local.h"
68#include "evp_local.h" 68#include "evp_local.h"
69 69
70#define TLS1_PRF_MAXBUF 1024 70#define TLS1_PRF_MAXBUF 1024
@@ -96,6 +96,9 @@ pkey_tls1_prf_cleanup(EVP_PKEY_CTX *ctx)
96{ 96{
97 struct tls1_prf_ctx *kctx = ctx->data; 97 struct tls1_prf_ctx *kctx = ctx->data;
98 98
99 if (kctx == NULL)
100 return;
101
99 freezero(kctx->secret, kctx->secret_len); 102 freezero(kctx->secret, kctx->secret_len);
100 freezero(kctx, sizeof(*kctx)); 103 freezero(kctx, sizeof(*kctx));
101} 104}
diff --git a/src/lib/libcrypto/lhash/lhash.c b/src/lib/libcrypto/lhash/lhash.c
index aa532267de..ad6ece543b 100644
--- a/src/lib/libcrypto/lhash/lhash.c
+++ b/src/lib/libcrypto/lhash/lhash.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: lhash.c,v 1.28 2024/07/14 14:32:45 jsing Exp $ */ 1/* $OpenBSD: lhash.c,v 1.29 2025/05/01 00:35:23 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -115,11 +115,11 @@ expand(_LHASH *lh)
115#endif 115#endif
116 if ((hash % nni) != p) { /* move it */ 116 if ((hash % nni) != p) { /* move it */
117 *n1 = (*n1)->next; 117 *n1 = (*n1)->next;
118 np->next= *n2; 118 np->next = *n2;
119 *n2 = np; 119 *n2 = np;
120 } else 120 } else
121 n1 = &((*n1)->next); 121 n1 = &((*n1)->next);
122 np= *n1; 122 np = *n1;
123 } 123 }
124 124
125 if ((lh->p) >= lh->pmax) { 125 if ((lh->p) >= lh->pmax) {
@@ -305,7 +305,7 @@ lh_delete(_LHASH *lh, const void *data)
305 if (*rn == NULL) { 305 if (*rn == NULL) {
306 return (NULL); 306 return (NULL);
307 } else { 307 } else {
308 nn= *rn; 308 nn = *rn;
309 *rn = nn->next; 309 *rn = nn->next;
310 ret = nn->data; 310 ret = nn->data;
311 free(nn); 311 free(nn);
diff --git a/src/lib/libcrypto/man/ACCESS_DESCRIPTION_new.3 b/src/lib/libcrypto/man/ACCESS_DESCRIPTION_new.3
index 15156ffca3..bfa915c8af 100644
--- a/src/lib/libcrypto/man/ACCESS_DESCRIPTION_new.3
+++ b/src/lib/libcrypto/man/ACCESS_DESCRIPTION_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ACCESS_DESCRIPTION_new.3,v 1.6 2022/03/31 17:27:16 naddy Exp $ 1.\" $OpenBSD: ACCESS_DESCRIPTION_new.3,v 1.7 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 31 2022 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt ACCESS_DESCRIPTION_NEW 3 18.Dt ACCESS_DESCRIPTION_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -24,6 +24,7 @@
24.Nm AUTHORITY_INFO_ACCESS_free 24.Nm AUTHORITY_INFO_ACCESS_free
25.Nd X.509 information access extensions 25.Nd X.509 information access extensions
26.Sh SYNOPSIS 26.Sh SYNOPSIS
27.Lb libcrypto
27.In openssl/x509v3.h 28.In openssl/x509v3.h
28.Ft ACCESS_DESCRIPTION * 29.Ft ACCESS_DESCRIPTION *
29.Fn ACCESS_DESCRIPTION_new void 30.Fn ACCESS_DESCRIPTION_new void
diff --git a/src/lib/libcrypto/man/AES_encrypt.3 b/src/lib/libcrypto/man/AES_encrypt.3
index f022848a61..4ceece648e 100644
--- a/src/lib/libcrypto/man/AES_encrypt.3
+++ b/src/lib/libcrypto/man/AES_encrypt.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: AES_encrypt.3,v 1.1 2019/08/28 10:37:42 schwarze Exp $ 1.\" $OpenBSD: AES_encrypt.3,v 1.2 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: August 28 2019 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt AES_ENCRYPT 3 18.Dt AES_ENCRYPT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -25,6 +25,7 @@
25.Nm AES_cbc_encrypt 25.Nm AES_cbc_encrypt
26.Nd low-level interface to the AES symmetric cipher 26.Nd low-level interface to the AES symmetric cipher
27.Sh SYNOPSIS 27.Sh SYNOPSIS
28.Lb libcrypto
28.In openssl/aes.h 29.In openssl/aes.h
29.Ft int 30.Ft int
30.Fo AES_set_encrypt_key 31.Fo AES_set_encrypt_key
diff --git a/src/lib/libcrypto/man/ASIdentifiers_new.3 b/src/lib/libcrypto/man/ASIdentifiers_new.3
index d8473b81a0..f5f4a1215e 100644
--- a/src/lib/libcrypto/man/ASIdentifiers_new.3
+++ b/src/lib/libcrypto/man/ASIdentifiers_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASIdentifiers_new.3,v 1.11 2023/09/30 18:16:44 tb Exp $ 1.\" $OpenBSD: ASIdentifiers_new.3,v 1.12 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> 3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: September 30 2023 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt ASIDENTIFIERS_NEW 3 18.Dt ASIDENTIFIERS_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -24,6 +24,7 @@
24.Nm i2d_ASIdentifiers 24.Nm i2d_ASIdentifiers
25.Nd RFC 3779 autonomous system identifier delegation extensions 25.Nd RFC 3779 autonomous system identifier delegation extensions
26.Sh SYNOPSIS 26.Sh SYNOPSIS
27.Lb libcrypto
27.In openssl/x509v3.h 28.In openssl/x509v3.h
28.Ft ASIdentifiers * 29.Ft ASIdentifiers *
29.Fo ASIdentifiers_new 30.Fo ASIdentifiers_new
diff --git a/src/lib/libcrypto/man/ASN1_BIT_STRING_set.3 b/src/lib/libcrypto/man/ASN1_BIT_STRING_set.3
index a916ca3ab2..d3ab3b1ee0 100644
--- a/src/lib/libcrypto/man/ASN1_BIT_STRING_set.3
+++ b/src/lib/libcrypto/man/ASN1_BIT_STRING_set.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_BIT_STRING_set.3,v 1.5 2024/12/24 09:48:56 schwarze Exp $ 1.\" $OpenBSD: ASN1_BIT_STRING_set.3,v 1.6 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: December 24 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt ASN1_BIT_STRING_SET 3 18.Dt ASN1_BIT_STRING_SET 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -23,6 +23,7 @@
23.Nm ASN1_BIT_STRING_get_bit 23.Nm ASN1_BIT_STRING_get_bit
24.Nd ASN.1 BIT STRING accessors 24.Nd ASN.1 BIT STRING accessors
25.Sh SYNOPSIS 25.Sh SYNOPSIS
26.Lb libcrypto
26.In openssl/asn1.h 27.In openssl/asn1.h
27.Ft int 28.Ft int
28.Fo ASN1_BIT_STRING_set 29.Fo ASN1_BIT_STRING_set
diff --git a/src/lib/libcrypto/man/ASN1_INTEGER_get.3 b/src/lib/libcrypto/man/ASN1_INTEGER_get.3
index 84f566eda9..985e2e5084 100644
--- a/src/lib/libcrypto/man/ASN1_INTEGER_get.3
+++ b/src/lib/libcrypto/man/ASN1_INTEGER_get.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_INTEGER_get.3,v 1.7 2023/05/22 19:38:04 tb Exp $ 1.\" $OpenBSD: ASN1_INTEGER_get.3,v 1.8 2025/06/08 22:40:29 schwarze Exp $
2.\" selective merge up to: 2.\" selective merge up to:
3.\" OpenSSL man3/ASN1_INTEGER_get_int64 24a535ea Sep 22 13:14:20 2020 +0100 3.\" OpenSSL man3/ASN1_INTEGER_get_int64 24a535ea Sep 22 13:14:20 2020 +0100
4.\" 4.\"
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: May 22 2023 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt ASN1_INTEGER_GET 3 70.Dt ASN1_INTEGER_GET 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -88,6 +88,7 @@
88.Nm ASN1_ENUMERATED_to_BN 88.Nm ASN1_ENUMERATED_to_BN
89.Nd ASN.1 INTEGER and ENUMERATED utilities 89.Nd ASN.1 INTEGER and ENUMERATED utilities
90.Sh SYNOPSIS 90.Sh SYNOPSIS
91.Lb libcrypto
91.In openssl/asn1.h 92.In openssl/asn1.h
92.Ft int 93.Ft int
93.Fo ASN1_INTEGER_get_uint64 94.Fo ASN1_INTEGER_get_uint64
diff --git a/src/lib/libcrypto/man/ASN1_NULL_new.3 b/src/lib/libcrypto/man/ASN1_NULL_new.3
index b4d2428ed1..1244f2e252 100644
--- a/src/lib/libcrypto/man/ASN1_NULL_new.3
+++ b/src/lib/libcrypto/man/ASN1_NULL_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_NULL_new.3,v 1.3 2021/12/09 18:42:35 schwarze Exp $ 1.\" $OpenBSD: ASN1_NULL_new.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: December 9 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt ASN1_NULL_NEW 3 18.Dt ASN1_NULL_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm ASN1_NULL_free 22.Nm ASN1_NULL_free
23.Nd ASN.1 NULL value 23.Nd ASN.1 NULL value
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/asn1.h 26.In openssl/asn1.h
26.Ft ASN1_NULL * 27.Ft ASN1_NULL *
27.Fn ASN1_NULL_new void 28.Fn ASN1_NULL_new void
diff --git a/src/lib/libcrypto/man/ASN1_OBJECT_new.3 b/src/lib/libcrypto/man/ASN1_OBJECT_new.3
index 3e2eac02ee..3df3dd8e68 100644
--- a/src/lib/libcrypto/man/ASN1_OBJECT_new.3
+++ b/src/lib/libcrypto/man/ASN1_OBJECT_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_OBJECT_new.3,v 1.16 2023/09/05 15:01:39 schwarze Exp $ 1.\" $OpenBSD: ASN1_OBJECT_new.3,v 1.17 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 99d63d4 Mar 19 12:28:58 2016 -0400 2.\" full merge up to: OpenSSL 99d63d4 Mar 19 12:28:58 2016 -0400
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: September 5 2023 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt ASN1_OBJECT_NEW 3 69.Dt ASN1_OBJECT_NEW 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -74,6 +74,7 @@
74.Nm ASN1_OBJECT_free 74.Nm ASN1_OBJECT_free
75.Nd ASN.1 object identifiers 75.Nd ASN.1 object identifiers
76.Sh SYNOPSIS 76.Sh SYNOPSIS
77.Lb libcrypto
77.In openssl/asn1.h 78.In openssl/asn1.h
78.Ft ASN1_OBJECT * 79.Ft ASN1_OBJECT *
79.Fo ASN1_OBJECT_new 80.Fo ASN1_OBJECT_new
diff --git a/src/lib/libcrypto/man/ASN1_PRINTABLE_type.3 b/src/lib/libcrypto/man/ASN1_PRINTABLE_type.3
index 391dd32e66..47288ee960 100644
--- a/src/lib/libcrypto/man/ASN1_PRINTABLE_type.3
+++ b/src/lib/libcrypto/man/ASN1_PRINTABLE_type.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_PRINTABLE_type.3,v 1.1 2021/11/15 13:39:40 schwarze Exp $ 1.\" $OpenBSD: ASN1_PRINTABLE_type.3,v 1.2 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: November 15 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt ASN1_PRINTABLE_TYPE 3 18.Dt ASN1_PRINTABLE_TYPE 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm ASN1_PRINTABLE_type 21.Nm ASN1_PRINTABLE_type
22.Nd classify a single-byte character string 22.Nd classify a single-byte character string
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
24.In openssl/asn1.h 25.In openssl/asn1.h
25.Ft int 26.Ft int
26.Fo ASN1_PRINTABLE_type 27.Fo ASN1_PRINTABLE_type
diff --git a/src/lib/libcrypto/man/ASN1_STRING_TABLE_get.3 b/src/lib/libcrypto/man/ASN1_STRING_TABLE_get.3
index 2bf8831c12..4149b73d34 100644
--- a/src/lib/libcrypto/man/ASN1_STRING_TABLE_get.3
+++ b/src/lib/libcrypto/man/ASN1_STRING_TABLE_get.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_STRING_TABLE_get.3,v 1.4 2023/12/21 21:23:37 tb Exp $ 1.\" $OpenBSD: ASN1_STRING_TABLE_get.3,v 1.5 2025/06/08 22:37:23 schwarze Exp $
2.\" checked up to: 2.\" checked up to:
3.\" OpenSSL ASN1_STRING_TABLE_add.pod 7b608d08 Jul 27 01:18:50 2017 +0800 3.\" OpenSSL ASN1_STRING_TABLE_add.pod 7b608d08 Jul 27 01:18:50 2017 +0800
4.\" 4.\"
@@ -16,17 +16,15 @@
16.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18.\" 18.\"
19.Dd $Mdocdate: December 21 2023 $ 19.Dd $Mdocdate: June 8 2025 $
20.Dt ASN1_STRING_TABLE_GET 3 20.Dt ASN1_STRING_TABLE_GET 3
21.Os 21.Os
22.Sh NAME 22.Sh NAME
23.\" .Nm ASN1_STRING_TABLE_add0 and
24.\" .Nm ASN1_STRING_TABLE_cleanup are intentionally undocumented
25.\" because they will be removed in the next major bump
26.\" .Dv STABLE_FLAGS_MALLOC is intentionally undocumented because it is unused 23.\" .Dv STABLE_FLAGS_MALLOC is intentionally undocumented because it is unused
27.Nm ASN1_STRING_TABLE_get 24.Nm ASN1_STRING_TABLE_get
28.Nd retrieve an entry from the global ASN.1 string table 25.Nd retrieve an entry from the global ASN.1 string table
29.Sh SYNOPSIS 26.Sh SYNOPSIS
27.Lb libcrypto
30.In openssl/asn1.h 28.In openssl/asn1.h
31.Ft ASN1_STRING_TABLE * 29.Ft ASN1_STRING_TABLE *
32.Fo ASN1_STRING_TABLE_get 30.Fo ASN1_STRING_TABLE_get
diff --git a/src/lib/libcrypto/man/ASN1_STRING_length.3 b/src/lib/libcrypto/man/ASN1_STRING_length.3
index 0c397607a9..922ae89ac6 100644
--- a/src/lib/libcrypto/man/ASN1_STRING_length.3
+++ b/src/lib/libcrypto/man/ASN1_STRING_length.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_STRING_length.3,v 1.30 2024/12/27 15:30:17 schwarze Exp $ 1.\" $OpenBSD: ASN1_STRING_length.3,v 1.31 2025/06/08 22:37:23 schwarze Exp $
2.\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 2.\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: December 27 2024 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt ASN1_STRING_LENGTH 3 70.Dt ASN1_STRING_LENGTH 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -84,10 +84,9 @@
84.Nm ASN1_STRING_copy , 84.Nm ASN1_STRING_copy ,
85.Nm ASN1_STRING_to_UTF8 , 85.Nm ASN1_STRING_to_UTF8 ,
86.Nm ASN1_STRING_type 86.Nm ASN1_STRING_type
87.\" deprecated aliases, intentionally undocumented:
88.\" M_ASN1_STRING_data, M_ASN1_STRING_length
89.Nd ASN1_STRING utility functions 87.Nd ASN1_STRING utility functions
90.Sh SYNOPSIS 88.Sh SYNOPSIS
89.Lb libcrypto
91.In openssl/asn1.h 90.In openssl/asn1.h
92.Ft int 91.Ft int
93.Fo ASN1_STRING_cmp 92.Fo ASN1_STRING_cmp
diff --git a/src/lib/libcrypto/man/ASN1_STRING_new.3 b/src/lib/libcrypto/man/ASN1_STRING_new.3
index 212bacd413..d653b70dda 100644
--- a/src/lib/libcrypto/man/ASN1_STRING_new.3
+++ b/src/lib/libcrypto/man/ASN1_STRING_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_STRING_new.3,v 1.27 2024/12/27 15:30:17 schwarze Exp $ 1.\" $OpenBSD: ASN1_STRING_new.3,v 1.28 2025/06/08 22:37:23 schwarze Exp $
2.\" OpenSSL 99d63d46 Tue Mar 24 07:52:24 2015 -0400 2.\" OpenSSL 99d63d46 Tue Mar 24 07:52:24 2015 -0400
3.\" 3.\"
4.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> 4.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,7 +15,7 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 17.\"
18.Dd $Mdocdate: December 27 2024 $ 18.Dd $Mdocdate: June 8 2025 $
19.Dt ASN1_STRING_NEW 3 19.Dt ASN1_STRING_NEW 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
@@ -58,10 +58,9 @@
58.Nm ASN1_UTCTIME_free , 58.Nm ASN1_UTCTIME_free ,
59.Nm ASN1_TIME_new , 59.Nm ASN1_TIME_new ,
60.Nm ASN1_TIME_free 60.Nm ASN1_TIME_free
61.\" deprecated aliases, intentionally undocumented: M_ASN1_IA5STRING_new,
62.\" M_ASN1_ENUMERATED_free, M_ASN1_INTEGER_free, M_ASN1_OCTET_STRING_free
63.Nd allocate and free ASN1_STRING objects 61.Nd allocate and free ASN1_STRING objects
64.Sh SYNOPSIS 62.Sh SYNOPSIS
63.Lb libcrypto
65.In openssl/asn1.h 64.In openssl/asn1.h
66.Ft ASN1_STRING * 65.Ft ASN1_STRING *
67.Fn ASN1_STRING_new void 66.Fn ASN1_STRING_new void
diff --git a/src/lib/libcrypto/man/ASN1_STRING_print_ex.3 b/src/lib/libcrypto/man/ASN1_STRING_print_ex.3
index eb43b2fe5c..8295b3e9dd 100644
--- a/src/lib/libcrypto/man/ASN1_STRING_print_ex.3
+++ b/src/lib/libcrypto/man/ASN1_STRING_print_ex.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_STRING_print_ex.3,v 1.18 2021/12/14 19:36:18 schwarze Exp $ 1.\" $OpenBSD: ASN1_STRING_print_ex.3,v 1.19 2025/06/08 22:37:23 schwarze Exp $
2.\" full merge up to: OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400 2.\" full merge up to: OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400
3.\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 3.\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800
4.\" 4.\"
@@ -50,7 +50,7 @@
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\" 52.\"
53.Dd $Mdocdate: December 14 2021 $ 53.Dd $Mdocdate: June 8 2025 $
54.Dt ASN1_STRING_PRINT_EX 3 54.Dt ASN1_STRING_PRINT_EX 3
55.Os 55.Os
56.Sh NAME 56.Sh NAME
@@ -58,9 +58,9 @@
58.Nm ASN1_STRING_print_ex_fp , 58.Nm ASN1_STRING_print_ex_fp ,
59.Nm ASN1_STRING_print , 59.Nm ASN1_STRING_print ,
60.Nm ASN1_tag2str 60.Nm ASN1_tag2str
61.\" M_ASN1_OCTET_STRING_print is a deprecated alias, intentionally undocumented
62.Nd ASN1_STRING output routines 61.Nd ASN1_STRING output routines
63.Sh SYNOPSIS 62.Sh SYNOPSIS
63.Lb libcrypto
64.In openssl/asn1.h 64.In openssl/asn1.h
65.Ft int 65.Ft int
66.Fo ASN1_STRING_print_ex 66.Fo ASN1_STRING_print_ex
diff --git a/src/lib/libcrypto/man/ASN1_TIME_set.3 b/src/lib/libcrypto/man/ASN1_TIME_set.3
index 233cb13f2c..8cfcf4339b 100644
--- a/src/lib/libcrypto/man/ASN1_TIME_set.3
+++ b/src/lib/libcrypto/man/ASN1_TIME_set.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_TIME_set.3,v 1.23 2024/03/05 18:30:40 tb Exp $ 1.\" $OpenBSD: ASN1_TIME_set.3,v 1.24 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 3d0f1cb9 Jul 11 03:01:24 2017 +0800 2.\" full merge up to: OpenSSL 3d0f1cb9 Jul 11 03:01:24 2017 +0800
3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
4.\" 4.\"
@@ -68,7 +68,7 @@
68.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 68.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
69.\" OF THE POSSIBILITY OF SUCH DAMAGE. 69.\" OF THE POSSIBILITY OF SUCH DAMAGE.
70.\" 70.\"
71.Dd $Mdocdate: March 5 2024 $ 71.Dd $Mdocdate: June 8 2025 $
72.Dt ASN1_TIME_SET 3 72.Dt ASN1_TIME_SET 3
73.Os 73.Os
74.Sh NAME 74.Sh NAME
@@ -101,6 +101,7 @@
101.Nm OPENSSL_tm_to_posix 101.Nm OPENSSL_tm_to_posix
102.Nd ASN.1 Time functions 102.Nd ASN.1 Time functions
103.Sh SYNOPSIS 103.Sh SYNOPSIS
104.Lb libcrypto
104.In openssl/asn1.h 105.In openssl/asn1.h
105.Ft ASN1_TIME * 106.Ft ASN1_TIME *
106.Fo ASN1_TIME_set 107.Fo ASN1_TIME_set
diff --git a/src/lib/libcrypto/man/ASN1_TYPE_get.3 b/src/lib/libcrypto/man/ASN1_TYPE_get.3
index 16af168d91..3b3359b6ff 100644
--- a/src/lib/libcrypto/man/ASN1_TYPE_get.3
+++ b/src/lib/libcrypto/man/ASN1_TYPE_get.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_TYPE_get.3,v 1.19 2023/10/09 16:06:01 tb Exp $ 1.\" $OpenBSD: ASN1_TYPE_get.3,v 1.20 2025/06/08 22:40:29 schwarze Exp $
2.\" selective merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200 2.\" selective merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: October 9 2023 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt ASN1_TYPE_GET 3 69.Dt ASN1_TYPE_GET 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -81,6 +81,7 @@
81.Nm ASN1_TYPE_cmp 81.Nm ASN1_TYPE_cmp
82.Nd ASN.1 objects of arbitrary type 82.Nd ASN.1 objects of arbitrary type
83.Sh SYNOPSIS 83.Sh SYNOPSIS
84.Lb libcrypto
84.In openssl/asn1.h 85.In openssl/asn1.h
85.Ft ASN1_TYPE * 86.Ft ASN1_TYPE *
86.Fn ASN1_TYPE_new void 87.Fn ASN1_TYPE_new void
diff --git a/src/lib/libcrypto/man/ASN1_UNIVERSALSTRING_to_string.3 b/src/lib/libcrypto/man/ASN1_UNIVERSALSTRING_to_string.3
index 2af675295b..c76956107f 100644
--- a/src/lib/libcrypto/man/ASN1_UNIVERSALSTRING_to_string.3
+++ b/src/lib/libcrypto/man/ASN1_UNIVERSALSTRING_to_string.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_UNIVERSALSTRING_to_string.3,v 1.1 2021/11/15 13:39:40 schwarze Exp $ 1.\" $OpenBSD: ASN1_UNIVERSALSTRING_to_string.3,v 1.2 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: November 15 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt ASN1_UNIVERSALSTRING_TO_STRING 3 18.Dt ASN1_UNIVERSALSTRING_TO_STRING 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm ASN1_UNIVERSALSTRING_to_string 21.Nm ASN1_UNIVERSALSTRING_to_string
22.Nd recode UTF-32 to ISO Latin-1 22.Nd recode UTF-32 to ISO Latin-1
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
24.In openssl/asn1.h 25.In openssl/asn1.h
25.Ft int 26.Ft int
26.Fo ASN1_UNIVERSALSTRING_to_string 27.Fo ASN1_UNIVERSALSTRING_to_string
diff --git a/src/lib/libcrypto/man/ASN1_generate_nconf.3 b/src/lib/libcrypto/man/ASN1_generate_nconf.3
index b15d4295a9..ed92bb13b6 100644
--- a/src/lib/libcrypto/man/ASN1_generate_nconf.3
+++ b/src/lib/libcrypto/man/ASN1_generate_nconf.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_generate_nconf.3,v 1.13 2019/06/10 14:58:48 schwarze Exp $ 1.\" $OpenBSD: ASN1_generate_nconf.3,v 1.14 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL 05ea606a Fri May 20 20:52:46 2016 -0400 2.\" OpenSSL 05ea606a Fri May 20 20:52:46 2016 -0400
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson. 4.\" This file was written by Dr. Stephen Henson.
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: June 10 2019 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt ASN1_GENERATE_NCONF 3 53.Dt ASN1_GENERATE_NCONF 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -57,6 +57,7 @@
57.Nm ASN1_generate_v3 57.Nm ASN1_generate_v3
58.Nd ASN.1 generation functions 58.Nd ASN.1 generation functions
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/asn1.h 61.In openssl/asn1.h
61.Ft ASN1_TYPE * 62.Ft ASN1_TYPE *
62.Fo ASN1_generate_nconf 63.Fo ASN1_generate_nconf
diff --git a/src/lib/libcrypto/man/ASN1_get_object.3 b/src/lib/libcrypto/man/ASN1_get_object.3
index 781b12ad5a..7f92ff6d05 100644
--- a/src/lib/libcrypto/man/ASN1_get_object.3
+++ b/src/lib/libcrypto/man/ASN1_get_object.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_get_object.3,v 1.2 2021/07/11 19:03:45 schwarze Exp $ 1.\" $OpenBSD: ASN1_get_object.3,v 1.3 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: July 11 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt ASN1_GET_OBJECT 3 18.Dt ASN1_GET_OBJECT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm ASN1_get_object 21.Nm ASN1_get_object
22.Nd parse identifier and length octets 22.Nd parse identifier and length octets
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
24.In openssl/asn1.h 25.In openssl/asn1.h
25.Ft int 26.Ft int
26.Fo ASN1_get_object 27.Fo ASN1_get_object
diff --git a/src/lib/libcrypto/man/ASN1_item_d2i.3 b/src/lib/libcrypto/man/ASN1_item_d2i.3
index bc99f4a6da..cb5fd19f28 100644
--- a/src/lib/libcrypto/man/ASN1_item_d2i.3
+++ b/src/lib/libcrypto/man/ASN1_item_d2i.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_item_d2i.3,v 1.18 2023/05/01 07:37:45 tb Exp $ 1.\" $OpenBSD: ASN1_item_d2i.3,v 1.19 2025/06/08 22:40:29 schwarze Exp $
2.\" selective merge up to: 2.\" selective merge up to:
3.\" OpenSSL doc/man3/d2i_X509.pod 256989ce Jun 19 15:00:32 2020 +0200 3.\" OpenSSL doc/man3/d2i_X509.pod 256989ce Jun 19 15:00:32 2020 +0200
4.\" 4.\"
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: May 1 2023 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt ASN1_ITEM_D2I 3 70.Dt ASN1_ITEM_D2I 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -82,6 +82,7 @@
82.Nm ASN1_item_print 82.Nm ASN1_item_print
83.Nd decode and encode ASN.1 objects 83.Nd decode and encode ASN.1 objects
84.Sh SYNOPSIS 84.Sh SYNOPSIS
85.Lb libcrypto
85.In openssl/asn1.h 86.In openssl/asn1.h
86.Ft ASN1_VALUE * 87.Ft ASN1_VALUE *
87.Fo ASN1_item_d2i 88.Fo ASN1_item_d2i
diff --git a/src/lib/libcrypto/man/ASN1_item_digest.3 b/src/lib/libcrypto/man/ASN1_item_digest.3
index 56a97555e9..829b82a56b 100644
--- a/src/lib/libcrypto/man/ASN1_item_digest.3
+++ b/src/lib/libcrypto/man/ASN1_item_digest.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_item_digest.3,v 1.2 2022/09/11 04:39:46 jsg Exp $ 1.\" $OpenBSD: ASN1_item_digest.3,v 1.3 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: September 11 2022 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt ASN1_ITEM_DIGEST 3 18.Dt ASN1_ITEM_DIGEST 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm ASN1_item_digest 21.Nm ASN1_item_digest
22.Nd DER-encode and hash an ASN.1 value 22.Nd DER-encode and hash an ASN.1 value
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
24.In openssl/x509.h 25.In openssl/x509.h
25.Ft int 26.Ft int
26.Fo ASN1_item_digest 27.Fo ASN1_item_digest
diff --git a/src/lib/libcrypto/man/ASN1_item_new.3 b/src/lib/libcrypto/man/ASN1_item_new.3
index 7015ed6319..42e9dd8f68 100644
--- a/src/lib/libcrypto/man/ASN1_item_new.3
+++ b/src/lib/libcrypto/man/ASN1_item_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_item_new.3,v 1.11 2022/01/12 17:54:51 tb Exp $ 1.\" $OpenBSD: ASN1_item_new.3,v 1.12 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016, 2018 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016, 2018 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: January 12 2022 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt ASN1_ITEM_NEW 3 18.Dt ASN1_ITEM_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm ASN1_item_free 22.Nm ASN1_item_free
23.Nd generic ASN.1 value constructor and destructor 23.Nd generic ASN.1 value constructor and destructor
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/asn1.h 26.In openssl/asn1.h
26.Ft ASN1_VALUE * 27.Ft ASN1_VALUE *
27.Fo ASN1_item_new 28.Fo ASN1_item_new
diff --git a/src/lib/libcrypto/man/ASN1_item_pack.3 b/src/lib/libcrypto/man/ASN1_item_pack.3
index 4c87530622..d0023f599d 100644
--- a/src/lib/libcrypto/man/ASN1_item_pack.3
+++ b/src/lib/libcrypto/man/ASN1_item_pack.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_item_pack.3,v 1.1 2021/11/15 11:51:09 schwarze Exp $ 1.\" $OpenBSD: ASN1_item_pack.3,v 1.2 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: November 15 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt ASN1_ITEM_PACK 3 18.Dt ASN1_ITEM_PACK 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm ASN1_item_unpack 22.Nm ASN1_item_unpack
23.Nd pack an ASN.1 object into an ASN1_STRING 23.Nd pack an ASN.1 object into an ASN1_STRING
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/asn1.h 26.In openssl/asn1.h
26.Ft ASN1_STRING * 27.Ft ASN1_STRING *
27.Fo ASN1_item_pack 28.Fo ASN1_item_pack
diff --git a/src/lib/libcrypto/man/ASN1_item_sign.3 b/src/lib/libcrypto/man/ASN1_item_sign.3
index 8c09fe77ff..72e317c310 100644
--- a/src/lib/libcrypto/man/ASN1_item_sign.3
+++ b/src/lib/libcrypto/man/ASN1_item_sign.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_item_sign.3,v 1.3 2024/12/06 12:51:13 schwarze Exp $ 1.\" $OpenBSD: ASN1_item_sign.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: December 6 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt ASN1_ITEM_SIGN 3 18.Dt ASN1_ITEM_SIGN 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm ASN1_item_sign_ctx 22.Nm ASN1_item_sign_ctx
23.Nd DER-encode and sign an ASN.1 value 23.Nd DER-encode and sign an ASN.1 value
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/x509.h 26.In openssl/x509.h
26.Ft int 27.Ft int
27.Fo ASN1_item_sign 28.Fo ASN1_item_sign
diff --git a/src/lib/libcrypto/man/ASN1_item_verify.3 b/src/lib/libcrypto/man/ASN1_item_verify.3
index d2810879e3..282db875bb 100644
--- a/src/lib/libcrypto/man/ASN1_item_verify.3
+++ b/src/lib/libcrypto/man/ASN1_item_verify.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_item_verify.3,v 1.3 2021/12/18 17:47:44 schwarze Exp $ 1.\" $OpenBSD: ASN1_item_verify.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: December 18 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt ASN1_ITEM_VERIFY 3 18.Dt ASN1_ITEM_VERIFY 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm ASN1_item_verify 21.Nm ASN1_item_verify
22.Nd signature verification for ASN.1 values 22.Nd signature verification for ASN.1 values
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
24.In openssl/x509.h 25.In openssl/x509.h
25.Ft int 26.Ft int
26.Fo ASN1_item_verify 27.Fo ASN1_item_verify
diff --git a/src/lib/libcrypto/man/ASN1_mbstring_copy.3 b/src/lib/libcrypto/man/ASN1_mbstring_copy.3
index e0b48aaa62..6a64bc7464 100644
--- a/src/lib/libcrypto/man/ASN1_mbstring_copy.3
+++ b/src/lib/libcrypto/man/ASN1_mbstring_copy.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_mbstring_copy.3,v 1.6 2022/02/21 00:22:03 jsg Exp $ 1.\" $OpenBSD: ASN1_mbstring_copy.3,v 1.7 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: February 21 2022 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt ASN1_MBSTRING_COPY 3 18.Dt ASN1_MBSTRING_COPY 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -27,6 +27,7 @@
27.Nm ASN1_tag2bit 27.Nm ASN1_tag2bit
28.Nd copy a multibyte string into an ASN.1 string object 28.Nd copy a multibyte string into an ASN.1 string object
29.Sh SYNOPSIS 29.Sh SYNOPSIS
30.Lb libcrypto
30.In openssl/asn1.h 31.In openssl/asn1.h
31.Ft int 32.Ft int
32.Fo ASN1_mbstring_copy 33.Fo ASN1_mbstring_copy
diff --git a/src/lib/libcrypto/man/ASN1_parse_dump.3 b/src/lib/libcrypto/man/ASN1_parse_dump.3
index 50761f38aa..45aa673d4c 100644
--- a/src/lib/libcrypto/man/ASN1_parse_dump.3
+++ b/src/lib/libcrypto/man/ASN1_parse_dump.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_parse_dump.3,v 1.3 2021/12/09 18:52:09 schwarze Exp $ 1.\" $OpenBSD: ASN1_parse_dump.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: December 9 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt ASN1_PARSE_DUMP 3 18.Dt ASN1_PARSE_DUMP 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm ASN1_parse 22.Nm ASN1_parse
23.Nd parse BER and print information about it 23.Nd parse BER and print information about it
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/asn1.h 26.In openssl/asn1.h
26.Ft int 27.Ft int
27.Fo ASN1_parse_dump 28.Fo ASN1_parse_dump
diff --git a/src/lib/libcrypto/man/ASN1_put_object.3 b/src/lib/libcrypto/man/ASN1_put_object.3
index 97a352724c..94fa55366a 100644
--- a/src/lib/libcrypto/man/ASN1_put_object.3
+++ b/src/lib/libcrypto/man/ASN1_put_object.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_put_object.3,v 1.5 2022/01/12 17:54:51 tb Exp $ 1.\" $OpenBSD: ASN1_put_object.3,v 1.6 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2019, 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2019, 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: January 12 2022 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt ASN1_PUT_OBJECT 3 18.Dt ASN1_PUT_OBJECT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -23,6 +23,7 @@
23.Nm ASN1_object_size 23.Nm ASN1_object_size
24.Nd start and end the BER encoding of an arbitrary ASN.1 data element 24.Nd start and end the BER encoding of an arbitrary ASN.1 data element
25.Sh SYNOPSIS 25.Sh SYNOPSIS
26.Lb libcrypto
26.In openssl/asn1.h 27.In openssl/asn1.h
27.Ft void 28.Ft void
28.Fo ASN1_put_object 29.Fo ASN1_put_object
diff --git a/src/lib/libcrypto/man/ASRange_new.3 b/src/lib/libcrypto/man/ASRange_new.3
index dc58c98e58..b507213b48 100644
--- a/src/lib/libcrypto/man/ASRange_new.3
+++ b/src/lib/libcrypto/man/ASRange_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASRange_new.3,v 1.8 2023/10/11 12:06:11 tb Exp $ 1.\" $OpenBSD: ASRange_new.3,v 1.10 2025/06/13 18:34:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> 3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: October 11 2023 $ 17.Dd $Mdocdate: June 13 2025 $
18.Dt ASRANGE_NEW 3 18.Dt ASRANGE_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -32,8 +32,9 @@
32.Nm i2d_ASIdentifierChoice 32.Nm i2d_ASIdentifierChoice
33.Nd RFC 3779 autonomous system identifiers and ranges 33.Nd RFC 3779 autonomous system identifiers and ranges
34.Sh SYNOPSIS 34.Sh SYNOPSIS
35.Lb libcrypto
35.In openssl/x509v3.h 36.In openssl/x509v3.h
36.Ft "ASRange *" 37.Ft ASRange *
37.Fn ASRange_new void 38.Fn ASRange_new void
38.Ft void 39.Ft void
39.Fn ASRange_free "ASRange *asrange" 40.Fn ASRange_free "ASRange *asrange"
@@ -48,7 +49,7 @@
48.Fa "ASRange *asrange" 49.Fa "ASRange *asrange"
49.Fa "unsigned char **der_out" 50.Fa "unsigned char **der_out"
50.Fc 51.Fc
51.Ft "ASIdOrRange *" 52.Ft ASIdOrRange *
52.Fn ASIdOrRange_new void 53.Fn ASIdOrRange_new void
53.Ft void 54.Ft void
54.Fn ASIdOrRange_free "ASIdOrRange *aor" 55.Fn ASIdOrRange_free "ASIdOrRange *aor"
@@ -63,7 +64,7 @@
63.Fa "ASIdOrRange *aor" 64.Fa "ASIdOrRange *aor"
64.Fa "unsigned char **der_out" 65.Fa "unsigned char **der_out"
65.Fc 66.Fc
66.Ft "ASIdentifierChoice *" 67.Ft ASIdentifierChoice *
67.Fn ASIdentifierChoice_new void 68.Fn ASIdentifierChoice_new void
68.Ft void 69.Ft void
69.Fn ASIdentifierChoice_free "ASIdentifierChoice *aic" 70.Fn ASIdentifierChoice_free "ASIdentifierChoice *aic"
diff --git a/src/lib/libcrypto/man/AUTHORITY_KEYID_new.3 b/src/lib/libcrypto/man/AUTHORITY_KEYID_new.3
index bff451ff36..982685d17f 100644
--- a/src/lib/libcrypto/man/AUTHORITY_KEYID_new.3
+++ b/src/lib/libcrypto/man/AUTHORITY_KEYID_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: AUTHORITY_KEYID_new.3,v 1.4 2019/06/06 01:06:58 schwarze Exp $ 1.\" $OpenBSD: AUTHORITY_KEYID_new.3,v 1.5 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 6 2019 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt AUTHORITY_KEYID_NEW 3 18.Dt AUTHORITY_KEYID_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm AUTHORITY_KEYID_free 22.Nm AUTHORITY_KEYID_free
23.Nd X.509 authority key identifier extension 23.Nd X.509 authority key identifier extension
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/x509v3.h 26.In openssl/x509v3.h
26.Ft AUTHORITY_KEYID * 27.Ft AUTHORITY_KEYID *
27.Fn AUTHORITY_KEYID_new void 28.Fn AUTHORITY_KEYID_new void
diff --git a/src/lib/libcrypto/man/BASIC_CONSTRAINTS_new.3 b/src/lib/libcrypto/man/BASIC_CONSTRAINTS_new.3
index e60b0d223c..f1b1486a8a 100644
--- a/src/lib/libcrypto/man/BASIC_CONSTRAINTS_new.3
+++ b/src/lib/libcrypto/man/BASIC_CONSTRAINTS_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BASIC_CONSTRAINTS_new.3,v 1.6 2021/10/27 11:24:47 schwarze Exp $ 1.\" $OpenBSD: BASIC_CONSTRAINTS_new.3,v 1.7 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: October 27 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt BASIC_CONSTRAINTS_NEW 3 18.Dt BASIC_CONSTRAINTS_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm BASIC_CONSTRAINTS_free 22.Nm BASIC_CONSTRAINTS_free
23.Nd X.509 extension to mark CA certificates 23.Nd X.509 extension to mark CA certificates
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/x509v3.h 26.In openssl/x509v3.h
26.Ft BASIC_CONSTRAINTS * 27.Ft BASIC_CONSTRAINTS *
27.Fn BASIC_CONSTRAINTS_new void 28.Fn BASIC_CONSTRAINTS_new void
diff --git a/src/lib/libcrypto/man/BF_set_key.3 b/src/lib/libcrypto/man/BF_set_key.3
index 5f4c7a689b..1299a0f2ef 100644
--- a/src/lib/libcrypto/man/BF_set_key.3
+++ b/src/lib/libcrypto/man/BF_set_key.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BF_set_key.3,v 1.12 2023/08/05 18:27:55 jmc Exp $ 1.\" $OpenBSD: BF_set_key.3,v 1.13 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL 99d63d46 Jul 19 09:27:53 2016 -0400 2.\" OpenSSL 99d63d46 Jul 19 09:27:53 2016 -0400
3.\" 3.\"
4.\" This file was written by Richard Levitte <levitte@openssl.org>. 4.\" This file was written by Richard Levitte <levitte@openssl.org>.
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: August 5 2023 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt BF_SET_KEY 3 53.Dt BF_SET_KEY 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -62,6 +62,7 @@
62.Nm BF_ofb64_encrypt 62.Nm BF_ofb64_encrypt
63.Nd Blowfish encryption 63.Nd Blowfish encryption
64.Sh SYNOPSIS 64.Sh SYNOPSIS
65.Lb libcrypto
65.In openssl/blowfish.h 66.In openssl/blowfish.h
66.Ft void 67.Ft void
67.Fo BF_set_key 68.Fo BF_set_key
diff --git a/src/lib/libcrypto/man/BIO_accept.3 b/src/lib/libcrypto/man/BIO_accept.3
index e2547ac0dd..73b415017f 100644
--- a/src/lib/libcrypto/man/BIO_accept.3
+++ b/src/lib/libcrypto/man/BIO_accept.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_accept.3,v 1.2 2023/04/30 13:38:48 schwarze Exp $ 1.\" $OpenBSD: BIO_accept.3,v 1.3 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: April 30 2023 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt BIO_ACCEPT 3 18.Dt BIO_ACCEPT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -43,6 +43,7 @@
43.\" .Nm BIO_sock_cleanup 43.\" .Nm BIO_sock_cleanup
44.Nd wrappers for socket operations 44.Nd wrappers for socket operations
45.Sh SYNOPSIS 45.Sh SYNOPSIS
46.Lb libcrypto
46.In openssl/bio.h 47.In openssl/bio.h
47.Ft int 48.Ft int
48.Fo BIO_get_host_ip 49.Fo BIO_get_host_ip
diff --git a/src/lib/libcrypto/man/BIO_ctrl.3 b/src/lib/libcrypto/man/BIO_ctrl.3
index 2c537956e1..ca13f2067b 100644
--- a/src/lib/libcrypto/man/BIO_ctrl.3
+++ b/src/lib/libcrypto/man/BIO_ctrl.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_ctrl.3,v 1.25 2023/11/16 20:19:23 schwarze Exp $ 1.\" $OpenBSD: BIO_ctrl.3,v 1.26 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 24a535eaf Tue Sep 22 13:14:20 2020 +0100 2.\" full merge up to: OpenSSL 24a535eaf Tue Sep 22 13:14:20 2020 +0100
3.\" selective merge up to: OpenSSL 0c5bc96f Tue Mar 15 13:57:22 2022 +0000 3.\" selective merge up to: OpenSSL 0c5bc96f Tue Mar 15 13:57:22 2022 +0000
4.\" 4.\"
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: November 16 2023 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt BIO_CTRL 3 70.Dt BIO_CTRL 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -91,6 +91,7 @@
91.Nm bio_info_cb 91.Nm bio_info_cb
92.Nd BIO control operations 92.Nd BIO control operations
93.Sh SYNOPSIS 93.Sh SYNOPSIS
94.Lb libcrypto
94.In openssl/bio.h 95.In openssl/bio.h
95.Ft long 96.Ft long
96.Fo BIO_ctrl 97.Fo BIO_ctrl
diff --git a/src/lib/libcrypto/man/BIO_dump.3 b/src/lib/libcrypto/man/BIO_dump.3
index 8817f0c4ca..2c06c8cc9c 100644
--- a/src/lib/libcrypto/man/BIO_dump.3
+++ b/src/lib/libcrypto/man/BIO_dump.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_dump.3,v 1.4 2022/12/20 15:34:03 schwarze Exp $ 1.\" $OpenBSD: BIO_dump.3,v 1.6 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,19 +14,15 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: December 20 2022 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt BIO_DUMP 3 18.Dt BIO_DUMP 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm BIO_dump , 21.Nm BIO_dump ,
22.Nm BIO_dump_indent , 22.Nm BIO_dump_indent
23.Nm BIO_dump_fp ,
24.Nm BIO_dump_indent_fp
25.\" intentionally undocumented because nothing uses these two functions:
26.\" .Nm BIO_dump_cb
27.\" .Nm BIO_dump_indent_cb
28.Nd hexadecimal printout of arbitrary byte arrays 23.Nd hexadecimal printout of arbitrary byte arrays
29.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
30.In openssl/bio.h 26.In openssl/bio.h
31.Ft int 27.Ft int
32.Fo BIO_dump 28.Fo BIO_dump
@@ -41,19 +37,6 @@
41.Fa "int len" 37.Fa "int len"
42.Fa "int indent" 38.Fa "int indent"
43.Fc 39.Fc
44.Ft int
45.Fo BIO_dump_fp
46.Fa "FILE *fp"
47.Fa "const char *s"
48.Fa "int len"
49.Fc
50.Ft int
51.Fo BIO_dump_indent_fp
52.Fa "FILE *fp"
53.Fa "const char *s"
54.Fa "int len"
55.Fa "int indent"
56.Fc
57.Sh DESCRIPTION 40.Sh DESCRIPTION
58.Fn BIO_dump 41.Fn BIO_dump
59prints 42prints
@@ -92,14 +75,6 @@ If
92.Fa indent 75.Fa indent
93is 7 or more, the number of data columns is reduced such that the 76is 7 or more, the number of data columns is reduced such that the
94total width of the output does not exceed 79 characters per line. 77total width of the output does not exceed 79 characters per line.
95.Pp
96.Fn BIO_dump_fp
97and
98.Fn BIO_dump_indent_fp
99are similar except that
100.Xr fwrite 3
101is used instead of
102.Xr BIO_write 3 .
103.Sh RETURN VALUES 78.Sh RETURN VALUES
104On success these functions return the total number of bytes written by 79On success these functions return the total number of bytes written by
105.Xr BIO_write 3 80.Xr BIO_write 3
@@ -120,9 +95,3 @@ first appeared in SSLeay 0.6.5 and has been available since
120.Fn BIO_dump_indent 95.Fn BIO_dump_indent
121first appeared in OpenSSL 0.9.6 and has been available since 96first appeared in OpenSSL 0.9.6 and has been available since
122.Ox 2.9 . 97.Ox 2.9 .
123.Pp
124.Fn BIO_dump_fp
125and
126.Fn BIO_dump_indent_fp
127first appeared in OpenSSL 0.9.8 and have been available since
128.Ox 4.5 .
diff --git a/src/lib/libcrypto/man/BIO_dup_chain.3 b/src/lib/libcrypto/man/BIO_dup_chain.3
index 5c5e8c6533..ad753e71a5 100644
--- a/src/lib/libcrypto/man/BIO_dup_chain.3
+++ b/src/lib/libcrypto/man/BIO_dup_chain.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_dup_chain.3,v 1.2 2023/04/09 06:27:52 jsg Exp $ 1.\" $OpenBSD: BIO_dup_chain.3,v 1.3 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: April 9 2023 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt BIO_DUP_CHAIN 3 18.Dt BIO_DUP_CHAIN 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm BIO_dup_state 22.Nm BIO_dup_state
23.Nd copy a BIO chain 23.Nd copy a BIO chain
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/bio.h 26.In openssl/bio.h
26.Ft BIO * 27.Ft BIO *
27.Fn BIO_dup_chain "BIO *b" 28.Fn BIO_dup_chain "BIO *b"
diff --git a/src/lib/libcrypto/man/BIO_f_base64.3 b/src/lib/libcrypto/man/BIO_f_base64.3
index e4589de035..f652dac100 100644
--- a/src/lib/libcrypto/man/BIO_f_base64.3
+++ b/src/lib/libcrypto/man/BIO_f_base64.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_f_base64.3,v 1.15 2023/09/11 04:00:40 jsg Exp $ 1.\" $OpenBSD: BIO_f_base64.3,v 1.16 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL fc1d88f0 Wed Jul 2 22:42:40 2014 -0400 2.\" OpenSSL fc1d88f0 Wed Jul 2 22:42:40 2014 -0400
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: September 11 2023 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt BIO_F_BASE64 3 53.Dt BIO_F_BASE64 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -60,6 +60,7 @@
60.\" and practically unused outside evp/bio_b64.c. 60.\" and practically unused outside evp/bio_b64.c.
61.Nd base64 BIO filter 61.Nd base64 BIO filter
62.Sh SYNOPSIS 62.Sh SYNOPSIS
63.Lb libcrypto
63.In openssl/bio.h 64.In openssl/bio.h
64.In openssl/evp.h 65.In openssl/evp.h
65.Ft const BIO_METHOD * 66.Ft const BIO_METHOD *
diff --git a/src/lib/libcrypto/man/BIO_f_buffer.3 b/src/lib/libcrypto/man/BIO_f_buffer.3
index a3012c5c5d..28c4f3166f 100644
--- a/src/lib/libcrypto/man/BIO_f_buffer.3
+++ b/src/lib/libcrypto/man/BIO_f_buffer.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_f_buffer.3,v 1.17 2023/04/29 12:22:08 schwarze Exp $ 1.\" $OpenBSD: BIO_f_buffer.3,v 1.18 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: April 29 2023 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt BIO_F_BUFFER 3 70.Dt BIO_F_BUFFER 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -82,6 +82,7 @@
82.\" whatever that is supposed to be, but are NOOPs, and nothing uses them. 82.\" whatever that is supposed to be, but are NOOPs, and nothing uses them.
83.Nd buffering BIO 83.Nd buffering BIO
84.Sh SYNOPSIS 84.Sh SYNOPSIS
85.Lb libcrypto
85.In openssl/bio.h 86.In openssl/bio.h
86.Ft const BIO_METHOD * 87.Ft const BIO_METHOD *
87.Fo BIO_f_buffer 88.Fo BIO_f_buffer
diff --git a/src/lib/libcrypto/man/BIO_f_cipher.3 b/src/lib/libcrypto/man/BIO_f_cipher.3
index c5d00c6981..3f7fe7bfaf 100644
--- a/src/lib/libcrypto/man/BIO_f_cipher.3
+++ b/src/lib/libcrypto/man/BIO_f_cipher.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_f_cipher.3,v 1.16 2023/04/29 12:01:53 schwarze Exp $ 1.\" $OpenBSD: BIO_f_cipher.3,v 1.17 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: April 29 2023 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt BIO_F_CIPHER 3 53.Dt BIO_F_CIPHER 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -60,6 +60,7 @@
60.\" .Nm BIO_CTRL_SET is intentionally undocumented because it has no effect. 60.\" .Nm BIO_CTRL_SET is intentionally undocumented because it has no effect.
61.Nd cipher BIO filter 61.Nd cipher BIO filter
62.Sh SYNOPSIS 62.Sh SYNOPSIS
63.Lb libcrypto
63.In openssl/bio.h 64.In openssl/bio.h
64.In openssl/evp.h 65.In openssl/evp.h
65.Ft const BIO_METHOD * 66.Ft const BIO_METHOD *
diff --git a/src/lib/libcrypto/man/BIO_f_md.3 b/src/lib/libcrypto/man/BIO_f_md.3
index 279aabc980..ba5a0d9b85 100644
--- a/src/lib/libcrypto/man/BIO_f_md.3
+++ b/src/lib/libcrypto/man/BIO_f_md.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_f_md.3,v 1.15 2023/04/28 16:20:01 schwarze Exp $ 1.\" $OpenBSD: BIO_f_md.3,v 1.16 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: April 28 2023 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt BIO_F_MD 3 70.Dt BIO_F_MD 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -77,6 +77,7 @@
77.Nm BIO_set_md_ctx 77.Nm BIO_set_md_ctx
78.Nd message digest BIO filter 78.Nd message digest BIO filter
79.Sh SYNOPSIS 79.Sh SYNOPSIS
80.Lb libcrypto
80.In openssl/bio.h 81.In openssl/bio.h
81.In openssl/evp.h 82.In openssl/evp.h
82.Ft const BIO_METHOD * 83.Ft const BIO_METHOD *
diff --git a/src/lib/libcrypto/man/BIO_f_null.3 b/src/lib/libcrypto/man/BIO_f_null.3
index 687d991b52..ea75a242a4 100644
--- a/src/lib/libcrypto/man/BIO_f_null.3
+++ b/src/lib/libcrypto/man/BIO_f_null.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_f_null.3,v 1.12 2023/04/11 16:58:43 schwarze Exp $ 1.\" $OpenBSD: BIO_f_null.3,v 1.13 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: April 11 2023 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt BIO_F_NULL 3 52.Dt BIO_F_NULL 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -58,6 +58,7 @@
58.\" except in openssl(1) s_client/s_server -nbio_test. 58.\" except in openssl(1) s_client/s_server -nbio_test.
59.Nd null filter 59.Nd null filter
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libcrypto
61.In openssl/bio.h 62.In openssl/bio.h
62.Ft const BIO_METHOD * 63.Ft const BIO_METHOD *
63.Fo BIO_f_null 64.Fo BIO_f_null
diff --git a/src/lib/libcrypto/man/BIO_find_type.3 b/src/lib/libcrypto/man/BIO_find_type.3
index 4a9eee7832..88f36032c7 100644
--- a/src/lib/libcrypto/man/BIO_find_type.3
+++ b/src/lib/libcrypto/man/BIO_find_type.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_find_type.3,v 1.12 2023/07/26 20:01:04 tb Exp $ 1.\" $OpenBSD: BIO_find_type.3,v 1.13 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 1cb7eff4 Sep 10 13:56:40 2019 +0100 2.\" full merge up to: OpenSSL 1cb7eff4 Sep 10 13:56:40 2019 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: July 26 2023 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt BIO_FIND_TYPE 3 69.Dt BIO_FIND_TYPE 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -75,6 +75,7 @@
75.Nm BIO_method_name 75.Nm BIO_method_name
76.Nd BIO chain traversal 76.Nd BIO chain traversal
77.Sh SYNOPSIS 77.Sh SYNOPSIS
78.Lb libcrypto
78.In openssl/bio.h 79.In openssl/bio.h
79.Ft BIO * 80.Ft BIO *
80.Fo BIO_find_type 81.Fo BIO_find_type
diff --git a/src/lib/libcrypto/man/BIO_get_data.3 b/src/lib/libcrypto/man/BIO_get_data.3
index 63750ac37b..26783929b1 100644
--- a/src/lib/libcrypto/man/BIO_get_data.3
+++ b/src/lib/libcrypto/man/BIO_get_data.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_get_data.3,v 1.8 2023/11/16 20:27:43 schwarze Exp $ 1.\" $OpenBSD: BIO_get_data.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 2.\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: November 16 2023 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt BIO_GET_DATA 3 69.Dt BIO_GET_DATA 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -87,6 +87,7 @@
87.Nm BIO_get_shutdown 87.Nm BIO_get_shutdown
88.Nd manage BIO state information 88.Nd manage BIO state information
89.Sh SYNOPSIS 89.Sh SYNOPSIS
90.Lb libcrypto
90.In openssl/bio.h 91.In openssl/bio.h
91.Ft void 92.Ft void
92.Fo BIO_set_data 93.Fo BIO_set_data
diff --git a/src/lib/libcrypto/man/BIO_get_ex_new_index.3 b/src/lib/libcrypto/man/BIO_get_ex_new_index.3
index 54d00775e7..13d20e14a8 100644
--- a/src/lib/libcrypto/man/BIO_get_ex_new_index.3
+++ b/src/lib/libcrypto/man/BIO_get_ex_new_index.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_get_ex_new_index.3,v 1.17 2023/11/19 10:26:36 tb Exp $ 1.\" $OpenBSD: BIO_get_ex_new_index.3,v 1.18 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 2.\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800
3.\" 3.\"
4.\" This file was written by Rich Salz <rsalz@akamai.com>. 4.\" This file was written by Rich Salz <rsalz@akamai.com>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: November 19 2023 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt BIO_GET_EX_NEW_INDEX 3 52.Dt BIO_GET_EX_NEW_INDEX 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -68,6 +68,7 @@
68.Nm EC_KEY_set_ex_data 68.Nm EC_KEY_set_ex_data
69.Nd application-specific data 69.Nd application-specific data
70.Sh SYNOPSIS 70.Sh SYNOPSIS
71.Lb libcrypto
71.In openssl/bio.h 72.In openssl/bio.h
72.In openssl/ui.h 73.In openssl/ui.h
73.In openssl/x509.h 74.In openssl/x509.h
diff --git a/src/lib/libcrypto/man/BIO_meth_new.3 b/src/lib/libcrypto/man/BIO_meth_new.3
index 2159560596..98feac5bcc 100644
--- a/src/lib/libcrypto/man/BIO_meth_new.3
+++ b/src/lib/libcrypto/man/BIO_meth_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_meth_new.3,v 1.5 2018/07/09 09:52:18 tb Exp $ 1.\" $OpenBSD: BIO_meth_new.3,v 1.6 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 3.\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800
4.\" 4.\"
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: July 9 2018 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt BIO_METH_NEW 3 70.Dt BIO_METH_NEW 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -91,6 +91,7 @@
91.Nm BIO_meth_set_callback_ctrl 91.Nm BIO_meth_set_callback_ctrl
92.Nd manipulate BIO_METHOD structures 92.Nd manipulate BIO_METHOD structures
93.Sh SYNOPSIS 93.Sh SYNOPSIS
94.Lb libcrypto
94.In openssl/bio.h 95.In openssl/bio.h
95.Ft int 96.Ft int
96.Fn BIO_get_new_index void 97.Fn BIO_get_new_index void
diff --git a/src/lib/libcrypto/man/BIO_new.3 b/src/lib/libcrypto/man/BIO_new.3
index f97a314826..f0079948fb 100644
--- a/src/lib/libcrypto/man/BIO_new.3
+++ b/src/lib/libcrypto/man/BIO_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_new.3,v 1.28 2023/07/26 20:01:04 tb Exp $ 1.\" $OpenBSD: BIO_new.3,v 1.29 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL man3/BIO_new.pod fb46be03 Feb 26 11:51:31 2016 +0000 3.\" OpenSSL man3/BIO_new.pod fb46be03 Feb 26 11:51:31 2016 +0000
4.\" OpenSSL man7/bio.pod 631c37be Dec 12 16:56:50 2017 +0100 4.\" OpenSSL man7/bio.pod 631c37be Dec 12 16:56:50 2017 +0100
@@ -52,7 +52,7 @@
52.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 52.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
53.\" OF THE POSSIBILITY OF SUCH DAMAGE. 53.\" OF THE POSSIBILITY OF SUCH DAMAGE.
54.\" 54.\"
55.Dd $Mdocdate: July 26 2023 $ 55.Dd $Mdocdate: June 8 2025 $
56.Dt BIO_NEW 3 56.Dt BIO_NEW 3
57.Os 57.Os
58.Sh NAME 58.Sh NAME
@@ -64,6 +64,7 @@
64.Nm BIO_free_all 64.Nm BIO_free_all
65.Nd construct and destruct I/O abstraction objects 65.Nd construct and destruct I/O abstraction objects
66.Sh SYNOPSIS 66.Sh SYNOPSIS
67.Lb libcrypto
67.In openssl/bio.h 68.In openssl/bio.h
68.Ft BIO * 69.Ft BIO *
69.Fo BIO_new 70.Fo BIO_new
diff --git a/src/lib/libcrypto/man/BIO_new_CMS.3 b/src/lib/libcrypto/man/BIO_new_CMS.3
index ab93e1c00c..0279f704f4 100644
--- a/src/lib/libcrypto/man/BIO_new_CMS.3
+++ b/src/lib/libcrypto/man/BIO_new_CMS.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_new_CMS.3,v 1.9 2023/05/01 07:28:11 tb Exp $ 1.\" $OpenBSD: BIO_new_CMS.3,v 1.10 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL df75c2bfc Dec 9 01:02:36 2018 +0100 2.\" full merge up to: OpenSSL df75c2bfc Dec 9 01:02:36 2018 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: May 1 2023 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt BIO_NEW_CMS 3 52.Dt BIO_NEW_CMS 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm BIO_new_CMS 55.Nm BIO_new_CMS
56.Nd CMS streaming filter BIO 56.Nd CMS streaming filter BIO
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/cms.h 59.In openssl/cms.h
59.Ft BIO * 60.Ft BIO *
60.Fo BIO_new_CMS 61.Fo BIO_new_CMS
diff --git a/src/lib/libcrypto/man/BIO_printf.3 b/src/lib/libcrypto/man/BIO_printf.3
index 32dec0a828..6df31ad24c 100644
--- a/src/lib/libcrypto/man/BIO_printf.3
+++ b/src/lib/libcrypto/man/BIO_printf.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_printf.3,v 1.4 2024/03/02 09:18:28 tb Exp $ 1.\" $OpenBSD: BIO_printf.3,v 1.5 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL 2ca2e917 Mon Mar 20 16:25:22 2017 -0400 2.\" OpenSSL 2ca2e917 Mon Mar 20 16:25:22 2017 -0400
3.\" 3.\"
4.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> 4.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,13 +15,14 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 17.\"
18.Dd $Mdocdate: March 2 2024 $ 18.Dd $Mdocdate: June 8 2025 $
19.Dt BIO_PRINTF 3 19.Dt BIO_PRINTF 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
22.Nm BIO_printf 22.Nm BIO_printf
23.Nd formatted output to a BIO 23.Nd formatted output to a BIO
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/bio.h 26.In openssl/bio.h
26.Ft int 27.Ft int
27.Fo BIO_printf 28.Fo BIO_printf
diff --git a/src/lib/libcrypto/man/BIO_push.3 b/src/lib/libcrypto/man/BIO_push.3
index 46c736e2c2..21b798a54f 100644
--- a/src/lib/libcrypto/man/BIO_push.3
+++ b/src/lib/libcrypto/man/BIO_push.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_push.3,v 1.14 2022/12/16 16:02:17 schwarze Exp $ 1.\" $OpenBSD: BIO_push.3,v 1.15 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL doc/man3/BIO_push.pod 791bfd91 Nov 19 20:38:27 2021 +0100 3.\" OpenSSL doc/man3/BIO_push.pod 791bfd91 Nov 19 20:38:27 2021 +0100
4.\" OpenSSL doc/man7/bio.pod 1cb7eff4 Sep 10 13:56:40 2019 +0100 4.\" OpenSSL doc/man7/bio.pod 1cb7eff4 Sep 10 13:56:40 2019 +0100
@@ -67,7 +67,7 @@
67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
69.\" 69.\"
70.Dd $Mdocdate: December 16 2022 $ 70.Dd $Mdocdate: June 8 2025 $
71.Dt BIO_PUSH 3 71.Dt BIO_PUSH 3
72.Os 72.Os
73.Sh NAME 73.Sh NAME
@@ -76,6 +76,7 @@
76.Nm BIO_set_next 76.Nm BIO_set_next
77.Nd manipulate BIO chains 77.Nd manipulate BIO chains
78.Sh SYNOPSIS 78.Sh SYNOPSIS
79.Lb libcrypto
79.In openssl/bio.h 80.In openssl/bio.h
80.Ft BIO * 81.Ft BIO *
81.Fo BIO_push 82.Fo BIO_push
diff --git a/src/lib/libcrypto/man/BIO_read.3 b/src/lib/libcrypto/man/BIO_read.3
index 5fea9f728a..2a65b18535 100644
--- a/src/lib/libcrypto/man/BIO_read.3
+++ b/src/lib/libcrypto/man/BIO_read.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_read.3,v 1.11 2022/12/18 17:40:55 schwarze Exp $ 1.\" $OpenBSD: BIO_read.3,v 1.12 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: December 18 2022 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt BIO_READ 3 69.Dt BIO_READ 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -78,6 +78,7 @@
78.Nm BIO_number_written 78.Nm BIO_number_written
79.Nd BIO I/O functions 79.Nd BIO I/O functions
80.Sh SYNOPSIS 80.Sh SYNOPSIS
81.Lb libcrypto
81.In openssl/bio.h 82.In openssl/bio.h
82.Ft int 83.Ft int
83.Fo BIO_read 84.Fo BIO_read
diff --git a/src/lib/libcrypto/man/BIO_s_accept.3 b/src/lib/libcrypto/man/BIO_s_accept.3
index 8e88fe1c52..c5a8f6d293 100644
--- a/src/lib/libcrypto/man/BIO_s_accept.3
+++ b/src/lib/libcrypto/man/BIO_s_accept.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_s_accept.3,v 1.16 2023/04/29 13:06:10 schwarze Exp $ 1.\" $OpenBSD: BIO_s_accept.3,v 1.17 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL c03726ca Thu Aug 27 12:28:08 2015 -0400 2.\" full merge up to: OpenSSL c03726ca Thu Aug 27 12:28:08 2015 -0400
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: April 29 2023 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt BIO_S_ACCEPT 3 69.Dt BIO_S_ACCEPT 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -80,6 +80,7 @@
80.Nm BIO_do_accept 80.Nm BIO_do_accept
81.Nd accept BIO 81.Nd accept BIO
82.Sh SYNOPSIS 82.Sh SYNOPSIS
83.Lb libcrypto
83.In openssl/bio.h 84.In openssl/bio.h
84.Ft const BIO_METHOD * 85.Ft const BIO_METHOD *
85.Fo BIO_s_accept 86.Fo BIO_s_accept
diff --git a/src/lib/libcrypto/man/BIO_s_bio.3 b/src/lib/libcrypto/man/BIO_s_bio.3
index efda019df3..6590ff81ec 100644
--- a/src/lib/libcrypto/man/BIO_s_bio.3
+++ b/src/lib/libcrypto/man/BIO_s_bio.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_s_bio.3,v 1.20 2024/05/19 07:12:50 jsg Exp $ 1.\" $OpenBSD: BIO_s_bio.3,v 1.21 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file was written by 4.\" This file was written by
@@ -53,7 +53,7 @@
53.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 53.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
54.\" OF THE POSSIBILITY OF SUCH DAMAGE. 54.\" OF THE POSSIBILITY OF SUCH DAMAGE.
55.\" 55.\"
56.Dd $Mdocdate: May 19 2024 $ 56.Dd $Mdocdate: June 8 2025 $
57.Dt BIO_S_BIO 3 57.Dt BIO_S_BIO 3
58.Os 58.Os
59.Sh NAME 59.Sh NAME
@@ -71,6 +71,7 @@
71.Nm BIO_ctrl_reset_read_request 71.Nm BIO_ctrl_reset_read_request
72.Nd BIO pair BIO 72.Nd BIO pair BIO
73.Sh SYNOPSIS 73.Sh SYNOPSIS
74.Lb libcrypto
74.In openssl/bio.h 75.In openssl/bio.h
75.Ft const BIO_METHOD * 76.Ft const BIO_METHOD *
76.Fo BIO_s_bio 77.Fo BIO_s_bio
diff --git a/src/lib/libcrypto/man/BIO_s_connect.3 b/src/lib/libcrypto/man/BIO_s_connect.3
index bce68a26b9..ca7ee6d988 100644
--- a/src/lib/libcrypto/man/BIO_s_connect.3
+++ b/src/lib/libcrypto/man/BIO_s_connect.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_s_connect.3,v 1.19 2023/04/30 13:53:54 schwarze Exp $ 1.\" $OpenBSD: BIO_s_connect.3,v 1.20 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 0e474b8b Nov 1 15:45:49 2015 +0100 2.\" full merge up to: OpenSSL 0e474b8b Nov 1 15:45:49 2015 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: April 30 2023 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt BIO_S_CONNECT 3 69.Dt BIO_S_CONNECT 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -83,6 +83,7 @@
83.Nm BIO_do_connect 83.Nm BIO_do_connect
84.Nd connect BIO 84.Nd connect BIO
85.Sh SYNOPSIS 85.Sh SYNOPSIS
86.Lb libcrypto
86.In openssl/bio.h 87.In openssl/bio.h
87.Ft const BIO_METHOD * 88.Ft const BIO_METHOD *
88.Fo BIO_s_connect 89.Fo BIO_s_connect
diff --git a/src/lib/libcrypto/man/BIO_s_datagram.3 b/src/lib/libcrypto/man/BIO_s_datagram.3
index 104823e7a7..bbe80b259c 100644
--- a/src/lib/libcrypto/man/BIO_s_datagram.3
+++ b/src/lib/libcrypto/man/BIO_s_datagram.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_s_datagram.3,v 1.3 2023/04/28 16:49:00 schwarze Exp $ 1.\" $OpenBSD: BIO_s_datagram.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: April 28 2023 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt BIO_S_DATAGRAM 3 18.Dt BIO_S_DATAGRAM 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -32,6 +32,7 @@
32.\" They are almost unused, and OpenBSD does not appear to support them. 32.\" They are almost unused, and OpenBSD does not appear to support them.
33.Nd datagram socket BIO 33.Nd datagram socket BIO
34.Sh SYNOPSIS 34.Sh SYNOPSIS
35.Lb libcrypto
35.In openssl/bio.h 36.In openssl/bio.h
36.Ft const BIO_METHOD * 37.Ft const BIO_METHOD *
37.Fn BIO_s_datagram void 38.Fn BIO_s_datagram void
diff --git a/src/lib/libcrypto/man/BIO_s_fd.3 b/src/lib/libcrypto/man/BIO_s_fd.3
index 852a06756a..b1165f30a1 100644
--- a/src/lib/libcrypto/man/BIO_s_fd.3
+++ b/src/lib/libcrypto/man/BIO_s_fd.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_s_fd.3,v 1.13 2023/11/16 20:19:23 schwarze Exp $ 1.\" $OpenBSD: BIO_s_fd.3,v 1.14 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: November 16 2023 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt BIO_S_FD 3 69.Dt BIO_S_FD 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -77,6 +77,7 @@
77.Nm BIO_fd_should_retry 77.Nm BIO_fd_should_retry
78.Nd file descriptor BIO 78.Nd file descriptor BIO
79.Sh SYNOPSIS 79.Sh SYNOPSIS
80.Lb libcrypto
80.In openssl/bio.h 81.In openssl/bio.h
81.Ft const BIO_METHOD * 82.Ft const BIO_METHOD *
82.Fo BIO_s_fd 83.Fo BIO_s_fd
diff --git a/src/lib/libcrypto/man/BIO_s_file.3 b/src/lib/libcrypto/man/BIO_s_file.3
index 14950cad13..d59e157c33 100644
--- a/src/lib/libcrypto/man/BIO_s_file.3
+++ b/src/lib/libcrypto/man/BIO_s_file.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_s_file.3,v 1.17 2023/11/16 20:19:23 schwarze Exp $ 1.\" $OpenBSD: BIO_s_file.3,v 1.18 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" selective merge up to: OpenSSL 1212818e Sep 11 13:22:14 2018 +0100 3.\" selective merge up to: OpenSSL 1212818e Sep 11 13:22:14 2018 +0100
4.\" 4.\"
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: November 16 2023 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt BIO_S_FILE 3 70.Dt BIO_S_FILE 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -82,6 +82,7 @@
82.\" Nm BIO_CTRL_SET_FILENAME is unused and intentionally undocumented. 82.\" Nm BIO_CTRL_SET_FILENAME is unused and intentionally undocumented.
83.Nd FILE BIO 83.Nd FILE BIO
84.Sh SYNOPSIS 84.Sh SYNOPSIS
85.Lb libcrypto
85.In openssl/bio.h 86.In openssl/bio.h
86.Ft const BIO_METHOD * 87.Ft const BIO_METHOD *
87.Fo BIO_s_file 88.Fo BIO_s_file
diff --git a/src/lib/libcrypto/man/BIO_s_mem.3 b/src/lib/libcrypto/man/BIO_s_mem.3
index d7bbf6af43..e43be66e2f 100644
--- a/src/lib/libcrypto/man/BIO_s_mem.3
+++ b/src/lib/libcrypto/man/BIO_s_mem.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_s_mem.3,v 1.19 2023/11/16 20:19:23 schwarze Exp $ 1.\" $OpenBSD: BIO_s_mem.3,v 1.20 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 8711efb4 Mon Apr 20 11:33:12 2009 +0000 2.\" full merge up to: OpenSSL 8711efb4 Mon Apr 20 11:33:12 2009 +0000
3.\" selective merge up to: OpenSSL 36359cec Mar 7 14:37:23 2018 +0100 3.\" selective merge up to: OpenSSL 36359cec Mar 7 14:37:23 2018 +0100
4.\" 4.\"
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: November 16 2023 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt BIO_S_MEM 3 53.Dt BIO_S_MEM 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -61,6 +61,7 @@
61.Nm BIO_new_mem_buf 61.Nm BIO_new_mem_buf
62.Nd memory BIO 62.Nd memory BIO
63.Sh SYNOPSIS 63.Sh SYNOPSIS
64.Lb libcrypto
64.In openssl/bio.h 65.In openssl/bio.h
65.Ft const BIO_METHOD * 66.Ft const BIO_METHOD *
66.Fo BIO_s_mem 67.Fo BIO_s_mem
diff --git a/src/lib/libcrypto/man/BIO_s_null.3 b/src/lib/libcrypto/man/BIO_s_null.3
index 6e7cad6d37..7198797b99 100644
--- a/src/lib/libcrypto/man/BIO_s_null.3
+++ b/src/lib/libcrypto/man/BIO_s_null.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_s_null.3,v 1.10 2023/04/11 16:58:43 schwarze Exp $ 1.\" $OpenBSD: BIO_s_null.3,v 1.12 2025/07/16 18:10:53 tb Exp $
2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,14 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: April 11 2023 $ 51.Dd $Mdocdate: July 16 2025 $
52.Dt BIO_S_NULL 3 52.Dt BIO_S_NULL 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm BIO_s_null 55.Nm BIO_s_null
56.\" .Nm BIO_s_log is intentionally undocumented because it is unused
57.Nd null data sink 56.Nd null data sink
58.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
59.In openssl/bio.h 59.In openssl/bio.h
60.Ft const BIO_METHOD * 60.Ft const BIO_METHOD *
61.Fo BIO_s_null 61.Fo BIO_s_null
diff --git a/src/lib/libcrypto/man/BIO_s_socket.3 b/src/lib/libcrypto/man/BIO_s_socket.3
index 402622b3bd..aebf399b2b 100644
--- a/src/lib/libcrypto/man/BIO_s_socket.3
+++ b/src/lib/libcrypto/man/BIO_s_socket.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_s_socket.3,v 1.10 2023/04/11 16:58:43 schwarze Exp $ 1.\" $OpenBSD: BIO_s_socket.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL bbdc9c98 Oct 19 22:02:21 2000 +0000 2.\" OpenSSL bbdc9c98 Oct 19 22:02:21 2000 +0000
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: April 11 2023 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt BIO_S_SOCKET 3 52.Dt BIO_S_SOCKET 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -56,6 +56,7 @@
56.Nm BIO_new_socket 56.Nm BIO_new_socket
57.Nd socket BIO 57.Nd socket BIO
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libcrypto
59.In openssl/bio.h 60.In openssl/bio.h
60.Ft const BIO_METHOD * 61.Ft const BIO_METHOD *
61.Fo BIO_s_socket 62.Fo BIO_s_socket
diff --git a/src/lib/libcrypto/man/BIO_set_callback.3 b/src/lib/libcrypto/man/BIO_set_callback.3
index 56a0102be6..f3f40cba8e 100644
--- a/src/lib/libcrypto/man/BIO_set_callback.3
+++ b/src/lib/libcrypto/man/BIO_set_callback.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_set_callback.3,v 1.12 2023/04/30 13:57:29 schwarze Exp $ 1.\" $OpenBSD: BIO_set_callback.3,v 1.13 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 2.\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: April 30 2023 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt BIO_SET_CALLBACK 3 69.Dt BIO_SET_CALLBACK 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -85,6 +85,7 @@
85.\" .Nm BIO_cb_post 85.\" .Nm BIO_cb_post
86.Nd BIO callback functions 86.Nd BIO callback functions
87.Sh SYNOPSIS 87.Sh SYNOPSIS
88.Lb libcrypto
88.In openssl/bio.h 89.In openssl/bio.h
89.Ft typedef long 90.Ft typedef long
90.Fo (*BIO_callback_fn_ex) 91.Fo (*BIO_callback_fn_ex)
diff --git a/src/lib/libcrypto/man/BIO_should_retry.3 b/src/lib/libcrypto/man/BIO_should_retry.3
index 9b93743516..4a0948ff86 100644
--- a/src/lib/libcrypto/man/BIO_should_retry.3
+++ b/src/lib/libcrypto/man/BIO_should_retry.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_should_retry.3,v 1.11 2023/04/30 14:03:47 schwarze Exp $ 1.\" $OpenBSD: BIO_should_retry.3,v 1.12 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" selective merge up to: OpenSSL 57fd5170 May 13 11:24:11 2018 +0200 3.\" selective merge up to: OpenSSL 57fd5170 May 13 11:24:11 2018 +0200
4.\" 4.\"
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: April 30 2023 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt BIO_SHOULD_RETRY 3 70.Dt BIO_SHOULD_RETRY 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -80,6 +80,7 @@
80.Nm BIO_set_retry_reason 80.Nm BIO_set_retry_reason
81.Nd BIO retry functions 81.Nd BIO retry functions
82.Sh SYNOPSIS 82.Sh SYNOPSIS
83.Lb libcrypto
83.In openssl/bio.h 84.In openssl/bio.h
84.Ft int 85.Ft int
85.Fo BIO_should_read 86.Fo BIO_should_read
diff --git a/src/lib/libcrypto/man/BN_CTX_new.3 b/src/lib/libcrypto/man/BN_CTX_new.3
index 336b918896..0d5a3e847c 100644
--- a/src/lib/libcrypto/man/BN_CTX_new.3
+++ b/src/lib/libcrypto/man/BN_CTX_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_CTX_new.3,v 1.10 2023/04/25 17:21:51 tb Exp $ 1.\" $OpenBSD: BN_CTX_new.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL aafbe1cc Jun 12 23:42:08 2013 +0100 2.\" OpenSSL aafbe1cc Jun 12 23:42:08 2013 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: April 25 2023 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt BN_CTX_NEW 3 52.Dt BN_CTX_NEW 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -56,6 +56,7 @@
56.Nm BN_CTX_free 56.Nm BN_CTX_free
57.Nd allocate and free BN_CTX structures 57.Nd allocate and free BN_CTX structures
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libcrypto
59.In openssl/bn.h 60.In openssl/bn.h
60.Ft BN_CTX * 61.Ft BN_CTX *
61.Fo BN_CTX_new 62.Fo BN_CTX_new
diff --git a/src/lib/libcrypto/man/BN_CTX_start.3 b/src/lib/libcrypto/man/BN_CTX_start.3
index a2b62eff5c..27159ce90d 100644
--- a/src/lib/libcrypto/man/BN_CTX_start.3
+++ b/src/lib/libcrypto/man/BN_CTX_start.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_CTX_start.3,v 1.8 2019/08/20 10:59:09 schwarze Exp $ 1.\" $OpenBSD: BN_CTX_start.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 35fd9953 May 28 14:49:38 2019 +0200 2.\" full merge up to: OpenSSL 35fd9953 May 28 14:49:38 2019 +0200
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: August 20 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt BN_CTX_START 3 52.Dt BN_CTX_START 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -57,6 +57,7 @@
57.Nm BN_CTX_end 57.Nm BN_CTX_end
58.Nd use temporary BIGNUM variables 58.Nd use temporary BIGNUM variables
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/bn.h 61.In openssl/bn.h
61.Ft void 62.Ft void
62.Fo BN_CTX_start 63.Fo BN_CTX_start
diff --git a/src/lib/libcrypto/man/BN_add.3 b/src/lib/libcrypto/man/BN_add.3
index e7de441b7a..32378f6940 100644
--- a/src/lib/libcrypto/man/BN_add.3
+++ b/src/lib/libcrypto/man/BN_add.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_add.3,v 1.20 2023/04/27 09:47:03 tb Exp $ 1.\" $OpenBSD: BN_add.3,v 1.21 2025/06/08 22:37:23 schwarze Exp $
2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: April 27 2023 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt BN_ADD 3 70.Dt BN_ADD 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -94,13 +94,11 @@
94.\" The following are public, but intentionally undocumented for now: 94.\" The following are public, but intentionally undocumented for now:
95.\" .Nm BN_mod_exp_mont , r \(== a ^ p (mod m) 95.\" .Nm BN_mod_exp_mont , r \(== a ^ p (mod m)
96.\" .Nm BN_mod_exp_mont_consttime , 96.\" .Nm BN_mod_exp_mont_consttime ,
97.\" .Nm BN_mod_exp_mont_word ,
98.\" .Nm BN_mod_exp_simple ,
99.\" .Nm BN_mod_exp2_mont r \(== (a1 ^ p1) * (a2 ^ p2) (mod m)
100.\" Maybe they should be deleted from <openssl/bn.h>. 97.\" Maybe they should be deleted from <openssl/bn.h>.
101.Nm BN_gcd 98.Nm BN_gcd
102.Nd arithmetic operations on BIGNUMs 99.Nd arithmetic operations on BIGNUMs
103.Sh SYNOPSIS 100.Sh SYNOPSIS
101.Lb libcrypto
104.In openssl/bn.h 102.In openssl/bn.h
105.Ft int 103.Ft int
106.Fo BN_add 104.Fo BN_add
diff --git a/src/lib/libcrypto/man/BN_add_word.3 b/src/lib/libcrypto/man/BN_add_word.3
index 161029c302..b8b45bfb2c 100644
--- a/src/lib/libcrypto/man/BN_add_word.3
+++ b/src/lib/libcrypto/man/BN_add_word.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_add_word.3,v 1.10 2022/11/22 19:02:07 schwarze Exp $ 1.\" $OpenBSD: BN_add_word.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 9e183d22 Mar 11 08:56:44 2017 -0500 2.\" full merge up to: OpenSSL 9e183d22 Mar 11 08:56:44 2017 -0500
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: November 22 2022 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt BN_ADD_WORD 3 52.Dt BN_ADD_WORD 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -59,6 +59,7 @@
59.Nm BN_mod_word 59.Nm BN_mod_word
60.Nd arithmetic functions on BIGNUMs with integers 60.Nd arithmetic functions on BIGNUMs with integers
61.Sh SYNOPSIS 61.Sh SYNOPSIS
62.Lb libcrypto
62.In openssl/bn.h 63.In openssl/bn.h
63.Ft int 64.Ft int
64.Fo BN_add_word 65.Fo BN_add_word
diff --git a/src/lib/libcrypto/man/BN_bn2bin.3 b/src/lib/libcrypto/man/BN_bn2bin.3
index 0fe9a90738..cf72e6dd1b 100644
--- a/src/lib/libcrypto/man/BN_bn2bin.3
+++ b/src/lib/libcrypto/man/BN_bn2bin.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_bn2bin.3,v 1.16 2023/07/09 06:45:03 tb Exp $ 1.\" $OpenBSD: BN_bn2bin.3,v 1.17 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 2.\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org> 4.\" This file was written by Ulf Moeller <ulf@openssl.org>
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: July 9 2023 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt BN_BN2BIN 3 53.Dt BN_BN2BIN 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -69,6 +69,7 @@
69.Nm BN_mpi2bn 69.Nm BN_mpi2bn
70.Nd format conversions 70.Nd format conversions
71.Sh SYNOPSIS 71.Sh SYNOPSIS
72.Lb libcrypto
72.In openssl/bn.h 73.In openssl/bn.h
73.Ft int 74.Ft int
74.Fo BN_bn2bin 75.Fo BN_bn2bin
diff --git a/src/lib/libcrypto/man/BN_cmp.3 b/src/lib/libcrypto/man/BN_cmp.3
index ba973313f0..3837ffcd1a 100644
--- a/src/lib/libcrypto/man/BN_cmp.3
+++ b/src/lib/libcrypto/man/BN_cmp.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_cmp.3,v 1.10 2022/11/22 19:02:07 schwarze Exp $ 1.\" $OpenBSD: BN_cmp.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 5b31b9df Aug 4 10:45:52 2021 +0300 2.\" full merge up to: OpenSSL 5b31b9df Aug 4 10:45:52 2021 +0300
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: November 22 2022 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt BN_CMP 3 52.Dt BN_CMP 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -61,6 +61,7 @@
61.Nm BN_is_odd 61.Nm BN_is_odd
62.Nd BIGNUM comparison and test functions 62.Nd BIGNUM comparison and test functions
63.Sh SYNOPSIS 63.Sh SYNOPSIS
64.Lb libcrypto
64.In openssl/bn.h 65.In openssl/bn.h
65.Ft int 66.Ft int
66.Fo BN_cmp 67.Fo BN_cmp
diff --git a/src/lib/libcrypto/man/BN_copy.3 b/src/lib/libcrypto/man/BN_copy.3
index 383255e382..5481431e97 100644
--- a/src/lib/libcrypto/man/BN_copy.3
+++ b/src/lib/libcrypto/man/BN_copy.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_copy.3,v 1.10 2021/12/06 19:45:27 schwarze Exp $ 1.\" $OpenBSD: BN_copy.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org> 4.\" This file was written by Ulf Moeller <ulf@openssl.org>
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: December 6 2021 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt BN_COPY 3 53.Dt BN_COPY 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -58,6 +58,7 @@
58.Nm BN_with_flags 58.Nm BN_with_flags
59.Nd copy BIGNUMs 59.Nd copy BIGNUMs
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libcrypto
61.In openssl/bn.h 62.In openssl/bn.h
62.Ft BIGNUM * 63.Ft BIGNUM *
63.Fo BN_copy 64.Fo BN_copy
diff --git a/src/lib/libcrypto/man/BN_generate_prime.3 b/src/lib/libcrypto/man/BN_generate_prime.3
index d9144155c6..55eed14e75 100644
--- a/src/lib/libcrypto/man/BN_generate_prime.3
+++ b/src/lib/libcrypto/man/BN_generate_prime.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_generate_prime.3,v 1.25 2023/12/29 19:12:46 tb Exp $ 1.\" $OpenBSD: BN_generate_prime.3,v 1.26 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL f987a4dd Jun 27 10:12:08 2019 +0200 2.\" full merge up to: OpenSSL f987a4dd Jun 27 10:12:08 2019 +0200
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -67,7 +67,7 @@
67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
69.\" 69.\"
70.Dd $Mdocdate: December 29 2023 $ 70.Dd $Mdocdate: June 8 2025 $
71.Dt BN_GENERATE_PRIME 3 71.Dt BN_GENERATE_PRIME 3
72.Os 72.Os
73.Sh NAME 73.Sh NAME
@@ -84,6 +84,7 @@
84.\" because it should not be used outside of libcrypto. 84.\" because it should not be used outside of libcrypto.
85.Nd generate primes and test for primality 85.Nd generate primes and test for primality
86.Sh SYNOPSIS 86.Sh SYNOPSIS
87.Lb libcrypto
87.In openssl/bn.h 88.In openssl/bn.h
88.Ft int 89.Ft int
89.Fo BN_is_prime_ex 90.Fo BN_is_prime_ex
diff --git a/src/lib/libcrypto/man/BN_get_rfc3526_prime_8192.3 b/src/lib/libcrypto/man/BN_get_rfc3526_prime_8192.3
index abaf80ef20..41345de274 100644
--- a/src/lib/libcrypto/man/BN_get_rfc3526_prime_8192.3
+++ b/src/lib/libcrypto/man/BN_get_rfc3526_prime_8192.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_get_rfc3526_prime_8192.3,v 1.1 2023/07/20 16:26:40 tb Exp $ 1.\" $OpenBSD: BN_get_rfc3526_prime_8192.3,v 1.2 2025/06/08 22:40:29 schwarze Exp $
2.\" checked up to: OpenSSL DH_get_1024_160 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" checked up to: OpenSSL DH_get_1024_160 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> 4.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,7 +15,7 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 17.\"
18.Dd $Mdocdate: July 20 2023 $ 18.Dd $Mdocdate: June 8 2025 $
19.Dt BN_GET_RFC3526_PRIME_8192 3 19.Dt BN_GET_RFC3526_PRIME_8192 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
@@ -29,6 +29,7 @@
29.Nm BN_get_rfc3526_prime_8192 29.Nm BN_get_rfc3526_prime_8192
30.Nd standard moduli for Diffie-Hellman key exchange 30.Nd standard moduli for Diffie-Hellman key exchange
31.Sh SYNOPSIS 31.Sh SYNOPSIS
32.Lb libcrypto
32.In openssl/bn.h 33.In openssl/bn.h
33.Ft BIGNUM * 34.Ft BIGNUM *
34.Fn BN_get_rfc2409_prime_768 "BIGNUM *bn" 35.Fn BN_get_rfc2409_prime_768 "BIGNUM *bn"
diff --git a/src/lib/libcrypto/man/BN_kronecker.3 b/src/lib/libcrypto/man/BN_kronecker.3
index 90b7f43230..6a5b7ecd88 100644
--- a/src/lib/libcrypto/man/BN_kronecker.3
+++ b/src/lib/libcrypto/man/BN_kronecker.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_kronecker.3,v 1.2 2022/11/15 17:55:00 schwarze Exp $ 1.\" $OpenBSD: BN_kronecker.3,v 1.3 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: November 15 2022 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt BN_KRONECKER 3 18.Dt BN_KRONECKER 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm BN_kronecker 21.Nm BN_kronecker
22.Nd Kronecker symbol 22.Nd Kronecker symbol
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
24.In openssl/bn.h 25.In openssl/bn.h
25.Ft int 26.Ft int
26.Fo BN_kronecker 27.Fo BN_kronecker
diff --git a/src/lib/libcrypto/man/BN_mod_inverse.3 b/src/lib/libcrypto/man/BN_mod_inverse.3
index d0a4b458f4..ce10fa216e 100644
--- a/src/lib/libcrypto/man/BN_mod_inverse.3
+++ b/src/lib/libcrypto/man/BN_mod_inverse.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_mod_inverse.3,v 1.13 2023/10/21 13:53:43 schwarze Exp $ 1.\" $OpenBSD: BN_mod_inverse.3,v 1.14 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: October 21 2023 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt BN_MOD_INVERSE 3 52.Dt BN_MOD_INVERSE 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm BN_mod_inverse 55.Nm BN_mod_inverse
56.Nd compute inverse modulo m 56.Nd compute inverse modulo m
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/bn.h 59.In openssl/bn.h
59.Ft BIGNUM * 60.Ft BIGNUM *
60.Fo BN_mod_inverse 61.Fo BN_mod_inverse
diff --git a/src/lib/libcrypto/man/BN_mod_mul_montgomery.3 b/src/lib/libcrypto/man/BN_mod_mul_montgomery.3
index ed004c2549..2f9e3a532e 100644
--- a/src/lib/libcrypto/man/BN_mod_mul_montgomery.3
+++ b/src/lib/libcrypto/man/BN_mod_mul_montgomery.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_mod_mul_montgomery.3,v 1.16 2025/03/09 15:24:25 tb Exp $ 1.\" $OpenBSD: BN_mod_mul_montgomery.3,v 1.17 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 6859cf74 Sep 25 13:33:28 2002 +0000 2.\" full merge up to: OpenSSL 6859cf74 Sep 25 13:33:28 2002 +0000
3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
4.\" 4.\"
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: March 9 2025 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt BN_MOD_MUL_MONTGOMERY 3 70.Dt BN_MOD_MUL_MONTGOMERY 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -80,6 +80,7 @@
80.Nm BN_to_montgomery 80.Nm BN_to_montgomery
81.Nd Montgomery multiplication 81.Nd Montgomery multiplication
82.Sh SYNOPSIS 82.Sh SYNOPSIS
83.Lb libcrypto
83.In openssl/bn.h 84.In openssl/bn.h
84.Ft BN_MONT_CTX * 85.Ft BN_MONT_CTX *
85.Fo BN_MONT_CTX_new 86.Fo BN_MONT_CTX_new
diff --git a/src/lib/libcrypto/man/BN_mod_sqrt.3 b/src/lib/libcrypto/man/BN_mod_sqrt.3
index 7247d907a0..f2cd80e658 100644
--- a/src/lib/libcrypto/man/BN_mod_sqrt.3
+++ b/src/lib/libcrypto/man/BN_mod_sqrt.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_mod_sqrt.3,v 1.2 2022/12/06 22:22:42 tb Exp $ 1.\" $OpenBSD: BN_mod_sqrt.3,v 1.3 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: December 6 2022 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt BN_MOD_SQRT 3 18.Dt BN_MOD_SQRT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm BN_mod_sqrt 21.Nm BN_mod_sqrt
22.Nd square root in a prime field 22.Nd square root in a prime field
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
24.In openssl/bn.h 25.In openssl/bn.h
25.Ft BIGNUM * 26.Ft BIGNUM *
26.Fo BN_mod_sqrt 27.Fo BN_mod_sqrt
diff --git a/src/lib/libcrypto/man/BN_new.3 b/src/lib/libcrypto/man/BN_new.3
index 088048c622..8e61a1fcc3 100644
--- a/src/lib/libcrypto/man/BN_new.3
+++ b/src/lib/libcrypto/man/BN_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_new.3,v 1.31 2023/07/26 20:08:59 tb Exp $ 1.\" $OpenBSD: BN_new.3,v 1.33 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL man3/BN_new 2457c19d Mar 6 08:43:36 2004 +0000 2.\" full merge up to: OpenSSL man3/BN_new 2457c19d Mar 6 08:43:36 2004 +0000
3.\" selective merge up to: man3/BN_new 681acb31 Sep 29 13:10:34 2017 +0200 3.\" selective merge up to: man3/BN_new 681acb31 Sep 29 13:10:34 2017 +0200
4.\" full merge up to: OpenSSL man7/bn 05ea606a May 20 20:52:46 2016 -0400 4.\" full merge up to: OpenSSL man7/bn 05ea606a May 20 20:52:46 2016 -0400
@@ -50,7 +50,7 @@
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\" 52.\"
53.Dd $Mdocdate: July 26 2023 $ 53.Dd $Mdocdate: June 8 2025 $
54.Dt BN_NEW 3 54.Dt BN_NEW 3
55.Os 55.Os
56.Sh NAME 56.Sh NAME
@@ -60,6 +60,7 @@
60.Nm BN_clear_free 60.Nm BN_clear_free
61.Nd allocate and free BIGNUMs 61.Nd allocate and free BIGNUMs
62.Sh SYNOPSIS 62.Sh SYNOPSIS
63.Lb libcrypto
63.In openssl/bn.h 64.In openssl/bn.h
64.Ft BIGNUM * 65.Ft BIGNUM *
65.Fo BN_new 66.Fo BN_new
@@ -91,8 +92,6 @@ memory allocation error has occurred.
91The basic object in this library is a 92The basic object in this library is a
92.Vt BIGNUM . 93.Vt BIGNUM .
93It is used to hold a single large integer. 94It is used to hold a single large integer.
94This type should be considered opaque and fields should not be modified
95or accessed directly.
96.Pp 95.Pp
97.Fn BN_new 96.Fn BN_new
98allocates and initializes a 97allocates and initializes a
diff --git a/src/lib/libcrypto/man/BN_num_bytes.3 b/src/lib/libcrypto/man/BN_num_bytes.3
index 785f43e2f0..608bb2ebb8 100644
--- a/src/lib/libcrypto/man/BN_num_bytes.3
+++ b/src/lib/libcrypto/man/BN_num_bytes.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_num_bytes.3,v 1.9 2022/11/22 18:55:04 schwarze Exp $ 1.\" $OpenBSD: BN_num_bytes.3,v 1.10 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 9e183d22 Mar 11 08:56:44 2017 -0500 2.\" full merge up to: OpenSSL 9e183d22 Mar 11 08:56:44 2017 -0500
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: November 22 2022 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt BN_NUM_BYTES 3 70.Dt BN_NUM_BYTES 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -75,6 +75,7 @@
75.Nm BN_num_bytes 75.Nm BN_num_bytes
76.Nd get BIGNUM size 76.Nd get BIGNUM size
77.Sh SYNOPSIS 77.Sh SYNOPSIS
78.Lb libcrypto
78.In openssl/bn.h 79.In openssl/bn.h
79.Ft int 80.Ft int
80.Fo BN_num_bits_word 81.Fo BN_num_bits_word
diff --git a/src/lib/libcrypto/man/BN_rand.3 b/src/lib/libcrypto/man/BN_rand.3
index 3d4401a429..b21155af0d 100644
--- a/src/lib/libcrypto/man/BN_rand.3
+++ b/src/lib/libcrypto/man/BN_rand.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_rand.3,v 1.18 2021/11/30 18:34:35 tb Exp $ 1.\" $OpenBSD: BN_rand.3,v 1.19 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 05ea606a May 20 20:52:46 2016 -0400 2.\" full merge up to: OpenSSL 05ea606a May 20 20:52:46 2016 -0400
3.\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 3.\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
4.\" 4.\"
@@ -50,7 +50,7 @@
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\" 52.\"
53.Dd $Mdocdate: November 30 2021 $ 53.Dd $Mdocdate: June 8 2025 $
54.Dt BN_RAND 3 54.Dt BN_RAND 3
55.Os 55.Os
56.Sh NAME 56.Sh NAME
@@ -60,6 +60,7 @@
60.Nm BN_pseudo_rand_range 60.Nm BN_pseudo_rand_range
61.Nd generate pseudo-random number 61.Nd generate pseudo-random number
62.Sh SYNOPSIS 62.Sh SYNOPSIS
63.Lb libcrypto
63.In openssl/bn.h 64.In openssl/bn.h
64.Ft int 65.Ft int
65.Fo BN_rand 66.Fo BN_rand
diff --git a/src/lib/libcrypto/man/BN_set_bit.3 b/src/lib/libcrypto/man/BN_set_bit.3
index 2c53066777..c13122b729 100644
--- a/src/lib/libcrypto/man/BN_set_bit.3
+++ b/src/lib/libcrypto/man/BN_set_bit.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_set_bit.3,v 1.8 2021/11/30 18:34:35 tb Exp $ 1.\" $OpenBSD: BN_set_bit.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: November 30 2021 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt BN_SET_BIT 3 52.Dt BN_SET_BIT 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -62,6 +62,7 @@
62.Nm BN_rshift1 62.Nm BN_rshift1
63.Nd bit operations on BIGNUMs 63.Nd bit operations on BIGNUMs
64.Sh SYNOPSIS 64.Sh SYNOPSIS
65.Lb libcrypto
65.In openssl/bn.h 66.In openssl/bn.h
66.Ft int 67.Ft int
67.Fo BN_set_bit 68.Fo BN_set_bit
diff --git a/src/lib/libcrypto/man/BN_set_flags.3 b/src/lib/libcrypto/man/BN_set_flags.3
index 1285ae2b28..eb4840a54b 100644
--- a/src/lib/libcrypto/man/BN_set_flags.3
+++ b/src/lib/libcrypto/man/BN_set_flags.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_set_flags.3,v 1.6 2023/04/27 07:22:22 tb Exp $ 1.\" $OpenBSD: BN_set_flags.3,v 1.7 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: April 27 2023 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt BN_SET_FLAGS 3 18.Dt BN_SET_FLAGS 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm BN_get_flags 22.Nm BN_get_flags
23.Nd enable and inspect flags on BIGNUM objects 23.Nd enable and inspect flags on BIGNUM objects
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/bn.h 26.In openssl/bn.h
26.Ft void 27.Ft void
27.Fo BN_set_flags 28.Fo BN_set_flags
diff --git a/src/lib/libcrypto/man/BN_set_negative.3 b/src/lib/libcrypto/man/BN_set_negative.3
index 6cdff5c974..579bcf2123 100644
--- a/src/lib/libcrypto/man/BN_set_negative.3
+++ b/src/lib/libcrypto/man/BN_set_negative.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_set_negative.3,v 1.6 2021/12/06 19:45:27 schwarze Exp $ 1.\" $OpenBSD: BN_set_negative.3,v 1.7 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: December 6 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt BN_SET_NEGATIVE 3 18.Dt BN_SET_NEGATIVE 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm BN_is_negative 22.Nm BN_is_negative
23.Nd change and inspect the sign of a BIGNUM 23.Nd change and inspect the sign of a BIGNUM
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/bn.h 26.In openssl/bn.h
26.Ft void 27.Ft void
27.Fo BN_set_negative 28.Fo BN_set_negative
diff --git a/src/lib/libcrypto/man/BN_swap.3 b/src/lib/libcrypto/man/BN_swap.3
index 218ca1cf02..a6a5fa95ba 100644
--- a/src/lib/libcrypto/man/BN_swap.3
+++ b/src/lib/libcrypto/man/BN_swap.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_swap.3,v 1.6 2021/12/19 22:06:35 schwarze Exp $ 1.\" $OpenBSD: BN_swap.3,v 1.7 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 2.\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: December 19 2021 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt BN_SWAP 3 69.Dt BN_SWAP 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -73,6 +73,7 @@
73.Nm BN_consttime_swap 73.Nm BN_consttime_swap
74.Nd exchange BIGNUMs 74.Nd exchange BIGNUMs
75.Sh SYNOPSIS 75.Sh SYNOPSIS
76.Lb libcrypto
76.In openssl/bn.h 77.In openssl/bn.h
77.Ft void 78.Ft void
78.Fo BN_swap 79.Fo BN_swap
diff --git a/src/lib/libcrypto/man/BN_zero.3 b/src/lib/libcrypto/man/BN_zero.3
index 0b677b246f..18a31a1080 100644
--- a/src/lib/libcrypto/man/BN_zero.3
+++ b/src/lib/libcrypto/man/BN_zero.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_zero.3,v 1.13 2023/04/30 19:23:54 tb Exp $ 1.\" $OpenBSD: BN_zero.3,v 1.15 2025/06/14 06:48:47 tb Exp $
2.\" full merge up to: OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 2.\" full merge up to: OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400
3.\" selective merge up to: OpenSSL b713c4ff Jan 22 14:41:09 2018 -0500 3.\" selective merge up to: OpenSSL b713c4ff Jan 22 14:41:09 2018 -0500
4.\" 4.\"
@@ -67,7 +67,7 @@
67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
69.\" 69.\"
70.Dd $Mdocdate: April 30 2023 $ 70.Dd $Mdocdate: June 14 2025 $
71.Dt BN_ZERO 3 71.Dt BN_ZERO 3
72.Os 72.Os
73.Sh NAME 73.Sh NAME
@@ -78,8 +78,9 @@
78.Nm BN_get_word 78.Nm BN_get_word
79.Nd BIGNUM assignment operations 79.Nd BIGNUM assignment operations
80.Sh SYNOPSIS 80.Sh SYNOPSIS
81.Lb libcrypto
81.In openssl/bn.h 82.In openssl/bn.h
82.Ft int 83.Ft void
83.Fo BN_zero 84.Fo BN_zero
84.Fa "BIGNUM *a" 85.Fa "BIGNUM *a"
85.Fc 86.Fc
@@ -136,8 +137,7 @@ or a number with all bits set if
136cannot be represented as a 137cannot be represented as a
137.Vt BN_ULONG . 138.Vt BN_ULONG .
138.Pp 139.Pp
139.Fn BN_zero , 140.Fn BN_one
140.Fn BN_one ,
141and 141and
142.Fn BN_set_word 142.Fn BN_set_word
143return 1 on success, 0 otherwise. 143return 1 on success, 0 otherwise.
diff --git a/src/lib/libcrypto/man/BUF_MEM_new.3 b/src/lib/libcrypto/man/BUF_MEM_new.3
index 8c72091abe..ef9e473cc3 100644
--- a/src/lib/libcrypto/man/BUF_MEM_new.3
+++ b/src/lib/libcrypto/man/BUF_MEM_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BUF_MEM_new.3,v 1.19 2024/07/24 08:57:58 tb Exp $ 1.\" $OpenBSD: BUF_MEM_new.3,v 1.20 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL doc/crypto/buffer.pod 18edda0f Sep 20 03:28:54 2000 +0000 2.\" OpenSSL doc/crypto/buffer.pod 18edda0f Sep 20 03:28:54 2000 +0000
3.\" not merged: 74924dcb, 58e3457a, 21b0fa91, 7644a9ae 3.\" not merged: 74924dcb, 58e3457a, 21b0fa91, 7644a9ae
4.\" OpenSSL doc/crypto/BUF_MEM_new.pod 53934822 Jun 9 16:39:19 2016 -0400 4.\" OpenSSL doc/crypto/BUF_MEM_new.pod 53934822 Jun 9 16:39:19 2016 -0400
@@ -52,7 +52,7 @@
52.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 52.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
53.\" OF THE POSSIBILITY OF SUCH DAMAGE. 53.\" OF THE POSSIBILITY OF SUCH DAMAGE.
54.\" 54.\"
55.Dd $Mdocdate: July 24 2024 $ 55.Dd $Mdocdate: June 8 2025 $
56.Dt BUF_MEM_NEW 3 56.Dt BUF_MEM_NEW 3
57.Os 57.Os
58.Sh NAME 58.Sh NAME
@@ -62,6 +62,7 @@
62.Nm BUF_MEM_grow_clean 62.Nm BUF_MEM_grow_clean
63.Nd simple character arrays structure 63.Nd simple character arrays structure
64.Sh SYNOPSIS 64.Sh SYNOPSIS
65.Lb libcrypto
65.In openssl/buffer.h 66.In openssl/buffer.h
66.Ft BUF_MEM * 67.Ft BUF_MEM *
67.Fo BUF_MEM_new 68.Fo BUF_MEM_new
diff --git a/src/lib/libcrypto/man/CMAC_Init.3 b/src/lib/libcrypto/man/CMAC_Init.3
index fd32ca085a..b1b62a6359 100644
--- a/src/lib/libcrypto/man/CMAC_Init.3
+++ b/src/lib/libcrypto/man/CMAC_Init.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CMAC_Init.3,v 1.9 2024/11/12 00:42:28 schwarze Exp $ 1.\" $OpenBSD: CMAC_Init.3,v 1.10 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: November 12 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt CMAC_INIT 3 18.Dt CMAC_INIT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -28,6 +28,7 @@
28.Nm CMAC_CTX_free 28.Nm CMAC_CTX_free
29.Nd Cipher-based message authentication code 29.Nd Cipher-based message authentication code
30.Sh SYNOPSIS 30.Sh SYNOPSIS
31.Lb libcrypto
31.In openssl/cmac.h 32.In openssl/cmac.h
32.Ft CMAC_CTX * 33.Ft CMAC_CTX *
33.Fn CMAC_CTX_new void 34.Fn CMAC_CTX_new void
diff --git a/src/lib/libcrypto/man/CMS_ContentInfo_new.3 b/src/lib/libcrypto/man/CMS_ContentInfo_new.3
index d5117fa4ae..b44f65ee91 100644
--- a/src/lib/libcrypto/man/CMS_ContentInfo_new.3
+++ b/src/lib/libcrypto/man/CMS_ContentInfo_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CMS_ContentInfo_new.3,v 1.4 2024/01/22 14:00:13 tb Exp $ 1.\" $OpenBSD: CMS_ContentInfo_new.3,v 1.5 2025/06/08 22:40:29 schwarze Exp $
2.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> 2.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org>
3.\" 3.\"
4.\" Permission to use, copy, modify, and distribute this software for any 4.\" Permission to use, copy, modify, and distribute this software for any
@@ -13,7 +13,7 @@
13.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15.\" 15.\"
16.Dd $Mdocdate: January 22 2024 $ 16.Dd $Mdocdate: June 8 2025 $
17.Dt CMS_CONTENTINFO_NEW 3 17.Dt CMS_CONTENTINFO_NEW 3
18.Os 18.Os
19.Sh NAME 19.Sh NAME
@@ -24,6 +24,7 @@
24.Nm CMS_ReceiptRequest_free 24.Nm CMS_ReceiptRequest_free
25.Nd Cryptographic Message Syntax data structures 25.Nd Cryptographic Message Syntax data structures
26.Sh SYNOPSIS 26.Sh SYNOPSIS
27.Lb libcrypto
27.In openssl/cms.h 28.In openssl/cms.h
28.Ft CMS_ContentInfo * 29.Ft CMS_ContentInfo *
29.Fn CMS_ContentInfo_new void 30.Fn CMS_ContentInfo_new void
diff --git a/src/lib/libcrypto/man/CMS_add0_cert.3 b/src/lib/libcrypto/man/CMS_add0_cert.3
index be9357cc9a..d0e9be6bd5 100644
--- a/src/lib/libcrypto/man/CMS_add0_cert.3
+++ b/src/lib/libcrypto/man/CMS_add0_cert.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CMS_add0_cert.3,v 1.10 2024/11/30 21:21:40 tb Exp $ 1.\" $OpenBSD: CMS_add0_cert.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: November 30 2024 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt CMS_ADD0_CERT 3 69.Dt CMS_ADD0_CERT 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -77,6 +77,7 @@
77.Nm CMS_get1_crls 77.Nm CMS_get1_crls
78.Nd CMS certificate and CRL utility functions 78.Nd CMS certificate and CRL utility functions
79.Sh SYNOPSIS 79.Sh SYNOPSIS
80.Lb libcrypto
80.In openssl/cms.h 81.In openssl/cms.h
81.Ft int 82.Ft int
82.Fo CMS_add0_cert 83.Fo CMS_add0_cert
diff --git a/src/lib/libcrypto/man/CMS_add1_recipient_cert.3 b/src/lib/libcrypto/man/CMS_add1_recipient_cert.3
index 465119397d..7c0c3fae90 100644
--- a/src/lib/libcrypto/man/CMS_add1_recipient_cert.3
+++ b/src/lib/libcrypto/man/CMS_add1_recipient_cert.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CMS_add1_recipient_cert.3,v 1.7 2019/11/02 15:39:46 schwarze Exp $ 1.\" $OpenBSD: CMS_add1_recipient_cert.3,v 1.8 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: November 2 2019 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt CMS_ADD1_RECIPIENT_CERT 3 69.Dt CMS_ADD1_RECIPIENT_CERT 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -73,6 +73,7 @@
73.Nm CMS_add0_recipient_key 73.Nm CMS_add0_recipient_key
74.Nd add recipients to a CMS EnvelopedData structure 74.Nd add recipients to a CMS EnvelopedData structure
75.Sh SYNOPSIS 75.Sh SYNOPSIS
76.Lb libcrypto
76.In openssl/cms.h 77.In openssl/cms.h
77.Ft CMS_RecipientInfo * 78.Ft CMS_RecipientInfo *
78.Fo CMS_add1_recipient_cert 79.Fo CMS_add1_recipient_cert
diff --git a/src/lib/libcrypto/man/CMS_add1_signer.3 b/src/lib/libcrypto/man/CMS_add1_signer.3
index 316d63c5ad..68bdb12c73 100644
--- a/src/lib/libcrypto/man/CMS_add1_signer.3
+++ b/src/lib/libcrypto/man/CMS_add1_signer.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CMS_add1_signer.3,v 1.10 2024/04/18 16:50:22 tb Exp $ 1.\" $OpenBSD: CMS_add1_signer.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: April 18 2024 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt CMS_ADD1_SIGNER 3 69.Dt CMS_ADD1_SIGNER 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -73,6 +73,7 @@
73.Nm CMS_SignerInfo_sign 73.Nm CMS_SignerInfo_sign
74.Nd add a signer to a CMS SignedData structure 74.Nd add a signer to a CMS SignedData structure
75.Sh SYNOPSIS 75.Sh SYNOPSIS
76.Lb libcrypto
76.In openssl/cms.h 77.In openssl/cms.h
77.Ft CMS_SignerInfo * 78.Ft CMS_SignerInfo *
78.Fo CMS_add1_signer 79.Fo CMS_add1_signer
diff --git a/src/lib/libcrypto/man/CMS_compress.3 b/src/lib/libcrypto/man/CMS_compress.3
index 242e4e96cb..9026837fc8 100644
--- a/src/lib/libcrypto/man/CMS_compress.3
+++ b/src/lib/libcrypto/man/CMS_compress.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CMS_compress.3,v 1.7 2019/11/02 15:39:46 schwarze Exp $ 1.\" $OpenBSD: CMS_compress.3,v 1.8 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,13 +65,14 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: November 2 2019 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt CMS_COMPRESS 3 69.Dt CMS_COMPRESS 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
72.Nm CMS_compress 72.Nm CMS_compress
73.Nd create a CMS CompressedData structure 73.Nd create a CMS CompressedData structure
74.Sh SYNOPSIS 74.Sh SYNOPSIS
75.Lb libcrypto
75.In openssl/cms.h 76.In openssl/cms.h
76.Ft CMS_ContentInfo * 77.Ft CMS_ContentInfo *
77.Fo CMS_compress 78.Fo CMS_compress
diff --git a/src/lib/libcrypto/man/CMS_decrypt.3 b/src/lib/libcrypto/man/CMS_decrypt.3
index 243ab2f30e..2141098084 100644
--- a/src/lib/libcrypto/man/CMS_decrypt.3
+++ b/src/lib/libcrypto/man/CMS_decrypt.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CMS_decrypt.3,v 1.8 2019/11/02 15:39:46 schwarze Exp $ 1.\" $OpenBSD: CMS_decrypt.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: November 2 2019 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt CMS_DECRYPT 3 69.Dt CMS_DECRYPT 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -74,6 +74,7 @@
74.Nm CMS_decrypt_set1_key 74.Nm CMS_decrypt_set1_key
75.Nd decrypt content from a CMS EnvelopedData structure 75.Nd decrypt content from a CMS EnvelopedData structure
76.Sh SYNOPSIS 76.Sh SYNOPSIS
77.Lb libcrypto
77.In openssl/cms.h 78.In openssl/cms.h
78.Ft int 79.Ft int
79.Fo CMS_decrypt 80.Fo CMS_decrypt
diff --git a/src/lib/libcrypto/man/CMS_encrypt.3 b/src/lib/libcrypto/man/CMS_encrypt.3
index 03d8b4edbb..5eda883857 100644
--- a/src/lib/libcrypto/man/CMS_encrypt.3
+++ b/src/lib/libcrypto/man/CMS_encrypt.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CMS_encrypt.3,v 1.7 2019/11/02 15:39:46 schwarze Exp $ 1.\" $OpenBSD: CMS_encrypt.3,v 1.8 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 2.\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: November 2 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt CMS_ENCRYPT 3 52.Dt CMS_ENCRYPT 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm CMS_encrypt 55.Nm CMS_encrypt
56.Nd create a CMS EnvelopedData structure 56.Nd create a CMS EnvelopedData structure
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/cms.h 59.In openssl/cms.h
59.Ft CMS_ContentInfo * 60.Ft CMS_ContentInfo *
60.Fo CMS_encrypt 61.Fo CMS_encrypt
diff --git a/src/lib/libcrypto/man/CMS_final.3 b/src/lib/libcrypto/man/CMS_final.3
index 4ca8945923..f2b5755fa9 100644
--- a/src/lib/libcrypto/man/CMS_final.3
+++ b/src/lib/libcrypto/man/CMS_final.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CMS_final.3,v 1.6 2019/11/02 15:39:46 schwarze Exp $ 1.\" $OpenBSD: CMS_final.3,v 1.7 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 25ccb589 Jul 1 02:02:06 2019 +0800 2.\" full merge up to: OpenSSL 25ccb589 Jul 1 02:02:06 2019 +0800
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: November 2 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt CMS_FINAL 3 52.Dt CMS_FINAL 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm CMS_final 55.Nm CMS_final
56.Nd finalise a CMS_ContentInfo structure 56.Nd finalise a CMS_ContentInfo structure
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/cms.h 59.In openssl/cms.h
59.Ft int 60.Ft int
60.Fo CMS_final 61.Fo CMS_final
diff --git a/src/lib/libcrypto/man/CMS_get0_RecipientInfos.3 b/src/lib/libcrypto/man/CMS_get0_RecipientInfos.3
index 094d6ec487..beb54bdccc 100644
--- a/src/lib/libcrypto/man/CMS_get0_RecipientInfos.3
+++ b/src/lib/libcrypto/man/CMS_get0_RecipientInfos.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CMS_get0_RecipientInfos.3,v 1.8 2022/03/31 17:27:16 naddy Exp $ 1.\" $OpenBSD: CMS_get0_RecipientInfos.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 31 2022 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt CMS_GET0_RECIPIENTINFOS 3 52.Dt CMS_GET0_RECIPIENTINFOS 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -64,6 +64,7 @@
64.Nm CMS_RecipientInfo_encrypt 64.Nm CMS_RecipientInfo_encrypt
65.Nd CMS EnvelopedData RecipientInfo routines 65.Nd CMS EnvelopedData RecipientInfo routines
66.Sh SYNOPSIS 66.Sh SYNOPSIS
67.Lb libcrypto
67.In openssl/cms.h 68.In openssl/cms.h
68.Ft STACK_OF(CMS_RecipientInfo) * 69.Ft STACK_OF(CMS_RecipientInfo) *
69.Fo CMS_get0_RecipientInfos 70.Fo CMS_get0_RecipientInfos
diff --git a/src/lib/libcrypto/man/CMS_get0_SignerInfos.3 b/src/lib/libcrypto/man/CMS_get0_SignerInfos.3
index 017fdd40f2..f141508eb1 100644
--- a/src/lib/libcrypto/man/CMS_get0_SignerInfos.3
+++ b/src/lib/libcrypto/man/CMS_get0_SignerInfos.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CMS_get0_SignerInfos.3,v 1.9 2024/01/22 14:00:13 tb Exp $ 1.\" $OpenBSD: CMS_get0_SignerInfos.3,v 1.10 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 2.\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: January 22 2024 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt CMS_GET0_SIGNERINFOS 3 52.Dt CMS_GET0_SIGNERINFOS 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -60,6 +60,7 @@
60.Nm CMS_SignerInfo_set1_signer_cert 60.Nm CMS_SignerInfo_set1_signer_cert
61.Nd CMS SignedData signer functions 61.Nd CMS SignedData signer functions
62.Sh SYNOPSIS 62.Sh SYNOPSIS
63.Lb libcrypto
63.In openssl/cms.h 64.In openssl/cms.h
64.Ft STACK_OF(CMS_SignerInfo) * 65.Ft STACK_OF(CMS_SignerInfo) *
65.Fo CMS_get0_SignerInfos 66.Fo CMS_get0_SignerInfos
diff --git a/src/lib/libcrypto/man/CMS_get0_type.3 b/src/lib/libcrypto/man/CMS_get0_type.3
index 55adacd86d..5547de494a 100644
--- a/src/lib/libcrypto/man/CMS_get0_type.3
+++ b/src/lib/libcrypto/man/CMS_get0_type.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CMS_get0_type.3,v 1.9 2023/07/27 05:31:28 tb Exp $ 1.\" $OpenBSD: CMS_get0_type.3,v 1.10 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 72a7a702 Feb 26 14:05:09 2019 +0000 2.\" full merge up to: OpenSSL 72a7a702 Feb 26 14:05:09 2019 +0000
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: July 27 2023 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt CMS_GET0_TYPE 3 69.Dt CMS_GET0_TYPE 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -76,6 +76,7 @@
76.Nm CMS_get0_content 76.Nm CMS_get0_content
77.Nd get and set CMS content types and content 77.Nd get and set CMS content types and content
78.Sh SYNOPSIS 78.Sh SYNOPSIS
79.Lb libcrypto
79.In openssl/cms.h 80.In openssl/cms.h
80.Ft const ASN1_OBJECT * 81.Ft const ASN1_OBJECT *
81.Fo CMS_get0_type 82.Fo CMS_get0_type
diff --git a/src/lib/libcrypto/man/CMS_get1_ReceiptRequest.3 b/src/lib/libcrypto/man/CMS_get1_ReceiptRequest.3
index 9feedd13a2..17a14c47e3 100644
--- a/src/lib/libcrypto/man/CMS_get1_ReceiptRequest.3
+++ b/src/lib/libcrypto/man/CMS_get1_ReceiptRequest.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CMS_get1_ReceiptRequest.3,v 1.7 2019/11/02 15:39:46 schwarze Exp $ 1.\" $OpenBSD: CMS_get1_ReceiptRequest.3,v 1.8 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 2.\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: November 2 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt CMS_GET1_RECEIPTREQUEST 3 52.Dt CMS_GET1_RECEIPTREQUEST 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -58,6 +58,7 @@
58.Nm CMS_ReceiptRequest_get0_values 58.Nm CMS_ReceiptRequest_get0_values
59.Nd CMS signed receipt request functions 59.Nd CMS signed receipt request functions
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libcrypto
61.In openssl/cms.h 62.In openssl/cms.h
62.Ft CMS_ReceiptRequest * 63.Ft CMS_ReceiptRequest *
63.Fo CMS_ReceiptRequest_create0 64.Fo CMS_ReceiptRequest_create0
diff --git a/src/lib/libcrypto/man/CMS_sign.3 b/src/lib/libcrypto/man/CMS_sign.3
index 5261c190a6..82f9ff9896 100644
--- a/src/lib/libcrypto/man/CMS_sign.3
+++ b/src/lib/libcrypto/man/CMS_sign.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CMS_sign.3,v 1.11 2024/04/18 16:50:22 tb Exp $ 1.\" $OpenBSD: CMS_sign.3,v 1.13 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: April 18 2024 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt CMS_SIGN 3 52.Dt CMS_SIGN 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm CMS_sign 55.Nm CMS_sign
56.Nd create a CMS SignedData structure 56.Nd create a CMS SignedData structure
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/cms.h 59.In openssl/cms.h
59.Ft CMS_ContentInfo * 60.Ft CMS_ContentInfo *
60.Fo CMS_sign 61.Fo CMS_sign
@@ -176,7 +177,7 @@ added before finalization.
176.Pp 177.Pp
177If a signer is specified, it will use the default digest for the signing 178If a signer is specified, it will use the default digest for the signing
178algorithm. 179algorithm.
179This is SHA1 for both RSA and DSA keys. 180This is SHA-1 for both RSA and DSA keys.
180.Pp 181.Pp
181If 182If
182.Fa signcert 183.Fa signcert
diff --git a/src/lib/libcrypto/man/CMS_sign_receipt.3 b/src/lib/libcrypto/man/CMS_sign_receipt.3
index 6394957846..32807b26e1 100644
--- a/src/lib/libcrypto/man/CMS_sign_receipt.3
+++ b/src/lib/libcrypto/man/CMS_sign_receipt.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CMS_sign_receipt.3,v 1.7 2019/11/02 15:39:46 schwarze Exp $ 1.\" $OpenBSD: CMS_sign_receipt.3,v 1.8 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: November 2 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt CMS_SIGN_RECEIPT 3 52.Dt CMS_SIGN_RECEIPT 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm CMS_sign_receipt 55.Nm CMS_sign_receipt
56.Nd create a CMS signed receipt 56.Nd create a CMS signed receipt
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/cms.h 59.In openssl/cms.h
59.Ft CMS_ContentInfo * 60.Ft CMS_ContentInfo *
60.Fo CMS_sign_receipt 61.Fo CMS_sign_receipt
diff --git a/src/lib/libcrypto/man/CMS_signed_add1_attr.3 b/src/lib/libcrypto/man/CMS_signed_add1_attr.3
index 1a50c0b9d1..10a959bba6 100644
--- a/src/lib/libcrypto/man/CMS_signed_add1_attr.3
+++ b/src/lib/libcrypto/man/CMS_signed_add1_attr.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CMS_signed_add1_attr.3,v 1.5 2024/09/02 07:54:21 tb Exp $ 1.\" $OpenBSD: CMS_signed_add1_attr.3,v 1.7 2025/06/13 18:34:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2024 Job Snijders <job@openbsd.org> 3.\" Copyright (c) 2024 Job Snijders <job@openbsd.org>
4.\" Copyright (c) 2024 Theo Buehler <tb@openbsd.org> 4.\" Copyright (c) 2024 Theo Buehler <tb@openbsd.org>
@@ -16,7 +16,7 @@
16.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18.\" 18.\"
19.Dd $Mdocdate: September 2 2024 $ 19.Dd $Mdocdate: June 13 2025 $
20.Dt CMS_SIGNED_ADD1_ATTR 3 20.Dt CMS_SIGNED_ADD1_ATTR 3
21.Os 21.Os
22.Sh NAME 22.Sh NAME
@@ -42,6 +42,7 @@
42.Nm CMS_unsigned_get_attr_count 42.Nm CMS_unsigned_get_attr_count
43.Nd change signed and unsigned attributes of a CMS SignerInfo object 43.Nd change signed and unsigned attributes of a CMS SignerInfo object
44.Sh SYNOPSIS 44.Sh SYNOPSIS
45.Lb libcrypto
45.In openssl/cms.h 46.In openssl/cms.h
46.Ft int 47.Ft int
47.Fo CMS_signed_add1_attr 48.Fo CMS_signed_add1_attr
@@ -72,19 +73,19 @@
72.Fa "const void *bytes" 73.Fa "const void *bytes"
73.Fa "int len" 74.Fa "int len"
74.Fc 75.Fc
75.Ft "X509_ATTRIBUTE *" 76.Ft X509_ATTRIBUTE *
76.Fo CMS_signed_delete_attr 77.Fo CMS_signed_delete_attr
77.Fa "CMS_SignerInfo *si" 78.Fa "CMS_SignerInfo *si"
78.Fa "int loc" 79.Fa "int loc"
79.Fc 80.Fc
80.Ft "void *" 81.Ft void *
81.Fo CMS_signed_get0_data_by_OBJ 82.Fo CMS_signed_get0_data_by_OBJ
82.Fa "CMS_SignerInfo *si" 83.Fa "CMS_SignerInfo *si"
83.Fa "const ASN1_OBJECT *oid" 84.Fa "const ASN1_OBJECT *oid"
84.Fa "int start_after" 85.Fa "int start_after"
85.Fa "int type" 86.Fa "int type"
86.Fc 87.Fc
87.Ft "X509_ATTRIBUTE *" 88.Ft X509_ATTRIBUTE *
88.Fo CMS_signed_get_attr 89.Fo CMS_signed_get_attr
89.Fa "const CMS_SignerInfo *si" 90.Fa "const CMS_SignerInfo *si"
90.Fa "int loc" 91.Fa "int loc"
@@ -134,19 +135,19 @@
134.Fa "const void *bytes" 135.Fa "const void *bytes"
135.Fa "int len" 136.Fa "int len"
136.Fc 137.Fc
137.Ft "X509_ATTRIBUTE *" 138.Ft X509_ATTRIBUTE *
138.Fo CMS_unsigned_delete_attr 139.Fo CMS_unsigned_delete_attr
139.Fa "CMS_SignerInfo *si" 140.Fa "CMS_SignerInfo *si"
140.Fa "int loc" 141.Fa "int loc"
141.Fc 142.Fc
142.Ft "void *" 143.Ft void *
143.Fo CMS_unsigned_get0_data_by_OBJ 144.Fo CMS_unsigned_get0_data_by_OBJ
144.Fa "CMS_SignerInfo *si" 145.Fa "CMS_SignerInfo *si"
145.Fa "ASN1_OBJECT *oid" 146.Fa "ASN1_OBJECT *oid"
146.Fa "int start_after" 147.Fa "int start_after"
147.Fa "int type" 148.Fa "int type"
148.Fc 149.Fc
149.Ft "X509_ATTRIBUTE *" 150.Ft X509_ATTRIBUTE *
150.Fo CMS_unsigned_get_attr 151.Fo CMS_unsigned_get_attr
151.Fa "const CMS_SignerInfo *si" 152.Fa "const CMS_SignerInfo *si"
152.Fa "int loc" 153.Fa "int loc"
diff --git a/src/lib/libcrypto/man/CMS_uncompress.3 b/src/lib/libcrypto/man/CMS_uncompress.3
index ed2172521e..2a5e2f593b 100644
--- a/src/lib/libcrypto/man/CMS_uncompress.3
+++ b/src/lib/libcrypto/man/CMS_uncompress.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CMS_uncompress.3,v 1.7 2019/11/02 15:39:46 schwarze Exp $ 1.\" $OpenBSD: CMS_uncompress.3,v 1.8 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: November 2 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt CMS_UNCOMPRESS 3 52.Dt CMS_UNCOMPRESS 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm CMS_uncompress 55.Nm CMS_uncompress
56.Nd uncompress a CMS CompressedData structure 56.Nd uncompress a CMS CompressedData structure
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/cms.h 59.In openssl/cms.h
59.Ft int 60.Ft int
60.Fo CMS_uncompress 61.Fo CMS_uncompress
diff --git a/src/lib/libcrypto/man/CMS_verify.3 b/src/lib/libcrypto/man/CMS_verify.3
index 63f1b8bb18..a8803b0595 100644
--- a/src/lib/libcrypto/man/CMS_verify.3
+++ b/src/lib/libcrypto/man/CMS_verify.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CMS_verify.3,v 1.10 2024/03/29 06:43:12 tb Exp $ 1.\" $OpenBSD: CMS_verify.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 35fd9953 May 28 14:49:38 2019 +0200 2.\" full merge up to: OpenSSL 35fd9953 May 28 14:49:38 2019 +0200
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 29 2024 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt CMS_VERIFY 3 52.Dt CMS_VERIFY 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -56,6 +56,7 @@
56.Nm CMS_get0_signers 56.Nm CMS_get0_signers
57.Nd verify a CMS SignedData structure 57.Nd verify a CMS SignedData structure
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libcrypto
59.In openssl/cms.h 60.In openssl/cms.h
60.Ft int 61.Ft int
61.Fo CMS_verify 62.Fo CMS_verify
diff --git a/src/lib/libcrypto/man/CMS_verify_receipt.3 b/src/lib/libcrypto/man/CMS_verify_receipt.3
index ac50087a4c..98f5c4ad91 100644
--- a/src/lib/libcrypto/man/CMS_verify_receipt.3
+++ b/src/lib/libcrypto/man/CMS_verify_receipt.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CMS_verify_receipt.3,v 1.7 2019/11/02 15:39:46 schwarze Exp $ 1.\" $OpenBSD: CMS_verify_receipt.3,v 1.8 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: November 2 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt CMS_VERIFY_RECEIPT 3 52.Dt CMS_VERIFY_RECEIPT 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm CMS_verify_receipt 55.Nm CMS_verify_receipt
56.Nd verify a CMS signed receipt 56.Nd verify a CMS signed receipt
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/cms.h 59.In openssl/cms.h
59.Ft int 60.Ft int
60.Fo CMS_verify_receipt 61.Fo CMS_verify_receipt
diff --git a/src/lib/libcrypto/man/CONF_modules_free.3 b/src/lib/libcrypto/man/CONF_modules_free.3
index c5fb840942..ab299bcbda 100644
--- a/src/lib/libcrypto/man/CONF_modules_free.3
+++ b/src/lib/libcrypto/man/CONF_modules_free.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CONF_modules_free.3,v 1.6 2023/07/21 10:46:54 tb Exp $ 1.\" $OpenBSD: CONF_modules_free.3,v 1.7 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 2.\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: July 21 2023 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt CONF_MODULES_FREE 3 52.Dt CONF_MODULES_FREE 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -57,6 +57,7 @@
57.Nm CONF_modules_unload 57.Nm CONF_modules_unload
58.Nd OpenSSL configuration cleanup functions 58.Nd OpenSSL configuration cleanup functions
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/conf.h 61.In openssl/conf.h
61.Ft void 62.Ft void
62.Fo CONF_modules_free 63.Fo CONF_modules_free
diff --git a/src/lib/libcrypto/man/CONF_modules_load_file.3 b/src/lib/libcrypto/man/CONF_modules_load_file.3
index d1bcd49a38..78cfc32f0d 100644
--- a/src/lib/libcrypto/man/CONF_modules_load_file.3
+++ b/src/lib/libcrypto/man/CONF_modules_load_file.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CONF_modules_load_file.3,v 1.14 2023/11/19 20:58:07 tb Exp $ 1.\" $OpenBSD: CONF_modules_load_file.3,v 1.16 2025/06/09 12:43:53 schwarze Exp $
2.\" full merge up to: e9b77246 Jan 20 19:58:49 2017 +0100 2.\" full merge up to: e9b77246 Jan 20 19:58:49 2017 +0100
3.\" selective merge up to: d090fc00 Feb 26 13:11:10 2019 +0800 3.\" selective merge up to: d090fc00 Feb 26 13:11:10 2019 +0800
4.\" 4.\"
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: November 19 2023 $ 69.Dd $Mdocdate: June 9 2025 $
70.Dt CONF_MODULES_LOAD_FILE 3 70.Dt CONF_MODULES_LOAD_FILE 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -75,6 +75,7 @@
75.Nm X509_get_default_cert_area 75.Nm X509_get_default_cert_area
76.Nd OpenSSL configuration functions 76.Nd OpenSSL configuration functions
77.Sh SYNOPSIS 77.Sh SYNOPSIS
78.Lb libcrypto
78.In openssl/conf.h 79.In openssl/conf.h
79.Ft int 80.Ft int
80.Fo CONF_modules_load_file 81.Fo CONF_modules_load_file
@@ -222,7 +223,6 @@ Load custom configuration file and section instead of the standard one,
222only print warnings on error, missing configuration file ignored: 223only print warnings on error, missing configuration file ignored:
223.Bd -literal 224.Bd -literal
224OPENSSL_no_config(); 225OPENSSL_no_config();
225OPENSSL_load_builtin_modules();
226if (CONF_modules_load_file("/something/app.cnf", "myapp", 226if (CONF_modules_load_file("/something/app.cnf", "myapp",
227 CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) { 227 CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) {
228 fprintf(stderr, "WARNING: error loading configuration file\en"); 228 fprintf(stderr, "WARNING: error loading configuration file\en");
@@ -233,11 +233,7 @@ if (CONF_modules_load_file("/something/app.cnf", "myapp",
233In the previous example, the call to 233In the previous example, the call to
234.Xr OPENSSL_no_config 3 234.Xr OPENSSL_no_config 3
235is required first to suppress automatic loading 235is required first to suppress automatic loading
236of the standard configuration file, and the call to 236of the standard configuration file.
237.Xr OPENSSL_load_builtin_modules 3
238is needed so that the configuration of builtin modules
239is loaded in addition to the configuration of
240.Qq myapp .
241.Pp 237.Pp
242Load and parse configuration file manually, custom error handling: 238Load and parse configuration file manually, custom error handling:
243.Bd -literal 239.Bd -literal
@@ -268,8 +264,7 @@ if (fp == NULL) {
268.Sh SEE ALSO 264.Sh SEE ALSO
269.Xr CONF_modules_free 3 , 265.Xr CONF_modules_free 3 ,
270.Xr ERR 3 , 266.Xr ERR 3 ,
271.Xr OPENSSL_config 3 , 267.Xr OPENSSL_config 3
272.Xr OPENSSL_load_builtin_modules 3
273.Sh HISTORY 268.Sh HISTORY
274.Fn X509_get_default_cert_area 269.Fn X509_get_default_cert_area
275first appeared in SSLeay 0.4.1 and has been available since 270first appeared in SSLeay 0.4.1 and has been available since
diff --git a/src/lib/libcrypto/man/CRYPTO_lock.3 b/src/lib/libcrypto/man/CRYPTO_lock.3
index afc5eb54c5..7877dd5804 100644
--- a/src/lib/libcrypto/man/CRYPTO_lock.3
+++ b/src/lib/libcrypto/man/CRYPTO_lock.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CRYPTO_lock.3,v 1.3 2024/03/14 22:09:40 tb Exp $ 1.\" $OpenBSD: CRYPTO_lock.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL doc/crypto/threads.pod fb552ac6 Sep 30 23:43:01 2009 +0000 2.\" OpenSSL doc/crypto/threads.pod fb552ac6 Sep 30 23:43:01 2009 +0000
3.\" 3.\"
4.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> 4.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,7 +15,7 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 17.\"
18.Dd $Mdocdate: March 14 2024 $ 18.Dd $Mdocdate: June 8 2025 $
19.Dt CRYPTO_LOCK 3 19.Dt CRYPTO_LOCK 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
@@ -27,6 +27,7 @@
27.Nm CRYPTO_add 27.Nm CRYPTO_add
28.Nd thread support 28.Nd thread support
29.Sh SYNOPSIS 29.Sh SYNOPSIS
30.Lb libcrypto
30.In openssl/crypto.h 31.In openssl/crypto.h
31.Ft void 32.Ft void
32.Fo CRYPTO_lock 33.Fo CRYPTO_lock
diff --git a/src/lib/libcrypto/man/CRYPTO_memcmp.3 b/src/lib/libcrypto/man/CRYPTO_memcmp.3
index cbc0030c55..fbe092cb90 100644
--- a/src/lib/libcrypto/man/CRYPTO_memcmp.3
+++ b/src/lib/libcrypto/man/CRYPTO_memcmp.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CRYPTO_memcmp.3,v 1.1 2019/08/25 06:20:22 schwarze Exp $ 1.\" $OpenBSD: CRYPTO_memcmp.3,v 1.2 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 1075139c Jun 24 09:18:48 2019 +1000 2.\" full merge up to: OpenSSL 1075139c Jun 24 09:18:48 2019 +1000
3.\" 3.\"
4.\" This file was written by Pauli <paul.dale@oracle.com>. 4.\" This file was written by Pauli <paul.dale@oracle.com>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: August 25 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt CRYPTO_MEMCMP 3 52.Dt CRYPTO_MEMCMP 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm CRYPTO_memcmp 55.Nm CRYPTO_memcmp
56.Nd constant time memory comparison 56.Nd constant time memory comparison
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/crypto.h 59.In openssl/crypto.h
59.Ft int 60.Ft int
60.Fo CRYPTO_memcmp 61.Fo CRYPTO_memcmp
diff --git a/src/lib/libcrypto/man/CRYPTO_set_ex_data.3 b/src/lib/libcrypto/man/CRYPTO_set_ex_data.3
index c22fb22352..57cdbfb4ca 100644
--- a/src/lib/libcrypto/man/CRYPTO_set_ex_data.3
+++ b/src/lib/libcrypto/man/CRYPTO_set_ex_data.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CRYPTO_set_ex_data.3,v 1.15 2023/09/18 14:49:43 schwarze Exp $ 1.\" $OpenBSD: CRYPTO_set_ex_data.3,v 1.16 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: September 18 2023 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt CRYPTO_SET_EX_DATA 3 18.Dt CRYPTO_SET_EX_DATA 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -28,6 +28,7 @@
28.Nm CRYPTO_free_ex_data 28.Nm CRYPTO_free_ex_data
29.Nd low-level functions for application specific data 29.Nd low-level functions for application specific data
30.Sh SYNOPSIS 30.Sh SYNOPSIS
31.Lb libcrypto
31.In openssl/crypto.h 32.In openssl/crypto.h
32.Ft int 33.Ft int
33.Fo CRYPTO_get_ex_new_index 34.Fo CRYPTO_get_ex_new_index
diff --git a/src/lib/libcrypto/man/CRYPTO_set_mem_functions.3 b/src/lib/libcrypto/man/CRYPTO_set_mem_functions.3
index d020d10ff6..4fc88339a8 100644
--- a/src/lib/libcrypto/man/CRYPTO_set_mem_functions.3
+++ b/src/lib/libcrypto/man/CRYPTO_set_mem_functions.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CRYPTO_set_mem_functions.3,v 1.2 2025/03/08 17:17:09 tb Exp $ 1.\" $OpenBSD: CRYPTO_set_mem_functions.3,v 1.3 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 8 2025 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt CRYPTO_SET_MEM_FUNCTIONS 3 18.Dt CRYPTO_SET_MEM_FUNCTIONS 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -25,6 +25,7 @@
25.Nm CRYPTO_mem_leaks_cb 25.Nm CRYPTO_mem_leaks_cb
26.Nd legacy OpenSSL memory allocation control 26.Nd legacy OpenSSL memory allocation control
27.Sh SYNOPSIS 27.Sh SYNOPSIS
28.Lb libcrypto
28.In openssl/crypto.h 29.In openssl/crypto.h
29.Ft int 30.Ft int
30.Fo CRYPTO_set_mem_functions 31.Fo CRYPTO_set_mem_functions
diff --git a/src/lib/libcrypto/man/ChaCha.3 b/src/lib/libcrypto/man/ChaCha.3
index 9aae6d70cf..54cd597f6c 100644
--- a/src/lib/libcrypto/man/ChaCha.3
+++ b/src/lib/libcrypto/man/ChaCha.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ChaCha.3,v 1.3 2022/02/18 10:24:32 jsg Exp $ 1.\" $OpenBSD: ChaCha.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: February 18 2022 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt CHACHA 3 18.Dt CHACHA 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -26,6 +26,7 @@
26.Nm CRYPTO_xchacha_20 26.Nm CRYPTO_xchacha_20
27.Nd ChaCha20 stream cipher 27.Nd ChaCha20 stream cipher
28.Sh SYNOPSIS 28.Sh SYNOPSIS
29.Lb libcrypto
29.In openssl/chacha.h 30.In openssl/chacha.h
30.Ft void 31.Ft void
31.Fo ChaCha_set_key 32.Fo ChaCha_set_key
diff --git a/src/lib/libcrypto/man/DES_set_key.3 b/src/lib/libcrypto/man/DES_set_key.3
index fd09d77730..3794285006 100644
--- a/src/lib/libcrypto/man/DES_set_key.3
+++ b/src/lib/libcrypto/man/DES_set_key.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: DES_set_key.3,v 1.17 2024/05/24 19:18:07 tb Exp $ 1.\" $OpenBSD: DES_set_key.3,v 1.18 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL man3/DES_random_key 521738e9 Oct 5 14:58:30 2018 -0400 3.\" OpenSSL man3/DES_random_key 521738e9 Oct 5 14:58:30 2018 -0400
4.\" 4.\"
@@ -115,7 +115,7 @@
115.\" copied and put under another distribution licence 115.\" copied and put under another distribution licence
116.\" [including the GNU Public Licence.] 116.\" [including the GNU Public Licence.]
117.\" 117.\"
118.Dd $Mdocdate: May 24 2024 $ 118.Dd $Mdocdate: June 8 2025 $
119.Dt DES_SET_KEY 3 119.Dt DES_SET_KEY 3
120.Os 120.Os
121.Sh NAME 121.Sh NAME
@@ -151,6 +151,7 @@
151.Nm DES_crypt 151.Nm DES_crypt
152.Nd DES encryption 152.Nd DES encryption
153.Sh SYNOPSIS 153.Sh SYNOPSIS
154.Lb libcrypto
154.In openssl/des.h 155.In openssl/des.h
155.Ft void 156.Ft void
156.Fo DES_random_key 157.Fo DES_random_key
diff --git a/src/lib/libcrypto/man/DH_generate_key.3 b/src/lib/libcrypto/man/DH_generate_key.3
index 076b49f7a1..c3158b8132 100644
--- a/src/lib/libcrypto/man/DH_generate_key.3
+++ b/src/lib/libcrypto/man/DH_generate_key.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: DH_generate_key.3,v 1.12 2019/08/19 13:08:26 schwarze Exp $ 1.\" $OpenBSD: DH_generate_key.3,v 1.13 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: August 19 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt DH_GENERATE_KEY 3 52.Dt DH_GENERATE_KEY 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -56,6 +56,7 @@
56.Nm DH_compute_key 56.Nm DH_compute_key
57.Nd perform Diffie-Hellman key exchange 57.Nd perform Diffie-Hellman key exchange
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libcrypto
59.In openssl/dh.h 60.In openssl/dh.h
60.Ft int 61.Ft int
61.Fo DH_generate_key 62.Fo DH_generate_key
diff --git a/src/lib/libcrypto/man/DH_generate_parameters.3 b/src/lib/libcrypto/man/DH_generate_parameters.3
index ac29521ec4..f47475e3b1 100644
--- a/src/lib/libcrypto/man/DH_generate_parameters.3
+++ b/src/lib/libcrypto/man/DH_generate_parameters.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: DH_generate_parameters.3,v 1.14 2022/07/13 13:47:59 schwarze Exp $ 1.\" $OpenBSD: DH_generate_parameters.3,v 1.15 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" selective merge up to: OpenSSL b0edda11 Mar 20 13:00:17 2018 +0000 3.\" selective merge up to: OpenSSL b0edda11 Mar 20 13:00:17 2018 +0000
4.\" 4.\"
@@ -67,7 +67,7 @@
67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
69.\" 69.\"
70.Dd $Mdocdate: July 13 2022 $ 70.Dd $Mdocdate: June 8 2025 $
71.Dt DH_GENERATE_PARAMETERS 3 71.Dt DH_GENERATE_PARAMETERS 3
72.Os 72.Os
73.Sh NAME 73.Sh NAME
@@ -77,6 +77,7 @@
77.Nm DH_generate_parameters 77.Nm DH_generate_parameters
78.Nd generate and check Diffie-Hellman parameters 78.Nd generate and check Diffie-Hellman parameters
79.Sh SYNOPSIS 79.Sh SYNOPSIS
80.Lb libcrypto
80.In openssl/dh.h 81.In openssl/dh.h
81.Ft int 82.Ft int
82.Fo DH_generate_parameters_ex 83.Fo DH_generate_parameters_ex
diff --git a/src/lib/libcrypto/man/DH_get0_pqg.3 b/src/lib/libcrypto/man/DH_get0_pqg.3
index eb012980f9..e30d628c7f 100644
--- a/src/lib/libcrypto/man/DH_get0_pqg.3
+++ b/src/lib/libcrypto/man/DH_get0_pqg.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: DH_get0_pqg.3,v 1.8 2024/07/21 08:36:43 tb Exp $ 1.\" $OpenBSD: DH_get0_pqg.3,v 1.10 2025/06/13 18:34:00 schwarze Exp $
2.\" selective merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 2.\" selective merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100
3.\" 3.\"
4.\" This file was written by Matt Caswell <matt@openssl.org>. 4.\" This file was written by Matt Caswell <matt@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: July 21 2024 $ 51.Dd $Mdocdate: June 13 2025 $
52.Dt DH_GET0_PQG 3 52.Dt DH_GET0_PQG 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -68,6 +68,7 @@
68.Nm DH_set_length 68.Nm DH_set_length
69.Nd get data from and set data in a DH object 69.Nd get data from and set data in a DH object
70.Sh SYNOPSIS 70.Sh SYNOPSIS
71.Lb libcrypto
71.In openssl/dh.h 72.In openssl/dh.h
72.Ft void 73.Ft void
73.Fo DH_get0_pqg 74.Fo DH_get0_pqg
@@ -76,15 +77,15 @@
76.Fa "const BIGNUM **q" 77.Fa "const BIGNUM **q"
77.Fa "const BIGNUM **g" 78.Fa "const BIGNUM **g"
78.Fc 79.Fc
79.Ft "const BIGNUM *" 80.Ft const BIGNUM *
80.Fo DH_get0_p 81.Fo DH_get0_p
81.Fa "const DH *dh" 82.Fa "const DH *dh"
82.Fc 83.Fc
83.Ft "const BIGNUM *" 84.Ft const BIGNUM *
84.Fo DH_get0_q 85.Fo DH_get0_q
85.Fa "const DH *dh" 86.Fa "const DH *dh"
86.Fc 87.Fc
87.Ft "const BIGNUM *" 88.Ft const BIGNUM *
88.Fo DH_get0_g 89.Fo DH_get0_g
89.Fa "const DH *dh" 90.Fa "const DH *dh"
90.Fc 91.Fc
@@ -101,11 +102,11 @@
101.Fa "const BIGNUM **pub_key" 102.Fa "const BIGNUM **pub_key"
102.Fa "const BIGNUM **priv_key" 103.Fa "const BIGNUM **priv_key"
103.Fc 104.Fc
104.Ft "const BIGNUM *" 105.Ft const BIGNUM *
105.Fo DH_get0_pub_key 106.Fo DH_get0_pub_key
106.Fa "const DH *dh" 107.Fa "const DH *dh"
107.Fc 108.Fc
108.Ft "const BIGNUM *" 109.Ft const BIGNUM *
109.Fo DH_get0_priv_key 110.Fo DH_get0_priv_key
110.Fa "const DH *dh" 111.Fa "const DH *dh"
111.Fc 112.Fc
diff --git a/src/lib/libcrypto/man/DH_get_ex_new_index.3 b/src/lib/libcrypto/man/DH_get_ex_new_index.3
index 81a0aff8ec..e0d1f1b813 100644
--- a/src/lib/libcrypto/man/DH_get_ex_new_index.3
+++ b/src/lib/libcrypto/man/DH_get_ex_new_index.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: DH_get_ex_new_index.3,v 1.5 2018/03/23 23:18:17 schwarze Exp $ 1.\" $OpenBSD: DH_get_ex_new_index.3,v 1.6 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 2.\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 23 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt DH_GET_EX_NEW_INDEX 3 52.Dt DH_GET_EX_NEW_INDEX 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -57,6 +57,7 @@
57.Nm DH_get_ex_data 57.Nm DH_get_ex_data
58.Nd add application specific data to DH structures 58.Nd add application specific data to DH structures
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/dh.h 61.In openssl/dh.h
61.Ft int 62.Ft int
62.Fo DH_get_ex_new_index 63.Fo DH_get_ex_new_index
diff --git a/src/lib/libcrypto/man/DH_new.3 b/src/lib/libcrypto/man/DH_new.3
index 4993456897..0e01a26733 100644
--- a/src/lib/libcrypto/man/DH_new.3
+++ b/src/lib/libcrypto/man/DH_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: DH_new.3,v 1.12 2022/07/13 21:51:35 schwarze Exp $ 1.\" $OpenBSD: DH_new.3,v 1.13 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: July 13 2022 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt DH_NEW 3 52.Dt DH_NEW 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -57,6 +57,7 @@
57.Nm DH_free 57.Nm DH_free
58.Nd allocate and free DH objects 58.Nd allocate and free DH objects
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/dh.h 61.In openssl/dh.h
61.Ft DH* 62.Ft DH*
62.Fn DH_new void 63.Fn DH_new void
diff --git a/src/lib/libcrypto/man/DH_set_method.3 b/src/lib/libcrypto/man/DH_set_method.3
index 70cf367c9d..3491cf8f6e 100644
--- a/src/lib/libcrypto/man/DH_set_method.3
+++ b/src/lib/libcrypto/man/DH_set_method.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: DH_set_method.3,v 1.9 2023/11/19 10:34:26 tb Exp $ 1.\" $OpenBSD: DH_set_method.3,v 1.10 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: November 19 2023 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt DH_SET_METHOD 3 52.Dt DH_SET_METHOD 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -59,6 +59,7 @@
59.Nm DH_OpenSSL 59.Nm DH_OpenSSL
60.Nd select DH method 60.Nd select DH method
61.Sh SYNOPSIS 61.Sh SYNOPSIS
62.Lb libcrypto
62.In openssl/dh.h 63.In openssl/dh.h
63.Ft void 64.Ft void
64.Fo DH_set_default_method 65.Fo DH_set_default_method
diff --git a/src/lib/libcrypto/man/DH_size.3 b/src/lib/libcrypto/man/DH_size.3
index 4e6dbc0cba..09c019f366 100644
--- a/src/lib/libcrypto/man/DH_size.3
+++ b/src/lib/libcrypto/man/DH_size.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: DH_size.3,v 1.10 2022/07/13 21:51:35 schwarze Exp $ 1.\" $OpenBSD: DH_size.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org> 4.\" This file was written by Ulf Moeller <ulf@openssl.org>
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: July 13 2022 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt DH_SIZE 3 53.Dt DH_SIZE 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -57,6 +57,7 @@
57.Nm DH_bits 57.Nm DH_bits
58.Nd get Diffie-Hellman prime size 58.Nd get Diffie-Hellman prime size
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/dh.h 61.In openssl/dh.h
61.Ft int 62.Ft int
62.Fo DH_size 63.Fo DH_size
diff --git a/src/lib/libcrypto/man/DIST_POINT_new.3 b/src/lib/libcrypto/man/DIST_POINT_new.3
index 6a5cc40468..e5aeb2a5d5 100644
--- a/src/lib/libcrypto/man/DIST_POINT_new.3
+++ b/src/lib/libcrypto/man/DIST_POINT_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: DIST_POINT_new.3,v 1.5 2019/06/06 01:06:58 schwarze Exp $ 1.\" $OpenBSD: DIST_POINT_new.3,v 1.6 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 6 2019 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt DIST_POINT_NEW 3 18.Dt DIST_POINT_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -28,6 +28,7 @@
28.Nm ISSUING_DIST_POINT_free 28.Nm ISSUING_DIST_POINT_free
29.Nd X.509 CRL distribution point extensions 29.Nd X.509 CRL distribution point extensions
30.Sh SYNOPSIS 30.Sh SYNOPSIS
31.Lb libcrypto
31.In openssl/x509v3.h 32.In openssl/x509v3.h
32.Ft DIST_POINT * 33.Ft DIST_POINT *
33.Fn DIST_POINT_new void 34.Fn DIST_POINT_new void
diff --git a/src/lib/libcrypto/man/DSA_SIG_new.3 b/src/lib/libcrypto/man/DSA_SIG_new.3
index 160b453939..003f71f0f1 100644
--- a/src/lib/libcrypto/man/DSA_SIG_new.3
+++ b/src/lib/libcrypto/man/DSA_SIG_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: DSA_SIG_new.3,v 1.8 2019/06/10 14:58:48 schwarze Exp $ 1.\" $OpenBSD: DSA_SIG_new.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>, 4.\" This file was written by Ulf Moeller <ulf@openssl.org>,
@@ -50,7 +50,7 @@
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\" 52.\"
53.Dd $Mdocdate: June 10 2019 $ 53.Dd $Mdocdate: June 8 2025 $
54.Dt DSA_SIG_NEW 3 54.Dt DSA_SIG_NEW 3
55.Os 55.Os
56.Sh NAME 56.Sh NAME
@@ -60,6 +60,7 @@
60.Nm DSA_SIG_set0 60.Nm DSA_SIG_set0
61.Nd manipulate DSA signature objects 61.Nd manipulate DSA signature objects
62.Sh SYNOPSIS 62.Sh SYNOPSIS
63.Lb libcrypto
63.In openssl/dsa.h 64.In openssl/dsa.h
64.Ft DSA_SIG * 65.Ft DSA_SIG *
65.Fn DSA_SIG_new void 66.Fn DSA_SIG_new void
diff --git a/src/lib/libcrypto/man/DSA_do_sign.3 b/src/lib/libcrypto/man/DSA_do_sign.3
index 4602bed872..f7de537bf9 100644
--- a/src/lib/libcrypto/man/DSA_do_sign.3
+++ b/src/lib/libcrypto/man/DSA_do_sign.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: DSA_do_sign.3,v 1.10 2019/06/10 14:58:48 schwarze Exp $ 1.\" $OpenBSD: DSA_do_sign.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 10 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt DSA_DO_SIGN 3 52.Dt DSA_DO_SIGN 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -56,6 +56,7 @@
56.Nm DSA_do_verify 56.Nm DSA_do_verify
57.Nd raw DSA signature operations 57.Nd raw DSA signature operations
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libcrypto
59.In openssl/dsa.h 60.In openssl/dsa.h
60.Ft DSA_SIG * 61.Ft DSA_SIG *
61.Fo DSA_do_sign 62.Fo DSA_do_sign
diff --git a/src/lib/libcrypto/man/DSA_dup_DH.3 b/src/lib/libcrypto/man/DSA_dup_DH.3
index d6163fd3c3..a3ec94f628 100644
--- a/src/lib/libcrypto/man/DSA_dup_DH.3
+++ b/src/lib/libcrypto/man/DSA_dup_DH.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: DSA_dup_DH.3,v 1.9 2023/08/12 08:26:38 tb Exp $ 1.\" $OpenBSD: DSA_dup_DH.3,v 1.10 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: August 12 2023 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt DSA_DUP_DH 3 52.Dt DSA_DUP_DH 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm DSA_dup_DH 55.Nm DSA_dup_DH
56.Nd create a DH structure out of DSA structure 56.Nd create a DH structure out of DSA structure
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/dsa.h 59.In openssl/dsa.h
59.Ft DH * 60.Ft DH *
60.Fo DSA_dup_DH 61.Fo DSA_dup_DH
diff --git a/src/lib/libcrypto/man/DSA_generate_key.3 b/src/lib/libcrypto/man/DSA_generate_key.3
index 37d8ec1c0f..161e0680cc 100644
--- a/src/lib/libcrypto/man/DSA_generate_key.3
+++ b/src/lib/libcrypto/man/DSA_generate_key.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: DSA_generate_key.3,v 1.11 2023/12/29 19:12:47 tb Exp $ 1.\" $OpenBSD: DSA_generate_key.3,v 1.12 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: December 29 2023 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt DSA_GENERATE_KEY 3 52.Dt DSA_GENERATE_KEY 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm DSA_generate_key 55.Nm DSA_generate_key
56.Nd generate DSA key pair 56.Nd generate DSA key pair
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/dsa.h 59.In openssl/dsa.h
59.Ft int 60.Ft int
60.Fo DSA_generate_key 61.Fo DSA_generate_key
diff --git a/src/lib/libcrypto/man/DSA_generate_parameters_ex.3 b/src/lib/libcrypto/man/DSA_generate_parameters_ex.3
index a318bf8298..fb610b8191 100644
--- a/src/lib/libcrypto/man/DSA_generate_parameters_ex.3
+++ b/src/lib/libcrypto/man/DSA_generate_parameters_ex.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: DSA_generate_parameters_ex.3,v 1.1 2023/12/29 19:15:15 tb Exp $ 1.\" $OpenBSD: DSA_generate_parameters_ex.3,v 1.2 2025/06/08 22:37:23 schwarze Exp $
2.\" OpenSSL 9b86974e Aug 7 22:14:47 2015 -0400 2.\" OpenSSL 9b86974e Aug 7 22:14:47 2015 -0400
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>, 4.\" This file was written by Ulf Moeller <ulf@openssl.org>,
@@ -49,15 +49,14 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: December 29 2023 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt DSA_GENERATE_PARAMETERS_EX 3 53.Dt DSA_GENERATE_PARAMETERS_EX 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
56.\" .Nm DSA_generate_parameters is intentionally undocumented
57.\" because it will be removed in the next major bump
58.Nm DSA_generate_parameters_ex 56.Nm DSA_generate_parameters_ex
59.Nd generate DSA parameters 57.Nd generate DSA parameters
60.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libcrypto
61.In openssl/dsa.h 60.In openssl/dsa.h
62.Ft int 61.Ft int
63.Fo DSA_generate_parameters_ex 62.Fo DSA_generate_parameters_ex
diff --git a/src/lib/libcrypto/man/DSA_get0_pqg.3 b/src/lib/libcrypto/man/DSA_get0_pqg.3
index b82affba66..e609b6250d 100644
--- a/src/lib/libcrypto/man/DSA_get0_pqg.3
+++ b/src/lib/libcrypto/man/DSA_get0_pqg.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: DSA_get0_pqg.3,v 1.11 2024/07/21 08:36:43 tb Exp $ 1.\" $OpenBSD: DSA_get0_pqg.3,v 1.13 2025/06/13 18:34:00 schwarze Exp $
2.\" full merge up to: OpenSSL e90fc053 Jul 15 09:39:45 2017 -0400 2.\" full merge up to: OpenSSL e90fc053 Jul 15 09:39:45 2017 -0400
3.\" 3.\"
4.\" This file was written by Matt Caswell <matt@openssl.org>. 4.\" This file was written by Matt Caswell <matt@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: July 21 2024 $ 51.Dd $Mdocdate: June 13 2025 $
52.Dt DSA_GET0_PQG 3 52.Dt DSA_GET0_PQG 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -67,6 +67,7 @@
67.Nm DSA_get0_engine 67.Nm DSA_get0_engine
68.Nd get data from and set data in a DSA object 68.Nd get data from and set data in a DSA object
69.Sh SYNOPSIS 69.Sh SYNOPSIS
70.Lb libcrypto
70.In openssl/dsa.h 71.In openssl/dsa.h
71.Ft void 72.Ft void
72.Fo DSA_get0_pqg 73.Fo DSA_get0_pqg
@@ -75,15 +76,15 @@
75.Fa "const BIGNUM **q" 76.Fa "const BIGNUM **q"
76.Fa "const BIGNUM **g" 77.Fa "const BIGNUM **g"
77.Fc 78.Fc
78.Ft "const BIGNUM *" 79.Ft const BIGNUM *
79.Fo DSA_get0_p 80.Fo DSA_get0_p
80.Fa "const DSA *d" 81.Fa "const DSA *d"
81.Fc 82.Fc
82.Ft "const BIGNUM *" 83.Ft const BIGNUM *
83.Fo DSA_get0_q 84.Fo DSA_get0_q
84.Fa "const DSA *d" 85.Fa "const DSA *d"
85.Fc 86.Fc
86.Ft "const BIGNUM *" 87.Ft const BIGNUM *
87.Fo DSA_get0_g 88.Fo DSA_get0_g
88.Fa "const DSA *d" 89.Fa "const DSA *d"
89.Fc 90.Fc
@@ -100,11 +101,11 @@
100.Fa "const BIGNUM **pub_key" 101.Fa "const BIGNUM **pub_key"
101.Fa "const BIGNUM **priv_key" 102.Fa "const BIGNUM **priv_key"
102.Fc 103.Fc
103.Ft "const BIGNUM *" 104.Ft const BIGNUM *
104.Fo DSA_get0_pub_key 105.Fo DSA_get0_pub_key
105.Fa "const DSA *d" 106.Fa "const DSA *d"
106.Fc 107.Fc
107.Ft "const BIGNUM *" 108.Ft const BIGNUM *
108.Fo DSA_get0_priv_key 109.Fo DSA_get0_priv_key
109.Fa "const DSA *d" 110.Fa "const DSA *d"
110.Fc 111.Fc
diff --git a/src/lib/libcrypto/man/DSA_get_ex_new_index.3 b/src/lib/libcrypto/man/DSA_get_ex_new_index.3
index 8fe055f337..477c011c53 100644
--- a/src/lib/libcrypto/man/DSA_get_ex_new_index.3
+++ b/src/lib/libcrypto/man/DSA_get_ex_new_index.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: DSA_get_ex_new_index.3,v 1.5 2018/03/22 16:06:33 schwarze Exp $ 1.\" $OpenBSD: DSA_get_ex_new_index.3,v 1.6 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 2.\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 22 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt DSA_GET_EX_NEW_INDEX 3 52.Dt DSA_GET_EX_NEW_INDEX 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -57,6 +57,7 @@
57.Nm DSA_get_ex_data 57.Nm DSA_get_ex_data
58.Nd add application specific data to DSA structures 58.Nd add application specific data to DSA structures
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/dsa.h 61.In openssl/dsa.h
61.Ft int 62.Ft int
62.Fo DSA_get_ex_new_index 63.Fo DSA_get_ex_new_index
diff --git a/src/lib/libcrypto/man/DSA_meth_new.3 b/src/lib/libcrypto/man/DSA_meth_new.3
index d89cd397b0..abd023346e 100644
--- a/src/lib/libcrypto/man/DSA_meth_new.3
+++ b/src/lib/libcrypto/man/DSA_meth_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: DSA_meth_new.3,v 1.3 2022/07/10 13:41:59 schwarze Exp $ 1.\" $OpenBSD: DSA_meth_new.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $
2.\" selective merge up to: OpenSSL c4d3c19b Apr 3 13:57:12 2018 +0100 2.\" selective merge up to: OpenSSL c4d3c19b Apr 3 13:57:12 2018 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: July 10 2022 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt DSA_METH_NEW 3 69.Dt DSA_METH_NEW 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -78,6 +78,7 @@
78.Nm DSA_meth_set_finish 78.Nm DSA_meth_set_finish
79.Nd build up DSA methods 79.Nd build up DSA methods
80.Sh SYNOPSIS 80.Sh SYNOPSIS
81.Lb libcrypto
81.In openssl/dsa.h 82.In openssl/dsa.h
82.Ft DSA_METHOD * 83.Ft DSA_METHOD *
83.Fo DSA_meth_new 84.Fo DSA_meth_new
diff --git a/src/lib/libcrypto/man/DSA_new.3 b/src/lib/libcrypto/man/DSA_new.3
index 5a958b58c4..5340bec4bd 100644
--- a/src/lib/libcrypto/man/DSA_new.3
+++ b/src/lib/libcrypto/man/DSA_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: DSA_new.3,v 1.14 2023/12/29 19:12:47 tb Exp $ 1.\" $OpenBSD: DSA_new.3,v 1.15 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: December 29 2023 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt DSA_NEW 3 52.Dt DSA_NEW 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -57,6 +57,7 @@
57.Nm DSA_free 57.Nm DSA_free
58.Nd allocate and free DSA objects 58.Nd allocate and free DSA objects
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/dsa.h 61.In openssl/dsa.h
61.Ft DSA* 62.Ft DSA*
62.Fn DSA_new void 63.Fn DSA_new void
diff --git a/src/lib/libcrypto/man/DSA_set_method.3 b/src/lib/libcrypto/man/DSA_set_method.3
index c60a3e29c3..f2a6eca57c 100644
--- a/src/lib/libcrypto/man/DSA_set_method.3
+++ b/src/lib/libcrypto/man/DSA_set_method.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: DSA_set_method.3,v 1.12 2024/05/11 06:53:19 tb Exp $ 1.\" $OpenBSD: DSA_set_method.3,v 1.13 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: May 11 2024 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt DSA_SET_METHOD 3 52.Dt DSA_SET_METHOD 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -59,6 +59,7 @@
59.Nm DSA_OpenSSL 59.Nm DSA_OpenSSL
60.Nd select DSA method 60.Nd select DSA method
61.Sh SYNOPSIS 61.Sh SYNOPSIS
62.Lb libcrypto
62.In openssl/dsa.h 63.In openssl/dsa.h
63.Ft void 64.Ft void
64.Fo DSA_set_default_method 65.Fo DSA_set_default_method
diff --git a/src/lib/libcrypto/man/DSA_sign.3 b/src/lib/libcrypto/man/DSA_sign.3
index 59f9042ba6..787dc903ea 100644
--- a/src/lib/libcrypto/man/DSA_sign.3
+++ b/src/lib/libcrypto/man/DSA_sign.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: DSA_sign.3,v 1.10 2019/06/10 14:58:48 schwarze Exp $ 1.\" $OpenBSD: DSA_sign.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 10 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt DSA_SIGN 3 52.Dt DSA_SIGN 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -57,6 +57,7 @@
57.Nm DSA_verify 57.Nm DSA_verify
58.Nd DSA signatures 58.Nd DSA signatures
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/dsa.h 61.In openssl/dsa.h
61.Ft int 62.Ft int
62.Fo DSA_sign 63.Fo DSA_sign
diff --git a/src/lib/libcrypto/man/DSA_size.3 b/src/lib/libcrypto/man/DSA_size.3
index 4786acc7e9..09ce80e132 100644
--- a/src/lib/libcrypto/man/DSA_size.3
+++ b/src/lib/libcrypto/man/DSA_size.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: DSA_size.3,v 1.8 2022/07/13 21:44:23 schwarze Exp $ 1.\" $OpenBSD: DSA_size.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 2.\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: July 13 2022 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt DSA_SIZE 3 70.Dt DSA_SIZE 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -74,6 +74,7 @@
74.Nm DSA_bits 74.Nm DSA_bits
75.Nd get DSA signature or key size 75.Nd get DSA signature or key size
76.Sh SYNOPSIS 76.Sh SYNOPSIS
77.Lb libcrypto
77.In openssl/dsa.h 78.In openssl/dsa.h
78.Ft int 79.Ft int
79.Fo DSA_size 80.Fo DSA_size
diff --git a/src/lib/libcrypto/man/ECDH_compute_key.3 b/src/lib/libcrypto/man/ECDH_compute_key.3
index c49988e141..b0ae6ad34c 100644
--- a/src/lib/libcrypto/man/ECDH_compute_key.3
+++ b/src/lib/libcrypto/man/ECDH_compute_key.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ECDH_compute_key.3,v 1.3 2023/08/29 10:07:42 tb Exp $ 1.\" $OpenBSD: ECDH_compute_key.3,v 1.5 2025/06/08 22:40:29 schwarze Exp $
2.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> 2.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org>
3.\" 3.\"
4.\" Permission to use, copy, modify, and distribute this software for any 4.\" Permission to use, copy, modify, and distribute this software for any
@@ -13,7 +13,7 @@
13.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15.\" 15.\"
16.Dd $Mdocdate: August 29 2023 $ 16.Dd $Mdocdate: June 8 2025 $
17.Dt ECDH_COMPUTE_KEY 3 17.Dt ECDH_COMPUTE_KEY 3
18.Os 18.Os
19.Sh NAME 19.Sh NAME
@@ -21,6 +21,7 @@
21.Nm ECDH_size 21.Nm ECDH_size
22.Nd Elliptic Curve Diffie-Hellman key exchange 22.Nd Elliptic Curve Diffie-Hellman key exchange
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
24.In openssl/ec.h 25.In openssl/ec.h
25.Ft int 26.Ft int
26.Fo ECDH_compute_key 27.Fo ECDH_compute_key
@@ -74,7 +75,7 @@ returns the number of bytes needed to store an affine coordinate.
74.Sh SEE ALSO 75.Sh SEE ALSO
75.Xr DH_generate_key 3 , 76.Xr DH_generate_key 3 ,
76.Xr DH_size 3 , 77.Xr DH_size 3 ,
77.Xr EC_GROUP_new 3 , 78.Xr EC_GROUP_new_by_curve_name 3 ,
78.Xr EC_KEY_new 3 , 79.Xr EC_KEY_new 3 ,
79.Xr EC_POINT_new 3 , 80.Xr EC_POINT_new 3 ,
80.Xr X25519 3 81.Xr X25519 3
diff --git a/src/lib/libcrypto/man/ECDSA_SIG_new.3 b/src/lib/libcrypto/man/ECDSA_SIG_new.3
index 2b72e6f1b9..4554af035c 100644
--- a/src/lib/libcrypto/man/ECDSA_SIG_new.3
+++ b/src/lib/libcrypto/man/ECDSA_SIG_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ECDSA_SIG_new.3,v 1.21 2024/11/15 20:14:58 tb Exp $ 1.\" $OpenBSD: ECDSA_SIG_new.3,v 1.24 2025/06/13 18:34:00 schwarze Exp $
2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
3.\" selective merge up to: OpenSSL da4ea0cf Aug 5 16:13:24 2019 +0100 3.\" selective merge up to: OpenSSL da4ea0cf Aug 5 16:13:24 2019 +0100
4.\" 4.\"
@@ -50,7 +50,7 @@
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\" 52.\"
53.Dd $Mdocdate: November 15 2024 $ 53.Dd $Mdocdate: June 13 2025 $
54.Dt ECDSA_SIG_NEW 3 54.Dt ECDSA_SIG_NEW 3
55.Os 55.Os
56.Sh NAME 56.Sh NAME
@@ -69,8 +69,9 @@
69.Nm ECDSA_do_verify 69.Nm ECDSA_do_verify
70.Nd Elliptic Curve Digital Signature Algorithm 70.Nd Elliptic Curve Digital Signature Algorithm
71.Sh SYNOPSIS 71.Sh SYNOPSIS
72.Lb libcrypto
72.In openssl/ec.h 73.In openssl/ec.h
73.Ft ECDSA_SIG* 74.Ft ECDSA_SIG *
74.Fo ECDSA_SIG_new 75.Fo ECDSA_SIG_new
75.Fa void 76.Fa void
76.Fc 77.Fc
@@ -84,11 +85,11 @@
84.Fa "const BIGNUM **r" 85.Fa "const BIGNUM **r"
85.Fa "const BIGNUM **s" 86.Fa "const BIGNUM **s"
86.Fc 87.Fc
87.Ft "const BIGNUM *" 88.Ft const BIGNUM *
88.Fo ECDSA_SIG_get0_r 89.Fo ECDSA_SIG_get0_r
89.Fa "const ECDSA_SIG *sig" 90.Fa "const ECDSA_SIG *sig"
90.Fc 91.Fc
91.Ft "const BIGNUM *" 92.Ft const BIGNUM *
92.Fo ECDSA_SIG_get0_s 93.Fo ECDSA_SIG_get0_s
93.Fa "const ECDSA_SIG *sig" 94.Fa "const ECDSA_SIG *sig"
94.Fc 95.Fc
@@ -103,7 +104,7 @@
103.Fa "const ECDSA_SIG *sig_in" 104.Fa "const ECDSA_SIG *sig_in"
104.Fa "unsigned char **der_out" 105.Fa "unsigned char **der_out"
105.Fc 106.Fc
106.Ft ECDSA_SIG* 107.Ft ECDSA_SIG *
107.Fo d2i_ECDSA_SIG 108.Fo d2i_ECDSA_SIG
108.Fa "ECDSA_SIG **sig_out" 109.Fa "ECDSA_SIG **sig_out"
109.Fa "const unsigned char **der_in" 110.Fa "const unsigned char **der_in"
@@ -131,7 +132,7 @@
131.Fa "int siglen" 132.Fa "int siglen"
132.Fa "EC_KEY *eckey" 133.Fa "EC_KEY *eckey"
133.Fc 134.Fc
134.Ft ECDSA_SIG* 135.Ft ECDSA_SIG *
135.Fo ECDSA_do_sign 136.Fo ECDSA_do_sign
136.Fa "const unsigned char *dgst" 137.Fa "const unsigned char *dgst"
137.Fa "int dgst_len" 138.Fa "int dgst_len"
@@ -413,7 +414,7 @@ if (ret == -1) {
413.Xr crypto 3 , 414.Xr crypto 3 ,
414.Xr d2i_ECPKParameters 3 , 415.Xr d2i_ECPKParameters 3 ,
415.Xr DSA_new 3 , 416.Xr DSA_new 3 ,
416.Xr EC_GROUP_new 3 , 417.Xr EC_GROUP_new_by_curve_name 3 ,
417.Xr EC_KEY_METHOD_new 3 , 418.Xr EC_KEY_METHOD_new 3 ,
418.Xr EC_KEY_new 3 , 419.Xr EC_KEY_new 3 ,
419.Xr EC_KEY_set_ex_data 3 , 420.Xr EC_KEY_set_ex_data 3 ,
diff --git a/src/lib/libcrypto/man/EC_GROUP_check.3 b/src/lib/libcrypto/man/EC_GROUP_check.3
new file mode 100644
index 0000000000..146c3d255d
--- /dev/null
+++ b/src/lib/libcrypto/man/EC_GROUP_check.3
@@ -0,0 +1,160 @@
1.\" $OpenBSD: EC_GROUP_check.3,v 1.6 2025/07/04 05:16:56 jsg Exp $
2.\"
3.\" Copyright (c) 2025 Theo Buehler <tb@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: July 4 2025 $
18.Dt EC_GROUP_CHECK 3
19.Os
20.Sh NAME
21.Nm EC_GROUP_check_discriminant ,
22.Nm EC_GROUP_check
23.Nd partially check validity of
24.Vt EC_GROUP
25objects
26.Sh SYNOPSIS
27.Lb libcrypto
28.In openssl/bn.h
29.In openssl/ec.h
30.Pp
31Deprecated:
32.Pp
33.Ft int
34.Fo EC_GROUP_check_discriminant
35.Fa "const EC_GROUP *group"
36.Fa "BN_CTX *ctx"
37.Fc
38.Ft int
39.Fo EC_GROUP_check
40.Fa "const EC_GROUP *group"
41.Fa "BN_CTX *ctx"
42.Fc
43.Sh DESCRIPTION
44These functions are deprecated.
45Only standardized curves built into the library should be used, see
46.Xr EC_GROUP_new_by_curve_name 3 .
47Builtin curves went through far more thorough checking than
48the minimal, incomplete tests performed by these functions.
49.Pp
50These functions have an optional
51.Fa ctx
52argument which is used to avoid the cost of repeated allocation of
53auxiliary
54.Vt BIGNUM
55objects.
56.Pp
57.Fn EC_GROUP_check_discriminant
58can be called after
59.Xr EC_GROUP_new_curve_GFp 3
60to verify that
61.Fa group Ns 's
62parameters have non-zero discriminant 4a^3 + 27b^2 modulo p.
63Assuming that
64.Fa p
65is a prime number larger than three
66this implies that the Weierstrass equation defines an elliptic curve.
67.Pp
68.Fn EC_GROUP_check
69partially verifies that
70.Fa group
71represents an elliptic curve and that
72.Fa generator
73is a point on the curve whose order divides
74.Fa order .
75It checks with
76.Fn EC_GROUP_check_discriminant
77that the discriminant is non-zero
78and then verifies that that
79.Fa order
80is non-zero and that the product
81.Fa generator No * Fa order
82is the point at infinity.
83This implies that the
84.Fa order
85set on
86.Fa group
87is an integer multiple of the
88.Fa generator Ns 's
89order.
90The verification that
91.Fa p
92is a prime
93and that
94.Fa order
95is equal to the
96.Fa generator Ns 's
97order are skipped because they are too expensive.
98.Sh RETURN VALUES
99.Fn EC_GROUP_check_discriminant
100returns 1 on success and 0 on failure.
101Failure modes include that the discriminant is zero modulo
102.Fa p
103and memory allocation failure.
104.Pp
105.Fn EC_GROUP_check
106returns 1 on success and 0 on failure.
107.Sh ERRORS
108Diagnostics for
109.Fn EC_GROUP_check
110that can be retrieved with
111.Xr ERR_get_error 3 ,
112.Xr ERR_GET_REASON 3 ,
113and
114.Xr ERR_reason_error_string 3
115include:
116.Bl -tag -width Ds
117.It Dv EC_R_DISCRIMINANT_IS_ZERO Qq "discriminant is zero"
118.Fn EC_GROUP_check_discriminant
119failed because the discriminant is zero or for some other reason.
120.It Dv EC_R_UNDEFINED_GENERATOR Qq "undefined generator"
121no generator is set on
122.Fa group ,
123for example because a call to
124.Xr EC_GROUP_set_generator 3
125is missing.
126.It Dv EC_R_POINT_IS_NOT_ON_CURVE Qq "point is not on curve"
127a generator is set, but it is not a point on the curve represented by
128.Fa group .
129.It Dv EC_R_UNDEFINED_ORDER Qq "undefined order"
130the
131.Fa order
132set on
133.Fa group
134is zero.
135.It Dv EC_R_INVALID_GROUP_ORDER Qq "invalid group order"
136.Fa generator No * Fa order
137is not the point at infinity.
138.El
139.Sh SEE ALSO
140.Xr BN_CTX_new 3 ,
141.Xr BN_is_zero 3 ,
142.Xr crypto 3 ,
143.Xr d2i_ECPKParameters 3 ,
144.Xr EC_GROUP_get_curve_name 3 ,
145.Xr EC_GROUP_new_by_curve_name 3 ,
146.Xr EC_GROUP_new_curve_GFp 3 ,
147.Xr EC_KEY_METHOD_new 3 ,
148.Xr EC_KEY_new 3 ,
149.Xr EC_POINT_add 3 ,
150.Xr EC_POINT_get_affine_coordinates 3 ,
151.Xr EC_POINT_new 3 ,
152.Xr EC_POINT_point2oct 3 ,
153.Xr ECDH_compute_key 3 ,
154.Xr ECDSA_SIG_new 3
155.Sh HISTORY
156.Fn EC_GROUP_check
157and
158.Fn EC_GROUP_check_discriminant
159first appeared in OpenSSL 0.9.8 and have been available since
160.Ox 4.5 .
diff --git a/src/lib/libcrypto/man/EC_GROUP_copy.3 b/src/lib/libcrypto/man/EC_GROUP_copy.3
deleted file mode 100644
index 2e5e798236..0000000000
--- a/src/lib/libcrypto/man/EC_GROUP_copy.3
+++ /dev/null
@@ -1,492 +0,0 @@
1.\" $OpenBSD: EC_GROUP_copy.3,v 1.16 2025/03/08 16:40:59 tb Exp $
2.\" full merge up to: OpenSSL d900a015 Oct 8 14:40:42 2015 +0200
3.\" selective merge up to: OpenSSL 24c23e1f Aug 22 10:51:25 2019 +0530
4.\"
5.\" This file was written by Matt Caswell <matt@openssl.org>,
6.\" Dr. Stephen Henson <steve@openssl.org>,
7.\" and Jayaram X Matta <jayaramx.matta@intel.com>.
8.\" Copyright (c) 2013, 2015, 2019 The OpenSSL Project. All rights reserved.
9.\"
10.\" Redistribution and use in source and binary forms, with or without
11.\" modification, are permitted provided that the following conditions
12.\" are met:
13.\"
14.\" 1. Redistributions of source code must retain the above copyright
15.\" notice, this list of conditions and the following disclaimer.
16.\"
17.\" 2. Redistributions in binary form must reproduce the above copyright
18.\" notice, this list of conditions and the following disclaimer in
19.\" the documentation and/or other materials provided with the
20.\" distribution.
21.\"
22.\" 3. All advertising materials mentioning features or use of this
23.\" software must display the following acknowledgment:
24.\" "This product includes software developed by the OpenSSL Project
25.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
26.\"
27.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
28.\" endorse or promote products derived from this software without
29.\" prior written permission. For written permission, please contact
30.\" openssl-core@openssl.org.
31.\"
32.\" 5. Products derived from this software may not be called "OpenSSL"
33.\" nor may "OpenSSL" appear in their names without prior written
34.\" permission of the OpenSSL Project.
35.\"
36.\" 6. Redistributions of any form whatsoever must retain the following
37.\" acknowledgment:
38.\" "This product includes software developed by the OpenSSL Project
39.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
40.\"
41.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
42.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
44.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
45.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
46.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
47.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
48.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
49.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
50.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
51.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
52.\" OF THE POSSIBILITY OF SUCH DAMAGE.
53.\"
54.Dd $Mdocdate: March 8 2025 $
55.Dt EC_GROUP_COPY 3
56.Os
57.Sh NAME
58.Nm EC_GROUP_copy ,
59.Nm EC_GROUP_dup ,
60.Nm EC_GROUP_set_generator ,
61.Nm EC_GROUP_get0_generator ,
62.Nm EC_GROUP_get_order ,
63.Nm EC_GROUP_order_bits ,
64.Nm EC_GROUP_get_cofactor ,
65.Nm EC_GROUP_set_curve_name ,
66.Nm EC_GROUP_get_curve_name ,
67.Nm EC_GROUP_set_asn1_flag ,
68.Nm EC_GROUP_get_asn1_flag ,
69.Nm EC_GROUP_set_point_conversion_form ,
70.Nm EC_GROUP_get_point_conversion_form ,
71.Nm EC_GROUP_get0_seed ,
72.Nm EC_GROUP_get_seed_len ,
73.Nm EC_GROUP_set_seed ,
74.Nm EC_GROUP_get_degree ,
75.Nm EC_GROUP_check ,
76.Nm EC_GROUP_check_discriminant ,
77.Nm EC_GROUP_cmp ,
78.Nm EC_GROUP_get_basis_type
79.Nd manipulate EC_GROUP objects
80.Sh SYNOPSIS
81.In openssl/ec.h
82.In openssl/bn.h
83.Ft int
84.Fo EC_GROUP_copy
85.Fa "EC_GROUP *dst"
86.Fa "const EC_GROUP *src"
87.Fc
88.Ft EC_GROUP *
89.Fo EC_GROUP_dup
90.Fa "const EC_GROUP *src"
91.Fc
92.Ft int
93.Fo EC_GROUP_set_generator
94.Fa "EC_GROUP *group"
95.Fa "const EC_POINT *generator"
96.Fa "const BIGNUM *order"
97.Fa "const BIGNUM *cofactor"
98.Fc
99.Ft const EC_POINT *
100.Fo EC_GROUP_get0_generator
101.Fa "const EC_GROUP *group"
102.Fc
103.Ft int
104.Fo EC_GROUP_get_order
105.Fa "const EC_GROUP *group"
106.Fa "BIGNUM *order"
107.Fa "BN_CTX *ctx"
108.Fc
109.Ft int
110.Fo EC_GROUP_order_bits
111.Fa "const EC_GROUP *group"
112.Fc
113.Ft int
114.Fo EC_GROUP_get_cofactor
115.Fa "const EC_GROUP *group"
116.Fa "BIGNUM *cofactor"
117.Fa "BN_CTX *ctx"
118.Fc
119.Ft void
120.Fo EC_GROUP_set_curve_name
121.Fa "EC_GROUP *group"
122.Fa "int nid"
123.Fc
124.Ft int
125.Fo EC_GROUP_get_curve_name
126.Fa "const EC_GROUP *group"
127.Fc
128.Ft void
129.Fo EC_GROUP_set_asn1_flag
130.Fa "EC_GROUP *group"
131.Fa "int flag"
132.Fc
133.Ft int
134.Fo EC_GROUP_get_asn1_flag
135.Fa "const EC_GROUP *group"
136.Fc
137.Ft void
138.Fo EC_GROUP_set_point_conversion_form
139.Fa "EC_GROUP *group"
140.Fa "point_conversion_form_t form"
141.Fc
142.Ft point_conversion_form_t
143.Fo EC_GROUP_get_point_conversion_form
144.Fa "const EC_GROUP *"
145.Fc
146.Ft unsigned char *
147.Fo EC_GROUP_get0_seed
148.Fa "const EC_GROUP *x"
149.Fc
150.Ft size_t
151.Fo EC_GROUP_get_seed_len
152.Fa "const EC_GROUP *"
153.Fc
154.Ft size_t
155.Fo EC_GROUP_set_seed
156.Fa "EC_GROUP *"
157.Fa "const unsigned char *"
158.Fa "size_t len"
159.Fc
160.Ft int
161.Fo EC_GROUP_get_degree
162.Fa "const EC_GROUP *group"
163.Fc
164.Ft int
165.Fo EC_GROUP_check
166.Fa "const EC_GROUP *group"
167.Fa "BN_CTX *ctx"
168.Fc
169.Ft int
170.Fo EC_GROUP_check_discriminant
171.Fa "const EC_GROUP *group"
172.Fa "BN_CTX *ctx"
173.Fc
174.Ft int
175.Fo EC_GROUP_cmp
176.Fa "const EC_GROUP *a"
177.Fa "const EC_GROUP *b"
178.Fa "BN_CTX *ctx"
179.Fc
180.Ft int
181.Fo EC_GROUP_get_basis_type
182.Fa "const EC_GROUP *"
183.Fc
184.Sh DESCRIPTION
185These functions operate on
186.Vt EC_GROUP
187objects created by the functions described in
188.Xr EC_GROUP_new 3 .
189.Pp
190.Fn EC_GROUP_copy
191copies the curve
192.Fa src
193into
194.Fa dst .
195Both
196.Fa src
197and
198.Fa dst
199must use the same
200.Vt EC_METHOD .
201.Pp
202.Fn EC_GROUP_dup
203creates a new
204.Vt EC_GROUP
205object and copies the content from
206.Fa src
207to the newly created
208.Vt EC_GROUP
209object.
210.Pp
211.Fn EC_GROUP_set_generator
212sets curve parameters that must be agreed by all participants using
213the curve.
214These parameters include the
215.Fa generator ,
216the
217.Fa order
218and the
219.Fa cofactor .
220The
221.Fa generator
222is a well defined point on the curve chosen for cryptographic
223operations.
224Integers used for point multiplications will be between 0 and
225.Fa order No - 1 .
226The
227.Fa order
228multiplied by the
229.Fa cofactor
230gives the number of points on the curve.
231.Pp
232.Fn EC_GROUP_get0_generator
233returns the generator for the identified
234.Fa group .
235.Pp
236.Fn EC_GROUP_get_order
237retrieves the order of the
238.Fa group
239and copies its value into
240.Fa order .
241It fails if the order of the
242.Fa group
243is not set or set to zero.
244.Pp
245.Fn EC_GROUP_get_cofactor
246retrieves the cofactor of the
247.Fa group
248and copies its value into
249.Fa cofactor .
250It fails if the cofactor of the
251.Fa group
252is not set or set to zero.
253.Pp
254The functions
255.Fn EC_GROUP_set_curve_name
256and
257.Fn EC_GROUP_get_curve_name
258set and get the NID for the curve, respectively (see
259.Xr EC_GROUP_new 3 ) .
260If a curve does not have a NID associated with it, then
261.Fn EC_GROUP_get_curve_name
262will return
263.Dv NID_undef .
264.Pp
265The asn1_flag value is used to determine whether the curve encoding
266uses explicit parameters or a named curve using an ASN.1 OID:
267many applications only support the latter form.
268If asn1_flag is the default value
269.Dv OPENSSL_EC_NAMED_CURVE ,
270then the named curve form is used and the parameters must have a
271corresponding named curve NID set.
272If asn1_flags is
273.Dv OPENSSL_EC_EXPLICIT_CURVE ,
274the parameters are explicitly encoded.
275The functions
276.Fn EC_GROUP_get_asn1_flag
277and
278.Fn EC_GROUP_set_asn1_flag
279get and set the status of the asn1_flag for the curve.
280.Pp
281The point_conversion_form for a curve controls how
282.Vt EC_POINT
283data is encoded as ASN.1 as defined in X9.62 (ECDSA).
284.Vt point_conversion_form_t
285is an enum defined as follows:
286.Bd -literal
287typedef enum {
288 /** the point is encoded as z||x, where the octet z specifies
289 * which solution of the quadratic equation y is */
290 POINT_CONVERSION_COMPRESSED = 2,
291 /** the point is encoded as z||x||y, where z is the octet 0x04 */
292 POINT_CONVERSION_UNCOMPRESSED = 4,
293 /** the point is encoded as z||x||y, where the octet z specifies
294 * which solution of the quadratic equation y is */
295 POINT_CONVERSION_HYBRID = 6
296} point_conversion_form_t;
297.Ed
298.Pp
299For
300.Dv POINT_CONVERSION_UNCOMPRESSED
301the point is encoded as an octet signifying the UNCOMPRESSED form
302has been used followed by the octets for x, followed by the octets
303for y.
304.Pp
305For any given x coordinate for a point on a curve it is possible to
306derive two possible y values.
307For
308.Dv POINT_CONVERSION_COMPRESSED
309the point is encoded as an octet signifying that the COMPRESSED
310form has been used AND which of the two possible solutions for y
311has been used, followed by the octets for x.
312.Pp
313For
314.Dv POINT_CONVERSION_HYBRID
315the point is encoded as an octet signifying the HYBRID form has
316been used AND which of the two possible solutions for y has been
317used, followed by the octets for x, followed by the octets for y.
318.Pp
319The functions
320.Fn EC_GROUP_set_point_conversion_form
321and
322.Fn EC_GROUP_get_point_conversion_form
323set and get the point_conversion_form for the curve, respectively.
324.Pp
325ANSI X9.62 (ECDSA standard) defines a method of generating the curve
326parameter b from a random number.
327This provides advantages in that a parameter obtained in this way is
328highly unlikely to be susceptible to special purpose attacks, or have
329any trapdoors in it.
330If the seed is present for a curve then the b parameter was generated in
331a verifiable fashion using that seed.
332The OpenSSL EC library does not use this seed value but does enable you
333to inspect it using
334.Fn EC_GROUP_get0_seed .
335This returns a pointer to a memory block containing the seed that was
336used.
337The length of the memory block can be obtained using
338.Fn EC_GROUP_get_seed_len .
339A number of the builtin curves within the library provide seed values
340that can be obtained.
341It is also possible to set a custom seed using
342.Fn EC_GROUP_set_seed
343and passing a pointer to a memory block, along with the length of
344the seed.
345Again, the EC library will not use this seed value, although it will be
346preserved in any ASN.1 based communications.
347.Pp
348.Fn EC_GROUP_get_degree
349gets the degree of the field.
350For Fp fields this will be the number of bits in p.
351For F2^m fields this will be the value m.
352.Pp
353The function
354.Fn EC_GROUP_check_discriminant
355calculates the discriminant for the curve and verifies that it is
356valid.
357For a curve defined over Fp the discriminant is given by the formula
3584*a^3 + 27*b^2 whilst for F2^m curves the discriminant is simply b.
359In either case for the curve to be valid the discriminant must be
360non-zero.
361.Pp
362The function
363.Fn EC_GROUP_check
364performs a number of checks on a curve to verify that it is valid.
365Checks performed include verifying that the discriminant is non-zero;
366that a generator has been defined; that the generator is on the curve
367and has the correct order.
368.Pp
369.Fn EC_GROUP_cmp
370compares
371.Fa a
372and
373.Fa b
374to determine whether they represent the same curve or not.
375.Pp
376.Fn EC_GROUP_get_basis_type
377always returns 0 and is only provided for compatibility.
378.Sh RETURN VALUES
379The following functions return 1 on success or 0 on error:
380.Fn EC_GROUP_copy ,
381.Fn EC_GROUP_set_generator ,
382.Fn EC_GROUP_check ,
383and
384.Fn EC_GROUP_check_discriminant .
385.Pp
386.Fn EC_GROUP_dup
387returns a pointer to the duplicated curve or
388.Dv NULL
389on error.
390.Pp
391.Fn EC_GROUP_get0_generator
392returns the generator for the given curve or
393.Dv NULL
394on error.
395.Pp
396.Fn EC_GROUP_get_order
397returns 0 if the order is not set or set to zero for the
398.Fa group
399or if copying into
400.Fa order
401fails, or 1 otherwise.
402.Pp
403.Fn EC_GROUP_order_bits
404returns the number of bits in the group order.
405.Pp
406.Fn EC_GROUP_get_cofactor
407returns 0 if the cofactor is not set or set to zero for the
408.Fa group
409or if copying into
410.Fa cofactor
411fails, or 1 otherwise.
412.Pp
413.Fn EC_GROUP_get_curve_name
414returns the curve name (NID) for the
415.Fa group
416or
417.Dv NID_undef
418if no curve name is associated.
419.Pp
420.Fn EC_GROUP_get_asn1_flag
421returns the ASN.1 flag for the specified
422.Fa group .
423.Pp
424.Fn EC_GROUP_get_point_conversion_form
425returns the point_conversion_form for the
426.Fa group .
427.Pp
428.Fn EC_GROUP_get_degree
429returns the degree for the
430.Fa group
431or 0 if the operation is not supported
432by the underlying group implementation.
433.Pp
434.Fn EC_GROUP_get0_seed
435returns a pointer to the seed that was used to generate the parameter
436b, or
437.Dv NULL
438if the seed is not specified.
439.Fn EC_GROUP_get_seed_len
440returns the length of the seed or 0 if the seed is not specified.
441.Pp
442.Fn EC_GROUP_set_seed
443returns the length of the seed that has been set.
444If the supplied seed is
445.Dv NULL
446or the supplied seed length is 0, the return value will be 1.
447On error 0 is returned.
448.Pp
449.Fn EC_GROUP_cmp
450returns 0 if the curves are equal, 1 if they are not equal,
451or -1 on error.
452.Pp
453.Fn EC_GROUP_get_basis_type
454always returns 0.
455.Sh SEE ALSO
456.Xr d2i_ECPKParameters 3 ,
457.Xr EC_GROUP_new 3 ,
458.Xr EC_KEY_new 3 ,
459.Xr EC_POINT_add 3 ,
460.Xr EC_POINT_new 3
461.Sh HISTORY
462.Fn EC_GROUP_copy ,
463.Fn EC_GROUP_set_generator ,
464.Fn EC_GROUP_get0_generator ,
465.Fn EC_GROUP_get_order ,
466and
467.Fn EC_GROUP_get_cofactor
468first appeared in OpenSSL 0.9.7 and have been available since
469.Ox 3.2 .
470.Pp
471.Fn EC_GROUP_dup ,
472.Fn EC_GROUP_set_curve_name ,
473.Fn EC_GROUP_get_curve_name ,
474.Fn EC_GROUP_set_asn1_flag ,
475.Fn EC_GROUP_get_asn1_flag ,
476.Fn EC_GROUP_set_point_conversion_form ,
477.Fn EC_GROUP_get_point_conversion_form ,
478.Fn EC_GROUP_get0_seed ,
479.Fn EC_GROUP_get_seed_len ,
480.Fn EC_GROUP_set_seed ,
481.Fn EC_GROUP_get_degree ,
482.Fn EC_GROUP_check ,
483.Fn EC_GROUP_check_discriminant ,
484.Fn EC_GROUP_cmp ,
485and
486.Fn EC_GROUP_get_basis_type
487first appeared in OpenSSL 0.9.8 and have been available since
488.Ox 4.5 .
489.Pp
490.Fn EC_GROUP_order_bits
491first appeared in OpenSSL 1.1.0 and has been available since
492.Ox 7.0 .
diff --git a/src/lib/libcrypto/man/EC_GROUP_get_curve_name.3 b/src/lib/libcrypto/man/EC_GROUP_get_curve_name.3
new file mode 100644
index 0000000000..940aa3c1a1
--- /dev/null
+++ b/src/lib/libcrypto/man/EC_GROUP_get_curve_name.3
@@ -0,0 +1,266 @@
1.\" $OpenBSD: EC_GROUP_get_curve_name.3,v 1.4 2025/06/13 18:34:00 schwarze Exp $
2.\"
3.\" Copyright (c) 2025 Theo Buehler <tb@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: June 13 2025 $
18.Dt EC_GROUP_GET_CURVE_NAME 3
19.Os
20.Sh NAME
21.Nm EC_GROUP_get_curve_name ,
22.Nm EC_GROUP_set_curve_name ,
23.Nm EC_GROUP_get_asn1_flag ,
24.Nm EC_GROUP_set_asn1_flag ,
25.Nm EC_GROUP_get0_seed ,
26.Nm EC_GROUP_get_seed_len ,
27.Nm EC_GROUP_set_seed ,
28.Nm EC_GROUP_get_point_conversion_form ,
29.Nm EC_GROUP_set_point_conversion_form ,
30.Nm EC_GROUP_get_basis_type
31.Nd configure and inspect details of the ASN.1 encoding of
32.Vt EC_GROUP
33and related objects
34.Sh SYNOPSIS
35.Lb libcrypto
36.In openssl/ec.h
37.Ft int
38.Fo EC_GROUP_get_curve_name
39.Fa "const EC_GROUP *group"
40.Fc
41.Ft void
42.Fo EC_GROUP_set_curve_name
43.Fa "EC_GROUP *group"
44.Fa "int nid"
45.Fc
46.Ft int
47.Fo EC_GROUP_get_asn1_flag
48.Fa "const EC_GROUP *group"
49.Fc
50.Ft void
51.Fo EC_GROUP_set_asn1_flag
52.Fa "EC_GROUP *group"
53.Fa "int flag"
54.Fc
55.Ft unsigned char *
56.Fo EC_GROUP_get0_seed
57.Fa "const EC_GROUP *group"
58.Fc
59.Ft size_t
60.Fo EC_GROUP_get_seed_len
61.Fa "const EC_GROUP *group"
62.Fc
63.Ft size_t
64.Fo EC_GROUP_set_seed
65.Fa "EC_GROUP *group"
66.Fa "const unsigned char *seed"
67.Fa "size_t len"
68.Fc
69.Bd -literal
70typedef enum {
71 POINT_CONVERSION_COMPRESSED = 2,
72 POINT_CONVERSION_UNCOMPRESSED = 4,
73 POINT_CONVERSION_HYBRID = 6
74} point_conversion_form_t;
75
76.Ed
77.Ft point_conversion_form_t
78.Fo EC_GROUP_get_point_conversion_form
79.Fa "const EC_GROUP *group"
80.Fc
81.Ft void
82.Fo EC_GROUP_set_point_conversion_form
83.Fa "EC_GROUP *group"
84.Fa "point_conversion_form_t form"
85.Fc
86.Pp
87Deprecated:
88.Pp
89.Ft int
90.Fo EC_GROUP_get_basis_type
91.Fa "const EC_GROUP *group"
92.Fc
93.Sh DESCRIPTION
94The functions in this manual affect or allow the inspection of
95the details of the ASN.1 encoding produced by the
96.Xr i2d_ECPKParameters 3
97family of functions.
98Modern applications use named curves and uncompressed point encoding,
99which are the default for
100.Xr EC_GROUP_new_by_curve_name 3 .
101.Pp
102In this library, Elliptic curve parameters are either encoded as a
103.Em named curve ,
104using an ASN.1 Object Identifier (OID) to refer to
105standardized parameters that need to be built into the library,
106or using
107.Em explicit curve parameters
108where the field, the curve equation, the base point's coordinates
109and other data are encoded explicitly.
110The
111.Em implicitly CA
112variant is not supported.
113.Pp
114.Fn EC_GROUP_get_curve_name
115gets the Numerical Identifier (NID) representation of the
116ASN.1 Object Identifier used for the named curve encoding of
117.Fa group .
118.Fn EC_GROUP_set_curve_name
119sets it to
120.Fa nid .
121.Pp
122.Fn EC_GROUP_get_asn1_flag
123retrieves the value of the
124.Fa asn1_flag
125member of
126.Fa group .
127If the bit corresponding to
128.Dv OPENSSL_EC_NAMED_CURVE
129is set, named curve encoding is used for
130.Fa group ,
131otherwise explicit encoding is used.
132.Fn EC_GROUP_set_asn1_flag
133sets the
134.Fa asn1_flag
135member of group to
136.Fa flag ,
137which should be either
138.Dv OPENSSL_EC_NAMED_CURVE
139to use named curve encoding or
140.Dv OPENSSL_EC_EXPLICIT_CURVE
141to use explicit encoding.
142.Pp
143The ASN.1 encoding of explicit curve parameters includes
144an optional seed value for parameters generated verifiably at random.
145If a seed value is set on
146.Fa group ,
147.Fn EC_GROUP_get0_seed
148returns a pointer to the internal byte string whose length is returned by
149.Fn EC_GROUP_get_seed_len .
150.Pp
151.Fn EC_GROUP_set_seed
152first clears any seed and length already stored in
153.Fa group .
154If
155.Fa seed
156is not
157.Dv NULL
158and
159.Fa len
160is not zero, it stores a copy of them in
161.Fa group .
162The
163.Fa seed
164should be a random byte string of
165.Fa len
166at least 20 bytes.
167The seed can be unset by passing
168.Dv NULL
169as a
170.Fa seed
171and a
172.Fa len
173of zero.
174The library does not perform any computation or validation with this seed,
175it only includes it in its ASN.1 encoded parameters,
176whether it contains a sensible value or not.
177.Pp
178Points on an elliptic curve, such as the generator or a public key,
179can be encoded in compressed form, uncompressed form,
180or in a hybrid form encompassing both, see
181.Xr EC_POINT_point2oct 3 .
182.Fn EC_GROUP_get_point_conversion_form
183retrieves the encoding used for points on
184.Fa group
185and
186.Fn EC_GROUP_set_point_conversion_form
187sets it to
188.Fa form .
189.Pp
190The deprecated
191.Fn EC_GROUP_get_basis_type
192only makes sense for curves over binary fields.
193It is provided for compatibility only.
194.Sh RETURN VALUES
195.Fn EC_GROUP_get_curve_name
196returns the NID to be used for named curve encoding of
197.Fa group
198or
199.Dv NID_undef
200if no NID is set.
201.Pp
202.Fn EC_GROUP_get_asn1_flag
203returns the value most recently set by
204.Fn EC_GROUP_set_asn1_flag
205on
206.Fa group .
207.Pp
208.Fn EC_GROUP_get0_seed
209returns an internal pointer to the
210.Fa seed
211on
212.Fa group
213or
214.Dv NULL
215if none is set.
216.Pp
217.Fn EC_GROUP_get_seed_len
218returns the byte length of the seed set on
219.Fa group
220or zero if none is set.
221.Pp
222.Fn EC_GROUP_set_seed
223returns 0 on memory allocation failure.
224It returns
225.Fa len
226on success unless
227.Fa seed
228is
229.Dv NULL
230or
231.Fa len
232is zero, in which case it returns 1.
233.Pp
234.Fn EC_GROUP_get_point_conversion_form
235returns the point conversion form last set by
236.Fn EC_GROUP_set_point_conversion_form
237on
238.Fa group .
239.Pp
240.Fn EC_GROUP_get_basis_type
241always returns
242.Dv NID_undef .
243.Sh SEE ALSO
244.Xr crypto 3 ,
245.Xr d2i_ECPKParameters 3 ,
246.Xr EC_GROUP_check 3 ,
247.Xr EC_GROUP_new_by_curve_name 3 ,
248.Xr EC_GROUP_new_curve_GFp 3 ,
249.Xr EC_KEY_METHOD_new 3 ,
250.Xr EC_KEY_new 3 ,
251.Xr EC_POINT_add 3 ,
252.Xr EC_POINT_get_affine_coordinates 3 ,
253.Xr EC_POINT_new 3 ,
254.Xr EC_POINT_point2oct 3 ,
255.Xr ECDH_compute_key 3 ,
256.Xr ECDSA_SIG_new 3 ,
257.Xr OBJ_obj2nid 3
258.Sh HISTORY
259These functions first appeared in OpenSSL 0.9.8 and have been available since
260.Ox 4.5 .
261.Sh BUGS
262Most of the setters cannot report errors and none of them perform proper
263input validation and accept most of the values passed in.
264This can result in invalid or nonsensical ASN.1 encoding produced by
265.Xr i2d_ECPKParameters 3
266and related functions.
diff --git a/src/lib/libcrypto/man/EC_GROUP_new.3 b/src/lib/libcrypto/man/EC_GROUP_new.3
deleted file mode 100644
index 83e3e4c870..0000000000
--- a/src/lib/libcrypto/man/EC_GROUP_new.3
+++ /dev/null
@@ -1,353 +0,0 @@
1.\" $OpenBSD: EC_GROUP_new.3,v 1.18 2025/03/08 16:38:13 tb Exp $
2.\" OpenSSL 6328d367 Sat Jul 4 21:58:30 2020 +0200
3.\"
4.\" This file was written by Matt Caswell <matt@openssl.org>.
5.\" Copyright (c) 2013 The OpenSSL Project. All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\"
11.\" 1. Redistributions of source code must retain the above copyright
12.\" notice, this list of conditions and the following disclaimer.
13.\"
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in
16.\" the documentation and/or other materials provided with the
17.\" distribution.
18.\"
19.\" 3. All advertising materials mentioning features or use of this
20.\" software must display the following acknowledgment:
21.\" "This product includes software developed by the OpenSSL Project
22.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
23.\"
24.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
25.\" endorse or promote products derived from this software without
26.\" prior written permission. For written permission, please contact
27.\" openssl-core@openssl.org.
28.\"
29.\" 5. Products derived from this software may not be called "OpenSSL"
30.\" nor may "OpenSSL" appear in their names without prior written
31.\" permission of the OpenSSL Project.
32.\"
33.\" 6. Redistributions of any form whatsoever must retain the following
34.\" acknowledgment:
35.\" "This product includes software developed by the OpenSSL Project
36.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
37.\"
38.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
39.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
41.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
42.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
47.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\"
51.Dd $Mdocdate: March 8 2025 $
52.Dt EC_GROUP_NEW 3
53.Os
54.Sh NAME
55.Nm EC_GROUP_new ,
56.Nm EC_GROUP_free ,
57.Nm EC_GROUP_clear_free ,
58.Nm EC_GROUP_new_curve_GFp ,
59.Nm EC_GROUP_new_by_curve_name ,
60.Nm EC_GROUP_set_curve ,
61.Nm EC_GROUP_get_curve ,
62.Nm EC_GROUP_set_curve_GFp ,
63.Nm EC_GROUP_get_curve_GFp ,
64.Nm EC_get_builtin_curves ,
65.Nm EC_curve_nid2nist ,
66.Nm EC_curve_nist2nid
67.Nd create and destroy EC_GROUP objects
68.Sh SYNOPSIS
69.In openssl/ec.h
70.In openssl/bn.h
71.Ft EC_GROUP *
72.Fo EC_GROUP_new
73.Fa "const EC_METHOD *meth"
74.Fc
75.Ft void
76.Fo EC_GROUP_free
77.Fa "EC_GROUP *group"
78.Fc
79.Ft void
80.Fo EC_GROUP_clear_free
81.Fa "EC_GROUP *group"
82.Fc
83.Ft EC_GROUP *
84.Fo EC_GROUP_new_curve_GFp
85.Fa "const BIGNUM *p"
86.Fa "const BIGNUM *a"
87.Fa "const BIGNUM *b"
88.Fa "BN_CTX *ctx"
89.Fc
90.Ft EC_GROUP *
91.Fo EC_GROUP_new_by_curve_name
92.Fa "int nid"
93.Fc
94.Ft int
95.Fo EC_GROUP_set_curve
96.Fa "EC_GROUP *group"
97.Fa "const BIGNUM *p"
98.Fa "const BIGNUM *a"
99.Fa "const BIGNUM *b"
100.Fa "BN_CTX *ctx"
101.Fc
102.Ft int
103.Fo EC_GROUP_get_curve
104.Fa "const EC_GROUP *group"
105.Fa "BIGNUM *p"
106.Fa "BIGNUM *a"
107.Fa "BIGNUM *b"
108.Fa "BN_CTX *ctx"
109.Fc
110.Ft int
111.Fo EC_GROUP_set_curve_GFp
112.Fa "EC_GROUP *group"
113.Fa "const BIGNUM *p"
114.Fa "const BIGNUM *a"
115.Fa "const BIGNUM *b"
116.Fa "BN_CTX *ctx"
117.Fc
118.Ft int
119.Fo EC_GROUP_get_curve_GFp
120.Fa "const EC_GROUP *group"
121.Fa "BIGNUM *p"
122.Fa "BIGNUM *a"
123.Fa "BIGNUM *b"
124.Fa "BN_CTX *ctx"
125.Fc
126.Ft size_t
127.Fo EC_get_builtin_curves
128.Fa "EC_builtin_curve *r"
129.Fa "size_t nitems"
130.Fc
131.Ft "const char *"
132.Fo EC_curve_nid2nist
133.Fa "int nid"
134.Fc
135.Ft int
136.Fo EC_curve_nist2nid
137.Fa "const char *name"
138.Fc
139.Sh DESCRIPTION
140The EC library provides functions for performing operations on
141elliptic curves in Weierstrass form.
142Such curves are defined over the prime field of order
143.Fa p
144and satisfy the Weierstrass equation with coefficients
145.Fa a
146and
147.Fa b
148.Pp
149.Dl y^2 = x^3 + ax + b
150.Pp
151An
152.Vt EC_GROUP
153structure is used to represent the definition of an elliptic curve.
154A new curve can be constructed by calling
155.Fn EC_GROUP_new ,
156using the implementation provided by
157.Fa meth .
158It is then necessary to call
159.Fn EC_GROUP_set_curve
160to set the curve parameters.
161.Pp
162.Fn EC_GROUP_set_curve
163sets the curve parameters
164.Fa p ,
165.Fa a ,
166and
167.Fa b ,
168where
169.Fa a
170and
171.Fa b
172represent the coefficients of the curve equation.
173.Pp
174.Fn EC_GROUP_set_curve_GFp
175is a deprecated synonym for
176.Fn EC_GROUP_set_curve .
177.Pp
178.Fn EC_GROUP_get_curve
179obtains the previously set curve parameters.
180.Pp
181.Fn EC_GROUP_get_curve_GFp
182is a deprecated synonym for
183.Fn EC_GROUP_get_curve .
184.Pp
185The function
186.Fn EC_GROUP_new_curve_GFp
187is a shortcut for calling
188.Fn EC_GROUP_new
189and
190.Fn EC_GROUP_set_curve .
191An appropriate default implementation method will be used.
192.Pp
193Whilst the library can be used to create any curve using the functions
194described above, there are also a number of predefined curves that are
195available.
196In order to obtain a list of all of the predefined curves, call the
197function
198.Fn EC_get_builtin_curves .
199The parameter
200.Fa r
201should be an array of
202.Vt EC_builtin_cure
203structures of size
204.Fa nitems .
205The function will populate the
206.Fa r
207array with information about the builtin curves.
208If
209.Fa nitems
210is less than the total number of curves available, then the first
211.Fa nitems
212curves will be returned.
213Otherwise the total number of curves will be provided.
214The return value is the total number of curves available (whether that
215number has been populated in
216.Fa r
217or not).
218Passing a
219.Dv NULL
220.Fa r ,
221or setting
222.Fa nitems
223to 0, will do nothing other than return the total number of curves
224available.
225The
226.Vt EC_builtin_curve
227structure is defined as follows:
228.Bd -literal
229typedef struct {
230 int nid;
231 const char *comment;
232} EC_builtin_curve;
233.Ed
234.Pp
235Each
236.Vt EC_builtin_curve
237item has a unique integer ID
238.Pq Fa nid
239and a human readable comment string describing the curve.
240.Pp
241In order to construct a builtin curve, use the function
242.Fn EC_GROUP_new_by_curve_name
243and provide the
244.Fa nid
245of the curve to be constructed.
246.Pp
247.Fn EC_GROUP_free
248frees the memory associated with the
249.Vt EC_GROUP .
250If
251.Fa group
252is a
253.Dv NULL
254pointer, no action occurs.
255.Pp
256.Fn EC_GROUP_clear_free
257destroys any sensitive data held within the
258.Vt EC_GROUP
259and then frees its memory.
260If
261.Fa group
262is a
263.Dv NULL
264pointer, no action occurs.
265.Pp
266Some builtin curves can be identified by their NIST name
267in addition to a numerical identifier (NID).
268.Fn EC_curve_nid2nist
269and
270.Fn EC_curve_nist2nid
271translate between the two.
272The five built-in prime curves are:
273.Pp
274.Bl -column "NIST name" NID_X9_62_prime256v1 "deprecated in SP800-186" -compact
275.It No NIST Fa name Ta Em ASN.1 NID Ta Em notes
276.It Qq P-192 Ta Dv NID_X9_62_prime192v1 Ta No deprecated in SP800-186
277.It Qq P-224 Ta Dv NID_secp224r1 Ta
278.It Qq P-256 Ta Dv NID_X9_62_prime256v1 Ta
279.It Qq P-384 Ta Dv NID_secp384r1 Ta
280.It Qq P-521 Ta Dv NID_secp521r1 Ta
281.El
282.Pp
283.Fn EC_curve_nid2nist
284and
285.Fn EC_curve_nist2nid
286also accept the ten binary curves defined in FIPS\& 186-4
287and deprecated in SP800-186,
288although they no longer correspond to builtin curves in LibreSSL.
289.Sh RETURN VALUES
290All
291.Fn EC_GROUP_new*
292functions return a pointer to the newly constructed group or
293.Dv NULL
294on error.
295.Pp
296.Fn EC_get_builtin_curves
297returns the number of builtin curves that are available.
298.Pp
299.Fn EC_curve_nid2nist
300returns a string constant containing the NIST name if
301.Fa nid
302identifies a NIST curve or
303.Dv NULL
304otherwise.
305.Pp
306.Fn EC_curve_nist2nid
307returns the NID corresponding to the NIST curve
308.Fa name ,
309or
310.Dv NID_undef .
311.Pp
312.Fn EC_GROUP_set_curve ,
313.Fn EC_GROUP_get_curve ,
314.Fn EC_GROUP_set_curve_GFp ,
315and
316.Fn EC_GROUP_get_curve_GFp
317return 1 on success or 0 on error.
318.Sh SEE ALSO
319.Xr crypto 3 ,
320.Xr d2i_ECPKParameters 3 ,
321.Xr EC_GROUP_copy 3 ,
322.Xr EC_KEY_new 3 ,
323.Xr EC_POINT_add 3 ,
324.Xr EC_POINT_new 3 ,
325.Xr ECDH_compute_key 3 ,
326.Xr ECDSA_SIG_new 3
327.Sh HISTORY
328.Fn EC_GROUP_new ,
329.Fn EC_GROUP_free ,
330.Fn EC_GROUP_clear_free ,
331.Fn EC_GROUP_new_curve_GFp ,
332.Fn EC_GROUP_set_curve_GFp ,
333and
334.Fn EC_GROUP_get_curve_GFp
335first appeared in OpenSSL 0.9.7 and have been available since
336.Ox 3.2 .
337.Pp
338.Fn EC_GROUP_new_by_curve_name
339and
340.Fn EC_get_builtin_curves
341first appeared in OpenSSL 0.9.8 and have been available since
342.Ox 4.5 .
343.Fn EC_curve_nid2nist ,
344and
345.Fn EC_curve_nist2nid
346first appeared in OpenSSL 1.1.0 and have been available since
347.Ox 5.8 .
348.Pp
349.Fn EC_GROUP_set_curve
350and
351.Fn EC_GROUP_get_curve
352first appeared in OpenSSL 1.1.1 and have been available since
353.Ox 7.0 .
diff --git a/src/lib/libcrypto/man/EC_GROUP_new_by_curve_name.3 b/src/lib/libcrypto/man/EC_GROUP_new_by_curve_name.3
new file mode 100644
index 0000000000..e05365874f
--- /dev/null
+++ b/src/lib/libcrypto/man/EC_GROUP_new_by_curve_name.3
@@ -0,0 +1,311 @@
1.\" $OpenBSD: EC_GROUP_new_by_curve_name.3,v 1.4 2025/06/13 18:34:00 schwarze Exp $
2.\"
3.\" Copyright (c) 2024, 2025 Theo Buehler <tb@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: June 13 2025 $
18.Dt EC_GROUP_NEW_BY_CURVE_NAME 3
19.Os
20.Sh NAME
21.Nm EC_GROUP_new_by_curve_name ,
22.Nm EC_GROUP_free ,
23.Nm EC_GROUP_dup ,
24.Nm EC_GROUP_cmp ,
25.Nm EC_get_builtin_curves ,
26.Nm EC_curve_nid2nist ,
27.Nm EC_curve_nist2nid
28.Nd instantiate named curves built into libcrypto
29.Sh SYNOPSIS
30.Lb libcrypto
31.In openssl/bn.h
32.In openssl/ec.h
33.In openssl/objects.h
34.Ft EC_GROUP *
35.Fo EC_GROUP_new_by_curve_name
36.Fa "int nid"
37.Fc
38.Ft void
39.Fo EC_GROUP_free
40.Fa "EC_GROUP *group"
41.Fc
42.Ft EC_GROUP *
43.Fo EC_GROUP_dup
44.Fa "const EC_GROUP *group"
45.Fc
46.Ft int
47.Fo EC_GROUP_cmp
48.Fa "const EC_GROUP *group1"
49.Fa "const EC_GROUP *group2"
50.Fa "BN_CTX *ctx"
51.Fc
52.Bd -literal
53typedef struct {
54 int nid;
55 const char *comment;
56} EC_builtin_curve;
57
58.Ed
59.Ft size_t
60.Fo EC_get_builtin_curves
61.Fa "EC_builtin_curve *curves"
62.Fa "size_t ncurves"
63.Fc
64.Ft int
65.Fo EC_curve_nist2nid
66.Fa "const char *name"
67.Fc
68.Ft const char *
69.Fo EC_curve_nid2nist
70.Fa "int nid"
71.Fc
72.Sh DESCRIPTION
73Most elliptic curves used in cryptographic protocols have a
74standardized representation as a
75.Em named curve ,
76where an ASN.1 Object Identifier (OID) is used instead of
77detailed domain parameters.
78This OID is represented internally by a Numerical Identifier (NID),
79and the parameters themselves must be built into the library.
80In the EC library the
81.Em curve name
82refers to this NID.
83.Pp
84.Fn EC_GROUP_new_by_curve_name
85returns a new
86.Vt EC_GROUP
87object representing the named curve corresponding to
88.Fa nid ,
89using the parameters built into the library.
90It is equivalent to passing the appropriate parameters to
91.Xr EC_GROUP_new_curve_GFp 3 ,
92.Xr EC_GROUP_set_curve_name 3 ,
93.Xr EC_GROUP_set_generator 3
94and
95.Xr EC_GROUP_set_seed 3 .
96.Pp
97.Fn EC_GROUP_free
98frees
99.Fa group
100and all the memory associated with it.
101If
102.Fa group
103is
104.Dv NULL ,
105no action occurs.
106.Pp
107.Fn EC_GROUP_dup
108creates a deep copy of
109.Fa group .
110.Pp
111.Fn EC_GROUP_cmp
112is intended to determine whether
113.Fa group1
114and
115.Fa group2
116represent the same elliptic curve,
117making use of the optional
118.Fa ctx .
119If the curve name is set on both curves, they are compared as integers,
120then the prime field,
121the coefficients of the Weierstrass equation,
122the generators, their order and their cofactors are compared
123using
124.Xr BN_cmp 3
125or
126.Xr EC_POINT_cmp 3 ,
127respectively.
128.Pp
129.Fn EC_get_builtin_curves
130returns the number of builtin curves.
131If
132.Fa curves
133is
134.Dv NULL
135or
136.Fa ncurves
137is zero, it performs no other action.
138Otherwise, after reducing
139.Fa ncurves
140to the number of builtin curves if necessary,
141it copies the
142.Fa nid
143and a pointer to the
144.Fa comment
145of the first
146.Fa ncurves
147built-in curves to the array of
148.Vt EC_builtin_curve
149objects pointed to by
150.Fa curves
151and leaves the remainder of the array uninitialized.
152.Pp
153Some curves can be identified by their NIST name
154in addition to the numerical identifier (NID).
155.Fn EC_curve_nist2nid
156and
157.Fn EC_curve_nid2nist
158translate between the two.
159The builtin NIST curves over a prime field are:
160.Pp
161.Bl -column "NIST name" NID_X9_62_prime256v1 "deprecated in SP800-186" -compact
162.It No NIST Fa name Ta Em ASN.1 NID Ta Em notes
163.It Qq P-224 Ta Dv NID_secp224r1 Ta
164.It Qq P-256 Ta Dv NID_X9_62_prime256v1 Ta also known as secp256r1
165.It Qq P-384 Ta Dv NID_secp384r1 Ta
166.It Qq P-521 Ta Dv NID_secp521r1 Ta
167.El
168.Pp
169.Fn EC_curve_nist2nid
170and
171.Fn EC_curve_nid2nist
172also accept the binary curves defined in FIPS\& 186-4
173and deprecated in SP800-186,
174as well as
175.Qq P-192
176and
177.Dv NID_X9_62_prime192v1 ,
178although all these no longer correspond to builtin curves in LibreSSL.
179.Sh RETURN VALUES
180.Fn EC_GROUP_new_by_curve_name
181returns a newly allocated group or
182.Dv NULL
183if there is no built-in group with NID
184.Fa nid ,
185or if memory allocation fails.
186.Pp
187.Fn EC_GROUP_dup
188returns a newly allocated group or
189.Dv NULL
190if memory allocation fails.
191.Pp
192.Fn EC_GROUP_cmp
193returns 1 if the groups are distinct, 0 if the groups are
194considered identical and \-1 on memory allocation error.
195.Pp
196.Fn EC_get_builtin_curves
197returns the number of builtin curves.
198.Pp
199.Fn EC_curve_nid2nist
200returns a string constant containing the NIST name if
201.Fa nid
202identifies a NIST curve or
203.Dv NULL
204otherwise.
205.Pp
206.Fn EC_curve_nist2nid
207returns the NID corresponding to the NIST curve
208.Fa name ,
209or
210.Dv NID_undef .
211.Sh EXAMPLES
212Print the list of builtin curves, their NIDs, their NIST name and
213a comment describing each curve:
214.Bd -literal
215#include <err.h>
216#include <stdio.h>
217#include <stdlib.h>
218#include <unistd.h>
219
220#include <openssl/ec.h>
221
222int
223main(void)
224{
225 EC_builtin_curve *curves;
226 size_t ncurves, i;
227
228 if (pledge("stdio", NULL) == \-1)
229 err(1, "pledge");
230
231 ncurves = EC_get_builtin_curves(NULL, 0);
232 if ((curves = calloc(ncurves, sizeof(*curves))) == NULL)
233 err(1, NULL);
234 (void)EC_get_builtin_curves(curves, ncurves);
235
236 printf("curve\etnid\etNIST\etcomment\en");
237 for (i = 0; i < ncurves; i++) {
238 const char *nist_name = EC_curve_nid2nist(curves[i].nid);
239
240 printf("%2zu\et%d\et%s\et%s\en", i, curves[i].nid,
241 nist_name != NULL ? nist_name : "", curves[i].comment);
242 }
243
244 free(curves);
245
246 return 0;
247}
248.Ed
249.Sh SEE ALSO
250.Xr crypto 3 ,
251.Xr d2i_ECPKParameters 3 ,
252.Xr EC_GROUP_check 3 ,
253.Xr EC_GROUP_get_curve_name 3 ,
254.Xr EC_GROUP_new_curve_GFp 3 ,
255.Xr EC_KEY_METHOD_new 3 ,
256.Xr EC_KEY_new 3 ,
257.Xr EC_POINT_add 3 ,
258.Xr EC_POINT_get_affine_coordinates 3 ,
259.Xr EC_POINT_new 3 ,
260.Xr EC_POINT_point2oct 3 ,
261.Xr ECDH_compute_key 3 ,
262.Xr ECDSA_SIG_new 3 ,
263.Xr OBJ_nid2obj 3
264.Sh STANDARDS
265.Rs
266.%T SEC 1: Elliptic Curve Cryptography, Version 2.0
267.%U https://www.secg.org/sec1-v2.pdf
268.%D May 21, 2009
269.Re
270.Pp
271.Rs
272.%T SEC 2: Recommended Elliptic Curve Domain Parameters, Version 2.0
273.%U https://www.secg.org/sec2-v2.pdf
274.%D Jan 27, 2010
275.Re
276.Sh HISTORY
277.Fn EC_GROUP_free
278first appeared in OpenSSL 0.9.7 and has been available since
279.Ox 3.2 .
280.Pp
281.Fn EC_GROUP_new_by_curve_name ,
282.Fn EC_GROUP_cmp ,
283.Fn EC_GROUP_dup ,
284and
285.Fn EC_get_builtin_curves
286first appeared in OpenSSL 0.9.8 and have been available since
287.Ox 4.5 .
288.Pp
289.Fn EC_curve_nid2nist
290and
291.Fn EC_curve_nist2nid
292first appeared in OpenSSL 1.1.0 and have been available since
293.Ox 5.8 .
294.Sh BUGS
295.Fn EC_GROUP_cmp
296compares the coefficients of the Weierstrass equation as
297integers, not as elements of the prime field.
298It also treats the generator as mandatory while it is generally
299optional in the EC library.
300Aspects of the ASN.1 encoding controlled by the functions in
301.Xr EC_GROUP_get_asn1_flag 3 ,
302in particular seed, ASN.1 flag, and point conversion form,
303are ignored in the comparison.
304Group objects may therefore compare as equal and produce
305completely different ASN.1 encodings via
306.Xr i2d_ECPKParameters 3
307and related functions.
308In fact, either of these encodings might be valid or not,
309accepted or rejected by
310.Xr d2i_ECPKParameters 3 ,
311or the encoding might fail on one or both of the group objects.
diff --git a/src/lib/libcrypto/man/EC_GROUP_new_curve_GFp.3 b/src/lib/libcrypto/man/EC_GROUP_new_curve_GFp.3
new file mode 100644
index 0000000000..038deff434
--- /dev/null
+++ b/src/lib/libcrypto/man/EC_GROUP_new_curve_GFp.3
@@ -0,0 +1,458 @@
1.\" $OpenBSD: EC_GROUP_new_curve_GFp.3,v 1.5 2025/06/13 18:34:00 schwarze Exp $
2.\"
3.\" Copyright (c) 2025 Theo Buehler <tb@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: June 13 2025 $
18.Dt EC_GROUP_NEW_CURVE_GFP 3
19.Os
20.Sh NAME
21.Nm EC_GROUP_new_curve_GFp ,
22.Nm EC_GROUP_set_curve ,
23.Nm EC_GROUP_get_curve ,
24.Nm EC_GROUP_set_generator ,
25.Nm EC_GROUP_get0_generator ,
26.Nm EC_GROUP_get_degree ,
27.Nm EC_GROUP_get_order ,
28.Nm EC_GROUP_order_bits ,
29.Nm EC_GROUP_get_cofactor ,
30.Nm EC_GROUP_clear_free ,
31.Nm EC_GROUP_set_curve_GFp ,
32.Nm EC_GROUP_get_curve_GFp
33.Nd define elliptic curves and retrieve information from them
34.Sh SYNOPSIS
35.Lb libcrypto
36.In openssl/bn.h
37.In openssl/ec.h
38.Ft EC_GROUP *
39.Fo EC_GROUP_new_curve_GFp
40.Fa "const BIGNUM *p"
41.Fa "const BIGNUM *a"
42.Fa "const BIGNUM *b"
43.Fa "BN_CTX *ctx"
44.Fc
45.Ft int
46.Fo EC_GROUP_set_curve
47.Fa "EC_GROUP *group"
48.Fa "const BIGNUM *p"
49.Fa "const BIGNUM *a"
50.Fa "const BIGNUM *b"
51.Fa "BN_CTX *ctx"
52.Fc
53.Ft int
54.Fo EC_GROUP_get_curve
55.Fa "const EC_GROUP *group"
56.Fa "BIGNUM *p"
57.Fa "BIGNUM *a"
58.Fa "BIGNUM *b"
59.Fa "BN_CTX *ctx"
60.Fc
61.Ft int
62.Fo EC_GROUP_set_generator
63.Fa "EC_GROUP *group"
64.Fa "const EC_POINT *generator"
65.Fa "const BIGNUM *order"
66.Fa "const BIGNUM *cofactor"
67.Fc
68.Ft const EC_POINT *
69.Fo EC_GROUP_get0_generator
70.Fa "const EC_GROUP *group"
71.Fc
72.Ft int
73.Fo EC_GROUP_get_degree
74.Fa "const EC_GROUP *"
75.Fc
76.Ft int
77.Fo EC_GROUP_get_order
78.Fa "const EC_GROUP *group"
79.Fa "BIGNUM *order"
80.Fa "BN_CTX *ctx"
81.Fc
82.Ft int
83.Fo EC_GROUP_order_bits
84.Fa "const EC_GROUP *group"
85.Fc
86.Ft int
87.Fo EC_GROUP_get_cofactor
88.Fa "const EC_GROUP *group"
89.Fa "BIGNUM *cofactor"
90.Fa "BN_CTX *ctx"
91.Fc
92.Pp
93Deprecated:
94.Pp
95.Ft void
96.Fo EC_GROUP_clear_free
97.Fa "EC_GROUP *group"
98.Fc
99.Ft int
100.Fo EC_GROUP_set_curve_GFp
101.Fa "EC_GROUP *group"
102.Fa "const BIGNUM *p"
103.Fa "const BIGNUM *a"
104.Fa "const BIGNUM *b"
105.Fa "BN_CTX *ctx"
106.Fc
107.Ft int
108.Fo EC_GROUP_get_curve_GFp
109.Fa "const EC_GROUP *group"
110.Fa "BIGNUM *p"
111.Fa "BIGNUM *a"
112.Fa "BIGNUM *b"
113.Fa "BN_CTX *ctx"
114.Fc
115.Sh DESCRIPTION
116With the exception of the getters
117the functions in this manual should not be used.
118Use
119.Xr EC_GROUP_new_by_curve_name 3
120instead.
121.Pp
122The EC library uses
123.Vt EC_GROUP
124objects to represent
125elliptic curves in Weierstrass form.
126These curves are defined over the prime field of order
127.Fa p
128via the Weierstrass equation
129.Pp
130.Dl y^2 = x^3 + ax + b
131.Pp
132where
133.Fa a
134and
135.Fa b
136are such that the discriminant 4a^3 - 27b^2 is non-zero.
137.Pp
138The points on an elliptic curve form a group.
139Cryptographic applications usually depend on the choice of a
140.Fa generator
141whose multiples form a cyclic subgroup of a certain
142.Fa order .
143By Lagrange's theorem, the number of points on the elliptic curve is
144the product of
145.Fa order
146and another integer called the
147.Fa cofactor .
148Hasse's theorem is the inequality
149.Pp
150.Dl | Ns Fa order No * Fa cofactor No - (p + 1)| <= 2 sqrt(p)
151.Pp
152which implies an upper bound on
153.Fa order
154in terms of
155.Fa p
156and allows the computation of
157.Fa cofactor
158provided that
159.Fa order
160is large enough.
161.Pp
162.Fn EC_GROUP_new_curve_GFp
163instantiates a new
164.Vt EC_GROUP
165object over the prime field of size
166.Fa p
167with Weierstrass equation given by the coefficients
168.Fa a
169and
170.Fa b .
171The optional
172.Fa ctx
173is used to transform the other arguments into internal representation.
174It is the caller's responsibility to ensure that
175.Fa p
176is a prime number greater than three and that
177the discriminant is non-zero.
178This can be done with
179.Xr EC_GROUP_check_discriminant 3
180or as part of
181.Xr EC_GROUP_check 3
182after
183.Fn EC_GROUP_set_generator .
184.Pp
185.Fn EC_GROUP_set_curve
186sets the curve parameters of
187.Fa group
188to
189.Fa p ,
190.Fa a ,
191.Fa b
192using the optional
193.Fa ctx
194and the comments in
195.Fn EC_GROUP_new_curve_GFp
196apply.
197Existing
198.Fa generator ,
199.Fa order ,
200or
201.Fa cofactor
202on
203.Fa group
204are left unmodified and become most likely invalid.
205They must therefore be set to legitimate values using
206.Fn EC_GROUP_set_generator .
207.Pp
208.Fn EC_GROUP_get_curve
209copies the curve parameters of
210.Fa group
211into the caller-owned
212.Fa p ,
213.Fa a ,
214and
215.Fa b ,
216possibly making use of the
217.Fa ctx
218for conversion from internal representations.
219Except for
220.Fa group ,
221all arguments are optional.
222.Pp
223.Fn EC_GROUP_set_generator
224performs sanity checks based on Hasse's theorem
225and copies
226.Fa generator ,
227.Fa order
228and the optional
229.Fa cofactor
230into
231.Fa group ,
232replacing all existing entries.
233It is the caller's responsibility to ensure that
234.Fa generator
235is a point on the curve and that
236.Fa order
237is its order,
238which can partially be accomplished with a subsequent call to
239.Xr EC_GROUP_check 3 .
240If
241.Fa cofactor
242is
243.Dv NULL ,
244it can be computed on curves of cryptographic interest,
245in which case
246.Fa cofactor
247is set to the computed value, otherwise it is set to zero.
248.Pp
249.Fn EC_GROUP_get0_generator
250returns an internal pointer to the
251.Fa group Ns 's
252.Fa generator ,
253which may be
254.Dv NULL
255if no generator was set.
256.Pp
257.Fn EC_GROUP_get_degree
258returns the bit length of the prime
259.Fa p
260set on
261.Fa group .
262.Pp
263.Fn EC_GROUP_get_order
264copies the value of the
265.Fa group Ns 's
266.Fa order
267into the caller-owned
268.Fa order ,
269returning failure if the
270.Fa group Ns 's
271.Fa order
272is zero.
273The
274.Fa ctx
275argument is ignored.
276.Pp
277.Fn EC_GROUP_order_bits
278returns the number of bits in the
279.Fa group Ns 's
280.Fa order ,
281which is the result of calling
282.Xr BN_num_bits 3
283on
284.Fa order .
285Unlike
286.Fn EC_GROUP_get_order ,
287it does not fail if
288.Fa order
289is zero.
290.Pp
291.Fn EC_GROUP_get_cofactor
292copies the value of the
293.Fa group Ns 's
294.Fa cofactor
295into the caller-owned
296.Fa cofactor ,
297returning failure if the
298.Fa group Ns 's
299.Fa cofactor
300is zero.
301The
302.Fa ctx
303argument is ignored.
304.Pp
305The deprecated
306.Fn EC_GROUP_clear_free
307uses
308.Xr explicit_bzero 3
309and
310.Xr freezero 3
311to clear and free all data associated with
312.Fa group .
313If
314.Fa group
315is
316.Dv NULL ,
317no action occurs.
318Since there is no secret data in
319.Fa group ,
320this API is useless.
321In LibreSSL,
322.Xr EC_GROUP_free 3
323and
324.Fn EC_GROUP_clear_free
325behave identically.
326.Pp
327.Fn EC_GROUP_set_curve_GFp
328and
329.Fn EC_GROUP_get_curve_GFp
330are deprecated aliases for
331.Fn EC_GROUP_set_curve
332and
333.Fn EC_GROUP_get_curve ,
334respectively.
335.Sh RETURN VALUES
336.Fn EC_GROUP_new_curve_GFp
337returns a newly allocated group or
338.Dv NULL
339if memory allocation fails,
340or if some minimal sanity checks on
341.Fa p ,
342.Fa a ,
343and
344.Fa b
345fail.
346.Pp
347.Fn EC_GROUP_set_curve
348and
349.Fn EC_GROUP_set_curve_GFp
350return 1 on success and 0 on failure.
351Failure conditions include that
352.Fa p
353is smaller than or equal to three, or even, or
354memory allocation failure.
355.Pp
356.Fn EC_GROUP_get_curve
357and
358.Fn EC_GROUP_get_curve_GFp
359return 1 on success and 0 on memory allocation failure.
360.Pp
361.Fn EC_GROUP_set_generator
362returns 1 on success and 0 on memory allocation failure, or if
363.Fa order
364or
365.Fa cofactor
366are larger than Hasse's theorem allows.
367.Pp
368.Fn EC_GROUP_get0_generator
369returns an internal pointer to the
370.Fa generator
371or
372.Dv NULL
373if none was set on
374.Fa group .
375.Pp
376.Fn EC_GROUP_get_order
377returns 1 on success or 0 on memory allocation failure or if the
378.Fa order
379is zero.
380.Pp
381.Fn EC_GROUP_get_cofactor
382returns 1 on success or 0 on memory allocation failure or if the
383.Fa cofactor
384is zero.
385.Pp
386.Fn EC_GROUP_get_degree ,
387and
388.Fn EC_GROUP_order_bits
389return the number of bits in the
390.Fa group Ns 's
391.Fa p ,
392and
393.Fa order ,
394respectively.
395.Sh SEE ALSO
396.Xr BN_new 3 ,
397.Xr BN_num_bits 3 ,
398.Xr crypto 3 ,
399.Xr d2i_ECPKParameters 3 ,
400.Xr EC_GROUP_check 3 ,
401.Xr EC_GROUP_get_curve_name 3 ,
402.Xr EC_GROUP_new_by_curve_name 3 ,
403.Xr EC_KEY_METHOD_new 3 ,
404.Xr EC_KEY_new 3 ,
405.Xr EC_POINT_add 3 ,
406.Xr EC_POINT_get_affine_coordinates 3 ,
407.Xr EC_POINT_new 3 ,
408.Xr EC_POINT_point2oct 3 ,
409.Xr ECDH_compute_key 3 ,
410.Xr ECDSA_SIG_new 3
411.Sh STANDARDS
412.Rs
413.%T SEC 1: Elliptic Curve Cryptography, Version 2.0
414.%U https://www.secg.org/sec1-v2.pdf
415.%D May 21, 2009
416.Re
417.Pp
418.Rs
419.%T SEC 2: Recommended Elliptic Curve Domain Parameters, Version 2.0
420.%U https://www.secg.org/sec2-v2.pdf
421.%D Jan 27, 2010
422.Re
423.Sh HISTORY
424.Fn EC_GROUP_new_curve_GFp ,
425.Fn EC_GROUP_clear_free ,
426.Fn EC_GROUP_set_curve_GFp ,
427.Fn EC_GROUP_get_curve_GFp ,
428.Fn EC_GROUP_set_generator ,
429.Fn EC_GROUP_get0_generator ,
430.Fn EC_GROUP_get_order ,
431and
432.Fn EC_GROUP_get_cofactor
433first appeared in OpenSSL 0.9.7 and
434have been available since
435.Ox 3.2 .
436.Pp
437.Fn EC_GROUP_get_degree
438first appeared in OpenSSL 0.9.8 and
439has been available since
440.Ox 4.5 .
441.Pp
442.Fn EC_GROUP_set_curve ,
443.Fn EC_GROUP_get_curve ,
444and
445.Fn EC_GROUP_order_bits
446first appeared in OpenSSL 1.1.1 and
447have been available since
448.Ox 7.0
449.Sh BUGS
450Too many.
451The API is unergonomic and the design is very poor even by
452OpenSSL's standards.
453Naming is inconsistent, especially in regard to the _GFp suffix
454and the _get_ infix.
455Function signatures are inconsistent.
456In particular, functions that should have a
457.Vt BN_CTX
458argument don't have one and functions that don't need it have one.
diff --git a/src/lib/libcrypto/man/EC_KEY_METHOD_new.3 b/src/lib/libcrypto/man/EC_KEY_METHOD_new.3
index 79c16ef014..a0ab6bac9e 100644
--- a/src/lib/libcrypto/man/EC_KEY_METHOD_new.3
+++ b/src/lib/libcrypto/man/EC_KEY_METHOD_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EC_KEY_METHOD_new.3,v 1.4 2024/07/21 08:36:43 tb Exp $ 1.\" $OpenBSD: EC_KEY_METHOD_new.3,v 1.6 2025/06/08 22:40:29 schwarze Exp $
2.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> 2.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org>
3.\" 3.\"
4.\" Permission to use, copy, modify, and distribute this software for any 4.\" Permission to use, copy, modify, and distribute this software for any
@@ -13,7 +13,7 @@
13.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15.\" 15.\"
16.Dd $Mdocdate: July 21 2024 $ 16.Dd $Mdocdate: June 8 2025 $
17.Dt EC_KEY_METHOD_NEW 3 17.Dt EC_KEY_METHOD_NEW 3
18.Os 18.Os
19.Sh NAME 19.Sh NAME
@@ -37,6 +37,7 @@
37.Nm EC_KEY_get_method 37.Nm EC_KEY_get_method
38.Nd custom EC_KEY implementations 38.Nd custom EC_KEY implementations
39.Sh SYNOPSIS 39.Sh SYNOPSIS
40.Lb libcrypto
40.In openssl/ec.h 41.In openssl/ec.h
41.Ft EC_KEY_METHOD * 42.Ft EC_KEY_METHOD *
42.Fo EC_KEY_METHOD_new 43.Fo EC_KEY_METHOD_new
@@ -312,7 +313,16 @@ returns 1 for success or 0 for failure.
312returns the EC_KEY implementation used by the given 313returns the EC_KEY implementation used by the given
313.Fa key . 314.Fa key .
314.Sh SEE ALSO 315.Sh SEE ALSO
316.Xr crypto 3 ,
317.Xr EC_GROUP_check 3 ,
318.Xr EC_GROUP_get_curve_name 3 ,
319.Xr EC_GROUP_new_by_curve_name 3 ,
320.Xr EC_GROUP_new_curve_GFp 3 ,
315.Xr EC_KEY_new 3 , 321.Xr EC_KEY_new 3 ,
322.Xr EC_POINT_add 3 ,
323.Xr EC_POINT_get_affine_coordinates 3 ,
324.Xr EC_POINT_new 3 ,
325.Xr EC_POINT_point2oct 3 ,
316.Xr ECDSA_sign 3 326.Xr ECDSA_sign 3
317.Sh HISTORY 327.Sh HISTORY
318These functions first appeared in OpenSSL 1.1.0 328These functions first appeared in OpenSSL 1.1.0
diff --git a/src/lib/libcrypto/man/EC_KEY_new.3 b/src/lib/libcrypto/man/EC_KEY_new.3
index c24cb080ef..41ebbbe878 100644
--- a/src/lib/libcrypto/man/EC_KEY_new.3
+++ b/src/lib/libcrypto/man/EC_KEY_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EC_KEY_new.3,v 1.21 2025/03/08 16:38:13 tb Exp $ 1.\" $OpenBSD: EC_KEY_new.3,v 1.23 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 3aef36ff Jan 5 13:06:03 2016 -0500 2.\" full merge up to: OpenSSL 3aef36ff Jan 5 13:06:03 2016 -0500
3.\" partial merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 3.\" partial merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
4.\" 4.\"
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: March 8 2025 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt EC_KEY_NEW 3 53.Dt EC_KEY_NEW 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -81,6 +81,7 @@
81.Nm EC_KEY_print_fp 81.Nm EC_KEY_print_fp
82.Nd create, destroy and manipulate EC_KEY objects 82.Nd create, destroy and manipulate EC_KEY objects
83.Sh SYNOPSIS 83.Sh SYNOPSIS
84.Lb libcrypto
84.In openssl/ec.h 85.In openssl/ec.h
85.In openssl/bn.h 86.In openssl/bn.h
86.Ft EC_KEY * 87.Ft EC_KEY *
@@ -234,7 +235,7 @@ and supplying the
234.Fa nid 235.Fa nid
235of the associated curve. 236of the associated curve.
236Refer to 237Refer to
237.Xr EC_GROUP_new 3 238.Xr EC_GROUP_new_by_curve_name 3
238for a description of curve names. 239for a description of curve names.
239This function simply wraps calls to 240This function simply wraps calls to
240.Fn EC_KEY_new 241.Fn EC_KEY_new
@@ -357,7 +358,7 @@ The format of the external representation of the public key written by
357such as whether it is stored in a compressed form or not, 358such as whether it is stored in a compressed form or not,
358is described by the point_conversion_form. 359is described by the point_conversion_form.
359See 360See
360.Xr EC_GROUP_copy 3 361.Xr EC_POINT_point2oct 3
361for a description of point_conversion_form. 362for a description of point_conversion_form.
362.Pp 363.Pp
363When reading a private key encoded without an associated public key, 364When reading a private key encoded without an associated public key,
@@ -378,7 +379,7 @@ and
378get and set the point_conversion_form for the 379get and set the point_conversion_form for the
379.Fa key . 380.Fa key .
380For a description of point_conversion_form refer to 381For a description of point_conversion_form refer to
381.Xr EC_GROUP_copy 3 . 382.Xr EC_POINT_point2oct 3 .
382.Pp 383.Pp
383.Fn EC_KEY_set_flags 384.Fn EC_KEY_set_flags
384sets the flags in the 385sets the flags in the
@@ -407,7 +408,7 @@ sets the asn1_flag on the underlying
407.Vt EC_GROUP 408.Vt EC_GROUP
408object (if set). 409object (if set).
409Refer to 410Refer to
410.Xr EC_GROUP_copy 3 411.Xr EC_GROUP_get_curve_name 3
411for further information on the asn1_flag. 412for further information on the asn1_flag.
412.Pp 413.Pp
413.Fn EC_KEY_precompute_mult 414.Fn EC_KEY_precompute_mult
@@ -488,11 +489,14 @@ returns the point_conversion_form for the
488.Vt EC_KEY . 489.Vt EC_KEY .
489.Sh SEE ALSO 490.Sh SEE ALSO
490.Xr d2i_ECPKParameters 3 , 491.Xr d2i_ECPKParameters 3 ,
491.Xr EC_GROUP_copy 3 , 492.Xr EC_GROUP_check 3 ,
492.Xr EC_GROUP_new 3 , 493.Xr EC_GROUP_get_curve_name 3 ,
494.Xr EC_GROUP_new_by_curve_name 3 ,
495.Xr EC_GROUP_new_curve_GFp 3 ,
493.Xr EC_KEY_METHOD_new 3 , 496.Xr EC_KEY_METHOD_new 3 ,
494.Xr EC_POINT_add 3 , 497.Xr EC_POINT_add 3 ,
495.Xr EC_POINT_new 3 , 498.Xr EC_POINT_get_affine_coordinates 3 ,
499.Xr EC_POINT_point2oct 3 ,
496.Xr ECDH_compute_key 3 , 500.Xr ECDH_compute_key 3 ,
497.Xr ECDSA_SIG_new 3 , 501.Xr ECDSA_SIG_new 3 ,
498.Xr EVP_PKEY_set1_EC_KEY 3 502.Xr EVP_PKEY_set1_EC_KEY 3
diff --git a/src/lib/libcrypto/man/EC_POINT_add.3 b/src/lib/libcrypto/man/EC_POINT_add.3
index cc35499c0e..28f3143a8d 100644
--- a/src/lib/libcrypto/man/EC_POINT_add.3
+++ b/src/lib/libcrypto/man/EC_POINT_add.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EC_POINT_add.3,v 1.15 2025/03/08 16:48:22 tb Exp $ 1.\" $OpenBSD: EC_POINT_add.3,v 1.17 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Matt Caswell <matt@openssl.org>. 4.\" This file was written by Matt Caswell <matt@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 8 2025 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt EC_POINT_ADD 3 52.Dt EC_POINT_ADD 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -62,6 +62,7 @@
62.Nm EC_POINT_mul 62.Nm EC_POINT_mul
63.Nd perform mathematical operations and tests on EC_POINT objects 63.Nd perform mathematical operations and tests on EC_POINT objects
64.Sh SYNOPSIS 64.Sh SYNOPSIS
65.Lb libcrypto
65.In openssl/ec.h 66.In openssl/ec.h
66.In openssl/bn.h 67.In openssl/bn.h
67.Ft int 68.Ft int
@@ -177,7 +178,7 @@ in which case the result is just
177.Dl q * m. 178.Dl q * m.
178.Pp 179.Pp
179See 180See
180.Xr EC_GROUP_copy 3 181.Xr EC_GROUP_new_curve_GFp 3
181for information about the generator. 182for information about the generator.
182.Sh RETURN VALUES 183.Sh RETURN VALUES
183The following functions return 1 on success or 0 on error: 184The following functions return 1 on success or 0 on error:
@@ -197,11 +198,17 @@ returns 1 if the point is on the curve, 0 if not, or -1 on error.
197.Fn EC_POINT_cmp 198.Fn EC_POINT_cmp
198returns 1 if the points are not equal, 0 if they are, or -1 on error. 199returns 1 if the points are not equal, 0 if they are, or -1 on error.
199.Sh SEE ALSO 200.Sh SEE ALSO
201.Xr crypto 3 ,
200.Xr d2i_ECPKParameters 3 , 202.Xr d2i_ECPKParameters 3 ,
201.Xr EC_GROUP_copy 3 , 203.Xr EC_GROUP_check 3 ,
202.Xr EC_GROUP_new 3 , 204.Xr EC_GROUP_get_curve_name 3 ,
205.Xr EC_GROUP_new_by_curve_name 3 ,
206.Xr EC_GROUP_new_curve_GFp 3 ,
207.Xr EC_KEY_METHOD_new 3 ,
203.Xr EC_KEY_new 3 , 208.Xr EC_KEY_new 3 ,
204.Xr EC_POINT_new 3 209.Xr EC_POINT_get_affine_coordinates 3 ,
210.Xr EC_POINT_new 3 ,
211.Xr EC_POINT_point2oct 3
205.Sh HISTORY 212.Sh HISTORY
206.Fn EC_POINT_add , 213.Fn EC_POINT_add ,
207.Fn EC_POINT_dbl , 214.Fn EC_POINT_dbl ,
diff --git a/src/lib/libcrypto/man/EC_POINT_get_affine_coordinates.3 b/src/lib/libcrypto/man/EC_POINT_get_affine_coordinates.3
new file mode 100644
index 0000000000..76ef516307
--- /dev/null
+++ b/src/lib/libcrypto/man/EC_POINT_get_affine_coordinates.3
@@ -0,0 +1,216 @@
1.\" $OpenBSD: EC_POINT_get_affine_coordinates.3,v 1.2 2025/06/08 22:40:29 schwarze Exp $
2.\"
3.\" Copyright (c) 2025 Theo Buehler <tb@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: June 8 2025 $
18.Dt EC_POINT_GET_AFFINE_COORDINATES 3
19.Os
20.Sh NAME
21.Nm EC_POINT_get_affine_coordinates ,
22.Nm EC_POINT_set_affine_coordinates ,
23.Nm EC_POINT_set_compressed_coordinates ,
24.Nm EC_POINT_set_to_infinity ,
25.Nm EC_POINT_get_affine_coordinates_GFp ,
26.Nm EC_POINT_set_affine_coordinates_GFp ,
27.Nm EC_POINT_set_compressed_coordinates_GFp
28.Nd get and set coordinates of elliptic curve points
29.Sh SYNOPSIS
30.Lb libcrypto
31.In openssl/bn.h
32.In openssl/ec.h
33.Pp
34.Ft int
35.Fo EC_POINT_get_affine_coordinates
36.Fa "const EC_GROUP *group"
37.Fa "const EC_POINT *point"
38.Fa "BIGNUM *x"
39.Fa "BIGNUM *y"
40.Fa "BN_CTX *ctx"
41.Fc
42.Ft int
43.Fo EC_POINT_set_affine_coordinates
44.Fa "const EC_GROUP *group"
45.Fa "EC_POINT *point"
46.Fa "const BIGNUM *x"
47.Fa "const BIGNUM *y"
48.Fa "BN_CTX *ctx"
49.Fc
50.Ft int
51.Fo EC_POINT_set_compressed_coordinates
52.Fa "const EC_GROUP *group"
53.Fa "EC_POINT *point"
54.Fa "const BIGNUM *x"
55.Fa "int y_bit"
56.Fa "BN_CTX *ctx"
57.Fc
58.Ft int
59.Fo EC_POINT_set_to_infinity
60.Fa "const EC_GROUP *group"
61.Fa "EC_POINT *point"
62.Fc
63.Pp
64Deprecated:
65.Pp
66.Ft int
67.Fo EC_POINT_get_affine_coordinates_GFp
68.Fa "const EC_GROUP *group"
69.Fa "const EC_POINT *point"
70.Fa "BIGNUM *x"
71.Fa "BIGNUM *y"
72.Fa "BN_CTX *ctx"
73.Fc
74.Ft int
75.Fo EC_POINT_set_affine_coordinates_GFp
76.Fa "const EC_GROUP *group"
77.Fa "EC_POINT *point"
78.Fa "const BIGNUM *x"
79.Fa "const BIGNUM *y"
80.Fa "BN_CTX *ctx"
81.Fc
82.Ft int
83.Fo EC_POINT_set_compressed_coordinates_GFp
84.Fa "const EC_GROUP *group"
85.Fa "EC_POINT *point"
86.Fa "const BIGNUM *x"
87.Fa "int y_bit"
88.Fa "BN_CTX *ctx"
89.Fc
90.Sh DESCRIPTION
91.Fn EC_POINT_get_affine_coordinates
92assumes that
93.Fa point
94is a point on
95.Fa group ,
96calculates its affine coordinates from its internal representation
97using the optional
98.Fa ctx ,
99and copies them into the optional user-provided
100.Fa x
101and
102.Fa y .
103.Pp
104.Fn EC_POINT_set_affine_coordinates
105assumes that
106.Fa x
107and
108.Fa y
109are the affine coordinates of a point on
110.Fa group ,
111converts them into internal representation and sets them on
112.Fa point
113using the optional
114.Fa ctx .
115The user-provided
116.Fa point
117should be the result of
118.Fn EC_POINT_new 3
119with an argument of
120.Fa group .
121It then verifies using
122.Xr EC_POINT_is_on_curve 3
123that
124.Fa x
125and
126.Fa y
127are indeed the affine coordinates of a point on
128.Fa group .
129.Pp
130.Fn EC_POINT_set_compressed_coordinates
131assumes that
132.Fa x
133is the x-coordinate and
134.Fa y_bit
135is the parity bit of a point on
136.Fa group
137and sets
138.Fa point
139to the corresponding point on
140.Fa group .
141It does this by solving the quadratic equation y^2 = x^3 + ax + b using
142.Xr BN_mod_sqrt 3
143and the optional
144.Fa ctx ,
145chooses the solution
146.Fa y
147with parity matching
148.Fa y_bit ,
149and passes
150.Fa x
151and
152.Fa y
153to
154.Fn EC_POINT_set_affine_coordinates .
155The user-provided
156.Fa point
157should be the result of
158.Fn EC_POINT_new
159with argument
160.Fa group .
161.Pp
162.Fn EC_POINT_set_to_infinity
163sets
164.Fa point
165to the internal representation of the point at infinity on
166.Fa group .
167.Pp
168.Fn EC_POINT_get_affine_coordinates_GFp
169is a deprecated alias for
170.Fn EC_POINT_get_affine_coordinates .
171Similarly for
172.Fn EC_POINT_set_affine_coordinates_GFp
173and
174.Fn EC_POINT_set_compressed_coordinates_GFp .
175.Sh RETURN VALUES
176All these functions return 1 on success and 0 on error.
177Error conditions include memory allocation failure,
178that
179.Fa point
180is incompatible with
181.Fa group ,
182and, for the coordinate setters, that the provided coordinates
183do not represent a point on
184.Fa group .
185.Sh SEE ALSO
186.Xr BN_CTX_new 3 ,
187.Xr BN_is_zero 3 ,
188.Xr BN_mod_sqrt 3 ,
189.Xr crypto 3 ,
190.Xr d2i_ECPKParameters 3 ,
191.Xr EC_GROUP_check 3 ,
192.Xr EC_GROUP_get_curve_name 3 ,
193.Xr EC_GROUP_new_by_curve_name 3 ,
194.Xr EC_GROUP_new_curve_GFp 3 ,
195.Xr EC_KEY_METHOD_new 3 ,
196.Xr EC_KEY_new 3 ,
197.Xr EC_POINT_add 3 ,
198.Xr EC_POINT_new 3 ,
199.Xr EC_POINT_point2oct 3 ,
200.Xr ECDH_compute_key 3 ,
201.Xr ECDSA_SIG_new 3
202.Sh HISTORY
203.Fn EC_POINT_get_affine_coordinates_GFp ,
204.Fn EC_POINT_set_affine_coordinates_GFp ,
205.Fn EC_POINT_set_compressed_coordinates_GFp ,
206and
207.Fn EC_POINT_set_to_infinity
208first appeared in OpenSSL 0.9.7 and have been available since
209.Ox 3.2 .
210.Pp
211.Fn EC_POINT_get_affine_coordinates ,
212.Fn EC_POINT_set_affine_coordinates ,
213and
214.Fn EC_POINT_set_compressed_coordinates
215first appeared in OpenSSL 1.1.1 and have been available since
216.Ox 7.0 .
diff --git a/src/lib/libcrypto/man/EC_POINT_new.3 b/src/lib/libcrypto/man/EC_POINT_new.3
index db6280fce7..0a797f8bc9 100644
--- a/src/lib/libcrypto/man/EC_POINT_new.3
+++ b/src/lib/libcrypto/man/EC_POINT_new.3
@@ -1,54 +1,20 @@
1.\" $OpenBSD: EC_POINT_new.3,v 1.17 2025/03/08 17:04:07 tb Exp $ 1.\" $OpenBSD: EC_POINT_new.3,v 1.21 2025/06/13 18:34:00 schwarze Exp $
2.\" full merge up to: OpenSSL 50db8163 Jul 30 16:56:41 2018 +0100
3.\" 2.\"
4.\" This file was written by Matt Caswell <matt@openssl.org>. 3.\" Copyright (c) 2025 Theo Buehler <tb@openbsd.org>
5.\" Copyright (c) 2013, 2016 The OpenSSL Project. All rights reserved.
6.\" 4.\"
7.\" Redistribution and use in source and binary forms, with or without 5.\" Permission to use, copy, modify, and distribute this software for any
8.\" modification, are permitted provided that the following conditions 6.\" purpose with or without fee is hereby granted, provided that the above
9.\" are met: 7.\" copyright notice and this permission notice appear in all copies.
10.\" 8.\"
11.\" 1. Redistributions of source code must retain the above copyright 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12.\" notice, this list of conditions and the following disclaimer. 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
13.\" 16.\"
14.\" 2. Redistributions in binary form must reproduce the above copyright 17.Dd $Mdocdate: June 13 2025 $
15.\" notice, this list of conditions and the following disclaimer in
16.\" the documentation and/or other materials provided with the
17.\" distribution.
18.\"
19.\" 3. All advertising materials mentioning features or use of this
20.\" software must display the following acknowledgment:
21.\" "This product includes software developed by the OpenSSL Project
22.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
23.\"
24.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
25.\" endorse or promote products derived from this software without
26.\" prior written permission. For written permission, please contact
27.\" openssl-core@openssl.org.
28.\"
29.\" 5. Products derived from this software may not be called "OpenSSL"
30.\" nor may "OpenSSL" appear in their names without prior written
31.\" permission of the OpenSSL Project.
32.\"
33.\" 6. Redistributions of any form whatsoever must retain the following
34.\" acknowledgment:
35.\" "This product includes software developed by the OpenSSL Project
36.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
37.\"
38.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
39.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
41.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
42.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
47.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\"
51.Dd $Mdocdate: March 8 2025 $
52.Dt EC_POINT_NEW 3 18.Dt EC_POINT_NEW 3
53.Os 19.Os
54.Sh NAME 20.Sh NAME
@@ -56,24 +22,12 @@
56.Nm EC_POINT_free , 22.Nm EC_POINT_free ,
57.Nm EC_POINT_clear_free , 23.Nm EC_POINT_clear_free ,
58.Nm EC_POINT_copy , 24.Nm EC_POINT_copy ,
59.Nm EC_POINT_dup , 25.Nm EC_POINT_dup
60.Nm EC_POINT_set_to_infinity , 26.Nd allocate, free and copy elliptic curve points
61.Nm EC_POINT_set_affine_coordinates ,
62.Nm EC_POINT_set_affine_coordinates_GFp ,
63.Nm EC_POINT_get_affine_coordinates ,
64.Nm EC_POINT_get_affine_coordinates_GFp ,
65.Nm EC_POINT_set_compressed_coordinates ,
66.Nm EC_POINT_set_compressed_coordinates_GFp ,
67.Nm EC_POINT_point2oct ,
68.Nm EC_POINT_oct2point ,
69.Nm EC_POINT_point2bn ,
70.Nm EC_POINT_bn2point ,
71.Nm EC_POINT_point2hex ,
72.Nm EC_POINT_hex2point
73.Nd create, destroy, and manipulate EC_POINT objects
74.Sh SYNOPSIS 27.Sh SYNOPSIS
28.Lb libcrypto
75.In openssl/ec.h 29.In openssl/ec.h
76.In openssl/bn.h 30.Pp
77.Ft EC_POINT * 31.Ft EC_POINT *
78.Fo EC_POINT_new 32.Fo EC_POINT_new
79.Fa "const EC_GROUP *group" 33.Fa "const EC_GROUP *group"
@@ -93,126 +47,32 @@
93.Fc 47.Fc
94.Ft EC_POINT * 48.Ft EC_POINT *
95.Fo EC_POINT_dup 49.Fo EC_POINT_dup
96.Fa "const EC_POINT *src" 50.Fa "const EC_POINT *point"
97.Fa "const EC_GROUP *group"
98.Fc
99.Ft int
100.Fo EC_POINT_set_to_infinity
101.Fa "const EC_GROUP *group"
102.Fa "EC_POINT *point"
103.Fc
104.Ft int
105.Fo EC_POINT_set_affine_coordinates
106.Fa "const EC_GROUP *group"
107.Fa "EC_POINT *p"
108.Fa "const BIGNUM *x"
109.Fa "const BIGNUM *y"
110.Fa "BN_CTX *ctx"
111.Fc
112.Ft int
113.Fo EC_POINT_set_affine_coordinates_GFp
114.Fa "const EC_GROUP *group"
115.Fa "EC_POINT *p"
116.Fa "const BIGNUM *x"
117.Fa "const BIGNUM *y"
118.Fa "BN_CTX *ctx"
119.Fc
120.Ft int
121.Fo EC_POINT_get_affine_coordinates
122.Fa "const EC_GROUP *group" 51.Fa "const EC_GROUP *group"
123.Fa "const EC_POINT *p"
124.Fa "BIGNUM *x"
125.Fa "BIGNUM *y"
126.Fa "BN_CTX *ctx"
127.Fc
128.Ft int
129.Fo EC_POINT_get_affine_coordinates_GFp
130.Fa "const EC_GROUP *group"
131.Fa "const EC_POINT *p"
132.Fa "BIGNUM *x"
133.Fa "BIGNUM *y"
134.Fa "BN_CTX *ctx"
135.Fc
136.Ft int
137.Fo EC_POINT_set_compressed_coordinates
138.Fa "const EC_GROUP *group"
139.Fa "EC_POINT *p"
140.Fa "const BIGNUM *x"
141.Fa "int y_bit"
142.Fa "BN_CTX *ctx"
143.Fc
144.Ft int
145.Fo EC_POINT_set_compressed_coordinates_GFp
146.Fa "const EC_GROUP *group"
147.Fa "EC_POINT *p"
148.Fa "const BIGNUM *x"
149.Fa "int y_bit"
150.Fa "BN_CTX *ctx"
151.Fc
152.Ft size_t
153.Fo EC_POINT_point2oct
154.Fa "const EC_GROUP *group"
155.Fa "const EC_POINT *p"
156.Fa "point_conversion_form_t form"
157.Fa "unsigned char *buf"
158.Fa "size_t len"
159.Fa "BN_CTX *ctx"
160.Fc
161.Ft int
162.Fo EC_POINT_oct2point
163.Fa "const EC_GROUP *group"
164.Fa "EC_POINT *p"
165.Fa "const unsigned char *buf"
166.Fa "size_t len"
167.Fa "BN_CTX *ctx"
168.Fc
169.Ft BIGNUM *
170.Fo EC_POINT_point2bn
171.Fa "const EC_GROUP *"
172.Fa "const EC_POINT *"
173.Fa "point_conversion_form_t form"
174.Fa "BIGNUM *"
175.Fa "BN_CTX *"
176.Fc
177.Ft EC_POINT *
178.Fo EC_POINT_bn2point
179.Fa "const EC_GROUP *"
180.Fa "const BIGNUM *"
181.Fa "EC_POINT *"
182.Fa "BN_CTX *"
183.Fc
184.Ft char *
185.Fo EC_POINT_point2hex
186.Fa "const EC_GROUP *"
187.Fa "const EC_POINT *"
188.Fa "point_conversion_form_t form"
189.Fa "BN_CTX *"
190.Fc
191.Ft EC_POINT *
192.Fo EC_POINT_hex2point
193.Fa "const EC_GROUP *"
194.Fa "const char *"
195.Fa "EC_POINT *"
196.Fa "BN_CTX *"
197.Fc 52.Fc
198.Sh DESCRIPTION 53.Sh DESCRIPTION
199An 54An
200.Vt EC_POINT 55.Vt EC_POINT
201represents a point on a curve. 56object holds a point on the elliptic curve represented by an
202A curve is represented by an 57.Vt EC_GROUP .
203.Vt EC_GROUP 58The details of the internal representation depend on the group
204object created by the functions described in 59and should never be an application's concern since the EC library
205.Xr EC_GROUP_new 3 . 60has API to set a point's coordinates,
61.Xr EC_POINT_set_affine_coordinates 3 .
206.Pp 62.Pp
207A new point is constructed by calling the function
208.Fn EC_POINT_new 63.Fn EC_POINT_new
209and providing the 64allocates and initializes an
210.Fa group 65.Vt EC_POINT
211object that the point relates to. 66object to be used with the
67.Fa group .
68Before explicitly setting its coordinates, the returned
69.Vt EC_POINT
70is invalid.
212.Pp 71.Pp
213.Fn EC_POINT_free 72.Fn EC_POINT_free
214frees the memory associated with the 73frees
215.Vt EC_POINT . 74.Fa point
75and all memory associated with it.
216If 76If
217.Fa point 77.Fa point
218is a 78is a
@@ -220,236 +80,129 @@ is a
220pointer, no action occurs. 80pointer, no action occurs.
221.Pp 81.Pp
222.Fn EC_POINT_clear_free 82.Fn EC_POINT_clear_free
223destroys any sensitive data held within the 83is intended to destroy sensitive data held in
224.Vt EC_POINT
225and then frees its memory.
226If
227.Fa point 84.Fa point
228is a 85in addition to freeing all memory associated with it.
229.Dv NULL 86Since elliptic curve points usually hold public data, this
230pointer, no action occurs. 87is rarely needed.
88In LibreSSL,
89.Fn EC_POINT_free
90and
91.Fn EC_POINT_clear_free
92behave identically.
231.Pp 93.Pp
232.Fn EC_POINT_copy 94.Fn EC_POINT_copy
233copies the point 95copies the internal representation of
234.Fa src 96.Fa src
235into 97into
236.Fa dst . 98.Fa dst .
237Both 99If
238.Fa src 100.Fa src
239and 101and
240.Fa dst 102.Fa dst
241must use the same 103are identical, no action occurs.
242.Vt EC_METHOD . 104Both
243.Pp
244.Fn EC_POINT_dup
245creates a new
246.Vt EC_POINT
247object and copies the content from
248.Fa src 105.Fa src
249to the newly created
250.Vt EC_POINT
251object.
252.Pp
253A valid point on a curve is the special point at infinity.
254A point is set to be at infinity by calling
255.Fn EC_POINT_set_to_infinity .
256.Pp
257The affine coordinates for a point describe a point in terms of its
258.Fa x
259and 106and
260.Fa y 107.Fa dst
261position. 108should be the result of
262The function 109.Fn EC_POINT_new
263.Fn EC_POINT_set_affine_coordinates 110with the same
264sets the 111.Fa group
265.Fa x 112argument, although
266and 113.Fn EC_POINT_copy
267.Fa y 114cannot check that.
268coordinates for the point
269.Fa p
270defined over the curve given in
271.Fa group .
272The function
273.Fn EC_POINT_get_affine_coordinates
274sets
275.Fa x
276and
277.Fa y ,
278either of which may be
279.Dv NULL ,
280to the corresponding coordinates of
281.Fa p .
282.Pp
283The functions
284.Fn EC_POINT_set_affine_coordinates_GFp
285is a deprecated synonym for
286.Fn EC_POINT_set_affine_coordinates
287and the function
288.Fn EC_POINT_get_affine_coordinates_GFp
289is a deprecated synonym for
290.Fn EC_POINT_get_affine_coordinates .
291.Pp
292Points can also be described in terms of their compressed coordinates.
293For a point
294.Pq Fa x , y ,
295for any given value for
296.Fa x
297such that the point is on the curve, there will only ever be two
298possible values for
299.Fa y .
300Therefore, a point can be set using the
301.Fn EC_POINT_set_compressed_coordinates
302function where
303.Fa x
304is the x coordinate and
305.Fa y_bit
306is a value 0 or 1 to identify which of the two possible values for y
307should be used.
308.Pp
309The functions
310.Fn EC_POINT_set_compressed_coordinates_GFp
311is a deprecated synonym for
312.Fn EC_POINT_set_compressed_coordinates .
313.Pp
314In addition
315.Vt EC_POINT Ns s
316can be converted to and from various external representations.
317Supported representations are octet strings,
318.Vt BIGNUM Ns s ,
319and hexadecimal.
320The format of the external representation is described by the
321point_conversion_form.
322See
323.Xr EC_GROUP_copy 3
324for a description of point_conversion_form.
325Octet strings are stored in a buffer along with an associated buffer
326length.
327A point held in a
328.Vt BIGNUM
329is calculated by converting the point to an octet string and then
330converting that octet string into a
331.Vt BIGNUM
332integer.
333Points in hexadecimal format are stored in a NUL terminated character
334string where each character is one of the printable values 0-9 or A-F
335(or a-f).
336.Pp
337The functions
338.Fn EC_POINT_point2oct ,
339.Fn EC_POINT_oct2point ,
340.Fn EC_POINT_point2bn ,
341.Fn EC_POINT_bn2point ,
342.Fn EC_POINT_point2hex ,
343and
344.Fn EC_POINT_hex2point
345convert from and to
346.Vt EC_POINT Ns s
347for the formats octet string,
348.Vt BIGNUM ,
349and hexadecimal, respectively.
350.Pp
351The function
352.Fn EC_POINT_point2oct
353must be supplied with a
354.Fa buf
355long enough to store the octet string.
356The return value provides the number of octets stored.
357Calling the function with a
358.Dv NULL
359.Fa buf
360will not perform the conversion but will still return the required
361buffer length.
362.Pp 115.Pp
363The function 116.Fn EC_POINT_dup
364.Fn EC_POINT_point2hex 117creates a deep copy of
365will allocate sufficient memory to store the hexadecimal string. 118.Fa point
366It is the caller's responsibility to free this memory with a subsequent 119by combining
367call to 120.Fn EC_POINT_new
368.Xr free 3 . 121with
122.Fn EC_GROUP_copy .
369.Sh RETURN VALUES 123.Sh RETURN VALUES
370.Fn EC_POINT_new 124.Fn EC_POINT_new
371and 125returns a newly allocated
372.Fn EC_POINT_dup
373return the newly allocated
374.Vt EC_POINT 126.Vt EC_POINT
375or 127or
376.Dv NULL 128.Dv NULL
377on error. 129on memory allocation failure.
378.Pp
379The following functions return 1 on success or 0 on error:
380.Fn EC_POINT_copy ,
381.Fn EC_POINT_set_to_infinity ,
382.Fn EC_POINT_set_affine_coordinates ,
383.Fn EC_POINT_set_affine_coordinates_GFp ,
384.Fn EC_POINT_get_affine_coordinates ,
385.Fn EC_POINT_get_affine_coordinates_GFp ,
386.Fn EC_POINT_set_compressed_coordinates ,
387.Fn EC_POINT_set_compressed_coordinates_GFp ,
388and
389.Fn EC_POINT_oct2point .
390.Pp
391.Fn EC_POINT_point2oct
392returns the length of the required buffer, or 0 on error.
393.Pp
394.Fn EC_POINT_point2bn
395returns the pointer to the
396.Vt BIGNUM
397supplied or
398.Dv NULL
399on error.
400.Pp 130.Pp
401.Fn EC_POINT_bn2point 131.Fn EC_POINT_copy
402returns the pointer to the 132returns 1 on success or 0 on error.
403.Vt EC_POINT 133Error conditions include memory allocation failure and that
404supplied or 134.Fa dst
405.Dv NULL 135is incompatible with the group on which
406on error. 136.Fa src
407.Pp 137is defined.
408.Fn EC_POINT_point2hex
409returns a pointer to the hex string or
410.Dv NULL
411on error.
412.Pp 138.Pp
413.Fn EC_POINT_hex2point 139.Fn EC_POINT_dup
414returns the pointer to the 140returns a newly allocated
415.Vt EC_POINT 141.Vt EC_POINT
416supplied or 142or
417.Dv NULL 143.Dv NULL
418on error. 144on failure.
145Error conditions include memory allocation failure or that
146.Fa group
147is incompatible with
148.Fa src .
419.Sh SEE ALSO 149.Sh SEE ALSO
150.Xr BN_CTX_new 3 ,
151.Xr BN_is_zero 3 ,
152.Xr crypto 3 ,
420.Xr d2i_ECPKParameters 3 , 153.Xr d2i_ECPKParameters 3 ,
421.Xr EC_GROUP_copy 3 , 154.Xr EC_GROUP_check 3 ,
422.Xr EC_GROUP_new 3 , 155.Xr EC_GROUP_get_curve_name 3 ,
156.Xr EC_GROUP_new_by_curve_name 3 ,
157.Xr EC_GROUP_new_curve_GFp 3 ,
158.Xr EC_KEY_METHOD_new 3 ,
423.Xr EC_KEY_new 3 , 159.Xr EC_KEY_new 3 ,
424.Xr EC_POINT_add 3 , 160.Xr EC_POINT_add 3 ,
425.Xr ECDH_compute_key 3 161.Xr EC_POINT_get_affine_coordinates 3 ,
162.Xr EC_POINT_point2oct 3 ,
163.Xr ECDH_compute_key 3 ,
164.Xr ECDSA_SIG_new 3
426.Sh HISTORY 165.Sh HISTORY
427.Fn EC_POINT_new , 166.Fn EC_POINT_new ,
428.Fn EC_POINT_free , 167.Fn EC_POINT_free ,
429.Fn EC_POINT_clear_free , 168.Fn EC_POINT_clear_free ,
430.Fn EC_POINT_copy ,
431.Fn EC_POINT_set_to_infinity ,
432.Fn EC_POINT_set_affine_coordinates_GFp ,
433.Fn EC_POINT_get_affine_coordinates_GFp ,
434.Fn EC_POINT_set_compressed_coordinates_GFp ,
435.Fn EC_POINT_point2oct ,
436and 169and
437.Fn EC_POINT_oct2point 170.Fn EC_POINT_copy
438first appeared in OpenSSL 0.9.7 and have been available since 171first appeared in OpenSSL 0.9.7 and have been available since
439.Ox 3.2 . 172.Ox 3.2 .
440.Pp 173.Pp
441.Fn EC_POINT_dup , 174.Fn EC_POINT_dup
442.Fn EC_POINT_point2bn , 175first appeared in OpenSSL 0.9.8 and has been available since
443.Fn EC_POINT_bn2point ,
444.Fn EC_POINT_point2hex ,
445and
446.Fn EC_POINT_hex2point
447first appeared in OpenSSL 0.9.8 and have been available since
448.Ox 4.5 . 176.Ox 4.5 .
449.Pp 177.Sh BUGS
450.Fn EC_POINT_set_affine_coordinates , 178A fundamental flaw in the OpenSSL API toolkit is that
451.Fn EC_POINT_get_affine_coordinates , 179.Fn *_new
180functions usually create invalid objects that are tricky to
181turn into valid objects.
182One specific flaw in the EC library internals is that
183.Vt EC_POINT
184objects do not hold a reference to the group they live on
185despite the fact that
186.Fn EC_POINT_new
187has a
188.Fa group
189argument.
190This is difficult to fix because
191.Vt EC_GROUP
192objects are not reference counted and
193because of const qualifiers in the API.
194This is the root cause for various contortions in the EC library
195and API and
196there are security implications because not
197only does the library not know whether an
198.Fa EC_POINT
199object represents a valid point,
200even if it did know that it would still not know on what curve.
201.Pp
202The signature of
203.Fn EC_GROUP_dup
204is bizarre and the order of
205.Fa point
452and 206and
453.Fn EC_POINT_set_compressed_coordinates 207.Fa group
454first appeared in OpenSSL 1.1.1 and have been available since 208is inconsistent with the rest of the EC API.
455.Ox 7.0 .
diff --git a/src/lib/libcrypto/man/EC_POINT_point2oct.3 b/src/lib/libcrypto/man/EC_POINT_point2oct.3
new file mode 100644
index 0000000000..ac89c9b1d4
--- /dev/null
+++ b/src/lib/libcrypto/man/EC_POINT_point2oct.3
@@ -0,0 +1,434 @@
1.\" $OpenBSD: EC_POINT_point2oct.3,v 1.6 2025/06/13 18:34:00 schwarze Exp $
2.\"
3.\" Copyright (c) 2025 Theo Buehler <tb@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: June 13 2025 $
18.Dt EC_POINT_POINT2OCT 3
19.Os
20.Sh NAME
21.Nm EC_POINT_point2oct ,
22.Nm EC_POINT_oct2point ,
23.Nm EC_POINT_point2bn ,
24.Nm EC_POINT_bn2point ,
25.Nm EC_POINT_point2hex ,
26.Nm EC_POINT_hex2point
27.Nd encode and decode elliptic curve points
28.Sh SYNOPSIS
29.Lb libcrypto
30.In openssl/bn.h
31.In openssl/ec.h
32.Bd -literal
33typedef enum {
34 POINT_CONVERSION_COMPRESSED = 2,
35 POINT_CONVERSION_UNCOMPRESSED = 4,
36 POINT_CONVERSION_HYBRID = 6
37} point_conversion_form_t;
38
39.Ed
40.Ft size_t
41.Fo EC_POINT_point2oct
42.Fa "const EC_GROUP *group"
43.Fa "const EC_POINT *point"
44.Fa "point_conversion_form_t form"
45.Fa "unsigned char *buf"
46.Fa "size_t len"
47.Fa "BN_CTX *ctx"
48.Fc
49.Ft int
50.Fo EC_POINT_oct2point
51.Fa "const EC_GROUP *group"
52.Fa "EC_POINT *point"
53.Fa "const unsigned char *buf"
54.Fa "size_t len"
55.Fa "BN_CTX *ctx"
56.Fc
57.Ft BIGNUM *
58.Fo EC_POINT_point2bn
59.Fa "const EC_GROUP *group"
60.Fa "const EC_POINT *point"
61.Fa "point_conversion_form_t form"
62.Fa "BIGNUM *bn"
63.Fa "BN_CTX *ctx"
64.Fc
65.Ft EC_POINT *
66.Fo EC_POINT_bn2point
67.Fa "const EC_GROUP *group"
68.Fa "const BIGNUM *bn"
69.Fa "EC_POINT *point"
70.Fa "BN_CTX *ctx"
71.Fc
72.Ft char *
73.Fo EC_POINT_point2hex
74.Fa "const EC_GROUP *group"
75.Fa "const EC_POINT *point"
76.Fa "point_conversion_form_t form"
77.Fa "BN_CTX *ctx"
78.Fc
79.Ft EC_POINT *
80.Fo EC_POINT_hex2point
81.Fa "const EC_GROUP *group"
82.Fa "const char *hex"
83.Fa "EC_POINT *point"
84.Fa "BN_CTX *ctx"
85.Fc
86.Sh DESCRIPTION
87The
88.Fa ctx
89argument of all functions in this manual is optional.
90.Pp
91An
92.Vt EC_POINT
93object represents a point on the elliptic curve given by an
94.Vt EC_GROUP
95object.
96It is either the point at infinity or it has a representation
97(x, y) in standard affine coordinates,
98in which case it satisfies the curve's Weierstrass equation
99.Pp
100.Dl y^2 = x^3 + ax + b
101.Pp
102in the prime field of size p.
103Thus, y is a square root of x^3 + ax + b.
104Since p > 3 is odd, p - y is another square root
105with different parity, unless y is zero.
106Point compression uses that x and the parity of y are enough
107to compute y using
108.Xr BN_mod_sqrt 3 .
109.Pp
110Field elements are represented as non-negative integers < p
111in big-endian 2-complement form, zero-padded on the left to the byte
112length l of p.
113If X and Y are the representations of x and y, respectively, and P is
114the parity bit of y, the three encodings of the point (x, y) are
115the byte strings:
116.Bl -column "EncodingX" "CompressedX" "UncompressedX" "Hybrid" -offset indent -compact
117.It Ta Em Compressed Ta Em Uncompressed Ta Em Hybrid
118.It Encoding Ta 2+P || X Ta 4 || X || Y Ta 6+P || X || Y
119.It Length Ta 1 + l Ta 1 + 2l Ta 1 + 2l
120.El
121where the first octet is the point conversion form
122combined with the parity bit in the compressed and hybrid encodings.
123The point at infinity is encoded as a single zero byte.
124.Pp
125.Fn EC_POINT_point2oct
126converts
127.Fa point
128into the octet string encoding of type
129.Fa form .
130It assumes without checking that
131.Fa point
132is a point on the elliptic curve represented by
133.Fa group
134and operates in two modes depending on the
135.Fa buf
136argument.
137If
138.Fa buf
139is
140.Dv NULL ,
141.Fn EC_POINT_point2oct
142returns the length of
143.Fa point Ns 's
144encoding of type
145.Fa form
146and ignores the
147.Fa len
148and
149.Fa ctx
150arguments.
151If
152.Fa buf
153is not
154.Dv NULL
155and its length
156.Fa len
157is sufficiently big,
158.Fn EC_POINT_point2oct
159writes the
160.Fa point Ns 's
161encoding of type
162.Fa form
163to
164.Fa buf
165and returns the number of bytes written.
166Unless
167.Fa point
168is the point at infinity, the coordinates to be encoded are calculated using
169.Xr EC_POINT_get_affine_coordinates 3 .
170.Pp
171.Fn EC_POINT_oct2point
172decodes the octet string representation of a point on
173.Fa group
174in
175.Fa buf
176of size
177.Fa len
178and, if it represents a point on
179.Fa group ,
180sets it on the caller-provided
181.Fa point
182using
183.Xr EC_POINT_set_to_infinity 3
184.Xr EC_POINT_set_compressed_coordinates 3 ,
185or
186.Xr EC_POINT_set_affine_coordinates 3 .
187For hybrid encoding the consistency of
188the parity bit in the leading octet is verified.
189.Pp
190.Fn EC_POINT_point2bn
191returns a
192.Vt BIGNUM
193containing the encoding of type
194.Fa form
195of the
196.Fa point
197on
198.Fa group .
199If
200.Fa bn
201is
202.Dv NULL ,
203this
204.Vt BIGNUM
205is newly allocated, otherwise the result is copied into
206.Fa bn
207and returned.
208.Fn EC_POINT_point2bn
209is equivalent to
210.Fn EC_POINT_point2oct
211followed by
212.Xr BN_bin2bn 3 .
213.Pp
214.Fn EC_POINT_bn2point
215assumes that
216.Fa bn
217contains the encoding of a point on
218.Fa group .
219If
220.Fa point
221is
222.Dv NULL ,
223the result is placed in a newly allocated
224.Vt EC_POINT ,
225otherwise the result is placed in
226.Fa point
227which is then returned.
228.Fn EC_POINT_bn2point
229is equivalent to
230.Xr BN_bn2bin 3
231followed by
232.Fn EC_POINT_oct2point .
233.Pp
234.Fn EC_POINT_point2hex
235returns a printable string containing the hexadecimal encoding of
236the point encoding of type
237.Fa form
238of the
239.Fa point
240on
241.Fa group .
242The string must be freed by the caller using
243.Xr free 3 .
244.Fn EC_POINT_point2hex
245is equivalent to
246.Fn EC_POINT_point2bn
247followed by
248.Xr BN_bn2hex 3 .
249.Pp
250.Fn EC_POINT_hex2point
251interprets
252.Fa hex
253as a hexadecimal encoding of the point encoding of a point on
254.Fa group .
255If
256.Fa point
257is
258.Dv NULL ,
259the result is returned in a newly allocated
260.Vt EC_POINT ,
261otherwise the result is copied into
262.Fa point ,
263which is then returned.
264.Fn EC_POINT_hex2point
265is equivalent to
266.Xr BN_hex2bn 3
267followed by
268.Fn EC_POINT_bn2point .
269.Sh RETURN VALUES
270If
271.Fa buf
272is
273.Dv NULL ,
274.Fn EC_POINT_point2oct
275returns the length needed to encode the
276.Fa point
277on
278.Fa group ,
279or 0 on error.
280If
281.Fa buf
282is not
283.Dv NULL ,
284.Fn EC_POINT_point2oct
285returns the number of bytes written to
286.Fa buf
287or 0 on error.
288Error conditions include that
289.Fa form
290is invalid,
291.Fa len
292is too small, and memory allocation failure.
293.Pp
294.Fn EC_POINT_oct2point
295returns 1 on success and 0 on error.
296Error conditions include invalid encoding,
297.Fa buf
298does not represent a point on
299.Fa group ,
300or memory allocation failure.
301.Pp
302.Fn EC_POINT_point2bn
303returns a
304.Vt BIGNUM
305containing the encoding of
306.Fa point
307or
308.Dv NULL
309on error.
310The returned
311.Vt BIGNUM
312is either
313.Fa bn
314or a newly allocated one which must be freed by the caller.
315Error conditions include those of
316.Fn EC_POINT_point2oct ,
317.Xr BN_bn2bin 3 ,
318or memory allocation failure.
319.Pp
320.Fn EC_POINT_bn2point
321returns an
322.Vt EC_POINT
323corresponding to the encoding in
324.Fa bn
325or
326.Dv NULL
327on error.
328The returned
329.Vt EC_POINT
330is either
331.Fa point
332or a newly allocated one which must be freed by the caller.
333Error conditions include those of
334.Xr BN_bn2bin 3 ,
335.Fn EC_POINT_oct2point ,
336or memory allocation failure.
337.Pp
338.Fn EC_POINT_point2hex
339returns a newly allocated string or
340.Dv NULL
341on error.
342Error conditions include those of
343.Fn EC_POINT_point2bn
344or
345.Xr BN_bn2hex 3 .
346.Pp
347.Fn EC_POINT_hex2point
348returns an
349.Vt EC_POINT
350containing the decoded point on
351.Fa group
352or
353.Dv NULL
354on error.
355The returned
356.Vt EC_POINT
357is either
358.Fa point
359or a newly allocated one which must be freed by the caller.
360Error conditions are those of
361.Xr BN_hex2bn 3 ,
362or
363.Fn EC_POINT_bn2point .
364.Sh SEE ALSO
365.Xr BN_mod_sqrt 3 ,
366.Xr BN_new 3 ,
367.Xr BN_num_bits 3 ,
368.Xr crypto 3 ,
369.Xr d2i_ECPKParameters 3 ,
370.Xr EC_GROUP_check 3 ,
371.Xr EC_GROUP_get_curve_name 3 ,
372.Xr EC_GROUP_new_by_curve_name 3 ,
373.Xr EC_GROUP_new_curve_GFp 3 ,
374.Xr EC_KEY_METHOD_new 3 ,
375.Xr EC_KEY_new 3 ,
376.Xr EC_POINT_add 3 ,
377.Xr EC_POINT_get_affine_coordinates 3 ,
378.Xr EC_POINT_new 3 ,
379.Xr ECDH_compute_key 3 ,
380.Xr ECDSA_SIG_new 3
381.Sh STANDARDS
382.Rs
383.%T SEC 1: Elliptic Curve Cryptography, Version 2.0
384.%U https://www.secg.org/sec1-v2.pdf
385.%D May 21, 2009
386.Re
387.Sh HISTORY
388.Fn EC_POINT_point2oct
389and
390.Fn EC_POINT_oct2point
391first appeared in OpenSSL 0.9.7 and have been available since
392.Ox 3.2 .
393.Pp
394.Fn EC_POINT_point2bn ,
395.Fn EC_POINT_bn2point ,
396.Fn EC_POINT_point2hex ,
397and
398.Fn EC_POINT_hex2point
399first appeared in OpenSSL 0.9.8 and have been available since
400.Ox 4.5 .
401.Sh BUGS
402The
403.Vt point_conversion_form_t
404is not properly exposed in the API.
405There is no representation for the point at infinity nor is there
406an API interface for the parity bit,
407forcing applications to invent their own and do bit twiddling in buffers.
408.Pp
409The poorly chosen signatures of the functions in this manual result
410in an unergonomic API, particularly so for
411.Fn EC_POINT_point2oct
412and
413.Fn EC_POINT_oct2point .
414Due to fundamental misdesign in the EC library,
415points are not directly linked to the curve they live on.
416Adding checks that
417.Fa point
418lives on
419.Fa group
420is too expensive and intrusive, so it is and will continue to be easy
421to make the EC_POINT_point2* API output nonsense.
422.Pp
423.Fn EC_POINT_point2bn
424and
425.Fn EC_POINT_bn2point
426make no sense.
427They abuse
428.Vt BIGNUM
429as a vector type, which is in poor taste.
430.Pp
431.Fn EC_POINT_point2hex
432and
433.Fn EC_POINT_hex2point
434use a non-standard encoding format.
diff --git a/src/lib/libcrypto/man/ENGINE_new.3 b/src/lib/libcrypto/man/ENGINE_new.3
index 55ed963563..f70adecc17 100644
--- a/src/lib/libcrypto/man/ENGINE_new.3
+++ b/src/lib/libcrypto/man/ENGINE_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ENGINE_new.3,v 1.10 2023/11/19 21:13:47 tb Exp $ 1.\" $OpenBSD: ENGINE_new.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> 3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
4.\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org> 4.\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,7 +15,7 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 17.\"
18.Dd $Mdocdate: November 19 2023 $ 18.Dd $Mdocdate: June 8 2025 $
19.Dt ENGINE_NEW 3 19.Dt ENGINE_NEW 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
@@ -40,6 +40,7 @@
40.Nm ENGINE_cleanup 40.Nm ENGINE_cleanup
41.Nd ENGINE stub functions 41.Nd ENGINE stub functions
42.Sh SYNOPSIS 42.Sh SYNOPSIS
43.Lb libcrypto
43.In openssl/engine.h 44.In openssl/engine.h
44.Ft ENGINE * 45.Ft ENGINE *
45.Fn ENGINE_new void 46.Fn ENGINE_new void
diff --git a/src/lib/libcrypto/man/ERR.3 b/src/lib/libcrypto/man/ERR.3
index 8f17e7a329..7d67c4f556 100644
--- a/src/lib/libcrypto/man/ERR.3
+++ b/src/lib/libcrypto/man/ERR.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ERR.3,v 1.11 2023/07/26 20:15:51 tb Exp $ 1.\" $OpenBSD: ERR.3,v 1.12 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL 186bb907 Apr 13 11:05:13 2015 -0700 2.\" OpenSSL 186bb907 Apr 13 11:05:13 2015 -0700
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org> and 4.\" This file was written by Ulf Moeller <ulf@openssl.org> and
@@ -49,13 +49,14 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: July 26 2023 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt ERR 3 53.Dt ERR 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
56.Nm ERR 56.Nm ERR
57.Nd OpenSSL error codes 57.Nd OpenSSL error codes
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libcrypto
59.In openssl/err.h 60.In openssl/err.h
60.Sh DESCRIPTION 61.Sh DESCRIPTION
61When a call to the OpenSSL library fails, this is usually signaled by 62When a call to the OpenSSL library fails, this is usually signaled by
diff --git a/src/lib/libcrypto/man/ERR_GET_LIB.3 b/src/lib/libcrypto/man/ERR_GET_LIB.3
index bc14f0e2ac..754f7fafe3 100644
--- a/src/lib/libcrypto/man/ERR_GET_LIB.3
+++ b/src/lib/libcrypto/man/ERR_GET_LIB.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ERR_GET_LIB.3,v 1.7 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: ERR_GET_LIB.3,v 1.8 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL doc/man3/ERR_GET_LIB.pod 3dfda1a6 Dec 12 11:14:40 2016 -0500 2.\" OpenSSL doc/man3/ERR_GET_LIB.pod 3dfda1a6 Dec 12 11:14:40 2016 -0500
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt ERR_GET_LIB 3 52.Dt ERR_GET_LIB 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -58,6 +58,7 @@
58.Nm ERR_FATAL_ERROR 58.Nm ERR_FATAL_ERROR
59.Nd get library, function and reason codes for OpenSSL errors 59.Nd get library, function and reason codes for OpenSSL errors
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libcrypto
61.In openssl/err.h 62.In openssl/err.h
62.Ft int 63.Ft int
63.Fo ERR_GET_LIB 64.Fo ERR_GET_LIB
diff --git a/src/lib/libcrypto/man/ERR_asprintf_error_data.3 b/src/lib/libcrypto/man/ERR_asprintf_error_data.3
index 4291dea23e..edd8655d6d 100644
--- a/src/lib/libcrypto/man/ERR_asprintf_error_data.3
+++ b/src/lib/libcrypto/man/ERR_asprintf_error_data.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ERR_asprintf_error_data.3,v 1.3 2024/08/29 20:23:21 tb Exp $ 1.\" $OpenBSD: ERR_asprintf_error_data.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2017 Bob Beck <beck@openbsd.org> 3.\" Copyright (c) 2017 Bob Beck <beck@openbsd.org>
4.\" 4.\"
@@ -13,13 +13,14 @@
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.Dd $Mdocdate: August 29 2024 $ 16.Dd $Mdocdate: June 8 2025 $
17.Dt ERR_ASPRINTF_ERROR_DATA 3 17.Dt ERR_ASPRINTF_ERROR_DATA 3
18.Os 18.Os
19.Sh NAME 19.Sh NAME
20.Nm ERR_asprintf_error_data 20.Nm ERR_asprintf_error_data
21.Nd record a LibreSSL error using a formatted string 21.Nd record a LibreSSL error using a formatted string
22.Sh SYNOPSIS 22.Sh SYNOPSIS
23.Lb libcrypto
23.In openssl/err.h 24.In openssl/err.h
24.Ft void 25.Ft void
25.Fo ERR_asprintf_error_data 26.Fo ERR_asprintf_error_data
diff --git a/src/lib/libcrypto/man/ERR_clear_error.3 b/src/lib/libcrypto/man/ERR_clear_error.3
index 54f563e166..d39ac11956 100644
--- a/src/lib/libcrypto/man/ERR_clear_error.3
+++ b/src/lib/libcrypto/man/ERR_clear_error.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ERR_clear_error.3,v 1.5 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: ERR_clear_error.3,v 1.6 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt ERR_CLEAR_ERROR 3 52.Dt ERR_CLEAR_ERROR 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm ERR_clear_error 55.Nm ERR_clear_error
56.Nd clear the OpenSSL error queue 56.Nd clear the OpenSSL error queue
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/err.h 59.In openssl/err.h
59.Ft void 60.Ft void
60.Fn ERR_clear_error void 61.Fn ERR_clear_error void
diff --git a/src/lib/libcrypto/man/ERR_error_string.3 b/src/lib/libcrypto/man/ERR_error_string.3
index 60f9132859..a1df20fe70 100644
--- a/src/lib/libcrypto/man/ERR_error_string.3
+++ b/src/lib/libcrypto/man/ERR_error_string.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ERR_error_string.3,v 1.7 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: ERR_error_string.3,v 1.8 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt ERR_ERROR_STRING 3 52.Dt ERR_ERROR_STRING 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -59,6 +59,7 @@
59.Nm ERR_reason_error_string 59.Nm ERR_reason_error_string
60.Nd obtain human-readable OpenSSL error messages 60.Nd obtain human-readable OpenSSL error messages
61.Sh SYNOPSIS 61.Sh SYNOPSIS
62.Lb libcrypto
62.In openssl/err.h 63.In openssl/err.h
63.Ft char * 64.Ft char *
64.Fo ERR_error_string 65.Fo ERR_error_string
diff --git a/src/lib/libcrypto/man/ERR_get_error.3 b/src/lib/libcrypto/man/ERR_get_error.3
index f3bcc09cbc..c592c34528 100644
--- a/src/lib/libcrypto/man/ERR_get_error.3
+++ b/src/lib/libcrypto/man/ERR_get_error.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ERR_get_error.3,v 1.8 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: ERR_get_error.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt ERR_GET_ERROR 3 52.Dt ERR_GET_ERROR 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -63,6 +63,7 @@
63.Nm ERR_peek_last_error_line_data 63.Nm ERR_peek_last_error_line_data
64.Nd obtain OpenSSL error code and data 64.Nd obtain OpenSSL error code and data
65.Sh SYNOPSIS 65.Sh SYNOPSIS
66.Lb libcrypto
66.In openssl/err.h 67.In openssl/err.h
67.Ft unsigned long 68.Ft unsigned long
68.Fn ERR_get_error void 69.Fn ERR_get_error void
diff --git a/src/lib/libcrypto/man/ERR_load_crypto_strings.3 b/src/lib/libcrypto/man/ERR_load_crypto_strings.3
index 2bca8af60f..13da93e22d 100644
--- a/src/lib/libcrypto/man/ERR_load_crypto_strings.3
+++ b/src/lib/libcrypto/man/ERR_load_crypto_strings.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ERR_load_crypto_strings.3,v 1.12 2024/03/05 19:21:31 tb Exp $ 1.\" $OpenBSD: ERR_load_crypto_strings.3,v 1.14 2025/06/08 22:58:09 schwarze Exp $
2.\" full merge up to: OpenSSL f672aee4 Feb 9 11:52:40 2016 -0500 2.\" full merge up to: OpenSSL f672aee4 Feb 9 11:52:40 2016 -0500
3.\" selective merge up to: OpenSSL b3696a55 Sep 2 09:35:50 2017 -0400 3.\" selective merge up to: OpenSSL b3696a55 Sep 2 09:35:50 2017 -0400
4.\" 4.\"
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: March 5 2024 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt ERR_LOAD_CRYPTO_STRINGS 3 70.Dt ERR_LOAD_CRYPTO_STRINGS 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -101,11 +101,14 @@
101.\" ERR_load_X509_strings() 101.\" ERR_load_X509_strings()
102.\" ERR_load_X509V3_strings() 102.\" ERR_load_X509V3_strings()
103.Sh SYNOPSIS 103.Sh SYNOPSIS
104.Lb libcrypto
104.In openssl/err.h 105.In openssl/err.h
105.Ft void 106.Ft void
106.Fn ERR_load_crypto_strings void 107.Fn ERR_load_crypto_strings void
107.Ft void 108.Ft void
108.Fn ERR_free_strings void 109.Fn ERR_free_strings void
110.Pp
111.Lb libssl libcrypto
109.In openssl/ssl.h 112.In openssl/ssl.h
110.Ft void 113.Ft void
111.Fn SSL_load_error_strings void 114.Fn SSL_load_error_strings void
diff --git a/src/lib/libcrypto/man/ERR_load_strings.3 b/src/lib/libcrypto/man/ERR_load_strings.3
index 1020743954..9697742404 100644
--- a/src/lib/libcrypto/man/ERR_load_strings.3
+++ b/src/lib/libcrypto/man/ERR_load_strings.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ERR_load_strings.3,v 1.8 2024/07/26 03:40:43 tb Exp $ 1.\" $OpenBSD: ERR_load_strings.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL 05ea606a May 20 20:52:46 2016 -0400 2.\" OpenSSL 05ea606a May 20 20:52:46 2016 -0400
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: July 26 2024 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt ERR_LOAD_STRINGS 3 52.Dt ERR_LOAD_STRINGS 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -57,6 +57,7 @@
57.Nm ERR_get_next_error_library 57.Nm ERR_get_next_error_library
58.Nd load arbitrary OpenSSL error strings 58.Nd load arbitrary OpenSSL error strings
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/err.h 61.In openssl/err.h
61.Ft void 62.Ft void
62.Fo ERR_load_strings 63.Fo ERR_load_strings
diff --git a/src/lib/libcrypto/man/ERR_print_errors.3 b/src/lib/libcrypto/man/ERR_print_errors.3
index a5c7c03287..4d6f8d3717 100644
--- a/src/lib/libcrypto/man/ERR_print_errors.3
+++ b/src/lib/libcrypto/man/ERR_print_errors.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ERR_print_errors.3,v 1.8 2020/03/28 22:40:58 schwarze Exp $ 1.\" $OpenBSD: ERR_print_errors.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>, 4.\" This file was written by Ulf Moeller <ulf@openssl.org>,
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: March 28 2020 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt ERR_PRINT_ERRORS 3 53.Dt ERR_PRINT_ERRORS 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -58,6 +58,7 @@
58.Nm ERR_print_errors_cb 58.Nm ERR_print_errors_cb
59.Nd print OpenSSL error messages 59.Nd print OpenSSL error messages
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libcrypto
61.In openssl/err.h 62.In openssl/err.h
62.Ft void 63.Ft void
63.Fo ERR_print_errors 64.Fo ERR_print_errors
diff --git a/src/lib/libcrypto/man/ERR_put_error.3 b/src/lib/libcrypto/man/ERR_put_error.3
index 37e1b4d1ab..1af0e37826 100644
--- a/src/lib/libcrypto/man/ERR_put_error.3
+++ b/src/lib/libcrypto/man/ERR_put_error.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ERR_put_error.3,v 1.11 2024/08/29 20:23:21 tb Exp $ 1.\" $OpenBSD: ERR_put_error.3,v 1.12 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: August 29 2024 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt ERR_PUT_ERROR 3 52.Dt ERR_PUT_ERROR 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm ERR_put_error 55.Nm ERR_put_error
56.Nd record an OpenSSL error 56.Nd record an OpenSSL error
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/err.h 59.In openssl/err.h
59.Ft void 60.Ft void
60.Fo ERR_put_error 61.Fo ERR_put_error
diff --git a/src/lib/libcrypto/man/ERR_remove_state.3 b/src/lib/libcrypto/man/ERR_remove_state.3
index bc28f15dea..c05810d778 100644
--- a/src/lib/libcrypto/man/ERR_remove_state.3
+++ b/src/lib/libcrypto/man/ERR_remove_state.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ERR_remove_state.3,v 1.7 2020/03/28 22:40:58 schwarze Exp $ 1.\" $OpenBSD: ERR_remove_state.3,v 1.8 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 2.\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org> and 4.\" This file was written by Ulf Moeller <ulf@openssl.org> and
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: March 28 2020 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt ERR_REMOVE_STATE 3 53.Dt ERR_REMOVE_STATE 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -57,6 +57,7 @@
57.Nm ERR_remove_state 57.Nm ERR_remove_state
58.Nd free a thread's OpenSSL error queue 58.Nd free a thread's OpenSSL error queue
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/err.h 61.In openssl/err.h
61.Ft void 62.Ft void
62.Fo ERR_remove_thread_state 63.Fo ERR_remove_thread_state
diff --git a/src/lib/libcrypto/man/ERR_set_mark.3 b/src/lib/libcrypto/man/ERR_set_mark.3
index 2f3486d8c0..88b1be88b5 100644
--- a/src/lib/libcrypto/man/ERR_set_mark.3
+++ b/src/lib/libcrypto/man/ERR_set_mark.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ERR_set_mark.3,v 1.4 2018/03/23 00:09:11 schwarze Exp $ 1.\" $OpenBSD: ERR_set_mark.3,v 1.5 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Richard Levitte <levitte@openssl.org>. 4.\" This file was written by Richard Levitte <levitte@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 23 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt ERR_SET_MARK 3 52.Dt ERR_SET_MARK 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -56,6 +56,7 @@
56.Nm ERR_pop_to_mark 56.Nm ERR_pop_to_mark
57.Nd set marks and pop OpenSSL errors until mark 57.Nd set marks and pop OpenSSL errors until mark
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libcrypto
59.In openssl/err.h 60.In openssl/err.h
60.Ft int 61.Ft int
61.Fn ERR_set_mark void 62.Fn ERR_set_mark void
diff --git a/src/lib/libcrypto/man/ESS_SIGNING_CERT_new.3 b/src/lib/libcrypto/man/ESS_SIGNING_CERT_new.3
index 4baabbcd99..7014d008af 100644
--- a/src/lib/libcrypto/man/ESS_SIGNING_CERT_new.3
+++ b/src/lib/libcrypto/man/ESS_SIGNING_CERT_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ESS_SIGNING_CERT_new.3,v 1.5 2019/06/06 01:06:58 schwarze Exp $ 1.\" $OpenBSD: ESS_SIGNING_CERT_new.3,v 1.6 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 6 2019 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt ESS_SIGNING_CERT_NEW 3 18.Dt ESS_SIGNING_CERT_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -26,6 +26,7 @@
26.Nm ESS_ISSUER_SERIAL_free 26.Nm ESS_ISSUER_SERIAL_free
27.Nd signing certificates for S/MIME 27.Nd signing certificates for S/MIME
28.Sh SYNOPSIS 28.Sh SYNOPSIS
29.Lb libcrypto
29.In openssl/ts.h 30.In openssl/ts.h
30.Ft ESS_SIGNING_CERT * 31.Ft ESS_SIGNING_CERT *
31.Fn ESS_SIGNING_CERT_new void 32.Fn ESS_SIGNING_CERT_new void
diff --git a/src/lib/libcrypto/man/EVP_AEAD_CTX_init.3 b/src/lib/libcrypto/man/EVP_AEAD_CTX_init.3
index 8b3b8adb0f..41a829c675 100644
--- a/src/lib/libcrypto/man/EVP_AEAD_CTX_init.3
+++ b/src/lib/libcrypto/man/EVP_AEAD_CTX_init.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_AEAD_CTX_init.3,v 1.16 2024/07/21 08:36:43 tb Exp $ 1.\" $OpenBSD: EVP_AEAD_CTX_init.3,v 1.17 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2014, Google Inc. 3.\" Copyright (c) 2014, Google Inc.
4.\" Parts of the text were written by Adam Langley and David Benjamin. 4.\" Parts of the text were written by Adam Langley and David Benjamin.
@@ -17,7 +17,7 @@
17.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19.\" 19.\"
20.Dd $Mdocdate: July 21 2024 $ 20.Dd $Mdocdate: June 8 2025 $
21.Dt EVP_AEAD_CTX_INIT 3 21.Dt EVP_AEAD_CTX_INIT 3
22.Os 22.Os
23.Sh NAME 23.Sh NAME
@@ -37,6 +37,7 @@
37.Nm EVP_aead_xchacha20_poly1305 37.Nm EVP_aead_xchacha20_poly1305
38.Nd authenticated encryption with additional data 38.Nd authenticated encryption with additional data
39.Sh SYNOPSIS 39.Sh SYNOPSIS
40.Lb libcrypto
40.In openssl/evp.h 41.In openssl/evp.h
41.Ft EVP_AEAD_CTX * 42.Ft EVP_AEAD_CTX *
42.Fn EVP_AEAD_CTX_new void 43.Fn EVP_AEAD_CTX_new void
diff --git a/src/lib/libcrypto/man/EVP_BytesToKey.3 b/src/lib/libcrypto/man/EVP_BytesToKey.3
index 1f78b4de06..060335744e 100644
--- a/src/lib/libcrypto/man/EVP_BytesToKey.3
+++ b/src/lib/libcrypto/man/EVP_BytesToKey.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_BytesToKey.3,v 1.9 2024/12/05 15:12:37 schwarze Exp $ 1.\" $OpenBSD: EVP_BytesToKey.3,v 1.10 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -49,13 +49,14 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: December 5 2024 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt EVP_BYTESTOKEY 3 53.Dt EVP_BYTESTOKEY 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
56.Nm EVP_BytesToKey 56.Nm EVP_BytesToKey
57.Nd password based encryption routine 57.Nd password based encryption routine
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libcrypto
59.In openssl/evp.h 60.In openssl/evp.h
60.Ft int 61.Ft int
61.Fo EVP_BytesToKey 62.Fo EVP_BytesToKey
diff --git a/src/lib/libcrypto/man/EVP_CIPHER_CTX_ctrl.3 b/src/lib/libcrypto/man/EVP_CIPHER_CTX_ctrl.3
index a75b722cd4..8aaf2cc385 100644
--- a/src/lib/libcrypto/man/EVP_CIPHER_CTX_ctrl.3
+++ b/src/lib/libcrypto/man/EVP_CIPHER_CTX_ctrl.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_CIPHER_CTX_ctrl.3,v 1.3 2024/12/08 17:41:23 schwarze Exp $ 1.\" $OpenBSD: EVP_CIPHER_CTX_ctrl.3,v 1.5 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 5211e094 Nov 11 14:39:11 2014 -0800 2.\" full merge up to: OpenSSL 5211e094 Nov 11 14:39:11 2014 -0800
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -67,7 +67,7 @@
67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
69.\" 69.\"
70.Dd $Mdocdate: December 8 2024 $ 70.Dd $Mdocdate: June 8 2025 $
71.Dt EVP_CIPHER_CTX_CTRL 3 71.Dt EVP_CIPHER_CTX_CTRL 3
72.Os 72.Os
73.Sh NAME 73.Sh NAME
@@ -82,6 +82,7 @@
82.Nm EVP_CIPHER_CTX_get_iv 82.Nm EVP_CIPHER_CTX_get_iv
83.Nd configure EVP cipher contexts 83.Nd configure EVP cipher contexts
84.Sh SYNOPSIS 84.Sh SYNOPSIS
85.Lb libcrypto
85.In openssl/evp.h 86.In openssl/evp.h
86.Ft int 87.Ft int
87.Fo EVP_CIPHER_CTX_ctrl 88.Fo EVP_CIPHER_CTX_ctrl
@@ -198,13 +199,8 @@ IV length for the context as returned by
198.Fn EVP_CIPHER_CTX_iv_length . 199.Fn EVP_CIPHER_CTX_iv_length .
199.Sh RETURN VALUES 200.Sh RETURN VALUES
200.Fn EVP_CIPHER_CTX_ctrl 201.Fn EVP_CIPHER_CTX_ctrl
201usually returns 1 for success, 0 for failure, or \-1 if the 202returns 1 for success or 0 for failure.
202.Fa type 203Some implementations may return negative values for some errors.
203is not supported by the
204.Fa ctx ,
205but there may be exceptions for some
206.Fa type
207arguments.
208.Pp 204.Pp
209.Fn EVP_CIPHER_CTX_set_padding 205.Fn EVP_CIPHER_CTX_set_padding
210always returns 1. 206always returns 1.
diff --git a/src/lib/libcrypto/man/EVP_CIPHER_CTX_get_cipher_data.3 b/src/lib/libcrypto/man/EVP_CIPHER_CTX_get_cipher_data.3
index 4f75c8b008..a549ea25f6 100644
--- a/src/lib/libcrypto/man/EVP_CIPHER_CTX_get_cipher_data.3
+++ b/src/lib/libcrypto/man/EVP_CIPHER_CTX_get_cipher_data.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_CIPHER_CTX_get_cipher_data.3,v 1.3 2023/08/26 15:12:04 schwarze Exp $ 1.\" $OpenBSD: EVP_CIPHER_CTX_get_cipher_data.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: August 26 2023 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt EVP_CIPHER_CTX_GET_CIPHER_DATA 3 69.Dt EVP_CIPHER_CTX_GET_CIPHER_DATA 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -74,6 +74,7 @@
74.Nm EVP_CIPHER_CTX_buf_noconst 74.Nm EVP_CIPHER_CTX_buf_noconst
75.Nd inspect and modify EVP_CIPHER_CTX objects 75.Nd inspect and modify EVP_CIPHER_CTX objects
76.Sh SYNOPSIS 76.Sh SYNOPSIS
77.Lb libcrypto
77.In openssl/evp.h 78.In openssl/evp.h
78.Ft void * 79.Ft void *
79.Fo EVP_CIPHER_CTX_get_cipher_data 80.Fo EVP_CIPHER_CTX_get_cipher_data
diff --git a/src/lib/libcrypto/man/EVP_CIPHER_CTX_init.3 b/src/lib/libcrypto/man/EVP_CIPHER_CTX_init.3
index 79a8e540af..7b1d81bafa 100644
--- a/src/lib/libcrypto/man/EVP_CIPHER_CTX_init.3
+++ b/src/lib/libcrypto/man/EVP_CIPHER_CTX_init.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_CIPHER_CTX_init.3,v 1.4 2024/12/06 15:01:01 schwarze Exp $ 1.\" $OpenBSD: EVP_CIPHER_CTX_init.3,v 1.5 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL EVP_EncryptInit.pod 0874d7f2 Oct 11 13:13:47 2022 +0100 3.\" OpenSSL EVP_EncryptInit.pod 0874d7f2 Oct 11 13:13:47 2022 +0100
4.\" 4.\"
@@ -68,7 +68,7 @@
68.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 68.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
69.\" OF THE POSSIBILITY OF SUCH DAMAGE. 69.\" OF THE POSSIBILITY OF SUCH DAMAGE.
70.\" 70.\"
71.Dd $Mdocdate: December 6 2024 $ 71.Dd $Mdocdate: June 8 2025 $
72.Dt EVP_CIPHER_CTX_INIT 3 72.Dt EVP_CIPHER_CTX_INIT 3
73.Os 73.Os
74.Sh NAME 74.Sh NAME
@@ -77,6 +77,7 @@
77.Nm EVP_Cipher 77.Nm EVP_Cipher
78.Nd obsolete EVP cipher functions 78.Nd obsolete EVP cipher functions
79.Sh SYNOPSIS 79.Sh SYNOPSIS
80.Lb libcrypto
80.In openssl/evp.h 81.In openssl/evp.h
81.Ft int 82.Ft int
82.Fo EVP_CIPHER_CTX_init 83.Fo EVP_CIPHER_CTX_init
diff --git a/src/lib/libcrypto/man/EVP_CIPHER_CTX_set_flags.3 b/src/lib/libcrypto/man/EVP_CIPHER_CTX_set_flags.3
index 67ef8679bc..0d86050ae6 100644
--- a/src/lib/libcrypto/man/EVP_CIPHER_CTX_set_flags.3
+++ b/src/lib/libcrypto/man/EVP_CIPHER_CTX_set_flags.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_CIPHER_CTX_set_flags.3,v 1.2 2023/09/06 16:26:49 schwarze Exp $ 1.\" $OpenBSD: EVP_CIPHER_CTX_set_flags.3,v 1.3 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 5211e094 Nov 11 14:39:11 2014 -0800 2.\" full merge up to: OpenSSL 5211e094 Nov 11 14:39:11 2014 -0800
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -67,7 +67,7 @@
67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
69.\" 69.\"
70.Dd $Mdocdate: September 6 2023 $ 70.Dd $Mdocdate: June 8 2025 $
71.Dt EVP_CIPHER_CTX_SET_FLAGS 3 71.Dt EVP_CIPHER_CTX_SET_FLAGS 3
72.Os 72.Os
73.Sh NAME 73.Sh NAME
@@ -86,6 +86,7 @@
86.Nm EVP_CIPHER_CTX_set_app_data 86.Nm EVP_CIPHER_CTX_set_app_data
87.Nd unusual EVP cipher context configuration 87.Nd unusual EVP cipher context configuration
88.Sh SYNOPSIS 88.Sh SYNOPSIS
89.Lb libcrypto
89.In openssl/evp.h 90.In openssl/evp.h
90.Ft void 91.Ft void
91.Fo EVP_CIPHER_CTX_set_flags 92.Fo EVP_CIPHER_CTX_set_flags
diff --git a/src/lib/libcrypto/man/EVP_CIPHER_do_all.3 b/src/lib/libcrypto/man/EVP_CIPHER_do_all.3
index e912044978..342cf372df 100644
--- a/src/lib/libcrypto/man/EVP_CIPHER_do_all.3
+++ b/src/lib/libcrypto/man/EVP_CIPHER_do_all.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_CIPHER_do_all.3,v 1.3 2024/03/14 23:54:55 tb Exp $ 1.\" $OpenBSD: EVP_CIPHER_do_all.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2023,2024 Theo Buehler <tb@openbsd.org> 3.\" Copyright (c) 2023,2024 Theo Buehler <tb@openbsd.org>
4.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 4.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,7 +15,7 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 17.\"
18.Dd $Mdocdate: March 14 2024 $ 18.Dd $Mdocdate: June 8 2025 $
19.Dt EVP_CIPHER_DO_ALL 3 19.Dt EVP_CIPHER_DO_ALL 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
@@ -27,6 +27,7 @@
27.Nm OBJ_NAME_do_all_sorted 27.Nm OBJ_NAME_do_all_sorted
28.Nd iterate over lookup tables for ciphers and digests 28.Nd iterate over lookup tables for ciphers and digests
29.Sh SYNOPSIS 29.Sh SYNOPSIS
30.Lb libcrypto
30.In openssl/evp.h 31.In openssl/evp.h
31.Ft void 32.Ft void
32.Fo EVP_CIPHER_do_all 33.Fo EVP_CIPHER_do_all
diff --git a/src/lib/libcrypto/man/EVP_CIPHER_meth_new.3 b/src/lib/libcrypto/man/EVP_CIPHER_meth_new.3
index 187dab6d8a..f831b20c3d 100644
--- a/src/lib/libcrypto/man/EVP_CIPHER_meth_new.3
+++ b/src/lib/libcrypto/man/EVP_CIPHER_meth_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_CIPHER_meth_new.3,v 1.6 2024/03/04 09:49:07 tb Exp $ 1.\" $OpenBSD: EVP_CIPHER_meth_new.3,v 1.7 2025/06/08 22:40:29 schwarze Exp $
2.\" selective merge up to: OpenSSL b0edda11 Mar 20 13:00:17 2018 +0000 2.\" selective merge up to: OpenSSL b0edda11 Mar 20 13:00:17 2018 +0000
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: March 4 2024 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt EVP_CIPHER_METH_NEW 3 70.Dt EVP_CIPHER_METH_NEW 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -84,6 +84,7 @@
84.Nm EVP_CIPHER_meth_set_ctrl 84.Nm EVP_CIPHER_meth_set_ctrl
85.Nd Routines to build up EVP_CIPHER methods 85.Nd Routines to build up EVP_CIPHER methods
86.Sh SYNOPSIS 86.Sh SYNOPSIS
87.Lb libcrypto
87.In openssl/evp.h 88.In openssl/evp.h
88.Ft EVP_CIPHER * 89.Ft EVP_CIPHER *
89.Fo EVP_CIPHER_meth_new 90.Fo EVP_CIPHER_meth_new
diff --git a/src/lib/libcrypto/man/EVP_CIPHER_nid.3 b/src/lib/libcrypto/man/EVP_CIPHER_nid.3
index 1feff4f34e..6152c389c8 100644
--- a/src/lib/libcrypto/man/EVP_CIPHER_nid.3
+++ b/src/lib/libcrypto/man/EVP_CIPHER_nid.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_CIPHER_nid.3,v 1.3 2023/09/05 14:54:21 schwarze Exp $ 1.\" $OpenBSD: EVP_CIPHER_nid.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL man3/EVP_EncryptInit.pod 2.\" full merge up to: OpenSSL man3/EVP_EncryptInit.pod
3.\" 0874d7f2 Oct 11 13:13:47 2022 +0100 3.\" 0874d7f2 Oct 11 13:13:47 2022 +0100
4.\" 4.\"
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: September 5 2023 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt EVP_CIPHER_NID 3 70.Dt EVP_CIPHER_NID 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -83,6 +83,7 @@
83.Nm EVP_CIPHER_CTX_mode 83.Nm EVP_CIPHER_CTX_mode
84.Nd inspect EVP_CIPHER objects 84.Nd inspect EVP_CIPHER objects
85.Sh SYNOPSIS 85.Sh SYNOPSIS
86.Lb libcrypto
86.In openssl/evp.h 87.In openssl/evp.h
87.Ft int 88.Ft int
88.Fo EVP_CIPHER_nid 89.Fo EVP_CIPHER_nid
diff --git a/src/lib/libcrypto/man/EVP_DigestInit.3 b/src/lib/libcrypto/man/EVP_DigestInit.3
index 668c189bc1..1457d65e40 100644
--- a/src/lib/libcrypto/man/EVP_DigestInit.3
+++ b/src/lib/libcrypto/man/EVP_DigestInit.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_DigestInit.3,v 1.37 2024/12/06 15:01:01 schwarze Exp $ 1.\" $OpenBSD: EVP_DigestInit.3,v 1.39 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 7f572e95 Dec 2 13:57:04 2015 +0000 2.\" full merge up to: OpenSSL 7f572e95 Dec 2 13:57:04 2015 +0000
3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
4.\" 4.\"
@@ -70,7 +70,7 @@
70.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 70.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
71.\" OF THE POSSIBILITY OF SUCH DAMAGE. 71.\" OF THE POSSIBILITY OF SUCH DAMAGE.
72.\" 72.\"
73.Dd $Mdocdate: December 6 2024 $ 73.Dd $Mdocdate: June 8 2025 $
74.Dt EVP_DIGESTINIT 3 74.Dt EVP_DIGESTINIT 3
75.Os 75.Os
76.Sh NAME 76.Sh NAME
@@ -103,6 +103,7 @@
103.Nm EVP_get_digestbyobj 103.Nm EVP_get_digestbyobj
104.Nd EVP digest routines 104.Nd EVP digest routines
105.Sh SYNOPSIS 105.Sh SYNOPSIS
106.Lb libcrypto
106.In openssl/evp.h 107.In openssl/evp.h
107.Ft EVP_MD_CTX * 108.Ft EVP_MD_CTX *
108.Fn EVP_MD_CTX_new void 109.Fn EVP_MD_CTX_new void
@@ -361,15 +362,16 @@ and
361.Fn EVP_ripemd160 362.Fn EVP_ripemd160
362return 363return
363.Vt EVP_MD 364.Vt EVP_MD
364structures for the SHA224, SHA256, SHA384, SHA512 and 365structures for the SHA-224, SHA-256, SHA-384, SHA-512 and
365RIPEMD160 digest algorithms respectively. 366RIPEMD-160 digest algorithms respectively.
366.Pp 367.Pp
367.Fn EVP_sha512_224 368.Fn EVP_sha512_224
368and 369and
369.Fn EVP_sha512_256 370.Fn EVP_sha512_256
370return an 371return an
371.Vt EVP_MD 372.Vt EVP_MD
372structure that provides the truncated SHA512 variants SHA512/224 and SHA512/256, 373structure that provides the truncated SHA-512 variants
374SHA-512/224 and SHA-512/256,
373respectively. 375respectively.
374.Pp 376.Pp
375.Fn EVP_md_null 377.Fn EVP_md_null
diff --git a/src/lib/libcrypto/man/EVP_DigestSignInit.3 b/src/lib/libcrypto/man/EVP_DigestSignInit.3
index caf519e28c..46b8acbd3c 100644
--- a/src/lib/libcrypto/man/EVP_DigestSignInit.3
+++ b/src/lib/libcrypto/man/EVP_DigestSignInit.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_DigestSignInit.3,v 1.15 2024/12/06 14:27:49 schwarze Exp $ 1.\" $OpenBSD: EVP_DigestSignInit.3,v 1.16 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 28428130 Apr 17 15:18:40 2018 +0200 2.\" full merge up to: OpenSSL 28428130 Apr 17 15:18:40 2018 +0200
3.\" selective merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200 3.\" selective merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200
4.\" 4.\"
@@ -50,7 +50,7 @@
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\" 52.\"
53.Dd $Mdocdate: December 6 2024 $ 53.Dd $Mdocdate: June 8 2025 $
54.Dt EVP_DIGESTSIGNINIT 3 54.Dt EVP_DIGESTSIGNINIT 3
55.Os 55.Os
56.Sh NAME 56.Sh NAME
@@ -60,6 +60,7 @@
60.Nm EVP_DigestSign 60.Nm EVP_DigestSign
61.Nd EVP signing functions 61.Nd EVP signing functions
62.Sh SYNOPSIS 62.Sh SYNOPSIS
63.Lb libcrypto
63.In openssl/evp.h 64.In openssl/evp.h
64.Ft int 65.Ft int
65.Fo EVP_DigestSignInit 66.Fo EVP_DigestSignInit
diff --git a/src/lib/libcrypto/man/EVP_DigestVerifyInit.3 b/src/lib/libcrypto/man/EVP_DigestVerifyInit.3
index fa62f5a0a5..3d40f8e916 100644
--- a/src/lib/libcrypto/man/EVP_DigestVerifyInit.3
+++ b/src/lib/libcrypto/man/EVP_DigestVerifyInit.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_DigestVerifyInit.3,v 1.17 2024/12/06 14:27:49 schwarze Exp $ 1.\" $OpenBSD: EVP_DigestVerifyInit.3,v 1.18 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to OpenSSL f097e875 Aug 23 11:37:22 2018 +0100 2.\" full merge up to OpenSSL f097e875 Aug 23 11:37:22 2018 +0100
3.\" selective merge up to 24a535ea Sep 22 13:14:20 2020 +0100 3.\" selective merge up to 24a535ea Sep 22 13:14:20 2020 +0100
4.\" 4.\"
@@ -50,7 +50,7 @@
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\" 52.\"
53.Dd $Mdocdate: December 6 2024 $ 53.Dd $Mdocdate: June 8 2025 $
54.Dt EVP_DIGESTVERIFYINIT 3 54.Dt EVP_DIGESTVERIFYINIT 3
55.Os 55.Os
56.Sh NAME 56.Sh NAME
@@ -60,6 +60,7 @@
60.Nm EVP_DigestVerify 60.Nm EVP_DigestVerify
61.Nd EVP signature verification functions 61.Nd EVP signature verification functions
62.Sh SYNOPSIS 62.Sh SYNOPSIS
63.Lb libcrypto
63.In openssl/evp.h 64.In openssl/evp.h
64.Ft int 65.Ft int
65.Fo EVP_DigestVerifyInit 66.Fo EVP_DigestVerifyInit
diff --git a/src/lib/libcrypto/man/EVP_EncodeInit.3 b/src/lib/libcrypto/man/EVP_EncodeInit.3
index da79af84cf..82f5687c8b 100644
--- a/src/lib/libcrypto/man/EVP_EncodeInit.3
+++ b/src/lib/libcrypto/man/EVP_EncodeInit.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_EncodeInit.3,v 1.7 2019/06/06 01:06:58 schwarze Exp $ 1.\" $OpenBSD: EVP_EncodeInit.3,v 1.8 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL f430ba31 Jun 19 19:39:01 2016 +0200 2.\" full merge up to: OpenSSL f430ba31 Jun 19 19:39:01 2016 +0200
3.\" selective merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 3.\" selective merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
4.\" 4.\"
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: June 6 2019 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt EVP_ENCODEINIT 3 53.Dt EVP_ENCODEINIT 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -65,6 +65,7 @@
65.Nm EVP_DecodeBlock 65.Nm EVP_DecodeBlock
66.Nd EVP base64 encode/decode routines 66.Nd EVP base64 encode/decode routines
67.Sh SYNOPSIS 67.Sh SYNOPSIS
68.Lb libcrypto
68.In openssl/evp.h 69.In openssl/evp.h
69.Ft EVP_ENCODE_CTX * 70.Ft EVP_ENCODE_CTX *
70.Fn EVP_ENCODE_CTX_new void 71.Fn EVP_ENCODE_CTX_new void
diff --git a/src/lib/libcrypto/man/EVP_EncryptInit.3 b/src/lib/libcrypto/man/EVP_EncryptInit.3
index 7765be2ca6..382c0e2b06 100644
--- a/src/lib/libcrypto/man/EVP_EncryptInit.3
+++ b/src/lib/libcrypto/man/EVP_EncryptInit.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_EncryptInit.3,v 1.56 2024/12/20 01:54:03 schwarze Exp $ 1.\" $OpenBSD: EVP_EncryptInit.3,v 1.57 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 5211e094 Nov 11 14:39:11 2014 -0800 2.\" full merge up to: OpenSSL 5211e094 Nov 11 14:39:11 2014 -0800
3.\" EVP_bf_cbc.pod EVP_cast5_cbc.pod EVP_idea_cbc.pod EVP_rc2_cbc.pod 3.\" EVP_bf_cbc.pod EVP_cast5_cbc.pod EVP_idea_cbc.pod EVP_rc2_cbc.pod
4.\" 7c6d372a Nov 20 13:20:01 2018 +0000 4.\" 7c6d372a Nov 20 13:20:01 2018 +0000
@@ -69,7 +69,7 @@
69.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 69.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
70.\" OF THE POSSIBILITY OF SUCH DAMAGE. 70.\" OF THE POSSIBILITY OF SUCH DAMAGE.
71.\" 71.\"
72.Dd $Mdocdate: December 20 2024 $ 72.Dd $Mdocdate: June 8 2025 $
73.Dt EVP_ENCRYPTINIT 3 73.Dt EVP_ENCRYPTINIT 3
74.Os 74.Os
75.Sh NAME 75.Sh NAME
@@ -115,6 +115,7 @@
115.Nm EVP_cast5_ofb 115.Nm EVP_cast5_ofb
116.Nd EVP cipher routines 116.Nd EVP cipher routines
117.Sh SYNOPSIS 117.Sh SYNOPSIS
118.Lb libcrypto
118.In openssl/evp.h 119.In openssl/evp.h
119.Ft EVP_CIPHER_CTX * 120.Ft EVP_CIPHER_CTX *
120.Fn EVP_CIPHER_CTX_new void 121.Fn EVP_CIPHER_CTX_new void
diff --git a/src/lib/libcrypto/man/EVP_MD_CTX_ctrl.3 b/src/lib/libcrypto/man/EVP_MD_CTX_ctrl.3
index c8c148faf0..a16bba9bf8 100644
--- a/src/lib/libcrypto/man/EVP_MD_CTX_ctrl.3
+++ b/src/lib/libcrypto/man/EVP_MD_CTX_ctrl.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_MD_CTX_ctrl.3,v 1.3 2024/03/05 17:21:40 tb Exp $ 1.\" $OpenBSD: EVP_MD_CTX_ctrl.3,v 1.5 2025/06/11 13:48:54 schwarze Exp $
2.\" full merge up to: OpenSSL man3/EVP_DigestInit.pod 2.\" full merge up to: OpenSSL man3/EVP_DigestInit.pod
3.\" 24a535ea Sep 22 13:14:20 2020 +0100 3.\" 24a535ea Sep 22 13:14:20 2020 +0100
4.\" 4.\"
@@ -69,7 +69,7 @@
69.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 69.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
70.\" OF THE POSSIBILITY OF SUCH DAMAGE. 70.\" OF THE POSSIBILITY OF SUCH DAMAGE.
71.\" 71.\"
72.Dd $Mdocdate: March 5 2024 $ 72.Dd $Mdocdate: June 11 2025 $
73.Dt EVP_MD_CTX_CTRL 3 73.Dt EVP_MD_CTX_CTRL 3
74.Os 74.Os
75.Sh NAME 75.Sh NAME
@@ -82,6 +82,7 @@
82.Nm EVP_MD_CTX_md_data 82.Nm EVP_MD_CTX_md_data
83.Nd configure EVP message digest contexts 83.Nd configure EVP message digest contexts
84.Sh SYNOPSIS 84.Sh SYNOPSIS
85.Lb libcrypto
85.In openssl/evp.h 86.In openssl/evp.h
86.Ft int 87.Ft int
87.Fo EVP_MD_CTX_ctrl 88.Fo EVP_MD_CTX_ctrl
@@ -154,7 +155,9 @@ when it is no longer needed.
154This 155This
155.Fa command 156.Fa command
156is used by 157is used by
157.Xr SMIME_write_ASN1 3 158.Xr SMIME_write_CMS 3
159and
160.Xr SMIME_write_PKCS7 3
158when creating S/MIME multipart/signed messages as specified in RFC 3851. 161when creating S/MIME multipart/signed messages as specified in RFC 3851.
159.Pp 162.Pp
160.Fn EVP_MD_CTX_set_flags 163.Fn EVP_MD_CTX_set_flags
diff --git a/src/lib/libcrypto/man/EVP_MD_nid.3 b/src/lib/libcrypto/man/EVP_MD_nid.3
index 15806091de..384c043149 100644
--- a/src/lib/libcrypto/man/EVP_MD_nid.3
+++ b/src/lib/libcrypto/man/EVP_MD_nid.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_MD_nid.3,v 1.4 2024/03/05 17:21:40 tb Exp $ 1.\" $OpenBSD: EVP_MD_nid.3,v 1.5 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL man3/EVP_DigestInit.pod 2.\" full merge up to: OpenSSL man3/EVP_DigestInit.pod
3.\" 24a535ea Sep 22 13:14:20 2020 +0100 3.\" 24a535ea Sep 22 13:14:20 2020 +0100
4.\" 4.\"
@@ -68,7 +68,7 @@
68.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 68.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
69.\" OF THE POSSIBILITY OF SUCH DAMAGE. 69.\" OF THE POSSIBILITY OF SUCH DAMAGE.
70.\" 70.\"
71.Dd $Mdocdate: March 5 2024 $ 71.Dd $Mdocdate: June 8 2025 $
72.Dt EVP_MD_NID 3 72.Dt EVP_MD_NID 3
73.Os 73.Os
74.Sh NAME 74.Sh NAME
@@ -84,6 +84,7 @@
84.Nm EVP_MD_pkey_type 84.Nm EVP_MD_pkey_type
85.Nd inspect EVP_MD objects 85.Nd inspect EVP_MD objects
86.Sh SYNOPSIS 86.Sh SYNOPSIS
87.Lb libcrypto
87.In openssl/evp.h 88.In openssl/evp.h
88.Ft int 89.Ft int
89.Fo EVP_MD_nid 90.Fo EVP_MD_nid
diff --git a/src/lib/libcrypto/man/EVP_OpenInit.3 b/src/lib/libcrypto/man/EVP_OpenInit.3
index fbd0e75571..8cdcbda0e9 100644
--- a/src/lib/libcrypto/man/EVP_OpenInit.3
+++ b/src/lib/libcrypto/man/EVP_OpenInit.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_OpenInit.3,v 1.9 2023/11/16 20:27:43 schwarze Exp $ 1.\" $OpenBSD: EVP_OpenInit.3,v 1.10 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: November 16 2023 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt EVP_OPENINIT 3 52.Dt EVP_OPENINIT 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -57,6 +57,7 @@
57.Nm EVP_OpenFinal 57.Nm EVP_OpenFinal
58.Nd EVP envelope decryption 58.Nd EVP envelope decryption
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/evp.h 61.In openssl/evp.h
61.Ft int 62.Ft int
62.Fo EVP_OpenInit 63.Fo EVP_OpenInit
diff --git a/src/lib/libcrypto/man/EVP_PKCS82PKEY.3 b/src/lib/libcrypto/man/EVP_PKCS82PKEY.3
index 30a43b8dca..a8b7d86808 100644
--- a/src/lib/libcrypto/man/EVP_PKCS82PKEY.3
+++ b/src/lib/libcrypto/man/EVP_PKCS82PKEY.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_PKCS82PKEY.3,v 1.3 2024/03/05 19:21:31 tb Exp $ 1.\" $OpenBSD: EVP_PKCS82PKEY.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 5 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt EVP_PKCS82PKEY 3 18.Dt EVP_PKCS82PKEY 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm EVP_PKEY2PKCS8 22.Nm EVP_PKEY2PKCS8
23.Nd convert between EVP_PKEY and PKCS#8 PrivateKeyInfo 23.Nd convert between EVP_PKEY and PKCS#8 PrivateKeyInfo
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/x509.h 26.In openssl/x509.h
26.Ft EVP_PKEY * 27.Ft EVP_PKEY *
27.Fn EVP_PKCS82PKEY "const PKCS8_PRIV_KEY_INFO *keyinfo" 28.Fn EVP_PKCS82PKEY "const PKCS8_PRIV_KEY_INFO *keyinfo"
diff --git a/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 b/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3
index 137e576c46..db65f132bb 100644
--- a/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3
+++ b/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_PKEY_CTX_ctrl.3,v 1.28 2024/12/10 14:54:20 schwarze Exp $ 1.\" $OpenBSD: EVP_PKEY_CTX_ctrl.3,v 1.30 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
4.\" Parts were split out into RSA_pkey_ctx_ctrl(3). 4.\" Parts were split out into RSA_pkey_ctx_ctrl(3).
@@ -69,7 +69,7 @@
69.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 69.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
70.\" OF THE POSSIBILITY OF SUCH DAMAGE. 70.\" OF THE POSSIBILITY OF SUCH DAMAGE.
71.\" 71.\"
72.Dd $Mdocdate: December 10 2024 $ 72.Dd $Mdocdate: June 8 2025 $
73.Dt EVP_PKEY_CTX_CTRL 3 73.Dt EVP_PKEY_CTX_CTRL 3
74.Os 74.Os
75.Sh NAME 75.Sh NAME
@@ -97,6 +97,7 @@
97.Nm EVP_PKEY_CTX_get1_id_len 97.Nm EVP_PKEY_CTX_get1_id_len
98.Nd algorithm specific control operations 98.Nd algorithm specific control operations
99.Sh SYNOPSIS 99.Sh SYNOPSIS
100.Lb libcrypto
100.In openssl/evp.h 101.In openssl/evp.h
101.Ft int 102.Ft int
102.Fo EVP_PKEY_CTX_ctrl 103.Fo EVP_PKEY_CTX_ctrl
@@ -371,7 +372,7 @@ The
371macro sets the key derivation function message digest to 372macro sets the key derivation function message digest to
372.Fa md 373.Fa md
373for ECDH key derivation. 374for ECDH key derivation.
374Note that X9.63 specifies that this digest should be SHA1, 375Note that X9.63 specifies that this digest should be SHA-1,
375but OpenSSL tolerates other digests. 376but OpenSSL tolerates other digests.
376.Pp 377.Pp
377The 378The
diff --git a/src/lib/libcrypto/man/EVP_PKEY_CTX_get_operation.3 b/src/lib/libcrypto/man/EVP_PKEY_CTX_get_operation.3
index 2482c746d4..ce234337bb 100644
--- a/src/lib/libcrypto/man/EVP_PKEY_CTX_get_operation.3
+++ b/src/lib/libcrypto/man/EVP_PKEY_CTX_get_operation.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_PKEY_CTX_get_operation.3,v 1.3 2023/09/12 16:15:23 schwarze Exp $ 1.\" $OpenBSD: EVP_PKEY_CTX_get_operation.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: September 12 2023 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt EVP_PKEY_CTX_GET_OPERATION 3 18.Dt EVP_PKEY_CTX_GET_OPERATION 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm EVP_PKEY_CTX_get0_pkey 22.Nm EVP_PKEY_CTX_get0_pkey
23.Nd inspect EVP_PKEY_CTX objects 23.Nd inspect EVP_PKEY_CTX objects
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/evp.h 26.In openssl/evp.h
26.Ft int 27.Ft int
27.Fo EVP_PKEY_CTX_get_operation 28.Fo EVP_PKEY_CTX_get_operation
diff --git a/src/lib/libcrypto/man/EVP_PKEY_CTX_new.3 b/src/lib/libcrypto/man/EVP_PKEY_CTX_new.3
index e74bce9dfb..d0f514d5ea 100644
--- a/src/lib/libcrypto/man/EVP_PKEY_CTX_new.3
+++ b/src/lib/libcrypto/man/EVP_PKEY_CTX_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_PKEY_CTX_new.3,v 1.16 2024/12/06 14:27:49 schwarze Exp $ 1.\" $OpenBSD: EVP_PKEY_CTX_new.3,v 1.17 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 2.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: December 6 2024 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt EVP_PKEY_CTX_NEW 3 69.Dt EVP_PKEY_CTX_NEW 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -75,6 +75,7 @@
75.Nm EVP_PKEY_CTX_free 75.Nm EVP_PKEY_CTX_free
76.Nd public key algorithm context functions 76.Nd public key algorithm context functions
77.Sh SYNOPSIS 77.Sh SYNOPSIS
78.Lb libcrypto
78.In openssl/evp.h 79.In openssl/evp.h
79.Ft EVP_PKEY_CTX * 80.Ft EVP_PKEY_CTX *
80.Fo EVP_PKEY_CTX_new 81.Fo EVP_PKEY_CTX_new
diff --git a/src/lib/libcrypto/man/EVP_PKEY_CTX_set_hkdf_md.3 b/src/lib/libcrypto/man/EVP_PKEY_CTX_set_hkdf_md.3
index 973ae95974..a63744097a 100644
--- a/src/lib/libcrypto/man/EVP_PKEY_CTX_set_hkdf_md.3
+++ b/src/lib/libcrypto/man/EVP_PKEY_CTX_set_hkdf_md.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_PKEY_CTX_set_hkdf_md.3,v 1.4 2024/07/10 07:57:37 tb Exp $ 1.\" $OpenBSD: EVP_PKEY_CTX_set_hkdf_md.3,v 1.5 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 1cb7eff4 Sep 10 13:56:40 2019 +0100 2.\" full merge up to: OpenSSL 1cb7eff4 Sep 10 13:56:40 2019 +0100
3.\" 3.\"
4.\" This file was written by Alessandro Ghedini <alessandro@ghedini.me>, 4.\" This file was written by Alessandro Ghedini <alessandro@ghedini.me>,
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: July 10 2024 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt EVP_PKEY_CTX_SET_HKDF_MD 3 53.Dt EVP_PKEY_CTX_SET_HKDF_MD 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -60,6 +60,7 @@
60.Nm EVP_PKEY_CTX_hkdf_mode 60.Nm EVP_PKEY_CTX_hkdf_mode
61.Nd HMAC-based Extract-and-Expand key derivation algorithm 61.Nd HMAC-based Extract-and-Expand key derivation algorithm
62.Sh SYNOPSIS 62.Sh SYNOPSIS
63.Lb libcrypto
63.In openssl/evp.h 64.In openssl/evp.h
64.In openssl/kdf.h 65.In openssl/kdf.h
65.Ft int 66.Ft int
diff --git a/src/lib/libcrypto/man/EVP_PKEY_CTX_set_tls1_prf_md.3 b/src/lib/libcrypto/man/EVP_PKEY_CTX_set_tls1_prf_md.3
index 1b95bbaa98..57a85a78d9 100644
--- a/src/lib/libcrypto/man/EVP_PKEY_CTX_set_tls1_prf_md.3
+++ b/src/lib/libcrypto/man/EVP_PKEY_CTX_set_tls1_prf_md.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_PKEY_CTX_set_tls1_prf_md.3,v 1.2 2024/07/10 10:22:03 tb Exp $ 1.\" $OpenBSD: EVP_PKEY_CTX_set_tls1_prf_md.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 1cb7eff4 Sep 10 13:56:40 2019 +0100 2.\" full merge up to: OpenSSL 1cb7eff4 Sep 10 13:56:40 2019 +0100
3.\" 3.\"
4.\" This file was written by Dr Stephen Henson <steve@openssl.org>, 4.\" This file was written by Dr Stephen Henson <steve@openssl.org>,
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: July 10 2024 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt EVP_PKEY_CTX_SET_TLS1_PRF_MD 3 52.Dt EVP_PKEY_CTX_SET_TLS1_PRF_MD 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -57,6 +57,7 @@
57.Nm EVP_PKEY_CTX_add1_tls1_prf_seed 57.Nm EVP_PKEY_CTX_add1_tls1_prf_seed
58.Nd TLS PRF key derivation algorithm 58.Nd TLS PRF key derivation algorithm
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/evp.h 61.In openssl/evp.h
61.In openssl/kdf.h 62.In openssl/kdf.h
62.Ft int 63.Ft int
@@ -87,7 +88,7 @@ It has no associated private key and only implements key derivation using
87sets the message digest associated with the TLS PRF. 88sets the message digest associated with the TLS PRF.
88.Xr EVP_md5_sha1 3 89.Xr EVP_md5_sha1 3
89is treated as a special case which uses the PRF algorithm using both 90is treated as a special case which uses the PRF algorithm using both
90MD5 and SHA1 as used in TLS 1.0 and 1.1. 91MD5 and SHA-1 as used in TLS 1.0 and 1.1.
91.Pp 92.Pp
92.Fn EVP_PKEY_CTX_set_tls1_prf_secret 93.Fn EVP_PKEY_CTX_set_tls1_prf_secret
93sets the secret value of the TLS PRF to 94sets the secret value of the TLS PRF to
diff --git a/src/lib/libcrypto/man/EVP_PKEY_asn1_get_count.3 b/src/lib/libcrypto/man/EVP_PKEY_asn1_get_count.3
index f7810789b6..098a5565b2 100644
--- a/src/lib/libcrypto/man/EVP_PKEY_asn1_get_count.3
+++ b/src/lib/libcrypto/man/EVP_PKEY_asn1_get_count.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_PKEY_asn1_get_count.3,v 1.10 2024/12/06 12:51:13 schwarze Exp $ 1.\" $OpenBSD: EVP_PKEY_asn1_get_count.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 72a7a702 Feb 26 14:05:09 2019 +0000 2.\" full merge up to: OpenSSL 72a7a702 Feb 26 14:05:09 2019 +0000
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: December 6 2024 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt EVP_PKEY_ASN1_GET_COUNT 3 69.Dt EVP_PKEY_ASN1_GET_COUNT 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -77,6 +77,7 @@
77.Nm EVP_PKEY_asn1_get0_info 77.Nm EVP_PKEY_asn1_get0_info
78.Nd enumerate public key ASN.1 methods 78.Nd enumerate public key ASN.1 methods
79.Sh SYNOPSIS 79.Sh SYNOPSIS
80.Lb libcrypto
80.In openssl/evp.h 81.In openssl/evp.h
81.Ft int 82.Ft int
82.Fn EVP_PKEY_asn1_get_count void 83.Fn EVP_PKEY_asn1_get_count void
diff --git a/src/lib/libcrypto/man/EVP_PKEY_cmp.3 b/src/lib/libcrypto/man/EVP_PKEY_cmp.3
index c12843854d..bcd0152dc8 100644
--- a/src/lib/libcrypto/man/EVP_PKEY_cmp.3
+++ b/src/lib/libcrypto/man/EVP_PKEY_cmp.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_PKEY_cmp.3,v 1.15 2024/12/06 12:51:13 schwarze Exp $ 1.\" $OpenBSD: EVP_PKEY_cmp.3,v 1.16 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 05ea606a May 20 20:52:46 2016 -0400 2.\" full merge up to: OpenSSL 05ea606a May 20 20:52:46 2016 -0400
3.\" selective merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 3.\" selective merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
4.\" 4.\"
@@ -67,7 +67,7 @@
67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
69.\" 69.\"
70.Dd $Mdocdate: December 6 2024 $ 70.Dd $Mdocdate: June 8 2025 $
71.Dt EVP_PKEY_CMP 3 71.Dt EVP_PKEY_CMP 3
72.Os 72.Os
73.Sh NAME 73.Sh NAME
@@ -81,6 +81,7 @@
81.\" resulting in incomplete output without the public key parameters. 81.\" resulting in incomplete output without the public key parameters.
82.Nd public key parameter and comparison functions 82.Nd public key parameter and comparison functions
83.Sh SYNOPSIS 83.Sh SYNOPSIS
84.Lb libcrypto
84.In openssl/evp.h 85.In openssl/evp.h
85.Ft int 86.Ft int
86.Fo EVP_PKEY_missing_parameters 87.Fo EVP_PKEY_missing_parameters
diff --git a/src/lib/libcrypto/man/EVP_PKEY_decrypt.3 b/src/lib/libcrypto/man/EVP_PKEY_decrypt.3
index c063847b10..abac0e6a2e 100644
--- a/src/lib/libcrypto/man/EVP_PKEY_decrypt.3
+++ b/src/lib/libcrypto/man/EVP_PKEY_decrypt.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_PKEY_decrypt.3,v 1.10 2024/12/06 14:27:49 schwarze Exp $ 1.\" $OpenBSD: EVP_PKEY_decrypt.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 48e5119a Jan 19 10:49:22 2018 +0100 2.\" full merge up to: OpenSSL 48e5119a Jan 19 10:49:22 2018 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: December 6 2024 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt EVP_PKEY_DECRYPT 3 53.Dt EVP_PKEY_DECRYPT 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -57,6 +57,7 @@
57.Nm EVP_PKEY_decrypt 57.Nm EVP_PKEY_decrypt
58.Nd decrypt using a public key algorithm 58.Nd decrypt using a public key algorithm
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/evp.h 61.In openssl/evp.h
61.Ft int 62.Ft int
62.Fo EVP_PKEY_decrypt_init 63.Fo EVP_PKEY_decrypt_init
diff --git a/src/lib/libcrypto/man/EVP_PKEY_derive.3 b/src/lib/libcrypto/man/EVP_PKEY_derive.3
index 47f467fea1..d02ef0e9e4 100644
--- a/src/lib/libcrypto/man/EVP_PKEY_derive.3
+++ b/src/lib/libcrypto/man/EVP_PKEY_derive.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_PKEY_derive.3,v 1.12 2024/12/06 14:27:49 schwarze Exp $ 1.\" $OpenBSD: EVP_PKEY_derive.3,v 1.13 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 48e5119a Jan 19 10:49:22 2018 +0100 2.\" full merge up to: OpenSSL 48e5119a Jan 19 10:49:22 2018 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: December 6 2024 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt EVP_PKEY_DERIVE 3 70.Dt EVP_PKEY_DERIVE 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -76,6 +76,7 @@
76.Nm EVP_PKEY_derive 76.Nm EVP_PKEY_derive
77.Nd derive public key algorithm shared secret 77.Nd derive public key algorithm shared secret
78.Sh SYNOPSIS 78.Sh SYNOPSIS
79.Lb libcrypto
79.In openssl/evp.h 80.In openssl/evp.h
80.Ft int 81.Ft int
81.Fo EVP_PKEY_derive_init 82.Fo EVP_PKEY_derive_init
diff --git a/src/lib/libcrypto/man/EVP_PKEY_encrypt.3 b/src/lib/libcrypto/man/EVP_PKEY_encrypt.3
index c2e70cb31f..f32d411283 100644
--- a/src/lib/libcrypto/man/EVP_PKEY_encrypt.3
+++ b/src/lib/libcrypto/man/EVP_PKEY_encrypt.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_PKEY_encrypt.3,v 1.10 2024/12/06 14:27:49 schwarze Exp $ 1.\" $OpenBSD: EVP_PKEY_encrypt.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: December 6 2024 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt EVP_PKEY_ENCRYPT 3 53.Dt EVP_PKEY_ENCRYPT 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -57,6 +57,7 @@
57.Nm EVP_PKEY_encrypt 57.Nm EVP_PKEY_encrypt
58.Nd encrypt using a public key algorithm 58.Nd encrypt using a public key algorithm
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/evp.h 61.In openssl/evp.h
61.Ft int 62.Ft int
62.Fo EVP_PKEY_encrypt_init 63.Fo EVP_PKEY_encrypt_init
diff --git a/src/lib/libcrypto/man/EVP_PKEY_get_default_digest_nid.3 b/src/lib/libcrypto/man/EVP_PKEY_get_default_digest_nid.3
index e9ff7c4609..5c5b07bd3c 100644
--- a/src/lib/libcrypto/man/EVP_PKEY_get_default_digest_nid.3
+++ b/src/lib/libcrypto/man/EVP_PKEY_get_default_digest_nid.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_PKEY_get_default_digest_nid.3,v 1.10 2024/12/06 12:51:13 schwarze Exp $ 1.\" $OpenBSD: EVP_PKEY_get_default_digest_nid.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 2.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -66,13 +66,14 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: December 6 2024 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt EVP_PKEY_GET_DEFAULT_DIGEST_NID 3 70.Dt EVP_PKEY_GET_DEFAULT_DIGEST_NID 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
73.Nm EVP_PKEY_get_default_digest_nid 73.Nm EVP_PKEY_get_default_digest_nid
74.Nd get default signature digest 74.Nd get default signature digest
75.Sh SYNOPSIS 75.Sh SYNOPSIS
76.Lb libcrypto
76.In openssl/evp.h 77.In openssl/evp.h
77.Ft int 78.Ft int
78.Fo EVP_PKEY_get_default_digest_nid 79.Fo EVP_PKEY_get_default_digest_nid
diff --git a/src/lib/libcrypto/man/EVP_PKEY_keygen.3 b/src/lib/libcrypto/man/EVP_PKEY_keygen.3
index e75859b486..3c000f8cd2 100644
--- a/src/lib/libcrypto/man/EVP_PKEY_keygen.3
+++ b/src/lib/libcrypto/man/EVP_PKEY_keygen.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_PKEY_keygen.3,v 1.15 2024/12/06 14:27:49 schwarze Exp $ 1.\" $OpenBSD: EVP_PKEY_keygen.3,v 1.16 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 2.\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: December 6 2024 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt EVP_PKEY_KEYGEN 3 70.Dt EVP_PKEY_KEYGEN 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -85,6 +85,7 @@
85.Nm EVP_PKEY_CTX_get_data 85.Nm EVP_PKEY_CTX_get_data
86.Nd key and parameter generation functions 86.Nd key and parameter generation functions
87.Sh SYNOPSIS 87.Sh SYNOPSIS
88.Lb libcrypto
88.In openssl/evp.h 89.In openssl/evp.h
89.Ft int 90.Ft int
90.Fo EVP_PKEY_keygen_init 91.Fo EVP_PKEY_keygen_init
diff --git a/src/lib/libcrypto/man/EVP_PKEY_new.3 b/src/lib/libcrypto/man/EVP_PKEY_new.3
index 3b1ef029c3..7c13f625bc 100644
--- a/src/lib/libcrypto/man/EVP_PKEY_new.3
+++ b/src/lib/libcrypto/man/EVP_PKEY_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_PKEY_new.3,v 1.26 2024/12/10 15:10:26 schwarze Exp $ 1.\" $OpenBSD: EVP_PKEY_new.3,v 1.27 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 4dcfdfce May 27 11:50:05 2020 +0100 2.\" full merge up to: OpenSSL 4dcfdfce May 27 11:50:05 2020 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: December 10 2024 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt EVP_PKEY_NEW 3 70.Dt EVP_PKEY_NEW 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -80,6 +80,7 @@
80.Nm EVP_PKEY_get_raw_public_key 80.Nm EVP_PKEY_get_raw_public_key
81.Nd public and private key allocation and raw key handling functions 81.Nd public and private key allocation and raw key handling functions
82.Sh SYNOPSIS 82.Sh SYNOPSIS
83.Lb libcrypto
83.In openssl/evp.h 84.In openssl/evp.h
84.Ft EVP_PKEY * 85.Ft EVP_PKEY *
85.Fn EVP_PKEY_new void 86.Fn EVP_PKEY_new void
diff --git a/src/lib/libcrypto/man/EVP_PKEY_new_CMAC_key.3 b/src/lib/libcrypto/man/EVP_PKEY_new_CMAC_key.3
index d09af3a012..e4202fab67 100644
--- a/src/lib/libcrypto/man/EVP_PKEY_new_CMAC_key.3
+++ b/src/lib/libcrypto/man/EVP_PKEY_new_CMAC_key.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_PKEY_new_CMAC_key.3,v 1.1 2024/11/12 20:00:36 schwarze Exp $ 1.\" $OpenBSD: EVP_PKEY_new_CMAC_key.3,v 1.2 2025/06/08 22:40:29 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: November 12 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt EVP_PKEY_NEW_CMAC_KEY 3 18.Dt EVP_PKEY_NEW_CMAC_KEY 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm EVP_PKEY_new_CMAC_key 21.Nm EVP_PKEY_new_CMAC_key
22.Nd CMAC in the EVP framework 22.Nd CMAC in the EVP framework
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
24.In openssl/evp.h 25.In openssl/evp.h
25.Ft EVP_PKEY * 26.Ft EVP_PKEY *
26.Fo EVP_PKEY_new_CMAC_key 27.Fo EVP_PKEY_new_CMAC_key
diff --git a/src/lib/libcrypto/man/EVP_PKEY_print_private.3 b/src/lib/libcrypto/man/EVP_PKEY_print_private.3
index a4b51a4bbb..877385d15b 100644
--- a/src/lib/libcrypto/man/EVP_PKEY_print_private.3
+++ b/src/lib/libcrypto/man/EVP_PKEY_print_private.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_PKEY_print_private.3,v 1.8 2024/12/06 12:51:13 schwarze Exp $ 1.\" $OpenBSD: EVP_PKEY_print_private.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: December 6 2024 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt EVP_PKEY_PRINT_PRIVATE 3 52.Dt EVP_PKEY_PRINT_PRIVATE 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -57,6 +57,7 @@
57.Nm EVP_PKEY_print_params 57.Nm EVP_PKEY_print_params
58.Nd public key algorithm printing routines 58.Nd public key algorithm printing routines
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/evp.h 61.In openssl/evp.h
61.Ft int 62.Ft int
62.Fo EVP_PKEY_print_public 63.Fo EVP_PKEY_print_public
diff --git a/src/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 b/src/lib/libcrypto/man/EVP_PKEY_set1_RSA.3
index 39404f5286..5e17894bea 100644
--- a/src/lib/libcrypto/man/EVP_PKEY_set1_RSA.3
+++ b/src/lib/libcrypto/man/EVP_PKEY_set1_RSA.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_PKEY_set1_RSA.3,v 1.24 2024/12/09 11:25:25 schwarze Exp $ 1.\" $OpenBSD: EVP_PKEY_set1_RSA.3,v 1.27 2025/07/02 06:40:28 tb Exp $
2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: December 9 2024 $ 68.Dd $Mdocdate: July 2 2025 $
69.Dt EVP_PKEY_SET1_RSA 3 69.Dt EVP_PKEY_SET1_RSA 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -103,6 +103,7 @@
103.\" EVP_PKT_ENC EVP_PKT_EXCH EVP_PKT_EXP EVP_PKT_SIGN 103.\" EVP_PKT_ENC EVP_PKT_EXCH EVP_PKT_EXP EVP_PKT_SIGN
104.Nd EVP_PKEY assignment functions 104.Nd EVP_PKEY assignment functions
105.Sh SYNOPSIS 105.Sh SYNOPSIS
106.Lb libcrypto
106.In openssl/evp.h 107.In openssl/evp.h
107.Ft int 108.Ft int
108.Fo EVP_PKEY_set1_RSA 109.Fo EVP_PKEY_set1_RSA
@@ -126,35 +127,35 @@
126.Fc 127.Fc
127.Ft RSA * 128.Ft RSA *
128.Fo EVP_PKEY_get1_RSA 129.Fo EVP_PKEY_get1_RSA
129.Fa "EVP_PKEY *pkey" 130.Fa "const EVP_PKEY *pkey"
130.Fc 131.Fc
131.Ft DSA * 132.Ft DSA *
132.Fo EVP_PKEY_get1_DSA 133.Fo EVP_PKEY_get1_DSA
133.Fa "EVP_PKEY *pkey" 134.Fa "const EVP_PKEY *pkey"
134.Fc 135.Fc
135.Ft DH * 136.Ft DH *
136.Fo EVP_PKEY_get1_DH 137.Fo EVP_PKEY_get1_DH
137.Fa "EVP_PKEY *pkey" 138.Fa "const EVP_PKEY *pkey"
138.Fc 139.Fc
139.Ft EC_KEY * 140.Ft EC_KEY *
140.Fo EVP_PKEY_get1_EC_KEY 141.Fo EVP_PKEY_get1_EC_KEY
141.Fa "EVP_PKEY *pkey" 142.Fa "const EVP_PKEY *pkey"
142.Fc 143.Fc
143.Ft RSA * 144.Ft RSA *
144.Fo EVP_PKEY_get0_RSA 145.Fo EVP_PKEY_get0_RSA
145.Fa "EVP_PKEY *pkey" 146.Fa "const EVP_PKEY *pkey"
146.Fc 147.Fc
147.Ft DSA * 148.Ft DSA *
148.Fo EVP_PKEY_get0_DSA 149.Fo EVP_PKEY_get0_DSA
149.Fa "EVP_PKEY *pkey" 150.Fa "const EVP_PKEY *pkey"
150.Fc 151.Fc
151.Ft DH * 152.Ft DH *
152.Fo EVP_PKEY_get0_DH 153.Fo EVP_PKEY_get0_DH
153.Fa "EVP_PKEY *pkey" 154.Fa "const EVP_PKEY *pkey"
154.Fc 155.Fc
155.Ft EC_KEY * 156.Ft EC_KEY *
156.Fo EVP_PKEY_get0_EC_KEY 157.Fo EVP_PKEY_get0_EC_KEY
157.Fa "EVP_PKEY *pkey" 158.Fa "const EVP_PKEY *pkey"
158.Fc 159.Fc
159.Ft const unsigned char * 160.Ft const unsigned char *
160.Fo EVP_PKEY_get0_hmac 161.Fo EVP_PKEY_get0_hmac
@@ -193,11 +194,11 @@
193.Fc 194.Fc
194.Ft int 195.Ft int
195.Fo EVP_PKEY_base_id 196.Fo EVP_PKEY_base_id
196.Fa "EVP_PKEY *pkey" 197.Fa "const EVP_PKEY *pkey"
197.Fc 198.Fc
198.Ft int 199.Ft int
199.Fo EVP_PKEY_id 200.Fo EVP_PKEY_id
200.Fa "EVP_PKEY *pkey" 201.Fa "const EVP_PKEY *pkey"
201.Fc 202.Fc
202.Ft int 203.Ft int
203.Fo EVP_PKEY_type 204.Fo EVP_PKEY_type
diff --git a/src/lib/libcrypto/man/EVP_PKEY_sign.3 b/src/lib/libcrypto/man/EVP_PKEY_sign.3
index d73b0abb7b..58d7e34cb6 100644
--- a/src/lib/libcrypto/man/EVP_PKEY_sign.3
+++ b/src/lib/libcrypto/man/EVP_PKEY_sign.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_PKEY_sign.3,v 1.9 2024/12/06 14:27:49 schwarze Exp $ 1.\" $OpenBSD: EVP_PKEY_sign.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: December 6 2024 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt EVP_PKEY_SIGN 3 53.Dt EVP_PKEY_SIGN 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -57,6 +57,7 @@
57.Nm EVP_PKEY_sign 57.Nm EVP_PKEY_sign
58.Nd sign using a public key algorithm 58.Nd sign using a public key algorithm
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/evp.h 61.In openssl/evp.h
61.Ft int 62.Ft int
62.Fo EVP_PKEY_sign_init 63.Fo EVP_PKEY_sign_init
@@ -134,7 +135,7 @@ return 1 for success and 0 or a negative value for failure.
134In particular, a return value of -2 indicates the operation is not 135In particular, a return value of -2 indicates the operation is not
135supported by the public key algorithm. 136supported by the public key algorithm.
136.Sh EXAMPLES 137.Sh EXAMPLES
137Sign data using RSA with PKCS#1 padding and SHA256 digest: 138Sign data using RSA with PKCS#1 padding and SHA-256 digest:
138.Bd -literal -offset indent 139.Bd -literal -offset indent
139#include <openssl/evp.h> 140#include <openssl/evp.h>
140#include <openssl/rsa.h> 141#include <openssl/rsa.h>
diff --git a/src/lib/libcrypto/man/EVP_PKEY_size.3 b/src/lib/libcrypto/man/EVP_PKEY_size.3
index cd25eec9c2..dc53de1268 100644
--- a/src/lib/libcrypto/man/EVP_PKEY_size.3
+++ b/src/lib/libcrypto/man/EVP_PKEY_size.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_PKEY_size.3,v 1.4 2024/12/06 12:51:13 schwarze Exp $ 1.\" $OpenBSD: EVP_PKEY_size.3,v 1.5 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL eed9d03b Jan 8 11:04:15 2020 +0100 2.\" full merge up to: OpenSSL eed9d03b Jan 8 11:04:15 2020 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: December 6 2024 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt EVP_PKEY_SIZE 3 69.Dt EVP_PKEY_SIZE 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -74,6 +74,7 @@
74.Nm EVP_PKEY_security_bits 74.Nm EVP_PKEY_security_bits
75.Nd EVP_PKEY information functions 75.Nd EVP_PKEY information functions
76.Sh SYNOPSIS 76.Sh SYNOPSIS
77.Lb libcrypto
77.In openssl/evp.h 78.In openssl/evp.h
78.Ft int 79.Ft int
79.Fo EVP_PKEY_size 80.Fo EVP_PKEY_size
diff --git a/src/lib/libcrypto/man/EVP_PKEY_verify.3 b/src/lib/libcrypto/man/EVP_PKEY_verify.3
index d096a3a7be..1a1d19a552 100644
--- a/src/lib/libcrypto/man/EVP_PKEY_verify.3
+++ b/src/lib/libcrypto/man/EVP_PKEY_verify.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_PKEY_verify.3,v 1.8 2024/12/06 14:27:49 schwarze Exp $ 1.\" $OpenBSD: EVP_PKEY_verify.3,v 1.10 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 48e5119a Jan 19 10:49:22 2018 +0100 2.\" full merge up to: OpenSSL 48e5119a Jan 19 10:49:22 2018 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: December 6 2024 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt EVP_PKEY_VERIFY 3 53.Dt EVP_PKEY_VERIFY 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -57,6 +57,7 @@
57.Nm EVP_PKEY_verify 57.Nm EVP_PKEY_verify
58.Nd signature verification using a public key algorithm 58.Nd signature verification using a public key algorithm
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/evp.h 61.In openssl/evp.h
61.Ft int 62.Ft int
62.Fo EVP_PKEY_verify_init 63.Fo EVP_PKEY_verify_init
@@ -120,7 +121,7 @@ failure.
120In particular, a return value of -2 indicates the operation is not 121In particular, a return value of -2 indicates the operation is not
121supported by the public key algorithm. 122supported by the public key algorithm.
122.Sh EXAMPLES 123.Sh EXAMPLES
123Verify signature using PKCS#1 and SHA256 digest: 124Verify signature using PKCS#1 and SHA-256 digest:
124.Bd -literal -offset 3n 125.Bd -literal -offset 3n
125#include <openssl/evp.h> 126#include <openssl/evp.h>
126#include <openssl/rsa.h> 127#include <openssl/rsa.h>
diff --git a/src/lib/libcrypto/man/EVP_PKEY_verify_recover.3 b/src/lib/libcrypto/man/EVP_PKEY_verify_recover.3
index 30c034cdb5..840307b41e 100644
--- a/src/lib/libcrypto/man/EVP_PKEY_verify_recover.3
+++ b/src/lib/libcrypto/man/EVP_PKEY_verify_recover.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_PKEY_verify_recover.3,v 1.10 2024/12/06 14:27:49 schwarze Exp $ 1.\" $OpenBSD: EVP_PKEY_verify_recover.3,v 1.12 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 48e5119a Jan 19 10:49:22 2018 +0100 2.\" full merge up to: OpenSSL 48e5119a Jan 19 10:49:22 2018 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: December 6 2024 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt EVP_PKEY_VERIFY_RECOVER 3 53.Dt EVP_PKEY_VERIFY_RECOVER 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -57,6 +57,7 @@
57.Nm EVP_PKEY_verify_recover 57.Nm EVP_PKEY_verify_recover
58.Nd recover signature using a public key algorithm 58.Nd recover signature using a public key algorithm
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/evp.h 61.In openssl/evp.h
61.Ft int 62.Ft int
62.Fo EVP_PKEY_verify_recover_init 63.Fo EVP_PKEY_verify_recover_init
@@ -135,7 +136,7 @@ return 1 for success and 0 or a negative value for failure.
135In particular, a return value of -2 indicates the operation is not 136In particular, a return value of -2 indicates the operation is not
136supported by the public key algorithm. 137supported by the public key algorithm.
137.Sh EXAMPLES 138.Sh EXAMPLES
138Recover digest originally signed using PKCS#1 and SHA256 digest: 139Recover digest originally signed using PKCS#1 and SHA-256 digest:
139.Bd -literal -offset indent 140.Bd -literal -offset indent
140#include <openssl/evp.h> 141#include <openssl/evp.h>
141#include <openssl/rsa.h> 142#include <openssl/rsa.h>
diff --git a/src/lib/libcrypto/man/EVP_SealInit.3 b/src/lib/libcrypto/man/EVP_SealInit.3
index da53535274..f211702ba6 100644
--- a/src/lib/libcrypto/man/EVP_SealInit.3
+++ b/src/lib/libcrypto/man/EVP_SealInit.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_SealInit.3,v 1.9 2023/11/16 20:27:43 schwarze Exp $ 1.\" $OpenBSD: EVP_SealInit.3,v 1.10 2025/06/08 22:40:29 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: November 16 2023 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt EVP_SEALINIT 3 53.Dt EVP_SEALINIT 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -58,6 +58,7 @@
58.Nm EVP_SealFinal 58.Nm EVP_SealFinal
59.Nd EVP envelope encryption 59.Nd EVP envelope encryption
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libcrypto
61.In openssl/evp.h 62.In openssl/evp.h
62.Ft int 63.Ft int
63.Fo EVP_SealInit 64.Fo EVP_SealInit
diff --git a/src/lib/libcrypto/man/EVP_SignInit.3 b/src/lib/libcrypto/man/EVP_SignInit.3
index 8158b21dbf..d3964abd41 100644
--- a/src/lib/libcrypto/man/EVP_SignInit.3
+++ b/src/lib/libcrypto/man/EVP_SignInit.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_SignInit.3,v 1.21 2024/12/06 12:51:13 schwarze Exp $ 1.\" $OpenBSD: EVP_SignInit.3,v 1.22 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200 2.\" full merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: December 6 2024 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt EVP_SIGNINIT 3 53.Dt EVP_SIGNINIT 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -59,6 +59,7 @@
59.Nm EVP_SignInit 59.Nm EVP_SignInit
60.Nd EVP signing functions 60.Nd EVP signing functions
61.Sh SYNOPSIS 61.Sh SYNOPSIS
62.Lb libcrypto
62.In openssl/evp.h 63.In openssl/evp.h
63.Ft int 64.Ft int
64.Fo EVP_SignInit_ex 65.Fo EVP_SignInit_ex
diff --git a/src/lib/libcrypto/man/EVP_VerifyInit.3 b/src/lib/libcrypto/man/EVP_VerifyInit.3
index 0baadfb9fb..9bf1f1e163 100644
--- a/src/lib/libcrypto/man/EVP_VerifyInit.3
+++ b/src/lib/libcrypto/man/EVP_VerifyInit.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_VerifyInit.3,v 1.13 2024/11/08 22:23:35 schwarze Exp $ 1.\" $OpenBSD: EVP_VerifyInit.3,v 1.14 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 2.\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: November 8 2024 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt EVP_VERIFYINIT 3 53.Dt EVP_VERIFYINIT 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -59,6 +59,7 @@
59.Nm EVP_VerifyInit 59.Nm EVP_VerifyInit
60.Nd EVP signature verification functions 60.Nd EVP signature verification functions
61.Sh SYNOPSIS 61.Sh SYNOPSIS
62.Lb libcrypto
62.In openssl/evp.h 63.In openssl/evp.h
63.Ft int 64.Ft int
64.Fo EVP_VerifyInit_ex 65.Fo EVP_VerifyInit_ex
diff --git a/src/lib/libcrypto/man/EVP_aes_128_cbc.3 b/src/lib/libcrypto/man/EVP_aes_128_cbc.3
index 46e3ef0bdc..72f654b73d 100644
--- a/src/lib/libcrypto/man/EVP_aes_128_cbc.3
+++ b/src/lib/libcrypto/man/EVP_aes_128_cbc.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_aes_128_cbc.3,v 1.8 2024/12/20 01:54:03 schwarze Exp $ 1.\" $OpenBSD: EVP_aes_128_cbc.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $
2.\" selective merge up to: OpenSSL 7c6d372a Nov 20 13:20:01 2018 +0000 2.\" selective merge up to: OpenSSL 7c6d372a Nov 20 13:20:01 2018 +0000
3.\" 3.\"
4.\" This file was written by Ronald Tse <ronald.tse@ribose.com> 4.\" This file was written by Ronald Tse <ronald.tse@ribose.com>
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: December 20 2024 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt EVP_AES_128_CBC 3 52.Dt EVP_AES_128_CBC 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -85,6 +85,7 @@
85.Nm EVP_aes_256_xts 85.Nm EVP_aes_256_xts
86.Nd EVP AES cipher 86.Nd EVP AES cipher
87.Sh SYNOPSIS 87.Sh SYNOPSIS
88.Lb libcrypto
88.In openssl/evp.h 89.In openssl/evp.h
89.Ft const EVP_CIPHER * 90.Ft const EVP_CIPHER *
90.Fn EVP_aes_128_cbc void 91.Fn EVP_aes_128_cbc void
diff --git a/src/lib/libcrypto/man/EVP_aes_128_ccm.3 b/src/lib/libcrypto/man/EVP_aes_128_ccm.3
index e9023a5b67..eaba95c936 100644
--- a/src/lib/libcrypto/man/EVP_aes_128_ccm.3
+++ b/src/lib/libcrypto/man/EVP_aes_128_ccm.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_aes_128_ccm.3,v 1.5 2024/12/29 12:27:28 schwarze Exp $ 1.\" $OpenBSD: EVP_aes_128_ccm.3,v 1.6 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL EVP_EncryptInit.pod 0874d7f2 Oct 11 13:13:47 2022 +0100 3.\" OpenSSL EVP_EncryptInit.pod 0874d7f2 Oct 11 13:13:47 2022 +0100
4.\" OpenSSL EVP_aes.pod a1ec85c1 Apr 21 10:49:12 2020 +0100 4.\" OpenSSL EVP_aes.pod a1ec85c1 Apr 21 10:49:12 2020 +0100
@@ -67,7 +67,7 @@
67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
69.\" 69.\"
70.Dd $Mdocdate: December 29 2024 $ 70.Dd $Mdocdate: June 8 2025 $
71.Dt EVP_AES_128_CCM 3 71.Dt EVP_AES_128_CCM 3
72.Os 72.Os
73.Sh NAME 73.Sh NAME
@@ -76,6 +76,7 @@
76.Nm EVP_aes_256_ccm 76.Nm EVP_aes_256_ccm
77.Nd EVP AES cipher in Counter with CBC-MAC mode 77.Nd EVP AES cipher in Counter with CBC-MAC mode
78.Sh SYNOPSIS 78.Sh SYNOPSIS
79.Lb libcrypto
79.In openssl/evp.h 80.In openssl/evp.h
80.Ft const EVP_CIPHER * 81.Ft const EVP_CIPHER *
81.Fn EVP_aes_128_ccm void 82.Fn EVP_aes_128_ccm void
diff --git a/src/lib/libcrypto/man/EVP_aes_128_gcm.3 b/src/lib/libcrypto/man/EVP_aes_128_gcm.3
index 53c41ea162..fa4a88619a 100644
--- a/src/lib/libcrypto/man/EVP_aes_128_gcm.3
+++ b/src/lib/libcrypto/man/EVP_aes_128_gcm.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_aes_128_gcm.3,v 1.2 2024/12/29 12:27:28 schwarze Exp $ 1.\" $OpenBSD: EVP_aes_128_gcm.3,v 1.3 2025/06/08 22:40:29 schwarze Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL EVP_EncryptInit.pod 0874d7f2 Oct 11 13:13:47 2022 +0100 3.\" OpenSSL EVP_EncryptInit.pod 0874d7f2 Oct 11 13:13:47 2022 +0100
4.\" OpenSSL EVP_aes.pod a1ec85c1 Apr 21 10:49:12 2020 +0100 4.\" OpenSSL EVP_aes.pod a1ec85c1 Apr 21 10:49:12 2020 +0100
@@ -67,7 +67,7 @@
67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
69.\" 69.\"
70.Dd $Mdocdate: December 29 2024 $ 70.Dd $Mdocdate: June 8 2025 $
71.Dt EVP_AES_128_GCM 3 71.Dt EVP_AES_128_GCM 3
72.Os 72.Os
73.Sh NAME 73.Sh NAME
@@ -76,6 +76,7 @@
76.Nm EVP_aes_256_gcm 76.Nm EVP_aes_256_gcm
77.Nd EVP AES cipher in Galois Counter Mode 77.Nd EVP AES cipher in Galois Counter Mode
78.Sh SYNOPSIS 78.Sh SYNOPSIS
79.Lb libcrypto
79.In openssl/evp.h 80.In openssl/evp.h
80.Ft const EVP_CIPHER * 81.Ft const EVP_CIPHER *
81.Fn EVP_aes_128_gcm void 82.Fn EVP_aes_128_gcm void
diff --git a/src/lib/libcrypto/man/EVP_camellia_128_cbc.3 b/src/lib/libcrypto/man/EVP_camellia_128_cbc.3
index 6f15a85f7f..3ff5d5a0e0 100644
--- a/src/lib/libcrypto/man/EVP_camellia_128_cbc.3
+++ b/src/lib/libcrypto/man/EVP_camellia_128_cbc.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_camellia_128_cbc.3,v 1.3 2024/11/09 22:03:49 schwarze Exp $ 1.\" $OpenBSD: EVP_camellia_128_cbc.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $
2.\" selective merge up to: OpenSSL 7c6d372a Nov 20 13:20:01 2018 +0000 2.\" selective merge up to: OpenSSL 7c6d372a Nov 20 13:20:01 2018 +0000
3.\" 3.\"
4.\" This file was written by Ronald Tse <ronald.tse@ribose.com> 4.\" This file was written by Ronald Tse <ronald.tse@ribose.com>
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: November 9 2024 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt EVP_CAMELLIA_128_CBC 3 52.Dt EVP_CAMELLIA_128_CBC 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -75,6 +75,7 @@
75.Nm EVP_camellia_256_ofb 75.Nm EVP_camellia_256_ofb
76.Nd EVP Camellia cipher 76.Nd EVP Camellia cipher
77.Sh SYNOPSIS 77.Sh SYNOPSIS
78.Lb libcrypto
78.In openssl/evp.h 79.In openssl/evp.h
79.Ft const EVP_CIPHER * 80.Ft const EVP_CIPHER *
80.Fn EVP_camellia_128_cbc void 81.Fn EVP_camellia_128_cbc void
diff --git a/src/lib/libcrypto/man/EVP_chacha20.3 b/src/lib/libcrypto/man/EVP_chacha20.3
index 8fc79dbf2b..45584f3e86 100644
--- a/src/lib/libcrypto/man/EVP_chacha20.3
+++ b/src/lib/libcrypto/man/EVP_chacha20.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_chacha20.3,v 1.8 2024/12/09 11:55:52 schwarze Exp $ 1.\" $OpenBSD: EVP_chacha20.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL 35fd9953 May 28 14:49:38 2019 +0200 2.\" full merge up to: OpenSSL 35fd9953 May 28 14:49:38 2019 +0200
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: December 9 2024 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt EVP_CHACHA20 3 69.Dt EVP_CHACHA20 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -73,6 +73,7 @@
73.Nm EVP_chacha20_poly1305 73.Nm EVP_chacha20_poly1305
74.Nd ChaCha20 stream cipher for EVP 74.Nd ChaCha20 stream cipher for EVP
75.Sh SYNOPSIS 75.Sh SYNOPSIS
76.Lb libcrypto
76.In openssl/evp.h 77.In openssl/evp.h
77.Ft const EVP_CIPHER * 78.Ft const EVP_CIPHER *
78.Fn EVP_chacha20 void 79.Fn EVP_chacha20 void
diff --git a/src/lib/libcrypto/man/EVP_des_cbc.3 b/src/lib/libcrypto/man/EVP_des_cbc.3
index 7c8a08c7db..84ee9aaa61 100644
--- a/src/lib/libcrypto/man/EVP_des_cbc.3
+++ b/src/lib/libcrypto/man/EVP_des_cbc.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_des_cbc.3,v 1.2 2024/11/09 22:03:49 schwarze Exp $ 1.\" $OpenBSD: EVP_des_cbc.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL EVP_desx_cbc.pod 8fa4d95e Oct 21 11:59:09 2017 +0900 3.\" OpenSSL EVP_desx_cbc.pod 8fa4d95e Oct 21 11:59:09 2017 +0900
4.\" selective merge up to: 4.\" selective merge up to:
@@ -51,7 +51,7 @@
51.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
52.\" OF THE POSSIBILITY OF SUCH DAMAGE. 52.\" OF THE POSSIBILITY OF SUCH DAMAGE.
53.\" 53.\"
54.Dd $Mdocdate: November 9 2024 $ 54.Dd $Mdocdate: June 8 2025 $
55.Dt EVP_DES_CBC 3 55.Dt EVP_DES_CBC 3
56.Os 56.Os
57.Sh NAME 57.Sh NAME
@@ -79,6 +79,7 @@
79.Nm EVP_desx_cbc 79.Nm EVP_desx_cbc
80.Nd EVP DES cipher 80.Nd EVP DES cipher
81.Sh SYNOPSIS 81.Sh SYNOPSIS
82.Lb libcrypto
82.In openssl/evp.h 83.In openssl/evp.h
83.Ft const EVP_CIPHER * 84.Ft const EVP_CIPHER *
84.Fn EVP_des_cbc void 85.Fn EVP_des_cbc void
diff --git a/src/lib/libcrypto/man/EVP_rc2_cbc.3 b/src/lib/libcrypto/man/EVP_rc2_cbc.3
index 38c8184260..9a3bc29304 100644
--- a/src/lib/libcrypto/man/EVP_rc2_cbc.3
+++ b/src/lib/libcrypto/man/EVP_rc2_cbc.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_rc2_cbc.3,v 1.1 2024/12/08 17:41:23 schwarze Exp $ 1.\" $OpenBSD: EVP_rc2_cbc.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: December 8 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt EVP_RC2_CBC 3 18.Dt EVP_RC2_CBC 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -27,6 +27,7 @@
27.Nm EVP_rc2_64_cbc 27.Nm EVP_rc2_64_cbc
28.Nd Rivest Cipher 2 in the EVP framework 28.Nd Rivest Cipher 2 in the EVP framework
29.Sh SYNOPSIS 29.Sh SYNOPSIS
30.Lb libcrypto
30.In openssl/evp.h 31.In openssl/evp.h
31.Ft const EVP_CIPHER * 32.Ft const EVP_CIPHER *
32.Fn EVP_rc2_cbc void 33.Fn EVP_rc2_cbc void
diff --git a/src/lib/libcrypto/man/EVP_rc4.3 b/src/lib/libcrypto/man/EVP_rc4.3
index fda041113c..40dd27e49f 100644
--- a/src/lib/libcrypto/man/EVP_rc4.3
+++ b/src/lib/libcrypto/man/EVP_rc4.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_rc4.3,v 1.1 2019/03/21 13:37:25 schwarze Exp $ 1.\" $OpenBSD: EVP_rc4.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL 8fa4d95e Oct 21 11:59:09 2017 +0900 2.\" full merge up to: OpenSSL 8fa4d95e Oct 21 11:59:09 2017 +0900
3.\" 3.\"
4.\" This file was written by Ronald Tse <ronald.tse@ribose.com> 4.\" This file was written by Ronald Tse <ronald.tse@ribose.com>
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 21 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt EVP_RC4 3 52.Dt EVP_RC4 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -57,6 +57,7 @@
57.Nm EVP_rc4_hmac_md5 57.Nm EVP_rc4_hmac_md5
58.Nd EVP RC4 stream cipher 58.Nd EVP RC4 stream cipher
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/evp.h 61.In openssl/evp.h
61.Ft const EVP_CIPHER * 62.Ft const EVP_CIPHER *
62.Fn EVP_rc4 void 63.Fn EVP_rc4 void
diff --git a/src/lib/libcrypto/man/EVP_sha1.3 b/src/lib/libcrypto/man/EVP_sha1.3
index b28c9f54c3..d1e336cc42 100644
--- a/src/lib/libcrypto/man/EVP_sha1.3
+++ b/src/lib/libcrypto/man/EVP_sha1.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_sha1.3,v 1.2 2024/03/05 17:21:40 tb Exp $ 1.\" $OpenBSD: EVP_sha1.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 5 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt EVP_SHA1 3 18.Dt EVP_SHA1 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -24,6 +24,7 @@
24.Nm EVP_md4 24.Nm EVP_md4
25.Nd legacy message digest algorithms 25.Nd legacy message digest algorithms
26.Sh SYNOPSIS 26.Sh SYNOPSIS
27.Lb libcrypto
27.In openssl/evp.h 28.In openssl/evp.h
28.Ft const EVP_MD * 29.Ft const EVP_MD *
29.Fn EVP_sha1 void 30.Fn EVP_sha1 void
diff --git a/src/lib/libcrypto/man/EVP_sha3_224.3 b/src/lib/libcrypto/man/EVP_sha3_224.3
index 3c21ae1a09..19a9114885 100644
--- a/src/lib/libcrypto/man/EVP_sha3_224.3
+++ b/src/lib/libcrypto/man/EVP_sha3_224.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_sha3_224.3,v 1.3 2024/03/05 17:21:40 tb Exp $ 1.\" $OpenBSD: EVP_sha3_224.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $
2.\" selective merge up to: OpenSSL bbda8ce9 Oct 31 15:43:01 2017 +0800 2.\" selective merge up to: OpenSSL bbda8ce9 Oct 31 15:43:01 2017 +0800
3.\" 3.\"
4.\" This file was written by Ronald Tse <ronald.tse@ribose.com>. 4.\" This file was written by Ronald Tse <ronald.tse@ribose.com>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 5 2024 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt EVP_SHA3_224 3 52.Dt EVP_SHA3_224 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -58,6 +58,7 @@
58.Nm EVP_sha3_512 58.Nm EVP_sha3_512
59.Nd Secure Hash Algorithm 3 for EVP 59.Nd Secure Hash Algorithm 3 for EVP
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libcrypto
61.In openssl/evp.h 62.In openssl/evp.h
62.Ft const EVP_MD * 63.Ft const EVP_MD *
63.Fn EVP_sha3_224 void 64.Fn EVP_sha3_224 void
diff --git a/src/lib/libcrypto/man/EVP_sm3.3 b/src/lib/libcrypto/man/EVP_sm3.3
index aa6789f249..33621bef81 100644
--- a/src/lib/libcrypto/man/EVP_sm3.3
+++ b/src/lib/libcrypto/man/EVP_sm3.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_sm3.3,v 1.1 2019/08/25 17:08:20 schwarze Exp $ 1.\" $OpenBSD: EVP_sm3.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL 21ebd2fc Aug 24 20:38:04 2018 +0800 2.\" full merge up to: OpenSSL 21ebd2fc Aug 24 20:38:04 2018 +0800
3.\" 3.\"
4.\" This file was written by Jack Lloyd <jack.lloyd@ribose.com> 4.\" This file was written by Jack Lloyd <jack.lloyd@ribose.com>
@@ -50,13 +50,14 @@
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\" 52.\"
53.Dd $Mdocdate: August 25 2019 $ 53.Dd $Mdocdate: June 8 2025 $
54.Dt EVP_SM3 3 54.Dt EVP_SM3 3
55.Os 55.Os
56.Sh NAME 56.Sh NAME
57.Nm EVP_sm3 57.Nm EVP_sm3
58.Nd SM3 hash function for EVP 58.Nd SM3 hash function for EVP
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/evp.h 61.In openssl/evp.h
61.Ft const EVP_MD * 62.Ft const EVP_MD *
62.Fn EVP_sm3 void 63.Fn EVP_sm3 void
diff --git a/src/lib/libcrypto/man/EVP_sm4_cbc.3 b/src/lib/libcrypto/man/EVP_sm4_cbc.3
index 0605a52faa..eba31afff3 100644
--- a/src/lib/libcrypto/man/EVP_sm4_cbc.3
+++ b/src/lib/libcrypto/man/EVP_sm4_cbc.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_sm4_cbc.3,v 1.2 2023/11/16 20:27:43 schwarze Exp $ 1.\" $OpenBSD: EVP_sm4_cbc.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL 87103969 Oct 1 14:11:57 2018 -0700 2.\" full merge up to: OpenSSL 87103969 Oct 1 14:11:57 2018 -0700
3.\" 3.\"
4.\" Copyright (c) 2017 Ribose Inc 4.\" Copyright (c) 2017 Ribose Inc
@@ -18,7 +18,7 @@
18.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 18.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20.\" 20.\"
21.Dd $Mdocdate: November 16 2023 $ 21.Dd $Mdocdate: June 8 2025 $
22.Dt EVP_SM4_CBC 3 22.Dt EVP_SM4_CBC 3
23.Os 23.Os
24.Sh NAME 24.Sh NAME
@@ -30,6 +30,7 @@
30.Nm EVP_sm4_ctr 30.Nm EVP_sm4_ctr
31.Nd EVP SM4 cipher 31.Nd EVP SM4 cipher
32.Sh SYNOPSIS 32.Sh SYNOPSIS
33.Lb libcrypto
33.In openssl/evp.h 34.In openssl/evp.h
34.Ft const EVP_CIPHER * 35.Ft const EVP_CIPHER *
35.Fn EVP_sm4_cbc void 36.Fn EVP_sm4_cbc void
diff --git a/src/lib/libcrypto/man/EXTENDED_KEY_USAGE_new.3 b/src/lib/libcrypto/man/EXTENDED_KEY_USAGE_new.3
index 3d1ed17ff3..3258c9793d 100644
--- a/src/lib/libcrypto/man/EXTENDED_KEY_USAGE_new.3
+++ b/src/lib/libcrypto/man/EXTENDED_KEY_USAGE_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EXTENDED_KEY_USAGE_new.3,v 1.6 2021/10/27 11:24:47 schwarze Exp $ 1.\" $OpenBSD: EXTENDED_KEY_USAGE_new.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: October 27 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt EXTENDED_KEY_USAGE_NEW 3 18.Dt EXTENDED_KEY_USAGE_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm EXTENDED_KEY_USAGE_free 22.Nm EXTENDED_KEY_USAGE_free
23.Nd X.509 key usage restrictions 23.Nd X.509 key usage restrictions
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/x509v3.h 26.In openssl/x509v3.h
26.Ft EXTENDED_KEY_USAGE 27.Ft EXTENDED_KEY_USAGE
27.Fn EXTENDED_KEY_USAGE_new void 28.Fn EXTENDED_KEY_USAGE_new void
diff --git a/src/lib/libcrypto/man/GENERAL_NAME_new.3 b/src/lib/libcrypto/man/GENERAL_NAME_new.3
index a6b7ee56da..84ad2edb3b 100644
--- a/src/lib/libcrypto/man/GENERAL_NAME_new.3
+++ b/src/lib/libcrypto/man/GENERAL_NAME_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: GENERAL_NAME_new.3,v 1.6 2019/06/06 01:06:58 schwarze Exp $ 1.\" $OpenBSD: GENERAL_NAME_new.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 6 2019 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt GENERAL_NAME_NEW 3 18.Dt GENERAL_NAME_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -28,6 +28,7 @@
28.Nm OTHERNAME_free 28.Nm OTHERNAME_free
29.Nd names for use in X.509 extensions 29.Nd names for use in X.509 extensions
30.Sh SYNOPSIS 30.Sh SYNOPSIS
31.Lb libcrypto
31.In openssl/x509v3.h 32.In openssl/x509v3.h
32.Ft GENERAL_NAME * 33.Ft GENERAL_NAME *
33.Fn GENERAL_NAME_new void 34.Fn GENERAL_NAME_new void
diff --git a/src/lib/libcrypto/man/HMAC.3 b/src/lib/libcrypto/man/HMAC.3
index a515014fca..0b9e24a7bd 100644
--- a/src/lib/libcrypto/man/HMAC.3
+++ b/src/lib/libcrypto/man/HMAC.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: HMAC.3,v 1.23 2024/08/29 20:21:53 tb Exp $ 1.\" $OpenBSD: HMAC.3,v 1.24 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL crypto/hmac a528d4f0 Oct 27 13:40:11 2015 -0400 2.\" full merge up to: OpenSSL crypto/hmac a528d4f0 Oct 27 13:40:11 2015 -0400
3.\" selective merge up to: OpenSSL man3/HMAC b3696a55 Sep 2 09:35:50 2017 -0400 3.\" selective merge up to: OpenSSL man3/HMAC b3696a55 Sep 2 09:35:50 2017 -0400
4.\" 4.\"
@@ -52,7 +52,7 @@
52.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 52.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
53.\" OF THE POSSIBILITY OF SUCH DAMAGE. 53.\" OF THE POSSIBILITY OF SUCH DAMAGE.
54.\" 54.\"
55.Dd $Mdocdate: August 29 2024 $ 55.Dd $Mdocdate: June 8 2025 $
56.Dt HMAC 3 56.Dt HMAC 3
57.Os 57.Os
58.Sh NAME 58.Sh NAME
@@ -69,6 +69,7 @@
69.Nm HMAC_size 69.Nm HMAC_size
70.Nd HMAC message authentication code 70.Nd HMAC message authentication code
71.Sh SYNOPSIS 71.Sh SYNOPSIS
72.Lb libcrypto
72.In openssl/hmac.h 73.In openssl/hmac.h
73.Ft unsigned char * 74.Ft unsigned char *
74.Fo HMAC 75.Fo HMAC
diff --git a/src/lib/libcrypto/man/IPAddressRange_new.3 b/src/lib/libcrypto/man/IPAddressRange_new.3
index a812107cdf..79e3751b4e 100644
--- a/src/lib/libcrypto/man/IPAddressRange_new.3
+++ b/src/lib/libcrypto/man/IPAddressRange_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: IPAddressRange_new.3,v 1.9 2023/10/03 09:58:06 tb Exp $ 1.\" $OpenBSD: IPAddressRange_new.3,v 1.11 2025/06/13 18:34:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> 3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: October 3 2023 $ 17.Dd $Mdocdate: June 13 2025 $
18.Dt IPADDRESSRANGE_NEW 3 18.Dt IPADDRESSRANGE_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -36,8 +36,9 @@
36.Nm i2d_IPAddressFamily 36.Nm i2d_IPAddressFamily
37.Nd RFC 3779 IP address prefixes and ranges 37.Nd RFC 3779 IP address prefixes and ranges
38.Sh SYNOPSIS 38.Sh SYNOPSIS
39.Lb libcrypto
39.In openssl/x509v3.h 40.In openssl/x509v3.h
40.Ft "IPAddressRange *" 41.Ft IPAddressRange *
41.Fn IPAddressRange_new void 42.Fn IPAddressRange_new void
42.Ft void 43.Ft void
43.Fn IPAddressRange_free "IPAddressRange *range" 44.Fn IPAddressRange_free "IPAddressRange *range"
@@ -52,7 +53,7 @@
52.Fa "IPAddressRange *range" 53.Fa "IPAddressRange *range"
53.Fa "unsigned char **der_out" 54.Fa "unsigned char **der_out"
54.Fc 55.Fc
55.Ft "IPAddressOrRange *" 56.Ft IPAddressOrRange *
56.Fn IPAddressOrRange_new void 57.Fn IPAddressOrRange_new void
57.Ft void 58.Ft void
58.Fn IPAddressOrRange_free "IPAddressOrRange *aor" 59.Fn IPAddressOrRange_free "IPAddressOrRange *aor"
@@ -67,7 +68,7 @@
67.Fa "IPAddressOrRange *aor" 68.Fa "IPAddressOrRange *aor"
68.Fa "unsigned char **der_out" 69.Fa "unsigned char **der_out"
69.Fc 70.Fc
70.Ft "IPAddressChoice *" 71.Ft IPAddressChoice *
71.Fn IPAddressChoice_new void 72.Fn IPAddressChoice_new void
72.Ft void 73.Ft void
73.Fn IPAddressChoice_free "IPAddressChoice *ac" 74.Fn IPAddressChoice_free "IPAddressChoice *ac"
@@ -82,7 +83,7 @@
82.Fa "IPAddressChoice *ac" 83.Fa "IPAddressChoice *ac"
83.Fa "unsigned char **der_out" 84.Fa "unsigned char **der_out"
84.Fc 85.Fc
85.Ft "IPAddressFamily *" 86.Ft IPAddressFamily *
86.Fn IPAddressFamily_new void 87.Fn IPAddressFamily_new void
87.Ft void 88.Ft void
88.Fn IPAddressFamily_free "IPAddressFamily *af" 89.Fn IPAddressFamily_free "IPAddressFamily *af"
diff --git a/src/lib/libcrypto/man/MD5.3 b/src/lib/libcrypto/man/MD5.3
index 01e715f406..c9c89c33af 100644
--- a/src/lib/libcrypto/man/MD5.3
+++ b/src/lib/libcrypto/man/MD5.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: MD5.3,v 1.9 2024/05/26 09:54:16 tb Exp $ 1.\" $OpenBSD: MD5.3,v 1.10 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org> and 4.\" This file was written by Ulf Moeller <ulf@openssl.org> and
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: May 26 2024 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt MD5 3 53.Dt MD5 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -63,6 +63,7 @@
63.Nm MD5_Final 63.Nm MD5_Final
64.Nd MD4 and MD5 hash functions 64.Nd MD4 and MD5 hash functions
65.Sh SYNOPSIS 65.Sh SYNOPSIS
66.Lb libcrypto
66.In openssl/md4.h 67.In openssl/md4.h
67.Ft unsigned char * 68.Ft unsigned char *
68.Fo MD4 69.Fo MD4
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile
index 9f3d448432..aea939dc2b 100644
--- a/src/lib/libcrypto/man/Makefile
+++ b/src/lib/libcrypto/man/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.307 2025/03/08 17:12:55 tb Exp $ 1# $OpenBSD: Makefile,v 1.312 2025/07/17 10:31:50 schwarze Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4 4
@@ -133,12 +133,16 @@ MAN= \
133 DSA_size.3 \ 133 DSA_size.3 \
134 ECDH_compute_key.3 \ 134 ECDH_compute_key.3 \
135 ECDSA_SIG_new.3 \ 135 ECDSA_SIG_new.3 \
136 EC_GROUP_copy.3 \ 136 EC_GROUP_check.3 \
137 EC_GROUP_new.3 \ 137 EC_GROUP_get_curve_name.3 \
138 EC_GROUP_new_by_curve_name.3 \
139 EC_GROUP_new_curve_GFp.3 \
138 EC_KEY_METHOD_new.3 \ 140 EC_KEY_METHOD_new.3 \
139 EC_KEY_new.3 \ 141 EC_KEY_new.3 \
140 EC_POINT_add.3 \ 142 EC_POINT_add.3 \
143 EC_POINT_get_affine_coordinates.3 \
141 EC_POINT_new.3 \ 144 EC_POINT_new.3 \
145 EC_POINT_point2oct.3 \
142 ENGINE_new.3 \ 146 ENGINE_new.3 \
143 ERR.3 \ 147 ERR.3 \
144 ERR_GET_LIB.3 \ 148 ERR_GET_LIB.3 \
@@ -212,7 +216,6 @@ MAN= \
212 IPAddressRange_new.3 \ 216 IPAddressRange_new.3 \
213 MD5.3 \ 217 MD5.3 \
214 NAME_CONSTRAINTS_new.3 \ 218 NAME_CONSTRAINTS_new.3 \
215 OBJ_NAME_add.3 \
216 OBJ_create.3 \ 219 OBJ_create.3 \
217 OBJ_find_sigid_algs.3 \ 220 OBJ_find_sigid_algs.3 \
218 OBJ_nid2obj.3 \ 221 OBJ_nid2obj.3 \
@@ -228,12 +231,11 @@ MAN= \
228 OPENSSL_cleanse.3 \ 231 OPENSSL_cleanse.3 \
229 OPENSSL_config.3 \ 232 OPENSSL_config.3 \
230 OPENSSL_init_crypto.3 \ 233 OPENSSL_init_crypto.3 \
231 OPENSSL_load_builtin_modules.3 \
232 OPENSSL_malloc.3 \ 234 OPENSSL_malloc.3 \
233 OPENSSL_sk_new.3 \ 235 OPENSSL_sk_new.3 \
234 OpenSSL_add_all_algorithms.3 \ 236 OpenSSL_add_all_algorithms.3 \
235 PEM_ASN1_read.3 \ 237 PEM_ASN1_read.3 \
236 PEM_X509_INFO_read.3 \ 238 PEM_X509_INFO_read_bio.3 \
237 PEM_bytes_read_bio.3 \ 239 PEM_bytes_read_bio.3 \
238 PEM_read.3 \ 240 PEM_read.3 \
239 PEM_read_bio_PrivateKey.3 \ 241 PEM_read_bio_PrivateKey.3 \
@@ -289,11 +291,9 @@ MAN= \
289 RSA_size.3 \ 291 RSA_size.3 \
290 SHA1.3 \ 292 SHA1.3 \
291 SMIME_crlf_copy.3 \ 293 SMIME_crlf_copy.3 \
292 SMIME_read_ASN1.3 \
293 SMIME_read_CMS.3 \ 294 SMIME_read_CMS.3 \
294 SMIME_read_PKCS7.3 \ 295 SMIME_read_PKCS7.3 \
295 SMIME_text.3 \ 296 SMIME_text.3 \
296 SMIME_write_ASN1.3 \
297 SMIME_write_CMS.3 \ 297 SMIME_write_CMS.3 \
298 SMIME_write_PKCS7.3 \ 298 SMIME_write_PKCS7.3 \
299 STACK_OF.3 \ 299 STACK_OF.3 \
@@ -326,7 +326,6 @@ MAN= \
326 X509_NAME_new.3 \ 326 X509_NAME_new.3 \
327 X509_NAME_print_ex.3 \ 327 X509_NAME_print_ex.3 \
328 X509_OBJECT_get0_X509.3 \ 328 X509_OBJECT_get0_X509.3 \
329 X509_PKEY_new.3 \
330 X509_PUBKEY_new.3 \ 329 X509_PUBKEY_new.3 \
331 X509_PURPOSE_set.3 \ 330 X509_PURPOSE_set.3 \
332 X509_REQ_add1_attr.3 \ 331 X509_REQ_add1_attr.3 \
diff --git a/src/lib/libcrypto/man/NAME_CONSTRAINTS_new.3 b/src/lib/libcrypto/man/NAME_CONSTRAINTS_new.3
index fec3aba7f7..7d39754858 100644
--- a/src/lib/libcrypto/man/NAME_CONSTRAINTS_new.3
+++ b/src/lib/libcrypto/man/NAME_CONSTRAINTS_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: NAME_CONSTRAINTS_new.3,v 1.4 2020/09/17 08:50:05 schwarze Exp $ 1.\" $OpenBSD: NAME_CONSTRAINTS_new.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: September 17 2020 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt NAME_CONSTRAINTS_NEW 3 18.Dt NAME_CONSTRAINTS_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -27,6 +27,7 @@
27.\" We probably need to deprecate it thoughtfully. 27.\" We probably need to deprecate it thoughtfully.
28.Nd X.509 CA name constraints extension 28.Nd X.509 CA name constraints extension
29.Sh SYNOPSIS 29.Sh SYNOPSIS
30.Lb libcrypto
30.In openssl/x509v3.h 31.In openssl/x509v3.h
31.Ft NAME_CONSTRAINTS * 32.Ft NAME_CONSTRAINTS *
32.Fn NAME_CONSTRAINTS_new void 33.Fn NAME_CONSTRAINTS_new void
diff --git a/src/lib/libcrypto/man/OBJ_NAME_add.3 b/src/lib/libcrypto/man/OBJ_NAME_add.3
deleted file mode 100644
index 0b46010c49..0000000000
--- a/src/lib/libcrypto/man/OBJ_NAME_add.3
+++ /dev/null
@@ -1,307 +0,0 @@
1.\" $OpenBSD: OBJ_NAME_add.3,v 1.6 2024/01/31 08:02:53 tb Exp $
2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: January 31 2024 $
18.Dt OBJ_NAME_ADD 3
19.Os
20.Sh NAME
21.Nm OBJ_NAME_add ,
22.Nm OBJ_NAME_remove ,
23.Nm OBJ_NAME_get ,
24.Nm OBJ_NAME_new_index ,
25.Nm OBJ_NAME_init ,
26.Nm OBJ_NAME_cleanup
27.Nd global associative array
28.Sh SYNOPSIS
29.In openssl/objects.h
30.Ft int
31.Fo OBJ_NAME_add
32.Fa "const char *name"
33.Fa "int type"
34.Fa "const char *value"
35.Fc
36.Ft int
37.Fo OBJ_NAME_remove
38.Fa "const char *name"
39.Fa "int type"
40.Fc
41.Ft const char *
42.Fo OBJ_NAME_get
43.Fa "const char *name"
44.Fa "int type"
45.Fc
46.Ft int
47.Fo OBJ_NAME_new_index
48.Fa "unsigned long (*hash_func)(const char *name)"
49.Fa "int (*cmp_func)(const char *name1, const char *name2)"
50.Fa "void (*free_func)(const char *name, int type, const char *value)"
51.Fc
52.Ft int
53.Fn OBJ_NAME_init void
54.Ft void
55.Fn OBJ_NAME_cleanup "int type"
56.Bd -literal
57typedef struct {
58 int type;
59 int alias;
60 const char *name;
61 const char *data;
62} OBJ_NAME;
63.Ed
64.Sh DESCRIPTION
65These functions implement a single, static associative array
66with the following properties:
67.Bl -bullet
68.It
69The keys are ordered pairs consisting of a NUL-terminated string
70.Pq called the Fa name
71and an
72.Vt int
73number
74.Pq called the Fa type .
75Two types are predefined and used internally by the library:
76.Dv OBJ_NAME_TYPE_MD_METH
77and
78.Dv OBJ_NAME_TYPE_CIPHER_METH .
79Two additional types are predefined but not used internally:
80.Dv OBJ_NAME_TYPE_PKEY_METH
81and
82.Dv OBJ_NAME_TYPE_COMP_METH .
83All predefined types are greater than
84.Dv OBJ_NAME_TYPE_UNDEF
85and smaller than
86.Dv OBJ_NAME_TYPE_NUM .
87.It
88The values are pointers.
89Formally, they are of the type
90.Vt const char * ,
91but in practice, pointers of other types, for example
92.Vt EVP_CIPHER *
93or
94.Vt EVP_MD * ,
95are often stored as values
96and cast back to the correct type on retrieval.
97.It
98The array supports type-specific aliases for names.
99.El
100.Pp
101.Fn OBJ_NAME_add
102removes the key-value pair or alias with the key
103.Pq Fa name , type
104in the same way as
105.Fn OBJ_NAME_remove
106and inserts a key-value pair with the specified
107.Fa name ,
108.Fa type ,
109and
110.Fa value .
111If the bit
112.Dv OBJ_NAME_ALIAS
113is set in the
114.Fa type
115argument, that bit is cleared before using the
116.Fa type
117and the key
118.Pq Fa name , type
119becomes an alias for the key
120.Pq Fa value , type
121instead of setting a value.
122It is not checked whether the key
123.Pq Fa value , type
124already exists.
125Consequently, it is possible to define an alias
126before setting the associated value.
127.Pp
128.Fn OBJ_NAME_remove
129removes the key-value pair or alias with the key
130.Pq Fa name , type
131from the array, if it exists.
132Otherwise, it has no effect.
133If the bit
134.Dv OBJ_NAME_ALIAS
135is set in the
136.Fa type
137argument, it is ignored and cleared before using the
138.Fa type .
139If the
140.Fa type
141is an application-defined type added with
142.Fn OBJ_NAME_new_index
143and the
144.Fa free_func
145associated with the
146.Fa type
147is not a
148.Dv NULL
149pointer, it is called with the
150.Fa name ,
151.Fa type ,
152and
153.Fa value
154of the key-value pair being removed or with the
155.Fa name ,
156.Fa type ,
157and alias target name of the alias being removed.
158In typical usage, this function might free the
159.Fa name ,
160and it might free the
161.Fa value
162in a type-specific way.
163.Pp
164.Fn OBJ_NAME_get
165looks up the key
166.Pq Fa name , type ,
167recursively resolving up to ten aliases if needed.
168If the bit
169.Dv OBJ_NAME_ALIAS
170is set in the
171.Fa type
172argument, it is cleared before using the
173.Fa type ,
174processing of aliases is disabled, and if
175.Pq Fa name , type
176is an alias, the target name of the alias is returned instead of a value.
177.Pp
178.Fn OBJ_NAME_new_index
179assigns the smallest unassigned positive integer number
180to represent a new, application-defined
181.Fa type .
182The three function pointers will be used, respectively,
183to hash a name for this type, to compare two names for this type,
184and to free the contents of a key-value pair holding the given
185.Fa name ,
186.Fa type ,
187and
188.Fa value .
189If the
190.Fa hash_func
191argument is a
192.Dv NULL
193pointer,
194.Xr lh_strhash 3
195is used instead.
196If the
197.Fa cmp_func
198argument is a
199.Dv NULL
200pointer,
201.Xr strcmp 3
202is used instead.
203If the
204.Fa free_func
205argument is a
206.Dv NULL
207pointer, the
208.Fa name
209and
210.Fa value
211pointers contained in the key-value pair are not freed,
212only the structure representing the pair itself is.
213This default behaviour is also used for the built-in types.
214.Pp
215.Fn OBJ_NAME_init
216initializes the array.
217After initialization, the array is empty.
218Calling
219.Fn OBJ_NAME_init
220when the array is already initialized has no effect.
221Application programs do not need to call this function because
222.Fn OBJ_NAME_add
223and
224.Fn OBJ_NAME_get
225automatically call it whenever needed.
226.Pp
227.Fn OBJ_NAME_cleanup
228removes all key-value pairs and aliases of the given
229.Fa type
230from the array by calling
231.Fn OBJ_NAME_remove
232on every such pair and alias.
233If the
234.Fa type
235argument is negative, it removes all key-value pairs and aliases
236of any type and also reverses all effects of
237.Fn OBJ_NAME_new_index
238and
239.Fn OBJ_NAME_init ,
240in particular resetting the list of types to the predefined types
241and releasing all memory reserved by these functions.
242.Pp
243The
244.Vt OBJ_NAME
245structure represents one key-value pair or one alias with the key
246.Pq Fa name , type .
247If the
248.Fa alias
249field is 0, the
250.Fa data
251field contains the value; otherwise, it contains the alias target name.
252.Sh RETURN VALUES
253.Fn OBJ_NAME_add
254and
255.Fn OBJ_NAME_init
256return 1 on success or 0 if memory allocation fails.
257.Pp
258.Fn OBJ_NAME_remove
259returns 1 if one key-value pair or alias was removed or 0 otherwise.
260.Pp
261.Fn OBJ_NAME_get
262returns the
263.Fa value
264associated with the key
265.Pq Fa name , type
266or
267.Dv NULL
268if
269.Fa name
270is
271.Dv NULL ,
272if the array does not contain a value for this key,
273or if more than ten aliases are encountered before finding a value.
274.Pp
275.Fn OBJ_NAME_new_index
276returns a positive integer greater than or equal to
277.Dv OBJ_NAME_TYPE_NUM
278representing the new type or 0 if memory allocation fails.
279.Sh SEE ALSO
280.Xr EVP_cleanup 3 ,
281.Xr EVP_get_cipherbyname 3 ,
282.Xr EVP_get_digestbyname 3 ,
283.Xr lh_new 3 ,
284.Xr OBJ_create 3 ,
285.Xr OBJ_nid2obj 3
286.Sh BUGS
287Calling
288.Fn OBJ_NAME_get
289with the bit
290.Dv OBJ_NAME_ALIAS
291is not very useful because there is no way to tell
292whether the returned pointer points to a value or to a name,
293short of calling the function again without setting the bit
294and comparing the two returned pointers.
295.Pp
296The
297.Fa free_func
298has no way to tell whether its
299.Fa value
300argument is indeed of the given
301.Fa type
302or whether it is merely the target name of an alias.
303Consequently, to use values of a type
304that requires more cleanup than merely calling
305.Xr free 3
306on it, instances of the type need to begin with a magic number or string
307that cannot occur at the beginning of a name.
diff --git a/src/lib/libcrypto/man/OBJ_create.3 b/src/lib/libcrypto/man/OBJ_create.3
index fa5bde3dd3..75d51f4bb8 100644
--- a/src/lib/libcrypto/man/OBJ_create.3
+++ b/src/lib/libcrypto/man/OBJ_create.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: OBJ_create.3,v 1.10 2024/01/31 08:02:53 tb Exp $ 1.\" $OpenBSD: OBJ_create.3,v 1.11 2025/06/08 22:37:23 schwarze Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL OBJ_nid2obj.pod 9b86974e Aug 17 15:21:33 2015 -0400 3.\" OpenSSL OBJ_nid2obj.pod 9b86974e Aug 17 15:21:33 2015 -0400
4.\" selective merge up to: 4.\" selective merge up to:
@@ -69,18 +69,18 @@
69.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 69.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
70.\" OF THE POSSIBILITY OF SUCH DAMAGE. 70.\" OF THE POSSIBILITY OF SUCH DAMAGE.
71.\" 71.\"
72.Dd $Mdocdate: January 31 2024 $ 72.Dd $Mdocdate: June 8 2025 $
73.Dt OBJ_CREATE 3 73.Dt OBJ_CREATE 3
74.Os 74.Os
75.Sh NAME 75.Sh NAME
76.Nm OBJ_new_nid , 76.Nm OBJ_new_nid ,
77.Nm OBJ_add_object , 77.Nm OBJ_add_object ,
78.Nm OBJ_create , 78.Nm OBJ_create ,
79.\" OBJ_create_and_add_object is a deprecated, unused alias for OBJ_create(3).
80.Nm OBJ_create_objects , 79.Nm OBJ_create_objects ,
81.Nm OBJ_cleanup 80.Nm OBJ_cleanup
82.Nd modify the table of ASN.1 object identifiers 81.Nd modify the table of ASN.1 object identifiers
83.Sh SYNOPSIS 82.Sh SYNOPSIS
83.Lb libcrypto
84.In openssl/objects.h 84.In openssl/objects.h
85.Ft int 85.Ft int
86.Fn OBJ_new_nid "int increment" 86.Fn OBJ_new_nid "int increment"
diff --git a/src/lib/libcrypto/man/OBJ_find_sigid_algs.3 b/src/lib/libcrypto/man/OBJ_find_sigid_algs.3
index 1d7a2b649b..4c071c6c76 100644
--- a/src/lib/libcrypto/man/OBJ_find_sigid_algs.3
+++ b/src/lib/libcrypto/man/OBJ_find_sigid_algs.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: OBJ_find_sigid_algs.3,v 1.2 2024/01/31 08:02:53 tb Exp $ 1.\" $OpenBSD: OBJ_find_sigid_algs.3,v 1.4 2025/06/09 12:42:46 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: January 31 2024 $ 17.Dd $Mdocdate: June 9 2025 $
18.Dt OBJ_FIND_SIGID_ALGS 3 18.Dt OBJ_FIND_SIGID_ALGS 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm OBJ_find_sigid_by_algs 22.Nm OBJ_find_sigid_by_algs
23.Nd signature algorithm mappings 23.Nd signature algorithm mappings
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/objects.h 26.In openssl/objects.h
26.Ft int 27.Ft int
27.Fo OBJ_find_sigid_algs 28.Fo OBJ_find_sigid_algs
@@ -80,7 +81,6 @@ and
80algorithms is defined or 0 if the definition of such an algorithm 81algorithms is defined or 0 if the definition of such an algorithm
81is not built into the library. 82is not built into the library.
82.Sh SEE ALSO 83.Sh SEE ALSO
83.Xr EVP_cleanup 3 ,
84.Xr OBJ_create 3 , 84.Xr OBJ_create 3 ,
85.Xr OBJ_nid2obj 3 85.Xr OBJ_nid2obj 3
86.Sh HISTORY 86.Sh HISTORY
diff --git a/src/lib/libcrypto/man/OBJ_nid2obj.3 b/src/lib/libcrypto/man/OBJ_nid2obj.3
index ccab1ed30c..9261ac9a7d 100644
--- a/src/lib/libcrypto/man/OBJ_nid2obj.3
+++ b/src/lib/libcrypto/man/OBJ_nid2obj.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: OBJ_nid2obj.3,v 1.22 2024/01/31 08:02:53 tb Exp $ 1.\" $OpenBSD: OBJ_nid2obj.3,v 1.23 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL c264592d May 14 11:28:00 2006 +0000 2.\" full merge up to: OpenSSL c264592d May 14 11:28:00 2006 +0000
3.\" selective merge up to: OpenSSL 35fd9953 May 28 14:49:38 2019 +0200 3.\" selective merge up to: OpenSSL 35fd9953 May 28 14:49:38 2019 +0200
4.\" 4.\"
@@ -67,7 +67,7 @@
67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
69.\" 69.\"
70.Dd $Mdocdate: January 31 2024 $ 70.Dd $Mdocdate: June 8 2025 $
71.Dt OBJ_NID2OBJ 3 71.Dt OBJ_NID2OBJ 3
72.Os 72.Os
73.Sh NAME 73.Sh NAME
@@ -86,6 +86,7 @@
86.Nm i2a_ASN1_OBJECT 86.Nm i2a_ASN1_OBJECT
87.Nd inspect and create ASN.1 object identifiers 87.Nd inspect and create ASN.1 object identifiers
88.Sh SYNOPSIS 88.Sh SYNOPSIS
89.Lb libcrypto
89.In openssl/objects.h 90.In openssl/objects.h
90.Ft ASN1_OBJECT * 91.Ft ASN1_OBJECT *
91.Fo OBJ_nid2obj 92.Fo OBJ_nid2obj
diff --git a/src/lib/libcrypto/man/OCSP_CRLID_new.3 b/src/lib/libcrypto/man/OCSP_CRLID_new.3
index 6feb608654..9b0126fe91 100644
--- a/src/lib/libcrypto/man/OCSP_CRLID_new.3
+++ b/src/lib/libcrypto/man/OCSP_CRLID_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: OCSP_CRLID_new.3,v 1.8 2022/01/15 23:38:50 jsg Exp $ 1.\" $OpenBSD: OCSP_CRLID_new.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: January 15 2022 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt OCSP_CRLID_NEW 3 18.Dt OCSP_CRLID_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -23,6 +23,7 @@
23.Nm OCSP_crlID_new 23.Nm OCSP_crlID_new
24.Nd OCSP CRL extension 24.Nd OCSP CRL extension
25.Sh SYNOPSIS 25.Sh SYNOPSIS
26.Lb libcrypto
26.In openssl/ocsp.h 27.In openssl/ocsp.h
27.Ft OCSP_CRLID * 28.Ft OCSP_CRLID *
28.Fn OCSP_CRLID_new void 29.Fn OCSP_CRLID_new void
diff --git a/src/lib/libcrypto/man/OCSP_REQUEST_new.3 b/src/lib/libcrypto/man/OCSP_REQUEST_new.3
index a304f60160..0e4e0ffb38 100644
--- a/src/lib/libcrypto/man/OCSP_REQUEST_new.3
+++ b/src/lib/libcrypto/man/OCSP_REQUEST_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: OCSP_REQUEST_new.3,v 1.12 2022/02/19 13:09:36 jsg Exp $ 1.\" $OpenBSD: OCSP_REQUEST_new.3,v 1.13 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: February 19 2022 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt OCSP_REQUEST_NEW 3 69.Dt OCSP_REQUEST_NEW 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -84,6 +84,7 @@
84.Nm OCSP_request_onereq_get0 84.Nm OCSP_request_onereq_get0
85.Nd OCSP request functions 85.Nd OCSP request functions
86.Sh SYNOPSIS 86.Sh SYNOPSIS
87.Lb libcrypto
87.In openssl/ocsp.h 88.In openssl/ocsp.h
88.Ft OCSP_REQUEST * 89.Ft OCSP_REQUEST *
89.Fn OCSP_REQUEST_new void 90.Fn OCSP_REQUEST_new void
diff --git a/src/lib/libcrypto/man/OCSP_SERVICELOC_new.3 b/src/lib/libcrypto/man/OCSP_SERVICELOC_new.3
index 62eb8c320f..42288321a3 100644
--- a/src/lib/libcrypto/man/OCSP_SERVICELOC_new.3
+++ b/src/lib/libcrypto/man/OCSP_SERVICELOC_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: OCSP_SERVICELOC_new.3,v 1.8 2019/08/23 12:23:39 schwarze Exp $ 1.\" $OpenBSD: OCSP_SERVICELOC_new.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: August 23 2019 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt OCSP_SERVICELOC_NEW 3 18.Dt OCSP_SERVICELOC_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -23,6 +23,7 @@
23.Nm OCSP_url_svcloc_new 23.Nm OCSP_url_svcloc_new
24.Nd OCSP service locator extension 24.Nd OCSP service locator extension
25.Sh SYNOPSIS 25.Sh SYNOPSIS
26.Lb libcrypto
26.In openssl/ocsp.h 27.In openssl/ocsp.h
27.Ft OCSP_SERVICELOC * 28.Ft OCSP_SERVICELOC *
28.Fn OCSP_SERVICELOC_new void 29.Fn OCSP_SERVICELOC_new void
diff --git a/src/lib/libcrypto/man/OCSP_cert_to_id.3 b/src/lib/libcrypto/man/OCSP_cert_to_id.3
index e014a1d262..d0c04fcbb1 100644
--- a/src/lib/libcrypto/man/OCSP_cert_to_id.3
+++ b/src/lib/libcrypto/man/OCSP_cert_to_id.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: OCSP_cert_to_id.3,v 1.13 2024/08/24 19:31:09 tb Exp $ 1.\" $OpenBSD: OCSP_cert_to_id.3,v 1.15 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: August 24 2024 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt OCSP_CERT_TO_ID 3 69.Dt OCSP_CERT_TO_ID 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -78,6 +78,7 @@
78.Nm OCSP_id_get0_info 78.Nm OCSP_id_get0_info
79.Nd OCSP certificate ID utility functions 79.Nd OCSP certificate ID utility functions
80.Sh SYNOPSIS 80.Sh SYNOPSIS
81.Lb libcrypto
81.In openssl/ocsp.h 82.In openssl/ocsp.h
82.Ft OCSP_CERTID * 83.Ft OCSP_CERTID *
83.Fn OCSP_CERTID_new void 84.Fn OCSP_CERTID_new void
@@ -148,7 +149,7 @@ If
148.Fa dgst 149.Fa dgst
149is 150is
150.Dv NULL 151.Dv NULL
151then SHA1 is used. 152then SHA-1 is used.
152.Pp 153.Pp
153.Fn OCSP_cert_id_new 154.Fn OCSP_cert_id_new
154creates and returns a new 155creates and returns a new
diff --git a/src/lib/libcrypto/man/OCSP_request_add1_nonce.3 b/src/lib/libcrypto/man/OCSP_request_add1_nonce.3
index 036c937c61..304d686ba7 100644
--- a/src/lib/libcrypto/man/OCSP_request_add1_nonce.3
+++ b/src/lib/libcrypto/man/OCSP_request_add1_nonce.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: OCSP_request_add1_nonce.3,v 1.4 2018/03/22 21:08:22 schwarze Exp $ 1.\" $OpenBSD: OCSP_request_add1_nonce.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 22 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt OCSP_REQUEST_ADD1_NONCE 3 52.Dt OCSP_REQUEST_ADD1_NONCE 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -58,6 +58,7 @@
58.Nm OCSP_copy_nonce 58.Nm OCSP_copy_nonce
59.Nd OCSP nonce functions 59.Nd OCSP nonce functions
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libcrypto
61.In openssl/ocsp.h 62.In openssl/ocsp.h
62.Ft int 63.Ft int
63.Fo OCSP_request_add1_nonce 64.Fo OCSP_request_add1_nonce
diff --git a/src/lib/libcrypto/man/OCSP_resp_find_status.3 b/src/lib/libcrypto/man/OCSP_resp_find_status.3
index 06d0354bd6..5e9ce02fd5 100644
--- a/src/lib/libcrypto/man/OCSP_resp_find_status.3
+++ b/src/lib/libcrypto/man/OCSP_resp_find_status.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: OCSP_resp_find_status.3,v 1.11 2022/03/31 17:27:17 naddy Exp $ 1.\" $OpenBSD: OCSP_resp_find_status.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL c952780c Jun 21 07:03:34 2016 -0400 2.\" full merge up to: OpenSSL c952780c Jun 21 07:03:34 2016 -0400
3.\" selective merge up to: OpenSSL 1212818e Sep 11 13:22:14 2018 +0100 3.\" selective merge up to: OpenSSL 1212818e Sep 11 13:22:14 2018 +0100
4.\" 4.\"
@@ -67,7 +67,7 @@
67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
69.\" 69.\"
70.Dd $Mdocdate: March 31 2022 $ 70.Dd $Mdocdate: June 8 2025 $
71.Dt OCSP_RESP_FIND_STATUS 3 71.Dt OCSP_RESP_FIND_STATUS 3
72.Os 72.Os
73.Sh NAME 73.Sh NAME
@@ -88,6 +88,7 @@
88.Nm OCSP_basic_verify 88.Nm OCSP_basic_verify
89.Nd OCSP response utility functions 89.Nd OCSP response utility functions
90.Sh SYNOPSIS 90.Sh SYNOPSIS
91.Lb libcrypto
91.In openssl/ocsp.h 92.In openssl/ocsp.h
92.Ft OCSP_SINGLERESP * 93.Ft OCSP_SINGLERESP *
93.Fn OCSP_SINGLERESP_new void 94.Fn OCSP_SINGLERESP_new void
diff --git a/src/lib/libcrypto/man/OCSP_response_status.3 b/src/lib/libcrypto/man/OCSP_response_status.3
index 4e85384fb0..7fd8267d9f 100644
--- a/src/lib/libcrypto/man/OCSP_response_status.3
+++ b/src/lib/libcrypto/man/OCSP_response_status.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: OCSP_response_status.3,v 1.8 2019/08/27 09:40:29 schwarze Exp $ 1.\" $OpenBSD: OCSP_response_status.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400 2.\" full merge up to: OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400
3.\" selective merge up to: OpenSSL 6738bf14 Feb 13 12:51:29 2018 +0000 3.\" selective merge up to: OpenSSL 6738bf14 Feb 13 12:51:29 2018 +0000
4.\" 4.\"
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: August 27 2019 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt OCSP_RESPONSE_STATUS 3 70.Dt OCSP_RESPONSE_STATUS 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -87,6 +87,7 @@
87.Nm OCSP_basic_sign 87.Nm OCSP_basic_sign
88.Nd OCSP response functions 88.Nd OCSP response functions
89.Sh SYNOPSIS 89.Sh SYNOPSIS
90.Lb libcrypto
90.In openssl/ocsp.h 91.In openssl/ocsp.h
91.Ft OCSP_RESPONSE * 92.Ft OCSP_RESPONSE *
92.Fn OCSP_RESPONSE_new void 93.Fn OCSP_RESPONSE_new void
diff --git a/src/lib/libcrypto/man/OCSP_sendreq_new.3 b/src/lib/libcrypto/man/OCSP_sendreq_new.3
index 300f719525..c6608ecce7 100644
--- a/src/lib/libcrypto/man/OCSP_sendreq_new.3
+++ b/src/lib/libcrypto/man/OCSP_sendreq_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: OCSP_sendreq_new.3,v 1.10 2022/03/31 17:27:17 naddy Exp $ 1.\" $OpenBSD: OCSP_sendreq_new.3,v 1.11 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: March 31 2022 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt OCSP_SENDREQ_NEW 3 69.Dt OCSP_SENDREQ_NEW 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -78,6 +78,7 @@
78.Nm OCSP_sendreq_bio 78.Nm OCSP_sendreq_bio
79.Nd OCSP responder query functions 79.Nd OCSP responder query functions
80.Sh SYNOPSIS 80.Sh SYNOPSIS
81.Lb libcrypto
81.In openssl/ocsp.h 82.In openssl/ocsp.h
82.Ft OCSP_REQ_CTX * 83.Ft OCSP_REQ_CTX *
83.Fo OCSP_sendreq_new 84.Fo OCSP_sendreq_new
diff --git a/src/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 b/src/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3
index 76427a864b..929658c28d 100644
--- a/src/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3
+++ b/src/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: OPENSSL_VERSION_NUMBER.3,v 1.13 2023/11/16 20:17:04 schwarze Exp $ 1.\" $OpenBSD: OPENSSL_VERSION_NUMBER.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL 1f13ad31 Dec 25 17:50:39 2017 +0800 2.\" full merge up to: OpenSSL 1f13ad31 Dec 25 17:50:39 2017 +0800
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -68,7 +68,7 @@
68.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 68.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
69.\" OF THE POSSIBILITY OF SUCH DAMAGE. 69.\" OF THE POSSIBILITY OF SUCH DAMAGE.
70.\" 70.\"
71.Dd $Mdocdate: November 16 2023 $ 71.Dd $Mdocdate: June 8 2025 $
72.Dt OPENSSL_VERSION_NUMBER 3 72.Dt OPENSSL_VERSION_NUMBER 3
73.Os 73.Os
74.Sh NAME 74.Sh NAME
@@ -82,6 +82,7 @@
82.Nm SSLeay_version 82.Nm SSLeay_version
83.Nd get OpenSSL version number 83.Nd get OpenSSL version number
84.Sh SYNOPSIS 84.Sh SYNOPSIS
85.Lb libcrypto
85.In openssl/opensslv.h 86.In openssl/opensslv.h
86.Fd #define OPENSSL_VERSION_NUMBER 0x020000000L 87.Fd #define OPENSSL_VERSION_NUMBER 0x020000000L
87.Fd #define LIBRESSL_VERSION_NUMBER 0x02nnnn00fL 88.Fd #define LIBRESSL_VERSION_NUMBER 0x02nnnn00fL
diff --git a/src/lib/libcrypto/man/OPENSSL_cleanse.3 b/src/lib/libcrypto/man/OPENSSL_cleanse.3
index 95fe6b86fd..cf16405db9 100644
--- a/src/lib/libcrypto/man/OPENSSL_cleanse.3
+++ b/src/lib/libcrypto/man/OPENSSL_cleanse.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: OPENSSL_cleanse.3,v 1.4 2019/06/10 09:49:48 schwarze Exp $ 1.\" $OpenBSD: OPENSSL_cleanse.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 10 2019 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt OPENSSL_CLEANSE 3 18.Dt OPENSSL_CLEANSE 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm OPENSSL_cleanse 21.Nm OPENSSL_cleanse
22.Nd OpenSSL memory cleaning operation 22.Nd OpenSSL memory cleaning operation
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
24.In openssl/crypto.h 25.In openssl/crypto.h
25.Ft void 26.Ft void
26.Fo OPENSSL_cleanse 27.Fo OPENSSL_cleanse
diff --git a/src/lib/libcrypto/man/OPENSSL_config.3 b/src/lib/libcrypto/man/OPENSSL_config.3
index f5f31571a1..e21b9817de 100644
--- a/src/lib/libcrypto/man/OPENSSL_config.3
+++ b/src/lib/libcrypto/man/OPENSSL_config.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: OPENSSL_config.3,v 1.16 2023/11/19 21:01:27 tb Exp $ 1.\" $OpenBSD: OPENSSL_config.3,v 1.18 2025/06/09 12:43:53 schwarze Exp $
2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: November 19 2023 $ 68.Dd $Mdocdate: June 9 2025 $
69.Dt OPENSSL_CONFIG 3 69.Dt OPENSSL_CONFIG 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -73,6 +73,7 @@
73.Nm OPENSSL_no_config 73.Nm OPENSSL_no_config
74.Nd simple crypto and ssl library configuration 74.Nd simple crypto and ssl library configuration
75.Sh SYNOPSIS 75.Sh SYNOPSIS
76.Lb libcrypto
76.In openssl/conf.h 77.In openssl/conf.h
77.Ft void 78.Ft void
78.Fo OPENSSL_config 79.Fo OPENSSL_config
@@ -117,13 +118,11 @@ To use a non-standard configuration file, refer to
117Internally, 118Internally,
118.Fn OPENSSL_config 119.Fn OPENSSL_config
119calls 120calls
120.Xr OPENSSL_init_crypto 3 121.Xr OPENSSL_init_crypto 3 .
121and
122.Xr OPENSSL_load_builtin_modules 3 .
123.Pp 122.Pp
124If an application is compiled with the preprocessor symbol 123If an application is compiled with the preprocessor symbol
125.Dv OPENSSL_LOAD_CONF 124.Dv OPENSSL_LOAD_CONF
126#define'd, 125defined,
127.Xr OpenSSL_add_all_algorithms 3 126.Xr OpenSSL_add_all_algorithms 3
128automatically calls 127automatically calls
129.Fn OPENSSL_config . 128.Fn OPENSSL_config .
@@ -140,7 +139,6 @@ standard configuration file
140.Xr CONF_modules_free 3 , 139.Xr CONF_modules_free 3 ,
141.Xr CONF_modules_load_file 3 , 140.Xr CONF_modules_load_file 3 ,
142.Xr crypto 3 , 141.Xr crypto 3 ,
143.Xr OPENSSL_load_builtin_modules 3 ,
144.Xr OPENSSL_VERSION_NUMBER 3 , 142.Xr OPENSSL_VERSION_NUMBER 3 ,
145.Xr openssl.cnf 5 , 143.Xr openssl.cnf 5 ,
146.Xr x509v3.cnf 5 144.Xr x509v3.cnf 5
diff --git a/src/lib/libcrypto/man/OPENSSL_init_crypto.3 b/src/lib/libcrypto/man/OPENSSL_init_crypto.3
index 6f38c7bda2..5c29d55aa9 100644
--- a/src/lib/libcrypto/man/OPENSSL_init_crypto.3
+++ b/src/lib/libcrypto/man/OPENSSL_init_crypto.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: OPENSSL_init_crypto.3,v 1.5 2020/05/24 12:21:31 schwarze Exp $ 1.\" $OpenBSD: OPENSSL_init_crypto.3,v 1.7 2025/06/09 12:43:53 schwarze Exp $
2.\" Copyright (c) 2018, 2020 Ingo Schwarze <schwarze@openbsd.org> 2.\" Copyright (c) 2018, 2020 Ingo Schwarze <schwarze@openbsd.org>
3.\" 3.\"
4.\" Permission to use, copy, modify, and distribute this software for any 4.\" Permission to use, copy, modify, and distribute this software for any
@@ -13,7 +13,7 @@
13.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15.\" 15.\"
16.Dd $Mdocdate: May 24 2020 $ 16.Dd $Mdocdate: June 9 2025 $
17.Dt OPENSSL_INIT_CRYPTO 3 17.Dt OPENSSL_INIT_CRYPTO 3
18.Os 18.Os
19.Sh NAME 19.Sh NAME
@@ -21,6 +21,7 @@
21.Nm OPENSSL_init 21.Nm OPENSSL_init
22.Nd initialise the crypto library 22.Nd initialise the crypto library
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
24.In openssl/crypto.h 25.In openssl/crypto.h
25.Ft int 26.Ft int
26.Fo OPENSSL_init_crypto 27.Fo OPENSSL_init_crypto
@@ -54,10 +55,7 @@ If
54is called before any other crypto or ssl functions, the crypto 55is called before any other crypto or ssl functions, the crypto
55library is initialised by allocating various internal resources, 56library is initialised by allocating various internal resources,
56in particular calling 57in particular calling
57.Xr ERR_load_crypto_strings 3 , 58.Xr ERR_load_crypto_strings 3 .
58.Xr OpenSSL_add_all_ciphers 3 ,
59and
60.Xr OpenSSL_add_all_digests 3 .
61.Pp 59.Pp
62The following 60The following
63.Fa options 61.Fa options
@@ -92,7 +90,6 @@ is intended to return 1 on success or 0 on error.
92.Sh SEE ALSO 90.Sh SEE ALSO
93.Xr CONF_modules_load_file 3 , 91.Xr CONF_modules_load_file 3 ,
94.Xr OPENSSL_config 3 , 92.Xr OPENSSL_config 3 ,
95.Xr OPENSSL_load_builtin_modules 3 ,
96.Xr openssl.cnf 5 93.Xr openssl.cnf 5
97.Sh HISTORY 94.Sh HISTORY
98.Fn OPENSSL_init 95.Fn OPENSSL_init
diff --git a/src/lib/libcrypto/man/OPENSSL_load_builtin_modules.3 b/src/lib/libcrypto/man/OPENSSL_load_builtin_modules.3
deleted file mode 100644
index 2b20efaf0e..0000000000
--- a/src/lib/libcrypto/man/OPENSSL_load_builtin_modules.3
+++ /dev/null
@@ -1,101 +0,0 @@
1.\" $OpenBSD: OPENSSL_load_builtin_modules.3,v 1.8 2023/12/05 02:41:13 jsg Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
5.\" Copyright (c) 2004, 2013 The OpenSSL Project. All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\"
11.\" 1. Redistributions of source code must retain the above copyright
12.\" notice, this list of conditions and the following disclaimer.
13.\"
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in
16.\" the documentation and/or other materials provided with the
17.\" distribution.
18.\"
19.\" 3. All advertising materials mentioning features or use of this
20.\" software must display the following acknowledgment:
21.\" "This product includes software developed by the OpenSSL Project
22.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
23.\"
24.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
25.\" endorse or promote products derived from this software without
26.\" prior written permission. For written permission, please contact
27.\" openssl-core@openssl.org.
28.\"
29.\" 5. Products derived from this software may not be called "OpenSSL"
30.\" nor may "OpenSSL" appear in their names without prior written
31.\" permission of the OpenSSL Project.
32.\"
33.\" 6. Redistributions of any form whatsoever must retain the following
34.\" acknowledgment:
35.\" "This product includes software developed by the OpenSSL Project
36.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
37.\"
38.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
39.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
41.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
42.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
47.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\"
51.Dd $Mdocdate: December 5 2023 $
52.Dt OPENSSL_LOAD_BUILTIN_MODULES 3
53.Os
54.Sh NAME
55.Nm OPENSSL_load_builtin_modules ,
56.Nm ASN1_add_oid_module
57.Nd add standard configuration modules
58.Sh SYNOPSIS
59.In openssl/conf.h
60.Ft void
61.Fn OPENSSL_load_builtin_modules void
62.Ft void
63.Fn ASN1_add_oid_module void
64.Sh DESCRIPTION
65The function
66.Fn OPENSSL_load_builtin_modules
67adds all the standard OpenSSL configuration modules to the internal
68list.
69They can then be used by the OpenSSL configuration code.
70.Pp
71.Fn ASN1_add_oid_module
72adds just the ASN.1 OBJECT module.
73.Pp
74If the simple configuration function
75.Xr OPENSSL_config 3
76is called then
77.Fn OPENSSL_load_builtin_modules
78is called automatically.
79.Pp
80Applications which use configuration functions like
81.Xr CONF_modules_load_file 3
82directly need to call
83.Fn OPENSSL_load_builtin_modules
84themselves
85.Em before
86any other configuration code.
87.Pp
88Applications should call
89.Xr OPENSSL_config 3
90or
91.Fn OPENSSL_load_builtin_modules
92to load all configuration modules instead of adding modules selectively:
93otherwise functionality may be missing from the application when
94new modules are added.
95.Sh SEE ALSO
96.Xr CONF_modules_load_file 3 ,
97.Xr OPENSSL_config 3
98.Sh HISTORY
99These functions first appeared in OpenSSL 0.9.7
100and have been available since
101.Ox 3.2 .
diff --git a/src/lib/libcrypto/man/OPENSSL_malloc.3 b/src/lib/libcrypto/man/OPENSSL_malloc.3
index a43dc56923..6e87d030d8 100644
--- a/src/lib/libcrypto/man/OPENSSL_malloc.3
+++ b/src/lib/libcrypto/man/OPENSSL_malloc.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: OPENSSL_malloc.3,v 1.13 2024/04/04 09:30:43 tb Exp $ 1.\" $OpenBSD: OPENSSL_malloc.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: April 4 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt OPENSSL_MALLOC 3 18.Dt OPENSSL_MALLOC 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -26,6 +26,7 @@
26.Nm CRYPTO_strdup 26.Nm CRYPTO_strdup
27.Nd legacy OpenSSL memory allocation wrappers 27.Nd legacy OpenSSL memory allocation wrappers
28.Sh SYNOPSIS 28.Sh SYNOPSIS
29.Lb libcrypto
29.In openssl/crypto.h 30.In openssl/crypto.h
30.Ft void * 31.Ft void *
31.Fo OPENSSL_malloc 32.Fo OPENSSL_malloc
diff --git a/src/lib/libcrypto/man/OPENSSL_sk_new.3 b/src/lib/libcrypto/man/OPENSSL_sk_new.3
index 8f06bb4212..632bc9d39f 100644
--- a/src/lib/libcrypto/man/OPENSSL_sk_new.3
+++ b/src/lib/libcrypto/man/OPENSSL_sk_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: OPENSSL_sk_new.3,v 1.13 2024/03/04 09:47:34 tb Exp $ 1.\" $OpenBSD: OPENSSL_sk_new.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 4 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt OPENSSL_SK_NEW 3 18.Dt OPENSSL_SK_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -40,6 +40,7 @@
40.Nm sk_zero 40.Nm sk_zero
41.Nd variable-sized arrays of void pointers, called OpenSSL stacks 41.Nd variable-sized arrays of void pointers, called OpenSSL stacks
42.Sh SYNOPSIS 42.Sh SYNOPSIS
43.Lb libcrypto
43.In openssl/stack.h 44.In openssl/stack.h
44.Ft _STACK * 45.Ft _STACK *
45.Fn sk_new_null void 46.Fn sk_new_null void
diff --git a/src/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 b/src/lib/libcrypto/man/OpenSSL_add_all_algorithms.3
index 88ecef9768..68d8799bd4 100644
--- a/src/lib/libcrypto/man/OpenSSL_add_all_algorithms.3
+++ b/src/lib/libcrypto/man/OpenSSL_add_all_algorithms.3
@@ -1,7 +1,24 @@
1.\" $OpenBSD: OpenSSL_add_all_algorithms.3,v 1.16 2024/03/04 19:04:47 tb Exp $ 1.\" $OpenBSD: OpenSSL_add_all_algorithms.3,v 1.19 2025/06/12 15:59:30 schwarze Exp $
2.\" full merge up to: OpenSSL b3696a55 Sep 2 09:35:50 2017 -0400 2.\" full merge up to: OpenSSL b3696a55 Sep 2 09:35:50 2017 -0400
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file is a derived work.
5.\" The changes are covered by the following Copyright and license:
6.\"
7.\" Copyright (c) 2018, 2019, 2023, 2025 Ingo Schwarze <schwarze@openbsd.org>
8.\"
9.\" Permission to use, copy, modify, and distribute this software for any
10.\" purpose with or without fee is hereby granted, provided that the above
11.\" copyright notice and this permission notice appear in all copies.
12.\"
13.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20.\"
21.\" The original file was written by Dr. Stephen Henson <steve@openssl.org>.
5.\" Copyright (c) 2000, 2003, 2013 The OpenSSL Project. All rights reserved. 22.\" Copyright (c) 2000, 2003, 2013 The OpenSSL Project. All rights reserved.
6.\" 23.\"
7.\" Redistribution and use in source and binary forms, with or without 24.\" Redistribution and use in source and binary forms, with or without
@@ -48,7 +65,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 67.\"
51.Dd $Mdocdate: March 4 2024 $ 68.Dd $Mdocdate: June 12 2025 $
52.Dt OPENSSL_ADD_ALL_ALGORITHMS 3 69.Dt OPENSSL_ADD_ALL_ALGORITHMS 3
53.Os 70.Os
54.Sh NAME 71.Sh NAME
@@ -64,6 +81,7 @@
64.\" because they are unused aliases. 81.\" because they are unused aliases.
65.Nd add algorithms to internal table 82.Nd add algorithms to internal table
66.Sh SYNOPSIS 83.Sh SYNOPSIS
84.Lb libcrypto
67.In openssl/evp.h 85.In openssl/evp.h
68.Ft void 86.Ft void
69.Fn OpenSSL_add_all_algorithms void 87.Fn OpenSSL_add_all_algorithms void
@@ -79,40 +97,43 @@
79These functions are deprecated. 97These functions are deprecated.
80It is never useful for any application program 98It is never useful for any application program
81to call any of them explicitly. 99to call any of them explicitly.
82The library automatically calls them internally whenever needed. 100Most of them have no effect except that they may or may not call
101.Xr OPENSSL_init_crypto 3 .
83.Pp 102.Pp
84OpenSSL keeps an internal table of digest algorithms and ciphers. 103The library contains internal tables of digest algorithms and ciphers.
85It uses this table to look up ciphers via functions such as 104It uses these tables to look up digests and ciphers via
86.Xr EVP_get_cipherbyname 3 . 105.Xr EVP_get_digestbyname 3
106and
107.Xr EVP_get_cipherbyname 3 ,
108respectively.
109In LibreSSL, these tables are static constants and do not require
110initialization.
87.Pp 111.Pp
88.Fn OpenSSL_add_all_algorithms 112.Fn OpenSSL_add_all_algorithms
89adds all algorithms to the table (digests and ciphers). 113used to add all digests and ciphers to the tables.
90If an application is compiled with the preprocessor symbol 114If an application is compiled with the preprocessor symbol
91.Dv OPENSSL_LOAD_CONF 115.Dv OPENSSL_LOAD_CONF
92#define'd, it also calls 116defined, it also calls
93.Xr OPENSSL_config 3 117.Xr OPENSSL_config 3
94with a 118with a
95.Dv NULL 119.Dv NULL
96argument, loading the default configuration file. 120argument, loading the default configuration file.
121Relying on this behaviour is not recommended.
122If loading a configuration file is desired, call
123.Xr OPENSSL_config 3
124or
125.Xr CONF_modules_load_file 3
126directly.
97.Pp 127.Pp
98.Fn OpenSSL_add_all_digests 128.Fn OpenSSL_add_all_digests
99adds all digest algorithms to the table. 129used to add all digest algorithms to the table.
100.Pp 130.Pp
101.Fn OpenSSL_add_all_ciphers 131.Fn OpenSSL_add_all_ciphers
102adds all encryption algorithms to the table including password based 132used to add all encryption algorithms to the table.
103encryption algorithms.
104.Pp
105If any of the above functions is called more than once,
106only the first call has an effect.
107.Pp 133.Pp
108.Fn EVP_cleanup 134.Fn EVP_cleanup
109removes all ciphers and digests from the table and also calls 135has no effect; it used to remove various kinds of application-supplied
110.Xr OBJ_NAME_cleanup 3 136data that is no longer supported in the first place.
111with an argument of \-1 ,
112thus resetting the global associative array of names
113and all signature algorithm definitions to their default states,
114removing all application-defined types, key-value pairs, and aliases,
115including any that are unrelated to the EVP library.
116.Pp 137.Pp
117.Fn SSLeay_add_all_algorithms 138.Fn SSLeay_add_all_algorithms
118is a deprecated alias for 139is a deprecated alias for
@@ -126,8 +147,6 @@ are implemented as macros.
126.Xr evp 3 , 147.Xr evp 3 ,
127.Xr EVP_DigestInit 3 , 148.Xr EVP_DigestInit 3 ,
128.Xr EVP_EncryptInit 3 , 149.Xr EVP_EncryptInit 3 ,
129.Xr OBJ_cleanup 3 ,
130.Xr OBJ_NAME_add 3 ,
131.Xr OPENSSL_config 3 150.Xr OPENSSL_config 3
132.Sh HISTORY 151.Sh HISTORY
133.Fn EVP_cleanup , 152.Fn EVP_cleanup ,
@@ -148,5 +167,3 @@ first appeared in OpenSSL 0.9.5 and have been available since
148.Sh BUGS 167.Sh BUGS
149Although the functions do not return error codes, it is possible for them 168Although the functions do not return error codes, it is possible for them
150to fail. 169to fail.
151This will only happen as a result of a memory allocation failure so this
152is not too much of a problem in practice.
diff --git a/src/lib/libcrypto/man/PEM_ASN1_read.3 b/src/lib/libcrypto/man/PEM_ASN1_read.3
index 53ebe5ada4..016007d405 100644
--- a/src/lib/libcrypto/man/PEM_ASN1_read.3
+++ b/src/lib/libcrypto/man/PEM_ASN1_read.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PEM_ASN1_read.3,v 1.2 2020/07/23 17:34:53 schwarze Exp $ 1.\" $OpenBSD: PEM_ASN1_read.3,v 1.4 2025/07/16 17:59:10 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: July 23 2020 $ 17.Dd $Mdocdate: July 16 2025 $
18.Dt PEM_ASN1_READ 3 18.Dt PEM_ASN1_READ 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -23,6 +23,7 @@
23.Nm PEM_ASN1_read_bio 23.Nm PEM_ASN1_read_bio
24.Nd PEM and DER decode an arbitrary ASN.1 value 24.Nd PEM and DER decode an arbitrary ASN.1 value
25.Sh SYNOPSIS 25.Sh SYNOPSIS
26.Lb libcrypto
26.In openssl/pem.h 27.In openssl/pem.h
27.Ft typedef void * 28.Ft typedef void *
28.Fo d2i_of_void 29.Fo d2i_of_void
@@ -165,7 +166,7 @@ Additional types of errors can result from
165.Xr PEM_read 3 , 166.Xr PEM_read 3 ,
166.Xr PEM_read_bio_PrivateKey 3 , 167.Xr PEM_read_bio_PrivateKey 3 ,
167.Xr PEM_read_SSL_SESSION 3 , 168.Xr PEM_read_SSL_SESSION 3 ,
168.Xr PEM_X509_INFO_read 3 169.Xr PEM_X509_INFO_read_bio 3
169.Sh HISTORY 170.Sh HISTORY
170These functions first appeared in SSLeay 0.5.1 171These functions first appeared in SSLeay 0.5.1
171and have been available since 172and have been available since
diff --git a/src/lib/libcrypto/man/PEM_X509_INFO_read.3 b/src/lib/libcrypto/man/PEM_X509_INFO_read_bio.3
index b3216a89b6..7d34951df0 100644
--- a/src/lib/libcrypto/man/PEM_X509_INFO_read.3
+++ b/src/lib/libcrypto/man/PEM_X509_INFO_read_bio.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PEM_X509_INFO_read.3,v 1.4 2021/10/19 10:39:33 schwarze Exp $ 1.\" $OpenBSD: PEM_X509_INFO_read_bio.3,v 1.1 2025/07/17 10:31:50 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,23 +14,16 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: October 19 2021 $ 17.Dd $Mdocdate: July 17 2025 $
18.Dt PEM_X509_INFO_READ 3 18.Dt PEM_X509_INFO_READ_BIO 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm PEM_X509_INFO_read ,
22.Nm PEM_X509_INFO_read_bio 21.Nm PEM_X509_INFO_read_bio
23.Nd PEM and DER decode X.509 certificates, private keys, and revocation lists 22.Nd PEM and DER decode X.509 certificates, private keys, and revocation lists
24.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
25.In openssl/pem.h 25.In openssl/pem.h
26.Ft STACK_OF(X509_INFO) * 26.Ft STACK_OF(X509_INFO) *
27.Fo PEM_X509_INFO_read
28.Fa "FILE *in_fp"
29.Fa "STACK_OF(X509_INFO) *sk"
30.Fa "pem_password_cb *cb"
31.Fa "void *u"
32.Fc
33.Ft STACK_OF(X509_INFO) *
34.Fo PEM_X509_INFO_read_bio 27.Fo PEM_X509_INFO_read_bio
35.Fa "BIO *in_bp" 28.Fa "BIO *in_bp"
36.Fa "STACK_OF(X509_INFO) *sk" 29.Fa "STACK_OF(X509_INFO) *sk"
@@ -38,13 +31,11 @@
38.Fa "void *u" 31.Fa "void *u"
39.Fc 32.Fc
40.Sh DESCRIPTION 33.Sh DESCRIPTION
41These functions read zero or more objects 34This function reads zero or more objects
42related to X.509 certificates from 35related to X.509 certificates from
43.Fa in_fp
44or
45.Fa in_bp , 36.Fa in_bp ,
46perform both PEM and DER decoding, 37performs both PEM and DER decoding,
47and wrap the resulting objects in newly allocated 38and wraps the resulting objects in newly allocated
48.Vt X509_INFO 39.Vt X509_INFO
49containers. 40containers.
50.Pp 41.Pp
@@ -109,11 +100,11 @@ during the same call are deleted again and
109.Fa sk 100.Fa sk
110is left unchanged. 101is left unchanged.
111.Sh RETURN VALUES 102.Sh RETURN VALUES
112These functions return a pointer to the stack 103This function returns a pointer to the stack
113the objects read were pushed onto or 104the objects read were pushed onto or
114.Dv NULL 105.Dv NULL
115if an error occurs. 106if an error occurs.
116They fail if 107It fails if
117.Xr PEM_read_bio 3 , 108.Xr PEM_read_bio 3 ,
118.Xr PEM_get_EVP_CIPHER_INFO 3 , 109.Xr PEM_get_EVP_CIPHER_INFO 3 ,
119.Xr PEM_do_header 3 , 110.Xr PEM_do_header 3 ,
@@ -128,9 +119,6 @@ include:
128.Bl -tag -width Ds 119.Bl -tag -width Ds
129.It Dv ERR_R_ASN1_LIB Qq "ASN1 lib" 120.It Dv ERR_R_ASN1_LIB Qq "ASN1 lib"
130DER decoding of a PEM object failed. 121DER decoding of a PEM object failed.
131.It Dv ERR_R_BUF_LIB Qq BUF lib
132.Fn PEM_X509_INFO_read
133failed to set up a temporary BIO, for example because memory was exhausted.
134.It Dv ERR_R_MALLOC_FAILURE Qq "malloc failure" 122.It Dv ERR_R_MALLOC_FAILURE Qq "malloc failure"
135.Fn PEM_X509_INFO_read_bio 123.Fn PEM_X509_INFO_read_bio
136failed to allocate a new 124failed to allocate a new
@@ -147,7 +135,7 @@ Additional types of errors can result from
147and 135and
148.Xr PEM_do_header 3 . 136.Xr PEM_do_header 3 .
149.Pp 137.Pp
150After these functions failed due to memory exhaustion, 138After this function failed due to memory exhaustion,
151.Xr ERR_get_error 3 139.Xr ERR_get_error 3
152may sometimes return 0 anyway. 140may sometimes return 0 anyway.
153.Sh SEE ALSO 141.Sh SEE ALSO
@@ -162,14 +150,10 @@ may sometimes return 0 anyway.
162.Xr X509_CRL_new 3 , 150.Xr X509_CRL_new 3 ,
163.Xr X509_INFO_new 3 , 151.Xr X509_INFO_new 3 ,
164.Xr X509_LOOKUP_new 3 , 152.Xr X509_LOOKUP_new 3 ,
165.Xr X509_new 3 , 153.Xr X509_new 3
166.Xr X509_PKEY_new 3
167.Sh HISTORY 154.Sh HISTORY
168.Fn PEM_X509_INFO_read
169first appeared in SSLeay 0.5.1 and
170.Fn PEM_X509_INFO_read_bio 155.Fn PEM_X509_INFO_read_bio
171in SSLeay 0.6.0. 156first appeared in SSLeay 0.6.0 and has been available since
172Both functions have been available since
173.Ox 2.4 . 157.Ox 2.4 .
174.Sh CAVEATS 158.Sh CAVEATS
175It is not an error 159It is not an error
@@ -184,6 +168,6 @@ a newly allocated, empty stack is returned.
184The only way to detect this situation is by comparing 168The only way to detect this situation is by comparing
185the number of objects on the stack before and after the call. 169the number of objects on the stack before and after the call.
186.Sh BUGS 170.Sh BUGS
187When reaching the end of the input, these functions call 171When reaching the end of the input, this function calls
188.Xr ERR_clear_error 3 , 172.Xr ERR_clear_error 3 ,
189which may hide errors that occurred before calling these functions. 173which may hide errors that occurred before calling it.
diff --git a/src/lib/libcrypto/man/PEM_bytes_read_bio.3 b/src/lib/libcrypto/man/PEM_bytes_read_bio.3
index 20ad6b8a4d..69cb26ce8d 100644
--- a/src/lib/libcrypto/man/PEM_bytes_read_bio.3
+++ b/src/lib/libcrypto/man/PEM_bytes_read_bio.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PEM_bytes_read_bio.3,v 1.6 2020/07/23 17:34:53 schwarze Exp $ 1.\" $OpenBSD: PEM_bytes_read_bio.3,v 1.8 2025/07/16 17:59:10 schwarze Exp $
2.\" selective merge up to: 2.\" selective merge up to:
3.\" OpenSSL PEM_bytes_read_bio.pod 7671342e Feb 29 15:47:12 2016 -0600 3.\" OpenSSL PEM_bytes_read_bio.pod 7671342e Feb 29 15:47:12 2016 -0600
4.\" 4.\"
@@ -65,13 +65,14 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: July 23 2020 $ 68.Dd $Mdocdate: July 16 2025 $
69.Dt PEM_BYTES_READ_BIO 3 69.Dt PEM_BYTES_READ_BIO 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
72.Nm PEM_bytes_read_bio 72.Nm PEM_bytes_read_bio
73.Nd read a PEM-encoded data structure from a BIO 73.Nd read a PEM-encoded data structure from a BIO
74.Sh SYNOPSIS 74.Sh SYNOPSIS
75.Lb libcrypto
75.In openssl/pem.h 76.In openssl/pem.h
76.Ft int 77.Ft int
77.Fo PEM_bytes_read_bio 78.Fo PEM_bytes_read_bio
@@ -175,7 +176,7 @@ Additional types of errors can result from
175.Xr PEM_ASN1_read 3 , 176.Xr PEM_ASN1_read 3 ,
176.Xr PEM_read 3 , 177.Xr PEM_read 3 ,
177.Xr PEM_read_bio_PrivateKey 3 , 178.Xr PEM_read_bio_PrivateKey 3 ,
178.Xr PEM_X509_INFO_read 3 179.Xr PEM_X509_INFO_read_bio 3
179.Sh STANDARDS 180.Sh STANDARDS
180RFC 1421: Privacy Enhancement for Internet Electronic Mail (PEM), Part I 181RFC 1421: Privacy Enhancement for Internet Electronic Mail (PEM), Part I
181.Sh HISTORY 182.Sh HISTORY
diff --git a/src/lib/libcrypto/man/PEM_read.3 b/src/lib/libcrypto/man/PEM_read.3
index 1493d54fc4..de93b3e903 100644
--- a/src/lib/libcrypto/man/PEM_read.3
+++ b/src/lib/libcrypto/man/PEM_read.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PEM_read.3,v 1.15 2023/09/18 15:26:46 schwarze Exp $ 1.\" $OpenBSD: PEM_read.3,v 1.17 2025/07/16 17:59:10 schwarze Exp $
2.\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 2.\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: September 18 2023 $ 69.Dd $Mdocdate: July 16 2025 $
70.Dt PEM_READ 3 70.Dt PEM_READ 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -80,6 +80,7 @@
80.Nm pem_password_cb 80.Nm pem_password_cb
81.Nd PEM encoding routines 81.Nd PEM encoding routines
82.Sh SYNOPSIS 82.Sh SYNOPSIS
83.Lb libcrypto
83.In openssl/pem.h 84.In openssl/pem.h
84.Ft int 85.Ft int
85.Fo PEM_write 86.Fo PEM_write
@@ -395,7 +396,7 @@ to fail may differ.
395.Xr PEM_read_SSL_SESSION 3 , 396.Xr PEM_read_SSL_SESSION 3 ,
396.Xr PEM_write_bio_CMS_stream 3 , 397.Xr PEM_write_bio_CMS_stream 3 ,
397.Xr PEM_write_bio_PKCS7_stream 3 , 398.Xr PEM_write_bio_PKCS7_stream 3 ,
398.Xr PEM_X509_INFO_read 3 399.Xr PEM_X509_INFO_read_bio 3
399.Sh HISTORY 400.Sh HISTORY
400.Fn PEM_write , 401.Fn PEM_write ,
401.Fn PEM_read , 402.Fn PEM_read ,
diff --git a/src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3 b/src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3
index 9f45261725..9ef136de7e 100644
--- a/src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3
+++ b/src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PEM_read_bio_PrivateKey.3,v 1.23 2024/09/02 08:04:32 tb Exp $ 1.\" $OpenBSD: PEM_read_bio_PrivateKey.3,v 1.25 2025/07/16 17:59:10 schwarze Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL man3/PEM_read_bio_PrivateKey.pod 18bad535 Apr 9 15:13:55 2019 +0100 3.\" OpenSSL man3/PEM_read_bio_PrivateKey.pod 18bad535 Apr 9 15:13:55 2019 +0100
4.\" OpenSSL man3/PEM_read_CMS.pod 83cf7abf May 29 13:07:08 2018 +0100 4.\" OpenSSL man3/PEM_read_CMS.pod 83cf7abf May 29 13:07:08 2018 +0100
@@ -51,7 +51,7 @@
51.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
52.\" OF THE POSSIBILITY OF SUCH DAMAGE. 52.\" OF THE POSSIBILITY OF SUCH DAMAGE.
53.\" 53.\"
54.Dd $Mdocdate: September 2 2024 $ 54.Dd $Mdocdate: July 16 2025 $
55.Dt PEM_READ_BIO_PRIVATEKEY 3 55.Dt PEM_READ_BIO_PRIVATEKEY 3
56.Os 56.Os
57.Sh NAME 57.Sh NAME
@@ -143,6 +143,7 @@
143.Nm PEM_write_bio_CMS 143.Nm PEM_write_bio_CMS
144.Nd PEM routines 144.Nd PEM routines
145.Sh SYNOPSIS 145.Sh SYNOPSIS
146.Lb libcrypto
146.In openssl/pem.h 147.In openssl/pem.h
147.Ft EVP_PKEY * 148.Ft EVP_PKEY *
148.Fo PEM_read_bio_PrivateKey 149.Fo PEM_read_bio_PrivateKey
@@ -1183,7 +1184,7 @@ pass_cb(char *buf, int size, int rwflag, void *u)
1183.Xr PEM_read_SSL_SESSION 3 , 1184.Xr PEM_read_SSL_SESSION 3 ,
1184.Xr PEM_write_bio_CMS_stream 3 , 1185.Xr PEM_write_bio_CMS_stream 3 ,
1185.Xr PEM_write_bio_PKCS7_stream 3 , 1186.Xr PEM_write_bio_PKCS7_stream 3 ,
1186.Xr PEM_X509_INFO_read 3 , 1187.Xr PEM_X509_INFO_read_bio 3 ,
1187.Xr RSA_new 3 , 1188.Xr RSA_new 3 ,
1188.Xr X509_CRL_new 3 , 1189.Xr X509_CRL_new 3 ,
1189.Xr X509_REQ_new 3 , 1190.Xr X509_REQ_new 3 ,
diff --git a/src/lib/libcrypto/man/PEM_write_bio_CMS_stream.3 b/src/lib/libcrypto/man/PEM_write_bio_CMS_stream.3
index 88adbba74f..a858874bab 100644
--- a/src/lib/libcrypto/man/PEM_write_bio_CMS_stream.3
+++ b/src/lib/libcrypto/man/PEM_write_bio_CMS_stream.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PEM_write_bio_CMS_stream.3,v 1.6 2023/05/01 07:28:11 tb Exp $ 1.\" $OpenBSD: PEM_write_bio_CMS_stream.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 2.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: May 1 2023 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt PEM_WRITE_BIO_CMS_STREAM 3 52.Dt PEM_WRITE_BIO_CMS_STREAM 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm PEM_write_bio_CMS_stream 55.Nm PEM_write_bio_CMS_stream
56.Nd output CMS_ContentInfo structure in PEM format 56.Nd output CMS_ContentInfo structure in PEM format
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/cms.h 59.In openssl/cms.h
59.Ft int 60.Ft int
60.Fo PEM_write_bio_CMS_stream 61.Fo PEM_write_bio_CMS_stream
diff --git a/src/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3 b/src/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3
index 9050b8562f..a731767049 100644
--- a/src/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3
+++ b/src/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PEM_write_bio_PKCS7_stream.3,v 1.12 2023/05/01 07:28:11 tb Exp $ 1.\" $OpenBSD: PEM_write_bio_PKCS7_stream.3,v 1.13 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 2.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: May 1 2023 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt PEM_WRITE_BIO_PKCS7_STREAM 3 52.Dt PEM_WRITE_BIO_PKCS7_STREAM 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm PEM_write_bio_PKCS7_stream 55.Nm PEM_write_bio_PKCS7_stream
56.Nd output PKCS7 structure in PEM format 56.Nd output PKCS7 structure in PEM format
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/pkcs7.h 59.In openssl/pkcs7.h
59.Ft int 60.Ft int
60.Fo PEM_write_bio_PKCS7_stream 61.Fo PEM_write_bio_PKCS7_stream
diff --git a/src/lib/libcrypto/man/PKCS12_SAFEBAG_new.3 b/src/lib/libcrypto/man/PKCS12_SAFEBAG_new.3
index e7d20ea7f6..45bdc20bc9 100644
--- a/src/lib/libcrypto/man/PKCS12_SAFEBAG_new.3
+++ b/src/lib/libcrypto/man/PKCS12_SAFEBAG_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PKCS12_SAFEBAG_new.3,v 1.4 2019/06/06 01:06:58 schwarze Exp $ 1.\" $OpenBSD: PKCS12_SAFEBAG_new.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 6 2019 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt PKCS12_SAFEBAG_NEW 3 18.Dt PKCS12_SAFEBAG_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -24,6 +24,7 @@
24.Nm PKCS12_BAGS_free 24.Nm PKCS12_BAGS_free
25.Nd PKCS#12 container for one piece of information 25.Nd PKCS#12 container for one piece of information
26.Sh SYNOPSIS 26.Sh SYNOPSIS
27.Lb libcrypto
27.In openssl/pkcs12.h 28.In openssl/pkcs12.h
28.Ft PKCS12_SAFEBAG * 29.Ft PKCS12_SAFEBAG *
29.Fn PKCS12_SAFEBAG_new void 30.Fn PKCS12_SAFEBAG_new void
diff --git a/src/lib/libcrypto/man/PKCS12_create.3 b/src/lib/libcrypto/man/PKCS12_create.3
index 904166da73..80471ca88a 100644
--- a/src/lib/libcrypto/man/PKCS12_create.3
+++ b/src/lib/libcrypto/man/PKCS12_create.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PKCS12_create.3,v 1.13 2024/08/22 12:26:01 tb Exp $ 1.\" $OpenBSD: PKCS12_create.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL 05ea606a May 20 20:52:46 2016 -0400 2.\" full merge up to: OpenSSL 05ea606a May 20 20:52:46 2016 -0400
3.\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 3.\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800
4.\" 4.\"
@@ -49,13 +49,14 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: August 22 2024 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt PKCS12_CREATE 3 53.Dt PKCS12_CREATE 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
56.Nm PKCS12_create 56.Nm PKCS12_create
57.Nd create a PKCS#12 structure 57.Nd create a PKCS#12 structure
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libcrypto
59.In openssl/pkcs12.h 60.In openssl/pkcs12.h
60.Ft PKCS12 * 61.Ft PKCS12 *
61.Fo PKCS12_create 62.Fo PKCS12_create
diff --git a/src/lib/libcrypto/man/PKCS12_new.3 b/src/lib/libcrypto/man/PKCS12_new.3
index c7ccdb4911..1506eaade3 100644
--- a/src/lib/libcrypto/man/PKCS12_new.3
+++ b/src/lib/libcrypto/man/PKCS12_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PKCS12_new.3,v 1.4 2019/06/06 01:06:58 schwarze Exp $ 1.\" $OpenBSD: PKCS12_new.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 6 2019 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt PKCS12_NEW 3 18.Dt PKCS12_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -24,6 +24,7 @@
24.Nm PKCS12_MAC_DATA_free 24.Nm PKCS12_MAC_DATA_free
25.Nd PKCS#12 personal information exchange (PFX) 25.Nd PKCS#12 personal information exchange (PFX)
26.Sh SYNOPSIS 26.Sh SYNOPSIS
27.Lb libcrypto
27.In openssl/pkcs12.h 28.In openssl/pkcs12.h
28.Ft PKCS12 * 29.Ft PKCS12 *
29.Fn PKCS12_new void 30.Fn PKCS12_new void
diff --git a/src/lib/libcrypto/man/PKCS12_newpass.3 b/src/lib/libcrypto/man/PKCS12_newpass.3
index b5642c96ea..b4d088e0e8 100644
--- a/src/lib/libcrypto/man/PKCS12_newpass.3
+++ b/src/lib/libcrypto/man/PKCS12_newpass.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PKCS12_newpass.3,v 1.4 2019/06/14 13:59:32 schwarze Exp $ 1.\" $OpenBSD: PKCS12_newpass.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL c95a8b4e May 5 14:26:26 2016 +0100 2.\" OpenSSL c95a8b4e May 5 14:26:26 2016 +0100
3.\" 3.\"
4.\" This file was written by Jeffrey Walton <noloader@gmail.com>. 4.\" This file was written by Jeffrey Walton <noloader@gmail.com>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 14 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt PKCS12_NEWPASS 3 52.Dt PKCS12_NEWPASS 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm PKCS12_newpass 55.Nm PKCS12_newpass
56.Nd change the password of a PKCS#12 structure 56.Nd change the password of a PKCS#12 structure
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/pkcs12.h 59.In openssl/pkcs12.h
59.Ft int 60.Ft int
60.Fo PKCS12_newpass 61.Fo PKCS12_newpass
diff --git a/src/lib/libcrypto/man/PKCS12_parse.3 b/src/lib/libcrypto/man/PKCS12_parse.3
index 4e92d303c7..333d86b672 100644
--- a/src/lib/libcrypto/man/PKCS12_parse.3
+++ b/src/lib/libcrypto/man/PKCS12_parse.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PKCS12_parse.3,v 1.7 2021/07/09 12:07:27 schwarze Exp $ 1.\" $OpenBSD: PKCS12_parse.3,v 1.8 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: July 9 2021 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt PKCS12_PARSE 3 52.Dt PKCS12_PARSE 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm PKCS12_parse 55.Nm PKCS12_parse
56.Nd parse a PKCS#12 structure 56.Nd parse a PKCS#12 structure
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/pkcs12.h 59.In openssl/pkcs12.h
59.Ft int 60.Ft int
60.Fo PKCS12_parse 61.Fo PKCS12_parse
diff --git a/src/lib/libcrypto/man/PKCS5_PBKDF2_HMAC.3 b/src/lib/libcrypto/man/PKCS5_PBKDF2_HMAC.3
index 3a448b92a7..7c113029ee 100644
--- a/src/lib/libcrypto/man/PKCS5_PBKDF2_HMAC.3
+++ b/src/lib/libcrypto/man/PKCS5_PBKDF2_HMAC.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PKCS5_PBKDF2_HMAC.3,v 1.9 2019/06/07 20:46:25 schwarze Exp $ 1.\" $OpenBSD: PKCS5_PBKDF2_HMAC.3,v 1.10 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Jeffrey Walton <noloader@gmail.com>. 4.\" This file was written by Jeffrey Walton <noloader@gmail.com>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 7 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt PKCS5_PBKDF2_HMAC 3 52.Dt PKCS5_PBKDF2_HMAC 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -56,6 +56,7 @@
56.Nm PKCS5_PBKDF2_HMAC_SHA1 56.Nm PKCS5_PBKDF2_HMAC_SHA1
57.Nd password based derivation routines with salt and iteration count 57.Nd password based derivation routines with salt and iteration count
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libcrypto
59.In openssl/evp.h 60.In openssl/evp.h
60.Ft int 61.Ft int
61.Fo PKCS5_PBKDF2_HMAC 62.Fo PKCS5_PBKDF2_HMAC
diff --git a/src/lib/libcrypto/man/PKCS7_add_attribute.3 b/src/lib/libcrypto/man/PKCS7_add_attribute.3
index 4a1c350f98..e7c8c734c4 100644
--- a/src/lib/libcrypto/man/PKCS7_add_attribute.3
+++ b/src/lib/libcrypto/man/PKCS7_add_attribute.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PKCS7_add_attribute.3,v 1.3 2020/06/10 11:39:12 schwarze Exp $ 1.\" $OpenBSD: PKCS7_add_attribute.3,v 1.6 2025/07/27 19:31:20 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 10 2020 $ 17.Dd $Mdocdate: July 27 2025 $
18.Dt PKCS7_ADD_ATTRIBUTE 3 18.Dt PKCS7_ADD_ATTRIBUTE 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -30,6 +30,7 @@
30.Nm PKCS7_add_attrib_smimecap 30.Nm PKCS7_add_attrib_smimecap
31.Nd attributes of SignerInfo objects 31.Nd attributes of SignerInfo objects
32.Sh SYNOPSIS 32.Sh SYNOPSIS
33.Lb libcrypto
33.In openssl/pkcs7.h 34.In openssl/pkcs7.h
34.Ft int 35.Ft int
35.Fo PKCS7_add_attribute 36.Fo PKCS7_add_attribute
@@ -306,6 +307,10 @@ RFC 2985: PKCS #9: Selected Object Classes and Attribute Types Version 2.0,
306section 5.3: Attribute types for use in PKCS #7 data 307section 5.3: Attribute types for use in PKCS #7 data
307and section 5.6: Attributes defined in S/MIME 308and section 5.6: Attributes defined in S/MIME
308.Pp 309.Pp
310RFC 5652: Cryptographic Message Syntax (CMS),
311section 5.3: SignerInfo Type
312and section 11: Useful Attributes
313.Pp
309RFC 8551: Secure/Multipurpose Internet Mail Extensions (S/MIME) 314RFC 8551: Secure/Multipurpose Internet Mail Extensions (S/MIME)
310Version 4.0 Message Specification, 315Version 4.0 Message Specification,
311section 2.5.2: SMIMECapabilities Attribute 316section 2.5.2: SMIMECapabilities Attribute
@@ -345,7 +350,7 @@ in a state that violates the standard.
345.Fn PKCS7_add0_attrib_signing_time 350.Fn PKCS7_add0_attrib_signing_time
346does not validate 351does not validate
347.Fa t 352.Fa t
348in any way. 353beyond checking that it is well-formed per RFC 5652, section 11.3.
349In particular, it may set the signing time to the future 354In particular, it may set the signing time to the future
350or to the remote past. 355or to the remote past.
351.Sh BUGS 356.Sh BUGS
diff --git a/src/lib/libcrypto/man/PKCS7_dataFinal.3 b/src/lib/libcrypto/man/PKCS7_dataFinal.3
index 1a01b2ff61..fdc9da7f9e 100644
--- a/src/lib/libcrypto/man/PKCS7_dataFinal.3
+++ b/src/lib/libcrypto/man/PKCS7_dataFinal.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PKCS7_dataFinal.3,v 1.3 2022/12/26 07:18:52 jmc Exp $ 1.\" $OpenBSD: PKCS7_dataFinal.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: December 26 2022 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt PKCS7_DATAFINAL 3 18.Dt PKCS7_DATAFINAL 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm PKCS7_dataFinal 21.Nm PKCS7_dataFinal
22.Nd move data from a BIO chain to a ContentInfo object 22.Nd move data from a BIO chain to a ContentInfo object
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
24.In openssl/pkcs7.h 25.In openssl/pkcs7.h
25.Ft int 26.Ft int
26.Fo PKCS7_dataFinal 27.Fo PKCS7_dataFinal
diff --git a/src/lib/libcrypto/man/PKCS7_dataInit.3 b/src/lib/libcrypto/man/PKCS7_dataInit.3
index cb54d3f95c..320a227454 100644
--- a/src/lib/libcrypto/man/PKCS7_dataInit.3
+++ b/src/lib/libcrypto/man/PKCS7_dataInit.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PKCS7_dataInit.3,v 1.2 2020/06/03 13:41:27 schwarze Exp $ 1.\" $OpenBSD: PKCS7_dataInit.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 3 2020 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt PKCS7_DATAINIT 3 18.Dt PKCS7_DATAINIT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm PKCS7_dataInit 21.Nm PKCS7_dataInit
22.Nd construct a BIO chain for adding or retrieving content 22.Nd construct a BIO chain for adding or retrieving content
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
24.In openssl/pkcs7.h 25.In openssl/pkcs7.h
25.Ft BIO * 26.Ft BIO *
26.Fo PKCS7_dataInit 27.Fo PKCS7_dataInit
diff --git a/src/lib/libcrypto/man/PKCS7_decrypt.3 b/src/lib/libcrypto/man/PKCS7_decrypt.3
index 8d00499b57..857777bcd6 100644
--- a/src/lib/libcrypto/man/PKCS7_decrypt.3
+++ b/src/lib/libcrypto/man/PKCS7_decrypt.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PKCS7_decrypt.3,v 1.10 2019/06/10 14:58:48 schwarze Exp $ 1.\" $OpenBSD: PKCS7_decrypt.3,v 1.11 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 10 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt PKCS7_DECRYPT 3 52.Dt PKCS7_DECRYPT 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm PKCS7_decrypt 55.Nm PKCS7_decrypt
56.Nd decrypt content from a PKCS#7 envelopedData structure 56.Nd decrypt content from a PKCS#7 envelopedData structure
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/pkcs7.h 59.In openssl/pkcs7.h
59.Ft int 60.Ft int
60.Fo PKCS7_decrypt 61.Fo PKCS7_decrypt
diff --git a/src/lib/libcrypto/man/PKCS7_encrypt.3 b/src/lib/libcrypto/man/PKCS7_encrypt.3
index 700498a1de..3e7283839d 100644
--- a/src/lib/libcrypto/man/PKCS7_encrypt.3
+++ b/src/lib/libcrypto/man/PKCS7_encrypt.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PKCS7_encrypt.3,v 1.11 2020/06/03 13:41:27 schwarze Exp $ 1.\" $OpenBSD: PKCS7_encrypt.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -49,13 +49,14 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: June 3 2020 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt PKCS7_ENCRYPT 3 53.Dt PKCS7_ENCRYPT 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
56.Nm PKCS7_encrypt 56.Nm PKCS7_encrypt
57.Nd create a PKCS#7 envelopedData structure 57.Nd create a PKCS#7 envelopedData structure
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libcrypto
59.In openssl/pkcs7.h 60.In openssl/pkcs7.h
60.Ft PKCS7 * 61.Ft PKCS7 *
61.Fo PKCS7_encrypt 62.Fo PKCS7_encrypt
diff --git a/src/lib/libcrypto/man/PKCS7_final.3 b/src/lib/libcrypto/man/PKCS7_final.3
index 775b84d984..5c2063b1bd 100644
--- a/src/lib/libcrypto/man/PKCS7_final.3
+++ b/src/lib/libcrypto/man/PKCS7_final.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PKCS7_final.3,v 1.3 2022/12/26 07:18:52 jmc Exp $ 1.\" $OpenBSD: PKCS7_final.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: December 26 2022 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt PKCS7_FINAL 3 18.Dt PKCS7_FINAL 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm PKCS7_final 21.Nm PKCS7_final
22.Nd read data from a BIO into a ContentInfo object 22.Nd read data from a BIO into a ContentInfo object
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
24.In openssl/pkcs7.h 25.In openssl/pkcs7.h
25.Ft int 26.Ft int
26.Fo PKCS7_final 27.Fo PKCS7_final
diff --git a/src/lib/libcrypto/man/PKCS7_get_signer_info.3 b/src/lib/libcrypto/man/PKCS7_get_signer_info.3
index 280f373ead..9edf4c63de 100644
--- a/src/lib/libcrypto/man/PKCS7_get_signer_info.3
+++ b/src/lib/libcrypto/man/PKCS7_get_signer_info.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PKCS7_get_signer_info.3,v 1.1 2020/06/10 11:43:08 schwarze Exp $ 1.\" $OpenBSD: PKCS7_get_signer_info.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 10 2020 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt PKCS7_GET_SIGNER_INFO 3 18.Dt PKCS7_GET_SIGNER_INFO 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm PKCS7_get_signer_info 21.Nm PKCS7_get_signer_info
22.Nd retrieve signerInfos from a SignedData object 22.Nd retrieve signerInfos from a SignedData object
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
24.In openssl/pkcs7.h 25.In openssl/pkcs7.h
25.Ft STACK_OF(PKCS7_SIGNER_INFO) * 26.Ft STACK_OF(PKCS7_SIGNER_INFO) *
26.Fn PKCS7_get_signer_info "PKCS7 *p7" 27.Fn PKCS7_get_signer_info "PKCS7 *p7"
diff --git a/src/lib/libcrypto/man/PKCS7_new.3 b/src/lib/libcrypto/man/PKCS7_new.3
index 151261a312..19f6f1ac81 100644
--- a/src/lib/libcrypto/man/PKCS7_new.3
+++ b/src/lib/libcrypto/man/PKCS7_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PKCS7_new.3,v 1.12 2020/06/10 11:43:08 schwarze Exp $ 1.\" $OpenBSD: PKCS7_new.3,v 1.13 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 10 2020 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt PKCS7_NEW 3 18.Dt PKCS7_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -40,6 +40,7 @@
40.Nm PKCS7_ISSUER_AND_SERIAL_free 40.Nm PKCS7_ISSUER_AND_SERIAL_free
41.Nd PKCS#7 data structures 41.Nd PKCS#7 data structures
42.Sh SYNOPSIS 42.Sh SYNOPSIS
43.Lb libcrypto
43.In openssl/pkcs7.h 44.In openssl/pkcs7.h
44.Ft PKCS7 * 45.Ft PKCS7 *
45.Fn PKCS7_new void 46.Fn PKCS7_new void
diff --git a/src/lib/libcrypto/man/PKCS7_set_content.3 b/src/lib/libcrypto/man/PKCS7_set_content.3
index fa057341d5..bf0eb76786 100644
--- a/src/lib/libcrypto/man/PKCS7_set_content.3
+++ b/src/lib/libcrypto/man/PKCS7_set_content.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PKCS7_set_content.3,v 1.2 2020/05/24 12:37:30 schwarze Exp $ 1.\" $OpenBSD: PKCS7_set_content.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: May 24 2020 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt PKCS7_SET_CONTENT 3 18.Dt PKCS7_SET_CONTENT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm PKCS7_content_new 22.Nm PKCS7_content_new
23.Nd set the nested contentInfo in a PKCS#7 structure 23.Nd set the nested contentInfo in a PKCS#7 structure
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/pkcs7.h 26.In openssl/pkcs7.h
26.Ft int 27.Ft int
27.Fo PKCS7_set_content 28.Fo PKCS7_set_content
diff --git a/src/lib/libcrypto/man/PKCS7_set_type.3 b/src/lib/libcrypto/man/PKCS7_set_type.3
index f414b128a2..23eefff972 100644
--- a/src/lib/libcrypto/man/PKCS7_set_type.3
+++ b/src/lib/libcrypto/man/PKCS7_set_type.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PKCS7_set_type.3,v 1.2 2020/05/20 11:40:26 schwarze Exp $ 1.\" $OpenBSD: PKCS7_set_type.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: May 20 2020 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt PKCS7_SET_TYPE 3 18.Dt PKCS7_SET_TYPE 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm PKCS7_set0_type_other 22.Nm PKCS7_set0_type_other
23.Nd initialize type of PKCS#7 ContentInfo 23.Nd initialize type of PKCS#7 ContentInfo
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/pkcs7.h 26.In openssl/pkcs7.h
26.Ft int 27.Ft int
27.Fo PKCS7_set_type 28.Fo PKCS7_set_type
diff --git a/src/lib/libcrypto/man/PKCS7_sign.3 b/src/lib/libcrypto/man/PKCS7_sign.3
index 37257e60fd..174b385196 100644
--- a/src/lib/libcrypto/man/PKCS7_sign.3
+++ b/src/lib/libcrypto/man/PKCS7_sign.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PKCS7_sign.3,v 1.13 2020/06/10 11:43:08 schwarze Exp $ 1.\" $OpenBSD: PKCS7_sign.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 2.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -49,13 +49,14 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: June 10 2020 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt PKCS7_SIGN 3 53.Dt PKCS7_SIGN 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
56.Nm PKCS7_sign 56.Nm PKCS7_sign
57.Nd create a PKCS#7 signedData structure 57.Nd create a PKCS#7 signedData structure
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libcrypto
59.In openssl/pkcs7.h 60.In openssl/pkcs7.h
60.Ft PKCS7 * 61.Ft PKCS7 *
61.Fo PKCS7_sign 62.Fo PKCS7_sign
diff --git a/src/lib/libcrypto/man/PKCS7_sign_add_signer.3 b/src/lib/libcrypto/man/PKCS7_sign_add_signer.3
index 195d6388c9..4b88ff72bd 100644
--- a/src/lib/libcrypto/man/PKCS7_sign_add_signer.3
+++ b/src/lib/libcrypto/man/PKCS7_sign_add_signer.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PKCS7_sign_add_signer.3,v 1.13 2020/06/10 11:43:08 schwarze Exp $ 1.\" $OpenBSD: PKCS7_sign_add_signer.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 2.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -49,13 +49,14 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: June 10 2020 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt PKCS7_SIGN_ADD_SIGNER 3 53.Dt PKCS7_SIGN_ADD_SIGNER 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
56.Nm PKCS7_sign_add_signer 56.Nm PKCS7_sign_add_signer
57.Nd add a signer to a SignedData structure 57.Nd add a signer to a SignedData structure
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libcrypto
59.In openssl/pkcs7.h 60.In openssl/pkcs7.h
60.Ft PKCS7_SIGNER_INFO * 61.Ft PKCS7_SIGNER_INFO *
61.Fo PKCS7_sign_add_signer 62.Fo PKCS7_sign_add_signer
diff --git a/src/lib/libcrypto/man/PKCS7_verify.3 b/src/lib/libcrypto/man/PKCS7_verify.3
index d091c03dfd..6bf932b54b 100644
--- a/src/lib/libcrypto/man/PKCS7_verify.3
+++ b/src/lib/libcrypto/man/PKCS7_verify.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PKCS7_verify.3,v 1.11 2022/03/31 17:27:17 naddy Exp $ 1.\" $OpenBSD: PKCS7_verify.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 2.\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 31 2022 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt PKCS7_VERIFY 3 52.Dt PKCS7_VERIFY 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -56,6 +56,7 @@
56.Nm PKCS7_get0_signers 56.Nm PKCS7_get0_signers
57.Nd verify a PKCS#7 signedData structure 57.Nd verify a PKCS#7 signedData structure
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libcrypto
59.In openssl/pkcs7.h 60.In openssl/pkcs7.h
60.Ft int 61.Ft int
61.Fo PKCS7_verify 62.Fo PKCS7_verify
diff --git a/src/lib/libcrypto/man/PKCS8_PRIV_KEY_INFO_new.3 b/src/lib/libcrypto/man/PKCS8_PRIV_KEY_INFO_new.3
index 822968f58d..55eb464a33 100644
--- a/src/lib/libcrypto/man/PKCS8_PRIV_KEY_INFO_new.3
+++ b/src/lib/libcrypto/man/PKCS8_PRIV_KEY_INFO_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PKCS8_PRIV_KEY_INFO_new.3,v 1.7 2024/12/06 12:51:13 schwarze Exp $ 1.\" $OpenBSD: PKCS8_PRIV_KEY_INFO_new.3,v 1.8 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: December 6 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt PKCS8_PRIV_KEY_INFO_NEW 3 18.Dt PKCS8_PRIV_KEY_INFO_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm PKCS8_PRIV_KEY_INFO_free 22.Nm PKCS8_PRIV_KEY_INFO_free
23.Nd PKCS#8 private key information 23.Nd PKCS#8 private key information
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/x509.h 26.In openssl/x509.h
26.Ft PKCS8_PRIV_KEY_INFO * 27.Ft PKCS8_PRIV_KEY_INFO *
27.Fn PKCS8_PRIV_KEY_INFO_new void 28.Fn PKCS8_PRIV_KEY_INFO_new void
diff --git a/src/lib/libcrypto/man/PKCS8_pkey_set0.3 b/src/lib/libcrypto/man/PKCS8_pkey_set0.3
index f3d5a294c3..a8a160d544 100644
--- a/src/lib/libcrypto/man/PKCS8_pkey_set0.3
+++ b/src/lib/libcrypto/man/PKCS8_pkey_set0.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PKCS8_pkey_set0.3,v 1.3 2024/09/02 07:45:09 tb Exp $ 1.\" $OpenBSD: PKCS8_pkey_set0.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: September 2 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt PKCS8_PKEY_SET0 3 18.Dt PKCS8_PKEY_SET0 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -24,6 +24,7 @@
24.Nm PKCS8_pkey_get0_attrs 24.Nm PKCS8_pkey_get0_attrs
25.Nd change and inspect PKCS#8 PrivateKeyInfo objects 25.Nd change and inspect PKCS#8 PrivateKeyInfo objects
26.Sh SYNOPSIS 26.Sh SYNOPSIS
27.Lb libcrypto
27.In openssl/x509.h 28.In openssl/x509.h
28.Ft int 29.Ft int
29.Fo PKCS8_pkey_set0 30.Fo PKCS8_pkey_set0
diff --git a/src/lib/libcrypto/man/PKEY_USAGE_PERIOD_new.3 b/src/lib/libcrypto/man/PKEY_USAGE_PERIOD_new.3
index 40735c6f86..2d4f010bce 100644
--- a/src/lib/libcrypto/man/PKEY_USAGE_PERIOD_new.3
+++ b/src/lib/libcrypto/man/PKEY_USAGE_PERIOD_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PKEY_USAGE_PERIOD_new.3,v 1.5 2019/06/06 01:06:59 schwarze Exp $ 1.\" $OpenBSD: PKEY_USAGE_PERIOD_new.3,v 1.6 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 6 2019 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt PKEY_USAGE_PERIOD_NEW 3 18.Dt PKEY_USAGE_PERIOD_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm PKEY_USAGE_PERIOD_free 22.Nm PKEY_USAGE_PERIOD_free
23.Nd X.509 certificate private key usage period extension 23.Nd X.509 certificate private key usage period extension
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/x509v3.h 26.In openssl/x509v3.h
26.Ft PKEY_USAGE_PERIOD * 27.Ft PKEY_USAGE_PERIOD *
27.Fn PKEY_USAGE_PERIOD_new void 28.Fn PKEY_USAGE_PERIOD_new void
diff --git a/src/lib/libcrypto/man/POLICYINFO_new.3 b/src/lib/libcrypto/man/POLICYINFO_new.3
index 52c004414e..aad2ad3ce5 100644
--- a/src/lib/libcrypto/man/POLICYINFO_new.3
+++ b/src/lib/libcrypto/man/POLICYINFO_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: POLICYINFO_new.3,v 1.11 2023/05/14 08:03:57 tb Exp $ 1.\" $OpenBSD: POLICYINFO_new.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: May 14 2023 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt POLICYINFO_NEW 3 18.Dt POLICYINFO_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -34,6 +34,7 @@
34.Nm POLICY_CONSTRAINTS_free 34.Nm POLICY_CONSTRAINTS_free
35.Nd X.509 certificate policies 35.Nd X.509 certificate policies
36.Sh SYNOPSIS 36.Sh SYNOPSIS
37.Lb libcrypto
37.In openssl/x509v3.h 38.In openssl/x509v3.h
38.Ft POLICYINFO * 39.Ft POLICYINFO *
39.Fn POLICYINFO_new void 40.Fn POLICYINFO_new void
diff --git a/src/lib/libcrypto/man/RAND_add.3 b/src/lib/libcrypto/man/RAND_add.3
index 5404f696a3..b56707a313 100644
--- a/src/lib/libcrypto/man/RAND_add.3
+++ b/src/lib/libcrypto/man/RAND_add.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RAND_add.3,v 1.10 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: RAND_add.3,v 1.11 2025/06/08 22:40:30 schwarze Exp $
2.\" content checked up to: OpenSSL c16de9d8 Aug 31 23:16:22 2017 +0200 2.\" content checked up to: OpenSSL c16de9d8 Aug 31 23:16:22 2017 +0200
3.\" 3.\"
4.\" Copyright (c) 2014 Miod Vallat <miod@openbsd.org> 4.\" Copyright (c) 2014 Miod Vallat <miod@openbsd.org>
@@ -15,7 +15,7 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 17.\"
18.Dd $Mdocdate: March 27 2018 $ 18.Dd $Mdocdate: June 8 2025 $
19.Dt RAND_ADD 3 19.Dt RAND_ADD 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
@@ -26,6 +26,7 @@
26.Nm RAND_status 26.Nm RAND_status
27.Nd manipulate the PRNG state 27.Nd manipulate the PRNG state
28.Sh SYNOPSIS 28.Sh SYNOPSIS
29.Lb libcrypto
29.In openssl/rand.h 30.In openssl/rand.h
30.Ft void 31.Ft void
31.Fo RAND_add 32.Fo RAND_add
diff --git a/src/lib/libcrypto/man/RAND_bytes.3 b/src/lib/libcrypto/man/RAND_bytes.3
index 19427a82df..ce0773f448 100644
--- a/src/lib/libcrypto/man/RAND_bytes.3
+++ b/src/lib/libcrypto/man/RAND_bytes.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RAND_bytes.3,v 1.6 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: RAND_bytes.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt RAND_BYTES 3 52.Dt RAND_BYTES 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -56,6 +56,7 @@
56.Nm RAND_pseudo_bytes 56.Nm RAND_pseudo_bytes
57.Nd generate random data 57.Nd generate random data
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libcrypto
59.In openssl/rand.h 60.In openssl/rand.h
60.Ft int 61.Ft int
61.Fo RAND_bytes 62.Fo RAND_bytes
diff --git a/src/lib/libcrypto/man/RAND_load_file.3 b/src/lib/libcrypto/man/RAND_load_file.3
index 9227e2721b..1c6f7a27fb 100644
--- a/src/lib/libcrypto/man/RAND_load_file.3
+++ b/src/lib/libcrypto/man/RAND_load_file.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RAND_load_file.3,v 1.6 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: RAND_load_file.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt RAND_LOAD_FILE 3 52.Dt RAND_LOAD_FILE 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -57,6 +57,7 @@
57.Nm RAND_write_file 57.Nm RAND_write_file
58.Nd PRNG seed file 58.Nd PRNG seed file
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/rand.h 61.In openssl/rand.h
61.Ft const char * 62.Ft const char *
62.Fo RAND_file_name 63.Fo RAND_file_name
diff --git a/src/lib/libcrypto/man/RAND_set_rand_method.3 b/src/lib/libcrypto/man/RAND_set_rand_method.3
index d94d794daf..2756099c7b 100644
--- a/src/lib/libcrypto/man/RAND_set_rand_method.3
+++ b/src/lib/libcrypto/man/RAND_set_rand_method.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RAND_set_rand_method.3,v 1.4 2018/03/21 09:03:49 schwarze Exp $ 1.\" $OpenBSD: RAND_set_rand_method.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2014 Miod Vallat <miod@openbsd.org> 3.\" Copyright (c) 2014 Miod Vallat <miod@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 21 2018 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt RAND_SET_RAND_METHOD 3 18.Dt RAND_SET_RAND_METHOD 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -23,6 +23,7 @@
23.Nm RAND_SSLeay 23.Nm RAND_SSLeay
24.Nd select RAND method 24.Nd select RAND method
25.Sh SYNOPSIS 25.Sh SYNOPSIS
26.Lb libcrypto
26.In openssl/rand.h 27.In openssl/rand.h
27.Ft int 28.Ft int
28.Fo RAND_set_rand_method 29.Fo RAND_set_rand_method
diff --git a/src/lib/libcrypto/man/RC2_encrypt.3 b/src/lib/libcrypto/man/RC2_encrypt.3
index a90e0f574b..735c10cbd7 100644
--- a/src/lib/libcrypto/man/RC2_encrypt.3
+++ b/src/lib/libcrypto/man/RC2_encrypt.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RC2_encrypt.3,v 1.2 2024/12/18 04:15:48 jsg Exp $ 1.\" $OpenBSD: RC2_encrypt.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: December 18 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt RC2_ENCRYPT 3 18.Dt RC2_ENCRYPT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -27,6 +27,7 @@
27.Nm RC2_ofb64_encrypt 27.Nm RC2_ofb64_encrypt
28.Nd low-level functions for Rivest Cipher 2 28.Nd low-level functions for Rivest Cipher 2
29.Sh SYNOPSIS 29.Sh SYNOPSIS
30.Lb libcrypto
30.In openssl/rc2.h 31.In openssl/rc2.h
31.Ft void 32.Ft void
32.Fo RC2_set_key 33.Fo RC2_set_key
diff --git a/src/lib/libcrypto/man/RC4.3 b/src/lib/libcrypto/man/RC4.3
index 8b20a434b7..ff92cffc78 100644
--- a/src/lib/libcrypto/man/RC4.3
+++ b/src/lib/libcrypto/man/RC4.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RC4.3,v 1.8 2020/03/29 17:05:02 schwarze Exp $ 1.\" $OpenBSD: RC4.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 29 2020 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt RC4 3 52.Dt RC4 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -56,6 +56,7 @@
56.Nm RC4 56.Nm RC4
57.Nd RC4 encryption 57.Nd RC4 encryption
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libcrypto
59.In openssl/rc4.h 60.In openssl/rc4.h
60.Ft void 61.Ft void
61.Fo RC4_set_key 62.Fo RC4_set_key
diff --git a/src/lib/libcrypto/man/RIPEMD160.3 b/src/lib/libcrypto/man/RIPEMD160.3
index 43c6694036..e22f4ed841 100644
--- a/src/lib/libcrypto/man/RIPEMD160.3
+++ b/src/lib/libcrypto/man/RIPEMD160.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RIPEMD160.3,v 1.8 2024/05/26 09:54:16 tb Exp $ 1.\" $OpenBSD: RIPEMD160.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL 72a7a702 Feb 26 14:05:09 2019 +0000 2.\" full merge up to: OpenSSL 72a7a702 Feb 26 14:05:09 2019 +0000
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: May 26 2024 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt RIPEMD160 3 52.Dt RIPEMD160 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -58,6 +58,7 @@
58.Nm RIPEMD160_Final 58.Nm RIPEMD160_Final
59.Nd RIPEMD-160 hash function 59.Nd RIPEMD-160 hash function
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libcrypto
61.In openssl/ripemd.h 62.In openssl/ripemd.h
62.Ft unsigned char * 63.Ft unsigned char *
63.Fo RIPEMD160 64.Fo RIPEMD160
diff --git a/src/lib/libcrypto/man/RSA_PSS_PARAMS_new.3 b/src/lib/libcrypto/man/RSA_PSS_PARAMS_new.3
index f69f33dbe5..6532028a57 100644
--- a/src/lib/libcrypto/man/RSA_PSS_PARAMS_new.3
+++ b/src/lib/libcrypto/man/RSA_PSS_PARAMS_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RSA_PSS_PARAMS_new.3,v 1.4 2019/06/06 01:06:59 schwarze Exp $ 1.\" $OpenBSD: RSA_PSS_PARAMS_new.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 6 2019 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt RSA_PSS_PARAMS_NEW 3 18.Dt RSA_PSS_PARAMS_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm RSA_PSS_PARAMS_free 22.Nm RSA_PSS_PARAMS_free
23.Nd probabilistic signature scheme with RSA hashing 23.Nd probabilistic signature scheme with RSA hashing
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/rsa.h 26.In openssl/rsa.h
26.Ft RSA_PSS_PARAMS * 27.Ft RSA_PSS_PARAMS *
27.Fn RSA_PSS_PARAMS_new void 28.Fn RSA_PSS_PARAMS_new void
diff --git a/src/lib/libcrypto/man/RSA_blinding_on.3 b/src/lib/libcrypto/man/RSA_blinding_on.3
index bd2a301377..0dfebf3739 100644
--- a/src/lib/libcrypto/man/RSA_blinding_on.3
+++ b/src/lib/libcrypto/man/RSA_blinding_on.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RSA_blinding_on.3,v 1.7 2023/07/26 20:08:59 tb Exp $ 1.\" $OpenBSD: RSA_blinding_on.3,v 1.8 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: July 26 2023 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt RSA_BLINDING_ON 3 52.Dt RSA_BLINDING_ON 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -56,6 +56,7 @@
56.Nm RSA_blinding_off 56.Nm RSA_blinding_off
57.Nd protect the RSA operation from timing attacks 57.Nd protect the RSA operation from timing attacks
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libcrypto
59.In openssl/rsa.h 60.In openssl/rsa.h
60.Ft int 61.Ft int
61.Fo RSA_blinding_on 62.Fo RSA_blinding_on
diff --git a/src/lib/libcrypto/man/RSA_check_key.3 b/src/lib/libcrypto/man/RSA_check_key.3
index 36b613b3a5..b6c9bc20a1 100644
--- a/src/lib/libcrypto/man/RSA_check_key.3
+++ b/src/lib/libcrypto/man/RSA_check_key.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RSA_check_key.3,v 1.10 2023/11/19 21:06:15 tb Exp $ 1.\" $OpenBSD: RSA_check_key.3,v 1.11 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL 6859cf74 Sep 25 13:33:28 2002 +0000 2.\" OpenSSL 6859cf74 Sep 25 13:33:28 2002 +0000
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org> and 4.\" This file was written by Ulf Moeller <ulf@openssl.org> and
@@ -49,13 +49,14 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: November 19 2023 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt RSA_CHECK_KEY 3 53.Dt RSA_CHECK_KEY 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
56.Nm RSA_check_key 56.Nm RSA_check_key
57.Nd validate private RSA keys 57.Nd validate private RSA keys
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libcrypto
59.In openssl/rsa.h 60.In openssl/rsa.h
60.Ft int 61.Ft int
61.Fo RSA_check_key 62.Fo RSA_check_key
diff --git a/src/lib/libcrypto/man/RSA_generate_key.3 b/src/lib/libcrypto/man/RSA_generate_key.3
index 83703b1eaa..a72168def9 100644
--- a/src/lib/libcrypto/man/RSA_generate_key.3
+++ b/src/lib/libcrypto/man/RSA_generate_key.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RSA_generate_key.3,v 1.13 2019/06/10 14:58:48 schwarze Exp $ 1.\" $OpenBSD: RSA_generate_key.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL RSA_generate_key.pod bb6c5e7f Feb 5 10:29:22 2017 -0500 2.\" OpenSSL RSA_generate_key.pod bb6c5e7f Feb 5 10:29:22 2017 -0500
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 10 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt RSA_GENERATE_KEY 3 52.Dt RSA_GENERATE_KEY 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -56,6 +56,7 @@
56.Nm RSA_generate_key 56.Nm RSA_generate_key
57.Nd generate RSA key pair 57.Nd generate RSA key pair
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libcrypto
59.In openssl/rsa.h 60.In openssl/rsa.h
60.Ft int 61.Ft int
61.Fo RSA_generate_key_ex 62.Fo RSA_generate_key_ex
diff --git a/src/lib/libcrypto/man/RSA_get0_key.3 b/src/lib/libcrypto/man/RSA_get0_key.3
index f09fb00d2b..cf82b21ce2 100644
--- a/src/lib/libcrypto/man/RSA_get0_key.3
+++ b/src/lib/libcrypto/man/RSA_get0_key.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RSA_get0_key.3,v 1.8 2025/01/05 15:40:42 tb Exp $ 1.\" $OpenBSD: RSA_get0_key.3,v 1.10 2025/06/13 18:34:00 schwarze Exp $
2.\" selective merge up to: OpenSSL 665d899f Aug 2 02:19:43 2017 +0800 2.\" selective merge up to: OpenSSL 665d899f Aug 2 02:19:43 2017 +0800
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: January 5 2025 $ 68.Dd $Mdocdate: June 13 2025 $
69.Dt RSA_GET0_KEY 3 69.Dt RSA_GET0_KEY 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -88,6 +88,7 @@
88.Nm RSA_set_flags 88.Nm RSA_set_flags
89.Nd get and set data in an RSA object 89.Nd get and set data in an RSA object
90.Sh SYNOPSIS 90.Sh SYNOPSIS
91.Lb libcrypto
91.In openssl/rsa.h 92.In openssl/rsa.h
92.Ft void 93.Ft void
93.Fo RSA_get0_key 94.Fo RSA_get0_key
@@ -96,15 +97,15 @@
96.Fa "const BIGNUM **e" 97.Fa "const BIGNUM **e"
97.Fa "const BIGNUM **d" 98.Fa "const BIGNUM **d"
98.Fc 99.Fc
99.Ft "const BIGNUM *" 100.Ft const BIGNUM *
100.Fo RSA_get0_n 101.Fo RSA_get0_n
101.Fa "const RSA *r" 102.Fa "const RSA *r"
102.Fc 103.Fc
103.Ft "const BIGNUM *" 104.Ft const BIGNUM *
104.Fo RSA_get0_e 105.Fo RSA_get0_e
105.Fa "const RSA *r" 106.Fa "const RSA *r"
106.Fc 107.Fc
107.Ft "const BIGNUM *" 108.Ft const BIGNUM *
108.Fo RSA_get0_d 109.Fo RSA_get0_d
109.Fa "const RSA *r" 110.Fa "const RSA *r"
110.Fc 111.Fc
@@ -121,11 +122,11 @@
121.Fa "const BIGNUM **p" 122.Fa "const BIGNUM **p"
122.Fa "const BIGNUM **q" 123.Fa "const BIGNUM **q"
123.Fc 124.Fc
124.Ft "const BIGNUM *" 125.Ft const BIGNUM *
125.Fo RSA_get0_p 126.Fo RSA_get0_p
126.Fa "const RSA *r" 127.Fa "const RSA *r"
127.Fc 128.Fc
128.Ft "const BIGNUM *" 129.Ft const BIGNUM *
129.Fo RSA_get0_q 130.Fo RSA_get0_q
130.Fa "const RSA *r" 131.Fa "const RSA *r"
131.Fc 132.Fc
@@ -142,15 +143,15 @@
142.Fa "const BIGNUM **dmq1" 143.Fa "const BIGNUM **dmq1"
143.Fa "const BIGNUM **iqmp" 144.Fa "const BIGNUM **iqmp"
144.Fc 145.Fc
145.Ft "const BIGNUM *" 146.Ft const BIGNUM *
146.Fo RSA_get0_dmp1 147.Fo RSA_get0_dmp1
147.Fa "const RSA *r" 148.Fa "const RSA *r"
148.Fc 149.Fc
149.Ft "const BIGNUM *" 150.Ft const BIGNUM *
150.Fo RSA_get0_dmq1 151.Fo RSA_get0_dmq1
151.Fa "const RSA *r" 152.Fa "const RSA *r"
152.Fc 153.Fc
153.Ft "const BIGNUM *" 154.Ft const BIGNUM *
154.Fo RSA_get0_iqmp 155.Fo RSA_get0_iqmp
155.Fa "const RSA *r" 156.Fa "const RSA *r"
156.Fc 157.Fc
diff --git a/src/lib/libcrypto/man/RSA_get_ex_new_index.3 b/src/lib/libcrypto/man/RSA_get_ex_new_index.3
index 5f1fb4335f..1b7096faa1 100644
--- a/src/lib/libcrypto/man/RSA_get_ex_new_index.3
+++ b/src/lib/libcrypto/man/RSA_get_ex_new_index.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RSA_get_ex_new_index.3,v 1.13 2023/11/19 21:08:04 tb Exp $ 1.\" $OpenBSD: RSA_get_ex_new_index.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: November 19 2023 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt RSA_GET_EX_NEW_INDEX 3 18.Dt RSA_GET_EX_NEW_INDEX 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -23,6 +23,7 @@
23.Nm RSA_get_ex_data 23.Nm RSA_get_ex_data
24.Nd add application specific data to RSA objects 24.Nd add application specific data to RSA objects
25.Sh SYNOPSIS 25.Sh SYNOPSIS
26.Lb libcrypto
26.In openssl/rsa.h 27.In openssl/rsa.h
27.Ft int 28.Ft int
28.Fo RSA_get_ex_new_index 29.Fo RSA_get_ex_new_index
diff --git a/src/lib/libcrypto/man/RSA_meth_new.3 b/src/lib/libcrypto/man/RSA_meth_new.3
index a3a5c549e5..9626f1139f 100644
--- a/src/lib/libcrypto/man/RSA_meth_new.3
+++ b/src/lib/libcrypto/man/RSA_meth_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RSA_meth_new.3,v 1.6 2025/01/05 15:40:42 tb Exp $ 1.\" $OpenBSD: RSA_meth_new.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL a970b14f Jul 31 18:58:40 2017 -0400 2.\" full merge up to: OpenSSL a970b14f Jul 31 18:58:40 2017 -0400
3.\" selective merge up to: OpenSSL 24907560 Sep 17 07:47:42 2018 +1000 3.\" selective merge up to: OpenSSL 24907560 Sep 17 07:47:42 2018 +1000
4.\" 4.\"
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: January 5 2025 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt RSA_METH_NEW 3 70.Dt RSA_METH_NEW 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -103,6 +103,7 @@
103.Nm RSA_meth_set_keygen 103.Nm RSA_meth_set_keygen
104.Nd build up RSA methods 104.Nd build up RSA methods
105.Sh SYNOPSIS 105.Sh SYNOPSIS
106.Lb libcrypto
106.In openssl/rsa.h 107.In openssl/rsa.h
107.Ft RSA_METHOD * 108.Ft RSA_METHOD *
108.Fo RSA_meth_new 109.Fo RSA_meth_new
diff --git a/src/lib/libcrypto/man/RSA_new.3 b/src/lib/libcrypto/man/RSA_new.3
index f5c7929e77..9c69ce27b1 100644
--- a/src/lib/libcrypto/man/RSA_new.3
+++ b/src/lib/libcrypto/man/RSA_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RSA_new.3,v 1.18 2023/11/19 21:03:22 tb Exp $ 1.\" $OpenBSD: RSA_new.3,v 1.19 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL doc/man3/RSA_new.pod e9b77246 Jan 20 19:58:49 2017 +0100 3.\" OpenSSL doc/man3/RSA_new.pod e9b77246 Jan 20 19:58:49 2017 +0100
4.\" OpenSSL doc/crypto/rsa.pod 35d2e327 Jun 3 16:19:49 2016 -0400 (final) 4.\" OpenSSL doc/crypto/rsa.pod 35d2e327 Jun 3 16:19:49 2016 -0400 (final)
@@ -67,7 +67,7 @@
67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
69.\" 69.\"
70.Dd $Mdocdate: November 19 2023 $ 70.Dd $Mdocdate: June 8 2025 $
71.Dt RSA_NEW 3 71.Dt RSA_NEW 3
72.Os 72.Os
73.Sh NAME 73.Sh NAME
@@ -78,6 +78,7 @@
78.Nm RSA_free 78.Nm RSA_free
79.Nd allocate and free RSA objects 79.Nd allocate and free RSA objects
80.Sh SYNOPSIS 80.Sh SYNOPSIS
81.Lb libcrypto
81.In openssl/rsa.h 82.In openssl/rsa.h
82.Ft RSA * 83.Ft RSA *
83.Fn RSA_new void 84.Fn RSA_new void
diff --git a/src/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 b/src/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3
index e7c3a2a624..d8a142f3f9 100644
--- a/src/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3
+++ b/src/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RSA_padding_add_PKCS1_type_1.3,v 1.8 2018/03/21 16:09:51 schwarze Exp $ 1.\" $OpenBSD: RSA_padding_add_PKCS1_type_1.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL 1e3f62a3 Jul 17 16:47:13 2017 +0200 2.\" OpenSSL 1e3f62a3 Jul 17 16:47:13 2017 +0200
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 21 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt RSA_PADDING_ADD_PKCS1_TYPE_1 3 52.Dt RSA_PADDING_ADD_PKCS1_TYPE_1 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -62,6 +62,7 @@
62.Nm RSA_padding_check_none 62.Nm RSA_padding_check_none
63.Nd asymmetric encryption padding 63.Nd asymmetric encryption padding
64.Sh SYNOPSIS 64.Sh SYNOPSIS
65.Lb libcrypto
65.In openssl/rsa.h 66.In openssl/rsa.h
66.Ft int 67.Ft int
67.Fo RSA_padding_add_PKCS1_type_1 68.Fo RSA_padding_add_PKCS1_type_1
diff --git a/src/lib/libcrypto/man/RSA_pkey_ctx_ctrl.3 b/src/lib/libcrypto/man/RSA_pkey_ctx_ctrl.3
index 3d4e79cc47..ca805e5191 100644
--- a/src/lib/libcrypto/man/RSA_pkey_ctx_ctrl.3
+++ b/src/lib/libcrypto/man/RSA_pkey_ctx_ctrl.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RSA_pkey_ctx_ctrl.3,v 1.8 2024/12/06 14:27:49 schwarze Exp $ 1.\" $OpenBSD: RSA_pkey_ctx_ctrl.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL man3/EVP_PKEY_CTX_ctrl.pod 99d63d46 Oct 26 13:56:48 2016 -0400 3.\" OpenSSL man3/EVP_PKEY_CTX_ctrl.pod 99d63d46 Oct 26 13:56:48 2016 -0400
4.\" OpenSSL man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md.pod 4.\" OpenSSL man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md.pod
@@ -55,7 +55,7 @@
55.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 55.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
56.\" OF THE POSSIBILITY OF SUCH DAMAGE. 56.\" OF THE POSSIBILITY OF SUCH DAMAGE.
57.\" 57.\"
58.Dd $Mdocdate: December 6 2024 $ 58.Dd $Mdocdate: June 8 2025 $
59.Dt RSA_PKEY_CTX_CTRL 3 59.Dt RSA_PKEY_CTX_CTRL 3
60.Os 60.Os
61.Sh NAME 61.Sh NAME
@@ -77,6 +77,7 @@
77.Nm EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen 77.Nm EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen
78.Nd RSA private key control operations 78.Nd RSA private key control operations
79.Sh SYNOPSIS 79.Sh SYNOPSIS
80.Lb libcrypto
80.In openssl/rsa.h 81.In openssl/rsa.h
81.Ft int 82.Ft int
82.Fo RSA_pkey_ctx_ctrl 83.Fo RSA_pkey_ctx_ctrl
diff --git a/src/lib/libcrypto/man/RSA_print.3 b/src/lib/libcrypto/man/RSA_print.3
index 767241ce1c..3f5d927b79 100644
--- a/src/lib/libcrypto/man/RSA_print.3
+++ b/src/lib/libcrypto/man/RSA_print.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RSA_print.3,v 1.9 2019/06/06 01:06:59 schwarze Exp $ 1.\" $OpenBSD: RSA_print.3,v 1.10 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 6 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt RSA_PRINT 3 52.Dt RSA_PRINT 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -62,6 +62,7 @@
62.Nm DHparams_print_fp 62.Nm DHparams_print_fp
63.Nd print cryptographic parameters 63.Nd print cryptographic parameters
64.Sh SYNOPSIS 64.Sh SYNOPSIS
65.Lb libcrypto
65.In openssl/rsa.h 66.In openssl/rsa.h
66.Ft int 67.Ft int
67.Fo RSA_print 68.Fo RSA_print
diff --git a/src/lib/libcrypto/man/RSA_private_encrypt.3 b/src/lib/libcrypto/man/RSA_private_encrypt.3
index 2bf6c57dba..43e94b1fd2 100644
--- a/src/lib/libcrypto/man/RSA_private_encrypt.3
+++ b/src/lib/libcrypto/man/RSA_private_encrypt.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RSA_private_encrypt.3,v 1.10 2019/06/10 14:58:48 schwarze Exp $ 1.\" $OpenBSD: RSA_private_encrypt.3,v 1.11 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL RSA_private_encrypt.pod b41f6b64 Mar 10 15:49:04 2017 +0000 2.\" OpenSSL RSA_private_encrypt.pod b41f6b64 Mar 10 15:49:04 2017 +0000
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 10 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt RSA_PRIVATE_ENCRYPT 3 52.Dt RSA_PRIVATE_ENCRYPT 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -56,6 +56,7 @@
56.Nm RSA_public_decrypt 56.Nm RSA_public_decrypt
57.Nd low level signature operations 57.Nd low level signature operations
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libcrypto
59.In openssl/rsa.h 60.In openssl/rsa.h
60.Ft int 61.Ft int
61.Fo RSA_private_encrypt 62.Fo RSA_private_encrypt
diff --git a/src/lib/libcrypto/man/RSA_public_encrypt.3 b/src/lib/libcrypto/man/RSA_public_encrypt.3
index be3afdf402..f40118846a 100644
--- a/src/lib/libcrypto/man/RSA_public_encrypt.3
+++ b/src/lib/libcrypto/man/RSA_public_encrypt.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RSA_public_encrypt.3,v 1.13 2023/09/10 16:04:15 schwarze Exp $ 1.\" $OpenBSD: RSA_public_encrypt.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL RSA_public_encrypt.pod 1e3f62a3 Jul 17 16:47:13 2017 +0200 2.\" OpenSSL RSA_public_encrypt.pod 1e3f62a3 Jul 17 16:47:13 2017 +0200
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: September 10 2023 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt RSA_PUBLIC_ENCRYPT 3 69.Dt RSA_PUBLIC_ENCRYPT 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -75,6 +75,7 @@
75.Nm EVP_PKEY_decrypt_old 75.Nm EVP_PKEY_decrypt_old
76.Nd RSA public key cryptography 76.Nd RSA public key cryptography
77.Sh SYNOPSIS 77.Sh SYNOPSIS
78.Lb libcrypto
78.In openssl/rsa.h 79.In openssl/rsa.h
79.Ft int 80.Ft int
80.Fo RSA_public_encrypt 81.Fo RSA_public_encrypt
diff --git a/src/lib/libcrypto/man/RSA_security_bits.3 b/src/lib/libcrypto/man/RSA_security_bits.3
index f7024a7956..0766ce61b1 100644
--- a/src/lib/libcrypto/man/RSA_security_bits.3
+++ b/src/lib/libcrypto/man/RSA_security_bits.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RSA_security_bits.3,v 1.1 2022/07/13 17:32:16 schwarze Exp $ 1.\" $OpenBSD: RSA_security_bits.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: July 13 2022 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt RSA_SECURITY_BITS 3 18.Dt RSA_SECURITY_BITS 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -24,6 +24,7 @@
24.Nm BN_security_bits 24.Nm BN_security_bits
25.Nd get security strength 25.Nd get security strength
26.Sh SYNOPSIS 26.Sh SYNOPSIS
27.Lb libcrypto
27.In openssl/rsa.h 28.In openssl/rsa.h
28.Ft int 29.Ft int
29.Fn RSA_security_bits "const RSA *rsa" 30.Fn RSA_security_bits "const RSA *rsa"
diff --git a/src/lib/libcrypto/man/RSA_set_method.3 b/src/lib/libcrypto/man/RSA_set_method.3
index ffe22c116f..127dc62c60 100644
--- a/src/lib/libcrypto/man/RSA_set_method.3
+++ b/src/lib/libcrypto/man/RSA_set_method.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RSA_set_method.3,v 1.18 2023/11/19 10:34:26 tb Exp $ 1.\" $OpenBSD: RSA_set_method.3,v 1.19 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org> 4.\" This file was written by Ulf Moeller <ulf@openssl.org>
@@ -50,7 +50,7 @@
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\" 52.\"
53.Dd $Mdocdate: November 19 2023 $ 53.Dd $Mdocdate: June 8 2025 $
54.Dt RSA_SET_METHOD 3 54.Dt RSA_SET_METHOD 3
55.Os 55.Os
56.Sh NAME 56.Sh NAME
@@ -63,6 +63,7 @@
63.Nm RSA_new_method 63.Nm RSA_new_method
64.Nd select RSA method 64.Nd select RSA method
65.Sh SYNOPSIS 65.Sh SYNOPSIS
66.Lb libcrypto
66.In openssl/rsa.h 67.In openssl/rsa.h
67.Ft void 68.Ft void
68.Fo RSA_set_default_method 69.Fo RSA_set_default_method
diff --git a/src/lib/libcrypto/man/RSA_sign.3 b/src/lib/libcrypto/man/RSA_sign.3
index 65e9dc99b8..d2a4512302 100644
--- a/src/lib/libcrypto/man/RSA_sign.3
+++ b/src/lib/libcrypto/man/RSA_sign.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RSA_sign.3,v 1.8 2019/06/10 14:58:48 schwarze Exp $ 1.\" $OpenBSD: RSA_sign.3,v 1.10 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL aa90ca11 Aug 20 15:48:56 2016 -0400 2.\" OpenSSL aa90ca11 Aug 20 15:48:56 2016 -0400
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: June 10 2019 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt RSA_SIGN 3 53.Dt RSA_SIGN 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -57,6 +57,7 @@
57.Nm RSA_verify 57.Nm RSA_verify
58.Nd RSA signatures 58.Nd RSA signatures
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/rsa.h 61.In openssl/rsa.h
61.Ft int 62.Ft int
62.Fo RSA_sign 63.Fo RSA_sign
@@ -106,7 +107,7 @@ If
106.Fa type 107.Fa type
107is 108is
108.Sy NID_md5_sha1 , 109.Sy NID_md5_sha1 ,
109an SSL signature (MD5 and SHA1 message digests with PKCS #1 padding and 110an SSL signature (MD5 and SHA-1 message digests with PKCS #1 padding and
110no algorithm identifier) is created. 111no algorithm identifier) is created.
111.Pp 112.Pp
112.Fn RSA_verify 113.Fn RSA_verify
diff --git a/src/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 b/src/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3
index 34aef42c48..bd11a0607a 100644
--- a/src/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3
+++ b/src/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RSA_sign_ASN1_OCTET_STRING.3,v 1.7 2019/06/10 14:58:48 schwarze Exp $ 1.\" $OpenBSD: RSA_sign_ASN1_OCTET_STRING.3,v 1.8 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 10 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt RSA_SIGN_ASN1_OCTET_STRING 3 52.Dt RSA_SIGN_ASN1_OCTET_STRING 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -56,6 +56,7 @@
56.Nm RSA_verify_ASN1_OCTET_STRING 56.Nm RSA_verify_ASN1_OCTET_STRING
57.Nd RSA signatures 57.Nd RSA signatures
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libcrypto
59.In openssl/rsa.h 60.In openssl/rsa.h
60.Ft int 61.Ft int
61.Fo RSA_sign_ASN1_OCTET_STRING 62.Fo RSA_sign_ASN1_OCTET_STRING
diff --git a/src/lib/libcrypto/man/RSA_size.3 b/src/lib/libcrypto/man/RSA_size.3
index 8a552b4e67..9988903d55 100644
--- a/src/lib/libcrypto/man/RSA_size.3
+++ b/src/lib/libcrypto/man/RSA_size.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: RSA_size.3,v 1.10 2022/07/13 21:51:35 schwarze Exp $ 1.\" $OpenBSD: RSA_size.3,v 1.11 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org> and 4.\" This file was written by Ulf Moeller <ulf@openssl.org> and
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: July 13 2022 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt RSA_SIZE 3 53.Dt RSA_SIZE 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -57,6 +57,7 @@
57.Nm RSA_bits 57.Nm RSA_bits
58.Nd get the RSA modulus size 58.Nd get the RSA modulus size
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/rsa.h 61.In openssl/rsa.h
61.Ft int 62.Ft int
62.Fo RSA_size 63.Fo RSA_size
diff --git a/src/lib/libcrypto/man/SHA1.3 b/src/lib/libcrypto/man/SHA1.3
index 4ccb08157c..74fd388cd8 100644
--- a/src/lib/libcrypto/man/SHA1.3
+++ b/src/lib/libcrypto/man/SHA1.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SHA1.3,v 1.9 2024/06/01 12:35:23 tb Exp $ 1.\" $OpenBSD: SHA1.3,v 1.10 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org> and 4.\" This file was written by Ulf Moeller <ulf@openssl.org> and
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: June 1 2024 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SHA1 3 53.Dt SHA1 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -75,6 +75,7 @@
75.Nm SHA512_Final 75.Nm SHA512_Final
76.Nd Secure Hash Algorithm 76.Nd Secure Hash Algorithm
77.Sh SYNOPSIS 77.Sh SYNOPSIS
78.Lb libcrypto
78.In openssl/sha.h 79.In openssl/sha.h
79.Ft unsigned char * 80.Ft unsigned char *
80.Fo SHA1 81.Fo SHA1
diff --git a/src/lib/libcrypto/man/SMIME_crlf_copy.3 b/src/lib/libcrypto/man/SMIME_crlf_copy.3
index 3b46138473..0991d207a1 100644
--- a/src/lib/libcrypto/man/SMIME_crlf_copy.3
+++ b/src/lib/libcrypto/man/SMIME_crlf_copy.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SMIME_crlf_copy.3,v 1.3 2023/05/01 07:28:11 tb Exp $ 1.\" $OpenBSD: SMIME_crlf_copy.3,v 1.5 2025/06/11 13:48:54 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,15 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: May 1 2023 $ 17.Dd $Mdocdate: June 11 2025 $
18.Dt SMIME_CRLF_COPY 3 18.Dt SMIME_CRLF_COPY 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm SMIME_crlf_copy 21.Nm SMIME_crlf_copy
22.Nd buffered copy between BIOs 22.Nd buffered copy between BIOs
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
25.In openssl/asn1.h
24.Ft int 26.Ft int
25.Fo SMIME_crlf_copy 27.Fo SMIME_crlf_copy
26.Fa "BIO *in_bio" 28.Fa "BIO *in_bio"
@@ -79,7 +81,8 @@ is intended to return 1 on success or 0 on failure.
79.Xr BIO_push 3 , 81.Xr BIO_push 3 ,
80.Xr BIO_read 3 , 82.Xr BIO_read 3 ,
81.Xr SMIME_text 3 , 83.Xr SMIME_text 3 ,
82.Xr SMIME_write_ASN1 3 84.Xr SMIME_write_CMS 3 ,
85.Xr SMIME_write_PKCS7 3
83.Sh HISTORY 86.Sh HISTORY
84.Fn SMIME_crlf_copy 87.Fn SMIME_crlf_copy
85first appeared in OpenSSL 1.0.0 and has been available since 88first appeared in OpenSSL 1.0.0 and has been available since
diff --git a/src/lib/libcrypto/man/SMIME_read_ASN1.3 b/src/lib/libcrypto/man/SMIME_read_ASN1.3
deleted file mode 100644
index 320064567c..0000000000
--- a/src/lib/libcrypto/man/SMIME_read_ASN1.3
+++ /dev/null
@@ -1,124 +0,0 @@
1.\" $OpenBSD: SMIME_read_ASN1.3,v 1.2 2021/12/14 15:22:49 schwarze Exp $
2.\" full merge up to:
3.\" OpenSSL SMIME_read_PKCS7.pod 83cf7abf May 29 13:07:08 2018 +0100
4.\" OpenSSL SMIME_read_CMS.pod b97fdb57 Nov 11 09:33:09 2016 +0100
5.\"
6.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
7.\" Copyright (c) 2002, 2006, 2008 The OpenSSL Project. All rights reserved.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\"
13.\" 1. Redistributions of source code must retain the above copyright
14.\" notice, this list of conditions and the following disclaimer.
15.\"
16.\" 2. Redistributions in binary form must reproduce the above copyright
17.\" notice, this list of conditions and the following disclaimer in
18.\" the documentation and/or other materials provided with the
19.\" distribution.
20.\"
21.\" 3. All advertising materials mentioning features or use of this
22.\" software must display the following acknowledgment:
23.\" "This product includes software developed by the OpenSSL Project
24.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
25.\"
26.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
27.\" endorse or promote products derived from this software without
28.\" prior written permission. For written permission, please contact
29.\" openssl-core@openssl.org.
30.\"
31.\" 5. Products derived from this software may not be called "OpenSSL"
32.\" nor may "OpenSSL" appear in their names without prior written
33.\" permission of the OpenSSL Project.
34.\"
35.\" 6. Redistributions of any form whatsoever must retain the following
36.\" acknowledgment:
37.\" "This product includes software developed by the OpenSSL Project
38.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
39.\"
40.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
41.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
44.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\"
53.Dd $Mdocdate: December 14 2021 $
54.Dt SMIME_READ_ASN1 3
55.Os
56.Sh NAME
57.Nm SMIME_read_ASN1
58.Nd generic S/MIME message parser
59.Sh SYNOPSIS
60.In openssl/asn1.h
61.Ft ASN1_VALUE *
62.Fo SMIME_read_ASN1
63.Fa "BIO *in_bio"
64.Fa "BIO **out_bio"
65.Fa "const ASN1_ITEM *it"
66.Fc
67.Sh DESCRIPTION
68.Fn SMIME_read_ASN1
69reads a message in S/MIME format from
70.Fa in_bio .
71.Pp
72If the message uses cleartext signing, the content is saved in a memory
73.Vt BIO
74which is written to
75.Pf * Fa out_bio .
76Otherwise,
77.Pf * Fa out_bio
78is set to
79.Dv NULL .
80.Pp
81To support future functionality, if
82.Fa out_bio
83is not
84.Dv NULL ,
85.Pf * Fa out_bio
86should be initialized to
87.Dv NULL
88before calling
89.Fn SMIME_read_ASN1 .
90.Sh RETURN VALUES
91.Fn SMIME_read_ASN1
92returns a newly allocated object of type
93.Fa it
94or
95.Dv NULL
96if an error occurred.
97The error can be obtained from
98.Xr ERR_get_error 3 .
99.Sh SEE ALSO
100.Xr ASN1_item_d2i_bio 3 ,
101.Xr BIO_f_base64 3 ,
102.Xr BIO_new 3 ,
103.Xr SMIME_read_CMS 3 ,
104.Xr SMIME_read_PKCS7 3 ,
105.Xr SMIME_text 3
106.Sh HISTORY
107.Fn SMIME_read_ASN1
108first appeared in OpenSSL 0.9.8h and has been available since
109.Ox 4.5 .
110.Sh BUGS
111The MIME parser used by
112.Fn SMIME_read_ASN1
113is somewhat primitive.
114While it will handle most S/MIME messages, more complex compound
115formats may not work.
116.Pp
117The parser assumes that the
118structure is always base64 encoded, and it will not handle the case
119where it is in binary format or uses quoted printable format.
120.Pp
121The use of a memory
122to hold the signed content limits the size of the message which can
123be processed due to memory restraints: a streaming single pass
124option should be available.
diff --git a/src/lib/libcrypto/man/SMIME_read_CMS.3 b/src/lib/libcrypto/man/SMIME_read_CMS.3
index e1b1d07499..d37769e5ea 100644
--- a/src/lib/libcrypto/man/SMIME_read_CMS.3
+++ b/src/lib/libcrypto/man/SMIME_read_CMS.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SMIME_read_CMS.3,v 1.7 2021/12/14 14:30:50 schwarze Exp $ 1.\" $OpenBSD: SMIME_read_CMS.3,v 1.9 2025/06/11 13:41:03 schwarze Exp $
2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: December 14 2021 $ 51.Dd $Mdocdate: June 11 2025 $
52.Dt SMIME_READ_CMS 3 52.Dt SMIME_READ_CMS 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SMIME_read_CMS 55.Nm SMIME_read_CMS
56.Nd extract CMS ContentInfo from an S/MIME message 56.Nd extract CMS ContentInfo from an S/MIME message
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/cms.h 59.In openssl/cms.h
59.Ft CMS_ContentInfo * 60.Ft CMS_ContentInfo *
60.Fo SMIME_read_CMS 61.Fo SMIME_read_CMS
@@ -103,12 +104,15 @@ if an error occurred.
103The error can be obtained from 104The error can be obtained from
104.Xr ERR_get_error 3 . 105.Xr ERR_get_error 3 .
105.Sh SEE ALSO 106.Sh SEE ALSO
107.Xr BIO_f_base64 3 ,
108.Xr BIO_new 3 ,
106.Xr CMS_ContentInfo_new 3 , 109.Xr CMS_ContentInfo_new 3 ,
107.Xr CMS_decrypt 3 , 110.Xr CMS_decrypt 3 ,
108.Xr CMS_get0_type 3 , 111.Xr CMS_get0_type 3 ,
109.Xr CMS_verify 3 , 112.Xr CMS_verify 3 ,
110.Xr d2i_CMS_ContentInfo 3 , 113.Xr d2i_CMS_ContentInfo 3 ,
111.Xr SMIME_read_ASN1 3 , 114.Xr SMIME_read_PKCS7 3 ,
115.Xr SMIME_text 3 ,
112.Xr SMIME_write_CMS 3 116.Xr SMIME_write_CMS 3
113.Sh HISTORY 117.Sh HISTORY
114.Fn SMIME_read_CMS 118.Fn SMIME_read_CMS
diff --git a/src/lib/libcrypto/man/SMIME_read_PKCS7.3 b/src/lib/libcrypto/man/SMIME_read_PKCS7.3
index dbe2765b8b..095115c0dc 100644
--- a/src/lib/libcrypto/man/SMIME_read_PKCS7.3
+++ b/src/lib/libcrypto/man/SMIME_read_PKCS7.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SMIME_read_PKCS7.3,v 1.8 2021/12/14 14:30:50 schwarze Exp $ 1.\" $OpenBSD: SMIME_read_PKCS7.3,v 1.10 2025/06/11 13:41:03 schwarze Exp $
2.\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 2.\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: December 14 2021 $ 51.Dd $Mdocdate: June 11 2025 $
52.Dt SMIME_READ_PKCS7 3 52.Dt SMIME_READ_PKCS7 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SMIME_read_PKCS7 55.Nm SMIME_read_PKCS7
56.Nd extract a PKCS#7 object from an S/MIME message 56.Nd extract a PKCS#7 object from an S/MIME message
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/pkcs7.h 59.In openssl/pkcs7.h
59.Ft PKCS7 * 60.Ft PKCS7 *
60.Fo SMIME_read_PKCS7 61.Fo SMIME_read_PKCS7
@@ -124,8 +125,11 @@ if an error occurred.
124The error can be obtained from 125The error can be obtained from
125.Xr ERR_get_error 3 . 126.Xr ERR_get_error 3 .
126.Sh SEE ALSO 127.Sh SEE ALSO
128.Xr BIO_f_base64 3 ,
129.Xr BIO_new 3 ,
127.Xr PKCS7_new 3 , 130.Xr PKCS7_new 3 ,
128.Xr SMIME_read_ASN1 3 , 131.Xr SMIME_read_CMS 3 ,
132.Xr SMIME_text 3 ,
129.Xr SMIME_write_PKCS7 3 133.Xr SMIME_write_PKCS7 3
130.Sh HISTORY 134.Sh HISTORY
131.Fn SMIME_read_PKCS7 135.Fn SMIME_read_PKCS7
diff --git a/src/lib/libcrypto/man/SMIME_text.3 b/src/lib/libcrypto/man/SMIME_text.3
index a4c9689925..719b3d921f 100644
--- a/src/lib/libcrypto/man/SMIME_text.3
+++ b/src/lib/libcrypto/man/SMIME_text.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SMIME_text.3,v 1.1 2021/12/14 15:22:49 schwarze Exp $ 1.\" $OpenBSD: SMIME_text.3,v 1.3 2025/06/11 13:48:54 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: December 14 2021 $ 17.Dd $Mdocdate: June 11 2025 $
18.Dt SMIME_TEXT 3 18.Dt SMIME_TEXT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm SMIME_text 21.Nm SMIME_text
22.Nd remove text/plain MIME headers 22.Nd remove text/plain MIME headers
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
24.In openssl/asn1.h 25.In openssl/asn1.h
25.Ft int 26.Ft int
26.Fo SMIME_text 27.Fo SMIME_text
@@ -47,7 +48,10 @@ header, or if the content type is not
47.Dq text/plain . 48.Dq text/plain .
48.Sh SEE ALSO 49.Sh SEE ALSO
49.Xr SMIME_crlf_copy 3 , 50.Xr SMIME_crlf_copy 3 ,
50.Xr SMIME_read_ASN1 3 51.Xr SMIME_read_CMS 3 ,
52.Xr SMIME_read_PKCS7 3 ,
53.Xr SMIME_write_CMS 3 ,
54.Xr SMIME_write_PKCS7 3
51.Sh HISTORY 55.Sh HISTORY
52.Fn SMIME_text 56.Fn SMIME_text
53first appeared in OpenSSL 1.0.0 and has been available since 57first appeared in OpenSSL 1.0.0 and has been available since
diff --git a/src/lib/libcrypto/man/SMIME_write_ASN1.3 b/src/lib/libcrypto/man/SMIME_write_ASN1.3
deleted file mode 100644
index a02fa58570..0000000000
--- a/src/lib/libcrypto/man/SMIME_write_ASN1.3
+++ /dev/null
@@ -1,163 +0,0 @@
1.\" $OpenBSD: SMIME_write_ASN1.3,v 1.2 2023/05/01 07:28:11 tb Exp $
2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: May 1 2023 $
18.Dt SMIME_WRITE_ASN1 3
19.Os
20.Sh NAME
21.Nm SMIME_write_ASN1
22.Nd generate an S/MIME message
23.Sh SYNOPSIS
24.In openssl/asn1.h
25.Ft int
26.Fo SMIME_write_ASN1
27.Fa "BIO *out_bio"
28.Fa "ASN1_VALUE *val_in"
29.Fa "BIO *in_bio"
30.Fa "int flags"
31.Fa "int ctype_nid"
32.Fa "int econt_nid"
33.Fa "STACK_OF(X509_ALGOR) *micalg"
34.Fa "const ASN1_ITEM *it"
35.Fc
36.Sh DESCRIPTION
37.Fn SMIME_write_ASN1
38generates an S/MIME message on
39.Fa out_bio
40by writing MIME 1.0 headers
41followed by a BER- and base64-encoded serialization of
42.Fa val_in ,
43which can be of the type
44.Vt CMS_ContentInfo
45or
46.Vt PKCS7
47and has to match the
48.Fa it
49argument.
50.Pp
51The
52.Fa flags
53can be the logical OR of zero or more of the following bits:
54.Bl -tag -width Ds
55.It Dv PKCS7_REUSE_DIGEST
56Skip the calls to
57.Xr PKCS7_dataInit 3
58and
59.Xr PKCS7_dataFinal 3 .
60This flag has no effect unless
61.Dv SMIME_DETACHED
62is also set.
63It is normally used if
64.Fa out_bio
65is already set up to calculate and finalize the digest when written through.
66.It Dv SMIME_BINARY
67If specified, this flag is passed through to
68.Xr SMIME_crlf_copy 3 .
69.It Dv SMIME_CRLFEOL
70End MIME header lines with pairs of carriage return and newline characters.
71By default, no carriage return characters are written
72and header lines are ended with newline characters only.
73.It Dv SMIME_DETACHED
74Use cleartext signing.
75Generate a
76.Qq multipart/signed
77S/MIME message using the
78.Fa micalg
79argument and ignoring the
80.Fa ctype_nid
81and
82.Fa econt_nid
83arguments.
84The content is read from
85.Fa in_bio .
86If
87.Fa in_bio
88is a
89.Dv NULL
90pointer, this flag is ignored.
91.Pp
92If this flag is ignored or not specified,
93the smime-type is chosen according to
94.Fa ctype_nid
95instead:
96.Bl -tag -width Ds
97.It Dv NID_pkcs7_enveloped
98.Qq enveloped-data
99.It Dv NID_pkcs7_signed
100.Qq signed-receipt
101if
102.Fa econt_nid
103is
104.Dv NID_id_smime_ct_receipt
105.br
106.Qq signed-data
107if
108.Fa micalg
109is not empty
110.br
111.Qq certs-only
112if
113.Fa micalg
114is empty
115.It Dv NID_id_smime_ct_compressedData
116.Qq compressed-data
117.El
118.It Dv SMIME_OLDMIME
119In Content-Type headers, use
120.Qq application/x-pkcs7-mime
121or
122.Qq application/x-pkcs7-signature .
123By default,
124.Qq application/pkcs7-mime
125or
126.Qq application/pkcs7-signature
127are used instead.
128.It Dv SMIME_STREAM
129Perform streaming by reading the content from
130.Fa in_bio .
131This only works if
132.Dv SMIME_DETACHED
133is not specified.
134.It SMIME_TEXT
135Prepend the line
136.Qq Content-Type: text/plain
137to the content.
138This only makes sense if
139.Dv SMIME_DETACHED
140is also set.
141It is ignored if the flag
142.Dv SMIME_BINARY
143is also set.
144.El
145.Sh RETURN VALUES
146.Fn SMIME_write_ASN1
147is intended to return 1 on success or 0 on failure.
148.Sh SEE ALSO
149.Xr ASN1_item_i2d_bio 3 ,
150.Xr BIO_f_base64 3 ,
151.Xr BIO_new 3 ,
152.Xr SMIME_crlf_copy 3 ,
153.Xr SMIME_write_CMS 3 ,
154.Xr SMIME_write_PKCS7 3 ,
155.Xr X509_ALGOR_new 3
156.Sh HISTORY
157.Fn SMIME_write_ASN1
158first appeared in OpenSSL 1.0.0 and has been available since
159.Ox 4.9 .
160.Sh BUGS
161.Fn SMIME_write_ASN1
162ignores most errors and is likely to return 1
163even after producing corrupt or incomplete output.
diff --git a/src/lib/libcrypto/man/SMIME_write_CMS.3 b/src/lib/libcrypto/man/SMIME_write_CMS.3
index c2c6b77e53..5f4c43bb7c 100644
--- a/src/lib/libcrypto/man/SMIME_write_CMS.3
+++ b/src/lib/libcrypto/man/SMIME_write_CMS.3
@@ -1,7 +1,24 @@
1.\" $OpenBSD: SMIME_write_CMS.3,v 1.6 2021/12/13 17:24:39 schwarze Exp $ 1.\" $OpenBSD: SMIME_write_CMS.3,v 1.9 2025/06/11 23:16:32 schwarze Exp $
2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file is a derived work.
5.\" The changes are covered by the following Copyright and license:
6.\"
7.\" Copyright (c) 2021, 2025 Ingo Schwarze <schwarze@openbsd.org>
8.\"
9.\" Permission to use, copy, modify, and distribute this software for any
10.\" purpose with or without fee is hereby granted, provided that the above
11.\" copyright notice and this permission notice appear in all copies.
12.\"
13.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20.\"
21.\" The original file was written by Dr. Stephen Henson <steve@openssl.org>.
5.\" Copyright (c) 2008 The OpenSSL Project. All rights reserved. 22.\" Copyright (c) 2008 The OpenSSL Project. All rights reserved.
6.\" 23.\"
7.\" Redistribution and use in source and binary forms, with or without 24.\" Redistribution and use in source and binary forms, with or without
@@ -48,13 +65,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 67.\"
51.Dd $Mdocdate: December 13 2021 $ 68.Dd $Mdocdate: June 11 2025 $
52.Dt SMIME_WRITE_CMS 3 69.Dt SMIME_WRITE_CMS 3
53.Os 70.Os
54.Sh NAME 71.Sh NAME
55.Nm SMIME_write_CMS 72.Nm SMIME_write_CMS
56.Nd convert CMS structure to S/MIME format 73.Nd convert CMS structure to S/MIME format
57.Sh SYNOPSIS 74.Sh SYNOPSIS
75.Lb libcrypto
58.In openssl/cms.h 76.In openssl/cms.h
59.Ft int 77.Ft int
60.Fo SMIME_write_CMS 78.Fo SMIME_write_CMS
@@ -65,21 +83,35 @@
65.Fc 83.Fc
66.Sh DESCRIPTION 84.Sh DESCRIPTION
67.Fn SMIME_write_CMS 85.Fn SMIME_write_CMS
68adds the appropriate MIME headers to the 86generates an S/MIME message on
69.Fa cms 87.Fa out
70structure to produce an S/MIME message and writes it to 88by writing MIME 1.0 headers
71.Fa out . 89followed by a BER- and base64-encoded serialization of
90.Fa cms .
91The BER encoding uses the DER format except as described for
92.Dv CMS_STREAM
93below.
72If streaming is enabled, the content must be supplied in the 94If streaming is enabled, the content must be supplied in the
73.Fa data 95.Fa data
74argument. 96argument.
75.Pp 97.Pp
76The following 98The
77.Fa flags 99.Fa flags
78can be passed: 100can be the logical OR of zero or more of the following bits:
79.Bl -tag -width Ds 101.Bl -tag -width Ds
80.It Dv CMS_DETACHED 102.It Dv CMS_DETACHED
81Use cleartext signing. 103Use cleartext signing and generate a
82This option only makes sense if 104.Qq multipart/signed
105S/MIME message.
106The content is read from
107.Fa data .
108If
109.Fa data
110is a
111.Dv NULL
112pointer, this flag is ignored.
113.Pp
114This flag is only supported if
83.Fa cms 115.Fa cms
84is of the type 116is of the type
85.Vt SignedData 117.Vt SignedData
@@ -94,13 +126,46 @@ is not set, the data must be read twice:
94once to compute the signature in 126once to compute the signature in
95.Xr CMS_sign 3 127.Xr CMS_sign 3
96and once to output the S/MIME message. 128and once to output the S/MIME message.
97.It Dv CMS_TEXT 129.Pp
98Add MIME headers for type text/plain to the content. 130If
99This only makes sense if 131.Dv CMS_DETACHED
132is ignored or not specified, the smime-type is chosen according to
133.Xr CMS_get0_type 3 :
134.Bl -tag -width Ds
135.It Dv NID_pkcs7_enveloped
136.Qq enveloped-data
137.It Dv NID_pkcs7_signed
138.Bl -tag -width Msigned-receiptM -compact
139.It Qq signed-receipt
140if
141.Xr CMS_get0_eContentType 3
142is
143.Dv NID_id_smime_ct_receipt
144.It Qq signed-data
145if
146.Fa cms
147specifies any digest algorithm
148.It Qq certs-only
149otherwise
150.El
151.It Dv NID_id_smime_ct_compressedData
152.Qq compressed-data
153.El
154.It Dv CMS_REUSE_DIGEST
155Skip the calls to
156.Xr CMS_dataInit 3
157and
158.Xr CMS_dataFinal 3 .
159This flag has no effect unless
100.Dv CMS_DETACHED 160.Dv CMS_DETACHED
101is also set. 161is also set.
102.It Dv CMS_STREAM 162.It Dv CMS_STREAM
103Perform streaming. 163Perform streaming by reading the content from
164.Fa data .
165This only works if
166.Dv CMS_DETACHED
167is not specified.
168.Pp
104This flag should only be set if 169This flag should only be set if
105.Dv CMS_STREAM 170.Dv CMS_STREAM
106was also passed to the function that created 171was also passed to the function that created
@@ -111,17 +176,38 @@ constructed encoding except in the case of
111.Vt SignedData 176.Vt SignedData
112with detached content where the content is absent and DER format is 177with detached content where the content is absent and DER format is
113used. 178used.
179.It Dv CMS_TEXT
180Prepend the line
181.Qq Content-Type: text/plain
182to the content.
183This only makes sense if
184.Dv CMS_DETACHED
185is also set.
186It is ignored if the flag
187.Dv SMIME_BINARY
188is also set.
189.It Dv SMIME_BINARY
190If specified, this flag is passed through to
191.Xr SMIME_crlf_copy 3 .
192.It Dv SMIME_CRLFEOL
193End MIME header lines with pairs of carriage return and newline characters.
194By default, no carriage return characters are written
195and header lines are ended with newline characters only.
114.El 196.El
115.Sh RETURN VALUES 197.Sh RETURN VALUES
116.Fn SMIME_write_CMS 198.Fn SMIME_write_CMS
117returns 1 for success or 0 for failure. 199is intended to return 1 on success or 0 on failure.
118.Sh SEE ALSO 200.Sh SEE ALSO
201.Xr BIO_f_base64 3 ,
202.Xr BIO_new 3 ,
119.Xr CMS_ContentInfo_new 3 , 203.Xr CMS_ContentInfo_new 3 ,
120.Xr CMS_encrypt 3 , 204.Xr CMS_encrypt 3 ,
121.Xr CMS_sign 3 , 205.Xr CMS_sign 3 ,
122.Xr d2i_CMS_ContentInfo 3 , 206.Xr d2i_CMS_ContentInfo 3 ,
123.Xr ERR_get_error 3 , 207.Xr ERR_get_error 3 ,
124.Xr SMIME_write_ASN1 3 208.Xr SMIME_crlf_copy 3 ,
209.Xr SMIME_read_CMS 3 ,
210.Xr SMIME_write_PKCS7 3
125.Sh HISTORY 211.Sh HISTORY
126.Fn SMIME_write_CMS 212.Fn SMIME_write_CMS
127first appeared in OpenSSL 0.9.8h 213first appeared in OpenSSL 0.9.8h
@@ -129,5 +215,9 @@ and has been available since
129.Ox 6.7 . 215.Ox 6.7 .
130.Sh BUGS 216.Sh BUGS
131.Fn SMIME_write_CMS 217.Fn SMIME_write_CMS
218ignores most errors and is likely to return 1
219even after producing corrupt or incomplete output.
220.Pp
221.Fn SMIME_write_CMS
132always base64 encodes CMS structures. 222always base64 encodes CMS structures.
133There should be an option to disable this. 223There should be an option to disable this.
diff --git a/src/lib/libcrypto/man/SMIME_write_PKCS7.3 b/src/lib/libcrypto/man/SMIME_write_PKCS7.3
index c1a9f051d0..5e344d9c63 100644
--- a/src/lib/libcrypto/man/SMIME_write_PKCS7.3
+++ b/src/lib/libcrypto/man/SMIME_write_PKCS7.3
@@ -1,10 +1,10 @@
1.\" $OpenBSD: SMIME_write_PKCS7.3,v 1.9 2021/12/14 15:46:48 schwarze Exp $ 1.\" $OpenBSD: SMIME_write_PKCS7.3,v 1.12 2025/06/11 23:16:32 schwarze Exp $
2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
5.\" The changes are covered by the following Copyright and license: 5.\" The changes are covered by the following Copyright and license:
6.\" 6.\"
7.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 7.\" Copyright (c) 2021, 2025 Ingo Schwarze <schwarze@openbsd.org>
8.\" 8.\"
9.\" Permission to use, copy, modify, and distribute this software for any 9.\" Permission to use, copy, modify, and distribute this software for any
10.\" purpose with or without fee is hereby granted, provided that the above 10.\" purpose with or without fee is hereby granted, provided that the above
@@ -66,13 +66,14 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: December 14 2021 $ 69.Dd $Mdocdate: June 11 2025 $
70.Dt SMIME_WRITE_PKCS7 3 70.Dt SMIME_WRITE_PKCS7 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
73.Nm SMIME_write_PKCS7 73.Nm SMIME_write_PKCS7
74.Nd convert PKCS#7 structure to S/MIME format 74.Nd convert PKCS#7 structure to S/MIME format
75.Sh SYNOPSIS 75.Sh SYNOPSIS
76.Lb libcrypto
76.In openssl/pkcs7.h 77.In openssl/pkcs7.h
77.Ft int 78.Ft int
78.Fo SMIME_write_PKCS7 79.Fo SMIME_write_PKCS7
@@ -83,48 +84,81 @@
83.Fc 84.Fc
84.Sh DESCRIPTION 85.Sh DESCRIPTION
85.Fn SMIME_write_PKCS7 86.Fn SMIME_write_PKCS7
86adds the appropriate MIME headers to a PKCS#7 structure to produce an 87generates an S/MIME message on
87S/MIME message.
88.Pp
89.Fa out 88.Fa out
90is the 89by writing MIME 1.0 headers
91.Vt BIO 90followed by a BER- and base64-encoded serialization of
92to write the data to. 91.Fa p7 .
93.Fa p7 92The BER encoding uses the DER format except as described for
94is the appropriate 93.Dv PKCS7_STREAM
95.Vt PKCS7 94below.
96structure.
97If streaming is enabled, then the content must be supplied in the 95If streaming is enabled, then the content must be supplied in the
98.Fa data 96.Fa data
99argument. 97argument.
100.Fa flags
101is an optional set of flags.
102.Pp 98.Pp
103The following flags can be passed in the 99The
104.Fa flags 100.Fa flags
105parameter. 101can be the logical OR of zero or more of the following bits:
106.Pp 102.Bl -tag -width Ds
103.It Dv PKCS7_DETACHED
104Use cleartext signing and generate a
105.Qq multipart/signed
106S/MIME message.
107The content is read from
108.Fa data .
107If 109If
108.Dv PKCS7_DETACHED 110.Fa data
109is set, then cleartext signing will be used. 111is a
110This option only makes sense for signedData where 112.Dv NULL
113pointer, this flag is ignored.
114.Pp
115This flag is only supported for signedData where
111.Dv PKCS7_DETACHED 116.Dv PKCS7_DETACHED
112is also set when 117is also set when
113.Xr PKCS7_sign 3 118.Xr PKCS7_sign 3
114is also called. 119is called.
115.Pp 120.Pp
116If the 121If
117.Dv PKCS7_TEXT 122.Dv PKCS7_STREAM
118flag is set, MIME headers for type 123is not set, the data must be read twice: once to compute the
119.Sy text/plain 124signature in
120are added to the content. 125.Xr PKCS7_sign 3
121This only makes sense if 126and once to output the S/MIME message.
127.Pp
128If
129.Dv PKCS7_DETACHED
130is ignored or not specified, the smime-type is chosen according to the type of
131.Fa p7 :
132.Bl -tag -width Ds
133.It Dv NID_pkcs7_enveloped
134.Qq enveloped-data
135.It Dv NID_pkcs7_signed
136.Bl -tag -width Msigned-dataM -compact
137.It Qq signed-data
138if
139.Fa p7
140specifies any digest algorithm
141.It Qq certs-only
142otherwise
143.El
144.It Dv NID_id_smime_ct_compressedData
145.Qq compressed-data
146.El
147.It Dv PKCS7_REUSE_DIGEST
148Skip the calls to
149.Xr PKCS7_dataInit 3
150and
151.Xr PKCS7_dataFinal 3 .
152This flag has no effect unless
122.Dv PKCS7_DETACHED 153.Dv PKCS7_DETACHED
123is also set. 154is also set.
155.It Dv PKCS7_STREAM
156Perform streaming by reading the content from
157.Fa data .
158This only works if
159.Dv PKCS7_DETACHED
160is not specified.
124.Pp 161.Pp
125If the
126.Dv PKCS7_STREAM
127flag is set, streaming is performed.
128This flag should only be set if 162This flag should only be set if
129.Dv PKCS7_STREAM 163.Dv PKCS7_STREAM
130was also set in the previous call to 164was also set in the previous call to
@@ -132,13 +166,28 @@ was also set in the previous call to
132or 166or
133.Xr PKCS7_encrypt 3 . 167.Xr PKCS7_encrypt 3 .
134.Pp 168.Pp
135The bit 169The content is output in BER format using indefinite length constructed
136.Dv SMIME_OLDMIME 170encoding except in the case of signed data with detached content
137is inverted before passing on the 171where the content is absent and DER format is used.
138.Fa flags 172.It Dv PKCS7_TEXT
139to 173Prepend the line
140.Xr SMIME_write_ASN1 3 . 174.Qq Content-Type: text/plain
141Consequently, if this bit is set in the 175to the content.
176This only makes sense if
177.Dv PKCS7_DETACHED
178is also set.
179It is ignored if the flag
180.Dv SMIME_BINARY
181is also set.
182.It Dv SMIME_BINARY
183If specified, this flag is passed through to
184.Xr SMIME_crlf_copy 3 .
185.It Dv SMIME_CRLFEOL
186End MIME header lines with pairs of carriage return and newline characters.
187By default, no carriage return characters are written
188and header lines are ended with newline characters only.
189.It Dv SMIME_OLDMIME
190If this bit is set in the
142.Fa flags 191.Fa flags
143argument, 192argument,
144.Qq application/pkcs7-mime 193.Qq application/pkcs7-mime
@@ -150,35 +199,30 @@ Otherwise,
150or 199or
151.Qq application/x-pkcs7-signature 200.Qq application/x-pkcs7-signature
152is used. 201is used.
153.Pp 202.El
154If cleartext signing is being used and
155.Dv PKCS7_STREAM
156is not set, then the data must be read twice: once to compute the
157signature in
158.Xr PKCS7_sign 3
159and once to output the S/MIME message.
160.Pp
161If streaming is performed, the content is output in BER format using
162indefinite length constructed encoding except in the case of signed
163data with detached content where the content is absent and DER
164format is used.
165.Sh RETURN VALUES 203.Sh RETURN VALUES
166Upon successful completion, 1 is returned; 204.Fn SMIME_write_PKCS7
167otherwise 0 is returned and an error code can be retrieved with 205is intended to return 1 on success or 0 on failure.
168.Xr ERR_get_error 3 .
169.Sh SEE ALSO 206.Sh SEE ALSO
207.Xr BIO_f_base64 3 ,
208.Xr BIO_new 3 ,
170.Xr i2d_PKCS7_bio_stream 3 , 209.Xr i2d_PKCS7_bio_stream 3 ,
171.Xr PEM_write_bio_PKCS7_stream 3 , 210.Xr PEM_write_bio_PKCS7_stream 3 ,
172.Xr PEM_write_PKCS7 3 , 211.Xr PEM_write_PKCS7 3 ,
173.Xr PKCS7_final 3 , 212.Xr PKCS7_final 3 ,
174.Xr PKCS7_new 3 , 213.Xr PKCS7_new 3 ,
214.Xr SMIME_crlf_copy 3 ,
175.Xr SMIME_read_PKCS7 3 , 215.Xr SMIME_read_PKCS7 3 ,
176.Xr SMIME_write_ASN1 3 216.Xr SMIME_write_CMS 3
177.Sh HISTORY 217.Sh HISTORY
178.Fn SMIME_write_PKCS7 218.Fn SMIME_write_PKCS7
179first appeared in OpenSSL 0.9.5 and has been available since 219first appeared in OpenSSL 0.9.5 and has been available since
180.Ox 2.7 . 220.Ox 2.7 .
181.Sh BUGS 221.Sh BUGS
182.Fn SMIME_write_PKCS7 222.Fn SMIME_write_PKCS7
223ignores most errors and is likely to return 1
224even after producing corrupt or incomplete output.
225.Pp
226.Fn SMIME_write_PKCS7
183always base64 encodes PKCS#7 structures. 227always base64 encodes PKCS#7 structures.
184There should be an option to disable this. 228There should be an option to disable this.
diff --git a/src/lib/libcrypto/man/STACK_OF.3 b/src/lib/libcrypto/man/STACK_OF.3
index 4c627eed9b..38bca99cf6 100644
--- a/src/lib/libcrypto/man/STACK_OF.3
+++ b/src/lib/libcrypto/man/STACK_OF.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: STACK_OF.3,v 1.5 2021/10/24 13:10:46 schwarze Exp $ 1.\" $OpenBSD: STACK_OF.3,v 1.6 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: October 24 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt STACK_OF 3 18.Dt STACK_OF 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm STACK_OF 21.Nm STACK_OF
22.Nd variable-sized arrays of pointers, called OpenSSL stacks 22.Nd variable-sized arrays of pointers, called OpenSSL stacks
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
24.In openssl/safestack.h 25.In openssl/safestack.h
25.Fn STACK_OF type 26.Fn STACK_OF type
26.Sh DESCRIPTION 27.Sh DESCRIPTION
diff --git a/src/lib/libcrypto/man/TS_REQ_new.3 b/src/lib/libcrypto/man/TS_REQ_new.3
index 8dbd15ea7e..796b58f4f8 100644
--- a/src/lib/libcrypto/man/TS_REQ_new.3
+++ b/src/lib/libcrypto/man/TS_REQ_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: TS_REQ_new.3,v 1.6 2019/06/06 01:06:59 schwarze Exp $ 1.\" $OpenBSD: TS_REQ_new.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 6 2019 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt TS_REQ_NEW 3 18.Dt TS_REQ_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -32,6 +32,7 @@
32.Nm TS_MSG_IMPRINT_free 32.Nm TS_MSG_IMPRINT_free
33.Nd X.509 time-stamp protocol 33.Nd X.509 time-stamp protocol
34.Sh SYNOPSIS 34.Sh SYNOPSIS
35.Lb libcrypto
35.In openssl/ts.h 36.In openssl/ts.h
36.Ft TS_REQ * 37.Ft TS_REQ *
37.Fn TS_REQ_new void 38.Fn TS_REQ_new void
diff --git a/src/lib/libcrypto/man/UI_create_method.3 b/src/lib/libcrypto/man/UI_create_method.3
index ffd6b98157..a116baaa79 100644
--- a/src/lib/libcrypto/man/UI_create_method.3
+++ b/src/lib/libcrypto/man/UI_create_method.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: UI_create_method.3,v 1.6 2023/05/22 19:38:04 tb Exp $ 1.\" $OpenBSD: UI_create_method.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL UI_create_method.pod 8e3d46e5 Mar 11 10:51:04 2017 +0100 2.\" OpenSSL UI_create_method.pod 8e3d46e5 Mar 11 10:51:04 2017 +0100
3.\" 3.\"
4.\" This file was written by Richard Levitte <levitte@openssl.org>. 4.\" This file was written by Richard Levitte <levitte@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: May 22 2023 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt UI_CREATE_METHOD 3 52.Dt UI_CREATE_METHOD 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -68,6 +68,7 @@
68.Nm UI_method_get_prompt_constructor 68.Nm UI_method_get_prompt_constructor
69.Nd user interface method creation and destruction 69.Nd user interface method creation and destruction
70.Sh SYNOPSIS 70.Sh SYNOPSIS
71.Lb libcrypto
71.In openssl/ui.h 72.In openssl/ui.h
72.Ft UI_METHOD * 73.Ft UI_METHOD *
73.Fo UI_create_method 74.Fo UI_create_method
diff --git a/src/lib/libcrypto/man/UI_get_string_type.3 b/src/lib/libcrypto/man/UI_get_string_type.3
index bc0449a90e..84c774d94d 100644
--- a/src/lib/libcrypto/man/UI_get_string_type.3
+++ b/src/lib/libcrypto/man/UI_get_string_type.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: UI_get_string_type.3,v 1.4 2018/03/22 21:08:22 schwarze Exp $ 1.\" $OpenBSD: UI_get_string_type.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL UI_STRING.pod e9c9971b Jul 1 18:28:50 2017 +0200 2.\" OpenSSL UI_STRING.pod e9c9971b Jul 1 18:28:50 2017 +0200
3.\" 3.\"
4.\" This file was written by Richard Levitte <levitte@openssl.org> 4.\" This file was written by Richard Levitte <levitte@openssl.org>
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 22 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt UI_GET_STRING_TYPE 3 52.Dt UI_GET_STRING_TYPE 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -63,6 +63,7 @@
63.Nm UI_set_result 63.Nm UI_set_result
64.Nd OpenSSL user interface string parsing 64.Nd OpenSSL user interface string parsing
65.Sh SYNOPSIS 65.Sh SYNOPSIS
66.Lb libcrypto
66.In openssl/ui.h 67.In openssl/ui.h
67.Bd -literal 68.Bd -literal
68enum UI_string_types { 69enum UI_string_types {
diff --git a/src/lib/libcrypto/man/UI_new.3 b/src/lib/libcrypto/man/UI_new.3
index e55477f31e..853219aac2 100644
--- a/src/lib/libcrypto/man/UI_new.3
+++ b/src/lib/libcrypto/man/UI_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: UI_new.3,v 1.13 2025/03/09 15:25:14 tb Exp $ 1.\" $OpenBSD: UI_new.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL 78b19e90 Jan 11 00:12:01 2017 +0100 2.\" full merge up to: OpenSSL 78b19e90 Jan 11 00:12:01 2017 +0100
3.\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 3.\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800
4.\" 4.\"
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: March 9 2025 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt UI_NEW 3 53.Dt UI_NEW 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -80,6 +80,7 @@
80.Nm UI_null 80.Nm UI_null
81.Nd New User Interface 81.Nd New User Interface
82.Sh SYNOPSIS 82.Sh SYNOPSIS
83.Lb libcrypto
83.In openssl/ui.h 84.In openssl/ui.h
84.Ft UI * 85.Ft UI *
85.Fn UI_new void 86.Fn UI_new void
diff --git a/src/lib/libcrypto/man/X25519.3 b/src/lib/libcrypto/man/X25519.3
index a327f8c7b2..3686df9bfa 100644
--- a/src/lib/libcrypto/man/X25519.3
+++ b/src/lib/libcrypto/man/X25519.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X25519.3,v 1.7 2022/12/15 17:20:48 schwarze Exp $ 1.\" $OpenBSD: X25519.3,v 1.8 2025/06/08 22:40:30 schwarze Exp $
2.\" contains some text from: BoringSSL curve25519.h, curve25519.c 2.\" contains some text from: BoringSSL curve25519.h, curve25519.c
3.\" content also checked up to: OpenSSL f929439f Mar 15 12:19:16 2018 +0000 3.\" content also checked up to: OpenSSL f929439f Mar 15 12:19:16 2018 +0000
4.\" 4.\"
@@ -24,7 +24,7 @@
24.\" by Daniel J. Bernstein and others that are included in SUPERCOP 24.\" by Daniel J. Bernstein and others that are included in SUPERCOP
25.\" and that Adam Langley's BoringSSL implementation is based on. 25.\" and that Adam Langley's BoringSSL implementation is based on.
26.\" 26.\"
27.Dd $Mdocdate: December 15 2022 $ 27.Dd $Mdocdate: June 8 2025 $
28.Dt X25519 3 28.Dt X25519 3
29.Os 29.Os
30.Sh NAME 30.Sh NAME
@@ -35,6 +35,7 @@
35.Nm ED25519_verify 35.Nm ED25519_verify
36.Nd Elliptic Curve Diffie-Hellman and signature primitives based on Curve25519 36.Nd Elliptic Curve Diffie-Hellman and signature primitives based on Curve25519
37.Sh SYNOPSIS 37.Sh SYNOPSIS
38.Lb libcrypto
38.In openssl/curve25519.h 39.In openssl/curve25519.h
39.Ft int 40.Ft int
40.Fo X25519 41.Fo X25519
diff --git a/src/lib/libcrypto/man/X509V3_EXT_get_nid.3 b/src/lib/libcrypto/man/X509V3_EXT_get_nid.3
index ad153c36d0..78975874aa 100644
--- a/src/lib/libcrypto/man/X509V3_EXT_get_nid.3
+++ b/src/lib/libcrypto/man/X509V3_EXT_get_nid.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509V3_EXT_get_nid.3,v 1.8 2024/12/24 09:48:56 schwarze Exp $ 1.\" $OpenBSD: X509V3_EXT_get_nid.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2024 Theo Buehler <tb@openbsd.org> 3.\" Copyright (c) 2024 Theo Buehler <tb@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: December 24 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509V3_EXT_GET_NID 3 18.Dt X509V3_EXT_GET_NID 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm X509V3_EXT_get 22.Nm X509V3_EXT_get
23.Nd retrieve X.509v3 certificate extension methods 23.Nd retrieve X.509v3 certificate extension methods
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/x509v3.h 26.In openssl/x509v3.h
26.Ft const X509V3_EXT_METHOD * 27.Ft const X509V3_EXT_METHOD *
27.Fo X509V3_EXT_get_nid 28.Fo X509V3_EXT_get_nid
diff --git a/src/lib/libcrypto/man/X509V3_EXT_print.3 b/src/lib/libcrypto/man/X509V3_EXT_print.3
index edb97d3a36..8705e4d5ac 100644
--- a/src/lib/libcrypto/man/X509V3_EXT_print.3
+++ b/src/lib/libcrypto/man/X509V3_EXT_print.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509V3_EXT_print.3,v 1.3 2024/12/28 10:19:45 schwarze Exp $ 1.\" $OpenBSD: X509V3_EXT_print.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021, 2024 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021, 2024 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: December 28 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509V3_EXT_PRINT 3 18.Dt X509V3_EXT_PRINT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm X509V3_EXT_print_fp 22.Nm X509V3_EXT_print_fp
23.Nd pretty-print an X.509 extension 23.Nd pretty-print an X.509 extension
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/x509v3.h 26.In openssl/x509v3.h
26.Ft int 27.Ft int
27.Fo X509V3_EXT_print 28.Fo X509V3_EXT_print
diff --git a/src/lib/libcrypto/man/X509V3_extensions_print.3 b/src/lib/libcrypto/man/X509V3_extensions_print.3
index 8c43fe9b01..d95a4da01e 100644
--- a/src/lib/libcrypto/man/X509V3_extensions_print.3
+++ b/src/lib/libcrypto/man/X509V3_extensions_print.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509V3_extensions_print.3,v 1.2 2021/11/26 13:48:21 jsg Exp $ 1.\" $OpenBSD: X509V3_extensions_print.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: November 26 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509V3_EXTENSIONS_PRINT 3 18.Dt X509V3_EXTENSIONS_PRINT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm X509V3_extensions_print 21.Nm X509V3_extensions_print
22.Nd pretty-print an array of X.509 extensions 22.Nd pretty-print an array of X.509 extensions
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
24.In openssl/x509v3.h 25.In openssl/x509v3.h
25.Ft int 26.Ft int
26.Fo X509V3_extensions_print 27.Fo X509V3_extensions_print
diff --git a/src/lib/libcrypto/man/X509V3_get_d2i.3 b/src/lib/libcrypto/man/X509V3_get_d2i.3
index bf442dc846..7920fca09f 100644
--- a/src/lib/libcrypto/man/X509V3_get_d2i.3
+++ b/src/lib/libcrypto/man/X509V3_get_d2i.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509V3_get_d2i.3,v 1.25 2024/12/31 20:17:00 tb Exp $ 1.\" $OpenBSD: X509V3_get_d2i.3,v 1.26 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL ff7fbfd5 Nov 2 11:52:01 2015 +0000 2.\" full merge up to: OpenSSL ff7fbfd5 Nov 2 11:52:01 2015 +0000
3.\" selective merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 3.\" selective merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
4.\" 4.\"
@@ -67,7 +67,7 @@
67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
69.\" 69.\"
70.Dd $Mdocdate: December 31 2024 $ 70.Dd $Mdocdate: June 8 2025 $
71.Dt X509V3_GET_D2I 3 71.Dt X509V3_GET_D2I 3
72.Os 72.Os
73.Sh NAME 73.Sh NAME
@@ -87,6 +87,7 @@
87.Nm X509_get0_uids 87.Nm X509_get0_uids
88.Nd X509 extension decode and encode functions 88.Nd X509 extension decode and encode functions
89.Sh SYNOPSIS 89.Sh SYNOPSIS
90.Lb libcrypto
90.In openssl/x509v3.h 91.In openssl/x509v3.h
91.Ft void * 92.Ft void *
92.Fo X509V3_get_d2i 93.Fo X509V3_get_d2i
diff --git a/src/lib/libcrypto/man/X509V3_parse_list.3 b/src/lib/libcrypto/man/X509V3_parse_list.3
index 447f1a5e94..385f8ad9c8 100644
--- a/src/lib/libcrypto/man/X509V3_parse_list.3
+++ b/src/lib/libcrypto/man/X509V3_parse_list.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509V3_parse_list.3,v 1.2 2024/12/24 09:48:56 schwarze Exp $ 1.\" $OpenBSD: X509V3_parse_list.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: December 24 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509V3_PARSE_LIST 3 18.Dt X509V3_PARSE_LIST 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm X509V3_conf_free 22.Nm X509V3_conf_free
23.Nd create and destroy CONF_VALUE objects 23.Nd create and destroy CONF_VALUE objects
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/x509v3.h 26.In openssl/x509v3.h
26.Ft STACK_OF(CONF_VALUE) * 27.Ft STACK_OF(CONF_VALUE) *
27.Fn X509V3_parse_list "const char *string" 28.Fn X509V3_parse_list "const char *string"
diff --git a/src/lib/libcrypto/man/X509_ALGOR_dup.3 b/src/lib/libcrypto/man/X509_ALGOR_dup.3
index ef7ca75863..bc9ba4b77d 100644
--- a/src/lib/libcrypto/man/X509_ALGOR_dup.3
+++ b/src/lib/libcrypto/man/X509_ALGOR_dup.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_ALGOR_dup.3,v 1.23 2024/03/19 17:34:05 tb Exp $ 1.\" $OpenBSD: X509_ALGOR_dup.3,v 1.24 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL 4692340e Jun 7 15:49:08 2016 -0400 2.\" OpenSSL 4692340e Jun 7 15:49:08 2016 -0400
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: March 19 2024 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt X509_ALGOR_DUP 3 70.Dt X509_ALGOR_DUP 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -78,6 +78,7 @@
78.Nm X509_ALGOR_cmp 78.Nm X509_ALGOR_cmp
79.Nd create, change, and inspect algorithm identifiers 79.Nd create, change, and inspect algorithm identifiers
80.Sh SYNOPSIS 80.Sh SYNOPSIS
81.Lb libcrypto
81.In openssl/x509.h 82.In openssl/x509.h
82.Ft X509_ALGOR * 83.Ft X509_ALGOR *
83.Fn X509_ALGOR_new void 84.Fn X509_ALGOR_new void
diff --git a/src/lib/libcrypto/man/X509_ATTRIBUTE_get0_object.3 b/src/lib/libcrypto/man/X509_ATTRIBUTE_get0_object.3
index 4212e27d7e..b452fcbea2 100644
--- a/src/lib/libcrypto/man/X509_ATTRIBUTE_get0_object.3
+++ b/src/lib/libcrypto/man/X509_ATTRIBUTE_get0_object.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_ATTRIBUTE_get0_object.3,v 1.2 2021/10/21 16:26:34 schwarze Exp $ 1.\" $OpenBSD: X509_ATTRIBUTE_get0_object.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: October 21 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_ATTRIBUTE_GET0_OBJECT 3 18.Dt X509_ATTRIBUTE_GET0_OBJECT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -27,6 +27,7 @@
27.\" The type is called "Attribute" with capital "A", not "attribute". 27.\" The type is called "Attribute" with capital "A", not "attribute".
28.Nd X.501 Attribute read accessors 28.Nd X.501 Attribute read accessors
29.Sh SYNOPSIS 29.Sh SYNOPSIS
30.Lb libcrypto
30.In openssl/x509.h 31.In openssl/x509.h
31.Ft ASN1_OBJECT * 32.Ft ASN1_OBJECT *
32.Fo X509_ATTRIBUTE_get0_object 33.Fo X509_ATTRIBUTE_get0_object
diff --git a/src/lib/libcrypto/man/X509_ATTRIBUTE_new.3 b/src/lib/libcrypto/man/X509_ATTRIBUTE_new.3
index cc2b27d4c0..63a5c58169 100644
--- a/src/lib/libcrypto/man/X509_ATTRIBUTE_new.3
+++ b/src/lib/libcrypto/man/X509_ATTRIBUTE_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_ATTRIBUTE_new.3,v 1.18 2024/09/02 07:57:27 tb Exp $ 1.\" $OpenBSD: X509_ATTRIBUTE_new.3,v 1.19 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016, 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016, 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: September 2 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_ATTRIBUTE_NEW 3 18.Dt X509_ATTRIBUTE_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -27,6 +27,7 @@
27.\" The type is called "Attribute" with capital "A", not "attribute". 27.\" The type is called "Attribute" with capital "A", not "attribute".
28.Nd generic X.501 Attribute 28.Nd generic X.501 Attribute
29.Sh SYNOPSIS 29.Sh SYNOPSIS
30.Lb libcrypto
30.In openssl/x509.h 31.In openssl/x509.h
31.Ft X509_ATTRIBUTE * 32.Ft X509_ATTRIBUTE *
32.Fn X509_ATTRIBUTE_new void 33.Fn X509_ATTRIBUTE_new void
diff --git a/src/lib/libcrypto/man/X509_ATTRIBUTE_set1_object.3 b/src/lib/libcrypto/man/X509_ATTRIBUTE_set1_object.3
index 3555d4b169..d26e7de473 100644
--- a/src/lib/libcrypto/man/X509_ATTRIBUTE_set1_object.3
+++ b/src/lib/libcrypto/man/X509_ATTRIBUTE_set1_object.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_ATTRIBUTE_set1_object.3,v 1.3 2021/11/26 13:48:21 jsg Exp $ 1.\" $OpenBSD: X509_ATTRIBUTE_set1_object.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: November 26 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_ATTRIBUTE_SET1_OBJECT 3 18.Dt X509_ATTRIBUTE_SET1_OBJECT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -28,6 +28,7 @@
28.\" The type is called "Attribute" with capital "A", not "attribute". 28.\" The type is called "Attribute" with capital "A", not "attribute".
29.Nd modify an X.501 Attribute 29.Nd modify an X.501 Attribute
30.Sh SYNOPSIS 30.Sh SYNOPSIS
31.Lb libcrypto
31.In openssl/x509.h 32.In openssl/x509.h
32.Ft int 33.Ft int
33.Fo X509_ATTRIBUTE_set1_object 34.Fo X509_ATTRIBUTE_set1_object
diff --git a/src/lib/libcrypto/man/X509_CINF_new.3 b/src/lib/libcrypto/man/X509_CINF_new.3
index 6c09c58545..62399c07f7 100644
--- a/src/lib/libcrypto/man/X509_CINF_new.3
+++ b/src/lib/libcrypto/man/X509_CINF_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_CINF_new.3,v 1.11 2024/09/02 08:04:32 tb Exp $ 1.\" $OpenBSD: X509_CINF_new.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: September 2 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_CINF_NEW 3 18.Dt X509_CINF_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -26,6 +26,7 @@
26.Nm X509_CERT_AUX_free 26.Nm X509_CERT_AUX_free
27.Nd X.509 certificate information objects 27.Nd X.509 certificate information objects
28.Sh SYNOPSIS 28.Sh SYNOPSIS
29.Lb libcrypto
29.In openssl/x509.h 30.In openssl/x509.h
30.Ft X509_CINF * 31.Ft X509_CINF *
31.Fn X509_CINF_new void 32.Fn X509_CINF_new void
diff --git a/src/lib/libcrypto/man/X509_CRL_get0_by_serial.3 b/src/lib/libcrypto/man/X509_CRL_get0_by_serial.3
index f5edee6085..5a7d57c3f5 100644
--- a/src/lib/libcrypto/man/X509_CRL_get0_by_serial.3
+++ b/src/lib/libcrypto/man/X509_CRL_get0_by_serial.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_CRL_get0_by_serial.3,v 1.13 2024/03/06 02:34:14 tb Exp $ 1.\" $OpenBSD: X509_CRL_get0_by_serial.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL cdd6c8c5 Mar 20 12:29:37 2017 +0100 2.\" full merge up to: OpenSSL cdd6c8c5 Mar 20 12:29:37 2017 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 6 2024 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt X509_CRL_GET0_BY_SERIAL 3 52.Dt X509_CRL_GET0_BY_SERIAL 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -59,6 +59,7 @@
59.Nm X509_CRL_sort 59.Nm X509_CRL_sort
60.Nd add, sort, and retrieve CRL entries 60.Nd add, sort, and retrieve CRL entries
61.Sh SYNOPSIS 61.Sh SYNOPSIS
62.Lb libcrypto
62.In openssl/x509.h 63.In openssl/x509.h
63.Ft int 64.Ft int
64.Fo X509_CRL_get0_by_serial 65.Fo X509_CRL_get0_by_serial
diff --git a/src/lib/libcrypto/man/X509_CRL_new.3 b/src/lib/libcrypto/man/X509_CRL_new.3
index f9355fcfd3..36a6439269 100644
--- a/src/lib/libcrypto/man/X509_CRL_new.3
+++ b/src/lib/libcrypto/man/X509_CRL_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_CRL_new.3,v 1.14 2024/03/06 02:34:14 tb Exp $ 1.\" $OpenBSD: X509_CRL_new.3,v 1.15 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016, 2018, 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016, 2018, 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 6 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_CRL_NEW 3 18.Dt X509_CRL_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -26,6 +26,7 @@
26.Nm X509_CRL_INFO_free 26.Nm X509_CRL_INFO_free
27.Nd X.509 certificate revocation lists 27.Nd X.509 certificate revocation lists
28.Sh SYNOPSIS 28.Sh SYNOPSIS
29.Lb libcrypto
29.In openssl/x509.h 30.In openssl/x509.h
30.Ft X509_CRL * 31.Ft X509_CRL *
31.Fn X509_CRL_new void 32.Fn X509_CRL_new void
diff --git a/src/lib/libcrypto/man/X509_CRL_print.3 b/src/lib/libcrypto/man/X509_CRL_print.3
index 2f4832f0e7..1f1d278968 100644
--- a/src/lib/libcrypto/man/X509_CRL_print.3
+++ b/src/lib/libcrypto/man/X509_CRL_print.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_CRL_print.3,v 1.1 2021/07/19 13:16:43 schwarze Exp $ 1.\" $OpenBSD: X509_CRL_print.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: July 19 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_CRL_PRINT 3 18.Dt X509_CRL_PRINT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm X509_CRL_print_fp 22.Nm X509_CRL_print_fp
23.Nd pretty-print a certificate revocation list 23.Nd pretty-print a certificate revocation list
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/x509.h 26.In openssl/x509.h
26.Ft int 27.Ft int
27.Fo X509_CRL_print 28.Fo X509_CRL_print
diff --git a/src/lib/libcrypto/man/X509_EXTENSION_set_object.3 b/src/lib/libcrypto/man/X509_EXTENSION_set_object.3
index 45cf0dbaa5..f1356c350b 100644
--- a/src/lib/libcrypto/man/X509_EXTENSION_set_object.3
+++ b/src/lib/libcrypto/man/X509_EXTENSION_set_object.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_EXTENSION_set_object.3,v 1.19 2024/12/28 11:04:09 schwarze Exp $ 1.\" $OpenBSD: X509_EXTENSION_set_object.3,v 1.20 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: December 28 2024 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt X509_EXTENSION_SET_OBJECT 3 69.Dt X509_EXTENSION_SET_OBJECT 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -85,6 +85,7 @@
85.\" The ASN.1 structure is called "Extension", not "extension". 85.\" The ASN.1 structure is called "Extension", not "extension".
86.Nd create, change, and inspect X.509 Extension objects 86.Nd create, change, and inspect X.509 Extension objects
87.Sh SYNOPSIS 87.Sh SYNOPSIS
88.Lb libcrypto
88.In openssl/x509.h 89.In openssl/x509.h
89.Ft X509_EXTENSION * 90.Ft X509_EXTENSION *
90.Fn X509_EXTENSION_new void 91.Fn X509_EXTENSION_new void
diff --git a/src/lib/libcrypto/man/X509_INFO_new.3 b/src/lib/libcrypto/man/X509_INFO_new.3
index 1e9bb832f3..38bf6fe55c 100644
--- a/src/lib/libcrypto/man/X509_INFO_new.3
+++ b/src/lib/libcrypto/man/X509_INFO_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_INFO_new.3,v 1.3 2021/10/19 10:39:33 schwarze Exp $ 1.\" $OpenBSD: X509_INFO_new.3,v 1.5 2025/07/16 17:59:10 schwarze Exp $
2.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> 2.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org>
3.\" 3.\"
4.\" Permission to use, copy, modify, and distribute this software for any 4.\" Permission to use, copy, modify, and distribute this software for any
@@ -13,7 +13,7 @@
13.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15.\" 15.\"
16.Dd $Mdocdate: October 19 2021 $ 16.Dd $Mdocdate: July 16 2025 $
17.Dt X509_INFO_NEW 3 17.Dt X509_INFO_NEW 3
18.Os 18.Os
19.Sh NAME 19.Sh NAME
@@ -21,6 +21,7 @@
21.Nm X509_INFO_free 21.Nm X509_INFO_free
22.Nd X.509 certificate wrapper object 22.Nd X.509 certificate wrapper object
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
24.In openssl/x509.h 25.In openssl/x509.h
25.Ft X509_INFO * 26.Ft X509_INFO *
26.Fn X509_INFO_new void 27.Fn X509_INFO_new void
@@ -60,10 +61,9 @@ object or
60.Dv NULL 61.Dv NULL
61if an error occurs. 62if an error occurs.
62.Sh SEE ALSO 63.Sh SEE ALSO
63.Xr PEM_X509_INFO_read 3 , 64.Xr PEM_X509_INFO_read_bio 3 ,
64.Xr X509_CRL_new 3 , 65.Xr X509_CRL_new 3 ,
65.Xr X509_new 3 , 66.Xr X509_new 3
66.Xr X509_PKEY_new 3
67.Sh HISTORY 67.Sh HISTORY
68.Fn X509_INFO_new 68.Fn X509_INFO_new
69and 69and
diff --git a/src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3 b/src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3
index 5980f8f80d..74e3aaed3c 100644
--- a/src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3
+++ b/src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_LOOKUP_hash_dir.3,v 1.13 2024/09/02 07:20:21 tb Exp $ 1.\" $OpenBSD: X509_LOOKUP_hash_dir.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 2.\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800
3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
4.\" 4.\"
@@ -67,7 +67,7 @@
67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
69.\" 69.\"
70.Dd $Mdocdate: September 2 2024 $ 70.Dd $Mdocdate: June 8 2025 $
71.Dt X509_LOOKUP_HASH_DIR 3 71.Dt X509_LOOKUP_HASH_DIR 3
72.Os 72.Os
73.Sh NAME 73.Sh NAME
@@ -76,6 +76,7 @@
76.Nm X509_LOOKUP_mem 76.Nm X509_LOOKUP_mem
77.Nd certificate lookup methods 77.Nd certificate lookup methods
78.Sh SYNOPSIS 78.Sh SYNOPSIS
79.Lb libcrypto
79.In openssl/x509_vfy.h 80.In openssl/x509_vfy.h
80.Ft const X509_LOOKUP_METHOD * 81.Ft const X509_LOOKUP_METHOD *
81.Fn X509_LOOKUP_hash_dir void 82.Fn X509_LOOKUP_hash_dir void
diff --git a/src/lib/libcrypto/man/X509_LOOKUP_new.3 b/src/lib/libcrypto/man/X509_LOOKUP_new.3
index 559dbbb594..5fa9f99d7c 100644
--- a/src/lib/libcrypto/man/X509_LOOKUP_new.3
+++ b/src/lib/libcrypto/man/X509_LOOKUP_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_LOOKUP_new.3,v 1.12 2024/09/06 07:48:20 tb Exp $ 1.\" $OpenBSD: X509_LOOKUP_new.3,v 1.13 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: September 6 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_LOOKUP_NEW 3 18.Dt X509_LOOKUP_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -32,6 +32,7 @@
32.\" and because it doesn't do much in the first place. 32.\" and because it doesn't do much in the first place.
33.Nd certificate lookup object 33.Nd certificate lookup object
34.Sh SYNOPSIS 34.Sh SYNOPSIS
35.Lb libcrypto
35.In openssl/x509_vfy.h 36.In openssl/x509_vfy.h
36.Ft void 37.Ft void
37.Fn X509_LOOKUP_free "X509_LOOKUP *lookup" 38.Fn X509_LOOKUP_free "X509_LOOKUP *lookup"
diff --git a/src/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 b/src/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3
index 2eadec7b4d..ac6d590c5f 100644
--- a/src/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3
+++ b/src/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_NAME_ENTRY_get_object.3,v 1.16 2021/12/10 16:58:20 schwarze Exp $ 1.\" $OpenBSD: X509_NAME_ENTRY_get_object.3,v 1.17 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400 2.\" full merge up to: OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400
3.\" selective merge up to: OpenSSL ca34e08d Dec 12 07:38:07 2018 +0100 3.\" selective merge up to: OpenSSL ca34e08d Dec 12 07:38:07 2018 +0100
4.\" 4.\"
@@ -67,7 +67,7 @@
67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
69.\" 69.\"
70.Dd $Mdocdate: December 10 2021 $ 70.Dd $Mdocdate: June 8 2025 $
71.Dt X509_NAME_ENTRY_GET_OBJECT 3 71.Dt X509_NAME_ENTRY_GET_OBJECT 3
72.Os 72.Os
73.Sh NAME 73.Sh NAME
@@ -85,6 +85,7 @@
85.\" This object defined in X.501, not in X.509. 85.\" This object defined in X.501, not in X.509.
86.Nd X.501 relative distinguished name 86.Nd X.501 relative distinguished name
87.Sh SYNOPSIS 87.Sh SYNOPSIS
88.Lb libcrypto
88.In openssl/x509.h 89.In openssl/x509.h
89.Ft X509_NAME_ENTRY * 90.Ft X509_NAME_ENTRY *
90.Fn X509_NAME_ENTRY_new void 91.Fn X509_NAME_ENTRY_new void
diff --git a/src/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 b/src/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3
index 3c1237d20e..30cc3bccb1 100644
--- a/src/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3
+++ b/src/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_NAME_add_entry_by_txt.3,v 1.16 2022/03/31 17:27:17 naddy Exp $ 1.\" $OpenBSD: X509_NAME_add_entry_by_txt.3,v 1.17 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400 2.\" OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: March 31 2022 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt X509_NAME_ADD_ENTRY_BY_TXT 3 53.Dt X509_NAME_ADD_ENTRY_BY_TXT 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -60,6 +60,7 @@
60.Nm X509_NAME_delete_entry 60.Nm X509_NAME_delete_entry
61.Nd X509_NAME modification functions 61.Nd X509_NAME modification functions
62.Sh SYNOPSIS 62.Sh SYNOPSIS
63.Lb libcrypto
63.In openssl/x509.h 64.In openssl/x509.h
64.Ft int 65.Ft int
65.Fo X509_NAME_add_entry_by_txt 66.Fo X509_NAME_add_entry_by_txt
diff --git a/src/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 b/src/lib/libcrypto/man/X509_NAME_get_index_by_NID.3
index a2ceb10eb5..57dd488181 100644
--- a/src/lib/libcrypto/man/X509_NAME_get_index_by_NID.3
+++ b/src/lib/libcrypto/man/X509_NAME_get_index_by_NID.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_NAME_get_index_by_NID.3,v 1.16 2023/05/29 11:54:50 beck Exp $ 1.\" $OpenBSD: X509_NAME_get_index_by_NID.3,v 1.17 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400 2.\" OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: May 29 2023 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt X509_NAME_GET_INDEX_BY_NID 3 53.Dt X509_NAME_GET_INDEX_BY_NID 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -61,6 +61,7 @@
61.Nm X509_NAME_get_text_by_OBJ 61.Nm X509_NAME_get_text_by_OBJ
62.Nd X509_NAME lookup and enumeration functions 62.Nd X509_NAME lookup and enumeration functions
63.Sh SYNOPSIS 63.Sh SYNOPSIS
64.Lb libcrypto
64.In openssl/x509.h 65.In openssl/x509.h
65.Ft int 66.Ft int
66.Fo X509_NAME_get_index_by_NID 67.Fo X509_NAME_get_index_by_NID
diff --git a/src/lib/libcrypto/man/X509_NAME_hash.3 b/src/lib/libcrypto/man/X509_NAME_hash.3
index 8766109525..2e03f41ed2 100644
--- a/src/lib/libcrypto/man/X509_NAME_hash.3
+++ b/src/lib/libcrypto/man/X509_NAME_hash.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_NAME_hash.3,v 1.3 2021/07/31 14:54:33 schwarze Exp $ 1.\" $OpenBSD: X509_NAME_hash.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2017, 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2017, 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: July 31 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_NAME_HASH 3 18.Dt X509_NAME_HASH 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -31,6 +31,7 @@
31.\" The type is called "Name" with capital "N", not "name". 31.\" The type is called "Name" with capital "N", not "name".
32.Nd calculate SHA-1 or MD5 hashes of X.501 Name objects 32.Nd calculate SHA-1 or MD5 hashes of X.501 Name objects
33.Sh SYNOPSIS 33.Sh SYNOPSIS
34.Lb libcrypto
34.In openssl/x509.h 35.In openssl/x509.h
35.Ft unsigned long 36.Ft unsigned long
36.Fn X509_NAME_hash "X509_NAME *name" 37.Fn X509_NAME_hash "X509_NAME *name"
@@ -86,7 +87,7 @@ rather than an ASCII rendering in SSLeay 0.9.0 and have all been
86available since 87available since
87.Ox 2.4 . 88.Ox 2.4 .
88.Pp 89.Pp
89They were switched to using SHA1 instead of MD5 in OpenSSL 1.0.0 and in 90They were switched to using SHA-1 instead of MD5 in OpenSSL 1.0.0 and in
90.Ox 4.9 . 91.Ox 4.9 .
91.Pp 92.Pp
92.Fn X509_NAME_hash_old , 93.Fn X509_NAME_hash_old ,
diff --git a/src/lib/libcrypto/man/X509_NAME_new.3 b/src/lib/libcrypto/man/X509_NAME_new.3
index 3a4786a9ae..279df816fe 100644
--- a/src/lib/libcrypto/man/X509_NAME_new.3
+++ b/src/lib/libcrypto/man/X509_NAME_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_NAME_new.3,v 1.9 2021/07/20 17:31:32 schwarze Exp $ 1.\" $OpenBSD: X509_NAME_new.3,v 1.10 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: July 20 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_NAME_NEW 3 18.Dt X509_NAME_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -25,6 +25,7 @@
25.\" The type in called "Name" with capital "N", not "name". 25.\" The type in called "Name" with capital "N", not "name".
26.Nd X.501 Name object 26.Nd X.501 Name object
27.Sh SYNOPSIS 27.Sh SYNOPSIS
28.Lb libcrypto
28.In openssl/x509.h 29.In openssl/x509.h
29.Ft X509_NAME * 30.Ft X509_NAME *
30.Fn X509_NAME_new void 31.Fn X509_NAME_new void
diff --git a/src/lib/libcrypto/man/X509_NAME_print_ex.3 b/src/lib/libcrypto/man/X509_NAME_print_ex.3
index fc06a717cc..845428b3fb 100644
--- a/src/lib/libcrypto/man/X509_NAME_print_ex.3
+++ b/src/lib/libcrypto/man/X509_NAME_print_ex.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_NAME_print_ex.3,v 1.17 2025/03/09 16:45:31 tb Exp $ 1.\" $OpenBSD: X509_NAME_print_ex.3,v 1.18 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400 2.\" full merge up to: OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400
3.\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 3.\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800
4.\" 4.\"
@@ -50,7 +50,7 @@
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\" 52.\"
53.Dd $Mdocdate: March 9 2025 $ 53.Dd $Mdocdate: June 8 2025 $
54.Dt X509_NAME_PRINT_EX 3 54.Dt X509_NAME_PRINT_EX 3
55.Os 55.Os
56.Sh NAME 56.Sh NAME
@@ -59,6 +59,7 @@
59.Nm X509_NAME_oneline 59.Nm X509_NAME_oneline
60.Nd X509_NAME printing routines 60.Nd X509_NAME printing routines
61.Sh SYNOPSIS 61.Sh SYNOPSIS
62.Lb libcrypto
62.In openssl/x509.h 63.In openssl/x509.h
63.Ft int 64.Ft int
64.Fo X509_NAME_print_ex 65.Fo X509_NAME_print_ex
diff --git a/src/lib/libcrypto/man/X509_OBJECT_get0_X509.3 b/src/lib/libcrypto/man/X509_OBJECT_get0_X509.3
index 56b3926a8b..1b0de39265 100644
--- a/src/lib/libcrypto/man/X509_OBJECT_get0_X509.3
+++ b/src/lib/libcrypto/man/X509_OBJECT_get0_X509.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_OBJECT_get0_X509.3,v 1.16 2025/03/08 17:02:59 tb Exp $ 1.\" $OpenBSD: X509_OBJECT_get0_X509.3,v 1.17 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2018, 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2018, 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 8 2025 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_OBJECT_GET0_X509 3 18.Dt X509_OBJECT_GET0_X509 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -28,6 +28,7 @@
28.Nm X509_OBJECT_retrieve_match 28.Nm X509_OBJECT_retrieve_match
29.Nd certificate, CRL, private key, and string wrapper for certificate stores 29.Nd certificate, CRL, private key, and string wrapper for certificate stores
30.Sh SYNOPSIS 30.Sh SYNOPSIS
31.Lb libcrypto
31.In openssl/x509_vfy.h 32.In openssl/x509_vfy.h
32.Ft X509_LOOKUP_TYPE 33.Ft X509_LOOKUP_TYPE
33.Fo X509_OBJECT_get_type 34.Fo X509_OBJECT_get_type
diff --git a/src/lib/libcrypto/man/X509_PKEY_new.3 b/src/lib/libcrypto/man/X509_PKEY_new.3
deleted file mode 100644
index 253b0f6db5..0000000000
--- a/src/lib/libcrypto/man/X509_PKEY_new.3
+++ /dev/null
@@ -1,92 +0,0 @@
1.\" $OpenBSD: X509_PKEY_new.3,v 1.1 2021/10/19 10:39:33 schwarze Exp $
2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: October 19 2021 $
18.Dt X509_PKEY_NEW 3
19.Os
20.Sh NAME
21.Nm X509_PKEY_new ,
22.Nm X509_PKEY_free
23.Nd X.509 private key wrapper object
24.Sh SYNOPSIS
25.In openssl/x509.h
26.Ft X509_PKEY *
27.Fn X509_PKEY_new void
28.Ft void
29.Fn X509_PKEY_free "X509_PKEY *wrapper"
30.Sh DESCRIPTION
31.Vt X509_PKEY
32is a reference-counted wrapper object that can store
33.Bl -bullet -width 1n
34.It
35a pointer to an encrypted and ASN.1-encoded private key
36.It
37a pointer to an
38.Vt EVP_PKEY
39object representing the same key in decrypted form
40.It
41a pointer to an
42.Vt X509_ALGOR
43object identifying the algorithm used by the key
44.El
45.Pp
46The object may contain only the encrypted key or only the decrypted
47key or both.
48.Pp
49.Vt X509_PKEY
50is used as a sub-object of the
51.Vt X509_INFO
52object created by
53.Xr PEM_X509_INFO_read_bio 3
54if the PEM file contains any RSA, DSA, or EC PRIVATE KEY object.
55.Pp
56.Fn X509_PKEY_new
57allocates and initializes an empty
58.Vt X509_PKEY
59object and sets its reference count to 1.
60.Pp
61.Fn X509_PKEY_free
62decrements the reference count of the
63.Fa wrapper
64object by 1.
65If the reference count reaches 0,
66it frees all internal objects allocated by the
67.Fa wrapper
68as well as the storage needed for the
69.Fa wrapper
70object itself.
71If
72.Fa wrapper
73is a
74.Dv NULL
75pointer, no action occurs.
76.Sh RETURN VALUES
77.Fn X509_PKEY_new
78returns a pointer to the new
79.Vt X509_PKEY
80object or
81.Dv NULL
82if memory allocation fails.
83.Sh SEE ALSO
84.Xr EVP_PKEY_new 3 ,
85.Xr PEM_X509_INFO_read 3 ,
86.Xr X509_INFO_new 3
87.Sh HISTORY
88.Fn X509_PKEY_new
89and
90.Fn X509_PKEY_free
91first appeared in SSLeay 0.6.0 and have been available since
92.Ox 2.4 .
diff --git a/src/lib/libcrypto/man/X509_PUBKEY_new.3 b/src/lib/libcrypto/man/X509_PUBKEY_new.3
index df1c50bda2..1ef1afbc34 100644
--- a/src/lib/libcrypto/man/X509_PUBKEY_new.3
+++ b/src/lib/libcrypto/man/X509_PUBKEY_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_PUBKEY_new.3,v 1.18 2024/12/06 12:51:13 schwarze Exp $ 1.\" $OpenBSD: X509_PUBKEY_new.3,v 1.19 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: December 6 2024 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt X509_PUBKEY_NEW 3 69.Dt X509_PUBKEY_NEW 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -86,6 +86,7 @@
86.Nm X509_PUBKEY_get0_param 86.Nm X509_PUBKEY_get0_param
87.Nd X.509 SubjectPublicKeyInfo structure 87.Nd X.509 SubjectPublicKeyInfo structure
88.Sh SYNOPSIS 88.Sh SYNOPSIS
89.Lb libcrypto
89.In openssl/x509.h 90.In openssl/x509.h
90.Ft X509_PUBKEY * 91.Ft X509_PUBKEY *
91.Fn X509_PUBKEY_new void 92.Fn X509_PUBKEY_new void
diff --git a/src/lib/libcrypto/man/X509_PURPOSE_set.3 b/src/lib/libcrypto/man/X509_PURPOSE_set.3
index 1f723e9b9f..cb955f392c 100644
--- a/src/lib/libcrypto/man/X509_PURPOSE_set.3
+++ b/src/lib/libcrypto/man/X509_PURPOSE_set.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_PURPOSE_set.3,v 1.1 2021/07/23 14:27:32 schwarze Exp $ 1.\" $OpenBSD: X509_PURPOSE_set.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: July 23 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_PURPOSE_SET 3 18.Dt X509_PURPOSE_SET 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -31,6 +31,7 @@
31.Nm X509_PURPOSE_get_trust 31.Nm X509_PURPOSE_get_trust
32.Nd purpose objects, indices, and identifiers 32.Nd purpose objects, indices, and identifiers
33.Sh SYNOPSIS 33.Sh SYNOPSIS
34.Lb libcrypto
34.In openssl/x509v3.h 35.In openssl/x509v3.h
35.Ft int 36.Ft int
36.Fo X509_PURPOSE_set 37.Fo X509_PURPOSE_set
diff --git a/src/lib/libcrypto/man/X509_REQ_add1_attr.3 b/src/lib/libcrypto/man/X509_REQ_add1_attr.3
index f9b602dbef..6beb024039 100644
--- a/src/lib/libcrypto/man/X509_REQ_add1_attr.3
+++ b/src/lib/libcrypto/man/X509_REQ_add1_attr.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_REQ_add1_attr.3,v 1.4 2024/09/02 07:56:28 tb Exp $ 1.\" $OpenBSD: X509_REQ_add1_attr.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: September 2 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_REQ_ADD1_ATTR 3 18.Dt X509_REQ_ADD1_ATTR 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -29,6 +29,7 @@
29.Nm X509_REQ_get_attr_by_NID 29.Nm X509_REQ_get_attr_by_NID
30.Nd X.501 Attributes of PKCS#10 certification requests 30.Nd X.501 Attributes of PKCS#10 certification requests
31.Sh SYNOPSIS 31.Sh SYNOPSIS
32.Lb libcrypto
32.In openssl/x509.h 33.In openssl/x509.h
33.Ft int 34.Ft int
34.Fo X509_REQ_add1_attr 35.Fo X509_REQ_add1_attr
diff --git a/src/lib/libcrypto/man/X509_REQ_add_extensions.3 b/src/lib/libcrypto/man/X509_REQ_add_extensions.3
index ff33edf474..804e787947 100644
--- a/src/lib/libcrypto/man/X509_REQ_add_extensions.3
+++ b/src/lib/libcrypto/man/X509_REQ_add_extensions.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_REQ_add_extensions.3,v 1.2 2024/08/18 11:04:55 tb Exp $ 1.\" $OpenBSD: X509_REQ_add_extensions.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: August 18 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_REQ_ADD_EXTENSIONS 3 18.Dt X509_REQ_ADD_EXTENSIONS 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -24,6 +24,7 @@
24.Nm X509_REQ_extension_nid 24.Nm X509_REQ_extension_nid
25.Nd extensions in certification requests 25.Nd extensions in certification requests
26.Sh SYNOPSIS 26.Sh SYNOPSIS
27.Lb libcrypto
27.In openssl/x509.h 28.In openssl/x509.h
28.Ft int 29.Ft int
29.Fo X509_REQ_add_extensions 30.Fo X509_REQ_add_extensions
diff --git a/src/lib/libcrypto/man/X509_REQ_new.3 b/src/lib/libcrypto/man/X509_REQ_new.3
index 0a5828d5d4..a62f2c3acb 100644
--- a/src/lib/libcrypto/man/X509_REQ_new.3
+++ b/src/lib/libcrypto/man/X509_REQ_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_REQ_new.3,v 1.11 2021/10/29 09:42:07 schwarze Exp $ 1.\" $OpenBSD: X509_REQ_new.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016, 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016, 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: October 29 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_REQ_NEW 3 18.Dt X509_REQ_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -26,6 +26,7 @@
26.Nm X509_REQ_INFO_free 26.Nm X509_REQ_INFO_free
27.Nd PKCS#10 certification requests 27.Nd PKCS#10 certification requests
28.Sh SYNOPSIS 28.Sh SYNOPSIS
29.Lb libcrypto
29.In openssl/x509.h 30.In openssl/x509.h
30.Ft X509_REQ * 31.Ft X509_REQ *
31.Fn X509_REQ_new void 32.Fn X509_REQ_new void
diff --git a/src/lib/libcrypto/man/X509_REQ_print_ex.3 b/src/lib/libcrypto/man/X509_REQ_print_ex.3
index eee06abb21..8d87396b14 100644
--- a/src/lib/libcrypto/man/X509_REQ_print_ex.3
+++ b/src/lib/libcrypto/man/X509_REQ_print_ex.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_REQ_print_ex.3,v 1.3 2025/03/09 14:02:46 tb Exp $ 1.\" $OpenBSD: X509_REQ_print_ex.3,v 1.4 2025/06/08 22:30:52 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 9 2025 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_REQ_PRINT_EX 3 18.Dt X509_REQ_PRINT_EX 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -23,6 +23,8 @@
23.Nm X509_REQ_print_fp 23.Nm X509_REQ_print_fp
24.Nd pretty-print a PKCS#10 certification request 24.Nd pretty-print a PKCS#10 certification request
25.Sh SYNOPSIS 25.Sh SYNOPSIS
26.Lb libcrypto
27.In openssl/x509.h
26.Ft int 28.Ft int
27.Fo X509_REQ_print_ex 29.Fo X509_REQ_print_ex
28.Fa "BIO *bio" 30.Fa "BIO *bio"
diff --git a/src/lib/libcrypto/man/X509_REVOKED_new.3 b/src/lib/libcrypto/man/X509_REVOKED_new.3
index c1a50d1c9a..6dffcfd03e 100644
--- a/src/lib/libcrypto/man/X509_REVOKED_new.3
+++ b/src/lib/libcrypto/man/X509_REVOKED_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_REVOKED_new.3,v 1.12 2021/07/19 13:16:43 schwarze Exp $ 1.\" $OpenBSD: X509_REVOKED_new.3,v 1.13 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL man3/X509_CRL_get0_by_serial cdd6c8c5 Mar 20 12:29:37 2017 +0100 3.\" OpenSSL man3/X509_CRL_get0_by_serial cdd6c8c5 Mar 20 12:29:37 2017 +0100
4.\" 4.\"
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: July 19 2021 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt X509_REVOKED_NEW 3 70.Dt X509_REVOKED_NEW 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -79,6 +79,7 @@
79.Nm X509_REVOKED_set_revocationDate 79.Nm X509_REVOKED_set_revocationDate
80.Nd create, change, and inspect an X.509 CRL revoked entry 80.Nd create, change, and inspect an X.509 CRL revoked entry
81.Sh SYNOPSIS 81.Sh SYNOPSIS
82.Lb libcrypto
82.In openssl/x509.h 83.In openssl/x509.h
83.Ft X509_REVOKED * 84.Ft X509_REVOKED *
84.Fn X509_REVOKED_new void 85.Fn X509_REVOKED_new void
diff --git a/src/lib/libcrypto/man/X509_SIG_get0.3 b/src/lib/libcrypto/man/X509_SIG_get0.3
index 456261ca3f..339fcc0cf5 100644
--- a/src/lib/libcrypto/man/X509_SIG_get0.3
+++ b/src/lib/libcrypto/man/X509_SIG_get0.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_SIG_get0.3,v 1.1 2021/10/23 15:39:06 tb Exp $ 1.\" $OpenBSD: X509_SIG_get0.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 2.\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: October 23 2021 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt X509_SIG_GET0 3 53.Dt X509_SIG_GET0 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -57,6 +57,7 @@
57.Nm X509_SIG_getm 57.Nm X509_SIG_getm
58.Nd DigestInfo functions 58.Nd DigestInfo functions
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/x509.h 61.In openssl/x509.h
61.Ft void 62.Ft void
62.Fo X509_SIG_get0 63.Fo X509_SIG_get0
diff --git a/src/lib/libcrypto/man/X509_SIG_new.3 b/src/lib/libcrypto/man/X509_SIG_new.3
index 8e6b29dea5..8fafc00c98 100644
--- a/src/lib/libcrypto/man/X509_SIG_new.3
+++ b/src/lib/libcrypto/man/X509_SIG_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_SIG_new.3,v 1.5 2021/10/27 11:24:47 schwarze Exp $ 1.\" $OpenBSD: X509_SIG_new.3,v 1.6 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: October 27 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_SIG_NEW 3 18.Dt X509_SIG_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm X509_SIG_free 22.Nm X509_SIG_free
23.Nd PKCS#7 digest information 23.Nd PKCS#7 digest information
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/x509.h 26.In openssl/x509.h
26.Ft X509_SIG * 27.Ft X509_SIG *
27.Fn X509_SIG_new void 28.Fn X509_SIG_new void
diff --git a/src/lib/libcrypto/man/X509_STORE_CTX_get_error.3 b/src/lib/libcrypto/man/X509_STORE_CTX_get_error.3
index 1f221563cb..5eb2bfe8cb 100644
--- a/src/lib/libcrypto/man/X509_STORE_CTX_get_error.3
+++ b/src/lib/libcrypto/man/X509_STORE_CTX_get_error.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_STORE_CTX_get_error.3,v 1.28 2023/06/06 16:20:13 schwarze Exp $ 1.\" $OpenBSD: X509_STORE_CTX_get_error.3,v 1.29 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL man3/X509_STORE_CTX_get_error 24a535ea Sep 22 13:14:20 2020 +0100 3.\" OpenSSL man3/X509_STORE_CTX_get_error 24a535ea Sep 22 13:14:20 2020 +0100
4.\" OpenSSL man3/X509_STORE_CTX_new 24a535ea Sep 22 13:14:20 2020 +0100 4.\" OpenSSL man3/X509_STORE_CTX_new 24a535ea Sep 22 13:14:20 2020 +0100
@@ -68,7 +68,7 @@
68.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 68.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
69.\" OF THE POSSIBILITY OF SUCH DAMAGE. 69.\" OF THE POSSIBILITY OF SUCH DAMAGE.
70.\" 70.\"
71.Dd $Mdocdate: June 6 2023 $ 71.Dd $Mdocdate: June 8 2025 $
72.Dt X509_STORE_CTX_GET_ERROR 3 72.Dt X509_STORE_CTX_GET_ERROR 3
73.Os 73.Os
74.Sh NAME 74.Sh NAME
@@ -89,6 +89,7 @@
89.Nm X509_verify_cert_error_string 89.Nm X509_verify_cert_error_string
90.Nd get or set certificate verification status information 90.Nd get or set certificate verification status information
91.Sh SYNOPSIS 91.Sh SYNOPSIS
92.Lb libcrypto
92.In openssl/x509_vfy.h 93.In openssl/x509_vfy.h
93.Ft int 94.Ft int
94.Fo X509_STORE_CTX_get_error 95.Fo X509_STORE_CTX_get_error
diff --git a/src/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 b/src/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3
index bfec65a123..1c34efa947 100644
--- a/src/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3
+++ b/src/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_STORE_CTX_get_ex_new_index.3,v 1.6 2021/07/29 08:32:13 schwarze Exp $ 1.\" $OpenBSD: X509_STORE_CTX_get_ex_new_index.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 2.\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: July 29 2021 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt X509_STORE_CTX_GET_EX_NEW_INDEX 3 52.Dt X509_STORE_CTX_GET_EX_NEW_INDEX 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -59,6 +59,7 @@
59.Nm X509_STORE_CTX_get_app_data 59.Nm X509_STORE_CTX_get_app_data
60.Nd add application specific data to X509_STORE_CTX structures 60.Nd add application specific data to X509_STORE_CTX structures
61.Sh SYNOPSIS 61.Sh SYNOPSIS
62.Lb libcrypto
62.In openssl/x509_vfy.h 63.In openssl/x509_vfy.h
63.Ft int 64.Ft int
64.Fo X509_STORE_CTX_get_ex_new_index 65.Fo X509_STORE_CTX_get_ex_new_index
diff --git a/src/lib/libcrypto/man/X509_STORE_CTX_new.3 b/src/lib/libcrypto/man/X509_STORE_CTX_new.3
index 96af7a8afb..4c0f8c5857 100644
--- a/src/lib/libcrypto/man/X509_STORE_CTX_new.3
+++ b/src/lib/libcrypto/man/X509_STORE_CTX_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_STORE_CTX_new.3,v 1.27 2022/11/16 14:55:40 schwarze Exp $ 1.\" $OpenBSD: X509_STORE_CTX_new.3,v 1.28 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL aae41f8c Jun 25 09:47:15 2015 +0100 2.\" full merge up to: OpenSSL aae41f8c Jun 25 09:47:15 2015 +0100
3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
4.\" 4.\"
@@ -67,7 +67,7 @@
67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
69.\" 69.\"
70.Dd $Mdocdate: November 16 2022 $ 70.Dd $Mdocdate: June 8 2025 $
71.Dt X509_STORE_CTX_NEW 3 71.Dt X509_STORE_CTX_NEW 3
72.Os 72.Os
73.Sh NAME 73.Sh NAME
@@ -89,6 +89,7 @@
89.\" X509_STORE_CTX_set_verify moved to X509_STORE_CTX_set_verify(3) 89.\" X509_STORE_CTX_set_verify moved to X509_STORE_CTX_set_verify(3)
90.Nd X509_STORE_CTX initialisation 90.Nd X509_STORE_CTX initialisation
91.Sh SYNOPSIS 91.Sh SYNOPSIS
92.Lb libcrypto
92.In openssl/x509_vfy.h 93.In openssl/x509_vfy.h
93.Ft X509_STORE_CTX * 94.Ft X509_STORE_CTX *
94.Fn X509_STORE_CTX_new void 95.Fn X509_STORE_CTX_new void
diff --git a/src/lib/libcrypto/man/X509_STORE_CTX_set_flags.3 b/src/lib/libcrypto/man/X509_STORE_CTX_set_flags.3
index 04bb202bac..028d4da810 100644
--- a/src/lib/libcrypto/man/X509_STORE_CTX_set_flags.3
+++ b/src/lib/libcrypto/man/X509_STORE_CTX_set_flags.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_STORE_CTX_set_flags.3,v 1.8 2024/08/29 20:21:10 tb Exp $ 1.\" $OpenBSD: X509_STORE_CTX_set_flags.3,v 1.9 2025/06/08 22:37:23 schwarze Exp $
2.\" full merge up to: OpenSSL aae41f8c Jun 25 09:47:15 2015 +0100 2.\" full merge up to: OpenSSL aae41f8c Jun 25 09:47:15 2015 +0100
3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
4.\" 4.\"
@@ -67,7 +67,7 @@
67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
69.\" 69.\"
70.Dd $Mdocdate: August 29 2024 $ 70.Dd $Mdocdate: June 8 2025 $
71.Dt X509_STORE_CTX_SET_FLAGS 3 71.Dt X509_STORE_CTX_SET_FLAGS 3
72.Os 72.Os
73.Sh NAME 73.Sh NAME
@@ -76,13 +76,12 @@
76.Nm X509_STORE_CTX_set_depth , 76.Nm X509_STORE_CTX_set_depth ,
77.Nm X509_STORE_CTX_set_trust , 77.Nm X509_STORE_CTX_set_trust ,
78.Nm X509_STORE_CTX_set_purpose , 78.Nm X509_STORE_CTX_set_purpose ,
79.\" .Nm X509_STORE_CTX_purpose_inherit is intentionally undocumented
80.\" because it will be removed in the next major bump.
81.Nm X509_STORE_CTX_get0_param , 79.Nm X509_STORE_CTX_get0_param ,
82.Nm X509_STORE_CTX_set0_param , 80.Nm X509_STORE_CTX_set0_param ,
83.Nm X509_STORE_CTX_set_default 81.Nm X509_STORE_CTX_set_default
84.Nd X509_STORE_CTX parameter initialisation 82.Nd X509_STORE_CTX parameter initialisation
85.Sh SYNOPSIS 83.Sh SYNOPSIS
84.Lb libcrypto
86.In openssl/x509_vfy.h 85.In openssl/x509_vfy.h
87.Ft void 86.Ft void
88.Fo X509_STORE_CTX_set_flags 87.Fo X509_STORE_CTX_set_flags
diff --git a/src/lib/libcrypto/man/X509_STORE_CTX_set_verify.3 b/src/lib/libcrypto/man/X509_STORE_CTX_set_verify.3
index 8c27deea5d..4a319ed8bb 100644
--- a/src/lib/libcrypto/man/X509_STORE_CTX_set_verify.3
+++ b/src/lib/libcrypto/man/X509_STORE_CTX_set_verify.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_STORE_CTX_set_verify.3,v 1.8 2024/06/07 05:51:39 tb Exp $ 1.\" $OpenBSD: X509_STORE_CTX_set_verify.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021, 2022 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021, 2022 Ingo Schwarze <schwarze@openbsd.org>
4.\" Copyright (c) 2023 Job Snijders <job@openbsd.org> 4.\" Copyright (c) 2023 Job Snijders <job@openbsd.org>
@@ -15,7 +15,7 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 17.\"
18.Dd $Mdocdate: June 7 2024 $ 18.Dd $Mdocdate: June 8 2025 $
19.Dt X509_STORE_CTX_SET_VERIFY 3 19.Dt X509_STORE_CTX_SET_VERIFY 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
@@ -31,6 +31,7 @@
31.Nm X509_STORE_CTX_get_check_issued 31.Nm X509_STORE_CTX_get_check_issued
32.Nd user-defined certificate chain verification function 32.Nd user-defined certificate chain verification function
33.Sh SYNOPSIS 33.Sh SYNOPSIS
34.Lb libcrypto
34.In openssl/x509_vfy.h 35.In openssl/x509_vfy.h
35.Ft typedef int 36.Ft typedef int
36.Fo (*X509_STORE_CTX_verify_fn) 37.Fo (*X509_STORE_CTX_verify_fn)
diff --git a/src/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 b/src/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3
index 0fe086b721..29f1e79b62 100644
--- a/src/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3
+++ b/src/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_STORE_CTX_set_verify_cb.3,v 1.12 2023/05/30 07:37:34 op Exp $ 1.\" $OpenBSD: X509_STORE_CTX_set_verify_cb.3,v 1.13 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400 2.\" full merge up to: OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400
3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
4.\" 4.\"
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: May 30 2023 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt X509_STORE_CTX_SET_VERIFY_CB 3 70.Dt X509_STORE_CTX_SET_VERIFY_CB 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -75,6 +75,7 @@
75.Nm X509_STORE_CTX_get_verify_cb 75.Nm X509_STORE_CTX_get_verify_cb
76.Nd set and retrieve verification callback 76.Nd set and retrieve verification callback
77.Sh SYNOPSIS 77.Sh SYNOPSIS
78.Lb libcrypto
78.In openssl/x509_vfy.h 79.In openssl/x509_vfy.h
79.Ft typedef int 80.Ft typedef int
80.Fo (*X509_STORE_CTX_verify_cb) 81.Fo (*X509_STORE_CTX_verify_cb)
diff --git a/src/lib/libcrypto/man/X509_STORE_get_by_subject.3 b/src/lib/libcrypto/man/X509_STORE_get_by_subject.3
index 0f6fbd8410..a8379ad5cb 100644
--- a/src/lib/libcrypto/man/X509_STORE_get_by_subject.3
+++ b/src/lib/libcrypto/man/X509_STORE_get_by_subject.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_STORE_get_by_subject.3,v 1.6 2024/05/12 05:08:59 tb Exp $ 1.\" $OpenBSD: X509_STORE_get_by_subject.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021, 2023 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021, 2023 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: May 12 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_STORE_GET_BY_SUBJECT 3 18.Dt X509_STORE_GET_BY_SUBJECT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -28,6 +28,7 @@
28.Nm X509_STORE_get1_crls 28.Nm X509_STORE_get1_crls
29.Nd retrieve objects from a certificate store 29.Nd retrieve objects from a certificate store
30.Sh SYNOPSIS 30.Sh SYNOPSIS
31.Lb libcrypto
31.In openssl/x509_vfy.h 32.In openssl/x509_vfy.h
32.Ft int 33.Ft int
33.Fo X509_STORE_CTX_get_by_subject 34.Fo X509_STORE_CTX_get_by_subject
diff --git a/src/lib/libcrypto/man/X509_STORE_load_locations.3 b/src/lib/libcrypto/man/X509_STORE_load_locations.3
index a8177b0fd4..d876ef831a 100644
--- a/src/lib/libcrypto/man/X509_STORE_load_locations.3
+++ b/src/lib/libcrypto/man/X509_STORE_load_locations.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_STORE_load_locations.3,v 1.12 2024/09/02 07:20:21 tb Exp $ 1.\" $OpenBSD: X509_STORE_load_locations.3,v 1.13 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL X509_STORE_add_cert b0edda11 Mar 20 13:00:17 2018 +0000 3.\" OpenSSL X509_STORE_add_cert b0edda11 Mar 20 13:00:17 2018 +0000
4.\" 4.\"
@@ -16,7 +16,7 @@
16.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18.\" 18.\"
19.Dd $Mdocdate: September 2 2024 $ 19.Dd $Mdocdate: June 8 2025 $
20.Dt X509_STORE_LOAD_LOCATIONS 3 20.Dt X509_STORE_LOAD_LOCATIONS 3
21.Os 21.Os
22.Sh NAME 22.Sh NAME
@@ -26,6 +26,7 @@
26.Nm X509_STORE_add_lookup 26.Nm X509_STORE_add_lookup
27.Nd configure files and directories used by a certificate store 27.Nd configure files and directories used by a certificate store
28.Sh SYNOPSIS 28.Sh SYNOPSIS
29.Lb libcrypto
29.In openssl/x509_vfy.h 30.In openssl/x509_vfy.h
30.Ft int 31.Ft int
31.Fo X509_STORE_load_locations 32.Fo X509_STORE_load_locations
diff --git a/src/lib/libcrypto/man/X509_STORE_new.3 b/src/lib/libcrypto/man/X509_STORE_new.3
index a17da03a41..e1d146da43 100644
--- a/src/lib/libcrypto/man/X509_STORE_new.3
+++ b/src/lib/libcrypto/man/X509_STORE_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_STORE_new.3,v 1.7 2021/11/17 16:08:32 schwarze Exp $ 1.\" $OpenBSD: X509_STORE_new.3,v 1.8 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL 05ea606a May 20 20:52:46 2016 -0400 2.\" full merge up to: OpenSSL 05ea606a May 20 20:52:46 2016 -0400
3.\" selective merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 3.\" selective merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
4.\" 4.\"
@@ -67,7 +67,7 @@
67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
69.\" 69.\"
70.Dd $Mdocdate: November 17 2021 $ 70.Dd $Mdocdate: June 8 2025 $
71.Dt X509_STORE_NEW 3 71.Dt X509_STORE_NEW 3
72.Os 72.Os
73.Sh NAME 73.Sh NAME
@@ -76,6 +76,7 @@
76.Nm X509_STORE_free 76.Nm X509_STORE_free
77.Nd allocate and free X.509 certificate stores 77.Nd allocate and free X.509 certificate stores
78.Sh SYNOPSIS 78.Sh SYNOPSIS
79.Lb libcrypto
79.In openssl/x509_vfy.h 80.In openssl/x509_vfy.h
80.Ft X509_STORE * 81.Ft X509_STORE *
81.Fn X509_STORE_new void 82.Fn X509_STORE_new void
diff --git a/src/lib/libcrypto/man/X509_STORE_set1_param.3 b/src/lib/libcrypto/man/X509_STORE_set1_param.3
index 527fe652e5..d96a33a8fa 100644
--- a/src/lib/libcrypto/man/X509_STORE_set1_param.3
+++ b/src/lib/libcrypto/man/X509_STORE_set1_param.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_STORE_set1_param.3,v 1.22 2024/03/14 22:19:12 tb Exp $ 1.\" $OpenBSD: X509_STORE_set1_param.3,v 1.23 2025/06/08 22:40:30 schwarze Exp $
2.\" content checked up to: 2.\" content checked up to:
3.\" OpenSSL man3/X509_STORE_add_cert b0edda11 Mar 20 13:00:17 2018 +0000 3.\" OpenSSL man3/X509_STORE_add_cert b0edda11 Mar 20 13:00:17 2018 +0000
4.\" OpenSSL man3/X509_STORE_get0_param e90fc053 Jul 15 09:39:45 2017 -0400 4.\" OpenSSL man3/X509_STORE_get0_param e90fc053 Jul 15 09:39:45 2017 -0400
@@ -17,7 +17,7 @@
17.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19.\" 19.\"
20.Dd $Mdocdate: March 14 2024 $ 20.Dd $Mdocdate: June 8 2025 $
21.Dt X509_STORE_SET1_PARAM 3 21.Dt X509_STORE_SET1_PARAM 3
22.Os 22.Os
23.Sh NAME 23.Sh NAME
@@ -36,6 +36,7 @@
36.Nm X509_STORE_get_ex_data 36.Nm X509_STORE_get_ex_data
37.Nd get and set X509_STORE data 37.Nd get and set X509_STORE data
38.Sh SYNOPSIS 38.Sh SYNOPSIS
39.Lb libcrypto
39.In openssl/x509_vfy.h 40.In openssl/x509_vfy.h
40.Ft int 41.Ft int
41.Fo X509_STORE_set1_param 42.Fo X509_STORE_set1_param
diff --git a/src/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 b/src/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3
index bdd5ea5044..a09e6741a2 100644
--- a/src/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3
+++ b/src/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_STORE_set_verify_cb_func.3,v 1.12 2022/11/16 14:51:08 schwarze Exp $ 1.\" $OpenBSD: X509_STORE_set_verify_cb_func.3,v 1.13 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL 05ea606a May 20 20:52:46 2016 -0400 2.\" full merge up to: OpenSSL 05ea606a May 20 20:52:46 2016 -0400
3.\" selective merge up to: OpenSSL 315c47e0 Dec 1 14:22:16 2020 +0100 3.\" selective merge up to: OpenSSL 315c47e0 Dec 1 14:22:16 2020 +0100
4.\" 4.\"
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: November 16 2022 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt X509_STORE_SET_VERIFY_CB_FUNC 3 53.Dt X509_STORE_SET_VERIFY_CB_FUNC 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -58,6 +58,7 @@
58.Nm X509_STORE_get_verify_cb 58.Nm X509_STORE_get_verify_cb
59.Nd set verification callback 59.Nd set verification callback
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libcrypto
61.In openssl/x509_vfy.h 62.In openssl/x509_vfy.h
62.Ft void 63.Ft void
63.Fo X509_STORE_set_verify_cb 64.Fo X509_STORE_set_verify_cb
diff --git a/src/lib/libcrypto/man/X509_VERIFY_PARAM_new.3 b/src/lib/libcrypto/man/X509_VERIFY_PARAM_new.3
index a22d2b1b4b..333b3860e0 100644
--- a/src/lib/libcrypto/man/X509_VERIFY_PARAM_new.3
+++ b/src/lib/libcrypto/man/X509_VERIFY_PARAM_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_VERIFY_PARAM_new.3,v 1.5 2023/05/24 09:57:50 tb Exp $ 1.\" $OpenBSD: X509_VERIFY_PARAM_new.3,v 1.6 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2018, 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2018, 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: May 24 2023 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_VERIFY_PARAM_NEW 3 18.Dt X509_VERIFY_PARAM_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -38,6 +38,7 @@
38.\" X509_VP_FLAG_ONCE 38.\" X509_VP_FLAG_ONCE
39.Nd X509 verification parameter objects 39.Nd X509 verification parameter objects
40.Sh SYNOPSIS 40.Sh SYNOPSIS
41.Lb libcrypto
41.In openssl/x509_vfy.h 42.In openssl/x509_vfy.h
42.Ft X509_VERIFY_PARAM * 43.Ft X509_VERIFY_PARAM *
43.Fo X509_VERIFY_PARAM_new 44.Fo X509_VERIFY_PARAM_new
diff --git a/src/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 b/src/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3
index a0ae839f9a..e21d1122a9 100644
--- a/src/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3
+++ b/src/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_VERIFY_PARAM_set_flags.3,v 1.29 2023/04/30 19:40:23 tb Exp $ 1.\" $OpenBSD: X509_VERIFY_PARAM_set_flags.3,v 1.30 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL d33def66 Feb 9 14:17:13 2016 -0500 2.\" full merge up to: OpenSSL d33def66 Feb 9 14:17:13 2016 -0500
3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
4.\" 4.\"
@@ -68,7 +68,7 @@
68.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 68.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
69.\" OF THE POSSIBILITY OF SUCH DAMAGE. 69.\" OF THE POSSIBILITY OF SUCH DAMAGE.
70.\" 70.\"
71.Dd $Mdocdate: April 30 2023 $ 71.Dd $Mdocdate: June 8 2025 $
72.Dt X509_VERIFY_PARAM_SET_FLAGS 3 72.Dt X509_VERIFY_PARAM_SET_FLAGS 3
73.Os 73.Os
74.Sh NAME 74.Sh NAME
@@ -95,6 +95,7 @@
95.Nm X509_VERIFY_PARAM_set1_ip_asc 95.Nm X509_VERIFY_PARAM_set1_ip_asc
96.Nd X509 verification parameters 96.Nd X509 verification parameters
97.Sh SYNOPSIS 97.Sh SYNOPSIS
98.Lb libcrypto
98.In openssl/x509_vfy.h 99.In openssl/x509_vfy.h
99.Ft const char * 100.Ft const char *
100.Fo X509_VERIFY_PARAM_get0_name 101.Fo X509_VERIFY_PARAM_get0_name
diff --git a/src/lib/libcrypto/man/X509_add1_trust_object.3 b/src/lib/libcrypto/man/X509_add1_trust_object.3
index 067bf64464..e1ca67a8f3 100644
--- a/src/lib/libcrypto/man/X509_add1_trust_object.3
+++ b/src/lib/libcrypto/man/X509_add1_trust_object.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_add1_trust_object.3,v 1.4 2024/09/02 08:04:32 tb Exp $ 1.\" $OpenBSD: X509_add1_trust_object.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: September 2 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_ADD1_TRUST_OBJECT 3 18.Dt X509_ADD1_TRUST_OBJECT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -24,6 +24,7 @@
24.Nm X509_reject_clear 24.Nm X509_reject_clear
25.Nd mark an X.509 certificate as intended for a specific purpose 25.Nd mark an X.509 certificate as intended for a specific purpose
26.Sh SYNOPSIS 26.Sh SYNOPSIS
27.Lb libcrypto
27.In openssl/x509.h 28.In openssl/x509.h
28.Ft int 29.Ft int
29.Fo X509_add1_trust_object 30.Fo X509_add1_trust_object
diff --git a/src/lib/libcrypto/man/X509_check_ca.3 b/src/lib/libcrypto/man/X509_check_ca.3
index 114bac69e7..2aa496b6ff 100644
--- a/src/lib/libcrypto/man/X509_check_ca.3
+++ b/src/lib/libcrypto/man/X509_check_ca.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_check_ca.3,v 1.7 2022/05/10 19:44:29 tb Exp $ 1.\" $OpenBSD: X509_check_ca.3,v 1.8 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file was written by Victor B. Wagner <vitus@cryptocom.ru>. 4.\" This file was written by Victor B. Wagner <vitus@cryptocom.ru>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: May 10 2022 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt X509_CHECK_CA 3 52.Dt X509_CHECK_CA 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm X509_check_ca 55.Nm X509_check_ca
56.Nd check whether a certificate is a CA certificate 56.Nd check whether a certificate is a CA certificate
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/x509v3.h 59.In openssl/x509v3.h
59.Ft int 60.Ft int
60.Fo X509_check_ca 61.Fo X509_check_ca
diff --git a/src/lib/libcrypto/man/X509_check_host.3 b/src/lib/libcrypto/man/X509_check_host.3
index dbc56c0d21..be3190b2d2 100644
--- a/src/lib/libcrypto/man/X509_check_host.3
+++ b/src/lib/libcrypto/man/X509_check_host.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_check_host.3,v 1.6 2020/09/17 08:04:22 schwarze Exp $ 1.\" $OpenBSD: X509_check_host.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL a09e4d24 Jun 12 01:56:31 2014 -0400 2.\" full merge up to: OpenSSL a09e4d24 Jun 12 01:56:31 2014 -0400
3.\" selective merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200 3.\" selective merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200
4.\" 4.\"
@@ -51,7 +51,7 @@
51.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
52.\" OF THE POSSIBILITY OF SUCH DAMAGE. 52.\" OF THE POSSIBILITY OF SUCH DAMAGE.
53.\" 53.\"
54.Dd $Mdocdate: September 17 2020 $ 54.Dd $Mdocdate: June 8 2025 $
55.Dt X509_CHECK_HOST 3 55.Dt X509_CHECK_HOST 3
56.Os 56.Os
57.Sh NAME 57.Sh NAME
@@ -61,6 +61,7 @@
61.Nm X509_check_ip_asc 61.Nm X509_check_ip_asc
62.Nd X.509 certificate matching 62.Nd X.509 certificate matching
63.Sh SYNOPSIS 63.Sh SYNOPSIS
64.Lb libcrypto
64.In openssl/x509v3.h 65.In openssl/x509v3.h
65.Ft int 66.Ft int
66.Fo X509_check_host 67.Fo X509_check_host
diff --git a/src/lib/libcrypto/man/X509_check_issued.3 b/src/lib/libcrypto/man/X509_check_issued.3
index f8c2a5297a..24457674d5 100644
--- a/src/lib/libcrypto/man/X509_check_issued.3
+++ b/src/lib/libcrypto/man/X509_check_issued.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_check_issued.3,v 1.4 2019/06/06 01:06:59 schwarze Exp $ 1.\" $OpenBSD: X509_check_issued.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file was written by Victor B. Wagner <vitus@cryptocom.ru>. 4.\" This file was written by Victor B. Wagner <vitus@cryptocom.ru>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 6 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt X509_CHECK_ISSUED 3 52.Dt X509_CHECK_ISSUED 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm X509_check_issued 55.Nm X509_check_issued
56.Nd check whether a certificate was issued using a given CA certificate 56.Nd check whether a certificate was issued using a given CA certificate
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/x509v3.h 59.In openssl/x509v3.h
59.Ft int 60.Ft int
60.Fo X509_check_issued 61.Fo X509_check_issued
diff --git a/src/lib/libcrypto/man/X509_check_private_key.3 b/src/lib/libcrypto/man/X509_check_private_key.3
index 31df2126cc..61ff091728 100644
--- a/src/lib/libcrypto/man/X509_check_private_key.3
+++ b/src/lib/libcrypto/man/X509_check_private_key.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_check_private_key.3,v 1.6 2019/06/06 01:06:59 schwarze Exp $ 1.\" $OpenBSD: X509_check_private_key.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL X509_check_private_key.pod 09ddb878 Jun 5 03:56:07 2017 +0800 2.\" OpenSSL X509_check_private_key.pod 09ddb878 Jun 5 03:56:07 2017 +0800
3.\" 3.\"
4.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> 4.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,7 +15,7 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 17.\"
18.Dd $Mdocdate: June 6 2019 $ 18.Dd $Mdocdate: June 8 2025 $
19.Dt X509_CHECK_PRIVATE_KEY 3 19.Dt X509_CHECK_PRIVATE_KEY 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
@@ -23,6 +23,7 @@
23.Nm X509_REQ_check_private_key 23.Nm X509_REQ_check_private_key
24.Nd compare public key components 24.Nd compare public key components
25.Sh SYNOPSIS 25.Sh SYNOPSIS
26.Lb libcrypto
26.In openssl/x509.h 27.In openssl/x509.h
27.Ft int 28.Ft int
28.Fo X509_check_private_key 29.Fo X509_check_private_key
diff --git a/src/lib/libcrypto/man/X509_check_purpose.3 b/src/lib/libcrypto/man/X509_check_purpose.3
index 8fea6679fc..86ee53f559 100644
--- a/src/lib/libcrypto/man/X509_check_purpose.3
+++ b/src/lib/libcrypto/man/X509_check_purpose.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_check_purpose.3,v 1.12 2024/09/02 08:04:32 tb Exp $ 1.\" $OpenBSD: X509_check_purpose.3,v 1.13 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2019, 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2019, 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: September 2 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_CHECK_PURPOSE 3 18.Dt X509_CHECK_PURPOSE 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm X509_check_purpose 21.Nm X509_check_purpose
22.Nd check intended usage of a public key 22.Nd check intended usage of a public key
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
24.In openssl/x509v3.h 25.In openssl/x509v3.h
25.Ft int 26.Ft int
26.Fo X509_check_purpose 27.Fo X509_check_purpose
diff --git a/src/lib/libcrypto/man/X509_cmp.3 b/src/lib/libcrypto/man/X509_cmp.3
index b1cdec1773..e025f5c8c0 100644
--- a/src/lib/libcrypto/man/X509_cmp.3
+++ b/src/lib/libcrypto/man/X509_cmp.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_cmp.3,v 1.4 2024/06/07 14:00:09 job Exp $ 1.\" $OpenBSD: X509_cmp.3,v 1.5 2025/06/08 22:37:23 schwarze Exp $
2.\" full merge up to: OpenSSL ea5d4b89 Jun 6 11:42:02 2019 +0800 2.\" full merge up to: OpenSSL ea5d4b89 Jun 6 11:42:02 2019 +0800
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: June 7 2024 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt X509_CMP 3 69.Dt X509_CMP 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -79,10 +79,8 @@
79.Nm X509_CRL_cmp , 79.Nm X509_CRL_cmp ,
80.Nm X509_CRL_match 80.Nm X509_CRL_match
81.Nd compare X.509 certificates and related values 81.Nd compare X.509 certificates and related values
82.\" The function name_cmp() is intentionally undocumented.
83.\" It was a mistake to make it public in the first place,
84.\" and it is no longer part of the public API in OpenSSL 1.1.
85.Sh SYNOPSIS 82.Sh SYNOPSIS
83.Lb libcrypto
86.In openssl/x509.h 84.In openssl/x509.h
87.Ft int 85.Ft int
88.Fo X509_cmp 86.Fo X509_cmp
diff --git a/src/lib/libcrypto/man/X509_cmp_time.3 b/src/lib/libcrypto/man/X509_cmp_time.3
index bb430dfbb7..2ac584ad09 100644
--- a/src/lib/libcrypto/man/X509_cmp_time.3
+++ b/src/lib/libcrypto/man/X509_cmp_time.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_cmp_time.3,v 1.12 2024/03/05 18:30:40 tb Exp $ 1.\" $OpenBSD: X509_cmp_time.3,v 1.13 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 2.\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: March 5 2024 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt X509_CMP_TIME 3 69.Dt X509_CMP_TIME 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -76,6 +76,7 @@
76.Nm X509_gmtime_adj 76.Nm X509_gmtime_adj
77.Nd ASN.1 Time utilities 77.Nd ASN.1 Time utilities
78.Sh SYNOPSIS 78.Sh SYNOPSIS
79.Lb libcrypto
79.In openssl/x509.h 80.In openssl/x509.h
80.Ft int 81.Ft int
81.Fo X509_cmp_time 82.Fo X509_cmp_time
diff --git a/src/lib/libcrypto/man/X509_digest.3 b/src/lib/libcrypto/man/X509_digest.3
index 7627e07731..991d1990b2 100644
--- a/src/lib/libcrypto/man/X509_digest.3
+++ b/src/lib/libcrypto/man/X509_digest.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_digest.3,v 1.8 2019/08/20 13:27:19 schwarze Exp $ 1.\" $OpenBSD: X509_digest.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL 1212818e Sep 11 13:22:14 2018 +0100 2.\" full merge up to: OpenSSL 1212818e Sep 11 13:22:14 2018 +0100
3.\" 3.\"
4.\" This file was written by Rich Salz <rsalz@openssl.org> 4.\" This file was written by Rich Salz <rsalz@openssl.org>
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: August 20 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt X509_DIGEST 3 52.Dt X509_DIGEST 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -60,6 +60,7 @@
60.Nm PKCS7_ISSUER_AND_SERIAL_digest 60.Nm PKCS7_ISSUER_AND_SERIAL_digest
61.Nd get digests of various objects 61.Nd get digests of various objects
62.Sh SYNOPSIS 62.Sh SYNOPSIS
63.Lb libcrypto
63.In openssl/x509.h 64.In openssl/x509.h
64.Ft int 65.Ft int
65.Fo X509_digest 66.Fo X509_digest
diff --git a/src/lib/libcrypto/man/X509_find_by_subject.3 b/src/lib/libcrypto/man/X509_find_by_subject.3
index 98a76a1fca..962eb80854 100644
--- a/src/lib/libcrypto/man/X509_find_by_subject.3
+++ b/src/lib/libcrypto/man/X509_find_by_subject.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_find_by_subject.3,v 1.1 2021/07/04 12:56:27 schwarze Exp $ 1.\" $OpenBSD: X509_find_by_subject.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: July 4 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_FIND_BY_SUBJECT 3 18.Dt X509_FIND_BY_SUBJECT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm X509_find_by_issuer_and_serial 22.Nm X509_find_by_issuer_and_serial
23.Nd search an array of X.509 certificates 23.Nd search an array of X.509 certificates
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/x509.h 26.In openssl/x509.h
26.Ft X509 * 27.Ft X509 *
27.Fo X509_find_by_subject 28.Fo X509_find_by_subject
diff --git a/src/lib/libcrypto/man/X509_get0_notBefore.3 b/src/lib/libcrypto/man/X509_get0_notBefore.3
index 5e5c08b79a..5ac075fe31 100644
--- a/src/lib/libcrypto/man/X509_get0_notBefore.3
+++ b/src/lib/libcrypto/man/X509_get0_notBefore.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_get0_notBefore.3,v 1.7 2024/03/05 18:30:40 tb Exp $ 1.\" $OpenBSD: X509_get0_notBefore.3,v 1.8 2025/06/08 22:40:30 schwarze Exp $
2.\" content checked up to: OpenSSL 27b138e9 May 19 00:16:38 2017 +0000 2.\" content checked up to: OpenSSL 27b138e9 May 19 00:16:38 2017 +0000
3.\" 3.\"
4.\" Copyright (c) 2018, 2020 Ingo Schwarze <schwarze@openbsd.org> 4.\" Copyright (c) 2018, 2020 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,7 +15,7 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 17.\"
18.Dd $Mdocdate: March 5 2024 $ 18.Dd $Mdocdate: June 8 2025 $
19.Dt X509_GET0_NOTBEFORE 3 19.Dt X509_GET0_NOTBEFORE 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
@@ -39,6 +39,7 @@
39.Nm X509_CRL_set_nextUpdate 39.Nm X509_CRL_set_nextUpdate
40.Nd get and set certificate and CRL validity dates 40.Nd get and set certificate and CRL validity dates
41.Sh SYNOPSIS 41.Sh SYNOPSIS
42.Lb libcrypto
42.In openssl/x509.h 43.In openssl/x509.h
43.Ft const ASN1_TIME * 44.Ft const ASN1_TIME *
44.Fo X509_get0_notBefore 45.Fo X509_get0_notBefore
diff --git a/src/lib/libcrypto/man/X509_get0_signature.3 b/src/lib/libcrypto/man/X509_get0_signature.3
index dc3be2c70a..6cebb94e56 100644
--- a/src/lib/libcrypto/man/X509_get0_signature.3
+++ b/src/lib/libcrypto/man/X509_get0_signature.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_get0_signature.3,v 1.9 2024/08/28 07:18:55 tb Exp $ 1.\" $OpenBSD: X509_get0_signature.3,v 1.12 2025/07/06 09:32:08 tb Exp $
2.\" selective merge up to: 2.\" selective merge up to:
3.\" OpenSSL man3/X509_get0_signature 2f7a2520 Apr 25 17:28:08 2017 +0100 3.\" OpenSSL man3/X509_get0_signature 2f7a2520 Apr 25 17:28:08 2017 +0100
4.\" 4.\"
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: August 28 2024 $ 69.Dd $Mdocdate: July 6 2025 $
70.Dt X509_GET0_SIGNATURE 3 70.Dt X509_GET0_SIGNATURE 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -82,6 +82,7 @@
82.Nm X509_get_signature_info 82.Nm X509_get_signature_info
83.Nd signature information 83.Nd signature information
84.Sh SYNOPSIS 84.Sh SYNOPSIS
85.Lb libcrypto
85.In openssl/x509.h 86.In openssl/x509.h
86.Ft void 87.Ft void
87.Fo X509_get0_signature 88.Fo X509_get0_signature
@@ -212,11 +213,11 @@ For a supported EdDSA algorithm (in LibreSSL this is Ed25519)
212this flag is always set. 213this flag is always set.
213For an RSASSA-PSS PSS algorithm this flag is set if 214For an RSASSA-PSS PSS algorithm this flag is set if
214the parameters are DER encoded, 215the parameters are DER encoded,
215the digest algorithm is one of SHA256, SHA384, or SHA512, 216the digest algorithm is one of SHA-256, SHA-384, or SHA-512,
216the same digest algorithm is used in the mask generation function, 217the same digest algorithm is used in the mask generation function,
217and the salt length is equal to the digest algorithm's output length. 218and the salt length is equal to the digest algorithm's output length.
218For all other signature algorithms this flag is set if the digest 219For all other signature algorithms this flag is set if the digest
219algorithm is one of SHA1, SHA256, SHA384, or SHA512. 220algorithm is one of SHA-1, SHA-256, SHA-384, or SHA-512.
220.El 221.El
221.Pp 222.Pp
222.Fn X509_get_signature_info 223.Fn X509_get_signature_info
@@ -276,5 +277,12 @@ refer to the information available from the certificate signature
276(such as the signing digest). 277(such as the signing digest).
277In some cases the actual security of the signature is smaller 278In some cases the actual security of the signature is smaller
278because the signing key is less secure. 279because the signing key is less secure.
279For example in a certificate signed using SHA512 280For example in a certificate signed using SHA-512
280and a 1024-bit RSA key. 281and a 1024-bit RSA key.
282.Sh BUGS
283The signatures of
284.Fn X509_get0_signature ,
285.Fn X509_REQ_get0_signature ,
286and
287.Fn X509_CRL_get0_signature
288are inconsistent.
diff --git a/src/lib/libcrypto/man/X509_get1_email.3 b/src/lib/libcrypto/man/X509_get1_email.3
index c38a604899..020708d227 100644
--- a/src/lib/libcrypto/man/X509_get1_email.3
+++ b/src/lib/libcrypto/man/X509_get1_email.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_get1_email.3,v 1.1 2019/08/23 12:23:39 schwarze Exp $ 1.\" $OpenBSD: X509_get1_email.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: August 23 2019 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_GET1_EMAIL 3 18.Dt X509_GET1_EMAIL 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -23,6 +23,7 @@
23.Nm X509_email_free 23.Nm X509_email_free
24.Nd utilities for stacks of strings 24.Nd utilities for stacks of strings
25.Sh SYNOPSIS 25.Sh SYNOPSIS
26.Lb libcrypto
26.In openssl/x509v3.h 27.In openssl/x509v3.h
27.Vt typedef char *OPENSSL_STRING ; 28.Vt typedef char *OPENSSL_STRING ;
28.Ft STACK_OF(OPENSSL_STRING) * 29.Ft STACK_OF(OPENSSL_STRING) *
diff --git a/src/lib/libcrypto/man/X509_get_extension_flags.3 b/src/lib/libcrypto/man/X509_get_extension_flags.3
index 1d7f29c687..1d15be407e 100644
--- a/src/lib/libcrypto/man/X509_get_extension_flags.3
+++ b/src/lib/libcrypto/man/X509_get_extension_flags.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_get_extension_flags.3,v 1.4 2023/04/30 19:40:23 tb Exp $ 1.\" $OpenBSD: X509_get_extension_flags.3,v 1.6 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL 361136f4 Sep 1 18:56:58 2015 +0100 2.\" full merge up to: OpenSSL 361136f4 Sep 1 18:56:58 2015 +0100
3.\" selective merge up to: OpenSSL 2b2e3106f Feb 16 15:04:45 2021 +0000 3.\" selective merge up to: OpenSSL 2b2e3106f Feb 16 15:04:45 2021 +0000
4.\" 4.\"
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: April 30 2023 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt X509_GET_EXTENSION_FLAGS 3 53.Dt X509_GET_EXTENSION_FLAGS 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -58,6 +58,7 @@
58.Nm X509_get_extended_key_usage 58.Nm X509_get_extended_key_usage
59.Nd retrieve certificate extension data 59.Nd retrieve certificate extension data
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libcrypto
61.In openssl/x509v3.h 62.In openssl/x509v3.h
62.Ft uint32_t 63.Ft uint32_t
63.Fo X509_get_extension_flags 64.Fo X509_get_extension_flags
@@ -106,8 +107,8 @@ ASN1 object itself.
106.\" EXFLAG_NO_FINGERPRINT is not available in LibreSSL. Do we need 107.\" EXFLAG_NO_FINGERPRINT is not available in LibreSSL. Do we need
107.\" https://github.com/openssl/openssl/issues/13698 and the fix it fixes? 108.\" https://github.com/openssl/openssl/issues/13698 and the fix it fixes?
108.\".It Dv EXFLAG_NO_FINGERPRINT 109.\".It Dv EXFLAG_NO_FINGERPRINT
109.\" Failed to compute the internal SHA1 hash value of the certificate. 110.\" Failed to compute the internal SHA-1 hash value of the certificate.
110.\" This may be due to malloc failure or because no SHA1 implementation was 111.\" This may be due to malloc failure or because no SHA-1 implementation was
111.\" found. 112.\" found.
112.It Dv EXFLAG_INVALID_POLICY 113.It Dv EXFLAG_INVALID_POLICY
113The 114The
diff --git a/src/lib/libcrypto/man/X509_get_pubkey.3 b/src/lib/libcrypto/man/X509_get_pubkey.3
index 0829397982..9af6f49a33 100644
--- a/src/lib/libcrypto/man/X509_get_pubkey.3
+++ b/src/lib/libcrypto/man/X509_get_pubkey.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_get_pubkey.3,v 1.13 2022/03/31 17:27:17 naddy Exp $ 1.\" $OpenBSD: X509_get_pubkey.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $
2.\" selective merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" selective merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: March 31 2022 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt X509_GET_PUBKEY 3 69.Dt X509_GET_PUBKEY 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -81,6 +81,7 @@
81.Nm X509_REQ_extract_key 81.Nm X509_REQ_extract_key
82.Nd get or set certificate or certificate request public key 82.Nd get or set certificate or certificate request public key
83.Sh SYNOPSIS 83.Sh SYNOPSIS
84.Lb libcrypto
84.In openssl/x509.h 85.In openssl/x509.h
85.Ft EVP_PKEY * 86.Ft EVP_PKEY *
86.Fo X509_get_pubkey 87.Fo X509_get_pubkey
diff --git a/src/lib/libcrypto/man/X509_get_pubkey_parameters.3 b/src/lib/libcrypto/man/X509_get_pubkey_parameters.3
index 181361477e..b2611210d1 100644
--- a/src/lib/libcrypto/man/X509_get_pubkey_parameters.3
+++ b/src/lib/libcrypto/man/X509_get_pubkey_parameters.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_get_pubkey_parameters.3,v 1.2 2021/11/26 13:35:10 schwarze Exp $ 1.\" $OpenBSD: X509_get_pubkey_parameters.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: November 26 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_GET_PUBKEY_PARAMETERS 3 18.Dt X509_GET_PUBKEY_PARAMETERS 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm X509_get_pubkey_parameters 21.Nm X509_get_pubkey_parameters
22.Nd copy public key parameters from a chain 22.Nd copy public key parameters from a chain
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
24.In openssl/x509.h 25.In openssl/x509.h
25.Ft int 26.Ft int
26.Fo X509_get_pubkey_parameters 27.Fo X509_get_pubkey_parameters
diff --git a/src/lib/libcrypto/man/X509_get_serialNumber.3 b/src/lib/libcrypto/man/X509_get_serialNumber.3
index 7d757c7a71..56f108f3d7 100644
--- a/src/lib/libcrypto/man/X509_get_serialNumber.3
+++ b/src/lib/libcrypto/man/X509_get_serialNumber.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_get_serialNumber.3,v 1.5 2020/06/19 12:01:20 schwarze Exp $ 1.\" $OpenBSD: X509_get_serialNumber.3,v 1.6 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 2.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 19 2020 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt X509_GET_SERIALNUMBER 3 52.Dt X509_GET_SERIALNUMBER 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -57,6 +57,7 @@
57.Nm X509_set_serialNumber 57.Nm X509_set_serialNumber
58.Nd get or set certificate serial number 58.Nd get or set certificate serial number
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/x509.h 61.In openssl/x509.h
61.Ft ASN1_INTEGER * 62.Ft ASN1_INTEGER *
62.Fo X509_get_serialNumber 63.Fo X509_get_serialNumber
diff --git a/src/lib/libcrypto/man/X509_get_subject_name.3 b/src/lib/libcrypto/man/X509_get_subject_name.3
index fb9611f645..8dc19080f6 100644
--- a/src/lib/libcrypto/man/X509_get_subject_name.3
+++ b/src/lib/libcrypto/man/X509_get_subject_name.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_get_subject_name.3,v 1.10 2020/10/21 17:17:44 tb Exp $ 1.\" $OpenBSD: X509_get_subject_name.3,v 1.11 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: October 21 2020 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt X509_GET_SUBJECT_NAME 3 52.Dt X509_GET_SUBJECT_NAME 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -62,6 +62,7 @@
62.Nm X509_CRL_set_issuer_name 62.Nm X509_CRL_set_issuer_name
63.Nd get and set issuer or subject names 63.Nd get and set issuer or subject names
64.Sh SYNOPSIS 64.Sh SYNOPSIS
65.Lb libcrypto
65.In openssl/x509.h 66.In openssl/x509.h
66.Ft X509_NAME * 67.Ft X509_NAME *
67.Fo X509_get_subject_name 68.Fo X509_get_subject_name
diff --git a/src/lib/libcrypto/man/X509_get_version.3 b/src/lib/libcrypto/man/X509_get_version.3
index ee46ff7c8c..d539053d81 100644
--- a/src/lib/libcrypto/man/X509_get_version.3
+++ b/src/lib/libcrypto/man/X509_get_version.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_get_version.3,v 1.8 2020/10/21 17:17:44 tb Exp $ 1.\" $OpenBSD: X509_get_version.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: October 21 2020 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt X509_GET_VERSION 3 52.Dt X509_GET_VERSION 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -60,6 +60,7 @@
60.Nm X509_CRL_set_version 60.Nm X509_CRL_set_version
61.Nd get or set certificate, certificate request, or CRL version 61.Nd get or set certificate, certificate request, or CRL version
62.Sh SYNOPSIS 62.Sh SYNOPSIS
63.Lb libcrypto
63.In openssl/x509.h 64.In openssl/x509.h
64.Ft long 65.Ft long
65.Fo X509_get_version 66.Fo X509_get_version
diff --git a/src/lib/libcrypto/man/X509_keyid_set1.3 b/src/lib/libcrypto/man/X509_keyid_set1.3
index c529fc742b..e1668f976a 100644
--- a/src/lib/libcrypto/man/X509_keyid_set1.3
+++ b/src/lib/libcrypto/man/X509_keyid_set1.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_keyid_set1.3,v 1.2 2021/07/09 14:41:14 tb Exp $ 1.\" $OpenBSD: X509_keyid_set1.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: July 9 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_KEYID_SET1 3 18.Dt X509_KEYID_SET1 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -24,6 +24,7 @@
24.Nm X509_alias_get0 24.Nm X509_alias_get0
25.Nd auxiliary certificate data for PKCS#12 25.Nd auxiliary certificate data for PKCS#12
26.Sh SYNOPSIS 26.Sh SYNOPSIS
27.Lb libcrypto
27.In openssl/x509.h 28.In openssl/x509.h
28.Ft int 29.Ft int
29.Fo X509_keyid_set1 30.Fo X509_keyid_set1
diff --git a/src/lib/libcrypto/man/X509_load_cert_file.3 b/src/lib/libcrypto/man/X509_load_cert_file.3
index 95a83dd00e..04a666da25 100644
--- a/src/lib/libcrypto/man/X509_load_cert_file.3
+++ b/src/lib/libcrypto/man/X509_load_cert_file.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_load_cert_file.3,v 1.1 2021/11/09 16:23:04 schwarze Exp $ 1.\" $OpenBSD: X509_load_cert_file.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: November 9 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_LOAD_CERT_FILE 3 18.Dt X509_LOAD_CERT_FILE 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -23,6 +23,7 @@
23.Nm X509_load_cert_crl_file 23.Nm X509_load_cert_crl_file
24.Nd read, decode, and cache certificates and CRLs 24.Nd read, decode, and cache certificates and CRLs
25.Sh SYNOPSIS 25.Sh SYNOPSIS
26.Lb libcrypto
26.In openssl/x509_vfy.h 27.In openssl/x509_vfy.h
27.Ft int 28.Ft int
28.Fo X509_load_cert_file 29.Fo X509_load_cert_file
diff --git a/src/lib/libcrypto/man/X509_new.3 b/src/lib/libcrypto/man/X509_new.3
index 7b62363d4d..b6140b24b0 100644
--- a/src/lib/libcrypto/man/X509_new.3
+++ b/src/lib/libcrypto/man/X509_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_new.3,v 1.45 2024/09/02 08:04:32 tb Exp $ 1.\" $OpenBSD: X509_new.3,v 1.47 2025/07/16 17:59:10 schwarze Exp $
2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: September 2 2024 $ 69.Dd $Mdocdate: July 16 2025 $
70.Dt X509_NEW 3 70.Dt X509_NEW 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -78,6 +78,7 @@
78.Nm X509_chain_up_ref 78.Nm X509_chain_up_ref
79.Nd X.509 certificate object 79.Nd X.509 certificate object
80.Sh SYNOPSIS 80.Sh SYNOPSIS
81.Lb libcrypto
81.In openssl/x509.h 82.In openssl/x509.h
82.Ft X509 * 83.Ft X509 *
83.Fn X509_new void 84.Fn X509_new void
@@ -230,7 +231,6 @@ if an error occurs.
230.Xr X509_LOOKUP_new 3 , 231.Xr X509_LOOKUP_new 3 ,
231.Xr X509_NAME_new 3 , 232.Xr X509_NAME_new 3 ,
232.Xr X509_OBJECT_new 3 , 233.Xr X509_OBJECT_new 3 ,
233.Xr X509_PKEY_new 3 ,
234.Xr X509_print_ex 3 , 234.Xr X509_print_ex 3 ,
235.Xr X509_PUBKEY_new 3 , 235.Xr X509_PUBKEY_new 3 ,
236.Xr X509_PURPOSE_set 3 , 236.Xr X509_PURPOSE_set 3 ,
diff --git a/src/lib/libcrypto/man/X509_ocspid_print.3 b/src/lib/libcrypto/man/X509_ocspid_print.3
index b9b6c92fbb..7b0493c655 100644
--- a/src/lib/libcrypto/man/X509_ocspid_print.3
+++ b/src/lib/libcrypto/man/X509_ocspid_print.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_ocspid_print.3,v 1.1 2021/08/06 21:45:55 schwarze Exp $ 1.\" $OpenBSD: X509_ocspid_print.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: August 6 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_OCSPID_PRINT 3 18.Dt X509_OCSPID_PRINT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm X509_ocspid_print 21.Nm X509_ocspid_print
22.Nd pretty-print hashes of subject name and public key 22.Nd pretty-print hashes of subject name and public key
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
24.In openssl/x509.h 25.In openssl/x509.h
25.Ft int 26.Ft int
26.Fo X509_ocspid_print 27.Fo X509_ocspid_print
diff --git a/src/lib/libcrypto/man/X509_print_ex.3 b/src/lib/libcrypto/man/X509_print_ex.3
index c769e77c32..627ef25a79 100644
--- a/src/lib/libcrypto/man/X509_print_ex.3
+++ b/src/lib/libcrypto/man/X509_print_ex.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_print_ex.3,v 1.5 2025/03/09 14:02:46 tb Exp $ 1.\" $OpenBSD: X509_print_ex.3,v 1.7 2025/07/01 06:47:56 tb Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 9 2025 $ 17.Dd $Mdocdate: July 1 2025 $
18.Dt X509_PRINT_EX 3 18.Dt X509_PRINT_EX 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -25,6 +25,7 @@
25.Nm X509_print_fp 25.Nm X509_print_fp
26.Nd pretty-print an X.509 certificate 26.Nd pretty-print an X.509 certificate
27.Sh SYNOPSIS 27.Sh SYNOPSIS
28.Lb libcrypto
28.In openssl/x509.h 29.In openssl/x509.h
29.Ft int 30.Ft int
30.Fo X509_print_ex 31.Fo X509_print_ex
@@ -132,6 +133,11 @@ with
132.Xr EVP_PKEY_print_public 3 . 133.Xr EVP_PKEY_print_public 3 .
133.Pq Dv X509_FLAG_NO_PUBKEY 134.Pq Dv X509_FLAG_NO_PUBKEY
134.It 135.It
136If an issuer or a subject unique identifier is present, its hex dump
137is printed with
138.Xr X509_signature_dump 3 .
139.Pq Dv X509_FLAG_NO_IDS
140.It
135All X.509 extensions contained in the certificate are printed with 141All X.509 extensions contained in the certificate are printed with
136.Xr X509V3_extensions_print 3 . 142.Xr X509V3_extensions_print 3 .
137.Pq Dv X509_FLAG_NO_EXTENSIONS 143.Pq Dv X509_FLAG_NO_EXTENSIONS
diff --git a/src/lib/libcrypto/man/X509_sign.3 b/src/lib/libcrypto/man/X509_sign.3
index 059d92bac5..9e9df1e98d 100644
--- a/src/lib/libcrypto/man/X509_sign.3
+++ b/src/lib/libcrypto/man/X509_sign.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_sign.3,v 1.11 2024/03/06 02:34:14 tb Exp $ 1.\" $OpenBSD: X509_sign.3,v 1.13 2025/07/11 18:42:51 tb Exp $
2.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 2.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 6 2024 $ 51.Dd $Mdocdate: July 11 2025 $
52.Dt X509_SIGN 3 52.Dt X509_SIGN 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -63,6 +63,7 @@
63.Nm X509_CRL_verify 63.Nm X509_CRL_verify
64.Nd sign or verify certificate, certificate request, or CRL signature 64.Nd sign or verify certificate, certificate request, or CRL signature
65.Sh SYNOPSIS 65.Sh SYNOPSIS
66.Lb libcrypto
66.In openssl/x509.h 67.In openssl/x509.h
67.Ft int 68.Ft int
68.Fo X509_sign 69.Fo X509_sign
@@ -77,8 +78,8 @@
77.Fc 78.Fc
78.Ft int 79.Ft int
79.Fo X509_verify 80.Fo X509_verify
80.Fa "X509 *a" 81.Fa "X509 *x"
81.Fa "EVP_PKEY *r" 82.Fa "EVP_PKEY *pkey"
82.Fc 83.Fc
83.Ft int 84.Ft int
84.Fo X509_REQ_sign 85.Fo X509_REQ_sign
@@ -93,8 +94,8 @@
93.Fc 94.Fc
94.Ft int 95.Ft int
95.Fo X509_REQ_verify 96.Fo X509_REQ_verify
96.Fa "X509_REQ *a" 97.Fa "X509_REQ *x"
97.Fa "EVP_PKEY *r" 98.Fa "EVP_PKEY *pkey"
98.Fc 99.Fc
99.Ft int 100.Ft int
100.Fo X509_CRL_sign 101.Fo X509_CRL_sign
@@ -109,8 +110,8 @@
109.Fc 110.Fc
110.Ft int 111.Ft int
111.Fo X509_CRL_verify 112.Fo X509_CRL_verify
112.Fa "X509_CRL *a" 113.Fa "X509_CRL *x"
113.Fa "EVP_PKEY *r" 114.Fa "EVP_PKEY *pkey"
114.Fc 115.Fc
115.Sh DESCRIPTION 116.Sh DESCRIPTION
116.Fn X509_sign 117.Fn X509_sign
diff --git a/src/lib/libcrypto/man/X509_signature_dump.3 b/src/lib/libcrypto/man/X509_signature_dump.3
index 3333a615bf..c5b9277e0c 100644
--- a/src/lib/libcrypto/man/X509_signature_dump.3
+++ b/src/lib/libcrypto/man/X509_signature_dump.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_signature_dump.3,v 1.3 2024/12/06 12:51:13 schwarze Exp $ 1.\" $OpenBSD: X509_signature_dump.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: December 6 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509_SIGNATURE_DUMP 3 18.Dt X509_SIGNATURE_DUMP 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm X509_signature_print 22.Nm X509_signature_print
23.Nd pretty-print ASN.1 strings 23.Nd pretty-print ASN.1 strings
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/x509.h 26.In openssl/x509.h
26.Ft int 27.Ft int
27.Fo X509_signature_dump 28.Fo X509_signature_dump
diff --git a/src/lib/libcrypto/man/X509_verify_cert.3 b/src/lib/libcrypto/man/X509_verify_cert.3
index 9c085d7780..7897e09f80 100644
--- a/src/lib/libcrypto/man/X509_verify_cert.3
+++ b/src/lib/libcrypto/man/X509_verify_cert.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_verify_cert.3,v 1.8 2019/06/06 01:06:59 schwarze Exp $ 1.\" $OpenBSD: X509_verify_cert.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 6 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt X509_VERIFY_CERT 3 52.Dt X509_VERIFY_CERT 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm X509_verify_cert 55.Nm X509_verify_cert
56.Nd discover and verify X509 certificate chain 56.Nd discover and verify X509 certificate chain
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/x509.h 59.In openssl/x509.h
59.Ft int 60.Ft int
60.Fo X509_verify_cert 61.Fo X509_verify_cert
diff --git a/src/lib/libcrypto/man/X509v3_addr_add_inherit.3 b/src/lib/libcrypto/man/X509v3_addr_add_inherit.3
index 4b2d150c86..d33de1f6a8 100644
--- a/src/lib/libcrypto/man/X509v3_addr_add_inherit.3
+++ b/src/lib/libcrypto/man/X509v3_addr_add_inherit.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509v3_addr_add_inherit.3,v 1.11 2023/10/01 22:46:21 tb Exp $ 1.\" $OpenBSD: X509v3_addr_add_inherit.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> 3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: October 1 2023 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509V3_ADDR_ADD_INHERIT 3 18.Dt X509V3_ADDR_ADD_INHERIT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -25,6 +25,7 @@
25.Nm X509v3_addr_is_canonical 25.Nm X509v3_addr_is_canonical
26.Nd RFC 3779 IP address delegation extensions 26.Nd RFC 3779 IP address delegation extensions
27.Sh SYNOPSIS 27.Sh SYNOPSIS
28.Lb libcrypto
28.In openssl/x509v3.h 29.In openssl/x509v3.h
29.Ft int 30.Ft int
30.Fo X509v3_addr_add_inherit 31.Fo X509v3_addr_add_inherit
diff --git a/src/lib/libcrypto/man/X509v3_addr_get_range.3 b/src/lib/libcrypto/man/X509v3_addr_get_range.3
index e0d83b1162..7ad279d7cc 100644
--- a/src/lib/libcrypto/man/X509v3_addr_get_range.3
+++ b/src/lib/libcrypto/man/X509v3_addr_get_range.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509v3_addr_get_range.3,v 1.2 2023/09/30 14:12:40 schwarze Exp $ 1.\" $OpenBSD: X509v3_addr_get_range.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> 3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: September 30 2023 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509V3_ADDR_GET_RANGE 3 18.Dt X509V3_ADDR_GET_RANGE 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm X509v3_addr_get_range 22.Nm X509v3_addr_get_range
23.Nd parse helpers for the IP address delegation extension 23.Nd parse helpers for the IP address delegation extension
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/x509v3.h 26.In openssl/x509v3.h
26.Ft unsigned 27.Ft unsigned
27.Fn X509v3_addr_get_afi "const IPAddressFamily *af" 28.Fn X509v3_addr_get_afi "const IPAddressFamily *af"
diff --git a/src/lib/libcrypto/man/X509v3_addr_inherits.3 b/src/lib/libcrypto/man/X509v3_addr_inherits.3
index 8e3cecf7ae..0da24ad10f 100644
--- a/src/lib/libcrypto/man/X509v3_addr_inherits.3
+++ b/src/lib/libcrypto/man/X509v3_addr_inherits.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509v3_addr_inherits.3,v 1.3 2023/09/30 14:21:57 schwarze Exp $ 1.\" $OpenBSD: X509v3_addr_inherits.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> 3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: September 30 2023 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509V3_ADDR_INHERITS 3 18.Dt X509V3_ADDR_INHERITS 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm X509v3_asid_inherits 22.Nm X509v3_asid_inherits
23.Nd RFC 3779 inheritance 23.Nd RFC 3779 inheritance
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/x509v3.h 26.In openssl/x509v3.h
26.Ft int 27.Ft int
27.Fn X509v3_addr_inherits "IPAddrBlocks *addrblocks" 28.Fn X509v3_addr_inherits "IPAddrBlocks *addrblocks"
diff --git a/src/lib/libcrypto/man/X509v3_addr_subset.3 b/src/lib/libcrypto/man/X509v3_addr_subset.3
index 93714a26fa..5629d9c3cf 100644
--- a/src/lib/libcrypto/man/X509v3_addr_subset.3
+++ b/src/lib/libcrypto/man/X509v3_addr_subset.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509v3_addr_subset.3,v 1.2 2023/09/30 14:24:00 schwarze Exp $ 1.\" $OpenBSD: X509v3_addr_subset.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> 3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: September 30 2023 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509V3_ADDR_SUBSET 3 18.Dt X509V3_ADDR_SUBSET 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm X509v3_asid_subset 22.Nm X509v3_asid_subset
23.Nd RFC 3779 subset relationship 23.Nd RFC 3779 subset relationship
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/x509v3.h 26.In openssl/x509v3.h
26.Ft int 27.Ft int
27.Fn X509v3_addr_subset "IPAddrBlocks *child" "IPAddrBlocks *parent" 28.Fn X509v3_addr_subset "IPAddrBlocks *child" "IPAddrBlocks *parent"
diff --git a/src/lib/libcrypto/man/X509v3_addr_validate_path.3 b/src/lib/libcrypto/man/X509v3_addr_validate_path.3
index fe6065d599..5bafc6eba4 100644
--- a/src/lib/libcrypto/man/X509v3_addr_validate_path.3
+++ b/src/lib/libcrypto/man/X509v3_addr_validate_path.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509v3_addr_validate_path.3,v 1.5 2023/09/30 19:07:38 tb Exp $ 1.\" $OpenBSD: X509v3_addr_validate_path.3,v 1.6 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> 3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: September 30 2023 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509V3_ADDR_VALIDATE_PATH 3 18.Dt X509V3_ADDR_VALIDATE_PATH 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -24,6 +24,7 @@
24.Nm X509v3_asid_validate_resource_set 24.Nm X509v3_asid_validate_resource_set
25.Nd RFC 3779 path validation for IP address and AS number delegation 25.Nd RFC 3779 path validation for IP address and AS number delegation
26.Sh SYNOPSIS 26.Sh SYNOPSIS
27.Lb libcrypto
27.In openssl/x509v3.h 28.In openssl/x509v3.h
28.Ft int 29.Ft int
29.Fn X509v3_addr_validate_path "X509_STORE_CTX *ctx" 30.Fn X509v3_addr_validate_path "X509_STORE_CTX *ctx"
diff --git a/src/lib/libcrypto/man/X509v3_asid_add_id_or_range.3 b/src/lib/libcrypto/man/X509v3_asid_add_id_or_range.3
index 81221ca9bc..6378f45ae8 100644
--- a/src/lib/libcrypto/man/X509v3_asid_add_id_or_range.3
+++ b/src/lib/libcrypto/man/X509v3_asid_add_id_or_range.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509v3_asid_add_id_or_range.3,v 1.9 2023/09/30 18:16:44 tb Exp $ 1.\" $OpenBSD: X509v3_asid_add_id_or_range.3,v 1.10 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> 3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: September 30 2023 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt X509V3_ASID_ADD_ID_OR_RANGE 3 18.Dt X509V3_ASID_ADD_ID_OR_RANGE 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -24,6 +24,7 @@
24.Nm X509v3_asid_is_canonical 24.Nm X509v3_asid_is_canonical
25.Nd RFC 3779 autonomous system identifier delegation extension 25.Nd RFC 3779 autonomous system identifier delegation extension
26.Sh SYNOPSIS 26.Sh SYNOPSIS
27.Lb libcrypto
27.In openssl/x509v3.h 28.In openssl/x509v3.h
28.Ft int 29.Ft int
29.Fo X509v3_asid_add_id_or_range 30.Fo X509v3_asid_add_id_or_range
diff --git a/src/lib/libcrypto/man/X509v3_get_ext_by_NID.3 b/src/lib/libcrypto/man/X509v3_get_ext_by_NID.3
index 8c7c159f80..63f8180151 100644
--- a/src/lib/libcrypto/man/X509v3_get_ext_by_NID.3
+++ b/src/lib/libcrypto/man/X509v3_get_ext_by_NID.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509v3_get_ext_by_NID.3,v 1.15 2024/05/22 09:44:10 tb Exp $ 1.\" $OpenBSD: X509v3_get_ext_by_NID.3,v 1.16 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL fd38836b Jun 20 15:25:43 2018 +0100 2.\" full merge up to: OpenSSL fd38836b Jun 20 15:25:43 2018 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: May 22 2024 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt X509V3_GET_EXT_BY_NID 3 52.Dt X509V3_GET_EXT_BY_NID 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -82,6 +82,7 @@
82.Nm X509_REVOKED_add_ext 82.Nm X509_REVOKED_add_ext
83.Nd extension stack utility functions 83.Nd extension stack utility functions
84.Sh SYNOPSIS 84.Sh SYNOPSIS
85.Lb libcrypto
85.In openssl/x509.h 86.In openssl/x509.h
86.Ft int 87.Ft int
87.Fo X509v3_get_ext_count 88.Fo X509v3_get_ext_count
diff --git a/src/lib/libcrypto/man/a2d_ASN1_OBJECT.3 b/src/lib/libcrypto/man/a2d_ASN1_OBJECT.3
index 7d36a54be2..ed5e7b21f6 100644
--- a/src/lib/libcrypto/man/a2d_ASN1_OBJECT.3
+++ b/src/lib/libcrypto/man/a2d_ASN1_OBJECT.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: a2d_ASN1_OBJECT.3,v 1.3 2023/08/09 17:34:39 schwarze Exp $ 1.\" $OpenBSD: a2d_ASN1_OBJECT.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: August 9 2023 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt A2D_ASN1_OBJECT 3 18.Dt A2D_ASN1_OBJECT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm a2d_ASN1_OBJECT 21.Nm a2d_ASN1_OBJECT
22.Nd DER content octets of an ASN.1 object identifier 22.Nd DER content octets of an ASN.1 object identifier
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libcrypto
24.In openssl/asn1.h 25.In openssl/asn1.h
25.Ft int 26.Ft int
26.Fo a2d_ASN1_OBJECT 27.Fo a2d_ASN1_OBJECT
diff --git a/src/lib/libcrypto/man/a2i_ipadd.3 b/src/lib/libcrypto/man/a2i_ipadd.3
index 1372b2acfd..1fea5e1a05 100644
--- a/src/lib/libcrypto/man/a2i_ipadd.3
+++ b/src/lib/libcrypto/man/a2i_ipadd.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: a2i_ipadd.3,v 1.1 2024/12/27 15:30:17 schwarze Exp $ 1.\" $OpenBSD: a2i_ipadd.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: December 27 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt A2I_IPADD 3 18.Dt A2I_IPADD 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -23,6 +23,7 @@
23.Nm a2i_IPADDRESS_NC 23.Nm a2i_IPADDRESS_NC
24.Nd parse Internet Protocol addresses into ASN.1 OCTET STRINGs for X.509 24.Nd parse Internet Protocol addresses into ASN.1 OCTET STRINGs for X.509
25.Sh SYNOPSIS 25.Sh SYNOPSIS
26.Lb libcrypto
26.In openssl/x509v3.h 27.In openssl/x509v3.h
27.Ft int 28.Ft int
28.Fo a2i_ipadd 29.Fo a2i_ipadd
diff --git a/src/lib/libcrypto/man/crypto.3 b/src/lib/libcrypto/man/crypto.3
index f1367e9e62..ddc8b05686 100644
--- a/src/lib/libcrypto/man/crypto.3
+++ b/src/lib/libcrypto/man/crypto.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: crypto.3,v 1.30 2024/12/07 19:22:15 schwarze Exp $ 1.\" $OpenBSD: crypto.3,v 1.31 2025/04/25 20:04:09 tb Exp $
2.\" OpenSSL a9c85cea Nov 11 09:33:55 2016 +0100 2.\" OpenSSL a9c85cea Nov 11 09:33:55 2016 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: December 7 2024 $ 69.Dd $Mdocdate: April 25 2025 $
70.Dt CRYPTO 3 70.Dt CRYPTO 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -153,7 +153,7 @@ error reporting: see
153include 153include
154.Xr BIO_f_buffer 3 , 154.Xr BIO_f_buffer 3 ,
155.Xr BN_new 3 , 155.Xr BN_new 3 ,
156.Xr EC_GROUP_new 3 , 156.Xr EC_GROUP_new_by_curve_name 3 ,
157.Xr lh_new 3 , 157.Xr lh_new 3 ,
158and 158and
159.Xr STACK_OF 3 . 159.Xr STACK_OF 3 .
diff --git a/src/lib/libcrypto/man/d2i_ASN1_NULL.3 b/src/lib/libcrypto/man/d2i_ASN1_NULL.3
index 037c9c93e1..06aafc08a2 100644
--- a/src/lib/libcrypto/man/d2i_ASN1_NULL.3
+++ b/src/lib/libcrypto/man/d2i_ASN1_NULL.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_ASN1_NULL.3,v 1.5 2023/09/26 09:36:22 tb Exp $ 1.\" $OpenBSD: d2i_ASN1_NULL.3,v 1.6 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: September 26 2023 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt D2I_ASN1_NULL 3 18.Dt D2I_ASN1_NULL 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm i2d_ASN1_NULL 22.Nm i2d_ASN1_NULL
23.Nd decode and encode an ASN.1 NULL type 23.Nd decode and encode an ASN.1 NULL type
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/asn1.h 26.In openssl/asn1.h
26.Ft ASN1_NULL * 27.Ft ASN1_NULL *
27.Fo d2i_ASN1_NULL 28.Fo d2i_ASN1_NULL
diff --git a/src/lib/libcrypto/man/d2i_ASN1_OBJECT.3 b/src/lib/libcrypto/man/d2i_ASN1_OBJECT.3
index bbb70ad8c6..3d90c60e0b 100644
--- a/src/lib/libcrypto/man/d2i_ASN1_OBJECT.3
+++ b/src/lib/libcrypto/man/d2i_ASN1_OBJECT.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_ASN1_OBJECT.3,v 1.15 2025/03/14 21:32:15 tb Exp $ 1.\" $OpenBSD: d2i_ASN1_OBJECT.3,v 1.16 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2017, 2022, 2023 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2017, 2022, 2023 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 14 2025 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt D2I_ASN1_OBJECT 3 18.Dt D2I_ASN1_OBJECT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -24,6 +24,7 @@
24.Nm OBJ_length 24.Nm OBJ_length
25.Nd decode and encode ASN.1 object identifiers 25.Nd decode and encode ASN.1 object identifiers
26.Sh SYNOPSIS 26.Sh SYNOPSIS
27.Lb libcrypto
27.In openssl/asn1.h 28.In openssl/asn1.h
28.Ft ASN1_OBJECT * 29.Ft ASN1_OBJECT *
29.Fo d2i_ASN1_OBJECT 30.Fo d2i_ASN1_OBJECT
diff --git a/src/lib/libcrypto/man/d2i_ASN1_OCTET_STRING.3 b/src/lib/libcrypto/man/d2i_ASN1_OCTET_STRING.3
index d544af0fe4..bd4b900193 100644
--- a/src/lib/libcrypto/man/d2i_ASN1_OCTET_STRING.3
+++ b/src/lib/libcrypto/man/d2i_ASN1_OCTET_STRING.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_ASN1_OCTET_STRING.3,v 1.20 2024/02/13 12:38:43 job Exp $ 1.\" $OpenBSD: d2i_ASN1_OCTET_STRING.3,v 1.21 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: February 13 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt D2I_ASN1_OCTET_STRING 3 18.Dt D2I_ASN1_OCTET_STRING 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -57,6 +57,7 @@
57.Nm i2d_ASN1_TIME 57.Nm i2d_ASN1_TIME
58.Nd decode and encode ASN1_STRING objects 58.Nd decode and encode ASN1_STRING objects
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libcrypto
60.In openssl/asn1.h 61.In openssl/asn1.h
61.Ft ASN1_OCTET_STRING * 62.Ft ASN1_OCTET_STRING *
62.Fo d2i_ASN1_OCTET_STRING 63.Fo d2i_ASN1_OCTET_STRING
diff --git a/src/lib/libcrypto/man/d2i_ASN1_SEQUENCE_ANY.3 b/src/lib/libcrypto/man/d2i_ASN1_SEQUENCE_ANY.3
index 654f0b1e6b..bd54520005 100644
--- a/src/lib/libcrypto/man/d2i_ASN1_SEQUENCE_ANY.3
+++ b/src/lib/libcrypto/man/d2i_ASN1_SEQUENCE_ANY.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_ASN1_SEQUENCE_ANY.3,v 1.3 2021/12/09 19:05:09 schwarze Exp $ 1.\" $OpenBSD: d2i_ASN1_SEQUENCE_ANY.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2017, 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2017, 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: December 9 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt D2I_ASN1_SEQUENCE_ANY 3 18.Dt D2I_ASN1_SEQUENCE_ANY 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -24,6 +24,7 @@
24.Nm i2d_ASN1_SET_ANY 24.Nm i2d_ASN1_SET_ANY
25.Nd decode and encode ASN.1 sequences and sets 25.Nd decode and encode ASN.1 sequences and sets
26.Sh SYNOPSIS 26.Sh SYNOPSIS
27.Lb libcrypto
27.In openssl/asn1.h 28.In openssl/asn1.h
28.Ft ASN1_SEQUENCE_ANY * 29.Ft ASN1_SEQUENCE_ANY *
29.Fo d2i_ASN1_SEQUENCE_ANY 30.Fo d2i_ASN1_SEQUENCE_ANY
diff --git a/src/lib/libcrypto/man/d2i_AUTHORITY_KEYID.3 b/src/lib/libcrypto/man/d2i_AUTHORITY_KEYID.3
index 413f41e179..de1acfb6e1 100644
--- a/src/lib/libcrypto/man/d2i_AUTHORITY_KEYID.3
+++ b/src/lib/libcrypto/man/d2i_AUTHORITY_KEYID.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_AUTHORITY_KEYID.3,v 1.2 2018/03/21 16:09:51 schwarze Exp $ 1.\" $OpenBSD: d2i_AUTHORITY_KEYID.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 21 2018 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt D2I_AUTHORITY_KEYID 3 18.Dt D2I_AUTHORITY_KEYID 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm i2d_AUTHORITY_KEYID 22.Nm i2d_AUTHORITY_KEYID
23.Nd decode and encode X.509 authority key identifiers 23.Nd decode and encode X.509 authority key identifiers
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/x509v3.h 26.In openssl/x509v3.h
26.Ft AUTHORITY_KEYID * 27.Ft AUTHORITY_KEYID *
27.Fo d2i_AUTHORITY_KEYID 28.Fo d2i_AUTHORITY_KEYID
diff --git a/src/lib/libcrypto/man/d2i_BASIC_CONSTRAINTS.3 b/src/lib/libcrypto/man/d2i_BASIC_CONSTRAINTS.3
index 2964a1f90e..b90c13df06 100644
--- a/src/lib/libcrypto/man/d2i_BASIC_CONSTRAINTS.3
+++ b/src/lib/libcrypto/man/d2i_BASIC_CONSTRAINTS.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_BASIC_CONSTRAINTS.3,v 1.3 2018/03/22 21:08:22 schwarze Exp $ 1.\" $OpenBSD: d2i_BASIC_CONSTRAINTS.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 22 2018 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt D2I_BASIC_CONSTRAINTS 3 18.Dt D2I_BASIC_CONSTRAINTS 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -24,6 +24,7 @@
24.Nm i2d_EXTENDED_KEY_USAGE 24.Nm i2d_EXTENDED_KEY_USAGE
25.Nd decode and encode X.509 key usage purposes 25.Nd decode and encode X.509 key usage purposes
26.Sh SYNOPSIS 26.Sh SYNOPSIS
27.Lb libcrypto
27.In openssl/x509v3.h 28.In openssl/x509v3.h
28.Ft BASIC_CONSTRAINTS * 29.Ft BASIC_CONSTRAINTS *
29.Fo d2i_BASIC_CONSTRAINTS 30.Fo d2i_BASIC_CONSTRAINTS
diff --git a/src/lib/libcrypto/man/d2i_CMS_ContentInfo.3 b/src/lib/libcrypto/man/d2i_CMS_ContentInfo.3
index 0c61047c42..f4238d664d 100644
--- a/src/lib/libcrypto/man/d2i_CMS_ContentInfo.3
+++ b/src/lib/libcrypto/man/d2i_CMS_ContentInfo.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_CMS_ContentInfo.3,v 1.3 2019/11/02 15:39:46 schwarze Exp $ 1.\" $OpenBSD: d2i_CMS_ContentInfo.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $
2.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> 2.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org>
3.\" 3.\"
4.\" Permission to use, copy, modify, and distribute this software for any 4.\" Permission to use, copy, modify, and distribute this software for any
@@ -13,7 +13,7 @@
13.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15.\" 15.\"
16.Dd $Mdocdate: November 2 2019 $ 16.Dd $Mdocdate: June 8 2025 $
17.Dt D2I_CMS_CONTENTINFO 3 17.Dt D2I_CMS_CONTENTINFO 3
18.Os 18.Os
19.Sh NAME 19.Sh NAME
@@ -25,6 +25,7 @@
25.Nm i2d_CMS_ReceiptRequest 25.Nm i2d_CMS_ReceiptRequest
26.Nd decode and encode Cryptographic Message Syntax data 26.Nd decode and encode Cryptographic Message Syntax data
27.Sh SYNOPSIS 27.Sh SYNOPSIS
28.Lb libcrypto
28.In openssl/cms.h 29.In openssl/cms.h
29.Ft CMS_ContentInfo * 30.Ft CMS_ContentInfo *
30.Fo d2i_CMS_ContentInfo 31.Fo d2i_CMS_ContentInfo
diff --git a/src/lib/libcrypto/man/d2i_DHparams.3 b/src/lib/libcrypto/man/d2i_DHparams.3
index 7fd9878dc0..f3cbd21f13 100644
--- a/src/lib/libcrypto/man/d2i_DHparams.3
+++ b/src/lib/libcrypto/man/d2i_DHparams.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_DHparams.3,v 1.8 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: d2i_DHparams.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 2.\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org> and 4.\" This file was written by Ulf Moeller <ulf@openssl.org> and
@@ -50,7 +50,7 @@
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\" 52.\"
53.Dd $Mdocdate: March 27 2018 $ 53.Dd $Mdocdate: June 8 2025 $
54.Dt D2I_DHPARAMS 3 54.Dt D2I_DHPARAMS 3
55.Os 55.Os
56.Sh NAME 56.Sh NAME
@@ -58,6 +58,7 @@
58.Nm i2d_DHparams 58.Nm i2d_DHparams
59.Nd PKCS#3 DH parameter functions 59.Nd PKCS#3 DH parameter functions
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libcrypto
61.In openssl/dh.h 62.In openssl/dh.h
62.Ft DH * 63.Ft DH *
63.Fo d2i_DHparams 64.Fo d2i_DHparams
diff --git a/src/lib/libcrypto/man/d2i_DIST_POINT.3 b/src/lib/libcrypto/man/d2i_DIST_POINT.3
index 34bdb26fb4..0e49dfeeb3 100644
--- a/src/lib/libcrypto/man/d2i_DIST_POINT.3
+++ b/src/lib/libcrypto/man/d2i_DIST_POINT.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_DIST_POINT.3,v 1.4 2018/03/23 04:34:23 schwarze Exp $ 1.\" $OpenBSD: d2i_DIST_POINT.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 23 2018 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt D2I_DIST_POINT 3 18.Dt D2I_DIST_POINT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -32,6 +32,7 @@
32.Nm i2d_AUTHORITY_INFO_ACCESS 32.Nm i2d_AUTHORITY_INFO_ACCESS
33.Nd decode and encode X.509 data access extensions 33.Nd decode and encode X.509 data access extensions
34.Sh SYNOPSIS 34.Sh SYNOPSIS
35.Lb libcrypto
35.In openssl/x509v3.h 36.In openssl/x509v3.h
36.Ft DIST_POINT * 37.Ft DIST_POINT *
37.Fo d2i_DIST_POINT 38.Fo d2i_DIST_POINT
diff --git a/src/lib/libcrypto/man/d2i_DSAPublicKey.3 b/src/lib/libcrypto/man/d2i_DSAPublicKey.3
index 37ef22e1b9..62dcc45082 100644
--- a/src/lib/libcrypto/man/d2i_DSAPublicKey.3
+++ b/src/lib/libcrypto/man/d2i_DSAPublicKey.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_DSAPublicKey.3,v 1.14 2018/08/26 17:03:32 tb Exp $ 1.\" $OpenBSD: d2i_DSAPublicKey.3,v 1.15 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400 2.\" OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: August 26 2018 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt D2I_DSAPUBLICKEY 3 53.Dt D2I_DSAPUBLICKEY 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -78,6 +78,7 @@
78.Nm i2d_DSA_SIG 78.Nm i2d_DSA_SIG
79.Nd decode and encode DSA keys 79.Nd decode and encode DSA keys
80.Sh SYNOPSIS 80.Sh SYNOPSIS
81.Lb libcrypto
81.In openssl/dsa.h 82.In openssl/dsa.h
82.Ft DSA * 83.Ft DSA *
83.Fo d2i_DSAPublicKey 84.Fo d2i_DSAPublicKey
diff --git a/src/lib/libcrypto/man/d2i_ECPKParameters.3 b/src/lib/libcrypto/man/d2i_ECPKParameters.3
index c4ede82f3b..8e824951d6 100644
--- a/src/lib/libcrypto/man/d2i_ECPKParameters.3
+++ b/src/lib/libcrypto/man/d2i_ECPKParameters.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_ECPKParameters.3,v 1.13 2024/10/24 21:42:10 tb Exp $ 1.\" $OpenBSD: d2i_ECPKParameters.3,v 1.15 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL 05ea606a May 20 20:52:46 2016 -0400 2.\" OpenSSL 05ea606a May 20 20:52:46 2016 -0400
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: October 24 2024 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt D2I_ECPKPARAMETERS 3 69.Dt D2I_ECPKPARAMETERS 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -98,6 +98,7 @@
98.Nm i2d_EC_PUBKEY_fp 98.Nm i2d_EC_PUBKEY_fp
99.Nd decode and encode ASN.1 representations of elliptic curve entities 99.Nd decode and encode ASN.1 representations of elliptic curve entities
100.Sh SYNOPSIS 100.Sh SYNOPSIS
101.Lb libcrypto
101.In openssl/ec.h 102.In openssl/ec.h
102.Ft EC_GROUP * 103.Ft EC_GROUP *
103.Fo d2i_ECPKParameters 104.Fo d2i_ECPKParameters
@@ -418,8 +419,7 @@ and
418return 1 for success or 0 if an error occurs. 419return 1 for success or 0 if an error occurs.
419.Sh SEE ALSO 420.Sh SEE ALSO
420.Xr ASN1_item_d2i 3 , 421.Xr ASN1_item_d2i 3 ,
421.Xr EC_GROUP_copy 3 , 422.Xr EC_GROUP_new_by_curve_name 3 ,
422.Xr EC_GROUP_new 3 ,
423.Xr EC_KEY_new 3 , 423.Xr EC_KEY_new 3 ,
424.Xr EVP_PKEY_set1_EC_KEY 3 , 424.Xr EVP_PKEY_set1_EC_KEY 3 ,
425.Xr PEM_write_ECPrivateKey 3 , 425.Xr PEM_write_ECPrivateKey 3 ,
diff --git a/src/lib/libcrypto/man/d2i_ESS_SIGNING_CERT.3 b/src/lib/libcrypto/man/d2i_ESS_SIGNING_CERT.3
index c1d61d3b5e..0305ca78a1 100644
--- a/src/lib/libcrypto/man/d2i_ESS_SIGNING_CERT.3
+++ b/src/lib/libcrypto/man/d2i_ESS_SIGNING_CERT.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_ESS_SIGNING_CERT.3,v 1.2 2018/03/23 04:34:23 schwarze Exp $ 1.\" $OpenBSD: d2i_ESS_SIGNING_CERT.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 23 2018 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt D2I_ESS_SIGNING_CERT 3 18.Dt D2I_ESS_SIGNING_CERT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -26,6 +26,7 @@
26.Nm i2d_ESS_ISSUER_SERIAL 26.Nm i2d_ESS_ISSUER_SERIAL
27.Nd decode and encode signing certificates for S/MIME 27.Nd decode and encode signing certificates for S/MIME
28.Sh SYNOPSIS 28.Sh SYNOPSIS
29.Lb libcrypto
29.In openssl/ts.h 30.In openssl/ts.h
30.Ft ESS_SIGNING_CERT * 31.Ft ESS_SIGNING_CERT *
31.Fo d2i_ESS_SIGNING_CERT 32.Fo d2i_ESS_SIGNING_CERT
diff --git a/src/lib/libcrypto/man/d2i_GENERAL_NAME.3 b/src/lib/libcrypto/man/d2i_GENERAL_NAME.3
index bfdcc6c67c..557e5ce353 100644
--- a/src/lib/libcrypto/man/d2i_GENERAL_NAME.3
+++ b/src/lib/libcrypto/man/d2i_GENERAL_NAME.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_GENERAL_NAME.3,v 1.4 2018/03/22 21:08:22 schwarze Exp $ 1.\" $OpenBSD: d2i_GENERAL_NAME.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 22 2018 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt D2I_GENERAL_NAME 3 18.Dt D2I_GENERAL_NAME 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -28,6 +28,7 @@
28.Nm i2d_OTHERNAME 28.Nm i2d_OTHERNAME
29.Nd decode and encode names for use in X.509 extensions 29.Nd decode and encode names for use in X.509 extensions
30.Sh SYNOPSIS 30.Sh SYNOPSIS
31.Lb libcrypto
31.In openssl/x509v3.h 32.In openssl/x509v3.h
32.Ft GENERAL_NAME * 33.Ft GENERAL_NAME *
33.Fo d2i_GENERAL_NAME 34.Fo d2i_GENERAL_NAME
diff --git a/src/lib/libcrypto/man/d2i_OCSP_REQUEST.3 b/src/lib/libcrypto/man/d2i_OCSP_REQUEST.3
index 07a990556d..7d27d2b4c1 100644
--- a/src/lib/libcrypto/man/d2i_OCSP_REQUEST.3
+++ b/src/lib/libcrypto/man/d2i_OCSP_REQUEST.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_OCSP_REQUEST.3,v 1.3 2021/03/12 05:18:00 jsg Exp $ 1.\" $OpenBSD: d2i_OCSP_REQUEST.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 12 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt D2I_OCSP_REQUEST 3 18.Dt D2I_OCSP_REQUEST 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -32,6 +32,7 @@
32.Nm i2d_OCSP_SERVICELOC 32.Nm i2d_OCSP_SERVICELOC
33.Nd decode and encode OCSP requests 33.Nd decode and encode OCSP requests
34.Sh SYNOPSIS 34.Sh SYNOPSIS
35.Lb libcrypto
35.In openssl/ocsp.h 36.In openssl/ocsp.h
36.Ft OCSP_REQUEST * 37.Ft OCSP_REQUEST *
37.Fo d2i_OCSP_REQUEST 38.Fo d2i_OCSP_REQUEST
diff --git a/src/lib/libcrypto/man/d2i_OCSP_RESPONSE.3 b/src/lib/libcrypto/man/d2i_OCSP_RESPONSE.3
index 716e85dc6e..a89c566c12 100644
--- a/src/lib/libcrypto/man/d2i_OCSP_RESPONSE.3
+++ b/src/lib/libcrypto/man/d2i_OCSP_RESPONSE.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_OCSP_RESPONSE.3,v 1.4 2021/03/12 05:18:00 jsg Exp $ 1.\" $OpenBSD: d2i_OCSP_RESPONSE.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 12 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt D2I_OCSP_RESPONSE 3 18.Dt D2I_OCSP_RESPONSE 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -38,6 +38,7 @@
38.Nm i2d_OCSP_CRLID 38.Nm i2d_OCSP_CRLID
39.Nd decode and encode OCSP responses 39.Nd decode and encode OCSP responses
40.Sh SYNOPSIS 40.Sh SYNOPSIS
41.Lb libcrypto
41.In openssl/ocsp.h 42.In openssl/ocsp.h
42.Ft OCSP_RESPONSE * 43.Ft OCSP_RESPONSE *
43.Fo d2i_OCSP_RESPONSE 44.Fo d2i_OCSP_RESPONSE
diff --git a/src/lib/libcrypto/man/d2i_PKCS12.3 b/src/lib/libcrypto/man/d2i_PKCS12.3
index 55272d1f36..2dda946a3f 100644
--- a/src/lib/libcrypto/man/d2i_PKCS12.3
+++ b/src/lib/libcrypto/man/d2i_PKCS12.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_PKCS12.3,v 1.2 2018/03/21 17:57:48 schwarze Exp $ 1.\" $OpenBSD: d2i_PKCS12.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 21 2018 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt D2I_PKCS12 3 18.Dt D2I_PKCS12 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -32,6 +32,7 @@
32.Nm i2d_PKCS12_BAGS 32.Nm i2d_PKCS12_BAGS
33.Nd decode and encode PKCS#12 structures 33.Nd decode and encode PKCS#12 structures
34.Sh SYNOPSIS 34.Sh SYNOPSIS
35.Lb libcrypto
35.In openssl/pkcs12.h 36.In openssl/pkcs12.h
36.Ft PKCS12 * 37.Ft PKCS12 *
37.Fo d2i_PKCS12 38.Fo d2i_PKCS12
diff --git a/src/lib/libcrypto/man/d2i_PKCS7.3 b/src/lib/libcrypto/man/d2i_PKCS7.3
index e587787465..6d72433b7d 100644
--- a/src/lib/libcrypto/man/d2i_PKCS7.3
+++ b/src/lib/libcrypto/man/d2i_PKCS7.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_PKCS7.3,v 1.7 2023/04/25 18:05:07 tb Exp $ 1.\" $OpenBSD: d2i_PKCS7.3,v 1.8 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: April 25 2023 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt D2I_PKCS7 3 18.Dt D2I_PKCS7 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -44,6 +44,7 @@
44.Nm i2d_PKCS7_SIGN_ENVELOPE 44.Nm i2d_PKCS7_SIGN_ENVELOPE
45.Nd decode and encode PKCS#7 data structures 45.Nd decode and encode PKCS#7 data structures
46.Sh SYNOPSIS 46.Sh SYNOPSIS
47.Lb libcrypto
47.In openssl/pkcs7.h 48.In openssl/pkcs7.h
48.Ft PKCS7 * 49.Ft PKCS7 *
49.Fo d2i_PKCS7 50.Fo d2i_PKCS7
diff --git a/src/lib/libcrypto/man/d2i_PKCS8PrivateKey_bio.3 b/src/lib/libcrypto/man/d2i_PKCS8PrivateKey_bio.3
index 58dd989fae..41ab7ebcba 100644
--- a/src/lib/libcrypto/man/d2i_PKCS8PrivateKey_bio.3
+++ b/src/lib/libcrypto/man/d2i_PKCS8PrivateKey_bio.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_PKCS8PrivateKey_bio.3,v 1.11 2019/06/07 19:28:52 schwarze Exp $ 1.\" $OpenBSD: d2i_PKCS8PrivateKey_bio.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 2.\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 7 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt D2I_PKCS8PRIVATEKEY_BIO 3 52.Dt D2I_PKCS8PRIVATEKEY_BIO 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -60,6 +60,7 @@
60.Nm i2d_PKCS8PrivateKey_nid_fp 60.Nm i2d_PKCS8PrivateKey_nid_fp
61.Nd PKCS#8 format private key functions 61.Nd PKCS#8 format private key functions
62.Sh SYNOPSIS 62.Sh SYNOPSIS
63.Lb libcrypto
63.In openssl/evp.h 64.In openssl/evp.h
64.Ft EVP_PKEY * 65.Ft EVP_PKEY *
65.Fo d2i_PKCS8PrivateKey_bio 66.Fo d2i_PKCS8PrivateKey_bio
diff --git a/src/lib/libcrypto/man/d2i_PKCS8_PRIV_KEY_INFO.3 b/src/lib/libcrypto/man/d2i_PKCS8_PRIV_KEY_INFO.3
index 1ac0f2c308..583fd536f2 100644
--- a/src/lib/libcrypto/man/d2i_PKCS8_PRIV_KEY_INFO.3
+++ b/src/lib/libcrypto/man/d2i_PKCS8_PRIV_KEY_INFO.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_PKCS8_PRIV_KEY_INFO.3,v 1.3 2018/03/21 21:18:08 schwarze Exp $ 1.\" $OpenBSD: d2i_PKCS8_PRIV_KEY_INFO.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 21 2018 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt D2I_PKCS8_PRIV_KEY_INFO 3 18.Dt D2I_PKCS8_PRIV_KEY_INFO 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -26,6 +26,7 @@
26.Nm i2d_PKCS8_PRIV_KEY_INFO_fp 26.Nm i2d_PKCS8_PRIV_KEY_INFO_fp
27.Nd decode and encode PKCS#8 private key 27.Nd decode and encode PKCS#8 private key
28.Sh SYNOPSIS 28.Sh SYNOPSIS
29.Lb libcrypto
29.In openssl/x509.h 30.In openssl/x509.h
30.Ft PKCS8_PRIV_KEY_INFO * 31.Ft PKCS8_PRIV_KEY_INFO *
31.Fo d2i_PKCS8_PRIV_KEY_INFO 32.Fo d2i_PKCS8_PRIV_KEY_INFO
diff --git a/src/lib/libcrypto/man/d2i_PKEY_USAGE_PERIOD.3 b/src/lib/libcrypto/man/d2i_PKEY_USAGE_PERIOD.3
index df8639264c..1c3a215a38 100644
--- a/src/lib/libcrypto/man/d2i_PKEY_USAGE_PERIOD.3
+++ b/src/lib/libcrypto/man/d2i_PKEY_USAGE_PERIOD.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_PKEY_USAGE_PERIOD.3,v 1.2 2018/03/21 16:09:51 schwarze Exp $ 1.\" $OpenBSD: d2i_PKEY_USAGE_PERIOD.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 21 2018 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt D2I_PKEY_USAGE_PERIOD 3 18.Dt D2I_PKEY_USAGE_PERIOD 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm i2d_PKEY_USAGE_PERIOD 22.Nm i2d_PKEY_USAGE_PERIOD
23.Nd decode and encode X.509 key usage period extensions 23.Nd decode and encode X.509 key usage period extensions
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/x509v3.h 26.In openssl/x509v3.h
26.Ft PKEY_USAGE_PERIOD * 27.Ft PKEY_USAGE_PERIOD *
27.Fo d2i_PKEY_USAGE_PERIOD 28.Fo d2i_PKEY_USAGE_PERIOD
diff --git a/src/lib/libcrypto/man/d2i_POLICYINFO.3 b/src/lib/libcrypto/man/d2i_POLICYINFO.3
index bae78b17c7..c335edc1df 100644
--- a/src/lib/libcrypto/man/d2i_POLICYINFO.3
+++ b/src/lib/libcrypto/man/d2i_POLICYINFO.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_POLICYINFO.3,v 1.2 2018/03/21 17:57:48 schwarze Exp $ 1.\" $OpenBSD: d2i_POLICYINFO.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 21 2018 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt D2I_POLICYINFO 3 18.Dt D2I_POLICYINFO 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -30,6 +30,7 @@
30.Nm i2d_NOTICEREF 30.Nm i2d_NOTICEREF
31.Nd decode and encode X.509 certificate policies 31.Nd decode and encode X.509 certificate policies
32.Sh SYNOPSIS 32.Sh SYNOPSIS
33.Lb libcrypto
33.In openssl/x509v3.h 34.In openssl/x509v3.h
34.Ft POLICYINFO * 35.Ft POLICYINFO *
35.Fo d2i_POLICYINFO 36.Fo d2i_POLICYINFO
diff --git a/src/lib/libcrypto/man/d2i_PrivateKey.3 b/src/lib/libcrypto/man/d2i_PrivateKey.3
index b544ea0e9a..48f1b93a19 100644
--- a/src/lib/libcrypto/man/d2i_PrivateKey.3
+++ b/src/lib/libcrypto/man/d2i_PrivateKey.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_PrivateKey.3,v 1.11 2024/10/24 21:42:10 tb Exp $ 1.\" $OpenBSD: d2i_PrivateKey.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL b0edda11 Mar 20 13:00:17 2018 +0000 2.\" full merge up to: OpenSSL b0edda11 Mar 20 13:00:17 2018 +0000
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: October 24 2024 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt D2I_PRIVATEKEY 3 69.Dt D2I_PRIVATEKEY 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -82,6 +82,7 @@
82.Nm i2d_PublicKey 82.Nm i2d_PublicKey
83.Nd decode and encode EVP_PKEY objects 83.Nd decode and encode EVP_PKEY objects
84.Sh SYNOPSIS 84.Sh SYNOPSIS
85.Lb libcrypto
85.In openssl/evp.h 86.In openssl/evp.h
86.Ft EVP_PKEY * 87.Ft EVP_PKEY *
87.Fo d2i_PrivateKey 88.Fo d2i_PrivateKey
diff --git a/src/lib/libcrypto/man/d2i_RSAPublicKey.3 b/src/lib/libcrypto/man/d2i_RSAPublicKey.3
index d6c376d84b..3f738641df 100644
--- a/src/lib/libcrypto/man/d2i_RSAPublicKey.3
+++ b/src/lib/libcrypto/man/d2i_RSAPublicKey.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_RSAPublicKey.3,v 1.13 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: d2i_RSAPublicKey.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400 2.\" OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -67,7 +67,7 @@
67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
69.\" 69.\"
70.Dd $Mdocdate: March 27 2018 $ 70.Dd $Mdocdate: June 8 2025 $
71.Dt D2I_RSAPUBLICKEY 3 71.Dt D2I_RSAPUBLICKEY 3
72.Os 72.Os
73.Sh NAME 73.Sh NAME
@@ -95,6 +95,7 @@
95.Nm i2d_RSA_PUBKEY_fp 95.Nm i2d_RSA_PUBKEY_fp
96.Nd decode and encode RSA keys and parameters 96.Nd decode and encode RSA keys and parameters
97.Sh SYNOPSIS 97.Sh SYNOPSIS
98.Lb libcrypto
98.In openssl/rsa.h 99.In openssl/rsa.h
99.Ft RSA * 100.Ft RSA *
100.Fo d2i_RSAPublicKey 101.Fo d2i_RSAPublicKey
diff --git a/src/lib/libcrypto/man/d2i_TS_REQ.3 b/src/lib/libcrypto/man/d2i_TS_REQ.3
index 9f7c860fa1..87e9a402b8 100644
--- a/src/lib/libcrypto/man/d2i_TS_REQ.3
+++ b/src/lib/libcrypto/man/d2i_TS_REQ.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_TS_REQ.3,v 1.2 2018/03/23 04:34:23 schwarze Exp $ 1.\" $OpenBSD: d2i_TS_REQ.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 23 2018 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt D2I_TS_REQ 3 18.Dt D2I_TS_REQ 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -48,6 +48,7 @@
48.Nm i2d_TS_MSG_IMPRINT_fp 48.Nm i2d_TS_MSG_IMPRINT_fp
49.Nd decode and encode X.509 time-stamp protocol structures 49.Nd decode and encode X.509 time-stamp protocol structures
50.Sh SYNOPSIS 50.Sh SYNOPSIS
51.Lb libcrypto
51.In openssl/ts.h 52.In openssl/ts.h
52.Ft TS_REQ * 53.Ft TS_REQ *
53.Fo d2i_TS_REQ 54.Fo d2i_TS_REQ
diff --git a/src/lib/libcrypto/man/d2i_X509.3 b/src/lib/libcrypto/man/d2i_X509.3
index 6102e49e0e..2905e49aca 100644
--- a/src/lib/libcrypto/man/d2i_X509.3
+++ b/src/lib/libcrypto/man/d2i_X509.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_X509.3,v 1.11 2021/10/27 10:35:43 schwarze Exp $ 1.\" $OpenBSD: d2i_X509.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL d2i_X509.pod checked up to: 2.\" OpenSSL d2i_X509.pod checked up to:
3.\" 256989ce4 Jun 19 15:00:32 2020 +0200 3.\" 256989ce4 Jun 19 15:00:32 2020 +0200
4.\" OpenSSL i2d_re_X509_tbs.pod checked up to: 4.\" OpenSSL i2d_re_X509_tbs.pod checked up to:
@@ -71,7 +71,7 @@
71.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 71.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
72.\" OF THE POSSIBILITY OF SUCH DAMAGE. 72.\" OF THE POSSIBILITY OF SUCH DAMAGE.
73.\" 73.\"
74.Dd $Mdocdate: October 27 2021 $ 74.Dd $Mdocdate: June 8 2025 $
75.Dt D2I_X509 3 75.Dt D2I_X509 3
76.Os 76.Os
77.Sh NAME 77.Sh NAME
@@ -94,6 +94,7 @@
94.Nm i2d_re_X509_REQ_tbs 94.Nm i2d_re_X509_REQ_tbs
95.Nd decode and encode X.509 certificates 95.Nd decode and encode X.509 certificates
96.Sh SYNOPSIS 96.Sh SYNOPSIS
97.Lb libcrypto
97.In openssl/x509.h 98.In openssl/x509.h
98.Ft X509 * 99.Ft X509 *
99.Fo d2i_X509 100.Fo d2i_X509
diff --git a/src/lib/libcrypto/man/d2i_X509_ALGOR.3 b/src/lib/libcrypto/man/d2i_X509_ALGOR.3
index 252f3fc344..2691ceda85 100644
--- a/src/lib/libcrypto/man/d2i_X509_ALGOR.3
+++ b/src/lib/libcrypto/man/d2i_X509_ALGOR.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_X509_ALGOR.3,v 1.11 2025/03/14 21:32:15 tb Exp $ 1.\" $OpenBSD: d2i_X509_ALGOR.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016, 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016, 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 14 2025 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt D2I_X509_ALGOR 3 18.Dt D2I_X509_ALGOR 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -24,6 +24,7 @@
24.Nm i2d_X509_ALGORS 24.Nm i2d_X509_ALGORS
25.Nd decode and encode algorithm identifiers 25.Nd decode and encode algorithm identifiers
26.Sh SYNOPSIS 26.Sh SYNOPSIS
27.Lb libcrypto
27.In openssl/x509.h 28.In openssl/x509.h
28.Ft X509_ALGOR * 29.Ft X509_ALGOR *
29.Fo d2i_X509_ALGOR 30.Fo d2i_X509_ALGOR
diff --git a/src/lib/libcrypto/man/d2i_X509_ATTRIBUTE.3 b/src/lib/libcrypto/man/d2i_X509_ATTRIBUTE.3
index 6b070e5e51..be4924d3e0 100644
--- a/src/lib/libcrypto/man/d2i_X509_ATTRIBUTE.3
+++ b/src/lib/libcrypto/man/d2i_X509_ATTRIBUTE.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_X509_ATTRIBUTE.3,v 1.3 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: d2i_X509_ATTRIBUTE.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 27 2018 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt D2I_X509_ATTRIBUTE 3 18.Dt D2I_X509_ATTRIBUTE 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -25,6 +25,7 @@
25.\" The type in called "Attribute" with capital "A", not "attribute". 25.\" The type in called "Attribute" with capital "A", not "attribute".
26.Nd decode and encode generic X.501 Attribute 26.Nd decode and encode generic X.501 Attribute
27.Sh SYNOPSIS 27.Sh SYNOPSIS
28.Lb libcrypto
28.In openssl/x509.h 29.In openssl/x509.h
29.Ft X509_ATTRIBUTE * 30.Ft X509_ATTRIBUTE *
30.Fo d2i_X509_ATTRIBUTE 31.Fo d2i_X509_ATTRIBUTE
diff --git a/src/lib/libcrypto/man/d2i_X509_CRL.3 b/src/lib/libcrypto/man/d2i_X509_CRL.3
index 948c283b51..040ac0395f 100644
--- a/src/lib/libcrypto/man/d2i_X509_CRL.3
+++ b/src/lib/libcrypto/man/d2i_X509_CRL.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_X509_CRL.3,v 1.9 2024/03/06 02:34:14 tb Exp $ 1.\" $OpenBSD: d2i_X509_CRL.3,v 1.11 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016, 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016, 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 6 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt D2I_X509_CRL 3 18.Dt D2I_X509_CRL 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -30,6 +30,7 @@
30.Nm i2d_X509_REVOKED 30.Nm i2d_X509_REVOKED
31.Nd decode and encode X.509 certificate revocation lists 31.Nd decode and encode X.509 certificate revocation lists
32.Sh SYNOPSIS 32.Sh SYNOPSIS
33.Lb libcrypto
33.In openssl/x509.h 34.In openssl/x509.h
34.Ft X509_CRL * 35.Ft X509_CRL *
35.Fo d2i_X509_CRL 36.Fo d2i_X509_CRL
@@ -45,22 +46,22 @@
45.Ft X509_CRL * 46.Ft X509_CRL *
46.Fo d2i_X509_CRL_bio 47.Fo d2i_X509_CRL_bio
47.Fa "BIO *in_bio" 48.Fa "BIO *in_bio"
48.Fa "X509_CRL **der_out" 49.Fa "X509_CRL **val_out"
49.Fc 50.Fc
50.Ft X509_CRL * 51.Ft X509_CRL *
51.Fo d2i_X509_CRL_fp 52.Fo d2i_X509_CRL_fp
52.Fa "FILE *in_fp" 53.Fa "FILE *in_fp"
53.Fa "X509_CRL **der_out" 54.Fa "X509_CRL **val_out"
54.Fc 55.Fc
55.Ft int 56.Ft int
56.Fo i2d_X509_CRL_bio 57.Fo i2d_X509_CRL_bio
57.Fa "BIO *out_bio" 58.Fa "BIO *out_bio"
58.Fa "X509_CRL *der_in" 59.Fa "X509_CRL *val_in"
59.Fc 60.Fc
60.Ft int 61.Ft int
61.Fo i2d_X509_CRL_fp 62.Fo i2d_X509_CRL_fp
62.Fa "FILE *out_fp" 63.Fa "FILE *out_fp"
63.Fa "X509_CRL *der_in" 64.Fa "X509_CRL *val_in"
64.Fc 65.Fc
65.Ft X509_CRL_INFO * 66.Ft X509_CRL_INFO *
66.Fo d2i_X509_CRL_INFO 67.Fo d2i_X509_CRL_INFO
diff --git a/src/lib/libcrypto/man/d2i_X509_EXTENSION.3 b/src/lib/libcrypto/man/d2i_X509_EXTENSION.3
index 46a680c1ba..3e1011d180 100644
--- a/src/lib/libcrypto/man/d2i_X509_EXTENSION.3
+++ b/src/lib/libcrypto/man/d2i_X509_EXTENSION.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_X509_EXTENSION.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: d2i_X509_EXTENSION.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: March 27 2018 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt D2I_X509_EXTENSION 3 18.Dt D2I_X509_EXTENSION 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -26,6 +26,7 @@
26.\" The ASN.1 structure is called "Extensions", not "extensions". 26.\" The ASN.1 structure is called "Extensions", not "extensions".
27.Nd decode and encode X.509 Extensions 27.Nd decode and encode X.509 Extensions
28.Sh SYNOPSIS 28.Sh SYNOPSIS
29.Lb libcrypto
29.In openssl/x509.h 30.In openssl/x509.h
30.Ft X509_EXTENSION * 31.Ft X509_EXTENSION *
31.Fo d2i_X509_EXTENSION 32.Fo d2i_X509_EXTENSION
diff --git a/src/lib/libcrypto/man/d2i_X509_NAME.3 b/src/lib/libcrypto/man/d2i_X509_NAME.3
index f5cafaee97..c8df55f10d 100644
--- a/src/lib/libcrypto/man/d2i_X509_NAME.3
+++ b/src/lib/libcrypto/man/d2i_X509_NAME.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_X509_NAME.3,v 1.18 2025/03/14 21:32:15 tb Exp $ 1.\" $OpenBSD: d2i_X509_NAME.3,v 1.19 2025/06/08 22:40:30 schwarze Exp $
2.\" checked up to: 2.\" checked up to:
3.\" OpenSSL crypto/d2i_X509_NAME 4692340e Jun 7 15:49:08 2016 -0400 and 3.\" OpenSSL crypto/d2i_X509_NAME 4692340e Jun 7 15:49:08 2016 -0400 and
4.\" OpenSSL man3/X509_NAME_get0_der 99d63d46 Oct 26 13:56:48 2016 -0400 4.\" OpenSSL man3/X509_NAME_get0_der 99d63d46 Oct 26 13:56:48 2016 -0400
@@ -17,7 +17,7 @@
17.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19.\" 19.\"
20.Dd $Mdocdate: March 14 2025 $ 20.Dd $Mdocdate: June 8 2025 $
21.Dt D2I_X509_NAME 3 21.Dt D2I_X509_NAME 3
22.Os 22.Os
23.Sh NAME 23.Sh NAME
@@ -34,6 +34,7 @@
34.\" The type is called "Name" with capital "N", not "name". 34.\" The type is called "Name" with capital "N", not "name".
35.Nd decode and encode X.501 Name objects 35.Nd decode and encode X.501 Name objects
36.Sh SYNOPSIS 36.Sh SYNOPSIS
37.Lb libcrypto
37.In openssl/x509.h 38.In openssl/x509.h
38.Ft X509_NAME * 39.Ft X509_NAME *
39.Fo d2i_X509_NAME 40.Fo d2i_X509_NAME
diff --git a/src/lib/libcrypto/man/d2i_X509_REQ.3 b/src/lib/libcrypto/man/d2i_X509_REQ.3
index 95785a2d25..0f113757ee 100644
--- a/src/lib/libcrypto/man/d2i_X509_REQ.3
+++ b/src/lib/libcrypto/man/d2i_X509_REQ.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_X509_REQ.3,v 1.7 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: d2i_X509_REQ.3,v 1.8 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400 2.\" OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400
3.\" 3.\"
4.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 4.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,7 +15,7 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 17.\"
18.Dd $Mdocdate: March 27 2018 $ 18.Dd $Mdocdate: June 8 2025 $
19.Dt D2I_X509_REQ 3 19.Dt D2I_X509_REQ 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
@@ -29,6 +29,7 @@
29.Nm i2d_X509_REQ_INFO 29.Nm i2d_X509_REQ_INFO
30.Nd decode and encode PKCS#10 certification requests 30.Nd decode and encode PKCS#10 certification requests
31.Sh SYNOPSIS 31.Sh SYNOPSIS
32.Lb libcrypto
32.In openssl/x509.h 33.In openssl/x509.h
33.Ft X509_REQ * 34.Ft X509_REQ *
34.Fo d2i_X509_REQ 35.Fo d2i_X509_REQ
diff --git a/src/lib/libcrypto/man/d2i_X509_SIG.3 b/src/lib/libcrypto/man/d2i_X509_SIG.3
index c9fbf86633..1700b2d728 100644
--- a/src/lib/libcrypto/man/d2i_X509_SIG.3
+++ b/src/lib/libcrypto/man/d2i_X509_SIG.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_X509_SIG.3,v 1.10 2025/03/14 21:32:15 tb Exp $ 1.\" $OpenBSD: d2i_X509_SIG.3,v 1.11 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 2.\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400
3.\" 3.\"
4.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 4.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,7 +15,7 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 17.\"
18.Dd $Mdocdate: March 14 2025 $ 18.Dd $Mdocdate: June 8 2025 $
19.Dt D2I_X509_SIG 3 19.Dt D2I_X509_SIG 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
@@ -29,6 +29,7 @@
29.\" These functions are misnamed. 29.\" These functions are misnamed.
30.Nd decode and encode PKCS#7 digest information 30.Nd decode and encode PKCS#7 digest information
31.Sh SYNOPSIS 31.Sh SYNOPSIS
32.Lb libcrypto
32.In openssl/x509.h 33.In openssl/x509.h
33.Ft X509_SIG * 34.Ft X509_SIG *
34.Fo d2i_X509_SIG 35.Fo d2i_X509_SIG
diff --git a/src/lib/libcrypto/man/des_read_pw.3 b/src/lib/libcrypto/man/des_read_pw.3
index 7cb35b47f8..2ffe13bbe9 100644
--- a/src/lib/libcrypto/man/des_read_pw.3
+++ b/src/lib/libcrypto/man/des_read_pw.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: des_read_pw.3,v 1.12 2024/08/24 07:48:37 tb Exp $ 1.\" $OpenBSD: des_read_pw.3,v 1.13 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL doc/crypto/des.pod 2.\" full merge up to: OpenSSL doc/crypto/des.pod
3.\" 53934822 Jun 9 16:39:19 2016 -0400 3.\" 53934822 Jun 9 16:39:19 2016 -0400
4.\" 4.\"
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: August 24 2024 $ 69.Dd $Mdocdate: June 8 2025 $
70.Dt DES_READ_PW 3 70.Dt DES_READ_PW 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -76,6 +76,7 @@
76.Nm EVP_get_pw_prompt 76.Nm EVP_get_pw_prompt
77.Nd compatibility user interface functions 77.Nd compatibility user interface functions
78.Sh SYNOPSIS 78.Sh SYNOPSIS
79.Lb libcrypto
79.In openssl/evp.h 80.In openssl/evp.h
80.Ft int 81.Ft int
81.Fo EVP_read_pw_string 82.Fo EVP_read_pw_string
diff --git a/src/lib/libcrypto/man/evp.3 b/src/lib/libcrypto/man/evp.3
index 2c54c0f981..3a7acf1ff8 100644
--- a/src/lib/libcrypto/man/evp.3
+++ b/src/lib/libcrypto/man/evp.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: evp.3,v 1.36 2024/12/06 14:27:49 schwarze Exp $ 1.\" $OpenBSD: evp.3,v 1.38 2025/06/11 13:48:54 schwarze Exp $
2.\" full merge up to: OpenSSL man7/evp 24a535ea Sep 22 13:14:20 2020 +0100 2.\" full merge up to: OpenSSL man7/evp 24a535ea Sep 22 13:14:20 2020 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>, 4.\" This file was written by Ulf Moeller <ulf@openssl.org>,
@@ -51,13 +51,14 @@
51.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
52.\" OF THE POSSIBILITY OF SUCH DAMAGE. 52.\" OF THE POSSIBILITY OF SUCH DAMAGE.
53.\" 53.\"
54.Dd $Mdocdate: December 6 2024 $ 54.Dd $Mdocdate: June 11 2025 $
55.Dt EVP 3 55.Dt EVP 3
56.Os 56.Os
57.Sh NAME 57.Sh NAME
58.Nm evp 58.Nm evp
59.Nd high-level cryptographic functions 59.Nd high-level cryptographic functions
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libcrypto
61.In openssl/evp.h 62.In openssl/evp.h
62.Sh DESCRIPTION 63.Sh DESCRIPTION
63The EVP library provides a high-level interface to cryptographic 64The EVP library provides a high-level interface to cryptographic
@@ -75,7 +76,7 @@ in contexts like
75.Xr EVP_SealInit 3 , 76.Xr EVP_SealInit 3 ,
76.Xr PKCS7_encrypt 3 , 77.Xr PKCS7_encrypt 3 ,
77or 78or
78.Xr SMIME_write_ASN1 3 . 79.Xr SMIME_write_PKCS7 3 .
79.Pp 80.Pp
80.Xr EVP_SealInit 3 81.Xr EVP_SealInit 3
81and 82and
diff --git a/src/lib/libcrypto/man/i2a_ASN1_STRING.3 b/src/lib/libcrypto/man/i2a_ASN1_STRING.3
index 7d46474775..c16259e565 100644
--- a/src/lib/libcrypto/man/i2a_ASN1_STRING.3
+++ b/src/lib/libcrypto/man/i2a_ASN1_STRING.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: i2a_ASN1_STRING.3,v 1.5 2024/12/27 15:30:17 schwarze Exp $ 1.\" $OpenBSD: i2a_ASN1_STRING.3,v 1.6 2025/06/08 22:40:30 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2019, 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2019, 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: December 27 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt I2A_ASN1_STRING 3 18.Dt I2A_ASN1_STRING 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -26,6 +26,7 @@
26.Nm a2i_ASN1_ENUMERATED 26.Nm a2i_ASN1_ENUMERATED
27.Nd hexadecimal dump of an ASN.1 string 27.Nd hexadecimal dump of an ASN.1 string
28.Sh SYNOPSIS 28.Sh SYNOPSIS
29.Lb libcrypto
29.In openssl/asn1.h 30.In openssl/asn1.h
30.Ft int 31.Ft int
31.Fo i2a_ASN1_STRING 32.Fo i2a_ASN1_STRING
diff --git a/src/lib/libcrypto/man/i2d_CMS_bio_stream.3 b/src/lib/libcrypto/man/i2d_CMS_bio_stream.3
index b60468464c..403f7c2906 100644
--- a/src/lib/libcrypto/man/i2d_CMS_bio_stream.3
+++ b/src/lib/libcrypto/man/i2d_CMS_bio_stream.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: i2d_CMS_bio_stream.3,v 1.6 2023/05/01 07:28:11 tb Exp $ 1.\" $OpenBSD: i2d_CMS_bio_stream.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 2.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: May 1 2023 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt I2D_CMS_BIO_STREAM 3 52.Dt I2D_CMS_BIO_STREAM 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm i2d_CMS_bio_stream 55.Nm i2d_CMS_bio_stream
56.Nd output CMS_ContentInfo structure in BER format 56.Nd output CMS_ContentInfo structure in BER format
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libcrypto
58.In openssl/cms.h 59.In openssl/cms.h
59.Ft int 60.Ft int
60.Fo i2d_CMS_bio_stream 61.Fo i2d_CMS_bio_stream
diff --git a/src/lib/libcrypto/man/i2d_PKCS7_bio_stream.3 b/src/lib/libcrypto/man/i2d_PKCS7_bio_stream.3
index 7a47ba3026..3636960aa2 100644
--- a/src/lib/libcrypto/man/i2d_PKCS7_bio_stream.3
+++ b/src/lib/libcrypto/man/i2d_PKCS7_bio_stream.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: i2d_PKCS7_bio_stream.3,v 1.11 2023/05/01 07:28:11 tb Exp $ 1.\" $OpenBSD: i2d_PKCS7_bio_stream.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $
2.\" OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 2.\" OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -49,13 +49,14 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: May 1 2023 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt I2D_PKCS7_BIO_STREAM 3 53.Dt I2D_PKCS7_BIO_STREAM 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
56.Nm i2d_PKCS7_bio_stream 56.Nm i2d_PKCS7_bio_stream
57.Nd output PKCS7 structure in BER format 57.Nd output PKCS7 structure in BER format
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libcrypto
59.In openssl/pkcs7.h 60.In openssl/pkcs7.h
60.Ft int 61.Ft int
61.Fo i2d_PKCS7_bio_stream 62.Fo i2d_PKCS7_bio_stream
diff --git a/src/lib/libcrypto/man/lh_new.3 b/src/lib/libcrypto/man/lh_new.3
index 2550a7d2e7..cc0b3d6b96 100644
--- a/src/lib/libcrypto/man/lh_new.3
+++ b/src/lib/libcrypto/man/lh_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: lh_new.3,v 1.13 2024/03/05 22:15:29 tb Exp $ 1.\" $OpenBSD: lh_new.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL doc/crypto/lhash.pod 1bc74519 May 20 08:11:46 2016 -0400 3.\" OpenSSL doc/crypto/lhash.pod 1bc74519 May 20 08:11:46 2016 -0400
4.\" selective merge up to: 4.\" selective merge up to:
@@ -118,7 +118,7 @@
118.\" copied and put under another distribution licence 118.\" copied and put under another distribution licence
119.\" [including the GNU Public Licence.] 119.\" [including the GNU Public Licence.]
120.\" 120.\"
121.Dd $Mdocdate: March 5 2024 $ 121.Dd $Mdocdate: June 8 2025 $
122.Dt LH_NEW 3 122.Dt LH_NEW 3
123.Os 123.Os
124.Sh NAME 124.Sh NAME
@@ -137,6 +137,7 @@
137.Nm lh_strhash 137.Nm lh_strhash
138.Nd dynamic hash table 138.Nd dynamic hash table
139.Sh SYNOPSIS 139.Sh SYNOPSIS
140.Lb libcrypto
140.In openssl/lhash.h 141.In openssl/lhash.h
141.Fn DECLARE_LHASH_OF <type> 142.Fn DECLARE_LHASH_OF <type>
142.Ft LHASH * 143.Ft LHASH *
diff --git a/src/lib/libcrypto/man/s2i_ASN1_INTEGER.3 b/src/lib/libcrypto/man/s2i_ASN1_INTEGER.3
index a2105bc4bc..16646c69d1 100644
--- a/src/lib/libcrypto/man/s2i_ASN1_INTEGER.3
+++ b/src/lib/libcrypto/man/s2i_ASN1_INTEGER.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: s2i_ASN1_INTEGER.3,v 1.9 2024/12/27 15:30:17 schwarze Exp $ 1.\" $OpenBSD: s2i_ASN1_INTEGER.3,v 1.11 2025/06/13 18:34:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> 3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: December 27 2024 $ 17.Dd $Mdocdate: June 13 2025 $
18.Dt S2I_ASN1_INTEGER 3 18.Dt S2I_ASN1_INTEGER 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -26,35 +26,36 @@
26.Nm s2i_ASN1_OCTET_STRING 26.Nm s2i_ASN1_OCTET_STRING
27.Nd ASN.1 data type conversion utilities for certificate extensions 27.Nd ASN.1 data type conversion utilities for certificate extensions
28.Sh SYNOPSIS 28.Sh SYNOPSIS
29.Lb libcrypto
29.In openssl/asn1.h 30.In openssl/asn1.h
30.In openssl/x509v3.h 31.In openssl/x509v3.h
31.Ft "char *" 32.Ft char *
32.Fo i2s_ASN1_ENUMERATED 33.Fo i2s_ASN1_ENUMERATED
33.Fa "X509V3_EXT_METHOD *method" 34.Fa "X509V3_EXT_METHOD *method"
34.Fa "const ASN1_ENUMERATED *a" 35.Fa "const ASN1_ENUMERATED *a"
35.Fc 36.Fc
36.Ft "char *" 37.Ft char *
37.Fo i2s_ASN1_INTEGER 38.Fo i2s_ASN1_INTEGER
38.Fa "X509V3_EXT_METHOD *method" 39.Fa "X509V3_EXT_METHOD *method"
39.Fa "const ASN1_INTEGER *a" 40.Fa "const ASN1_INTEGER *a"
40.Fc 41.Fc
41.Ft "ASN1_INTEGER *" 42.Ft ASN1_INTEGER *
42.Fo s2i_ASN1_INTEGER 43.Fo s2i_ASN1_INTEGER
43.Fa "X509V3_EXT_METHOD *method" 44.Fa "X509V3_EXT_METHOD *method"
44.Fa "const char *value" 45.Fa "const char *value"
45.Fc 46.Fc
46.Ft "char *" 47.Ft char *
47.Fo i2s_ASN1_OCTET_STRING 48.Fo i2s_ASN1_OCTET_STRING
48.Fa "X509V3_EXT_METHOD *method" 49.Fa "X509V3_EXT_METHOD *method"
49.Fa "const ASN1_OCTET_STRING *aos" 50.Fa "const ASN1_OCTET_STRING *aos"
50.Fc 51.Fc
51.Ft "ASN1_OCTET_STRING *" 52.Ft ASN1_OCTET_STRING *
52.Fo s2i_ASN1_OCTET_STRING 53.Fo s2i_ASN1_OCTET_STRING
53.Fa "X509V3_EXT_METHOD *method" 54.Fa "X509V3_EXT_METHOD *method"
54.Fa "X509V3_CTX *ctx" 55.Fa "X509V3_CTX *ctx"
55.Fa "const char *value" 56.Fa "const char *value"
56.Fc 57.Fc
57.Ft "char *" 58.Ft char *
58.Fo i2s_ASN1_ENUMERATED_TABLE 59.Fo i2s_ASN1_ENUMERATED_TABLE
59.Fa "X509V3_EXT_METHOD *method" 60.Fa "X509V3_EXT_METHOD *method"
60.Fa "const ASN1_ENUMERATED *a" 61.Fa "const ASN1_ENUMERATED *a"
diff --git a/src/lib/libcrypto/man/v2i_ASN1_BIT_STRING.3 b/src/lib/libcrypto/man/v2i_ASN1_BIT_STRING.3
index 36d9f7496b..107a57ae35 100644
--- a/src/lib/libcrypto/man/v2i_ASN1_BIT_STRING.3
+++ b/src/lib/libcrypto/man/v2i_ASN1_BIT_STRING.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: v2i_ASN1_BIT_STRING.3,v 1.1 2024/12/24 09:48:56 schwarze Exp $ 1.\" $OpenBSD: v2i_ASN1_BIT_STRING.3,v 1.2 2025/06/08 22:40:31 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: December 24 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt V2I_ASN1_BIT_STRING 3 18.Dt V2I_ASN1_BIT_STRING 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm i2v_ASN1_BIT_STRING 22.Nm i2v_ASN1_BIT_STRING
23.Nd ASN.1 BIT STRING utility functions for certificate extensions 23.Nd ASN.1 BIT STRING utility functions for certificate extensions
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libcrypto
25.In openssl/x509v3.h 26.In openssl/x509v3.h
26.Ft ASN1_BIT_STRING * 27.Ft ASN1_BIT_STRING *
27.Fo v2i_ASN1_BIT_STRING 28.Fo v2i_ASN1_BIT_STRING
diff --git a/src/lib/libcrypto/mlkem/mlkem.h b/src/lib/libcrypto/mlkem/mlkem.h
index a5645facc6..a2c5d7fed0 100644
--- a/src/lib/libcrypto/mlkem/mlkem.h
+++ b/src/lib/libcrypto/mlkem/mlkem.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: mlkem.h,v 1.4 2024/12/19 23:52:26 tb Exp $ */ 1/* $OpenBSD: mlkem.h,v 1.6 2025/05/19 06:47:40 beck Exp $ */
2/* 2/*
3 * Copyright (c) 2024, Google Inc. 3 * Copyright (c) 2024, Google Inc.
4 * 4 *
@@ -25,10 +25,6 @@
25extern "C" { 25extern "C" {
26#endif 26#endif
27 27
28/* Hack for now */
29struct cbs_st;
30struct cbb_st;
31
32/* 28/*
33 * ML-KEM-768 29 * ML-KEM-768
34 * 30 *
@@ -78,10 +74,10 @@ struct MLKEM768_private_key {
78/* 74/*
79 * MLKEM_generate_key generates a random public/private key pair, writes the 75 * MLKEM_generate_key generates a random public/private key pair, writes the
80 * encoded public key to |out_encoded_public_key| and sets |out_private_key| to 76 * encoded public key to |out_encoded_public_key| and sets |out_private_key| to
81 * the private key. If |optional_out_seed| us not NULL then te seed used to 77 * the private key. If |optional_out_seed| is not NULL then the seed used to
82 * generate te private key is written to it. 78 * generate the private key is written to it.
83 */ 79 */
84void MLKEM768_generate_key( 80int MLKEM768_generate_key(
85 uint8_t out_encoded_public_key[MLKEM768_PUBLIC_KEY_BYTES], 81 uint8_t out_encoded_public_key[MLKEM768_PUBLIC_KEY_BYTES],
86 uint8_t optional_out_seed[MLKEM_SEED_BYTES], 82 uint8_t optional_out_seed[MLKEM_SEED_BYTES],
87 struct MLKEM768_private_key *out_private_key); 83 struct MLKEM768_private_key *out_private_key);
@@ -137,7 +133,7 @@ int MLKEM768_decap(uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES],
137 * format for ML-KEM public keys. It returns one on success or zero on allocation 133 * format for ML-KEM public keys. It returns one on success or zero on allocation
138 * error. 134 * error.
139 */ 135 */
140int MLKEM768_marshal_public_key(struct cbb_st *out, 136int MLKEM768_marshal_public_key(uint8_t **output, size_t *output_len,
141 const struct MLKEM768_public_key *public_key); 137 const struct MLKEM768_public_key *public_key);
142 138
143/* 139/*
@@ -147,7 +143,7 @@ int MLKEM768_marshal_public_key(struct cbb_st *out,
147 * there are trailing bytes in |in|. 143 * there are trailing bytes in |in|.
148 */ 144 */
149int MLKEM768_parse_public_key(struct MLKEM768_public_key *out_public_key, 145int MLKEM768_parse_public_key(struct MLKEM768_public_key *out_public_key,
150 struct cbs_st *in); 146 const uint8_t *input, size_t input_len);
151 147
152/* 148/*
153 * MLKEM_parse_private_key parses a private key, in the format generated by 149 * MLKEM_parse_private_key parses a private key, in the format generated by
@@ -157,7 +153,7 @@ int MLKEM768_parse_public_key(struct MLKEM768_public_key *out_public_key,
157 * Private keys should be stored as seeds and parsed using |MLKEM768_private_key_from_seed|. 153 * Private keys should be stored as seeds and parsed using |MLKEM768_private_key_from_seed|.
158 */ 154 */
159int MLKEM768_parse_private_key(struct MLKEM768_private_key *out_private_key, 155int MLKEM768_parse_private_key(struct MLKEM768_private_key *out_private_key,
160 struct cbs_st *in); 156 const uint8_t *input, size_t input_len);
161 157
162/* 158/*
163 * ML-KEM-1024 159 * ML-KEM-1024
@@ -200,7 +196,7 @@ struct MLKEM1024_private_key {
200 * the private key. If |optional_out_seed| is not NULL then the seed used to 196 * the private key. If |optional_out_seed| is not NULL then the seed used to
201 * generate the private key is written to it. 197 * generate the private key is written to it.
202 */ 198 */
203void MLKEM1024_generate_key( 199int MLKEM1024_generate_key(
204 uint8_t out_encoded_public_key[MLKEM1024_PUBLIC_KEY_BYTES], 200 uint8_t out_encoded_public_key[MLKEM1024_PUBLIC_KEY_BYTES],
205 uint8_t optional_out_seed[MLKEM_SEED_BYTES], 201 uint8_t optional_out_seed[MLKEM_SEED_BYTES],
206 struct MLKEM1024_private_key *out_private_key); 202 struct MLKEM1024_private_key *out_private_key);
@@ -256,7 +252,7 @@ int MLKEM1024_decap(uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES],
256 * format for ML-KEM-1024 public keys. It returns one on success or zero on 252 * format for ML-KEM-1024 public keys. It returns one on success or zero on
257 * allocation error. 253 * allocation error.
258 */ 254 */
259int MLKEM1024_marshal_public_key(struct cbb_st *out, 255int MLKEM1024_marshal_public_key(uint8_t **output, size_t *output_len,
260 const struct MLKEM1024_public_key *public_key); 256 const struct MLKEM1024_public_key *public_key);
261 257
262/* 258/*
@@ -266,7 +262,7 @@ int MLKEM1024_marshal_public_key(struct cbb_st *out,
266 * there are trailing bytes in |in|. 262 * there are trailing bytes in |in|.
267 */ 263 */
268int MLKEM1024_parse_public_key(struct MLKEM1024_public_key *out_public_key, 264int MLKEM1024_parse_public_key(struct MLKEM1024_public_key *out_public_key,
269 struct cbs_st *in); 265 const uint8_t *input, size_t input_len);
270 266
271/* 267/*
272 * MLKEM1024_parse_private_key parses a private key, in NIST's format for 268 * MLKEM1024_parse_private_key parses a private key, in NIST's format for
@@ -276,7 +272,7 @@ int MLKEM1024_parse_public_key(struct MLKEM1024_public_key *out_public_key,
276 * stored as seeds and parsed using |MLKEM1024_private_key_from_seed|. 272 * stored as seeds and parsed using |MLKEM1024_private_key_from_seed|.
277 */ 273 */
278int MLKEM1024_parse_private_key(struct MLKEM1024_private_key *out_private_key, 274int MLKEM1024_parse_private_key(struct MLKEM1024_private_key *out_private_key,
279 struct cbs_st *in); 275 const uint8_t *input, size_t input_len);
280 276
281#if defined(__cplusplus) 277#if defined(__cplusplus)
282} 278}
diff --git a/src/lib/libcrypto/mlkem/mlkem1024.c b/src/lib/libcrypto/mlkem/mlkem1024.c
index f6fccdf6a8..26c4716539 100644
--- a/src/lib/libcrypto/mlkem/mlkem1024.c
+++ b/src/lib/libcrypto/mlkem/mlkem1024.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: mlkem1024.c,v 1.6 2025/01/03 08:19:24 tb Exp $ */ 1/* $OpenBSD: mlkem1024.c,v 1.11 2025/05/21 02:18:11 kenjiro Exp $ */
2/* 2/*
3 * Copyright (c) 2024, Google Inc. 3 * Copyright (c) 2024, Google Inc.
4 * Copyright (c) 2024, Bob Beck <beck@obtuse.com> 4 * Copyright (c) 2024, Bob Beck <beck@obtuse.com>
@@ -612,6 +612,19 @@ vector_encode(uint8_t *out, const vector *a, int bits)
612 } 612 }
613} 613}
614 614
615/* Encodes an entire vector as above, but adding it to a CBB */
616static int
617vector_encode_cbb(CBB *cbb, const vector *a, int bits)
618{
619 uint8_t *encoded_vector;
620
621 if (!CBB_add_space(cbb, &encoded_vector, kEncodedVectorSize))
622 return 0;
623 vector_encode(encoded_vector, a, bits);
624
625 return 1;
626}
627
615/* 628/*
616 * scalar_decode parses |DEGREE * bits| bits from |in| into |DEGREE| values in 629 * scalar_decode parses |DEGREE * bits| bits from |in| into |DEGREE| values in
617 * |out|. It returns one on success and zero if any parsed value is >= 630 * |out|. It returns one on success and zero if any parsed value is >=
@@ -793,6 +806,8 @@ struct public_key {
793 matrix m; 806 matrix m;
794}; 807};
795 808
809CTASSERT(sizeof(struct MLKEM1024_public_key) == sizeof(struct public_key));
810
796static struct public_key * 811static struct public_key *
797public_key_1024_from_external(const struct MLKEM1024_public_key *external) 812public_key_1024_from_external(const struct MLKEM1024_public_key *external)
798{ 813{
@@ -805,6 +820,8 @@ struct private_key {
805 uint8_t fo_failure_secret[32]; 820 uint8_t fo_failure_secret[32];
806}; 821};
807 822
823CTASSERT(sizeof(struct MLKEM1024_private_key) == sizeof(struct private_key));
824
808static struct private_key * 825static struct private_key *
809private_key_1024_from_external(const struct MLKEM1024_private_key *external) 826private_key_1024_from_external(const struct MLKEM1024_private_key *external)
810{ 827{
@@ -815,7 +832,7 @@ private_key_1024_from_external(const struct MLKEM1024_private_key *external)
815 * Calls |MLKEM1024_generate_key_external_entropy| with random bytes from 832 * Calls |MLKEM1024_generate_key_external_entropy| with random bytes from
816 * |RAND_bytes|. 833 * |RAND_bytes|.
817 */ 834 */
818void 835int
819MLKEM1024_generate_key(uint8_t out_encoded_public_key[MLKEM1024_PUBLIC_KEY_BYTES], 836MLKEM1024_generate_key(uint8_t out_encoded_public_key[MLKEM1024_PUBLIC_KEY_BYTES],
820 uint8_t optional_out_seed[MLKEM_SEED_BYTES], 837 uint8_t optional_out_seed[MLKEM_SEED_BYTES],
821 struct MLKEM1024_private_key *out_private_key) 838 struct MLKEM1024_private_key *out_private_key)
@@ -825,7 +842,7 @@ MLKEM1024_generate_key(uint8_t out_encoded_public_key[MLKEM1024_PUBLIC_KEY_BYTES
825 entropy_buf; 842 entropy_buf;
826 843
827 arc4random_buf(entropy, MLKEM_SEED_BYTES); 844 arc4random_buf(entropy, MLKEM_SEED_BYTES);
828 MLKEM1024_generate_key_external_entropy(out_encoded_public_key, 845 return MLKEM1024_generate_key_external_entropy(out_encoded_public_key,
829 out_private_key, entropy); 846 out_private_key, entropy);
830} 847}
831LCRYPTO_ALIAS(MLKEM1024_generate_key); 848LCRYPTO_ALIAS(MLKEM1024_generate_key);
@@ -839,29 +856,20 @@ MLKEM1024_private_key_from_seed(struct MLKEM1024_private_key *out_private_key,
839 if (seed_len != MLKEM_SEED_BYTES) { 856 if (seed_len != MLKEM_SEED_BYTES) {
840 return 0; 857 return 0;
841 } 858 }
842 MLKEM1024_generate_key_external_entropy(public_key_bytes, 859 return MLKEM1024_generate_key_external_entropy(public_key_bytes,
843 out_private_key, seed); 860 out_private_key, seed);
844
845 return 1;
846} 861}
847LCRYPTO_ALIAS(MLKEM1024_private_key_from_seed); 862LCRYPTO_ALIAS(MLKEM1024_private_key_from_seed);
848 863
849static int 864static int
850mlkem_marshal_public_key(CBB *out, const struct public_key *pub) 865mlkem_marshal_public_key(CBB *out, const struct public_key *pub)
851{ 866{
852 uint8_t *vector_output; 867 if (!vector_encode_cbb(out, &pub->t, kLog2Prime))
853
854 if (!CBB_add_space(out, &vector_output, kEncodedVectorSize)) {
855 return 0; 868 return 0;
856 } 869 return CBB_add_bytes(out, pub->rho, sizeof(pub->rho));
857 vector_encode(vector_output, &pub->t, kLog2Prime);
858 if (!CBB_add_bytes(out, pub->rho, sizeof(pub->rho))) {
859 return 0;
860 }
861 return 1;
862} 870}
863 871
864void 872int
865MLKEM1024_generate_key_external_entropy( 873MLKEM1024_generate_key_external_entropy(
866 uint8_t out_encoded_public_key[MLKEM1024_PUBLIC_KEY_BYTES], 874 uint8_t out_encoded_public_key[MLKEM1024_PUBLIC_KEY_BYTES],
867 struct MLKEM1024_private_key *out_private_key, 875 struct MLKEM1024_private_key *out_private_key,
@@ -875,7 +883,9 @@ MLKEM1024_generate_key_external_entropy(
875 uint8_t hashed[64]; 883 uint8_t hashed[64];
876 vector error; 884 vector error;
877 CBB cbb; 885 CBB cbb;
886 int ret = 0;
878 887
888 memset(&cbb, 0, sizeof(CBB));
879 memcpy(augmented_seed, entropy, 32); 889 memcpy(augmented_seed, entropy, 32);
880 augmented_seed[32] = RANK1024; 890 augmented_seed[32] = RANK1024;
881 hash_g(hashed, augmented_seed, 33); 891 hash_g(hashed, augmented_seed, 33);
@@ -890,16 +900,23 @@ MLKEM1024_generate_key_external_entropy(
890 matrix_mult_transpose(&priv->pub.t, &priv->pub.m, &priv->s); 900 matrix_mult_transpose(&priv->pub.t, &priv->pub.m, &priv->s);
891 vector_add(&priv->pub.t, &error); 901 vector_add(&priv->pub.t, &error);
892 902
893 /* XXX - error checking. */ 903 if (!CBB_init_fixed(&cbb, out_encoded_public_key,
894 CBB_init_fixed(&cbb, out_encoded_public_key, MLKEM1024_PUBLIC_KEY_BYTES); 904 MLKEM1024_PUBLIC_KEY_BYTES))
895 if (!mlkem_marshal_public_key(&cbb, &priv->pub)) { 905 goto err;
896 abort(); 906
897 } 907 if (!mlkem_marshal_public_key(&cbb, &priv->pub))
898 CBB_cleanup(&cbb); 908 goto err;
899 909
900 hash_h(priv->pub.public_key_hash, out_encoded_public_key, 910 hash_h(priv->pub.public_key_hash, out_encoded_public_key,
901 MLKEM1024_PUBLIC_KEY_BYTES); 911 MLKEM1024_PUBLIC_KEY_BYTES);
902 memcpy(priv->fo_failure_secret, entropy + 32, 32); 912 memcpy(priv->fo_failure_secret, entropy + 32, 32);
913
914 ret = 1;
915
916 err:
917 CBB_cleanup(&cbb);
918
919 return ret;
903} 920}
904 921
905void 922void
@@ -1045,11 +1062,26 @@ MLKEM1024_decap(uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES],
1045LCRYPTO_ALIAS(MLKEM1024_decap); 1062LCRYPTO_ALIAS(MLKEM1024_decap);
1046 1063
1047int 1064int
1048MLKEM1024_marshal_public_key(CBB *out, 1065MLKEM1024_marshal_public_key(uint8_t **output, size_t *output_len,
1049 const struct MLKEM1024_public_key *public_key) 1066 const struct MLKEM1024_public_key *public_key)
1050{ 1067{
1051 return mlkem_marshal_public_key(out, 1068 int ret = 0;
1052 public_key_1024_from_external(public_key)); 1069 CBB cbb;
1070
1071 if (!CBB_init(&cbb, MLKEM1024_PUBLIC_KEY_BYTES))
1072 goto err;
1073 if (!mlkem_marshal_public_key(&cbb,
1074 public_key_1024_from_external(public_key)))
1075 goto err;
1076 if (!CBB_finish(&cbb, output, output_len))
1077 goto err;
1078
1079 ret = 1;
1080
1081 err:
1082 CBB_cleanup(&cbb);
1083
1084 return ret;
1053} 1085}
1054LCRYPTO_ALIAS(MLKEM1024_marshal_public_key); 1086LCRYPTO_ALIAS(MLKEM1024_marshal_public_key);
1055 1087
@@ -1062,10 +1094,11 @@ mlkem_parse_public_key_no_hash(struct public_key *pub, CBS *in)
1062{ 1094{
1063 CBS t_bytes; 1095 CBS t_bytes;
1064 1096
1065 if (!CBS_get_bytes(in, &t_bytes, kEncodedVectorSize) || 1097 if (!CBS_get_bytes(in, &t_bytes, kEncodedVectorSize))
1066 !vector_decode(&pub->t, CBS_data(&t_bytes), kLog2Prime)) {
1067 return 0; 1098 return 0;
1068 } 1099 if (!vector_decode(&pub->t, CBS_data(&t_bytes), kLog2Prime))
1100 return 0;
1101
1069 memcpy(pub->rho, CBS_data(in), sizeof(pub->rho)); 1102 memcpy(pub->rho, CBS_data(in), sizeof(pub->rho));
1070 if (!CBS_skip(in, sizeof(pub->rho))) 1103 if (!CBS_skip(in, sizeof(pub->rho)))
1071 return 0; 1104 return 0;
@@ -1074,64 +1107,84 @@ mlkem_parse_public_key_no_hash(struct public_key *pub, CBS *in)
1074} 1107}
1075 1108
1076int 1109int
1077MLKEM1024_parse_public_key(struct MLKEM1024_public_key *public_key, CBS *in) 1110MLKEM1024_parse_public_key(struct MLKEM1024_public_key *public_key,
1111 const uint8_t *input, size_t input_len)
1078{ 1112{
1079 struct public_key *pub = public_key_1024_from_external(public_key); 1113 struct public_key *pub = public_key_1024_from_external(public_key);
1080 CBS orig_in = *in; 1114 CBS cbs;
1081 1115
1082 if (!mlkem_parse_public_key_no_hash(pub, in) || 1116 CBS_init(&cbs, input, input_len);
1083 CBS_len(in) != 0) { 1117 if (!mlkem_parse_public_key_no_hash(pub, &cbs))
1084 return 0; 1118 return 0;
1085 } 1119 if (CBS_len(&cbs) != 0)
1086 hash_h(pub->public_key_hash, CBS_data(&orig_in), CBS_len(&orig_in)); 1120 return 0;
1121
1122 hash_h(pub->public_key_hash, input, input_len);
1123
1087 return 1; 1124 return 1;
1088} 1125}
1089LCRYPTO_ALIAS(MLKEM1024_parse_public_key); 1126LCRYPTO_ALIAS(MLKEM1024_parse_public_key);
1090 1127
1091int 1128int
1092MLKEM1024_marshal_private_key(CBB *out, 1129MLKEM1024_marshal_private_key(const struct MLKEM1024_private_key *private_key,
1093 const struct MLKEM1024_private_key *private_key) 1130 uint8_t **out_private_key, size_t *out_private_key_len)
1094{ 1131{
1095 const struct private_key *const priv = private_key_1024_from_external( 1132 const struct private_key *const priv = private_key_1024_from_external(
1096 private_key); 1133 private_key);
1097 uint8_t *s_output; 1134 CBB cbb;
1135 int ret = 0;
1098 1136
1099 if (!CBB_add_space(out, &s_output, kEncodedVectorSize)) { 1137 if (!CBB_init(&cbb, MLKEM1024_PRIVATE_KEY_BYTES))
1100 return 0; 1138 goto err;
1101 } 1139
1102 vector_encode(s_output, &priv->s, kLog2Prime); 1140 if (!vector_encode_cbb(&cbb, &priv->s, kLog2Prime))
1103 if (!mlkem_marshal_public_key(out, &priv->pub) || 1141 goto err;
1104 !CBB_add_bytes(out, priv->pub.public_key_hash, 1142 if (!mlkem_marshal_public_key(&cbb, &priv->pub))
1105 sizeof(priv->pub.public_key_hash)) || 1143 goto err;
1106 !CBB_add_bytes(out, priv->fo_failure_secret, 1144 if (!CBB_add_bytes(&cbb, priv->pub.public_key_hash,
1107 sizeof(priv->fo_failure_secret))) { 1145 sizeof(priv->pub.public_key_hash)))
1108 return 0; 1146 goto err;
1109 } 1147 if (!CBB_add_bytes(&cbb, priv->fo_failure_secret,
1110 return 1; 1148 sizeof(priv->fo_failure_secret)))
1149 goto err;
1150
1151 if (!CBB_finish(&cbb, out_private_key, out_private_key_len))
1152 goto err;
1153
1154 ret = 1;
1155
1156 err:
1157 CBB_cleanup(&cbb);
1158
1159 return ret;
1111} 1160}
1112 1161
1113int 1162int
1114MLKEM1024_parse_private_key(struct MLKEM1024_private_key *out_private_key, 1163MLKEM1024_parse_private_key(struct MLKEM1024_private_key *out_private_key,
1115 CBS *in) 1164 const uint8_t *input, size_t input_len)
1116{ 1165{
1117 struct private_key *const priv = private_key_1024_from_external( 1166 struct private_key *const priv = private_key_1024_from_external(
1118 out_private_key); 1167 out_private_key);
1119 CBS s_bytes; 1168 CBS cbs, s_bytes;
1120 1169
1121 if (!CBS_get_bytes(in, &s_bytes, kEncodedVectorSize) || 1170 CBS_init(&cbs, input, input_len);
1122 !vector_decode(&priv->s, CBS_data(&s_bytes), kLog2Prime) || 1171
1123 !mlkem_parse_public_key_no_hash(&priv->pub, in)) { 1172 if (!CBS_get_bytes(&cbs, &s_bytes, kEncodedVectorSize))
1124 return 0; 1173 return 0;
1125 } 1174 if (!vector_decode(&priv->s, CBS_data(&s_bytes), kLog2Prime))
1126 memcpy(priv->pub.public_key_hash, CBS_data(in), 1175 return 0;
1176 if (!mlkem_parse_public_key_no_hash(&priv->pub, &cbs))
1177 return 0;
1178
1179 memcpy(priv->pub.public_key_hash, CBS_data(&cbs),
1127 sizeof(priv->pub.public_key_hash)); 1180 sizeof(priv->pub.public_key_hash));
1128 if (!CBS_skip(in, sizeof(priv->pub.public_key_hash))) 1181 if (!CBS_skip(&cbs, sizeof(priv->pub.public_key_hash)))
1129 return 0; 1182 return 0;
1130 memcpy(priv->fo_failure_secret, CBS_data(in), 1183 memcpy(priv->fo_failure_secret, CBS_data(&cbs),
1131 sizeof(priv->fo_failure_secret)); 1184 sizeof(priv->fo_failure_secret));
1132 if (!CBS_skip(in, sizeof(priv->fo_failure_secret))) 1185 if (!CBS_skip(&cbs, sizeof(priv->fo_failure_secret)))
1133 return 0; 1186 return 0;
1134 if (CBS_len(in) != 0) 1187 if (CBS_len(&cbs) != 0)
1135 return 0; 1188 return 0;
1136 1189
1137 return 1; 1190 return 1;
diff --git a/src/lib/libcrypto/mlkem/mlkem768.c b/src/lib/libcrypto/mlkem/mlkem768.c
index bacde0c0b7..653b92d8d8 100644
--- a/src/lib/libcrypto/mlkem/mlkem768.c
+++ b/src/lib/libcrypto/mlkem/mlkem768.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: mlkem768.c,v 1.7 2025/01/03 08:19:24 tb Exp $ */ 1/* $OpenBSD: mlkem768.c,v 1.12 2025/05/20 00:30:38 beck Exp $ */
2/* 2/*
3 * Copyright (c) 2024, Google Inc. 3 * Copyright (c) 2024, Google Inc.
4 * Copyright (c) 2024, Bob Beck <beck@obtuse.com> 4 * Copyright (c) 2024, Bob Beck <beck@obtuse.com>
@@ -89,6 +89,7 @@ static const int kLog2Prime = 12;
89static const uint16_t kHalfPrime = (/*kPrime=*/3329 - 1) / 2; 89static const uint16_t kHalfPrime = (/*kPrime=*/3329 - 1) / 2;
90static const int kDU768 = 10; 90static const int kDU768 = 10;
91static const int kDV768 = 4; 91static const int kDV768 = 4;
92
92/* 93/*
93 * kInverseDegree is 128^-1 mod 3329; 128 because kPrime does not have a 512th 94 * kInverseDegree is 128^-1 mod 3329; 128 because kPrime does not have a 512th
94 * root of unity. 95 * root of unity.
@@ -611,6 +612,19 @@ vector_encode(uint8_t *out, const vector *a, int bits)
611 } 612 }
612} 613}
613 614
615/* Encodes an entire vector as above, but adding it to a CBB */
616static int
617vector_encode_cbb(CBB *cbb, const vector *a, int bits)
618{
619 uint8_t *encoded_vector;
620
621 if (!CBB_add_space(cbb, &encoded_vector, kEncodedVectorSize))
622 return 0;
623 vector_encode(encoded_vector, a, bits);
624
625 return 1;
626}
627
614/* 628/*
615 * scalar_decode parses |DEGREE * bits| bits from |in| into |DEGREE| values in 629 * scalar_decode parses |DEGREE * bits| bits from |in| into |DEGREE| values in
616 * |out|. It returns one on success and zero if any parsed value is >= 630 * |out|. It returns one on success and zero if any parsed value is >=
@@ -792,6 +806,8 @@ struct public_key {
792 matrix m; 806 matrix m;
793}; 807};
794 808
809CTASSERT(sizeof(struct MLKEM768_public_key) == sizeof(struct public_key));
810
795static struct public_key * 811static struct public_key *
796public_key_768_from_external(const struct MLKEM768_public_key *external) 812public_key_768_from_external(const struct MLKEM768_public_key *external)
797{ 813{
@@ -804,6 +820,8 @@ struct private_key {
804 uint8_t fo_failure_secret[32]; 820 uint8_t fo_failure_secret[32];
805}; 821};
806 822
823CTASSERT(sizeof(struct MLKEM768_private_key) == sizeof(struct private_key));
824
807static struct private_key * 825static struct private_key *
808private_key_768_from_external(const struct MLKEM768_private_key *external) 826private_key_768_from_external(const struct MLKEM768_private_key *external)
809{ 827{
@@ -814,7 +832,7 @@ private_key_768_from_external(const struct MLKEM768_private_key *external)
814 * Calls |MLKEM768_generate_key_external_entropy| with random bytes from 832 * Calls |MLKEM768_generate_key_external_entropy| with random bytes from
815 * |RAND_bytes|. 833 * |RAND_bytes|.
816 */ 834 */
817void 835int
818MLKEM768_generate_key(uint8_t out_encoded_public_key[MLKEM768_PUBLIC_KEY_BYTES], 836MLKEM768_generate_key(uint8_t out_encoded_public_key[MLKEM768_PUBLIC_KEY_BYTES],
819 uint8_t optional_out_seed[MLKEM_SEED_BYTES], 837 uint8_t optional_out_seed[MLKEM_SEED_BYTES],
820 struct MLKEM768_private_key *out_private_key) 838 struct MLKEM768_private_key *out_private_key)
@@ -824,7 +842,7 @@ MLKEM768_generate_key(uint8_t out_encoded_public_key[MLKEM768_PUBLIC_KEY_BYTES],
824 entropy_buf; 842 entropy_buf;
825 843
826 arc4random_buf(entropy, MLKEM_SEED_BYTES); 844 arc4random_buf(entropy, MLKEM_SEED_BYTES);
827 MLKEM768_generate_key_external_entropy(out_encoded_public_key, 845 return MLKEM768_generate_key_external_entropy(out_encoded_public_key,
828 out_private_key, entropy); 846 out_private_key, entropy);
829} 847}
830LCRYPTO_ALIAS(MLKEM768_generate_key); 848LCRYPTO_ALIAS(MLKEM768_generate_key);
@@ -838,29 +856,20 @@ MLKEM768_private_key_from_seed(struct MLKEM768_private_key *out_private_key,
838 if (seed_len != MLKEM_SEED_BYTES) { 856 if (seed_len != MLKEM_SEED_BYTES) {
839 return 0; 857 return 0;
840 } 858 }
841 MLKEM768_generate_key_external_entropy(public_key_bytes, 859 return MLKEM768_generate_key_external_entropy(public_key_bytes,
842 out_private_key, seed); 860 out_private_key, seed);
843
844 return 1;
845} 861}
846LCRYPTO_ALIAS(MLKEM768_private_key_from_seed); 862LCRYPTO_ALIAS(MLKEM768_private_key_from_seed);
847 863
848static int 864static int
849mlkem_marshal_public_key(CBB *out, const struct public_key *pub) 865mlkem_marshal_public_key(CBB *out, const struct public_key *pub)
850{ 866{
851 uint8_t *vector_output; 867 if (!vector_encode_cbb(out, &pub->t, kLog2Prime))
852
853 if (!CBB_add_space(out, &vector_output, kEncodedVectorSize)) {
854 return 0;
855 }
856 vector_encode(vector_output, &pub->t, kLog2Prime);
857 if (!CBB_add_bytes(out, pub->rho, sizeof(pub->rho))) {
858 return 0; 868 return 0;
859 } 869 return CBB_add_bytes(out, pub->rho, sizeof(pub->rho));
860 return 1;
861} 870}
862 871
863void 872int
864MLKEM768_generate_key_external_entropy( 873MLKEM768_generate_key_external_entropy(
865 uint8_t out_encoded_public_key[MLKEM768_PUBLIC_KEY_BYTES], 874 uint8_t out_encoded_public_key[MLKEM768_PUBLIC_KEY_BYTES],
866 struct MLKEM768_private_key *out_private_key, 875 struct MLKEM768_private_key *out_private_key,
@@ -874,7 +883,9 @@ MLKEM768_generate_key_external_entropy(
874 uint8_t hashed[64]; 883 uint8_t hashed[64];
875 vector error; 884 vector error;
876 CBB cbb; 885 CBB cbb;
886 int ret = 0;
877 887
888 memset(&cbb, 0, sizeof(CBB));
878 memcpy(augmented_seed, entropy, 32); 889 memcpy(augmented_seed, entropy, 32);
879 augmented_seed[32] = RANK768; 890 augmented_seed[32] = RANK768;
880 hash_g(hashed, augmented_seed, 33); 891 hash_g(hashed, augmented_seed, 33);
@@ -889,16 +900,23 @@ MLKEM768_generate_key_external_entropy(
889 matrix_mult_transpose(&priv->pub.t, &priv->pub.m, &priv->s); 900 matrix_mult_transpose(&priv->pub.t, &priv->pub.m, &priv->s);
890 vector_add(&priv->pub.t, &error); 901 vector_add(&priv->pub.t, &error);
891 902
892 /* XXX - error checking */ 903 if (!CBB_init_fixed(&cbb, out_encoded_public_key,
893 CBB_init_fixed(&cbb, out_encoded_public_key, MLKEM768_PUBLIC_KEY_BYTES); 904 MLKEM768_PUBLIC_KEY_BYTES))
894 if (!mlkem_marshal_public_key(&cbb, &priv->pub)) { 905 goto err;
895 abort(); 906
896 } 907 if (!mlkem_marshal_public_key(&cbb, &priv->pub))
897 CBB_cleanup(&cbb); 908 goto err;
898 909
899 hash_h(priv->pub.public_key_hash, out_encoded_public_key, 910 hash_h(priv->pub.public_key_hash, out_encoded_public_key,
900 MLKEM768_PUBLIC_KEY_BYTES); 911 MLKEM768_PUBLIC_KEY_BYTES);
901 memcpy(priv->fo_failure_secret, entropy + 32, 32); 912 memcpy(priv->fo_failure_secret, entropy + 32, 32);
913
914 ret = 1;
915
916 err:
917 CBB_cleanup(&cbb);
918
919 return ret;
902} 920}
903 921
904void 922void
@@ -961,8 +979,8 @@ MLKEM768_encap(uint8_t out_ciphertext[MLKEM768_CIPHERTEXT_BYTES],
961 uint8_t entropy[MLKEM_ENCAP_ENTROPY]; 979 uint8_t entropy[MLKEM_ENCAP_ENTROPY];
962 980
963 arc4random_buf(entropy, MLKEM_ENCAP_ENTROPY); 981 arc4random_buf(entropy, MLKEM_ENCAP_ENTROPY);
964 MLKEM768_encap_external_entropy(out_ciphertext, out_shared_secret, 982 MLKEM768_encap_external_entropy(out_ciphertext,
965 public_key, entropy); 983 out_shared_secret, public_key, entropy);
966} 984}
967LCRYPTO_ALIAS(MLKEM768_encap); 985LCRYPTO_ALIAS(MLKEM768_encap);
968 986
@@ -1044,11 +1062,26 @@ MLKEM768_decap(uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES],
1044LCRYPTO_ALIAS(MLKEM768_decap); 1062LCRYPTO_ALIAS(MLKEM768_decap);
1045 1063
1046int 1064int
1047MLKEM768_marshal_public_key(CBB *out, 1065MLKEM768_marshal_public_key(uint8_t **output, size_t *output_len,
1048 const struct MLKEM768_public_key *public_key) 1066 const struct MLKEM768_public_key *public_key)
1049{ 1067{
1050 return mlkem_marshal_public_key(out, 1068 int ret = 0;
1051 public_key_768_from_external(public_key)); 1069 CBB cbb;
1070
1071 if (!CBB_init(&cbb, MLKEM768_PUBLIC_KEY_BYTES))
1072 goto err;
1073 if (!mlkem_marshal_public_key(&cbb,
1074 public_key_768_from_external(public_key)))
1075 goto err;
1076 if (!CBB_finish(&cbb, output, output_len))
1077 goto err;
1078
1079 ret = 1;
1080
1081 err:
1082 CBB_cleanup(&cbb);
1083
1084 return ret;
1052} 1085}
1053LCRYPTO_ALIAS(MLKEM768_marshal_public_key); 1086LCRYPTO_ALIAS(MLKEM768_marshal_public_key);
1054 1087
@@ -1061,10 +1094,11 @@ mlkem_parse_public_key_no_hash(struct public_key *pub, CBS *in)
1061{ 1094{
1062 CBS t_bytes; 1095 CBS t_bytes;
1063 1096
1064 if (!CBS_get_bytes(in, &t_bytes, kEncodedVectorSize) || 1097 if (!CBS_get_bytes(in, &t_bytes, kEncodedVectorSize))
1065 !vector_decode(&pub->t, CBS_data(&t_bytes), kLog2Prime)) {
1066 return 0; 1098 return 0;
1067 } 1099 if (!vector_decode(&pub->t, CBS_data(&t_bytes), kLog2Prime))
1100 return 0;
1101
1068 memcpy(pub->rho, CBS_data(in), sizeof(pub->rho)); 1102 memcpy(pub->rho, CBS_data(in), sizeof(pub->rho));
1069 if (!CBS_skip(in, sizeof(pub->rho))) 1103 if (!CBS_skip(in, sizeof(pub->rho)))
1070 return 0; 1104 return 0;
@@ -1073,64 +1107,84 @@ mlkem_parse_public_key_no_hash(struct public_key *pub, CBS *in)
1073} 1107}
1074 1108
1075int 1109int
1076MLKEM768_parse_public_key(struct MLKEM768_public_key *public_key, CBS *in) 1110MLKEM768_parse_public_key(struct MLKEM768_public_key *public_key,
1111 const uint8_t *input, size_t input_len)
1077{ 1112{
1078 struct public_key *pub = public_key_768_from_external(public_key); 1113 struct public_key *pub = public_key_768_from_external(public_key);
1079 CBS orig_in = *in; 1114 CBS cbs;
1080 1115
1081 if (!mlkem_parse_public_key_no_hash(pub, in) || 1116 CBS_init(&cbs, input, input_len);
1082 CBS_len(in) != 0) { 1117 if (!mlkem_parse_public_key_no_hash(pub, &cbs))
1083 return 0; 1118 return 0;
1084 } 1119 if (CBS_len(&cbs) != 0)
1085 hash_h(pub->public_key_hash, CBS_data(&orig_in), CBS_len(&orig_in)); 1120 return 0;
1121
1122 hash_h(pub->public_key_hash, input, input_len);
1123
1086 return 1; 1124 return 1;
1087} 1125}
1088LCRYPTO_ALIAS(MLKEM768_parse_public_key); 1126LCRYPTO_ALIAS(MLKEM768_parse_public_key);
1089 1127
1090int 1128int
1091MLKEM768_marshal_private_key(CBB *out, 1129MLKEM768_marshal_private_key(const struct MLKEM768_private_key *private_key,
1092 const struct MLKEM768_private_key *private_key) 1130 uint8_t **out_private_key, size_t *out_private_key_len)
1093{ 1131{
1094 const struct private_key *const priv = private_key_768_from_external( 1132 const struct private_key *const priv = private_key_768_from_external(
1095 private_key); 1133 private_key);
1096 uint8_t *s_output; 1134 CBB cbb;
1135 int ret = 0;
1097 1136
1098 if (!CBB_add_space(out, &s_output, kEncodedVectorSize)) { 1137 if (!CBB_init(&cbb, MLKEM768_PRIVATE_KEY_BYTES))
1099 return 0; 1138 goto err;
1100 } 1139
1101 vector_encode(s_output, &priv->s, kLog2Prime); 1140 if (!vector_encode_cbb(&cbb, &priv->s, kLog2Prime))
1102 if (!mlkem_marshal_public_key(out, &priv->pub) || 1141 goto err;
1103 !CBB_add_bytes(out, priv->pub.public_key_hash, 1142 if (!mlkem_marshal_public_key(&cbb, &priv->pub))
1104 sizeof(priv->pub.public_key_hash)) || 1143 goto err;
1105 !CBB_add_bytes(out, priv->fo_failure_secret, 1144 if (!CBB_add_bytes(&cbb, priv->pub.public_key_hash,
1106 sizeof(priv->fo_failure_secret))) { 1145 sizeof(priv->pub.public_key_hash)))
1107 return 0; 1146 goto err;
1108 } 1147 if (!CBB_add_bytes(&cbb, priv->fo_failure_secret,
1109 return 1; 1148 sizeof(priv->fo_failure_secret)))
1149 goto err;
1150
1151 if (!CBB_finish(&cbb, out_private_key, out_private_key_len))
1152 goto err;
1153
1154 ret = 1;
1155
1156 err:
1157 CBB_cleanup(&cbb);
1158
1159 return ret;
1110} 1160}
1111 1161
1112int 1162int
1113MLKEM768_parse_private_key(struct MLKEM768_private_key *out_private_key, 1163MLKEM768_parse_private_key(struct MLKEM768_private_key *out_private_key,
1114 CBS *in) 1164 const uint8_t *input, size_t input_len)
1115{ 1165{
1116 struct private_key *const priv = private_key_768_from_external( 1166 struct private_key *const priv = private_key_768_from_external(
1117 out_private_key); 1167 out_private_key);
1118 CBS s_bytes; 1168 CBS cbs, s_bytes;
1119 1169
1120 if (!CBS_get_bytes(in, &s_bytes, kEncodedVectorSize) || 1170 CBS_init(&cbs, input, input_len);
1121 !vector_decode(&priv->s, CBS_data(&s_bytes), kLog2Prime) || 1171
1122 !mlkem_parse_public_key_no_hash(&priv->pub, in)) { 1172 if (!CBS_get_bytes(&cbs, &s_bytes, kEncodedVectorSize))
1123 return 0; 1173 return 0;
1124 } 1174 if (!vector_decode(&priv->s, CBS_data(&s_bytes), kLog2Prime))
1125 memcpy(priv->pub.public_key_hash, CBS_data(in), 1175 return 0;
1176 if (!mlkem_parse_public_key_no_hash(&priv->pub, &cbs))
1177 return 0;
1178
1179 memcpy(priv->pub.public_key_hash, CBS_data(&cbs),
1126 sizeof(priv->pub.public_key_hash)); 1180 sizeof(priv->pub.public_key_hash));
1127 if (!CBS_skip(in, sizeof(priv->pub.public_key_hash))) 1181 if (!CBS_skip(&cbs, sizeof(priv->pub.public_key_hash)))
1128 return 0; 1182 return 0;
1129 memcpy(priv->fo_failure_secret, CBS_data(in), 1183 memcpy(priv->fo_failure_secret, CBS_data(&cbs),
1130 sizeof(priv->fo_failure_secret)); 1184 sizeof(priv->fo_failure_secret));
1131 if (!CBS_skip(in, sizeof(priv->fo_failure_secret))) 1185 if (!CBS_skip(&cbs, sizeof(priv->fo_failure_secret)))
1132 return 0; 1186 return 0;
1133 if (CBS_len(in) != 0) 1187 if (CBS_len(&cbs) != 0)
1134 return 0; 1188 return 0;
1135 1189
1136 return 1; 1190 return 1;
diff --git a/src/lib/libcrypto/mlkem/mlkem_internal.h b/src/lib/libcrypto/mlkem/mlkem_internal.h
index d3f325932f..1e051970a8 100644
--- a/src/lib/libcrypto/mlkem/mlkem_internal.h
+++ b/src/lib/libcrypto/mlkem/mlkem_internal.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: mlkem_internal.h,v 1.4 2024/12/19 23:52:26 tb Exp $ */ 1/* $OpenBSD: mlkem_internal.h,v 1.7 2025/05/20 00:33:40 beck Exp $ */
2/* 2/*
3 * Copyright (c) 2023, Google Inc. 3 * Copyright (c) 2023, Google Inc.
4 * 4 *
@@ -41,7 +41,7 @@ __BEGIN_HIDDEN_DECLS
41 * regular callers should use the non-deterministic |MLKEM_generate_key| 41 * regular callers should use the non-deterministic |MLKEM_generate_key|
42 * directly. 42 * directly.
43 */ 43 */
44void MLKEM768_generate_key_external_entropy( 44int MLKEM768_generate_key_external_entropy(
45 uint8_t out_encoded_public_key[MLKEM768_PUBLIC_KEY_BYTES], 45 uint8_t out_encoded_public_key[MLKEM768_PUBLIC_KEY_BYTES],
46 struct MLKEM768_private_key *out_private_key, 46 struct MLKEM768_private_key *out_private_key,
47 const uint8_t entropy[MLKEM_SEED_BYTES]); 47 const uint8_t entropy[MLKEM_SEED_BYTES]);
@@ -57,8 +57,8 @@ void MLKEM768_generate_key_external_entropy(
57 * format for ML-KEM private keys. It returns one on success or zero on 57 * format for ML-KEM private keys. It returns one on success or zero on
58 * allocation error. 58 * allocation error.
59 */ 59 */
60int MLKEM768_marshal_private_key(CBB *out, 60int MLKEM768_marshal_private_key(const struct MLKEM768_private_key *private_key,
61 const struct MLKEM768_private_key *private_key); 61 uint8_t **out_private_key, size_t *out_private_key_len);
62 62
63/* 63/*
64 * MLKEM_encap_external_entropy behaves like |MLKEM_encap|, but uses 64 * MLKEM_encap_external_entropy behaves like |MLKEM_encap|, but uses
@@ -80,7 +80,7 @@ void MLKEM768_encap_external_entropy(
80 * regular callers should use the non-deterministic |MLKEM_generate_key| 80 * regular callers should use the non-deterministic |MLKEM_generate_key|
81 * directly. 81 * directly.
82 */ 82 */
83void MLKEM1024_generate_key_external_entropy( 83int MLKEM1024_generate_key_external_entropy(
84 uint8_t out_encoded_public_key[MLKEM1024_PUBLIC_KEY_BYTES], 84 uint8_t out_encoded_public_key[MLKEM1024_PUBLIC_KEY_BYTES],
85 struct MLKEM1024_private_key *out_private_key, 85 struct MLKEM1024_private_key *out_private_key,
86 const uint8_t entropy[MLKEM_SEED_BYTES]); 86 const uint8_t entropy[MLKEM_SEED_BYTES]);
@@ -96,8 +96,9 @@ void MLKEM1024_generate_key_external_entropy(
96 * standard format for ML-KEM private keys. It returns one on success or zero on 96 * standard format for ML-KEM private keys. It returns one on success or zero on
97 * allocation error. 97 * allocation error.
98 */ 98 */
99int MLKEM1024_marshal_private_key(CBB *out, 99int MLKEM1024_marshal_private_key(
100 const struct MLKEM1024_private_key *private_key); 100 const struct MLKEM1024_private_key *private_key, uint8_t **out_private_key,
101 size_t *out_private_key_len);
101 102
102/* 103/*
103 * MLKEM_encap_external_entropy behaves like |MLKEM_encap|, but uses 104 * MLKEM_encap_external_entropy behaves like |MLKEM_encap|, but uses
diff --git a/src/lib/libcrypto/modes/asm/ghash-x86.pl b/src/lib/libcrypto/modes/asm/ghash-x86.pl
index 47833582b6..395c680cc5 100644
--- a/src/lib/libcrypto/modes/asm/ghash-x86.pl
+++ b/src/lib/libcrypto/modes/asm/ghash-x86.pl
@@ -119,8 +119,7 @@ require "x86asm.pl";
119 119
120&asm_init($ARGV[0],"ghash-x86.pl",$x86only = $ARGV[$#ARGV] eq "386"); 120&asm_init($ARGV[0],"ghash-x86.pl",$x86only = $ARGV[$#ARGV] eq "386");
121 121
122$sse2=0; 122$sse2=1;
123for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); }
124 123
125($Zhh,$Zhl,$Zlh,$Zll) = ("ebp","edx","ecx","ebx"); 124($Zhh,$Zhl,$Zlh,$Zll) = ("ebp","edx","ecx","ebx");
126$inp = "edi"; 125$inp = "edi";
diff --git a/src/lib/libcrypto/modes/cbc128.c b/src/lib/libcrypto/modes/cbc128.c
index f8ebf79a87..1b6858ee25 100644
--- a/src/lib/libcrypto/modes/cbc128.c
+++ b/src/lib/libcrypto/modes/cbc128.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cbc128.c,v 1.8 2023/07/08 14:56:54 beck Exp $ */ 1/* $OpenBSD: cbc128.c,v 1.11 2025/04/23 10:09:08 jsing Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2008 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2008 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -49,15 +49,11 @@
49 * 49 *
50 */ 50 */
51 51
52#include <openssl/crypto.h>
53#include "modes_local.h"
54#include <string.h> 52#include <string.h>
55 53
56#ifndef MODES_DEBUG 54#include <openssl/crypto.h>
57# ifndef NDEBUG 55
58# define NDEBUG 56#include "modes_local.h"
59# endif
60#endif
61 57
62#undef STRICT_ALIGNMENT 58#undef STRICT_ALIGNMENT
63#ifdef __STRICT_ALIGNMENT 59#ifdef __STRICT_ALIGNMENT
@@ -74,7 +70,6 @@ CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out,
74 size_t n; 70 size_t n;
75 const unsigned char *iv = ivec; 71 const unsigned char *iv = ivec;
76 72
77#if !defined(OPENSSL_SMALL_FOOTPRINT)
78 if (STRICT_ALIGNMENT && 73 if (STRICT_ALIGNMENT &&
79 ((size_t)in|(size_t)out|(size_t)ivec) % sizeof(size_t) != 0) { 74 ((size_t)in|(size_t)out|(size_t)ivec) % sizeof(size_t) != 0) {
80 while (len >= 16) { 75 while (len >= 16) {
@@ -98,7 +93,6 @@ CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out,
98 out += 16; 93 out += 16;
99 } 94 }
100 } 95 }
101#endif
102 while (len) { 96 while (len) {
103 for (n = 0; n < 16 && n < len; ++n) 97 for (n = 0; n < 16 && n < len; ++n)
104 out[n] = in[n] ^ iv[n]; 98 out[n] = in[n] ^ iv[n];
@@ -127,7 +121,6 @@ CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out,
127 unsigned char c[16]; 121 unsigned char c[16];
128 } tmp; 122 } tmp;
129 123
130#if !defined(OPENSSL_SMALL_FOOTPRINT)
131 if (in != out) { 124 if (in != out) {
132 const unsigned char *iv = ivec; 125 const unsigned char *iv = ivec;
133 126
@@ -192,7 +185,6 @@ CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out,
192 } 185 }
193 } 186 }
194 } 187 }
195#endif
196 while (len) { 188 while (len) {
197 unsigned char c; 189 unsigned char c;
198 (*block)(in, tmp.c, key); 190 (*block)(in, tmp.c, key);
diff --git a/src/lib/libcrypto/modes/ccm128.c b/src/lib/libcrypto/modes/ccm128.c
index 68c5cce5da..e27681ee62 100644
--- a/src/lib/libcrypto/modes/ccm128.c
+++ b/src/lib/libcrypto/modes/ccm128.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ccm128.c,v 1.8 2023/07/08 14:56:54 beck Exp $ */ 1/* $OpenBSD: ccm128.c,v 1.12 2025/05/18 09:21:29 bcook Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2011 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2011 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -48,15 +48,11 @@
48 * ==================================================================== 48 * ====================================================================
49 */ 49 */
50 50
51#include <openssl/crypto.h>
52#include "modes_local.h"
53#include <string.h> 51#include <string.h>
54 52
55#ifndef MODES_DEBUG 53#include <openssl/crypto.h>
56# ifndef NDEBUG 54
57# define NDEBUG 55#include "modes_local.h"
58# endif
59#endif
60 56
61/* First you setup M and L parameters and pass the key schedule. 57/* First you setup M and L parameters and pass the key schedule.
62 * This is called once per session setup... */ 58 * This is called once per session setup... */
@@ -65,7 +61,7 @@ CRYPTO_ccm128_init(CCM128_CONTEXT *ctx,
65 unsigned int M, unsigned int L, void *key, block128_f block) 61 unsigned int M, unsigned int L, void *key, block128_f block)
66{ 62{
67 memset(ctx->nonce.c, 0, sizeof(ctx->nonce.c)); 63 memset(ctx->nonce.c, 0, sizeof(ctx->nonce.c));
68 ctx->nonce.c[0] = ((u8)(L - 1) & 7) | (u8)(((M - 2)/2) & 7) << 3; 64 ctx->nonce.c[0] = ((uint8_t)(L - 1) & 7) | (uint8_t)(((M - 2)/2) & 7) << 3;
69 ctx->blocks = 0; 65 ctx->blocks = 0;
70 ctx->block = block; 66 ctx->block = block;
71 ctx->key = key; 67 ctx->key = key;
@@ -85,17 +81,17 @@ CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx,
85 return -1; /* nonce is too short */ 81 return -1; /* nonce is too short */
86 82
87 if (sizeof(mlen) == 8 && L >= 3) { 83 if (sizeof(mlen) == 8 && L >= 3) {
88 ctx->nonce.c[8] = (u8)(mlen >> (56 % (sizeof(mlen)*8))); 84 ctx->nonce.c[8] = (uint8_t)(mlen >> (56 % (sizeof(mlen)*8)));
89 ctx->nonce.c[9] = (u8)(mlen >> (48 % (sizeof(mlen)*8))); 85 ctx->nonce.c[9] = (uint8_t)(mlen >> (48 % (sizeof(mlen)*8)));
90 ctx->nonce.c[10] = (u8)(mlen >> (40 % (sizeof(mlen)*8))); 86 ctx->nonce.c[10] = (uint8_t)(mlen >> (40 % (sizeof(mlen)*8)));
91 ctx->nonce.c[11] = (u8)(mlen >> (32 % (sizeof(mlen)*8))); 87 ctx->nonce.c[11] = (uint8_t)(mlen >> (32 % (sizeof(mlen)*8)));
92 } else 88 } else
93 ctx->nonce.u[1] = 0; 89 ctx->nonce.u[1] = 0;
94 90
95 ctx->nonce.c[12] = (u8)(mlen >> 24); 91 ctx->nonce.c[12] = (uint8_t)(mlen >> 24);
96 ctx->nonce.c[13] = (u8)(mlen >> 16); 92 ctx->nonce.c[13] = (uint8_t)(mlen >> 16);
97 ctx->nonce.c[14] = (u8)(mlen >> 8); 93 ctx->nonce.c[14] = (uint8_t)(mlen >> 8);
98 ctx->nonce.c[15] = (u8)mlen; 94 ctx->nonce.c[15] = (uint8_t)mlen;
99 95
100 ctx->nonce.c[0] &= ~0x40; /* clear Adata flag */ 96 ctx->nonce.c[0] &= ~0x40; /* clear Adata flag */
101 memcpy(&ctx->nonce.c[1], nonce, 14 - L); 97 memcpy(&ctx->nonce.c[1], nonce, 14 - L);
@@ -120,29 +116,29 @@ CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx,
120 ctx->blocks++; 116 ctx->blocks++;
121 117
122 if (alen < (0x10000 - 0x100)) { 118 if (alen < (0x10000 - 0x100)) {
123 ctx->cmac.c[0] ^= (u8)(alen >> 8); 119 ctx->cmac.c[0] ^= (uint8_t)(alen >> 8);
124 ctx->cmac.c[1] ^= (u8)alen; 120 ctx->cmac.c[1] ^= (uint8_t)alen;
125 i = 2; 121 i = 2;
126 } else if (sizeof(alen) == 8 && 122 } else if (sizeof(alen) == 8 &&
127 alen >= (size_t)1 << (32 % (sizeof(alen)*8))) { 123 alen >= (size_t)1 << (32 % (sizeof(alen)*8))) {
128 ctx->cmac.c[0] ^= 0xFF; 124 ctx->cmac.c[0] ^= 0xFF;
129 ctx->cmac.c[1] ^= 0xFF; 125 ctx->cmac.c[1] ^= 0xFF;
130 ctx->cmac.c[2] ^= (u8)(alen >> (56 % (sizeof(alen)*8))); 126 ctx->cmac.c[2] ^= (uint8_t)(alen >> (56 % (sizeof(alen)*8)));
131 ctx->cmac.c[3] ^= (u8)(alen >> (48 % (sizeof(alen)*8))); 127 ctx->cmac.c[3] ^= (uint8_t)(alen >> (48 % (sizeof(alen)*8)));
132 ctx->cmac.c[4] ^= (u8)(alen >> (40 % (sizeof(alen)*8))); 128 ctx->cmac.c[4] ^= (uint8_t)(alen >> (40 % (sizeof(alen)*8)));
133 ctx->cmac.c[5] ^= (u8)(alen >> (32 % (sizeof(alen)*8))); 129 ctx->cmac.c[5] ^= (uint8_t)(alen >> (32 % (sizeof(alen)*8)));
134 ctx->cmac.c[6] ^= (u8)(alen >> 24); 130 ctx->cmac.c[6] ^= (uint8_t)(alen >> 24);
135 ctx->cmac.c[7] ^= (u8)(alen >> 16); 131 ctx->cmac.c[7] ^= (uint8_t)(alen >> 16);
136 ctx->cmac.c[8] ^= (u8)(alen >> 8); 132 ctx->cmac.c[8] ^= (uint8_t)(alen >> 8);
137 ctx->cmac.c[9] ^= (u8)alen; 133 ctx->cmac.c[9] ^= (uint8_t)alen;
138 i = 10; 134 i = 10;
139 } else { 135 } else {
140 ctx->cmac.c[0] ^= 0xFF; 136 ctx->cmac.c[0] ^= 0xFF;
141 ctx->cmac.c[1] ^= 0xFE; 137 ctx->cmac.c[1] ^= 0xFE;
142 ctx->cmac.c[2] ^= (u8)(alen >> 24); 138 ctx->cmac.c[2] ^= (uint8_t)(alen >> 24);
143 ctx->cmac.c[3] ^= (u8)(alen >> 16); 139 ctx->cmac.c[3] ^= (uint8_t)(alen >> 16);
144 ctx->cmac.c[4] ^= (u8)(alen >> 8); 140 ctx->cmac.c[4] ^= (uint8_t)(alen >> 8);
145 ctx->cmac.c[5] ^= (u8)alen; 141 ctx->cmac.c[5] ^= (uint8_t)alen;
146 i = 6; 142 i = 6;
147 } 143 }
148 144
@@ -164,7 +160,7 @@ static void
164ctr64_inc(unsigned char *counter) 160ctr64_inc(unsigned char *counter)
165{ 161{
166 unsigned int n = 8; 162 unsigned int n = 8;
167 u8 c; 163 uint8_t c;
168 164
169 counter += 8; 165 counter += 8;
170 do { 166 do {
@@ -188,8 +184,8 @@ CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx,
188 block128_f block = ctx->block; 184 block128_f block = ctx->block;
189 void *key = ctx->key; 185 void *key = ctx->key;
190 union { 186 union {
191 u64 u[2]; 187 uint64_t u[2];
192 u8 c[16]; 188 uint8_t c[16];
193 } scratch; 189 } scratch;
194 190
195 if (!(flags0 & 0x40)) 191 if (!(flags0 & 0x40))
@@ -215,16 +211,16 @@ CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx,
215 while (len >= 16) { 211 while (len >= 16) {
216#ifdef __STRICT_ALIGNMENT 212#ifdef __STRICT_ALIGNMENT
217 union { 213 union {
218 u64 u[2]; 214 uint64_t u[2];
219 u8 c[16]; 215 uint8_t c[16];
220 } temp; 216 } temp;
221 217
222 memcpy(temp.c, inp, 16); 218 memcpy(temp.c, inp, 16);
223 ctx->cmac.u[0] ^= temp.u[0]; 219 ctx->cmac.u[0] ^= temp.u[0];
224 ctx->cmac.u[1] ^= temp.u[1]; 220 ctx->cmac.u[1] ^= temp.u[1];
225#else 221#else
226 ctx->cmac.u[0] ^= ((u64 *)inp)[0]; 222 ctx->cmac.u[0] ^= ((uint64_t *)inp)[0];
227 ctx->cmac.u[1] ^= ((u64 *)inp)[1]; 223 ctx->cmac.u[1] ^= ((uint64_t *)inp)[1];
228#endif 224#endif
229 (*block)(ctx->cmac.c, ctx->cmac.c, key); 225 (*block)(ctx->cmac.c, ctx->cmac.c, key);
230 (*block)(ctx->nonce.c, scratch.c, key); 226 (*block)(ctx->nonce.c, scratch.c, key);
@@ -234,8 +230,8 @@ CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx,
234 temp.u[1] ^= scratch.u[1]; 230 temp.u[1] ^= scratch.u[1];
235 memcpy(out, temp.c, 16); 231 memcpy(out, temp.c, 16);
236#else 232#else
237 ((u64 *)out)[0] = scratch.u[0] ^ ((u64 *)inp)[0]; 233 ((uint64_t *)out)[0] = scratch.u[0] ^ ((uint64_t *)inp)[0];
238 ((u64 *)out)[1] = scratch.u[1] ^ ((u64 *)inp)[1]; 234 ((uint64_t *)out)[1] = scratch.u[1] ^ ((uint64_t *)inp)[1];
239#endif 235#endif
240 inp += 16; 236 inp += 16;
241 out += 16; 237 out += 16;
@@ -275,8 +271,8 @@ CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx,
275 block128_f block = ctx->block; 271 block128_f block = ctx->block;
276 void *key = ctx->key; 272 void *key = ctx->key;
277 union { 273 union {
278 u64 u[2]; 274 uint64_t u[2];
279 u8 c[16]; 275 uint8_t c[16];
280 } scratch; 276 } scratch;
281 277
282 if (!(flags0 & 0x40)) 278 if (!(flags0 & 0x40))
@@ -297,8 +293,8 @@ CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx,
297 while (len >= 16) { 293 while (len >= 16) {
298#ifdef __STRICT_ALIGNMENT 294#ifdef __STRICT_ALIGNMENT
299 union { 295 union {
300 u64 u[2]; 296 uint64_t u[2];
301 u8 c[16]; 297 uint8_t c[16];
302 } temp; 298 } temp;
303#endif 299#endif
304 (*block)(ctx->nonce.c, scratch.c, key); 300 (*block)(ctx->nonce.c, scratch.c, key);
@@ -309,10 +305,10 @@ CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx,
309 ctx->cmac.u[1] ^= (scratch.u[1] ^= temp.u[1]); 305 ctx->cmac.u[1] ^= (scratch.u[1] ^= temp.u[1]);
310 memcpy(out, scratch.c, 16); 306 memcpy(out, scratch.c, 16);
311#else 307#else
312 ctx->cmac.u[0] ^= (((u64 *)out)[0] = scratch.u[0] ^ 308 ctx->cmac.u[0] ^= (((uint64_t *)out)[0] = scratch.u[0] ^
313 ((u64 *)inp)[0]); 309 ((uint64_t *)inp)[0]);
314 ctx->cmac.u[1] ^= (((u64 *)out)[1] = scratch.u[1] ^ 310 ctx->cmac.u[1] ^= (((uint64_t *)out)[1] = scratch.u[1] ^
315 ((u64 *)inp)[1]); 311 ((uint64_t *)inp)[1]);
316#endif 312#endif
317 (*block)(ctx->cmac.c, ctx->cmac.c, key); 313 (*block)(ctx->cmac.c, ctx->cmac.c, key);
318 314
@@ -367,8 +363,8 @@ CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx,
367 block128_f block = ctx->block; 363 block128_f block = ctx->block;
368 void *key = ctx->key; 364 void *key = ctx->key;
369 union { 365 union {
370 u64 u[2]; 366 uint64_t u[2];
371 u8 c[16]; 367 uint8_t c[16];
372 } scratch; 368 } scratch;
373 369
374 if (!(flags0 & 0x40)) 370 if (!(flags0 & 0x40))
@@ -434,8 +430,8 @@ CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx,
434 block128_f block = ctx->block; 430 block128_f block = ctx->block;
435 void *key = ctx->key; 431 void *key = ctx->key;
436 union { 432 union {
437 u64 u[2]; 433 uint64_t u[2];
438 u8 c[16]; 434 uint8_t c[16];
439 } scratch; 435 } scratch;
440 436
441 if (!(flags0 & 0x40)) 437 if (!(flags0 & 0x40))
diff --git a/src/lib/libcrypto/modes/cfb128.c b/src/lib/libcrypto/modes/cfb128.c
index 931353a620..9a63a46724 100644
--- a/src/lib/libcrypto/modes/cfb128.c
+++ b/src/lib/libcrypto/modes/cfb128.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cfb128.c,v 1.7 2023/07/08 14:56:54 beck Exp $ */ 1/* $OpenBSD: cfb128.c,v 1.10 2025/04/23 10:09:08 jsing Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2008 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2008 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -49,15 +49,11 @@
49 * 49 *
50 */ 50 */
51 51
52#include <openssl/crypto.h>
53#include "modes_local.h"
54#include <string.h> 52#include <string.h>
55 53
56#ifndef MODES_DEBUG 54#include <openssl/crypto.h>
57# ifndef NDEBUG 55
58# define NDEBUG 56#include "modes_local.h"
59# endif
60#endif
61 57
62/* The input and output encrypted as though 128bit cfb mode is being 58/* The input and output encrypted as though 128bit cfb mode is being
63 * used. The extra state information to record how much of the 59 * used. The extra state information to record how much of the
@@ -75,7 +71,6 @@ CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out,
75 n = *num; 71 n = *num;
76 72
77 if (enc) { 73 if (enc) {
78#if !defined(OPENSSL_SMALL_FOOTPRINT)
79 if (16 % sizeof(size_t) == 0) 74 if (16 % sizeof(size_t) == 0)
80 do { /* always true actually */ 75 do { /* always true actually */
81 while (n && len) { 76 while (n && len) {
@@ -111,7 +106,6 @@ CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out,
111 return; 106 return;
112 } while (0); 107 } while (0);
113 /* the rest would be commonly eliminated by x86* compiler */ 108 /* the rest would be commonly eliminated by x86* compiler */
114#endif
115 while (l < len) { 109 while (l < len) {
116 if (n == 0) { 110 if (n == 0) {
117 (*block)(ivec, ivec, key); 111 (*block)(ivec, ivec, key);
@@ -122,7 +116,6 @@ CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out,
122 } 116 }
123 *num = n; 117 *num = n;
124 } else { 118 } else {
125#if !defined(OPENSSL_SMALL_FOOTPRINT)
126 if (16 % sizeof(size_t) == 0) 119 if (16 % sizeof(size_t) == 0)
127 do { /* always true actually */ 120 do { /* always true actually */
128 while (n && len) { 121 while (n && len) {
@@ -163,7 +156,6 @@ CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out,
163 return; 156 return;
164 } while (0); 157 } while (0);
165 /* the rest would be commonly eliminated by x86* compiler */ 158 /* the rest would be commonly eliminated by x86* compiler */
166#endif
167 while (l < len) { 159 while (l < len) {
168 unsigned char c; 160 unsigned char c;
169 if (n == 0) { 161 if (n == 0) {
diff --git a/src/lib/libcrypto/modes/ctr128.c b/src/lib/libcrypto/modes/ctr128.c
index 6d507dfc3a..87d9abb355 100644
--- a/src/lib/libcrypto/modes/ctr128.c
+++ b/src/lib/libcrypto/modes/ctr128.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ctr128.c,v 1.11 2023/07/08 14:56:54 beck Exp $ */ 1/* $OpenBSD: ctr128.c,v 1.18 2025/05/18 09:05:59 jsing Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2008 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2008 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -49,16 +49,12 @@
49 * 49 *
50 */ 50 */
51 51
52#include <openssl/crypto.h>
53#include "modes_local.h"
54#include <string.h> 52#include <string.h>
55 53
56#ifndef MODES_DEBUG 54#include <openssl/crypto.h>
57# ifndef NDEBUG 55
58# define NDEBUG 56#include "crypto_internal.h"
59# endif 57#include "modes_local.h"
60#endif
61#include <assert.h>
62 58
63/* NOTE: the IV/counter CTR mode is big-endian. The code itself 59/* NOTE: the IV/counter CTR mode is big-endian. The code itself
64 * is endian-neutral. */ 60 * is endian-neutral. */
@@ -67,8 +63,8 @@
67static void 63static void
68ctr128_inc(unsigned char *counter) 64ctr128_inc(unsigned char *counter)
69{ 65{
70 u32 n = 16; 66 uint32_t n = 16;
71 u8 c; 67 uint8_t c;
72 68
73 do { 69 do {
74 --n; 70 --n;
@@ -80,7 +76,6 @@ ctr128_inc(unsigned char *counter)
80 } while (n); 76 } while (n);
81} 77}
82 78
83#if !defined(OPENSSL_SMALL_FOOTPRINT)
84static void 79static void
85ctr128_inc_aligned(unsigned char *counter) 80ctr128_inc_aligned(unsigned char *counter)
86{ 81{
@@ -100,7 +95,6 @@ ctr128_inc_aligned(unsigned char *counter)
100 } while (n); 95 } while (n);
101#endif 96#endif
102} 97}
103#endif
104 98
105/* The input encrypted as though 128bit counter mode is being 99/* The input encrypted as though 128bit counter mode is being
106 * used. The extra state information to record how much of the 100 * used. The extra state information to record how much of the
@@ -121,14 +115,11 @@ CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out,
121 unsigned char ivec[16], unsigned char ecount_buf[16], 115 unsigned char ivec[16], unsigned char ecount_buf[16],
122 unsigned int *num, block128_f block) 116 unsigned int *num, block128_f block)
123{ 117{
124 unsigned int n; 118 unsigned int n = *num;
125 size_t l = 0; 119 size_t l = 0;
126 120
127 assert(*num < 16); 121 OPENSSL_assert(n < 16);
128
129 n = *num;
130 122
131#if !defined(OPENSSL_SMALL_FOOTPRINT)
132 if (16 % sizeof(size_t) == 0) 123 if (16 % sizeof(size_t) == 0)
133 do { /* always true actually */ 124 do { /* always true actually */
134 while (n && len) { 125 while (n && len) {
@@ -166,7 +157,6 @@ CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out,
166 return; 157 return;
167 } while (0); 158 } while (0);
168 /* the rest would be commonly eliminated by x86* compiler */ 159 /* the rest would be commonly eliminated by x86* compiler */
169#endif
170 while (l < len) { 160 while (l < len) {
171 if (n == 0) { 161 if (n == 0) {
172 (*block)(ivec, ecount_buf, key); 162 (*block)(ivec, ecount_buf, key);
@@ -185,8 +175,8 @@ LCRYPTO_ALIAS(CRYPTO_ctr128_encrypt);
185static void 175static void
186ctr96_inc(unsigned char *counter) 176ctr96_inc(unsigned char *counter)
187{ 177{
188 u32 n = 12; 178 uint32_t n = 12;
189 u8 c; 179 uint8_t c;
190 180
191 do { 181 do {
192 --n; 182 --n;
@@ -204,11 +194,10 @@ CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out,
204 unsigned char ivec[16], unsigned char ecount_buf[16], 194 unsigned char ivec[16], unsigned char ecount_buf[16],
205 unsigned int *num, ctr128_f func) 195 unsigned int *num, ctr128_f func)
206{ 196{
207 unsigned int n, ctr32; 197 unsigned int n = *num;
198 unsigned int ctr32;
208 199
209 assert(*num < 16); 200 OPENSSL_assert(n < 16);
210
211 n = *num;
212 201
213 while (n && len) { 202 while (n && len) {
214 *(out++) = *(in++) ^ ecount_buf[n]; 203 *(out++) = *(in++) ^ ecount_buf[n];
@@ -216,7 +205,8 @@ CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out,
216 n = (n + 1) % 16; 205 n = (n + 1) % 16;
217 } 206 }
218 207
219 ctr32 = GETU32(ivec + 12); 208 ctr32 = crypto_load_be32toh(&ivec[12]);
209
220 while (len >= 16) { 210 while (len >= 16) {
221 size_t blocks = len/16; 211 size_t blocks = len/16;
222 /* 212 /*
@@ -233,14 +223,14 @@ CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out,
233 * overflow, which is then handled by limiting the 223 * overflow, which is then handled by limiting the
234 * amount of blocks to the exact overflow point... 224 * amount of blocks to the exact overflow point...
235 */ 225 */
236 ctr32 += (u32)blocks; 226 ctr32 += (uint32_t)blocks;
237 if (ctr32 < blocks) { 227 if (ctr32 < blocks) {
238 blocks -= ctr32; 228 blocks -= ctr32;
239 ctr32 = 0; 229 ctr32 = 0;
240 } 230 }
241 (*func)(in, out, blocks, key, ivec); 231 (*func)(in, out, blocks, key, ivec);
242 /* (*ctr) does not update ivec, caller does: */ 232 /* (*ctr) does not update ivec, caller does: */
243 PUTU32(ivec + 12, ctr32); 233 crypto_store_htobe32(&ivec[12], ctr32);
244 /* ... overflow was detected, propagate carry. */ 234 /* ... overflow was detected, propagate carry. */
245 if (ctr32 == 0) 235 if (ctr32 == 0)
246 ctr96_inc(ivec); 236 ctr96_inc(ivec);
@@ -253,7 +243,7 @@ CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out,
253 memset(ecount_buf, 0, 16); 243 memset(ecount_buf, 0, 16);
254 (*func)(ecount_buf, ecount_buf, 1, key, ivec); 244 (*func)(ecount_buf, ecount_buf, 1, key, ivec);
255 ++ctr32; 245 ++ctr32;
256 PUTU32(ivec + 12, ctr32); 246 crypto_store_htobe32(&ivec[12], ctr32);
257 if (ctr32 == 0) 247 if (ctr32 == 0)
258 ctr96_inc(ivec); 248 ctr96_inc(ivec);
259 while (len--) { 249 while (len--) {
diff --git a/src/lib/libcrypto/modes/gcm128.c b/src/lib/libcrypto/modes/gcm128.c
index 6c89bd44b7..b6874296e0 100644
--- a/src/lib/libcrypto/modes/gcm128.c
+++ b/src/lib/libcrypto/modes/gcm128.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: gcm128.c,v 1.27 2024/09/06 09:57:32 tb Exp $ */ 1/* $OpenBSD: gcm128.c,v 1.54 2025/06/28 12:39:10 jsing Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2010 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2010 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -48,8 +48,6 @@
48 * ==================================================================== 48 * ====================================================================
49 */ 49 */
50 50
51#define OPENSSL_FIPSAPI
52
53#include <string.h> 51#include <string.h>
54 52
55#include <openssl/crypto.h> 53#include <openssl/crypto.h>
@@ -57,284 +55,54 @@
57#include "crypto_internal.h" 55#include "crypto_internal.h"
58#include "modes_local.h" 56#include "modes_local.h"
59 57
60#ifndef MODES_DEBUG 58void
61# ifndef NDEBUG 59gcm_init_4bit(u128 Htable[16], uint64_t H[2])
62# define NDEBUG
63# endif
64#endif
65
66#if defined(BSWAP4) && defined(__STRICT_ALIGNMENT)
67/* redefine, because alignment is ensured */
68#undef GETU32
69#define GETU32(p) BSWAP4(*(const u32 *)(p))
70#endif
71
72#define PACK(s) ((size_t)(s)<<(sizeof(size_t)*8-16))
73#define REDUCE1BIT(V) \
74 do { \
75 if (sizeof(size_t)==8) { \
76 u64 T = U64(0xe100000000000000) & (0-(V.lo&1)); \
77 V.lo = (V.hi<<63)|(V.lo>>1); \
78 V.hi = (V.hi>>1 )^T; \
79 } else { \
80 u32 T = 0xe1000000U & (0-(u32)(V.lo&1)); \
81 V.lo = (V.hi<<63)|(V.lo>>1); \
82 V.hi = (V.hi>>1 )^((u64)T<<32); \
83 } \
84 } while(0)
85
86/*
87 * Even though permitted values for TABLE_BITS are 8, 4 and 1, it should
88 * never be set to 8. 8 is effectively reserved for testing purposes.
89 * TABLE_BITS>1 are lookup-table-driven implementations referred to as
90 * "Shoup's" in GCM specification. In other words OpenSSL does not cover
91 * whole spectrum of possible table driven implementations. Why? In
92 * non-"Shoup's" case memory access pattern is segmented in such manner,
93 * that it's trivial to see that cache timing information can reveal
94 * fair portion of intermediate hash value. Given that ciphertext is
95 * always available to attacker, it's possible for him to attempt to
96 * deduce secret parameter H and if successful, tamper with messages
97 * [which is nothing but trivial in CTR mode]. In "Shoup's" case it's
98 * not as trivial, but there is no reason to believe that it's resistant
99 * to cache-timing attack. And the thing about "8-bit" implementation is
100 * that it consumes 16 (sixteen) times more memory, 4KB per individual
101 * key + 1KB shared. Well, on pros side it should be twice as fast as
102 * "4-bit" version. And for gcc-generated x86[_64] code, "8-bit" version
103 * was observed to run ~75% faster, closer to 100% for commercial
104 * compilers... Yet "4-bit" procedure is preferred, because it's
105 * believed to provide better security-performance balance and adequate
106 * all-round performance. "All-round" refers to things like:
107 *
108 * - shorter setup time effectively improves overall timing for
109 * handling short messages;
110 * - larger table allocation can become unbearable because of VM
111 * subsystem penalties (for example on Windows large enough free
112 * results in VM working set trimming, meaning that consequent
113 * malloc would immediately incur working set expansion);
114 * - larger table has larger cache footprint, which can affect
115 * performance of other code paths (not necessarily even from same
116 * thread in Hyper-Threading world);
117 *
118 * Value of 1 is not appropriate for performance reasons.
119 */
120#if TABLE_BITS==8
121
122static void
123gcm_init_8bit(u128 Htable[256], u64 H[2])
124{
125 int i, j;
126 u128 V;
127
128 Htable[0].hi = 0;
129 Htable[0].lo = 0;
130 V.hi = H[0];
131 V.lo = H[1];
132
133 for (Htable[128] = V, i = 64; i > 0; i >>= 1) {
134 REDUCE1BIT(V);
135 Htable[i] = V;
136 }
137
138 for (i = 2; i < 256; i <<= 1) {
139 u128 *Hi = Htable + i, H0 = *Hi;
140 for (j = 1; j < i; ++j) {
141 Hi[j].hi = H0.hi ^ Htable[j].hi;
142 Hi[j].lo = H0.lo ^ Htable[j].lo;
143 }
144 }
145}
146
147static void
148gcm_gmult_8bit(u64 Xi[2], const u128 Htable[256])
149{
150 u128 Z = { 0, 0};
151 const u8 *xi = (const u8 *)Xi + 15;
152 size_t rem, n = *xi;
153 static const size_t rem_8bit[256] = {
154 PACK(0x0000), PACK(0x01C2), PACK(0x0384), PACK(0x0246),
155 PACK(0x0708), PACK(0x06CA), PACK(0x048C), PACK(0x054E),
156 PACK(0x0E10), PACK(0x0FD2), PACK(0x0D94), PACK(0x0C56),
157 PACK(0x0918), PACK(0x08DA), PACK(0x0A9C), PACK(0x0B5E),
158 PACK(0x1C20), PACK(0x1DE2), PACK(0x1FA4), PACK(0x1E66),
159 PACK(0x1B28), PACK(0x1AEA), PACK(0x18AC), PACK(0x196E),
160 PACK(0x1230), PACK(0x13F2), PACK(0x11B4), PACK(0x1076),
161 PACK(0x1538), PACK(0x14FA), PACK(0x16BC), PACK(0x177E),
162 PACK(0x3840), PACK(0x3982), PACK(0x3BC4), PACK(0x3A06),
163 PACK(0x3F48), PACK(0x3E8A), PACK(0x3CCC), PACK(0x3D0E),
164 PACK(0x3650), PACK(0x3792), PACK(0x35D4), PACK(0x3416),
165 PACK(0x3158), PACK(0x309A), PACK(0x32DC), PACK(0x331E),
166 PACK(0x2460), PACK(0x25A2), PACK(0x27E4), PACK(0x2626),
167 PACK(0x2368), PACK(0x22AA), PACK(0x20EC), PACK(0x212E),
168 PACK(0x2A70), PACK(0x2BB2), PACK(0x29F4), PACK(0x2836),
169 PACK(0x2D78), PACK(0x2CBA), PACK(0x2EFC), PACK(0x2F3E),
170 PACK(0x7080), PACK(0x7142), PACK(0x7304), PACK(0x72C6),
171 PACK(0x7788), PACK(0x764A), PACK(0x740C), PACK(0x75CE),
172 PACK(0x7E90), PACK(0x7F52), PACK(0x7D14), PACK(0x7CD6),
173 PACK(0x7998), PACK(0x785A), PACK(0x7A1C), PACK(0x7BDE),
174 PACK(0x6CA0), PACK(0x6D62), PACK(0x6F24), PACK(0x6EE6),
175 PACK(0x6BA8), PACK(0x6A6A), PACK(0x682C), PACK(0x69EE),
176 PACK(0x62B0), PACK(0x6372), PACK(0x6134), PACK(0x60F6),
177 PACK(0x65B8), PACK(0x647A), PACK(0x663C), PACK(0x67FE),
178 PACK(0x48C0), PACK(0x4902), PACK(0x4B44), PACK(0x4A86),
179 PACK(0x4FC8), PACK(0x4E0A), PACK(0x4C4C), PACK(0x4D8E),
180 PACK(0x46D0), PACK(0x4712), PACK(0x4554), PACK(0x4496),
181 PACK(0x41D8), PACK(0x401A), PACK(0x425C), PACK(0x439E),
182 PACK(0x54E0), PACK(0x5522), PACK(0x5764), PACK(0x56A6),
183 PACK(0x53E8), PACK(0x522A), PACK(0x506C), PACK(0x51AE),
184 PACK(0x5AF0), PACK(0x5B32), PACK(0x5974), PACK(0x58B6),
185 PACK(0x5DF8), PACK(0x5C3A), PACK(0x5E7C), PACK(0x5FBE),
186 PACK(0xE100), PACK(0xE0C2), PACK(0xE284), PACK(0xE346),
187 PACK(0xE608), PACK(0xE7CA), PACK(0xE58C), PACK(0xE44E),
188 PACK(0xEF10), PACK(0xEED2), PACK(0xEC94), PACK(0xED56),
189 PACK(0xE818), PACK(0xE9DA), PACK(0xEB9C), PACK(0xEA5E),
190 PACK(0xFD20), PACK(0xFCE2), PACK(0xFEA4), PACK(0xFF66),
191 PACK(0xFA28), PACK(0xFBEA), PACK(0xF9AC), PACK(0xF86E),
192 PACK(0xF330), PACK(0xF2F2), PACK(0xF0B4), PACK(0xF176),
193 PACK(0xF438), PACK(0xF5FA), PACK(0xF7BC), PACK(0xF67E),
194 PACK(0xD940), PACK(0xD882), PACK(0xDAC4), PACK(0xDB06),
195 PACK(0xDE48), PACK(0xDF8A), PACK(0xDDCC), PACK(0xDC0E),
196 PACK(0xD750), PACK(0xD692), PACK(0xD4D4), PACK(0xD516),
197 PACK(0xD058), PACK(0xD19A), PACK(0xD3DC), PACK(0xD21E),
198 PACK(0xC560), PACK(0xC4A2), PACK(0xC6E4), PACK(0xC726),
199 PACK(0xC268), PACK(0xC3AA), PACK(0xC1EC), PACK(0xC02E),
200 PACK(0xCB70), PACK(0xCAB2), PACK(0xC8F4), PACK(0xC936),
201 PACK(0xCC78), PACK(0xCDBA), PACK(0xCFFC), PACK(0xCE3E),
202 PACK(0x9180), PACK(0x9042), PACK(0x9204), PACK(0x93C6),
203 PACK(0x9688), PACK(0x974A), PACK(0x950C), PACK(0x94CE),
204 PACK(0x9F90), PACK(0x9E52), PACK(0x9C14), PACK(0x9DD6),
205 PACK(0x9898), PACK(0x995A), PACK(0x9B1C), PACK(0x9ADE),
206 PACK(0x8DA0), PACK(0x8C62), PACK(0x8E24), PACK(0x8FE6),
207 PACK(0x8AA8), PACK(0x8B6A), PACK(0x892C), PACK(0x88EE),
208 PACK(0x83B0), PACK(0x8272), PACK(0x8034), PACK(0x81F6),
209 PACK(0x84B8), PACK(0x857A), PACK(0x873C), PACK(0x86FE),
210 PACK(0xA9C0), PACK(0xA802), PACK(0xAA44), PACK(0xAB86),
211 PACK(0xAEC8), PACK(0xAF0A), PACK(0xAD4C), PACK(0xAC8E),
212 PACK(0xA7D0), PACK(0xA612), PACK(0xA454), PACK(0xA596),
213 PACK(0xA0D8), PACK(0xA11A), PACK(0xA35C), PACK(0xA29E),
214 PACK(0xB5E0), PACK(0xB422), PACK(0xB664), PACK(0xB7A6),
215 PACK(0xB2E8), PACK(0xB32A), PACK(0xB16C), PACK(0xB0AE),
216 PACK(0xBBF0), PACK(0xBA32), PACK(0xB874), PACK(0xB9B6),
217 PACK(0xBCF8), PACK(0xBD3A), PACK(0xBF7C), PACK(0xBEBE) };
218
219 while (1) {
220 Z.hi ^= Htable[n].hi;
221 Z.lo ^= Htable[n].lo;
222
223 if ((u8 *)Xi == xi)
224 break;
225
226 n = *(--xi);
227
228 rem = (size_t)Z.lo & 0xff;
229 Z.lo = (Z.hi << 56)|(Z.lo >> 8);
230 Z.hi = (Z.hi >> 8);
231#if SIZE_MAX == 0xffffffffffffffff
232 Z.hi ^= rem_8bit[rem];
233#else
234 Z.hi ^= (u64)rem_8bit[rem] << 32;
235#endif
236 }
237
238 Xi[0] = htobe64(Z.hi);
239 Xi[1] = htobe64(Z.lo);
240}
241#define GCM_MUL(ctx,Xi) gcm_gmult_8bit(ctx->Xi.u,ctx->Htable)
242
243#elif TABLE_BITS==4
244
245static void
246gcm_init_4bit(u128 Htable[16], u64 H[2])
247{ 60{
248 u128 V; 61 u128 V;
249#if defined(OPENSSL_SMALL_FOOTPRINT) 62 uint64_t T;
250 int i; 63 int i;
251#endif
252 64
253 Htable[0].hi = 0; 65 Htable[0].hi = 0;
254 Htable[0].lo = 0; 66 Htable[0].lo = 0;
255 V.hi = H[0]; 67 V.hi = H[0];
256 V.lo = H[1]; 68 V.lo = H[1];
257 69
258#if defined(OPENSSL_SMALL_FOOTPRINT)
259 for (Htable[8] = V, i = 4; i > 0; i >>= 1) { 70 for (Htable[8] = V, i = 4; i > 0; i >>= 1) {
260 REDUCE1BIT(V); 71 T = U64(0xe100000000000000) & (0 - (V.lo & 1));
72 V.lo = (V.hi << 63) | (V.lo >> 1);
73 V.hi = (V.hi >> 1 ) ^ T;
261 Htable[i] = V; 74 Htable[i] = V;
262 } 75 }
263 76
264 for (i = 2; i < 16; i <<= 1) { 77 for (i = 2; i < 16; i <<= 1) {
265 u128 *Hi = Htable + i; 78 u128 *Hi = Htable + i;
266 int j; 79 int j;
267 for (V = *Hi, j = 1; j < i; ++j) { 80 for (V = *Hi, j = 1; j < i; j++) {
268 Hi[j].hi = V.hi ^ Htable[j].hi; 81 Hi[j].hi = V.hi ^ Htable[j].hi;
269 Hi[j].lo = V.lo ^ Htable[j].lo; 82 Hi[j].lo = V.lo ^ Htable[j].lo;
270 } 83 }
271 } 84 }
272#else
273 Htable[8] = V;
274 REDUCE1BIT(V);
275 Htable[4] = V;
276 REDUCE1BIT(V);
277 Htable[2] = V;
278 REDUCE1BIT(V);
279 Htable[1] = V;
280 Htable[3].hi = V.hi ^ Htable[2].hi, Htable[3].lo = V.lo ^ Htable[2].lo;
281 V = Htable[4];
282 Htable[5].hi = V.hi ^ Htable[1].hi, Htable[5].lo = V.lo ^ Htable[1].lo;
283 Htable[6].hi = V.hi ^ Htable[2].hi, Htable[6].lo = V.lo ^ Htable[2].lo;
284 Htable[7].hi = V.hi ^ Htable[3].hi, Htable[7].lo = V.lo ^ Htable[3].lo;
285 V = Htable[8];
286 Htable[9].hi = V.hi ^ Htable[1].hi, Htable[9].lo = V.lo ^ Htable[1].lo;
287 Htable[10].hi = V.hi ^ Htable[2].hi,
288 Htable[10].lo = V.lo ^ Htable[2].lo;
289 Htable[11].hi = V.hi ^ Htable[3].hi,
290 Htable[11].lo = V.lo ^ Htable[3].lo;
291 Htable[12].hi = V.hi ^ Htable[4].hi,
292 Htable[12].lo = V.lo ^ Htable[4].lo;
293 Htable[13].hi = V.hi ^ Htable[5].hi,
294 Htable[13].lo = V.lo ^ Htable[5].lo;
295 Htable[14].hi = V.hi ^ Htable[6].hi,
296 Htable[14].lo = V.lo ^ Htable[6].lo;
297 Htable[15].hi = V.hi ^ Htable[7].hi,
298 Htable[15].lo = V.lo ^ Htable[7].lo;
299#endif
300#if defined(GHASH_ASM) && (defined(__arm__) || defined(__arm))
301 /*
302 * ARM assembler expects specific dword order in Htable.
303 */
304 {
305 int j;
306#if BYTE_ORDER == LITTLE_ENDIAN
307 for (j = 0; j < 16; ++j) {
308 V = Htable[j];
309 Htable[j].hi = V.lo;
310 Htable[j].lo = V.hi;
311 }
312#else /* BIG_ENDIAN */
313 for (j = 0; j < 16; ++j) {
314 V = Htable[j];
315 Htable[j].hi = V.lo << 32|V.lo >> 32;
316 Htable[j].lo = V.hi << 32|V.hi >> 32;
317 }
318#endif
319 }
320#endif
321} 85}
322 86
323#ifndef GHASH_ASM 87#ifdef GHASH_ASM
324static const size_t rem_4bit[16] = { 88void gcm_gmult_4bit(uint64_t Xi[2], const u128 Htable[16]);
325 PACK(0x0000), PACK(0x1C20), PACK(0x3840), PACK(0x2460), 89void gcm_ghash_4bit(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp,
326 PACK(0x7080), PACK(0x6CA0), PACK(0x48C0), PACK(0x54E0), 90 size_t len);
327 PACK(0xE100), PACK(0xFD20), PACK(0xD940), PACK(0xC560), 91
328 PACK(0x9180), PACK(0x8DA0), PACK(0xA9C0), PACK(0xB5E0) }; 92#else
93static const uint16_t rem_4bit[16] = {
94 0x0000, 0x1c20, 0x3840, 0x2460, 0x7080, 0x6ca0, 0x48c0, 0x54e0,
95 0xe100, 0xfd20, 0xd940, 0xc560, 0x9180, 0x8da0, 0xa9c0, 0xb5e0,
96};
329 97
330static void 98static void
331gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16]) 99gcm_gmult_4bit(uint64_t Xi[2], const u128 Htable[16])
332{ 100{
333 u128 Z; 101 u128 Z;
334 int cnt = 15; 102 int cnt = 15;
335 size_t rem, nlo, nhi; 103 size_t rem, nlo, nhi;
336 104
337 nlo = ((const u8 *)Xi)[15]; 105 nlo = ((const uint8_t *)Xi)[15];
338 nhi = nlo >> 4; 106 nhi = nlo >> 4;
339 nlo &= 0xf; 107 nlo &= 0xf;
340 108
@@ -345,29 +113,21 @@ gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16])
345 rem = (size_t)Z.lo & 0xf; 113 rem = (size_t)Z.lo & 0xf;
346 Z.lo = (Z.hi << 60)|(Z.lo >> 4); 114 Z.lo = (Z.hi << 60)|(Z.lo >> 4);
347 Z.hi = (Z.hi >> 4); 115 Z.hi = (Z.hi >> 4);
348#if SIZE_MAX == 0xffffffffffffffff 116 Z.hi ^= (uint64_t)rem_4bit[rem] << 48;
349 Z.hi ^= rem_4bit[rem];
350#else
351 Z.hi ^= (u64)rem_4bit[rem] << 32;
352#endif
353 Z.hi ^= Htable[nhi].hi; 117 Z.hi ^= Htable[nhi].hi;
354 Z.lo ^= Htable[nhi].lo; 118 Z.lo ^= Htable[nhi].lo;
355 119
356 if (--cnt < 0) 120 if (--cnt < 0)
357 break; 121 break;
358 122
359 nlo = ((const u8 *)Xi)[cnt]; 123 nlo = ((const uint8_t *)Xi)[cnt];
360 nhi = nlo >> 4; 124 nhi = nlo >> 4;
361 nlo &= 0xf; 125 nlo &= 0xf;
362 126
363 rem = (size_t)Z.lo & 0xf; 127 rem = (size_t)Z.lo & 0xf;
364 Z.lo = (Z.hi << 60)|(Z.lo >> 4); 128 Z.lo = (Z.hi << 60)|(Z.lo >> 4);
365 Z.hi = (Z.hi >> 4); 129 Z.hi = (Z.hi >> 4);
366#if SIZE_MAX == 0xffffffffffffffff 130 Z.hi ^= (uint64_t)rem_4bit[rem] << 48;
367 Z.hi ^= rem_4bit[rem];
368#else
369 Z.hi ^= (u64)rem_4bit[rem] << 32;
370#endif
371 Z.hi ^= Htable[nlo].hi; 131 Z.hi ^= Htable[nlo].hi;
372 Z.lo ^= Htable[nlo].lo; 132 Z.lo ^= Htable[nlo].lo;
373 } 133 }
@@ -376,26 +136,17 @@ gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16])
376 Xi[1] = htobe64(Z.lo); 136 Xi[1] = htobe64(Z.lo);
377} 137}
378 138
379#if !defined(OPENSSL_SMALL_FOOTPRINT)
380/*
381 * Streamed gcm_mult_4bit, see CRYPTO_gcm128_[en|de]crypt for
382 * details... Compiler-generated code doesn't seem to give any
383 * performance improvement, at least not on x86[_64]. It's here
384 * mostly as reference and a placeholder for possible future
385 * non-trivial optimization[s]...
386 */
387static void 139static void
388gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16], 140gcm_ghash_4bit(uint64_t Xi[2], const u128 Htable[16],
389 const u8 *inp, size_t len) 141 const uint8_t *inp, size_t len)
390{ 142{
391 u128 Z; 143 u128 Z;
392 int cnt; 144 int cnt;
393 size_t rem, nlo, nhi; 145 size_t rem, nlo, nhi;
394 146
395#if 1
396 do { 147 do {
397 cnt = 15; 148 cnt = 15;
398 nlo = ((const u8 *)Xi)[15]; 149 nlo = ((const uint8_t *)Xi)[15];
399 nlo ^= inp[15]; 150 nlo ^= inp[15];
400 nhi = nlo >> 4; 151 nhi = nlo >> 4;
401 nlo &= 0xf; 152 nlo &= 0xf;
@@ -407,18 +158,14 @@ gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16],
407 rem = (size_t)Z.lo & 0xf; 158 rem = (size_t)Z.lo & 0xf;
408 Z.lo = (Z.hi << 60)|(Z.lo >> 4); 159 Z.lo = (Z.hi << 60)|(Z.lo >> 4);
409 Z.hi = (Z.hi >> 4); 160 Z.hi = (Z.hi >> 4);
410#if SIZE_MAX == 0xffffffffffffffff 161 Z.hi ^= (uint64_t)rem_4bit[rem] << 48;
411 Z.hi ^= rem_4bit[rem];
412#else
413 Z.hi ^= (u64)rem_4bit[rem] << 32;
414#endif
415 Z.hi ^= Htable[nhi].hi; 162 Z.hi ^= Htable[nhi].hi;
416 Z.lo ^= Htable[nhi].lo; 163 Z.lo ^= Htable[nhi].lo;
417 164
418 if (--cnt < 0) 165 if (--cnt < 0)
419 break; 166 break;
420 167
421 nlo = ((const u8 *)Xi)[cnt]; 168 nlo = ((const uint8_t *)Xi)[cnt];
422 nlo ^= inp[cnt]; 169 nlo ^= inp[cnt];
423 nhi = nlo >> 4; 170 nhi = nlo >> 4;
424 nlo &= 0xf; 171 nlo &= 0xf;
@@ -426,222 +173,40 @@ gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16],
426 rem = (size_t)Z.lo & 0xf; 173 rem = (size_t)Z.lo & 0xf;
427 Z.lo = (Z.hi << 60)|(Z.lo >> 4); 174 Z.lo = (Z.hi << 60)|(Z.lo >> 4);
428 Z.hi = (Z.hi >> 4); 175 Z.hi = (Z.hi >> 4);
429#if SIZE_MAX == 0xffffffffffffffff 176 Z.hi ^= (uint64_t)rem_4bit[rem] << 48;
430 Z.hi ^= rem_4bit[rem];
431#else
432 Z.hi ^= (u64)rem_4bit[rem] << 32;
433#endif
434 Z.hi ^= Htable[nlo].hi; 177 Z.hi ^= Htable[nlo].hi;
435 Z.lo ^= Htable[nlo].lo; 178 Z.lo ^= Htable[nlo].lo;
436 } 179 }
437#else
438 /*
439 * Extra 256+16 bytes per-key plus 512 bytes shared tables
440 * [should] give ~50% improvement... One could have PACK()-ed
441 * the rem_8bit even here, but the priority is to minimize
442 * cache footprint...
443 */
444 u128 Hshr4[16]; /* Htable shifted right by 4 bits */
445 u8 Hshl4[16]; /* Htable shifted left by 4 bits */
446 static const unsigned short rem_8bit[256] = {
447 0x0000, 0x01C2, 0x0384, 0x0246, 0x0708, 0x06CA, 0x048C, 0x054E,
448 0x0E10, 0x0FD2, 0x0D94, 0x0C56, 0x0918, 0x08DA, 0x0A9C, 0x0B5E,
449 0x1C20, 0x1DE2, 0x1FA4, 0x1E66, 0x1B28, 0x1AEA, 0x18AC, 0x196E,
450 0x1230, 0x13F2, 0x11B4, 0x1076, 0x1538, 0x14FA, 0x16BC, 0x177E,
451 0x3840, 0x3982, 0x3BC4, 0x3A06, 0x3F48, 0x3E8A, 0x3CCC, 0x3D0E,
452 0x3650, 0x3792, 0x35D4, 0x3416, 0x3158, 0x309A, 0x32DC, 0x331E,
453 0x2460, 0x25A2, 0x27E4, 0x2626, 0x2368, 0x22AA, 0x20EC, 0x212E,
454 0x2A70, 0x2BB2, 0x29F4, 0x2836, 0x2D78, 0x2CBA, 0x2EFC, 0x2F3E,
455 0x7080, 0x7142, 0x7304, 0x72C6, 0x7788, 0x764A, 0x740C, 0x75CE,
456 0x7E90, 0x7F52, 0x7D14, 0x7CD6, 0x7998, 0x785A, 0x7A1C, 0x7BDE,
457 0x6CA0, 0x6D62, 0x6F24, 0x6EE6, 0x6BA8, 0x6A6A, 0x682C, 0x69EE,
458 0x62B0, 0x6372, 0x6134, 0x60F6, 0x65B8, 0x647A, 0x663C, 0x67FE,
459 0x48C0, 0x4902, 0x4B44, 0x4A86, 0x4FC8, 0x4E0A, 0x4C4C, 0x4D8E,
460 0x46D0, 0x4712, 0x4554, 0x4496, 0x41D8, 0x401A, 0x425C, 0x439E,
461 0x54E0, 0x5522, 0x5764, 0x56A6, 0x53E8, 0x522A, 0x506C, 0x51AE,
462 0x5AF0, 0x5B32, 0x5974, 0x58B6, 0x5DF8, 0x5C3A, 0x5E7C, 0x5FBE,
463 0xE100, 0xE0C2, 0xE284, 0xE346, 0xE608, 0xE7CA, 0xE58C, 0xE44E,
464 0xEF10, 0xEED2, 0xEC94, 0xED56, 0xE818, 0xE9DA, 0xEB9C, 0xEA5E,
465 0xFD20, 0xFCE2, 0xFEA4, 0xFF66, 0xFA28, 0xFBEA, 0xF9AC, 0xF86E,
466 0xF330, 0xF2F2, 0xF0B4, 0xF176, 0xF438, 0xF5FA, 0xF7BC, 0xF67E,
467 0xD940, 0xD882, 0xDAC4, 0xDB06, 0xDE48, 0xDF8A, 0xDDCC, 0xDC0E,
468 0xD750, 0xD692, 0xD4D4, 0xD516, 0xD058, 0xD19A, 0xD3DC, 0xD21E,
469 0xC560, 0xC4A2, 0xC6E4, 0xC726, 0xC268, 0xC3AA, 0xC1EC, 0xC02E,
470 0xCB70, 0xCAB2, 0xC8F4, 0xC936, 0xCC78, 0xCDBA, 0xCFFC, 0xCE3E,
471 0x9180, 0x9042, 0x9204, 0x93C6, 0x9688, 0x974A, 0x950C, 0x94CE,
472 0x9F90, 0x9E52, 0x9C14, 0x9DD6, 0x9898, 0x995A, 0x9B1C, 0x9ADE,
473 0x8DA0, 0x8C62, 0x8E24, 0x8FE6, 0x8AA8, 0x8B6A, 0x892C, 0x88EE,
474 0x83B0, 0x8272, 0x8034, 0x81F6, 0x84B8, 0x857A, 0x873C, 0x86FE,
475 0xA9C0, 0xA802, 0xAA44, 0xAB86, 0xAEC8, 0xAF0A, 0xAD4C, 0xAC8E,
476 0xA7D0, 0xA612, 0xA454, 0xA596, 0xA0D8, 0xA11A, 0xA35C, 0xA29E,
477 0xB5E0, 0xB422, 0xB664, 0xB7A6, 0xB2E8, 0xB32A, 0xB16C, 0xB0AE,
478 0xBBF0, 0xBA32, 0xB874, 0xB9B6, 0xBCF8, 0xBD3A, 0xBF7C, 0xBEBE };
479 /*
480 * This pre-processing phase slows down procedure by approximately
481 * same time as it makes each loop spin faster. In other words
482 * single block performance is approximately same as straightforward
483 * "4-bit" implementation, and then it goes only faster...
484 */
485 for (cnt = 0; cnt < 16; ++cnt) {
486 Z.hi = Htable[cnt].hi;
487 Z.lo = Htable[cnt].lo;
488 Hshr4[cnt].lo = (Z.hi << 60)|(Z.lo >> 4);
489 Hshr4[cnt].hi = (Z.hi >> 4);
490 Hshl4[cnt] = (u8)(Z.lo << 4);
491 }
492
493 do {
494 for (Z.lo = 0, Z.hi = 0, cnt = 15; cnt; --cnt) {
495 nlo = ((const u8 *)Xi)[cnt];
496 nlo ^= inp[cnt];
497 nhi = nlo >> 4;
498 nlo &= 0xf;
499
500 Z.hi ^= Htable[nlo].hi;
501 Z.lo ^= Htable[nlo].lo;
502
503 rem = (size_t)Z.lo & 0xff;
504
505 Z.lo = (Z.hi << 56)|(Z.lo >> 8);
506 Z.hi = (Z.hi >> 8);
507
508 Z.hi ^= Hshr4[nhi].hi;
509 Z.lo ^= Hshr4[nhi].lo;
510 Z.hi ^= (u64)rem_8bit[rem ^ Hshl4[nhi]] << 48;
511 }
512
513 nlo = ((const u8 *)Xi)[0];
514 nlo ^= inp[0];
515 nhi = nlo >> 4;
516 nlo &= 0xf;
517
518 Z.hi ^= Htable[nlo].hi;
519 Z.lo ^= Htable[nlo].lo;
520
521 rem = (size_t)Z.lo & 0xf;
522
523 Z.lo = (Z.hi << 60)|(Z.lo >> 4);
524 Z.hi = (Z.hi >> 4);
525
526 Z.hi ^= Htable[nhi].hi;
527 Z.lo ^= Htable[nhi].lo;
528 Z.hi ^= ((u64)rem_8bit[rem << 4]) << 48;
529#endif
530 180
531 Xi[0] = htobe64(Z.hi); 181 Xi[0] = htobe64(Z.hi);
532 Xi[1] = htobe64(Z.lo); 182 Xi[1] = htobe64(Z.lo);
533 } while (inp += 16, len -= 16); 183 } while (inp += 16, len -= 16);
534} 184}
535#endif 185#endif
536#else
537void gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16]);
538void gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16], const u8 *inp,
539 size_t len);
540#endif
541
542#define GCM_MUL(ctx,Xi) gcm_gmult_4bit(ctx->Xi.u,ctx->Htable)
543#if defined(GHASH_ASM) || !defined(OPENSSL_SMALL_FOOTPRINT)
544#define GHASH(ctx,in,len) gcm_ghash_4bit((ctx)->Xi.u,(ctx)->Htable,in,len)
545/* GHASH_CHUNK is "stride parameter" missioned to mitigate cache
546 * trashing effect. In other words idea is to hash data while it's
547 * still in L1 cache after encryption pass... */
548#define GHASH_CHUNK (3*1024)
549#endif
550 186
551#else /* TABLE_BITS */ 187static inline void
188gcm_mul(GCM128_CONTEXT *ctx, uint64_t u[2])
189{
190 ctx->gmult(u, ctx->Htable);
191}
552 192
553static void 193static inline void
554gcm_gmult_1bit(u64 Xi[2], const u64 H[2]) 194gcm_ghash(GCM128_CONTEXT *ctx, const uint8_t *in, size_t len)
555{ 195{
556 u128 V, Z = { 0,0 }; 196 ctx->ghash(ctx->Xi.u, ctx->Htable, in, len);
557 long X; 197}
558 int i, j;
559 const long *xi = (const long *)Xi;
560 198
561 V.hi = H[0]; /* H is in host byte order, no byte swapping */ 199#ifdef HAVE_GCM128_INIT
562 V.lo = H[1]; 200void gcm128_init(GCM128_CONTEXT *ctx);
563 201
564 for (j = 0; j < 16/sizeof(long); ++j) {
565#if BYTE_ORDER == LITTLE_ENDIAN
566#if SIZE_MAX == 0xffffffffffffffff
567#ifdef BSWAP8
568 X = (long)(BSWAP8(xi[j]));
569#else 202#else
570 const u8 *p = (const u8 *)(xi + j); 203static void
571 X = (long)((u64)GETU32(p) << 32|GETU32(p + 4)); 204gcm128_init(GCM128_CONTEXT *ctx)
572#endif 205{
573#else 206 gcm_init_4bit(ctx->Htable, ctx->H.u);
574 const u8 *p = (const u8 *)(xi + j); 207 ctx->gmult = gcm_gmult_4bit;
575 X = (long)GETU32(p); 208 ctx->ghash = gcm_ghash_4bit;
576#endif
577#else /* BIG_ENDIAN */
578 X = xi[j];
579#endif
580
581 for (i = 0; i < 8*sizeof(long); ++i, X <<= 1) {
582 u64 M = (u64)(X >> (8*sizeof(long) - 1));
583 Z.hi ^= V.hi & M;
584 Z.lo ^= V.lo & M;
585
586 REDUCE1BIT(V);
587 }
588 }
589
590 Xi[0] = htobe64(Z.hi);
591 Xi[1] = htobe64(Z.lo);
592} 209}
593#define GCM_MUL(ctx,Xi) gcm_gmult_1bit(ctx->Xi.u,ctx->H.u)
594
595#endif
596
597#if defined(GHASH_ASM) && \
598 (defined(__i386) || defined(__i386__) || \
599 defined(__x86_64) || defined(__x86_64__) || \
600 defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64))
601#include "x86_arch.h"
602#endif
603
604#if TABLE_BITS==4 && defined(GHASH_ASM)
605# if (defined(__i386) || defined(__i386__) || \
606 defined(__x86_64) || defined(__x86_64__) || \
607 defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64))
608# define GHASH_ASM_X86_OR_64
609# define GCM_FUNCREF_4BIT
610
611void gcm_init_clmul(u128 Htable[16], const u64 Xi[2]);
612void gcm_gmult_clmul(u64 Xi[2], const u128 Htable[16]);
613void gcm_ghash_clmul(u64 Xi[2], const u128 Htable[16], const u8 *inp,
614 size_t len);
615
616# if defined(__i386) || defined(__i386__) || defined(_M_IX86)
617# define GHASH_ASM_X86
618void gcm_gmult_4bit_mmx(u64 Xi[2], const u128 Htable[16]);
619void gcm_ghash_4bit_mmx(u64 Xi[2], const u128 Htable[16], const u8 *inp,
620 size_t len);
621
622void gcm_gmult_4bit_x86(u64 Xi[2], const u128 Htable[16]);
623void gcm_ghash_4bit_x86(u64 Xi[2], const u128 Htable[16], const u8 *inp,
624 size_t len);
625# endif
626# elif defined(__arm__) || defined(__arm)
627# include "arm_arch.h"
628# if __ARM_ARCH__>=7 && !defined(__STRICT_ALIGNMENT)
629# define GHASH_ASM_ARM
630# define GCM_FUNCREF_4BIT
631void gcm_gmult_neon(u64 Xi[2], const u128 Htable[16]);
632void gcm_ghash_neon(u64 Xi[2], const u128 Htable[16], const u8 *inp,
633 size_t len);
634# endif
635# endif
636#endif
637
638#ifdef GCM_FUNCREF_4BIT
639# undef GCM_MUL
640# define GCM_MUL(ctx,Xi) (*gcm_gmult_p)(ctx->Xi.u,ctx->Htable)
641# ifdef GHASH
642# undef GHASH
643# define GHASH(ctx,in,len) (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,in,len)
644# endif
645#endif 210#endif
646 211
647void 212void
@@ -657,60 +222,35 @@ CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, block128_f block)
657 ctx->H.u[0] = be64toh(ctx->H.u[0]); 222 ctx->H.u[0] = be64toh(ctx->H.u[0]);
658 ctx->H.u[1] = be64toh(ctx->H.u[1]); 223 ctx->H.u[1] = be64toh(ctx->H.u[1]);
659 224
660#if TABLE_BITS==8 225 gcm128_init(ctx);
661 gcm_init_8bit(ctx->Htable, ctx->H.u);
662#elif TABLE_BITS==4
663# if defined(GHASH_ASM_X86_OR_64)
664# if !defined(GHASH_ASM_X86) || defined(OPENSSL_IA32_SSE2)
665 /* check FXSR and PCLMULQDQ bits */
666 if ((crypto_cpu_caps_ia32() & (CPUCAP_MASK_FXSR | CPUCAP_MASK_PCLMUL)) ==
667 (CPUCAP_MASK_FXSR | CPUCAP_MASK_PCLMUL)) {
668 gcm_init_clmul(ctx->Htable, ctx->H.u);
669 ctx->gmult = gcm_gmult_clmul;
670 ctx->ghash = gcm_ghash_clmul;
671 return;
672 }
673# endif
674 gcm_init_4bit(ctx->Htable, ctx->H.u);
675# if defined(GHASH_ASM_X86) /* x86 only */
676# if defined(OPENSSL_IA32_SSE2)
677 if (crypto_cpu_caps_ia32() & CPUCAP_MASK_SSE) { /* check SSE bit */
678# else
679 if (crypto_cpu_caps_ia32() & CPUCAP_MASK_MMX) { /* check MMX bit */
680# endif
681 ctx->gmult = gcm_gmult_4bit_mmx;
682 ctx->ghash = gcm_ghash_4bit_mmx;
683 } else {
684 ctx->gmult = gcm_gmult_4bit_x86;
685 ctx->ghash = gcm_ghash_4bit_x86;
686 }
687# else
688 ctx->gmult = gcm_gmult_4bit;
689 ctx->ghash = gcm_ghash_4bit;
690# endif
691# elif defined(GHASH_ASM_ARM)
692 if (OPENSSL_armcap_P & ARMV7_NEON) {
693 ctx->gmult = gcm_gmult_neon;
694 ctx->ghash = gcm_ghash_neon;
695 } else {
696 gcm_init_4bit(ctx->Htable, ctx->H.u);
697 ctx->gmult = gcm_gmult_4bit;
698 ctx->ghash = gcm_ghash_4bit;
699 }
700# else
701 gcm_init_4bit(ctx->Htable, ctx->H.u);
702# endif
703#endif
704} 226}
705LCRYPTO_ALIAS(CRYPTO_gcm128_init); 227LCRYPTO_ALIAS(CRYPTO_gcm128_init);
706 228
229GCM128_CONTEXT *
230CRYPTO_gcm128_new(void *key, block128_f block)
231{
232 GCM128_CONTEXT *ctx;
233
234 if ((ctx = calloc(1, sizeof(*ctx))) == NULL)
235 return NULL;
236
237 CRYPTO_gcm128_init(ctx, key, block);
238
239 return ctx;
240}
241LCRYPTO_ALIAS(CRYPTO_gcm128_new);
242
243void
244CRYPTO_gcm128_release(GCM128_CONTEXT *ctx)
245{
246 freezero(ctx, sizeof(*ctx));
247}
248LCRYPTO_ALIAS(CRYPTO_gcm128_release);
249
707void 250void
708CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv, size_t len) 251CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv, size_t len)
709{ 252{
710 unsigned int ctr; 253 unsigned int ctr;
711#ifdef GCM_FUNCREF_4BIT
712 void (*gcm_gmult_p)(u64 Xi[2], const u128 Htable[16]) = ctx->gmult;
713#endif
714 254
715 ctx->Yi.u[0] = 0; 255 ctx->Yi.u[0] = 0;
716 ctx->Yi.u[1] = 0; 256 ctx->Yi.u[1] = 0;
@@ -727,577 +267,277 @@ CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv, size_t len)
727 ctr = 1; 267 ctr = 1;
728 } else { 268 } else {
729 size_t i; 269 size_t i;
730 u64 len0 = len; 270 uint64_t len0 = len;
731 271
732 while (len >= 16) { 272 while (len >= 16) {
733 for (i = 0; i < 16; ++i) 273 for (i = 0; i < 16; i++)
734 ctx->Yi.c[i] ^= iv[i]; 274 ctx->Yi.c[i] ^= iv[i];
735 GCM_MUL(ctx, Yi); 275 gcm_mul(ctx, ctx->Yi.u);
736 iv += 16; 276 iv += 16;
737 len -= 16; 277 len -= 16;
738 } 278 }
739 if (len) { 279 if (len > 0) {
740 for (i = 0; i < len; ++i) 280 for (i = 0; i < len; i++)
741 ctx->Yi.c[i] ^= iv[i]; 281 ctx->Yi.c[i] ^= iv[i];
742 GCM_MUL(ctx, Yi); 282 gcm_mul(ctx, ctx->Yi.u);
743 } 283 }
744 len0 <<= 3; 284 len0 <<= 3;
745 ctx->Yi.u[1] ^= htobe64(len0); 285 ctx->Yi.u[1] ^= htobe64(len0);
746 286
747 GCM_MUL(ctx, Yi); 287 gcm_mul(ctx, ctx->Yi.u);
748 288
749 ctr = be32toh(ctx->Yi.d[3]); 289 ctr = be32toh(ctx->Yi.d[3]);
750 } 290 }
751 291
752 (*ctx->block)(ctx->Yi.c, ctx->EK0.c, ctx->key); 292 (*ctx->block)(ctx->Yi.c, ctx->EK0.c, ctx->key);
753 ++ctr; 293 ctx->Yi.d[3] = htobe32(++ctr);
754 ctx->Yi.d[3] = htobe32(ctr);
755} 294}
756LCRYPTO_ALIAS(CRYPTO_gcm128_setiv); 295LCRYPTO_ALIAS(CRYPTO_gcm128_setiv);
757 296
758int 297int
759CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad, size_t len) 298CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad, size_t len)
760{ 299{
761 size_t i;
762 unsigned int n; 300 unsigned int n;
763 u64 alen = ctx->len.u[0]; 301 uint64_t alen;
764#ifdef GCM_FUNCREF_4BIT 302 size_t i;
765 void (*gcm_gmult_p)(u64 Xi[2], const u128 Htable[16]) = ctx->gmult;
766# ifdef GHASH
767 void (*gcm_ghash_p)(u64 Xi[2], const u128 Htable[16],
768 const u8 *inp, size_t len) = ctx->ghash;
769# endif
770#endif
771 303
772 if (ctx->len.u[1]) 304 if (ctx->len.u[1] != 0)
773 return -2; 305 return -2;
774 306
775 alen += len; 307 alen = ctx->len.u[0] + len;
776 if (alen > (U64(1) << 61) || (sizeof(len) == 8 && alen < len)) 308 if (alen > (U64(1) << 61) || (sizeof(len) == 8 && alen < len))
777 return -1; 309 return -1;
778 ctx->len.u[0] = alen; 310 ctx->len.u[0] = alen;
779 311
780 n = ctx->ares; 312 if ((n = ctx->ares) > 0) {
781 if (n) { 313 while (n > 0 && len > 0) {
782 while (n && len) {
783 ctx->Xi.c[n] ^= *(aad++); 314 ctx->Xi.c[n] ^= *(aad++);
784 --len;
785 n = (n + 1) % 16; 315 n = (n + 1) % 16;
316 len--;
786 } 317 }
787 if (n == 0) 318 if (n > 0) {
788 GCM_MUL(ctx, Xi);
789 else {
790 ctx->ares = n; 319 ctx->ares = n;
791 return 0; 320 return 0;
792 } 321 }
322 gcm_mul(ctx, ctx->Xi.u);
793 } 323 }
794 324
795#ifdef GHASH 325 if ((i = (len & (size_t)-16)) > 0) {
796 if ((i = (len & (size_t)-16))) { 326 gcm_ghash(ctx, aad, i);
797 GHASH(ctx, aad, i);
798 aad += i; 327 aad += i;
799 len -= i; 328 len -= i;
800 } 329 }
801#else 330 if (len > 0) {
802 while (len >= 16) {
803 for (i = 0; i < 16; ++i)
804 ctx->Xi.c[i] ^= aad[i];
805 GCM_MUL(ctx, Xi);
806 aad += 16;
807 len -= 16;
808 }
809#endif
810 if (len) {
811 n = (unsigned int)len; 331 n = (unsigned int)len;
812 for (i = 0; i < len; ++i) 332 for (i = 0; i < len; i++)
813 ctx->Xi.c[i] ^= aad[i]; 333 ctx->Xi.c[i] ^= aad[i];
814 } 334 }
815
816 ctx->ares = n; 335 ctx->ares = n;
336
817 return 0; 337 return 0;
818} 338}
819LCRYPTO_ALIAS(CRYPTO_gcm128_aad); 339LCRYPTO_ALIAS(CRYPTO_gcm128_aad);
820 340
821int 341int
822CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, 342CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, const unsigned char *in,
823 const unsigned char *in, unsigned char *out, 343 unsigned char *out, size_t len)
824 size_t len)
825{ 344{
826 unsigned int n, ctr; 345 unsigned int n, ctr;
346 uint64_t mlen;
827 size_t i; 347 size_t i;
828 u64 mlen = ctx->len.u[1];
829 block128_f block = ctx->block;
830 void *key = ctx->key;
831#ifdef GCM_FUNCREF_4BIT
832 void (*gcm_gmult_p)(u64 Xi[2], const u128 Htable[16]) = ctx->gmult;
833# ifdef GHASH
834 void (*gcm_ghash_p)(u64 Xi[2], const u128 Htable[16],
835 const u8 *inp, size_t len) = ctx->ghash;
836# endif
837#endif
838 348
839 mlen += len; 349 mlen = ctx->len.u[1] + len;
840 if (mlen > ((U64(1) << 36) - 32) || (sizeof(len) == 8 && mlen < len)) 350 if (mlen > ((U64(1) << 36) - 32) || (sizeof(len) == 8 && mlen < len))
841 return -1; 351 return -1;
842 ctx->len.u[1] = mlen; 352 ctx->len.u[1] = mlen;
843 353
844 if (ctx->ares) { 354 if (ctx->ares > 0) {
845 /* First call to encrypt finalizes GHASH(AAD) */ 355 /* First call to encrypt finalizes GHASH(AAD) */
846 GCM_MUL(ctx, Xi); 356 gcm_mul(ctx, ctx->Xi.u);
847 ctx->ares = 0; 357 ctx->ares = 0;
848 } 358 }
849 359
850 ctr = be32toh(ctx->Yi.d[3]); 360 ctr = be32toh(ctx->Yi.d[3]);
851 361
852 n = ctx->mres; 362 n = ctx->mres;
853#if !defined(OPENSSL_SMALL_FOOTPRINT)
854 if (16 % sizeof(size_t) == 0)
855 do { /* always true actually */
856 if (n) {
857 while (n && len) {
858 ctx->Xi.c[n] ^= *(out++) = *(in++) ^
859 ctx->EKi.c[n];
860 --len;
861 n = (n + 1) % 16;
862 }
863 if (n == 0)
864 GCM_MUL(ctx, Xi);
865 else {
866 ctx->mres = n;
867 return 0;
868 }
869 }
870#ifdef __STRICT_ALIGNMENT
871 if (((size_t)in|(size_t)out) % sizeof(size_t) != 0)
872 break;
873#endif
874#if defined(GHASH) && defined(GHASH_CHUNK)
875 while (len >= GHASH_CHUNK) {
876 size_t j = GHASH_CHUNK;
877
878 while (j) {
879 size_t *out_t = (size_t *)out;
880 const size_t *in_t = (const size_t *)in;
881
882 (*block)(ctx->Yi.c, ctx->EKi.c, key);
883 ++ctr;
884 ctx->Yi.d[3] = htobe32(ctr);
885
886 for (i = 0; i < 16/sizeof(size_t); ++i)
887 out_t[i] = in_t[i] ^
888 ctx->EKi.t[i];
889 out += 16;
890 in += 16;
891 j -= 16;
892 }
893 GHASH(ctx, out - GHASH_CHUNK, GHASH_CHUNK);
894 len -= GHASH_CHUNK;
895 }
896 if ((i = (len & (size_t)-16))) {
897 size_t j = i;
898
899 while (len >= 16) {
900 size_t *out_t = (size_t *)out;
901 const size_t *in_t = (const size_t *)in;
902
903 (*block)(ctx->Yi.c, ctx->EKi.c, key);
904 ++ctr;
905 ctx->Yi.d[3] = htobe32(ctr);
906
907 for (i = 0; i < 16/sizeof(size_t); ++i)
908 out_t[i] = in_t[i] ^
909 ctx->EKi.t[i];
910 out += 16;
911 in += 16;
912 len -= 16;
913 }
914 GHASH(ctx, out - j, j);
915 }
916#else
917 while (len >= 16) {
918 size_t *out_t = (size_t *)out;
919 const size_t *in_t = (const size_t *)in;
920
921 (*block)(ctx->Yi.c, ctx->EKi.c, key);
922 ++ctr;
923 ctx->Yi.d[3] = htobe32(ctr);
924
925 for (i = 0; i < 16/sizeof(size_t); ++i)
926 ctx->Xi.t[i] ^=
927 out_t[i] = in_t[i] ^ ctx->EKi.t[i];
928 GCM_MUL(ctx, Xi);
929 out += 16;
930 in += 16;
931 len -= 16;
932 }
933#endif
934 if (len) {
935 (*block)(ctx->Yi.c, ctx->EKi.c, key);
936 ++ctr;
937 ctx->Yi.d[3] = htobe32(ctr);
938
939 while (len--) {
940 ctx->Xi.c[n] ^= out[n] = in[n] ^
941 ctx->EKi.c[n];
942 ++n;
943 }
944 }
945 363
946 ctx->mres = n; 364 for (i = 0; i < len; i++) {
947 return 0;
948 } while (0);
949#endif
950 for (i = 0; i < len; ++i) {
951 if (n == 0) { 365 if (n == 0) {
952 (*block)(ctx->Yi.c, ctx->EKi.c, key); 366 ctx->block(ctx->Yi.c, ctx->EKi.c, ctx->key);
953 ++ctr; 367 ctx->Yi.d[3] = htobe32(++ctr);
954 ctx->Yi.d[3] = htobe32(ctr);
955 } 368 }
956 ctx->Xi.c[n] ^= out[i] = in[i] ^ ctx->EKi.c[n]; 369 ctx->Xi.c[n] ^= out[i] = in[i] ^ ctx->EKi.c[n];
957 n = (n + 1) % 16; 370 n = (n + 1) % 16;
958 if (n == 0) 371 if (n == 0)
959 GCM_MUL(ctx, Xi); 372 gcm_mul(ctx, ctx->Xi.u);
960 } 373 }
961 374
962 ctx->mres = n; 375 ctx->mres = n;
376
963 return 0; 377 return 0;
964} 378}
965LCRYPTO_ALIAS(CRYPTO_gcm128_encrypt); 379LCRYPTO_ALIAS(CRYPTO_gcm128_encrypt);
966 380
967int 381int
968CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, 382CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, const unsigned char *in,
969 const unsigned char *in, unsigned char *out, 383 unsigned char *out, size_t len)
970 size_t len)
971{ 384{
972 unsigned int n, ctr; 385 unsigned int n, ctr;
386 uint64_t mlen;
387 uint8_t c;
973 size_t i; 388 size_t i;
974 u64 mlen = ctx->len.u[1];
975 block128_f block = ctx->block;
976 void *key = ctx->key;
977#ifdef GCM_FUNCREF_4BIT
978 void (*gcm_gmult_p)(u64 Xi[2], const u128 Htable[16]) = ctx->gmult;
979# ifdef GHASH
980 void (*gcm_ghash_p)(u64 Xi[2], const u128 Htable[16],
981 const u8 *inp, size_t len) = ctx->ghash;
982# endif
983#endif
984 389
985 mlen += len; 390 mlen = ctx->len.u[1] + len;
986 if (mlen > ((U64(1) << 36) - 32) || (sizeof(len) == 8 && mlen < len)) 391 if (mlen > ((U64(1) << 36) - 32) || (sizeof(len) == 8 && mlen < len))
987 return -1; 392 return -1;
988 ctx->len.u[1] = mlen; 393 ctx->len.u[1] = mlen;
989 394
990 if (ctx->ares) { 395 if (ctx->ares) {
991 /* First call to decrypt finalizes GHASH(AAD) */ 396 /* First call to decrypt finalizes GHASH(AAD) */
992 GCM_MUL(ctx, Xi); 397 gcm_mul(ctx, ctx->Xi.u);
993 ctx->ares = 0; 398 ctx->ares = 0;
994 } 399 }
995 400
996 ctr = be32toh(ctx->Yi.d[3]); 401 ctr = be32toh(ctx->Yi.d[3]);
997 402
998 n = ctx->mres; 403 n = ctx->mres;
999#if !defined(OPENSSL_SMALL_FOOTPRINT)
1000 if (16 % sizeof(size_t) == 0)
1001 do { /* always true actually */
1002 if (n) {
1003 while (n && len) {
1004 u8 c = *(in++);
1005 *(out++) = c ^ ctx->EKi.c[n];
1006 ctx->Xi.c[n] ^= c;
1007 --len;
1008 n = (n + 1) % 16;
1009 }
1010 if (n == 0)
1011 GCM_MUL(ctx, Xi);
1012 else {
1013 ctx->mres = n;
1014 return 0;
1015 }
1016 }
1017#ifdef __STRICT_ALIGNMENT
1018 if (((size_t)in|(size_t)out) % sizeof(size_t) != 0)
1019 break;
1020#endif
1021#if defined(GHASH) && defined(GHASH_CHUNK)
1022 while (len >= GHASH_CHUNK) {
1023 size_t j = GHASH_CHUNK;
1024
1025 GHASH(ctx, in, GHASH_CHUNK);
1026 while (j) {
1027 size_t *out_t = (size_t *)out;
1028 const size_t *in_t = (const size_t *)in;
1029
1030 (*block)(ctx->Yi.c, ctx->EKi.c, key);
1031 ++ctr;
1032 ctx->Yi.d[3] = htobe32(ctr);
1033
1034 for (i = 0; i < 16/sizeof(size_t); ++i)
1035 out_t[i] = in_t[i] ^
1036 ctx->EKi.t[i];
1037 out += 16;
1038 in += 16;
1039 j -= 16;
1040 }
1041 len -= GHASH_CHUNK;
1042 }
1043 if ((i = (len & (size_t)-16))) {
1044 GHASH(ctx, in, i);
1045 while (len >= 16) {
1046 size_t *out_t = (size_t *)out;
1047 const size_t *in_t = (const size_t *)in;
1048
1049 (*block)(ctx->Yi.c, ctx->EKi.c, key);
1050 ++ctr;
1051 ctx->Yi.d[3] = htobe32(ctr);
1052
1053 for (i = 0; i < 16/sizeof(size_t); ++i)
1054 out_t[i] = in_t[i] ^
1055 ctx->EKi.t[i];
1056 out += 16;
1057 in += 16;
1058 len -= 16;
1059 }
1060 }
1061#else
1062 while (len >= 16) {
1063 size_t *out_t = (size_t *)out;
1064 const size_t *in_t = (const size_t *)in;
1065
1066 (*block)(ctx->Yi.c, ctx->EKi.c, key);
1067 ++ctr;
1068 ctx->Yi.d[3] = htobe32(ctr);
1069
1070 for (i = 0; i < 16/sizeof(size_t); ++i) {
1071 size_t c = in[i];
1072 out[i] = c ^ ctx->EKi.t[i];
1073 ctx->Xi.t[i] ^= c;
1074 }
1075 GCM_MUL(ctx, Xi);
1076 out += 16;
1077 in += 16;
1078 len -= 16;
1079 }
1080#endif
1081 if (len) {
1082 (*block)(ctx->Yi.c, ctx->EKi.c, key);
1083 ++ctr;
1084 ctx->Yi.d[3] = htobe32(ctr);
1085
1086 while (len--) {
1087 u8 c = in[n];
1088 ctx->Xi.c[n] ^= c;
1089 out[n] = c ^ ctx->EKi.c[n];
1090 ++n;
1091 }
1092 }
1093 404
1094 ctx->mres = n; 405 for (i = 0; i < len; i++) {
1095 return 0;
1096 } while (0);
1097#endif
1098 for (i = 0; i < len; ++i) {
1099 u8 c;
1100 if (n == 0) { 406 if (n == 0) {
1101 (*block)(ctx->Yi.c, ctx->EKi.c, key); 407 ctx->block(ctx->Yi.c, ctx->EKi.c, ctx->key);
1102 ++ctr; 408 ctx->Yi.d[3] = htobe32(++ctr);
1103 ctx->Yi.d[3] = htobe32(ctr);
1104 } 409 }
1105 c = in[i]; 410 c = in[i];
1106 out[i] = c ^ ctx->EKi.c[n]; 411 out[i] = c ^ ctx->EKi.c[n];
1107 ctx->Xi.c[n] ^= c; 412 ctx->Xi.c[n] ^= c;
1108 n = (n + 1) % 16; 413 n = (n + 1) % 16;
1109 if (n == 0) 414 if (n == 0)
1110 GCM_MUL(ctx, Xi); 415 gcm_mul(ctx, ctx->Xi.u);
1111 } 416 }
1112 417
1113 ctx->mres = n; 418 ctx->mres = n;
419
1114 return 0; 420 return 0;
1115} 421}
1116LCRYPTO_ALIAS(CRYPTO_gcm128_decrypt); 422LCRYPTO_ALIAS(CRYPTO_gcm128_decrypt);
1117 423
1118int 424int
1119CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, 425CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, const unsigned char *in,
1120 const unsigned char *in, unsigned char *out, 426 unsigned char *out, size_t len, ctr128_f stream)
1121 size_t len, ctr128_f stream)
1122{ 427{
1123 unsigned int n, ctr; 428 unsigned int n, ctr;
1124 size_t i; 429 uint64_t mlen;
1125 u64 mlen = ctx->len.u[1]; 430 size_t i, j;
1126 void *key = ctx->key;
1127#ifdef GCM_FUNCREF_4BIT
1128 void (*gcm_gmult_p)(u64 Xi[2], const u128 Htable[16]) = ctx->gmult;
1129# ifdef GHASH
1130 void (*gcm_ghash_p)(u64 Xi[2], const u128 Htable[16],
1131 const u8 *inp, size_t len) = ctx->ghash;
1132# endif
1133#endif
1134 431
1135 mlen += len; 432 mlen = ctx->len.u[1] + len;
1136 if (mlen > ((U64(1) << 36) - 32) || (sizeof(len) == 8 && mlen < len)) 433 if (mlen > ((U64(1) << 36) - 32) || (sizeof(len) == 8 && mlen < len))
1137 return -1; 434 return -1;
1138 ctx->len.u[1] = mlen; 435 ctx->len.u[1] = mlen;
1139 436
1140 if (ctx->ares) { 437 if (ctx->ares > 0) {
1141 /* First call to encrypt finalizes GHASH(AAD) */ 438 /* First call to encrypt finalizes GHASH(AAD) */
1142 GCM_MUL(ctx, Xi); 439 gcm_mul(ctx, ctx->Xi.u);
1143 ctx->ares = 0; 440 ctx->ares = 0;
1144 } 441 }
1145 442
1146 ctr = be32toh(ctx->Yi.d[3]); 443 ctr = be32toh(ctx->Yi.d[3]);
1147 444
1148 n = ctx->mres; 445 if ((n = ctx->mres) > 0) {
1149 if (n) { 446 while (n > 0 && len > 0) {
1150 while (n && len) {
1151 ctx->Xi.c[n] ^= *(out++) = *(in++) ^ ctx->EKi.c[n]; 447 ctx->Xi.c[n] ^= *(out++) = *(in++) ^ ctx->EKi.c[n];
1152 --len;
1153 n = (n + 1) % 16; 448 n = (n + 1) % 16;
449 len--;
1154 } 450 }
1155 if (n == 0) 451 if (n > 0) {
1156 GCM_MUL(ctx, Xi);
1157 else {
1158 ctx->mres = n; 452 ctx->mres = n;
1159 return 0; 453 return 0;
1160 } 454 }
455 gcm_mul(ctx, ctx->Xi.u);
1161 } 456 }
1162#if defined(GHASH) && !defined(OPENSSL_SMALL_FOOTPRINT) 457 if ((i = (len & (size_t)-16)) > 0) {
1163 while (len >= GHASH_CHUNK) { 458 j = i / 16;
1164 (*stream)(in, out, GHASH_CHUNK/16, key, ctx->Yi.c); 459 stream(in, out, j, ctx->key, ctx->Yi.c);
1165 ctr += GHASH_CHUNK/16;
1166 ctx->Yi.d[3] = htobe32(ctr);
1167 GHASH(ctx, out, GHASH_CHUNK);
1168 out += GHASH_CHUNK;
1169 in += GHASH_CHUNK;
1170 len -= GHASH_CHUNK;
1171 }
1172#endif
1173 if ((i = (len & (size_t)-16))) {
1174 size_t j = i/16;
1175
1176 (*stream)(in, out, j, key, ctx->Yi.c);
1177 ctr += (unsigned int)j; 460 ctr += (unsigned int)j;
1178 ctx->Yi.d[3] = htobe32(ctr); 461 ctx->Yi.d[3] = htobe32(ctr);
462 gcm_ghash(ctx, out, i);
1179 in += i; 463 in += i;
1180 len -= i;
1181#if defined(GHASH)
1182 GHASH(ctx, out, i);
1183 out += i; 464 out += i;
1184#else 465 len -= i;
1185 while (j--) {
1186 for (i = 0; i < 16; ++i)
1187 ctx->Xi.c[i] ^= out[i];
1188 GCM_MUL(ctx, Xi);
1189 out += 16;
1190 }
1191#endif
1192 } 466 }
1193 if (len) { 467 if (len > 0) {
1194 (*ctx->block)(ctx->Yi.c, ctx->EKi.c, key); 468 ctx->block(ctx->Yi.c, ctx->EKi.c, ctx->key);
1195 ++ctr; 469 ctx->Yi.d[3] = htobe32(++ctr);
1196 ctx->Yi.d[3] = htobe32(ctr); 470 while (len-- > 0) {
1197 while (len--) {
1198 ctx->Xi.c[n] ^= out[n] = in[n] ^ ctx->EKi.c[n]; 471 ctx->Xi.c[n] ^= out[n] = in[n] ^ ctx->EKi.c[n];
1199 ++n; 472 n++;
1200 } 473 }
1201 } 474 }
1202 475
1203 ctx->mres = n; 476 ctx->mres = n;
477
1204 return 0; 478 return 0;
1205} 479}
1206LCRYPTO_ALIAS(CRYPTO_gcm128_encrypt_ctr32); 480LCRYPTO_ALIAS(CRYPTO_gcm128_encrypt_ctr32);
1207 481
1208int 482int
1209CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, 483CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, const unsigned char *in,
1210 const unsigned char *in, unsigned char *out, 484 unsigned char *out, size_t len, ctr128_f stream)
1211 size_t len, ctr128_f stream)
1212{ 485{
1213 unsigned int n, ctr; 486 unsigned int n, ctr;
1214 size_t i; 487 uint64_t mlen;
1215 u64 mlen = ctx->len.u[1]; 488 size_t i, j;
1216 void *key = ctx->key; 489 uint8_t c;
1217#ifdef GCM_FUNCREF_4BIT
1218 void (*gcm_gmult_p)(u64 Xi[2], const u128 Htable[16]) = ctx->gmult;
1219# ifdef GHASH
1220 void (*gcm_ghash_p)(u64 Xi[2], const u128 Htable[16],
1221 const u8 *inp, size_t len) = ctx->ghash;
1222# endif
1223#endif
1224 490
1225 mlen += len; 491 mlen = ctx->len.u[1] + len;
1226 if (mlen > ((U64(1) << 36) - 32) || (sizeof(len) == 8 && mlen < len)) 492 if (mlen > ((U64(1) << 36) - 32) || (sizeof(len) == 8 && mlen < len))
1227 return -1; 493 return -1;
1228 ctx->len.u[1] = mlen; 494 ctx->len.u[1] = mlen;
1229 495
1230 if (ctx->ares) { 496 if (ctx->ares > 0) {
1231 /* First call to decrypt finalizes GHASH(AAD) */ 497 /* First call to decrypt finalizes GHASH(AAD) */
1232 GCM_MUL(ctx, Xi); 498 gcm_mul(ctx, ctx->Xi.u);
1233 ctx->ares = 0; 499 ctx->ares = 0;
1234 } 500 }
1235 501
1236 ctr = be32toh(ctx->Yi.d[3]); 502 ctr = be32toh(ctx->Yi.d[3]);
1237 503
1238 n = ctx->mres; 504 if ((n = ctx->mres) > 0) {
1239 if (n) { 505 while (n > 0 && len > 0) {
1240 while (n && len) { 506 c = *(in++);
1241 u8 c = *(in++);
1242 *(out++) = c ^ ctx->EKi.c[n]; 507 *(out++) = c ^ ctx->EKi.c[n];
1243 ctx->Xi.c[n] ^= c; 508 ctx->Xi.c[n] ^= c;
1244 --len;
1245 n = (n + 1) % 16; 509 n = (n + 1) % 16;
510 len--;
1246 } 511 }
1247 if (n == 0) 512 if (n > 0) {
1248 GCM_MUL(ctx, Xi);
1249 else {
1250 ctx->mres = n; 513 ctx->mres = n;
1251 return 0; 514 return 0;
1252 } 515 }
516 gcm_mul(ctx, ctx->Xi.u);
1253 } 517 }
1254#if defined(GHASH) && !defined(OPENSSL_SMALL_FOOTPRINT) 518 if ((i = (len & (size_t)-16)) > 0) {
1255 while (len >= GHASH_CHUNK) { 519 j = i / 16;
1256 GHASH(ctx, in, GHASH_CHUNK); 520 gcm_ghash(ctx, in, i);
1257 (*stream)(in, out, GHASH_CHUNK/16, key, ctx->Yi.c); 521 stream(in, out, j, ctx->key, ctx->Yi.c);
1258 ctr += GHASH_CHUNK/16;
1259 ctx->Yi.d[3] = htobe32(ctr);
1260 out += GHASH_CHUNK;
1261 in += GHASH_CHUNK;
1262 len -= GHASH_CHUNK;
1263 }
1264#endif
1265 if ((i = (len & (size_t)-16))) {
1266 size_t j = i/16;
1267
1268#if defined(GHASH)
1269 GHASH(ctx, in, i);
1270#else
1271 while (j--) {
1272 size_t k;
1273 for (k = 0; k < 16; ++k)
1274 ctx->Xi.c[k] ^= in[k];
1275 GCM_MUL(ctx, Xi);
1276 in += 16;
1277 }
1278 j = i/16;
1279 in -= i;
1280#endif
1281 (*stream)(in, out, j, key, ctx->Yi.c);
1282 ctr += (unsigned int)j; 522 ctr += (unsigned int)j;
1283 ctx->Yi.d[3] = htobe32(ctr); 523 ctx->Yi.d[3] = htobe32(ctr);
1284 out += i;
1285 in += i; 524 in += i;
525 out += i;
1286 len -= i; 526 len -= i;
1287 } 527 }
1288 if (len) { 528 if (len > 0) {
1289 (*ctx->block)(ctx->Yi.c, ctx->EKi.c, key); 529 ctx->block(ctx->Yi.c, ctx->EKi.c, ctx->key);
1290 ++ctr; 530 ctx->Yi.d[3] = htobe32(++ctr);
1291 ctx->Yi.d[3] = htobe32(ctr); 531 while (len-- > 0) {
1292 while (len--) { 532 c = in[n];
1293 u8 c = in[n];
1294 ctx->Xi.c[n] ^= c; 533 ctx->Xi.c[n] ^= c;
1295 out[n] = c ^ ctx->EKi.c[n]; 534 out[n] = c ^ ctx->EKi.c[n];
1296 ++n; 535 n++;
1297 } 536 }
1298 } 537 }
1299 538
1300 ctx->mres = n; 539 ctx->mres = n;
540
1301 return 0; 541 return 0;
1302} 542}
1303LCRYPTO_ALIAS(CRYPTO_gcm128_decrypt_ctr32); 543LCRYPTO_ALIAS(CRYPTO_gcm128_decrypt_ctr32);
@@ -1306,26 +546,25 @@ int
1306CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag, 546CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag,
1307 size_t len) 547 size_t len)
1308{ 548{
1309 u64 alen = ctx->len.u[0] << 3; 549 uint64_t alen, clen;
1310 u64 clen = ctx->len.u[1] << 3; 550
1311#ifdef GCM_FUNCREF_4BIT 551 alen = ctx->len.u[0] << 3;
1312 void (*gcm_gmult_p)(u64 Xi[2], const u128 Htable[16]) = ctx->gmult; 552 clen = ctx->len.u[1] << 3;
1313#endif
1314 553
1315 if (ctx->mres || ctx->ares) 554 if (ctx->ares > 0 || ctx->mres > 0)
1316 GCM_MUL(ctx, Xi); 555 gcm_mul(ctx, ctx->Xi.u);
1317 556
1318 ctx->Xi.u[0] ^= htobe64(alen); 557 ctx->Xi.u[0] ^= htobe64(alen);
1319 ctx->Xi.u[1] ^= htobe64(clen); 558 ctx->Xi.u[1] ^= htobe64(clen);
1320 GCM_MUL(ctx, Xi); 559 gcm_mul(ctx, ctx->Xi.u);
1321 560
1322 ctx->Xi.u[0] ^= ctx->EK0.u[0]; 561 ctx->Xi.u[0] ^= ctx->EK0.u[0];
1323 ctx->Xi.u[1] ^= ctx->EK0.u[1]; 562 ctx->Xi.u[1] ^= ctx->EK0.u[1];
1324 563
1325 if (tag && len <= sizeof(ctx->Xi)) 564 if (tag == NULL || len > sizeof(ctx->Xi))
1326 return memcmp(ctx->Xi.c, tag, len);
1327 else
1328 return -1; 565 return -1;
566
567 return timingsafe_memcmp(ctx->Xi.c, tag, len);
1329} 568}
1330LCRYPTO_ALIAS(CRYPTO_gcm128_finish); 569LCRYPTO_ALIAS(CRYPTO_gcm128_finish);
1331 570
@@ -1333,26 +572,10 @@ void
1333CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len) 572CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len)
1334{ 573{
1335 CRYPTO_gcm128_finish(ctx, NULL, 0); 574 CRYPTO_gcm128_finish(ctx, NULL, 0);
1336 memcpy(tag, ctx->Xi.c,
1337 len <= sizeof(ctx->Xi.c) ? len : sizeof(ctx->Xi.c));
1338}
1339LCRYPTO_ALIAS(CRYPTO_gcm128_tag);
1340
1341GCM128_CONTEXT *
1342CRYPTO_gcm128_new(void *key, block128_f block)
1343{
1344 GCM128_CONTEXT *ret;
1345 575
1346 if ((ret = malloc(sizeof(GCM128_CONTEXT)))) 576 if (len > sizeof(ctx->Xi.c))
1347 CRYPTO_gcm128_init(ret, key, block); 577 len = sizeof(ctx->Xi.c);
1348 578
1349 return ret; 579 memcpy(tag, ctx->Xi.c, len);
1350} 580}
1351LCRYPTO_ALIAS(CRYPTO_gcm128_new); 581LCRYPTO_ALIAS(CRYPTO_gcm128_tag);
1352
1353void
1354CRYPTO_gcm128_release(GCM128_CONTEXT *ctx)
1355{
1356 freezero(ctx, sizeof(*ctx));
1357}
1358LCRYPTO_ALIAS(CRYPTO_gcm128_release);
diff --git a/src/lib/libcrypto/modes/gcm128_amd64.c b/src/lib/libcrypto/modes/gcm128_amd64.c
new file mode 100644
index 0000000000..eaa66fb32f
--- /dev/null
+++ b/src/lib/libcrypto/modes/gcm128_amd64.c
@@ -0,0 +1,44 @@
1/* $OpenBSD: gcm128_amd64.c,v 1.1 2025/06/28 12:39:10 jsing Exp $ */
2/*
3 * Copyright (c) 2025 Joel Sing <jsing@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#include "crypto_arch.h"
19#include "modes_local.h"
20
21void gcm_init_4bit(u128 Htable[16], uint64_t H[2]);
22void gcm_gmult_4bit(uint64_t Xi[2], const u128 Htable[16]);
23void gcm_ghash_4bit(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp,
24 size_t len);
25
26void gcm_init_clmul(u128 Htable[16], const uint64_t Xi[2]);
27void gcm_gmult_clmul(uint64_t Xi[2], const u128 Htable[16]);
28void gcm_ghash_clmul(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp,
29 size_t len);
30
31void
32gcm128_init(GCM128_CONTEXT *ctx)
33{
34 if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_CLMUL) != 0) {
35 gcm_init_clmul(ctx->Htable, ctx->H.u);
36 ctx->gmult = gcm_gmult_clmul;
37 ctx->ghash = gcm_ghash_clmul;
38 return;
39 }
40
41 gcm_init_4bit(ctx->Htable, ctx->H.u);
42 ctx->gmult = gcm_gmult_4bit;
43 ctx->ghash = gcm_ghash_4bit;
44}
diff --git a/src/lib/libcrypto/modes/gcm128_i386.c b/src/lib/libcrypto/modes/gcm128_i386.c
new file mode 100644
index 0000000000..ac517fdb04
--- /dev/null
+++ b/src/lib/libcrypto/modes/gcm128_i386.c
@@ -0,0 +1,56 @@
1/* $OpenBSD: gcm128_i386.c,v 1.1 2025/06/28 12:39:10 jsing Exp $ */
2/*
3 * Copyright (c) 2025 Joel Sing <jsing@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#include "crypto_arch.h"
19#include "modes_local.h"
20
21void gcm_init_4bit(u128 Htable[16], uint64_t H[2]);
22
23void gcm_gmult_4bit_mmx(uint64_t Xi[2], const u128 Htable[16]);
24void gcm_ghash_4bit_mmx(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp,
25 size_t len);
26
27void gcm_gmult_4bit_x86(uint64_t Xi[2], const u128 Htable[16]);
28void gcm_ghash_4bit_x86(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp,
29 size_t len);
30
31void gcm_init_clmul(u128 Htable[16], const uint64_t Xi[2]);
32void gcm_gmult_clmul(uint64_t Xi[2], const u128 Htable[16]);
33void gcm_ghash_clmul(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp,
34 size_t len);
35
36void
37gcm128_init(GCM128_CONTEXT *ctx)
38{
39 if ((crypto_cpu_caps_i386 & CRYPTO_CPU_CAPS_I386_CLMUL) != 0) {
40 gcm_init_clmul(ctx->Htable, ctx->H.u);
41 ctx->gmult = gcm_gmult_clmul;
42 ctx->ghash = gcm_ghash_clmul;
43 return;
44 }
45
46 if ((crypto_cpu_caps_i386 & CRYPTO_CPU_CAPS_I386_MMX) != 0) {
47 gcm_init_4bit(ctx->Htable, ctx->H.u);
48 ctx->gmult = gcm_gmult_4bit_mmx;
49 ctx->ghash = gcm_ghash_4bit_mmx;
50 return;
51 }
52
53 gcm_init_4bit(ctx->Htable, ctx->H.u);
54 ctx->gmult = gcm_gmult_4bit_x86;
55 ctx->ghash = gcm_ghash_4bit_x86;
56}
diff --git a/src/lib/libcrypto/modes/modes_local.h b/src/lib/libcrypto/modes/modes_local.h
index 511855f2e0..5c1acfc25f 100644
--- a/src/lib/libcrypto/modes/modes_local.h
+++ b/src/lib/libcrypto/modes/modes_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: modes_local.h,v 1.2 2023/07/08 14:55:36 beck Exp $ */ 1/* $OpenBSD: modes_local.h,v 1.7 2025/07/13 06:01:33 jsing Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2010 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2010 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -15,105 +15,47 @@
15__BEGIN_HIDDEN_DECLS 15__BEGIN_HIDDEN_DECLS
16 16
17#if defined(_LP64) 17#if defined(_LP64)
18typedef long i64;
19typedef unsigned long u64;
20#define U64(C) C##UL 18#define U64(C) C##UL
21#else 19#else
22typedef long long i64;
23typedef unsigned long long u64;
24#define U64(C) C##ULL 20#define U64(C) C##ULL
25#endif 21#endif
26 22
27typedef unsigned int u32;
28typedef unsigned char u8;
29
30#if !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
31#if defined(__GNUC__) && __GNUC__>=2
32# if defined(__x86_64) || defined(__x86_64__)
33# define BSWAP8(x) ({ u64 ret=(x); \
34 asm ("bswapq %0" \
35 : "+r"(ret)); ret; })
36# define BSWAP4(x) ({ u32 ret=(x); \
37 asm ("bswapl %0" \
38 : "+r"(ret)); ret; })
39# elif (defined(__i386) || defined(__i386__))
40# define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \
41 asm ("bswapl %0; bswapl %1" \
42 : "+r"(hi),"+r"(lo)); \
43 (u64)hi<<32|lo; })
44# define BSWAP4(x) ({ u32 ret=(x); \
45 asm ("bswapl %0" \
46 : "+r"(ret)); ret; })
47# elif (defined(__arm__) || defined(__arm)) && !defined(__STRICT_ALIGNMENT)
48# define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \
49 asm ("rev %0,%0; rev %1,%1" \
50 : "+r"(hi),"+r"(lo)); \
51 (u64)hi<<32|lo; })
52# define BSWAP4(x) ({ u32 ret; \
53 asm ("rev %0,%1" \
54 : "=r"(ret) : "r"((u32)(x))); \
55 ret; })
56# endif
57#endif
58#endif
59
60#if defined(BSWAP4) && !defined(__STRICT_ALIGNMENT)
61#define GETU32(p) BSWAP4(*(const u32 *)(p))
62#define PUTU32(p,v) *(u32 *)(p) = BSWAP4(v)
63#else
64#define GETU32(p) ((u32)(p)[0]<<24|(u32)(p)[1]<<16|(u32)(p)[2]<<8|(u32)(p)[3])
65#define PUTU32(p,v) ((p)[0]=(u8)((v)>>24),(p)[1]=(u8)((v)>>16),(p)[2]=(u8)((v)>>8),(p)[3]=(u8)(v))
66#endif
67
68/* GCM definitions */ 23/* GCM definitions */
69 24
70typedef struct { 25typedef struct {
71 u64 hi, lo; 26 uint64_t hi, lo;
72} u128; 27} u128;
73 28
74#ifdef TABLE_BITS
75#undef TABLE_BITS
76#endif
77/*
78 * Even though permitted values for TABLE_BITS are 8, 4 and 1, it should
79 * never be set to 8 [or 1]. For further information see gcm128.c.
80 */
81#define TABLE_BITS 4
82
83struct gcm128_context { 29struct gcm128_context {
84 /* Following 6 names follow names in GCM specification */ 30 /* Following 6 names follow names in GCM specification */
85 union { 31 union {
86 u64 u[2]; 32 uint64_t u[2];
87 u32 d[4]; 33 uint32_t d[4];
88 u8 c[16]; 34 uint8_t c[16];
89 size_t t[16/sizeof(size_t)]; 35 size_t t[16/sizeof(size_t)];
90 } Yi, EKi, EK0, len, Xi, H; 36 } Yi, EKi, EK0, len, Xi, H;
91 /* Relative position of Xi, H and pre-computed Htable is used 37 /* Relative position of Xi, H and pre-computed Htable is used
92 * in some assembler modules, i.e. don't change the order! */ 38 * in some assembler modules, i.e. don't change the order! */
93#if TABLE_BITS==8
94 u128 Htable[256];
95#else
96 u128 Htable[16]; 39 u128 Htable[16];
97 void (*gmult)(u64 Xi[2], const u128 Htable[16]); 40 void (*gmult)(uint64_t Xi[2], const u128 Htable[16]);
98 void (*ghash)(u64 Xi[2], const u128 Htable[16], const u8 *inp, 41 void (*ghash)(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp,
99 size_t len); 42 size_t len);
100#endif
101 unsigned int mres, ares; 43 unsigned int mres, ares;
102 block128_f block; 44 block128_f block;
103 void *key; 45 void *key;
104}; 46};
105 47
106struct xts128_context { 48struct xts128_context {
107 void *key1, *key2; 49 const void *key1, *key2;
108 block128_f block1, block2; 50 block128_f block1, block2;
109}; 51};
110 52
111struct ccm128_context { 53struct ccm128_context {
112 union { 54 union {
113 u64 u[2]; 55 uint64_t u[2];
114 u8 c[16]; 56 uint8_t c[16];
115 } nonce, cmac; 57 } nonce, cmac;
116 u64 blocks; 58 uint64_t blocks;
117 block128_f block; 59 block128_f block;
118 void *key; 60 void *key;
119}; 61};
diff --git a/src/lib/libcrypto/modes/ofb128.c b/src/lib/libcrypto/modes/ofb128.c
index 42afd29d58..8440e7f583 100644
--- a/src/lib/libcrypto/modes/ofb128.c
+++ b/src/lib/libcrypto/modes/ofb128.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ofb128.c,v 1.7 2023/07/08 14:56:54 beck Exp $ */ 1/* $OpenBSD: ofb128.c,v 1.10 2025/04/23 10:09:08 jsing Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2008 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2008 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -49,15 +49,11 @@
49 * 49 *
50 */ 50 */
51 51
52#include <openssl/crypto.h>
53#include "modes_local.h"
54#include <string.h> 52#include <string.h>
55 53
56#ifndef MODES_DEBUG 54#include <openssl/crypto.h>
57# ifndef NDEBUG 55
58# define NDEBUG 56#include "modes_local.h"
59# endif
60#endif
61 57
62/* The input and output encrypted as though 128bit ofb mode is being 58/* The input and output encrypted as though 128bit ofb mode is being
63 * used. The extra state information to record how much of the 59 * used. The extra state information to record how much of the
@@ -74,7 +70,6 @@ CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out,
74 70
75 n = *num; 71 n = *num;
76 72
77#if !defined(OPENSSL_SMALL_FOOTPRINT)
78 if (16 % sizeof(size_t) == 0) 73 if (16 % sizeof(size_t) == 0)
79 do { /* always true actually */ 74 do { /* always true actually */
80 while (n && len) { 75 while (n && len) {
@@ -109,7 +104,6 @@ CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out,
109 return; 104 return;
110 } while (0); 105 } while (0);
111 /* the rest would be commonly eliminated by x86* compiler */ 106 /* the rest would be commonly eliminated by x86* compiler */
112#endif
113 while (l < len) { 107 while (l < len) {
114 if (n == 0) { 108 if (n == 0) {
115 (*block)(ivec, ivec, key); 109 (*block)(ivec, ivec, key);
diff --git a/src/lib/libcrypto/modes/xts128.c b/src/lib/libcrypto/modes/xts128.c
index 7516acf850..9c863e73d6 100644
--- a/src/lib/libcrypto/modes/xts128.c
+++ b/src/lib/libcrypto/modes/xts128.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: xts128.c,v 1.12 2023/07/08 14:56:54 beck Exp $ */ 1/* $OpenBSD: xts128.c,v 1.15 2025/05/18 09:05:59 jsing Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2011 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2011 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -48,17 +48,12 @@
48 * ==================================================================== 48 * ====================================================================
49 */ 49 */
50 50
51#include <openssl/crypto.h>
52#include "modes_local.h"
53
54#include <endian.h> 51#include <endian.h>
55#include <string.h> 52#include <string.h>
56 53
57#ifndef MODES_DEBUG 54#include <openssl/crypto.h>
58# ifndef NDEBUG 55
59# define NDEBUG 56#include "modes_local.h"
60# endif
61#endif
62 57
63int 58int
64CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], 59CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16],
@@ -66,9 +61,9 @@ CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16],
66 size_t len, int enc) 61 size_t len, int enc)
67{ 62{
68 union { 63 union {
69 u64 u[2]; 64 uint64_t u[2];
70 u32 d[4]; 65 uint32_t d[4];
71 u8 c[16]; 66 uint8_t c[16];
72 } tweak, scratch; 67 } tweak, scratch;
73 unsigned int i; 68 unsigned int i;
74 69
@@ -88,8 +83,8 @@ CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16],
88 scratch.u[0] ^= tweak.u[0]; 83 scratch.u[0] ^= tweak.u[0];
89 scratch.u[1] ^= tweak.u[1]; 84 scratch.u[1] ^= tweak.u[1];
90#else 85#else
91 scratch.u[0] = ((u64 *)inp)[0] ^ tweak.u[0]; 86 scratch.u[0] = ((uint64_t *)inp)[0] ^ tweak.u[0];
92 scratch.u[1] = ((u64 *)inp)[1] ^ tweak.u[1]; 87 scratch.u[1] = ((uint64_t *)inp)[1] ^ tweak.u[1];
93#endif 88#endif
94 (*ctx->block1)(scratch.c, scratch.c, ctx->key1); 89 (*ctx->block1)(scratch.c, scratch.c, ctx->key1);
95#ifdef __STRICT_ALIGNMENT 90#ifdef __STRICT_ALIGNMENT
@@ -97,8 +92,8 @@ CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16],
97 scratch.u[1] ^= tweak.u[1]; 92 scratch.u[1] ^= tweak.u[1];
98 memcpy(out, scratch.c, 16); 93 memcpy(out, scratch.c, 16);
99#else 94#else
100 ((u64 *)out)[0] = scratch.u[0] ^= tweak.u[0]; 95 ((uint64_t *)out)[0] = scratch.u[0] ^= tweak.u[0];
101 ((u64 *)out)[1] = scratch.u[1] ^= tweak.u[1]; 96 ((uint64_t *)out)[1] = scratch.u[1] ^= tweak.u[1];
102#endif 97#endif
103 inp += 16; 98 inp += 16;
104 out += 16; 99 out += 16;
@@ -120,15 +115,15 @@ CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16],
120 for (c = 0, i = 0; i < 16; ++i) { 115 for (c = 0, i = 0; i < 16; ++i) {
121 /*+ substitutes for |, because c is 1 bit */ 116 /*+ substitutes for |, because c is 1 bit */
122 c += ((size_t)tweak.c[i]) << 1; 117 c += ((size_t)tweak.c[i]) << 1;
123 tweak.c[i] = (u8)c; 118 tweak.c[i] = (uint8_t)c;
124 c = c >> 8; 119 c = c >> 8;
125 } 120 }
126 tweak.c[0] ^= (u8)(0x87 & (0 - c)); 121 tweak.c[0] ^= (uint8_t)(0x87 & (0 - c));
127#endif 122#endif
128 } 123 }
129 if (enc) { 124 if (enc) {
130 for (i = 0; i < len; ++i) { 125 for (i = 0; i < len; ++i) {
131 u8 ch = inp[i]; 126 uint8_t ch = inp[i];
132 out[i] = scratch.c[i]; 127 out[i] = scratch.c[i];
133 scratch.c[i] = ch; 128 scratch.c[i] = ch;
134 } 129 }
@@ -140,8 +135,8 @@ CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16],
140 memcpy(out - 16, scratch.c, 16); 135 memcpy(out - 16, scratch.c, 16);
141 } else { 136 } else {
142 union { 137 union {
143 u64 u[2]; 138 uint64_t u[2];
144 u8 c[16]; 139 uint8_t c[16];
145 } tweak1; 140 } tweak1;
146 141
147#if BYTE_ORDER == LITTLE_ENDIAN 142#if BYTE_ORDER == LITTLE_ENDIAN
@@ -157,25 +152,25 @@ CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16],
157 for (c = 0, i = 0; i < 16; ++i) { 152 for (c = 0, i = 0; i < 16; ++i) {
158 /*+ substitutes for |, because c is 1 bit */ 153 /*+ substitutes for |, because c is 1 bit */
159 c += ((size_t)tweak.c[i]) << 1; 154 c += ((size_t)tweak.c[i]) << 1;
160 tweak1.c[i] = (u8)c; 155 tweak1.c[i] = (uint8_t)c;
161 c = c >> 8; 156 c = c >> 8;
162 } 157 }
163 tweak1.c[0] ^= (u8)(0x87 & (0 - c)); 158 tweak1.c[0] ^= (uint8_t)(0x87 & (0 - c));
164#endif 159#endif
165#ifdef __STRICT_ALIGNMENT 160#ifdef __STRICT_ALIGNMENT
166 memcpy(scratch.c, inp, 16); 161 memcpy(scratch.c, inp, 16);
167 scratch.u[0] ^= tweak1.u[0]; 162 scratch.u[0] ^= tweak1.u[0];
168 scratch.u[1] ^= tweak1.u[1]; 163 scratch.u[1] ^= tweak1.u[1];
169#else 164#else
170 scratch.u[0] = ((u64 *)inp)[0] ^ tweak1.u[0]; 165 scratch.u[0] = ((uint64_t *)inp)[0] ^ tweak1.u[0];
171 scratch.u[1] = ((u64 *)inp)[1] ^ tweak1.u[1]; 166 scratch.u[1] = ((uint64_t *)inp)[1] ^ tweak1.u[1];
172#endif 167#endif
173 (*ctx->block1)(scratch.c, scratch.c, ctx->key1); 168 (*ctx->block1)(scratch.c, scratch.c, ctx->key1);
174 scratch.u[0] ^= tweak1.u[0]; 169 scratch.u[0] ^= tweak1.u[0];
175 scratch.u[1] ^= tweak1.u[1]; 170 scratch.u[1] ^= tweak1.u[1];
176 171
177 for (i = 0; i < len; ++i) { 172 for (i = 0; i < len; ++i) {
178 u8 ch = inp[16 + i]; 173 uint8_t ch = inp[16 + i];
179 out[16 + i] = scratch.c[i]; 174 out[16 + i] = scratch.c[i];
180 scratch.c[i] = ch; 175 scratch.c[i] = ch;
181 } 176 }
@@ -187,8 +182,8 @@ CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16],
187 scratch.u[1] ^= tweak.u[1]; 182 scratch.u[1] ^= tweak.u[1];
188 memcpy(out, scratch.c, 16); 183 memcpy(out, scratch.c, 16);
189#else 184#else
190 ((u64 *)out)[0] = scratch.u[0] ^ tweak.u[0]; 185 ((uint64_t *)out)[0] = scratch.u[0] ^ tweak.u[0];
191 ((u64 *)out)[1] = scratch.u[1] ^ tweak.u[1]; 186 ((uint64_t *)out)[1] = scratch.u[1] ^ tweak.u[1];
192#endif 187#endif
193 } 188 }
194 189
diff --git a/src/lib/libcrypto/objects/obj_dat.c b/src/lib/libcrypto/objects/obj_dat.c
index 2f4012fe15..d4da6be52c 100644
--- a/src/lib/libcrypto/objects/obj_dat.c
+++ b/src/lib/libcrypto/objects/obj_dat.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: obj_dat.c,v 1.94 2025/02/26 10:48:25 tb Exp $ */ 1/* $OpenBSD: obj_dat.c,v 1.95 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -66,11 +66,11 @@
66 66
67#include <openssl/asn1.h> 67#include <openssl/asn1.h>
68#include <openssl/bn.h> 68#include <openssl/bn.h>
69#include <openssl/err.h>
70#include <openssl/lhash.h> 69#include <openssl/lhash.h>
71#include <openssl/objects.h> 70#include <openssl/objects.h>
72 71
73#include "asn1_local.h" 72#include "asn1_local.h"
73#include "err_local.h"
74 74
75/* obj_dat.h is generated from objects.h by obj_dat.pl */ 75/* obj_dat.h is generated from objects.h by obj_dat.pl */
76#include "obj_dat.h" 76#include "obj_dat.h"
diff --git a/src/lib/libcrypto/objects/obj_lib.c b/src/lib/libcrypto/objects/obj_lib.c
index 45062dbd4c..56b0b10423 100644
--- a/src/lib/libcrypto/objects/obj_lib.c
+++ b/src/lib/libcrypto/objects/obj_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: obj_lib.c,v 1.19 2023/08/17 09:13:01 tb Exp $ */ 1/* $OpenBSD: obj_lib.c,v 1.20 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -59,12 +59,12 @@
59#include <stdio.h> 59#include <stdio.h>
60#include <string.h> 60#include <string.h>
61 61
62#include <openssl/err.h>
63#include <openssl/buffer.h> 62#include <openssl/buffer.h>
64#include <openssl/lhash.h> 63#include <openssl/lhash.h>
65#include <openssl/objects.h> 64#include <openssl/objects.h>
66 65
67#include "asn1_local.h" 66#include "asn1_local.h"
67#include "err_local.h"
68 68
69ASN1_OBJECT * 69ASN1_OBJECT *
70OBJ_dup(const ASN1_OBJECT *o) 70OBJ_dup(const ASN1_OBJECT *o)
diff --git a/src/lib/libcrypto/objects/obj_mac.num b/src/lib/libcrypto/objects/obj_mac.num
index 728bf02400..124aafec77 100644
--- a/src/lib/libcrypto/objects/obj_mac.num
+++ b/src/lib/libcrypto/objects/obj_mac.num
@@ -1053,3 +1053,6 @@ RSA_SHA3_512 1052
1053acmeIdentifier 1053 1053acmeIdentifier 1053
1054id_ct_rpkiSignedPrefixList 1054 1054id_ct_rpkiSignedPrefixList 1054
1055tls1_prf 1055 1055tls1_prf 1055
1056MLKEM768_X25519 1056
1057MLKEM768_ECDH_P256 1057
1058MLKEM768_ECDH_P384 1058
diff --git a/src/lib/libcrypto/objects/objects.txt b/src/lib/libcrypto/objects/objects.txt
index 4d5a52efcf..bdf6ea9fe3 100644
--- a/src/lib/libcrypto/objects/objects.txt
+++ b/src/lib/libcrypto/objects/objects.txt
@@ -1477,3 +1477,9 @@ tc26 1 3 3 : id-tc26-signwithdigest-gost3410-2012-512 : GOST R 34.11-2012 with
1477 : AuthECDSA : auth-ecdsa 1477 : AuthECDSA : auth-ecdsa
1478 : AuthGOST01 : auth-gost01 1478 : AuthGOST01 : auth-gost01
1479 : AuthNULL : auth-null 1479 : AuthNULL : auth-null
1480
1481# Hybrid KEMs from
1482# https://www.ietf.org/archive/id/draft-ietf-lamps-pq-composite-kem-06.html#section-7.1
14832 16 840 1 114027 80 5 2 33 : MLKEM768-X25519
14842 16 840 1 114027 80 5 2 34 : MLKEM768-ECDH-P256
14852 16 840 1 114027 80 5 2 35 : MLKEM768-ECDH-P384
diff --git a/src/lib/libcrypto/ocsp/ocsp_cl.c b/src/lib/libcrypto/ocsp/ocsp_cl.c
index d8ee33c391..460c1bce5e 100644
--- a/src/lib/libcrypto/ocsp/ocsp_cl.c
+++ b/src/lib/libcrypto/ocsp/ocsp_cl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ocsp_cl.c,v 1.25 2024/03/24 11:30:12 beck Exp $ */ 1/* $OpenBSD: ocsp_cl.c,v 1.26 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL 2/* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL
3 * project. */ 3 * project. */
4 4
@@ -64,7 +64,6 @@
64#include <stdio.h> 64#include <stdio.h>
65#include <time.h> 65#include <time.h>
66 66
67#include <openssl/err.h>
68#include <openssl/ocsp.h> 67#include <openssl/ocsp.h>
69#include <openssl/objects.h> 68#include <openssl/objects.h>
70#include <openssl/pem.h> 69#include <openssl/pem.h>
@@ -73,6 +72,7 @@
73#include <openssl/x509v3.h> 72#include <openssl/x509v3.h>
74 73
75#include "asn1_local.h" 74#include "asn1_local.h"
75#include "err_local.h"
76#include "ocsp_local.h" 76#include "ocsp_local.h"
77 77
78/* Utility functions related to sending OCSP requests and extracting 78/* Utility functions related to sending OCSP requests and extracting
diff --git a/src/lib/libcrypto/ocsp/ocsp_ht.c b/src/lib/libcrypto/ocsp/ocsp_ht.c
index 69723c2154..db83b35518 100644
--- a/src/lib/libcrypto/ocsp/ocsp_ht.c
+++ b/src/lib/libcrypto/ocsp/ocsp_ht.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ocsp_ht.c,v 1.27 2023/11/28 09:29:20 jsg Exp $ */ 1/* $OpenBSD: ocsp_ht.c,v 1.28 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -60,11 +60,13 @@
60#include <stdlib.h> 60#include <stdlib.h>
61#include <ctype.h> 61#include <ctype.h>
62#include <string.h> 62#include <string.h>
63
63#include <openssl/asn1.h> 64#include <openssl/asn1.h>
64#include <openssl/ocsp.h> 65#include <openssl/ocsp.h>
65#include <openssl/err.h>
66#include <openssl/buffer.h> 66#include <openssl/buffer.h>
67 67
68#include "err_local.h"
69
68/* Stateful OCSP request code, supporting non-blocking I/O */ 70/* Stateful OCSP request code, supporting non-blocking I/O */
69 71
70/* Opaque OCSP request status structure */ 72/* Opaque OCSP request status structure */
diff --git a/src/lib/libcrypto/ocsp/ocsp_lib.c b/src/lib/libcrypto/ocsp/ocsp_lib.c
index 521fb67aed..dfa002a594 100644
--- a/src/lib/libcrypto/ocsp/ocsp_lib.c
+++ b/src/lib/libcrypto/ocsp/ocsp_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ocsp_lib.c,v 1.28 2024/08/28 06:27:19 tb Exp $ */ 1/* $OpenBSD: ocsp_lib.c,v 1.29 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL 2/* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL
3 * project. */ 3 * project. */
4 4
@@ -67,13 +67,13 @@
67#include <openssl/opensslconf.h> 67#include <openssl/opensslconf.h>
68 68
69#include <openssl/asn1t.h> 69#include <openssl/asn1t.h>
70#include <openssl/err.h>
71#include <openssl/objects.h> 70#include <openssl/objects.h>
72#include <openssl/ocsp.h> 71#include <openssl/ocsp.h>
73#include <openssl/pem.h> 72#include <openssl/pem.h>
74#include <openssl/x509.h> 73#include <openssl/x509.h>
75#include <openssl/x509v3.h> 74#include <openssl/x509v3.h>
76 75
76#include "err_local.h"
77#include "ocsp_local.h" 77#include "ocsp_local.h"
78#include "x509_local.h" 78#include "x509_local.h"
79 79
diff --git a/src/lib/libcrypto/ocsp/ocsp_prn.c b/src/lib/libcrypto/ocsp/ocsp_prn.c
index fb7b9651d9..537d5e3d20 100644
--- a/src/lib/libcrypto/ocsp/ocsp_prn.c
+++ b/src/lib/libcrypto/ocsp/ocsp_prn.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ocsp_prn.c,v 1.11 2024/08/28 06:18:44 tb Exp $ */ 1/* $OpenBSD: ocsp_prn.c,v 1.12 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL 2/* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL
3 * project. */ 3 * project. */
4 4
@@ -62,7 +62,6 @@
62 */ 62 */
63 63
64#include <openssl/bio.h> 64#include <openssl/bio.h>
65#include <openssl/err.h>
66#include <openssl/ocsp.h> 65#include <openssl/ocsp.h>
67#include <openssl/pem.h> 66#include <openssl/pem.h>
68#include <openssl/x509.h> 67#include <openssl/x509.h>
diff --git a/src/lib/libcrypto/ocsp/ocsp_srv.c b/src/lib/libcrypto/ocsp/ocsp_srv.c
index 77c5e2e0fd..4b1d73d7ac 100644
--- a/src/lib/libcrypto/ocsp/ocsp_srv.c
+++ b/src/lib/libcrypto/ocsp/ocsp_srv.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ocsp_srv.c,v 1.13 2023/07/08 10:44:00 beck Exp $ */ 1/* $OpenBSD: ocsp_srv.c,v 1.14 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2001. 3 * project 2001.
4 */ 4 */
@@ -58,13 +58,13 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60 60
61#include <openssl/err.h>
62#include <openssl/objects.h> 61#include <openssl/objects.h>
63#include <openssl/ocsp.h> 62#include <openssl/ocsp.h>
64#include <openssl/pem.h> 63#include <openssl/pem.h>
65#include <openssl/x509.h> 64#include <openssl/x509.h>
66#include <openssl/x509v3.h> 65#include <openssl/x509v3.h>
67 66
67#include "err_local.h"
68#include "ocsp_local.h" 68#include "ocsp_local.h"
69 69
70/* Utility functions related to sending OCSP responses and extracting 70/* Utility functions related to sending OCSP responses and extracting
diff --git a/src/lib/libcrypto/ocsp/ocsp_vfy.c b/src/lib/libcrypto/ocsp/ocsp_vfy.c
index 27d2283ea7..185839f465 100644
--- a/src/lib/libcrypto/ocsp/ocsp_vfy.c
+++ b/src/lib/libcrypto/ocsp/ocsp_vfy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ocsp_vfy.c,v 1.24 2024/07/12 18:15:10 beck Exp $ */ 1/* $OpenBSD: ocsp_vfy.c,v 1.25 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -57,9 +57,9 @@
57 */ 57 */
58 58
59#include <openssl/ocsp.h> 59#include <openssl/ocsp.h>
60#include <openssl/err.h>
61#include <string.h> 60#include <string.h>
62 61
62#include "err_local.h"
63#include "ocsp_local.h" 63#include "ocsp_local.h"
64#include "x509_local.h" 64#include "x509_local.h"
65 65
diff --git a/src/lib/libcrypto/pem/pem.h b/src/lib/libcrypto/pem/pem.h
index 4fdab48bb2..709e17308b 100644
--- a/src/lib/libcrypto/pem/pem.h
+++ b/src/lib/libcrypto/pem/pem.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: pem.h,v 1.28 2024/05/11 05:41:28 tb Exp $ */ 1/* $OpenBSD: pem.h,v 1.29 2025/07/16 15:59:26 tb Exp $ */
2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -338,8 +338,6 @@ int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, void *x,
338 338
339STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio(BIO *bp, 339STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio(BIO *bp,
340 STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u); 340 STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u);
341int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc,
342 unsigned char *kstr, int klen, pem_password_cb *cd, void *u);
343#endif 341#endif
344 342
345int PEM_read(FILE *fp, char **name, char **header, 343int PEM_read(FILE *fp, char **name, char **header,
@@ -351,8 +349,6 @@ void * PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x,
351int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp, 349int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp,
352 void *x, const EVP_CIPHER *enc, unsigned char *kstr, 350 void *x, const EVP_CIPHER *enc, unsigned char *kstr,
353 int klen, pem_password_cb *callback, void *u); 351 int klen, pem_password_cb *callback, void *u);
354STACK_OF(X509_INFO) * PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,
355 pem_password_cb *cb, void *u);
356 352
357int PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type); 353int PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type);
358int PEM_SignUpdate(EVP_MD_CTX *ctx, unsigned char *d, unsigned int cnt); 354int PEM_SignUpdate(EVP_MD_CTX *ctx, unsigned char *d, unsigned int cnt);
diff --git a/src/lib/libcrypto/pem/pem_info.c b/src/lib/libcrypto/pem/pem_info.c
index b979c79b33..26061f6f08 100644
--- a/src/lib/libcrypto/pem/pem_info.c
+++ b/src/lib/libcrypto/pem/pem_info.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pem_info.c,v 1.27 2023/07/07 13:40:44 beck Exp $ */ 1/* $OpenBSD: pem_info.c,v 1.33 2025/07/16 15:59:26 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -57,43 +57,81 @@
57 */ 57 */
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include <stdlib.h>
60#include <string.h> 61#include <string.h>
61 62
62#include <openssl/opensslconf.h> 63#include <openssl/opensslconf.h>
63 64
64#include <openssl/buffer.h> 65#include <openssl/asn1.h>
66#include <openssl/bio.h>
67#include <openssl/crypto.h>
68#include <openssl/dsa.h>
69#include <openssl/ec.h>
65#include <openssl/err.h> 70#include <openssl/err.h>
66#include <openssl/evp.h> 71#include <openssl/evp.h>
67#include <openssl/objects.h> 72#include <openssl/objects.h>
68#include <openssl/pem.h> 73#include <openssl/pem.h>
69#include <openssl/x509.h>
70
71#ifndef OPENSSL_NO_DSA
72#include <openssl/dsa.h>
73#endif
74#ifndef OPENSSL_NO_RSA
75#include <openssl/rsa.h> 74#include <openssl/rsa.h>
76#endif 75#include <openssl/x509.h>
77 76
77#include "err_local.h"
78#include "evp_local.h" 78#include "evp_local.h"
79 79
80STACK_OF(X509_INFO) * 80X509_PKEY *
81PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, 81X509_PKEY_new(void)
82 void *u) 82{
83 X509_PKEY *x_pkey;
84
85 if ((x_pkey = calloc(1, sizeof(*x_pkey))) == NULL) {
86 ASN1error(ERR_R_MALLOC_FAILURE);
87 return NULL;
88 }
89
90 return x_pkey;
91}
92
93void
94X509_PKEY_free(X509_PKEY *x_pkey)
95{
96 if (x_pkey == NULL)
97 return;
98
99 EVP_PKEY_free(x_pkey->dec_pkey);
100 free(x_pkey);
101}
102
103X509_INFO *
104X509_INFO_new(void)
83{ 105{
84 BIO *b; 106 X509_INFO *ret;
85 STACK_OF(X509_INFO) *ret;
86 107
87 if ((b = BIO_new(BIO_s_file())) == NULL) { 108 if ((ret = calloc(1, sizeof(X509_INFO))) == NULL) {
88 PEMerror(ERR_R_BUF_LIB); 109 ASN1error(ERR_R_MALLOC_FAILURE);
89 return (0); 110 return NULL;
90 } 111 }
91 BIO_set_fp(b, fp, BIO_NOCLOSE); 112 ret->references = 1;
92 ret = PEM_X509_INFO_read_bio(b, sk, cb, u); 113
93 BIO_free(b); 114 return ret;
94 return (ret); 115}
116LCRYPTO_ALIAS(X509_INFO_new);
117
118void
119X509_INFO_free(X509_INFO *x)
120{
121 if (x == NULL)
122 return;
123
124 if (CRYPTO_add(&x->references, -1, CRYPTO_LOCK_X509_INFO) > 0)
125 return;
126
127 X509_free(x->x509);
128 X509_CRL_free(x->crl);
129 X509_PKEY_free(x->x_pkey);
130 free(x->enc_data);
131
132 free(x);
95} 133}
96LCRYPTO_ALIAS(PEM_X509_INFO_read); 134LCRYPTO_ALIAS(X509_INFO_free);
97 135
98STACK_OF(X509_INFO) * 136STACK_OF(X509_INFO) *
99PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, 137PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb,
@@ -290,98 +328,3 @@ err:
290 return ret; 328 return ret;
291} 329}
292LCRYPTO_ALIAS(PEM_X509_INFO_read_bio); 330LCRYPTO_ALIAS(PEM_X509_INFO_read_bio);
293
294
295/* A TJH addition */
296int
297PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc,
298 unsigned char *kstr, int klen, pem_password_cb *cb, void *u)
299{
300 EVP_CIPHER_CTX ctx;
301 int i, ret = 0;
302 unsigned char *data = NULL;
303 const char *objstr = NULL;
304 char buf[PEM_BUFSIZE];
305 unsigned char *iv = NULL;
306
307 if (enc != NULL) {
308 objstr = OBJ_nid2sn(EVP_CIPHER_nid(enc));
309 if (objstr == NULL) {
310 PEMerror(PEM_R_UNSUPPORTED_CIPHER);
311 goto err;
312 }
313 }
314
315 /* now for the fun part ... if we have a private key then
316 * we have to be able to handle a not-yet-decrypted key
317 * being written out correctly ... if it is decrypted or
318 * it is non-encrypted then we use the base code
319 */
320 if (xi->x_pkey != NULL) {
321 if ((xi->enc_data != NULL) && (xi->enc_len > 0) ) {
322 if (enc == NULL) {
323 PEMerror(PEM_R_CIPHER_IS_NULL);
324 goto err;
325 }
326
327 /* copy from weirdo names into more normal things */
328 iv = xi->enc_cipher.iv;
329 data = (unsigned char *)xi->enc_data;
330 i = xi->enc_len;
331
332 /* we take the encryption data from the
333 * internal stuff rather than what the
334 * user has passed us ... as we have to
335 * match exactly for some strange reason
336 */
337 objstr = OBJ_nid2sn(
338 EVP_CIPHER_nid(xi->enc_cipher.cipher));
339 if (objstr == NULL) {
340 PEMerror(PEM_R_UNSUPPORTED_CIPHER);
341 goto err;
342 }
343
344 /* create the right magic header stuff */
345 if (strlen(objstr) + 23 + 2 * enc->iv_len + 13 >
346 sizeof buf) {
347 PEMerror(ASN1_R_BUFFER_TOO_SMALL);
348 goto err;
349 }
350 buf[0] = '\0';
351 PEM_proc_type(buf, PEM_TYPE_ENCRYPTED);
352 PEM_dek_info(buf, objstr, enc->iv_len, (char *)iv);
353
354 /* use the normal code to write things out */
355 i = PEM_write_bio(bp, PEM_STRING_RSA, buf, data, i);
356 if (i <= 0)
357 goto err;
358 } else {
359 /* Add DSA/DH */
360#ifndef OPENSSL_NO_RSA
361 /* normal optionally encrypted stuff */
362 if (PEM_write_bio_RSAPrivateKey(bp,
363 xi->x_pkey->dec_pkey->pkey.rsa,
364 enc, kstr, klen, cb, u) <= 0)
365 goto err;
366#endif
367 }
368 }
369
370 /* if we have a certificate then write it out now */
371 if ((xi->x509 != NULL) && (PEM_write_bio_X509(bp, xi->x509) <= 0))
372 goto err;
373
374 /* we are ignoring anything else that is loaded into the X509_INFO
375 * structure for the moment ... as I don't need it so I'm not
376 * coding it here and Eric can do it when this makes it into the
377 * base library --tjh
378 */
379
380 ret = 1;
381
382err:
383 explicit_bzero((char *)&ctx, sizeof(ctx));
384 explicit_bzero(buf, PEM_BUFSIZE);
385 return (ret);
386}
387LCRYPTO_ALIAS(PEM_X509_INFO_write_bio);
diff --git a/src/lib/libcrypto/pem/pem_lib.c b/src/lib/libcrypto/pem/pem_lib.c
index 30db092c3e..7c7f776cae 100644
--- a/src/lib/libcrypto/pem/pem_lib.c
+++ b/src/lib/libcrypto/pem/pem_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pem_lib.c,v 1.56 2024/02/18 15:44:10 tb Exp $ */ 1/* $OpenBSD: pem_lib.c,v 1.57 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -64,7 +64,6 @@
64#include <openssl/opensslconf.h> 64#include <openssl/opensslconf.h>
65 65
66#include <openssl/buffer.h> 66#include <openssl/buffer.h>
67#include <openssl/err.h>
68#include <openssl/evp.h> 67#include <openssl/evp.h>
69#include <openssl/objects.h> 68#include <openssl/objects.h>
70#include <openssl/pem.h> 69#include <openssl/pem.h>
@@ -76,6 +75,7 @@
76#endif 75#endif
77 76
78#include "asn1_local.h" 77#include "asn1_local.h"
78#include "err_local.h"
79#include "evp_local.h" 79#include "evp_local.h"
80 80
81#define MIN_LENGTH 4 81#define MIN_LENGTH 4
diff --git a/src/lib/libcrypto/pem/pem_oth.c b/src/lib/libcrypto/pem/pem_oth.c
index 2dca978efd..d466179ad7 100644
--- a/src/lib/libcrypto/pem/pem_oth.c
+++ b/src/lib/libcrypto/pem/pem_oth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pem_oth.c,v 1.9 2023/07/07 13:40:44 beck Exp $ */ 1/* $OpenBSD: pem_oth.c,v 1.10 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -59,12 +59,13 @@
59#include <stdio.h> 59#include <stdio.h>
60 60
61#include <openssl/buffer.h> 61#include <openssl/buffer.h>
62#include <openssl/err.h>
63#include <openssl/evp.h> 62#include <openssl/evp.h>
64#include <openssl/objects.h> 63#include <openssl/objects.h>
65#include <openssl/pem.h> 64#include <openssl/pem.h>
66#include <openssl/x509.h> 65#include <openssl/x509.h>
67 66
67#include "err_local.h"
68
68/* Handle 'other' PEMs: not private keys */ 69/* Handle 'other' PEMs: not private keys */
69 70
70void * 71void *
diff --git a/src/lib/libcrypto/pem/pem_pk8.c b/src/lib/libcrypto/pem/pem_pk8.c
index 6d0c0cbd57..16bde39a7e 100644
--- a/src/lib/libcrypto/pem/pem_pk8.c
+++ b/src/lib/libcrypto/pem/pem_pk8.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pem_pk8.c,v 1.14 2023/07/07 13:40:44 beck Exp $ */ 1/* $OpenBSD: pem_pk8.c,v 1.15 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -60,13 +60,13 @@
60#include <string.h> 60#include <string.h>
61 61
62#include <openssl/buffer.h> 62#include <openssl/buffer.h>
63#include <openssl/err.h>
64#include <openssl/evp.h>
65#include <openssl/objects.h> 63#include <openssl/objects.h>
66#include <openssl/pem.h> 64#include <openssl/pem.h>
67#include <openssl/pkcs12.h> 65#include <openssl/pkcs12.h>
68#include <openssl/x509.h> 66#include <openssl/x509.h>
69 67
68#include "err_local.h"
69
70static int do_pk8pkey(BIO *bp, EVP_PKEY *x, int isder, int nid, 70static int do_pk8pkey(BIO *bp, EVP_PKEY *x, int isder, int nid,
71 const EVP_CIPHER *enc, char *kstr, int klen, pem_password_cb *cb, void *u); 71 const EVP_CIPHER *enc, char *kstr, int klen, pem_password_cb *cb, void *u);
72static int do_pk8pkey_fp(FILE *bp, EVP_PKEY *x, int isder, int nid, 72static int do_pk8pkey_fp(FILE *bp, EVP_PKEY *x, int isder, int nid,
diff --git a/src/lib/libcrypto/pem/pem_pkey.c b/src/lib/libcrypto/pem/pem_pkey.c
index d7001c83cc..df8ebaa036 100644
--- a/src/lib/libcrypto/pem/pem_pkey.c
+++ b/src/lib/libcrypto/pem/pem_pkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pem_pkey.c,v 1.28 2023/11/19 15:46:10 tb Exp $ */ 1/* $OpenBSD: pem_pkey.c,v 1.29 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -62,7 +62,6 @@
62#include <openssl/opensslconf.h> 62#include <openssl/opensslconf.h>
63 63
64#include <openssl/buffer.h> 64#include <openssl/buffer.h>
65#include <openssl/err.h>
66#include <openssl/evp.h> 65#include <openssl/evp.h>
67#include <openssl/objects.h> 66#include <openssl/objects.h>
68#include <openssl/pem.h> 67#include <openssl/pem.h>
@@ -70,6 +69,7 @@
70#include <openssl/x509.h> 69#include <openssl/x509.h>
71 70
72#include "asn1_local.h" 71#include "asn1_local.h"
72#include "err_local.h"
73#include "evp_local.h" 73#include "evp_local.h"
74 74
75int pem_check_suffix(const char *pem_str, const char *suffix); 75int pem_check_suffix(const char *pem_str, const char *suffix);
diff --git a/src/lib/libcrypto/pem/pem_sign.c b/src/lib/libcrypto/pem/pem_sign.c
index 461f957445..878be01b70 100644
--- a/src/lib/libcrypto/pem/pem_sign.c
+++ b/src/lib/libcrypto/pem/pem_sign.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pem_sign.c,v 1.15 2023/07/07 13:40:44 beck Exp $ */ 1/* $OpenBSD: pem_sign.c,v 1.16 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -58,12 +58,13 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60 60
61#include <openssl/err.h>
62#include <openssl/evp.h> 61#include <openssl/evp.h>
63#include <openssl/objects.h> 62#include <openssl/objects.h>
64#include <openssl/pem.h> 63#include <openssl/pem.h>
65#include <openssl/x509.h> 64#include <openssl/x509.h>
66 65
66#include "err_local.h"
67
67int 68int
68PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type) 69PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type)
69{ 70{
diff --git a/src/lib/libcrypto/pem/pvkfmt.c b/src/lib/libcrypto/pem/pvkfmt.c
index 40c9feefe5..395fd9df83 100644
--- a/src/lib/libcrypto/pem/pvkfmt.c
+++ b/src/lib/libcrypto/pem/pvkfmt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pvkfmt.c,v 1.28 2024/02/18 15:45:42 tb Exp $ */ 1/* $OpenBSD: pvkfmt.c,v 1.30 2025/06/07 09:32:35 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2005. 3 * project 2005.
4 */ 4 */
@@ -66,7 +66,6 @@
66#include <openssl/opensslconf.h> 66#include <openssl/opensslconf.h>
67 67
68#include <openssl/bn.h> 68#include <openssl/bn.h>
69#include <openssl/err.h>
70#include <openssl/pem.h> 69#include <openssl/pem.h>
71 70
72#if !defined(OPENSSL_NO_RSA) && !defined(OPENSSL_NO_DSA) 71#if !defined(OPENSSL_NO_RSA) && !defined(OPENSSL_NO_DSA)
@@ -75,6 +74,7 @@
75 74
76#include "bn_local.h" 75#include "bn_local.h"
77#include "dsa_local.h" 76#include "dsa_local.h"
77#include "err_local.h"
78#include "evp_local.h" 78#include "evp_local.h"
79#include "rsa_local.h" 79#include "rsa_local.h"
80 80
@@ -803,8 +803,8 @@ do_PVK_body(const unsigned char **in, unsigned int saltlen,
803 803
804 err: 804 err:
805 EVP_CIPHER_CTX_free(cctx); 805 EVP_CIPHER_CTX_free(cctx);
806 if (enctmp && saltlen) 806 free(enctmp);
807 free(enctmp); 807
808 return ret; 808 return ret;
809} 809}
810 810
diff --git a/src/lib/libcrypto/pkcs12/p12_add.c b/src/lib/libcrypto/pkcs12/p12_add.c
index f6f42c558c..e45218ba96 100644
--- a/src/lib/libcrypto/pkcs12/p12_add.c
+++ b/src/lib/libcrypto/pkcs12/p12_add.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p12_add.c,v 1.25 2024/03/02 10:20:27 tb Exp $ */ 1/* $OpenBSD: p12_add.c,v 1.26 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -58,9 +58,9 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60 60
61#include <openssl/err.h>
62#include <openssl/pkcs12.h> 61#include <openssl/pkcs12.h>
63 62
63#include "err_local.h"
64#include "pkcs12_local.h" 64#include "pkcs12_local.h"
65#include "x509_local.h" 65#include "x509_local.h"
66 66
diff --git a/src/lib/libcrypto/pkcs12/p12_crt.c b/src/lib/libcrypto/pkcs12/p12_crt.c
index 502ccecd25..321115cfcd 100644
--- a/src/lib/libcrypto/pkcs12/p12_crt.c
+++ b/src/lib/libcrypto/pkcs12/p12_crt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p12_crt.c,v 1.26 2024/08/22 12:22:42 tb Exp $ */ 1/* $OpenBSD: p12_crt.c,v 1.27 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -58,10 +58,10 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60 60
61#include <openssl/err.h>
62#include <openssl/pkcs12.h> 61#include <openssl/pkcs12.h>
63#include <openssl/x509.h> 62#include <openssl/x509.h>
64 63
64#include "err_local.h"
65#include "evp_local.h" 65#include "evp_local.h"
66#include "pkcs12_local.h" 66#include "pkcs12_local.h"
67#include "x509_local.h" 67#include "x509_local.h"
diff --git a/src/lib/libcrypto/pkcs12/p12_decr.c b/src/lib/libcrypto/pkcs12/p12_decr.c
index 907d4e52a6..8466e92415 100644
--- a/src/lib/libcrypto/pkcs12/p12_decr.c
+++ b/src/lib/libcrypto/pkcs12/p12_decr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p12_decr.c,v 1.26 2024/03/02 10:15:16 tb Exp $ */ 1/* $OpenBSD: p12_decr.c,v 1.27 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -59,9 +59,9 @@
59#include <stdio.h> 59#include <stdio.h>
60#include <string.h> 60#include <string.h>
61 61
62#include <openssl/err.h>
63#include <openssl/pkcs12.h> 62#include <openssl/pkcs12.h>
64 63
64#include "err_local.h"
65#include "evp_local.h" 65#include "evp_local.h"
66 66
67/* Encrypt/Decrypt a buffer based on password and algor, result in a 67/* Encrypt/Decrypt a buffer based on password and algor, result in a
diff --git a/src/lib/libcrypto/pkcs12/p12_init.c b/src/lib/libcrypto/pkcs12/p12_init.c
index cd9422d215..ac0f1eeb57 100644
--- a/src/lib/libcrypto/pkcs12/p12_init.c
+++ b/src/lib/libcrypto/pkcs12/p12_init.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p12_init.c,v 1.17 2024/03/24 06:48:03 tb Exp $ */ 1/* $OpenBSD: p12_init.c,v 1.18 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -58,9 +58,9 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60 60
61#include <openssl/err.h>
62#include <openssl/pkcs12.h> 61#include <openssl/pkcs12.h>
63 62
63#include "err_local.h"
64#include "pkcs12_local.h" 64#include "pkcs12_local.h"
65 65
66/* Initialise a PKCS12 structure to take data */ 66/* Initialise a PKCS12 structure to take data */
diff --git a/src/lib/libcrypto/pkcs12/p12_key.c b/src/lib/libcrypto/pkcs12/p12_key.c
index 443d632c87..29a99bbca4 100644
--- a/src/lib/libcrypto/pkcs12/p12_key.c
+++ b/src/lib/libcrypto/pkcs12/p12_key.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p12_key.c,v 1.36 2025/03/09 15:45:52 tb Exp $ */ 1/* $OpenBSD: p12_key.c,v 1.37 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -60,9 +60,9 @@
60#include <string.h> 60#include <string.h>
61 61
62#include <openssl/bn.h> 62#include <openssl/bn.h>
63#include <openssl/err.h>
64#include <openssl/pkcs12.h> 63#include <openssl/pkcs12.h>
65 64
65#include "err_local.h"
66#include "evp_local.h" 66#include "evp_local.h"
67#include "pkcs12_local.h" 67#include "pkcs12_local.h"
68 68
diff --git a/src/lib/libcrypto/pkcs12/p12_kiss.c b/src/lib/libcrypto/pkcs12/p12_kiss.c
index e4de2eb61c..f6f09ff2de 100644
--- a/src/lib/libcrypto/pkcs12/p12_kiss.c
+++ b/src/lib/libcrypto/pkcs12/p12_kiss.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p12_kiss.c,v 1.28 2025/01/06 23:35:25 tb Exp $ */ 1/* $OpenBSD: p12_kiss.c,v 1.29 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -58,9 +58,9 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60 60
61#include <openssl/err.h>
62#include <openssl/pkcs12.h> 61#include <openssl/pkcs12.h>
63 62
63#include "err_local.h"
64#include "pkcs12_local.h" 64#include "pkcs12_local.h"
65 65
66/* Simplified PKCS#12 routines */ 66/* Simplified PKCS#12 routines */
diff --git a/src/lib/libcrypto/pkcs12/p12_mutl.c b/src/lib/libcrypto/pkcs12/p12_mutl.c
index 2060358188..4a9d0f9757 100644
--- a/src/lib/libcrypto/pkcs12/p12_mutl.c
+++ b/src/lib/libcrypto/pkcs12/p12_mutl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p12_mutl.c,v 1.38 2024/03/24 06:48:03 tb Exp $ */ 1/* $OpenBSD: p12_mutl.c,v 1.40 2025/06/03 08:42:15 kenjiro Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -64,10 +64,10 @@
64 64
65#ifndef OPENSSL_NO_HMAC 65#ifndef OPENSSL_NO_HMAC
66 66
67#include <openssl/err.h>
68#include <openssl/hmac.h> 67#include <openssl/hmac.h>
69#include <openssl/pkcs12.h> 68#include <openssl/pkcs12.h>
70 69
70#include "err_local.h"
71#include "evp_local.h" 71#include "evp_local.h"
72#include "hmac_local.h" 72#include "hmac_local.h"
73#include "pkcs12_local.h" 73#include "pkcs12_local.h"
@@ -189,10 +189,10 @@ PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen)
189 PKCS12error(PKCS12_R_MAC_GENERATION_ERROR); 189 PKCS12error(PKCS12_R_MAC_GENERATION_ERROR);
190 return 0; 190 return 0;
191 } 191 }
192 if ((maclen != (unsigned int)p12->mac->dinfo->digest->length) || 192 if (maclen != (unsigned int)p12->mac->dinfo->digest->length)
193 memcmp(mac, p12->mac->dinfo->digest->data, maclen))
194 return 0; 193 return 0;
195 return 1; 194
195 return timingsafe_memcmp(mac, p12->mac->dinfo->digest->data, maclen) == 0;
196} 196}
197LCRYPTO_ALIAS(PKCS12_verify_mac); 197LCRYPTO_ALIAS(PKCS12_verify_mac);
198 198
diff --git a/src/lib/libcrypto/pkcs12/p12_npas.c b/src/lib/libcrypto/pkcs12/p12_npas.c
index 6d3b43ce22..c78deb9182 100644
--- a/src/lib/libcrypto/pkcs12/p12_npas.c
+++ b/src/lib/libcrypto/pkcs12/p12_npas.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p12_npas.c,v 1.27 2024/01/25 15:33:35 tb Exp $ */ 1/* $OpenBSD: p12_npas.c,v 1.28 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -60,9 +60,9 @@
60#include <stdlib.h> 60#include <stdlib.h>
61#include <string.h> 61#include <string.h>
62#include <openssl/pem.h> 62#include <openssl/pem.h>
63#include <openssl/err.h>
64#include <openssl/pkcs12.h> 63#include <openssl/pkcs12.h>
65 64
65#include "err_local.h"
66#include "pkcs12_local.h" 66#include "pkcs12_local.h"
67#include "x509_local.h" 67#include "x509_local.h"
68 68
diff --git a/src/lib/libcrypto/pkcs12/p12_p8e.c b/src/lib/libcrypto/pkcs12/p12_p8e.c
index bf61593266..a8a5039dfb 100644
--- a/src/lib/libcrypto/pkcs12/p12_p8e.c
+++ b/src/lib/libcrypto/pkcs12/p12_p8e.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p12_p8e.c,v 1.13 2024/03/02 10:15:16 tb Exp $ */ 1/* $OpenBSD: p12_p8e.c,v 1.14 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2001. 3 * project 2001.
4 */ 4 */
@@ -58,9 +58,9 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60 60
61#include <openssl/err.h>
62#include <openssl/pkcs12.h> 61#include <openssl/pkcs12.h>
63 62
63#include "err_local.h"
64#include "pkcs12_local.h" 64#include "pkcs12_local.h"
65#include "x509_local.h" 65#include "x509_local.h"
66 66
diff --git a/src/lib/libcrypto/pkcs12/p12_sbag.c b/src/lib/libcrypto/pkcs12/p12_sbag.c
index 1664e9409d..5fea54073b 100644
--- a/src/lib/libcrypto/pkcs12/p12_sbag.c
+++ b/src/lib/libcrypto/pkcs12/p12_sbag.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p12_sbag.c,v 1.9 2024/03/24 06:48:03 tb Exp $ */ 1/* $OpenBSD: p12_sbag.c,v 1.10 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project 3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
4 * 1999-2018. 4 * 1999-2018.
@@ -59,9 +59,9 @@
59 59
60#include <stdio.h> 60#include <stdio.h>
61 61
62#include <openssl/err.h>
63#include <openssl/pkcs12.h> 62#include <openssl/pkcs12.h>
64 63
64#include "err_local.h"
65#include "pkcs12_local.h" 65#include "pkcs12_local.h"
66#include "x509_local.h" 66#include "x509_local.h"
67 67
diff --git a/src/lib/libcrypto/pkcs12/pkcs12.h b/src/lib/libcrypto/pkcs12/pkcs12.h
index 200712039b..aec0362806 100644
--- a/src/lib/libcrypto/pkcs12/pkcs12.h
+++ b/src/lib/libcrypto/pkcs12/pkcs12.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: pkcs12.h,v 1.29 2025/03/09 15:45:52 tb Exp $ */ 1/* $OpenBSD: pkcs12.h,v 1.30 2025/05/10 19:01:16 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -77,7 +77,7 @@ extern "C" {
77 77
78#define PKCS12_MAC_KEY_LENGTH 20 78#define PKCS12_MAC_KEY_LENGTH 20
79 79
80#define PKCS12_SALT_LEN 8 80#define PKCS12_SALT_LEN 16
81 81
82/* Uncomment out next line for unicode password and names, otherwise ASCII */ 82/* Uncomment out next line for unicode password and names, otherwise ASCII */
83 83
diff --git a/src/lib/libcrypto/pkcs7/pk7_asn1.c b/src/lib/libcrypto/pkcs7/pk7_asn1.c
index 8a6ae487da..be1c4c1a1d 100644
--- a/src/lib/libcrypto/pkcs7/pk7_asn1.c
+++ b/src/lib/libcrypto/pkcs7/pk7_asn1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pk7_asn1.c,v 1.18 2024/07/08 16:23:27 beck Exp $ */ 1/* $OpenBSD: pk7_asn1.c,v 1.19 2025/06/11 18:11:55 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -84,7 +84,6 @@ static const ASN1_ADB_TABLE PKCS7_adbtbl[] = {
84 .field_name = "d.data", 84 .field_name = "d.data",
85 .item = &ASN1_OCTET_STRING_NDEF_it, 85 .item = &ASN1_OCTET_STRING_NDEF_it,
86 }, 86 },
87
88 }, 87 },
89 { 88 {
90 .value = NID_pkcs7_signed, 89 .value = NID_pkcs7_signed,
@@ -95,7 +94,6 @@ static const ASN1_ADB_TABLE PKCS7_adbtbl[] = {
95 .field_name = "d.sign", 94 .field_name = "d.sign",
96 .item = &PKCS7_SIGNED_it, 95 .item = &PKCS7_SIGNED_it,
97 }, 96 },
98
99 }, 97 },
100 { 98 {
101 .value = NID_pkcs7_enveloped, 99 .value = NID_pkcs7_enveloped,
@@ -106,7 +104,6 @@ static const ASN1_ADB_TABLE PKCS7_adbtbl[] = {
106 .field_name = "d.enveloped", 104 .field_name = "d.enveloped",
107 .item = &PKCS7_ENVELOPE_it, 105 .item = &PKCS7_ENVELOPE_it,
108 }, 106 },
109
110 }, 107 },
111 { 108 {
112 .value = NID_pkcs7_signedAndEnveloped, 109 .value = NID_pkcs7_signedAndEnveloped,
@@ -117,7 +114,6 @@ static const ASN1_ADB_TABLE PKCS7_adbtbl[] = {
117 .field_name = "d.signed_and_enveloped", 114 .field_name = "d.signed_and_enveloped",
118 .item = &PKCS7_SIGN_ENVELOPE_it, 115 .item = &PKCS7_SIGN_ENVELOPE_it,
119 }, 116 },
120
121 }, 117 },
122 { 118 {
123 .value = NID_pkcs7_digest, 119 .value = NID_pkcs7_digest,
@@ -128,7 +124,6 @@ static const ASN1_ADB_TABLE PKCS7_adbtbl[] = {
128 .field_name = "d.digest", 124 .field_name = "d.digest",
129 .item = &PKCS7_DIGEST_it, 125 .item = &PKCS7_DIGEST_it,
130 }, 126 },
131
132 }, 127 },
133 { 128 {
134 .value = NID_pkcs7_encrypted, 129 .value = NID_pkcs7_encrypted,
@@ -139,7 +134,6 @@ static const ASN1_ADB_TABLE PKCS7_adbtbl[] = {
139 .field_name = "d.encrypted", 134 .field_name = "d.encrypted",
140 .item = &PKCS7_ENCRYPT_it, 135 .item = &PKCS7_ENCRYPT_it,
141 }, 136 },
142
143 }, 137 },
144}; 138};
145 139
diff --git a/src/lib/libcrypto/pkcs7/pk7_attr.c b/src/lib/libcrypto/pkcs7/pk7_attr.c
index 52463aa3a3..f2e17806db 100644
--- a/src/lib/libcrypto/pkcs7/pk7_attr.c
+++ b/src/lib/libcrypto/pkcs7/pk7_attr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pk7_attr.c,v 1.15 2024/02/19 15:37:44 tb Exp $ */ 1/* $OpenBSD: pk7_attr.c,v 1.22 2025/07/31 02:24:21 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2001. 3 * project 2001.
4 */ 4 */
@@ -59,23 +59,48 @@
59#include <stdio.h> 59#include <stdio.h>
60 60
61#include <openssl/asn1.h> 61#include <openssl/asn1.h>
62#include <openssl/err.h>
63#include <openssl/objects.h> 62#include <openssl/objects.h>
64#include <openssl/pkcs7.h> 63#include <openssl/pkcs7.h>
65#include <openssl/x509.h> 64#include <openssl/x509.h>
66 65
66#include "asn1_local.h"
67#include "err_local.h"
68#include "x509_local.h"
69
67int 70int
68PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, STACK_OF(X509_ALGOR) *cap) 71PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, STACK_OF(X509_ALGOR) *cap)
69{ 72{
70 ASN1_STRING *seq; 73 ASN1_STRING *seq = NULL;
71 if (!(seq = ASN1_STRING_new())) { 74 unsigned char *data = NULL;
75 int len = 0;
76 int ret = 0;
77
78 if ((len = i2d_X509_ALGORS(cap, &data)) <= 0) {
79 len = 0;
80 goto err;
81 }
82
83 if ((seq = ASN1_STRING_new()) == NULL) {
72 PKCS7error(ERR_R_MALLOC_FAILURE); 84 PKCS7error(ERR_R_MALLOC_FAILURE);
73 return 0; 85 goto err;
74 } 86 }
75 seq->length = ASN1_item_i2d((ASN1_VALUE *)cap, &seq->data, 87
76 &X509_ALGORS_it); 88 ASN1_STRING_set0(seq, data, len);
77 return PKCS7_add_signed_attribute(si, NID_SMIMECapabilities, 89 data = NULL;
78 V_ASN1_SEQUENCE, seq); 90 len = 0;
91
92 if (!PKCS7_add_signed_attribute(si, NID_SMIMECapabilities,
93 V_ASN1_SEQUENCE, seq))
94 goto err;
95 seq = NULL;
96
97 ret = 1;
98
99 err:
100 ASN1_STRING_free(seq);
101 freezero(data, len);
102
103 return ret;
79} 104}
80LCRYPTO_ALIAS(PKCS7_add_attrib_smimecap); 105LCRYPTO_ALIAS(PKCS7_add_attrib_smimecap);
81 106
@@ -84,51 +109,60 @@ PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si)
84{ 109{
85 ASN1_TYPE *cap; 110 ASN1_TYPE *cap;
86 const unsigned char *p; 111 const unsigned char *p;
112 int len;
87 113
88 cap = PKCS7_get_signed_attribute(si, NID_SMIMECapabilities); 114 if ((cap = PKCS7_get_signed_attribute(si, NID_SMIMECapabilities)) == NULL)
89 if (!cap || (cap->type != V_ASN1_SEQUENCE)) 115 return NULL;
116 if (cap->type != V_ASN1_SEQUENCE)
90 return NULL; 117 return NULL;
118
91 p = cap->value.sequence->data; 119 p = cap->value.sequence->data;
92 return (STACK_OF(X509_ALGOR) *) 120 len = cap->value.sequence->length;
93 ASN1_item_d2i(NULL, &p, cap->value.sequence->length, 121
94 &X509_ALGORS_it); 122 return d2i_X509_ALGORS(NULL, &p, len);
95} 123}
96LCRYPTO_ALIAS(PKCS7_get_smimecap); 124LCRYPTO_ALIAS(PKCS7_get_smimecap);
97 125
98/* Basic smime-capabilities OID and optional integer arg */ 126/*
127 * Add AlgorithmIdentifier OID of type |nid| to the SMIMECapability attribute
128 * set |sk| (see RFC 3851, section 2.5.2). If keysize > 0, the OID has an
129 * integer parameter of value |keysize|, otherwise parameters are omitted.
130 *
131 * See also CMS_add_simple_smimecap().
132 */
99int 133int
100PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg) 134PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int keysize)
101{ 135{
102 X509_ALGOR *alg; 136 X509_ALGOR *alg = NULL;
137 ASN1_INTEGER *parameter = NULL;
138 int parameter_type = V_ASN1_UNDEF;
139 int ret = 0;
103 140
104 if (!(alg = X509_ALGOR_new())) { 141 if (keysize > 0) {
105 PKCS7error(ERR_R_MALLOC_FAILURE); 142 if ((parameter = ASN1_INTEGER_new()) == NULL)
106 return 0;
107 }
108 ASN1_OBJECT_free(alg->algorithm);
109 alg->algorithm = OBJ_nid2obj(nid);
110 if (arg > 0) {
111 ASN1_INTEGER *nbit;
112
113 if (!(alg->parameter = ASN1_TYPE_new()))
114 goto err;
115 if (!(nbit = ASN1_INTEGER_new()))
116 goto err; 143 goto err;
117 if (!ASN1_INTEGER_set(nbit, arg)) { 144 if (!ASN1_INTEGER_set(parameter, keysize))
118 ASN1_INTEGER_free(nbit);
119 goto err; 145 goto err;
120 } 146 parameter_type = V_ASN1_INTEGER;
121 alg->parameter->value.integer = nbit;
122 alg->parameter->type = V_ASN1_INTEGER;
123 } 147 }
124 if (sk_X509_ALGOR_push(sk, alg) == 0) 148
149 if ((alg = X509_ALGOR_new()) == NULL)
125 goto err; 150 goto err;
126 return 1; 151 if (!X509_ALGOR_set0_by_nid(alg, nid, parameter_type, parameter))
152 goto err;
153 parameter = NULL;
154
155 if (sk_X509_ALGOR_push(sk, alg) <= 0)
156 goto err;
157 alg = NULL;
127 158
128err: 159 ret = 1;
129 PKCS7error(ERR_R_MALLOC_FAILURE); 160
161 err:
130 X509_ALGOR_free(alg); 162 X509_ALGOR_free(alg);
131 return 0; 163 ASN1_INTEGER_free(parameter);
164
165 return ret;
132} 166}
133LCRYPTO_ALIAS(PKCS7_simple_smimecap); 167LCRYPTO_ALIAS(PKCS7_simple_smimecap);
134 168
@@ -147,30 +181,54 @@ LCRYPTO_ALIAS(PKCS7_add_attrib_content_type);
147int 181int
148PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t) 182PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t)
149{ 183{
150 if (!t && !(t = X509_gmtime_adj(NULL, 0))) { 184 ASN1_TIME *tm;
185 int ret = 0;
186
187 if ((tm = t) == NULL)
188 tm = X509_gmtime_adj(NULL, 0);
189 if (tm == NULL) {
151 PKCS7error(ERR_R_MALLOC_FAILURE); 190 PKCS7error(ERR_R_MALLOC_FAILURE);
152 return 0; 191 goto err;
153 } 192 }
154 return PKCS7_add_signed_attribute(si, NID_pkcs9_signingTime, 193
155 V_ASN1_UTCTIME, t); 194 /* RFC 5652, section 11.3 - UTCTime for the years 1950-2049. */
195 if (ASN1_time_parse(tm->data, tm->length, NULL, tm->type) == -1)
196 goto err;
197 if (!PKCS7_add_signed_attribute(si, NID_pkcs9_signingTime, tm->type, tm))
198 goto err;
199 tm = NULL;
200
201 ret = 1;
202
203 err:
204 if (tm != t)
205 ASN1_TIME_free(tm);
206
207 return ret;
156} 208}
157LCRYPTO_ALIAS(PKCS7_add0_attrib_signing_time); 209LCRYPTO_ALIAS(PKCS7_add0_attrib_signing_time);
158 210
159int 211int
160PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si, const unsigned char *md, 212PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si, const unsigned char *md,
161 int mdlen) 213 int md_len)
162{ 214{
163 ASN1_OCTET_STRING *os; 215 ASN1_OCTET_STRING *os;
216 int ret = 0;
164 217
165 os = ASN1_OCTET_STRING_new(); 218 if ((os = ASN1_OCTET_STRING_new()) == NULL)
166 if (!os) 219 goto err;
167 return 0; 220 if (!ASN1_STRING_set(os, md, md_len))
168 if (!ASN1_STRING_set(os, md, mdlen) || 221 goto err;
169 !PKCS7_add_signed_attribute(si, NID_pkcs9_messageDigest, 222 if (!PKCS7_add_signed_attribute(si, NID_pkcs9_messageDigest,
170 V_ASN1_OCTET_STRING, os)) { 223 V_ASN1_OCTET_STRING, os))
171 ASN1_OCTET_STRING_free(os); 224 goto err;
172 return 0; 225 os = NULL;
173 } 226
174 return 1; 227 ret = 1;
228
229 err:
230 ASN1_OCTET_STRING_free(os);
231
232 return ret;
175} 233}
176LCRYPTO_ALIAS(PKCS7_add1_attrib_digest); 234LCRYPTO_ALIAS(PKCS7_add1_attrib_digest);
diff --git a/src/lib/libcrypto/pkcs7/pk7_doit.c b/src/lib/libcrypto/pkcs7/pk7_doit.c
index e1c075f15a..e39d960780 100644
--- a/src/lib/libcrypto/pkcs7/pk7_doit.c
+++ b/src/lib/libcrypto/pkcs7/pk7_doit.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pk7_doit.c,v 1.57 2024/11/30 10:01:31 tb Exp $ */ 1/* $OpenBSD: pk7_doit.c,v 1.61 2025/07/27 07:06:41 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -60,11 +60,11 @@
60#include <stdlib.h> 60#include <stdlib.h>
61#include <string.h> 61#include <string.h>
62 62
63#include <openssl/err.h>
64#include <openssl/objects.h> 63#include <openssl/objects.h>
65#include <openssl/x509.h> 64#include <openssl/x509.h>
66#include <openssl/x509v3.h> 65#include <openssl/x509v3.h>
67 66
67#include "err_local.h"
68#include "evp_local.h" 68#include "evp_local.h"
69#include "x509_local.h" 69#include "x509_local.h"
70 70
@@ -981,8 +981,8 @@ PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx, BIO *bio,
981 X509_STORE_CTX_cleanup(ctx); 981 X509_STORE_CTX_cleanup(ctx);
982 982
983 return PKCS7_signatureVerify(bio, p7, si, x509); 983 return PKCS7_signatureVerify(bio, p7, si, x509);
984
984err: 985err:
985
986 return ret; 986 return ret;
987} 987}
988LCRYPTO_ALIAS(PKCS7_dataVerify); 988LCRYPTO_ALIAS(PKCS7_dataVerify);
@@ -1067,8 +1067,10 @@ PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, X509 *x509)
1067 ret = -1; 1067 ret = -1;
1068 goto err; 1068 goto err;
1069 } 1069 }
1070 if (!EVP_VerifyUpdate(&mdc_tmp, abuf, alen)) 1070 if (!EVP_VerifyUpdate(&mdc_tmp, abuf, alen)) {
1071 free(abuf);
1071 goto err; 1072 goto err;
1073 }
1072 1074
1073 free(abuf); 1075 free(abuf);
1074 } 1076 }
@@ -1206,43 +1208,51 @@ PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si, STACK_OF(X509_ATTRIBUTE) *sk)
1206LCRYPTO_ALIAS(PKCS7_set_attributes); 1208LCRYPTO_ALIAS(PKCS7_set_attributes);
1207 1209
1208static int 1210static int
1209add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype, void *value) 1211add_attribute(STACK_OF(X509_ATTRIBUTE) **in_sk, int nid, int atrtype, void *value)
1210{ 1212{
1211 X509_ATTRIBUTE *attr = NULL; 1213 STACK_OF(X509_ATTRIBUTE) *sk;
1214 X509_ATTRIBUTE *old_attr = NULL, *new_attr = NULL;
1215 int need_pop = 0;
1216 int i;
1212 1217
1213 if (*sk == NULL) { 1218 if ((sk = *in_sk) == NULL)
1214 *sk = sk_X509_ATTRIBUTE_new_null(); 1219 sk = sk_X509_ATTRIBUTE_new_null();
1215 if (*sk == NULL) 1220 if (sk == NULL)
1216 return 0; 1221 goto err;
1217new_attrib: 1222
1218 if (!(attr = X509_ATTRIBUTE_create(nid, atrtype, value))) 1223 /* Replace an already existing attribute with the given nid. */
1219 return 0; 1224 for (i = 0; i < sk_X509_ATTRIBUTE_num(sk); i++) {
1220 if (!sk_X509_ATTRIBUTE_push(*sk, attr)) { 1225 old_attr = sk_X509_ATTRIBUTE_value(sk, i);
1221 X509_ATTRIBUTE_free(attr); 1226 if(OBJ_obj2nid(old_attr->object) == nid)
1222 return 0; 1227 break;
1223 }
1224 } else {
1225 int i;
1226
1227 for (i = 0; i < sk_X509_ATTRIBUTE_num(*sk); i++) {
1228 attr = sk_X509_ATTRIBUTE_value(*sk, i);
1229 if (OBJ_obj2nid(attr->object) == nid) {
1230 X509_ATTRIBUTE_free(attr);
1231 attr = X509_ATTRIBUTE_create(nid, atrtype,
1232 value);
1233 if (attr == NULL)
1234 return 0;
1235 if (!sk_X509_ATTRIBUTE_set(*sk, i, attr)) {
1236 X509_ATTRIBUTE_free(attr);
1237 return 0;
1238 }
1239 goto end;
1240 }
1241 }
1242 goto new_attrib;
1243 } 1228 }
1244end: 1229
1230 /* If there is none, make room for the new one, so _set() succeeds. */
1231 if (i == sk_X509_ATTRIBUTE_num(sk)) {
1232 old_attr = NULL;
1233 if (sk_X509_ATTRIBUTE_push(sk, NULL) <= 0)
1234 goto err;
1235 need_pop = 1;
1236 }
1237
1238 /* On success, new_attr owns value. */
1239 if ((new_attr = X509_ATTRIBUTE_create(nid, atrtype, value)) == NULL)
1240 goto err;
1241
1242 X509_ATTRIBUTE_free(old_attr);
1243 (void)sk_X509_ATTRIBUTE_set(sk, i, new_attr);
1244
1245 *in_sk = sk;
1246
1245 return 1; 1247 return 1;
1248
1249 err:
1250 if (need_pop)
1251 (void)sk_X509_ATTRIBUTE_pop(sk);
1252 if (*in_sk != sk)
1253 sk_X509_ATTRIBUTE_pop_free(sk, X509_ATTRIBUTE_free);
1254
1255 return 0;
1246} 1256}
1247 1257
1248int 1258int
diff --git a/src/lib/libcrypto/pkcs7/pk7_lib.c b/src/lib/libcrypto/pkcs7/pk7_lib.c
index a1c7d61cca..8712a2ecc1 100644
--- a/src/lib/libcrypto/pkcs7/pk7_lib.c
+++ b/src/lib/libcrypto/pkcs7/pk7_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pk7_lib.c,v 1.30 2024/12/06 07:10:20 tb Exp $ */ 1/* $OpenBSD: pk7_lib.c,v 1.31 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -58,11 +58,11 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60 60
61#include <openssl/err.h>
62#include <openssl/objects.h> 61#include <openssl/objects.h>
63#include <openssl/x509.h> 62#include <openssl/x509.h>
64 63
65#include "asn1_local.h" 64#include "asn1_local.h"
65#include "err_local.h"
66#include "evp_local.h" 66#include "evp_local.h"
67#include "x509_local.h" 67#include "x509_local.h"
68 68
diff --git a/src/lib/libcrypto/pkcs7/pk7_smime.c b/src/lib/libcrypto/pkcs7/pk7_smime.c
index cff89c34e1..32f28f0505 100644
--- a/src/lib/libcrypto/pkcs7/pk7_smime.c
+++ b/src/lib/libcrypto/pkcs7/pk7_smime.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pk7_smime.c,v 1.27 2024/04/20 10:11:55 tb Exp $ */ 1/* $OpenBSD: pk7_smime.c,v 1.28 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -60,10 +60,10 @@
60 60
61#include <stdio.h> 61#include <stdio.h>
62 62
63#include <openssl/err.h>
64#include <openssl/x509.h> 63#include <openssl/x509.h>
65#include <openssl/x509v3.h> 64#include <openssl/x509v3.h>
66 65
66#include "err_local.h"
67#include "x509_local.h" 67#include "x509_local.h"
68 68
69static int pkcs7_copy_existing_digest(PKCS7 *p7, PKCS7_SIGNER_INFO *si); 69static int pkcs7_copy_existing_digest(PKCS7 *p7, PKCS7_SIGNER_INFO *si);
diff --git a/src/lib/libcrypto/pkcs7/pkcs7.h b/src/lib/libcrypto/pkcs7/pkcs7.h
index 6fd5adf457..6f0ccc0dc8 100644
--- a/src/lib/libcrypto/pkcs7/pkcs7.h
+++ b/src/lib/libcrypto/pkcs7/pkcs7.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: pkcs7.h,v 1.22 2024/10/23 01:57:19 jsg Exp $ */ 1/* $OpenBSD: pkcs7.h,v 1.24 2025/07/02 10:24:17 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -82,7 +82,7 @@ typedef struct pkcs7_issuer_and_serial_st {
82} PKCS7_ISSUER_AND_SERIAL; 82} PKCS7_ISSUER_AND_SERIAL;
83 83
84typedef struct pkcs7_signer_info_st { 84typedef struct pkcs7_signer_info_st {
85 ASN1_INTEGER *version; /* version 1 */ 85 ASN1_INTEGER *version; /* version 1 */
86 PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; 86 PKCS7_ISSUER_AND_SERIAL *issuer_and_serial;
87 X509_ALGOR *digest_alg; 87 X509_ALGOR *digest_alg;
88 STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */ 88 STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */
@@ -145,7 +145,7 @@ typedef struct pkcs7_signedandenveloped_st {
145typedef struct pkcs7_digest_st { 145typedef struct pkcs7_digest_st {
146 ASN1_INTEGER *version; /* version 0 */ 146 ASN1_INTEGER *version; /* version 0 */
147 X509_ALGOR *md; /* md used */ 147 X509_ALGOR *md; /* md used */
148 struct pkcs7_st *contents; 148 struct pkcs7_st *contents;
149 ASN1_OCTET_STRING *digest; 149 ASN1_OCTET_STRING *digest;
150} PKCS7_DIGEST; 150} PKCS7_DIGEST;
151 151
@@ -362,7 +362,7 @@ PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx);
362ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk); 362ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk);
363int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int type, 363int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int type,
364 void *data); 364 void *data);
365int PKCS7_add_attribute (PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, 365int PKCS7_add_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype,
366 void *value); 366 void *value);
367ASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid); 367ASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid);
368ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid); 368ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid);
diff --git a/src/lib/libcrypto/rc2/rc2_cbc.c b/src/lib/libcrypto/rc2/rc2.c
index 1d8e2def99..c122d4b810 100644
--- a/src/lib/libcrypto/rc2/rc2_cbc.c
+++ b/src/lib/libcrypto/rc2/rc2.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rc2_cbc.c,v 1.8 2023/07/07 13:40:44 beck Exp $ */ 1/* $OpenBSD: rc2.c,v 1.1 2025/05/25 05:29:54 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -57,86 +57,89 @@
57 */ 57 */
58 58
59#include <openssl/rc2.h> 59#include <openssl/rc2.h>
60
60#include "rc2_local.h" 61#include "rc2_local.h"
61 62
63static const unsigned char key_table[256]={
64 0xd9,0x78,0xf9,0xc4,0x19,0xdd,0xb5,0xed,0x28,0xe9,0xfd,0x79,
65 0x4a,0xa0,0xd8,0x9d,0xc6,0x7e,0x37,0x83,0x2b,0x76,0x53,0x8e,
66 0x62,0x4c,0x64,0x88,0x44,0x8b,0xfb,0xa2,0x17,0x9a,0x59,0xf5,
67 0x87,0xb3,0x4f,0x13,0x61,0x45,0x6d,0x8d,0x09,0x81,0x7d,0x32,
68 0xbd,0x8f,0x40,0xeb,0x86,0xb7,0x7b,0x0b,0xf0,0x95,0x21,0x22,
69 0x5c,0x6b,0x4e,0x82,0x54,0xd6,0x65,0x93,0xce,0x60,0xb2,0x1c,
70 0x73,0x56,0xc0,0x14,0xa7,0x8c,0xf1,0xdc,0x12,0x75,0xca,0x1f,
71 0x3b,0xbe,0xe4,0xd1,0x42,0x3d,0xd4,0x30,0xa3,0x3c,0xb6,0x26,
72 0x6f,0xbf,0x0e,0xda,0x46,0x69,0x07,0x57,0x27,0xf2,0x1d,0x9b,
73 0xbc,0x94,0x43,0x03,0xf8,0x11,0xc7,0xf6,0x90,0xef,0x3e,0xe7,
74 0x06,0xc3,0xd5,0x2f,0xc8,0x66,0x1e,0xd7,0x08,0xe8,0xea,0xde,
75 0x80,0x52,0xee,0xf7,0x84,0xaa,0x72,0xac,0x35,0x4d,0x6a,0x2a,
76 0x96,0x1a,0xd2,0x71,0x5a,0x15,0x49,0x74,0x4b,0x9f,0xd0,0x5e,
77 0x04,0x18,0xa4,0xec,0xc2,0xe0,0x41,0x6e,0x0f,0x51,0xcb,0xcc,
78 0x24,0x91,0xaf,0x50,0xa1,0xf4,0x70,0x39,0x99,0x7c,0x3a,0x85,
79 0x23,0xb8,0xb4,0x7a,0xfc,0x02,0x36,0x5b,0x25,0x55,0x97,0x31,
80 0x2d,0x5d,0xfa,0x98,0xe3,0x8a,0x92,0xae,0x05,0xdf,0x29,0x10,
81 0x67,0x6c,0xba,0xc9,0xd3,0x00,0xe6,0xcf,0xe1,0x9e,0xa8,0x2c,
82 0x63,0x16,0x01,0x3f,0x58,0xe2,0x89,0xa9,0x0d,0x38,0x34,0x1b,
83 0xab,0x33,0xff,0xb0,0xbb,0x48,0x0c,0x5f,0xb9,0xb1,0xcd,0x2e,
84 0xc5,0xf3,0xdb,0x47,0xe5,0xa5,0x9c,0x77,0x0a,0xa6,0x20,0x68,
85 0xfe,0x7f,0xc1,0xad,
86 };
87
88/* It has come to my attention that there are 2 versions of the RC2
89 * key schedule. One which is normal, and anther which has a hook to
90 * use a reduced key length.
91 * BSAFE uses the 'retarded' version. What I previously shipped is
92 * the same as specifying 1024 for the 'bits' parameter. Bsafe uses
93 * a version where the bits parameter is the same as len*8 */
62void 94void
63RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, 95RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits)
64 RC2_KEY *ks, unsigned char *iv, int encrypt)
65{ 96{
66 unsigned long tin0, tin1; 97 int i, j;
67 unsigned long tout0, tout1, xor0, xor1; 98 unsigned char *k;
68 long l = length; 99 RC2_INT *ki;
69 unsigned long tin[2]; 100 unsigned int c, d;
70 101
71 if (encrypt) { 102 k = (unsigned char *)&(key->data[0]);
72 c2l(iv, tout0); 103 *k = 0; /* for if there is a zero length key */
73 c2l(iv, tout1); 104
74 iv -= 8; 105 if (len > 128)
75 for (l -= 8; l >= 0; l -= 8) 106 len = 128;
76 { 107 if (bits <= 0)
77 c2l(in, tin0); 108 bits = 1024;
78 c2l(in, tin1); 109 if (bits > 1024)
79 tin0 ^= tout0; 110 bits = 1024;
80 tin1 ^= tout1; 111
81 tin[0] = tin0; 112 for (i = 0; i < len; i++)
82 tin[1] = tin1; 113 k[i] = data[i];
83 RC2_encrypt(tin, ks); 114
84 tout0 = tin[0]; 115 /* expand table */
85 l2c(tout0, out); 116 d = k[len - 1];
86 tout1 = tin[1]; 117 j = 0;
87 l2c(tout1, out); 118 for (i = len; i < 128; i++, j++)
88 } 119 {
89 if (l != -8) { 120 d = key_table[(k[j] + d) & 0xff];
90 c2ln(in, tin0, tin1, l + 8); 121 k[i] = d;
91 tin0 ^= tout0;
92 tin1 ^= tout1;
93 tin[0] = tin0;
94 tin[1] = tin1;
95 RC2_encrypt(tin, ks);
96 tout0 = tin[0];
97 l2c(tout0, out);
98 tout1 = tin[1];
99 l2c(tout1, out);
100 }
101 l2c(tout0, iv);
102 l2c(tout1, iv);
103 } else {
104 c2l(iv, xor0);
105 c2l(iv, xor1);
106 iv -= 8;
107 for (l -= 8; l >= 0; l -= 8)
108 {
109 c2l(in, tin0);
110 tin[0] = tin0;
111 c2l(in, tin1);
112 tin[1] = tin1;
113 RC2_decrypt(tin, ks);
114 tout0 = tin[0] ^ xor0;
115 tout1 = tin[1] ^ xor1;
116 l2c(tout0, out);
117 l2c(tout1, out);
118 xor0 = tin0;
119 xor1 = tin1;
120 }
121 if (l != -8) {
122 c2l(in, tin0);
123 tin[0] = tin0;
124 c2l(in, tin1);
125 tin[1] = tin1;
126 RC2_decrypt(tin, ks);
127 tout0 = tin[0] ^ xor0;
128 tout1 = tin[1] ^ xor1;
129 l2cn(tout0, tout1, out, l + 8);
130 xor0 = tin0;
131 xor1 = tin1;
132 }
133 l2c(xor0, iv);
134 l2c(xor1, iv);
135 } 122 }
136 tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0; 123
137 tin[0] = tin[1] = 0; 124 /* hmm.... key reduction to 'bits' bits */
125
126 j = (bits + 7) >> 3;
127 i = 128 - j;
128 c = (0xff >> (-bits & 0x07));
129
130 d = key_table[k[i] & c];
131 k[i] = d;
132 while (i--) {
133 d = key_table[k[i + j] ^ d];
134 k[i] = d;
135 }
136
137 /* copy from bytes into RC2_INT's */
138 ki = &(key->data[63]);
139 for (i = 127; i >= 0; i -= 2)
140 *(ki--) = ((k[i] << 8)|k[i - 1]) & 0xffff;
138} 141}
139LCRYPTO_ALIAS(RC2_cbc_encrypt); 142LCRYPTO_ALIAS(RC2_set_key);
140 143
141void 144void
142RC2_encrypt(unsigned long *d, RC2_KEY *key) 145RC2_encrypt(unsigned long *d, RC2_KEY *key)
@@ -234,3 +237,225 @@ RC2_decrypt(unsigned long *d, RC2_KEY *key)
234 16L); 237 16L);
235} 238}
236LCRYPTO_ALIAS(RC2_decrypt); 239LCRYPTO_ALIAS(RC2_decrypt);
240
241void
242RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
243 RC2_KEY *ks, unsigned char *iv, int encrypt)
244{
245 unsigned long tin0, tin1;
246 unsigned long tout0, tout1, xor0, xor1;
247 long l = length;
248 unsigned long tin[2];
249
250 if (encrypt) {
251 c2l(iv, tout0);
252 c2l(iv, tout1);
253 iv -= 8;
254 for (l -= 8; l >= 0; l -= 8)
255 {
256 c2l(in, tin0);
257 c2l(in, tin1);
258 tin0 ^= tout0;
259 tin1 ^= tout1;
260 tin[0] = tin0;
261 tin[1] = tin1;
262 RC2_encrypt(tin, ks);
263 tout0 = tin[0];
264 l2c(tout0, out);
265 tout1 = tin[1];
266 l2c(tout1, out);
267 }
268 if (l != -8) {
269 c2ln(in, tin0, tin1, l + 8);
270 tin0 ^= tout0;
271 tin1 ^= tout1;
272 tin[0] = tin0;
273 tin[1] = tin1;
274 RC2_encrypt(tin, ks);
275 tout0 = tin[0];
276 l2c(tout0, out);
277 tout1 = tin[1];
278 l2c(tout1, out);
279 }
280 l2c(tout0, iv);
281 l2c(tout1, iv);
282 } else {
283 c2l(iv, xor0);
284 c2l(iv, xor1);
285 iv -= 8;
286 for (l -= 8; l >= 0; l -= 8)
287 {
288 c2l(in, tin0);
289 tin[0] = tin0;
290 c2l(in, tin1);
291 tin[1] = tin1;
292 RC2_decrypt(tin, ks);
293 tout0 = tin[0] ^ xor0;
294 tout1 = tin[1] ^ xor1;
295 l2c(tout0, out);
296 l2c(tout1, out);
297 xor0 = tin0;
298 xor1 = tin1;
299 }
300 if (l != -8) {
301 c2l(in, tin0);
302 tin[0] = tin0;
303 c2l(in, tin1);
304 tin[1] = tin1;
305 RC2_decrypt(tin, ks);
306 tout0 = tin[0] ^ xor0;
307 tout1 = tin[1] ^ xor1;
308 l2cn(tout0, tout1, out, l + 8);
309 xor0 = tin0;
310 xor1 = tin1;
311 }
312 l2c(xor0, iv);
313 l2c(xor1, iv);
314 }
315 tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0;
316 tin[0] = tin[1] = 0;
317}
318LCRYPTO_ALIAS(RC2_cbc_encrypt);
319
320/* The input and output encrypted as though 64bit cfb mode is being
321 * used. The extra state information to record how much of the
322 * 64bit block we have used is contained in *num;
323 */
324void
325RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out,
326 long length, RC2_KEY *schedule, unsigned char *ivec,
327 int *num, int encrypt)
328{
329 unsigned long v0, v1, t;
330 int n = *num;
331 long l = length;
332 unsigned long ti[2];
333 unsigned char *iv, c, cc;
334
335 iv = (unsigned char *)ivec;
336 if (encrypt) {
337 while (l--) {
338 if (n == 0) {
339 c2l(iv, v0);
340 ti[0] = v0;
341 c2l(iv, v1);
342 ti[1] = v1;
343 RC2_encrypt((unsigned long *)ti, schedule);
344 iv = (unsigned char *)ivec;
345 t = ti[0];
346 l2c(t, iv);
347 t = ti[1];
348 l2c(t, iv);
349 iv = (unsigned char *)ivec;
350 }
351 c = *(in++) ^ iv[n];
352 *(out++) = c;
353 iv[n] = c;
354 n = (n + 1) & 0x07;
355 }
356 } else {
357 while (l--) {
358 if (n == 0) {
359 c2l(iv, v0);
360 ti[0] = v0;
361 c2l(iv, v1);
362 ti[1] = v1;
363 RC2_encrypt((unsigned long *)ti, schedule);
364 iv = (unsigned char *)ivec;
365 t = ti[0];
366 l2c(t, iv);
367 t = ti[1];
368 l2c(t, iv);
369 iv = (unsigned char *)ivec;
370 }
371 cc = *(in++);
372 c = iv[n];
373 iv[n] = cc;
374 *(out++) = c ^ cc;
375 n = (n + 1) & 0x07;
376 }
377 }
378 v0 = v1 = ti[0] = ti[1] = t = c = cc = 0;
379 *num = n;
380}
381LCRYPTO_ALIAS(RC2_cfb64_encrypt);
382
383/* RC2 as implemented frm a posting from
384 * Newsgroups: sci.crypt
385 * Sender: pgut01@cs.auckland.ac.nz (Peter Gutmann)
386 * Subject: Specification for Ron Rivests Cipher No.2
387 * Message-ID: <4fk39f$f70@net.auckland.ac.nz>
388 * Date: 11 Feb 1996 06:45:03 GMT
389 */
390void
391RC2_ecb_encrypt(const unsigned char *in, unsigned char *out, RC2_KEY *ks,
392 int encrypt)
393{
394 unsigned long l, d[2];
395
396 c2l(in, l);
397 d[0] = l;
398 c2l(in, l);
399 d[1] = l;
400 if (encrypt)
401 RC2_encrypt(d, ks);
402 else
403 RC2_decrypt(d, ks);
404 l = d[0];
405 l2c(l, out);
406 l = d[1];
407 l2c(l, out);
408 l = d[0] = d[1] = 0;
409}
410LCRYPTO_ALIAS(RC2_ecb_encrypt);
411
412/* The input and output encrypted as though 64bit ofb mode is being
413 * used. The extra state information to record how much of the
414 * 64bit block we have used is contained in *num;
415 */
416void
417RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out,
418 long length, RC2_KEY *schedule, unsigned char *ivec,
419 int *num)
420{
421 unsigned long v0, v1, t;
422 int n = *num;
423 long l = length;
424 unsigned char d[8];
425 char *dp;
426 unsigned long ti[2];
427 unsigned char *iv;
428 int save = 0;
429
430 iv = (unsigned char *)ivec;
431 c2l(iv, v0);
432 c2l(iv, v1);
433 ti[0] = v0;
434 ti[1] = v1;
435 dp = (char *)d;
436 l2c(v0, dp);
437 l2c(v1, dp);
438 while (l--) {
439 if (n == 0) {
440 RC2_encrypt((unsigned long *)ti, schedule);
441 dp = (char *)d;
442 t = ti[0];
443 l2c(t, dp);
444 t = ti[1];
445 l2c(t, dp);
446 save++;
447 }
448 *(out++) = *(in++) ^ d[n];
449 n = (n + 1) & 0x07;
450 }
451 if (save) {
452 v0 = ti[0];
453 v1 = ti[1];
454 iv = (unsigned char *)ivec;
455 l2c(v0, iv);
456 l2c(v1, iv);
457 }
458 t = v0 = v1 = ti[0] = ti[1] = 0;
459 *num = n;
460}
461LCRYPTO_ALIAS(RC2_ofb64_encrypt);
diff --git a/src/lib/libcrypto/rc2/rc2.h b/src/lib/libcrypto/rc2/rc2.h
index 96e395f32d..ead308cf51 100644
--- a/src/lib/libcrypto/rc2/rc2.h
+++ b/src/lib/libcrypto/rc2/rc2.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: rc2.h,v 1.13 2025/01/25 17:59:44 tb Exp $ */ 1/* $OpenBSD: rc2.h,v 1.14 2025/06/09 14:37:49 tb Exp $ */
2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -59,7 +59,12 @@
59#ifndef HEADER_RC2_H 59#ifndef HEADER_RC2_H
60#define HEADER_RC2_H 60#define HEADER_RC2_H
61 61
62#include <openssl/opensslconf.h> /* OPENSSL_NO_RC2, RC2_INT */ 62#include <openssl/opensslconf.h> /* OPENSSL_NO_RC2 */
63
64#ifndef RC2_INT
65/* XXX - typedef */
66#define RC2_INT unsigned int
67#endif
63 68
64#define RC2_ENCRYPT 1 69#define RC2_ENCRYPT 1
65#define RC2_DECRYPT 0 70#define RC2_DECRYPT 0
diff --git a/src/lib/libcrypto/rc2/rc2_ecb.c b/src/lib/libcrypto/rc2/rc2_ecb.c
deleted file mode 100644
index 6a3c8098eb..0000000000
--- a/src/lib/libcrypto/rc2/rc2_ecb.c
+++ /dev/null
@@ -1,91 +0,0 @@
1/* $OpenBSD: rc2_ecb.c,v 1.9 2023/07/07 13:40:44 beck Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <openssl/rc2.h>
60#include "rc2_local.h"
61#include <openssl/opensslv.h>
62
63/* RC2 as implemented frm a posting from
64 * Newsgroups: sci.crypt
65 * Sender: pgut01@cs.auckland.ac.nz (Peter Gutmann)
66 * Subject: Specification for Ron Rivests Cipher No.2
67 * Message-ID: <4fk39f$f70@net.auckland.ac.nz>
68 * Date: 11 Feb 1996 06:45:03 GMT
69 */
70
71void
72RC2_ecb_encrypt(const unsigned char *in, unsigned char *out, RC2_KEY *ks,
73 int encrypt)
74{
75 unsigned long l, d[2];
76
77 c2l(in, l);
78 d[0] = l;
79 c2l(in, l);
80 d[1] = l;
81 if (encrypt)
82 RC2_encrypt(d, ks);
83 else
84 RC2_decrypt(d, ks);
85 l = d[0];
86 l2c(l, out);
87 l = d[1];
88 l2c(l, out);
89 l = d[0] = d[1] = 0;
90}
91LCRYPTO_ALIAS(RC2_ecb_encrypt);
diff --git a/src/lib/libcrypto/rc2/rc2_skey.c b/src/lib/libcrypto/rc2/rc2_skey.c
deleted file mode 100644
index d33c02da8c..0000000000
--- a/src/lib/libcrypto/rc2/rc2_skey.c
+++ /dev/null
@@ -1,142 +0,0 @@
1/* $OpenBSD: rc2_skey.c,v 1.15 2023/07/07 13:40:44 beck Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <openssl/crypto.h>
60#include <openssl/rc2.h>
61#include "rc2_local.h"
62
63static const unsigned char key_table[256]={
64 0xd9,0x78,0xf9,0xc4,0x19,0xdd,0xb5,0xed,0x28,0xe9,0xfd,0x79,
65 0x4a,0xa0,0xd8,0x9d,0xc6,0x7e,0x37,0x83,0x2b,0x76,0x53,0x8e,
66 0x62,0x4c,0x64,0x88,0x44,0x8b,0xfb,0xa2,0x17,0x9a,0x59,0xf5,
67 0x87,0xb3,0x4f,0x13,0x61,0x45,0x6d,0x8d,0x09,0x81,0x7d,0x32,
68 0xbd,0x8f,0x40,0xeb,0x86,0xb7,0x7b,0x0b,0xf0,0x95,0x21,0x22,
69 0x5c,0x6b,0x4e,0x82,0x54,0xd6,0x65,0x93,0xce,0x60,0xb2,0x1c,
70 0x73,0x56,0xc0,0x14,0xa7,0x8c,0xf1,0xdc,0x12,0x75,0xca,0x1f,
71 0x3b,0xbe,0xe4,0xd1,0x42,0x3d,0xd4,0x30,0xa3,0x3c,0xb6,0x26,
72 0x6f,0xbf,0x0e,0xda,0x46,0x69,0x07,0x57,0x27,0xf2,0x1d,0x9b,
73 0xbc,0x94,0x43,0x03,0xf8,0x11,0xc7,0xf6,0x90,0xef,0x3e,0xe7,
74 0x06,0xc3,0xd5,0x2f,0xc8,0x66,0x1e,0xd7,0x08,0xe8,0xea,0xde,
75 0x80,0x52,0xee,0xf7,0x84,0xaa,0x72,0xac,0x35,0x4d,0x6a,0x2a,
76 0x96,0x1a,0xd2,0x71,0x5a,0x15,0x49,0x74,0x4b,0x9f,0xd0,0x5e,
77 0x04,0x18,0xa4,0xec,0xc2,0xe0,0x41,0x6e,0x0f,0x51,0xcb,0xcc,
78 0x24,0x91,0xaf,0x50,0xa1,0xf4,0x70,0x39,0x99,0x7c,0x3a,0x85,
79 0x23,0xb8,0xb4,0x7a,0xfc,0x02,0x36,0x5b,0x25,0x55,0x97,0x31,
80 0x2d,0x5d,0xfa,0x98,0xe3,0x8a,0x92,0xae,0x05,0xdf,0x29,0x10,
81 0x67,0x6c,0xba,0xc9,0xd3,0x00,0xe6,0xcf,0xe1,0x9e,0xa8,0x2c,
82 0x63,0x16,0x01,0x3f,0x58,0xe2,0x89,0xa9,0x0d,0x38,0x34,0x1b,
83 0xab,0x33,0xff,0xb0,0xbb,0x48,0x0c,0x5f,0xb9,0xb1,0xcd,0x2e,
84 0xc5,0xf3,0xdb,0x47,0xe5,0xa5,0x9c,0x77,0x0a,0xa6,0x20,0x68,
85 0xfe,0x7f,0xc1,0xad,
86 };
87
88/* It has come to my attention that there are 2 versions of the RC2
89 * key schedule. One which is normal, and anther which has a hook to
90 * use a reduced key length.
91 * BSAFE uses the 'retarded' version. What I previously shipped is
92 * the same as specifying 1024 for the 'bits' parameter. Bsafe uses
93 * a version where the bits parameter is the same as len*8 */
94void
95RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits)
96{
97 int i, j;
98 unsigned char *k;
99 RC2_INT *ki;
100 unsigned int c, d;
101
102 k = (unsigned char *)&(key->data[0]);
103 *k = 0; /* for if there is a zero length key */
104
105 if (len > 128)
106 len = 128;
107 if (bits <= 0)
108 bits = 1024;
109 if (bits > 1024)
110 bits = 1024;
111
112 for (i = 0; i < len; i++)
113 k[i] = data[i];
114
115 /* expand table */
116 d = k[len - 1];
117 j = 0;
118 for (i = len; i < 128; i++, j++)
119 {
120 d = key_table[(k[j] + d) & 0xff];
121 k[i] = d;
122 }
123
124 /* hmm.... key reduction to 'bits' bits */
125
126 j = (bits + 7) >> 3;
127 i = 128 - j;
128 c = (0xff >> (-bits & 0x07));
129
130 d = key_table[k[i] & c];
131 k[i] = d;
132 while (i--) {
133 d = key_table[k[i + j] ^ d];
134 k[i] = d;
135 }
136
137 /* copy from bytes into RC2_INT's */
138 ki = &(key->data[63]);
139 for (i = 127; i >= 0; i -= 2)
140 *(ki--) = ((k[i] << 8)|k[i - 1]) & 0xffff;
141}
142LCRYPTO_ALIAS(RC2_set_key);
diff --git a/src/lib/libcrypto/rc2/rc2cfb64.c b/src/lib/libcrypto/rc2/rc2cfb64.c
deleted file mode 100644
index 21266c430b..0000000000
--- a/src/lib/libcrypto/rc2/rc2cfb64.c
+++ /dev/null
@@ -1,124 +0,0 @@
1/* $OpenBSD: rc2cfb64.c,v 1.8 2023/07/07 13:40:44 beck Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <openssl/rc2.h>
60#include "rc2_local.h"
61
62/* The input and output encrypted as though 64bit cfb mode is being
63 * used. The extra state information to record how much of the
64 * 64bit block we have used is contained in *num;
65 */
66
67void
68RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out,
69 long length, RC2_KEY *schedule, unsigned char *ivec,
70 int *num, int encrypt)
71{
72 unsigned long v0, v1, t;
73 int n = *num;
74 long l = length;
75 unsigned long ti[2];
76 unsigned char *iv, c, cc;
77
78 iv = (unsigned char *)ivec;
79 if (encrypt) {
80 while (l--) {
81 if (n == 0) {
82 c2l(iv, v0);
83 ti[0] = v0;
84 c2l(iv, v1);
85 ti[1] = v1;
86 RC2_encrypt((unsigned long *)ti, schedule);
87 iv = (unsigned char *)ivec;
88 t = ti[0];
89 l2c(t, iv);
90 t = ti[1];
91 l2c(t, iv);
92 iv = (unsigned char *)ivec;
93 }
94 c = *(in++) ^ iv[n];
95 *(out++) = c;
96 iv[n] = c;
97 n = (n + 1) & 0x07;
98 }
99 } else {
100 while (l--) {
101 if (n == 0) {
102 c2l(iv, v0);
103 ti[0] = v0;
104 c2l(iv, v1);
105 ti[1] = v1;
106 RC2_encrypt((unsigned long *)ti, schedule);
107 iv = (unsigned char *)ivec;
108 t = ti[0];
109 l2c(t, iv);
110 t = ti[1];
111 l2c(t, iv);
112 iv = (unsigned char *)ivec;
113 }
114 cc = *(in++);
115 c = iv[n];
116 iv[n] = cc;
117 *(out++) = c ^ cc;
118 n = (n + 1) & 0x07;
119 }
120 }
121 v0 = v1 = ti[0] = ti[1] = t = c = cc = 0;
122 *num = n;
123}
124LCRYPTO_ALIAS(RC2_cfb64_encrypt);
diff --git a/src/lib/libcrypto/rc2/rc2ofb64.c b/src/lib/libcrypto/rc2/rc2ofb64.c
deleted file mode 100644
index 73d8323e92..0000000000
--- a/src/lib/libcrypto/rc2/rc2ofb64.c
+++ /dev/null
@@ -1,111 +0,0 @@
1/* $OpenBSD: rc2ofb64.c,v 1.8 2023/07/07 13:40:44 beck Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <openssl/rc2.h>
60#include "rc2_local.h"
61
62/* The input and output encrypted as though 64bit ofb mode is being
63 * used. The extra state information to record how much of the
64 * 64bit block we have used is contained in *num;
65 */
66void
67RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out,
68 long length, RC2_KEY *schedule, unsigned char *ivec,
69 int *num)
70{
71 unsigned long v0, v1, t;
72 int n = *num;
73 long l = length;
74 unsigned char d[8];
75 char *dp;
76 unsigned long ti[2];
77 unsigned char *iv;
78 int save = 0;
79
80 iv = (unsigned char *)ivec;
81 c2l(iv, v0);
82 c2l(iv, v1);
83 ti[0] = v0;
84 ti[1] = v1;
85 dp = (char *)d;
86 l2c(v0, dp);
87 l2c(v1, dp);
88 while (l--) {
89 if (n == 0) {
90 RC2_encrypt((unsigned long *)ti, schedule);
91 dp = (char *)d;
92 t = ti[0];
93 l2c(t, dp);
94 t = ti[1];
95 l2c(t, dp);
96 save++;
97 }
98 *(out++) = *(in++) ^ d[n];
99 n = (n + 1) & 0x07;
100 }
101 if (save) {
102 v0 = ti[0];
103 v1 = ti[1];
104 iv = (unsigned char *)ivec;
105 l2c(v0, iv);
106 l2c(v1, iv);
107 }
108 t = v0 = v1 = ti[0] = ti[1] = 0;
109 *num = n;
110}
111LCRYPTO_ALIAS(RC2_ofb64_encrypt);
diff --git a/src/lib/libcrypto/rc2/rrc2.doc b/src/lib/libcrypto/rc2/rrc2.doc
deleted file mode 100644
index f93ee003d2..0000000000
--- a/src/lib/libcrypto/rc2/rrc2.doc
+++ /dev/null
@@ -1,219 +0,0 @@
1>From cygnus.mincom.oz.au!minbne.mincom.oz.au!bunyip.cc.uq.oz.au!munnari.OZ.AU!comp.vuw.ac.nz!waikato!auckland.ac.nz!news Mon Feb 12 18:48:17 EST 1996
2Article 23601 of sci.crypt:
3Path: cygnus.mincom.oz.au!minbne.mincom.oz.au!bunyip.cc.uq.oz.au!munnari.OZ.AU!comp.vuw.ac.nz!waikato!auckland.ac.nz!news
4>From: pgut01@cs.auckland.ac.nz (Peter Gutmann)
5Newsgroups: sci.crypt
6Subject: Specification for Ron Rivests Cipher No.2
7Date: 11 Feb 1996 06:45:03 GMT
8Organization: University of Auckland
9Lines: 203
10Sender: pgut01@cs.auckland.ac.nz (Peter Gutmann)
11Message-ID: <4fk39f$f70@net.auckland.ac.nz>
12NNTP-Posting-Host: cs26.cs.auckland.ac.nz
13X-Newsreader: NN version 6.5.0 #3 (NOV)
14
15
16
17
18 Ron Rivest's Cipher No.2
19 ------------------------
20
21Ron Rivest's Cipher No.2 (hereafter referred to as RRC.2, other people may
22refer to it by other names) is word oriented, operating on a block of 64 bits
23divided into four 16-bit words, with a key table of 64 words. All data units
24are little-endian. This functional description of the algorithm is based in
25the paper "The RC5 Encryption Algorithm" (RC5 is a trademark of RSADSI), using
26the same general layout, terminology, and pseudocode style.
27
28
29Notation and RRC.2 Primitive Operations
30
31RRC.2 uses the following primitive operations:
32
331. Two's-complement addition of words, denoted by "+". The inverse operation,
34 subtraction, is denoted by "-".
352. Bitwise exclusive OR, denoted by "^".
363. Bitwise AND, denoted by "&".
374. Bitwise NOT, denoted by "~".
385. A left-rotation of words; the rotation of word x left by y is denoted
39 x <<< y. The inverse operation, right-rotation, is denoted x >>> y.
40
41These operations are directly and efficiently supported by most processors.
42
43
44The RRC.2 Algorithm
45
46RRC.2 consists of three components, a *key expansion* algorithm, an
47*encryption* algorithm, and a *decryption* algorithm.
48
49
50Key Expansion
51
52The purpose of the key-expansion routine is to expand the user's key K to fill
53the expanded key array S, so S resembles an array of random binary words
54determined by the user's secret key K.
55
56Initialising the S-box
57
58RRC.2 uses a single 256-byte S-box derived from the ciphertext contents of
59Beale Cipher No.1 XOR'd with a one-time pad. The Beale Ciphers predate modern
60cryptography by enough time that there should be no concerns about trapdoors
61hidden in the data. They have been published widely, and the S-box can be
62easily recreated from the one-time pad values and the Beale Cipher data taken
63from a standard source. To initialise the S-box:
64
65 for i = 0 to 255 do
66 sBox[ i ] = ( beale[ i ] mod 256 ) ^ pad[ i ]
67
68The contents of Beale Cipher No.1 and the necessary one-time pad are given as
69an appendix at the end of this document. For efficiency, implementors may wish
70to skip the Beale Cipher expansion and store the sBox table directly.
71
72Expanding the Secret Key to 128 Bytes
73
74The secret key is first expanded to fill 128 bytes (64 words). The expansion
75consists of taking the sum of the first and last bytes in the user key, looking
76up the sum (modulo 256) in the S-box, and appending the result to the key. The
77operation is repeated with the second byte and new last byte of the key until
78all 128 bytes have been generated. Note that the following pseudocode treats
79the S array as an array of 128 bytes rather than 64 words.
80
81 for j = 0 to length-1 do
82 S[ j ] = K[ j ]
83 for j = length to 127 do
84 s[ j ] = sBox[ ( S[ j-length ] + S[ j-1 ] ) mod 256 ];
85
86At this point it is possible to perform a truncation of the effective key
87length to ease the creation of espionage-enabled software products. However
88since the author cannot conceive why anyone would want to do this, it will not
89be considered further.
90
91The final phase of the key expansion involves replacing the first byte of S
92with the entry selected from the S-box:
93
94 S[ 0 ] = sBox[ S[ 0 ] ]
95
96
97Encryption
98
99The cipher has 16 full rounds, each divided into 4 subrounds. Two of the full
100rounds perform an additional transformation on the data. Note that the
101following pseudocode treats the S array as an array of 64 words rather than 128
102bytes.
103
104 for i = 0 to 15 do
105 j = i * 4;
106 word0 = ( word0 + ( word1 & ~word3 ) + ( word2 & word3 ) + S[ j+0 ] ) <<< 1
107 word1 = ( word1 + ( word2 & ~word0 ) + ( word3 & word0 ) + S[ j+1 ] ) <<< 2
108 word2 = ( word2 + ( word3 & ~word1 ) + ( word0 & word1 ) + S[ j+2 ] ) <<< 3
109 word3 = ( word3 + ( word0 & ~word2 ) + ( word1 & word2 ) + S[ j+3 ] ) <<< 5
110
111In addition the fifth and eleventh rounds add the contents of the S-box indexed
112by one of the data words to another of the data words following the four
113subrounds as follows:
114
115 word0 = word0 + S[ word3 & 63 ];
116 word1 = word1 + S[ word0 & 63 ];
117 word2 = word2 + S[ word1 & 63 ];
118 word3 = word3 + S[ word2 & 63 ];
119
120
121Decryption
122
123The decryption operation is simply the inverse of the encryption operation.
124Note that the following pseudocode treats the S array as an array of 64 words
125rather than 128 bytes.
126
127 for i = 15 downto 0 do
128 j = i * 4;
129 word3 = ( word3 >>> 5 ) - ( word0 & ~word2 ) - ( word1 & word2 ) - S[ j+3 ]
130 word2 = ( word2 >>> 3 ) - ( word3 & ~word1 ) - ( word0 & word1 ) - S[ j+2 ]
131 word1 = ( word1 >>> 2 ) - ( word2 & ~word0 ) - ( word3 & word0 ) - S[ j+1 ]
132 word0 = ( word0 >>> 1 ) - ( word1 & ~word3 ) - ( word2 & word3 ) - S[ j+0 ]
133
134In addition the fifth and eleventh rounds subtract the contents of the S-box
135indexed by one of the data words from another one of the data words following
136the four subrounds as follows:
137
138 word3 = word3 - S[ word2 & 63 ]
139 word2 = word2 - S[ word1 & 63 ]
140 word1 = word1 - S[ word0 & 63 ]
141 word0 = word0 - S[ word3 & 63 ]
142
143
144Test Vectors
145
146The following test vectors may be used to test the correctness of an RRC.2
147implementation:
148
149 Key: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
150 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
151 Plain: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
152 Cipher: 0x1C, 0x19, 0x8A, 0x83, 0x8D, 0xF0, 0x28, 0xB7
153
154 Key: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
155 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01
156 Plain: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
157 Cipher: 0x21, 0x82, 0x9C, 0x78, 0xA9, 0xF9, 0xC0, 0x74
158
159 Key: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
160 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
161 Plain: 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
162 Cipher: 0x13, 0xDB, 0x35, 0x17, 0xD3, 0x21, 0x86, 0x9E
163
164 Key: 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
165 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
166 Plain: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
167 Cipher: 0x50, 0xDC, 0x01, 0x62, 0xBD, 0x75, 0x7F, 0x31
168
169
170Appendix: Beale Cipher No.1, "The Locality of the Vault", and One-time Pad for
171 Creating the S-Box
172
173Beale Cipher No.1.
174
175 71, 194, 38,1701, 89, 76, 11, 83,1629, 48, 94, 63, 132, 16, 111, 95,
176 84, 341, 975, 14, 40, 64, 27, 81, 139, 213, 63, 90,1120, 8, 15, 3,
177 126,2018, 40, 74, 758, 485, 604, 230, 436, 664, 582, 150, 251, 284, 308, 231,
178 124, 211, 486, 225, 401, 370, 11, 101, 305, 139, 189, 17, 33, 88, 208, 193,
179 145, 1, 94, 73, 416, 918, 263, 28, 500, 538, 356, 117, 136, 219, 27, 176,
180 130, 10, 460, 25, 485, 18, 436, 65, 84, 200, 283, 118, 320, 138, 36, 416,
181 280, 15, 71, 224, 961, 44, 16, 401, 39, 88, 61, 304, 12, 21, 24, 283,
182 134, 92, 63, 246, 486, 682, 7, 219, 184, 360, 780, 18, 64, 463, 474, 131,
183 160, 79, 73, 440, 95, 18, 64, 581, 34, 69, 128, 367, 460, 17, 81, 12,
184 103, 820, 62, 110, 97, 103, 862, 70, 60,1317, 471, 540, 208, 121, 890, 346,
185 36, 150, 59, 568, 614, 13, 120, 63, 219, 812,2160,1780, 99, 35, 18, 21,
186 136, 872, 15, 28, 170, 88, 4, 30, 44, 112, 18, 147, 436, 195, 320, 37,
187 122, 113, 6, 140, 8, 120, 305, 42, 58, 461, 44, 106, 301, 13, 408, 680,
188 93, 86, 116, 530, 82, 568, 9, 102, 38, 416, 89, 71, 216, 728, 965, 818,
189 2, 38, 121, 195, 14, 326, 148, 234, 18, 55, 131, 234, 361, 824, 5, 81,
190 623, 48, 961, 19, 26, 33, 10,1101, 365, 92, 88, 181, 275, 346, 201, 206
191
192One-time Pad.
193
194 158, 186, 223, 97, 64, 145, 190, 190, 117, 217, 163, 70, 206, 176, 183, 194,
195 146, 43, 248, 141, 3, 54, 72, 223, 233, 153, 91, 210, 36, 131, 244, 161,
196 105, 120, 113, 191, 113, 86, 19, 245, 213, 221, 43, 27, 242, 157, 73, 213,
197 193, 92, 166, 10, 23, 197, 112, 110, 193, 30, 156, 51, 125, 51, 158, 67,
198 197, 215, 59, 218, 110, 246, 181, 0, 135, 76, 164, 97, 47, 87, 234, 108,
199 144, 127, 6, 6, 222, 172, 80, 144, 22, 245, 207, 70, 227, 182, 146, 134,
200 119, 176, 73, 58, 135, 69, 23, 198, 0, 170, 32, 171, 176, 129, 91, 24,
201 126, 77, 248, 0, 118, 69, 57, 60, 190, 171, 217, 61, 136, 169, 196, 84,
202 168, 167, 163, 102, 223, 64, 174, 178, 166, 239, 242, 195, 249, 92, 59, 38,
203 241, 46, 236, 31, 59, 114, 23, 50, 119, 186, 7, 66, 212, 97, 222, 182,
204 230, 118, 122, 86, 105, 92, 179, 243, 255, 189, 223, 164, 194, 215, 98, 44,
205 17, 20, 53, 153, 137, 224, 176, 100, 208, 114, 36, 200, 145, 150, 215, 20,
206 87, 44, 252, 20, 235, 242, 163, 132, 63, 18, 5, 122, 74, 97, 34, 97,
207 142, 86, 146, 221, 179, 166, 161, 74, 69, 182, 88, 120, 128, 58, 76, 155,
208 15, 30, 77, 216, 165, 117, 107, 90, 169, 127, 143, 181, 208, 137, 200, 127,
209 170, 195, 26, 84, 255, 132, 150, 58, 103, 250, 120, 221, 237, 37, 8, 99
210
211
212Implementation
213
214A non-US based programmer who has never seen any encryption code before will
215shortly be implementing RRC.2 based solely on this specification and not on
216knowledge of any other encryption algorithms. Stand by.
217
218
219
diff --git a/src/lib/libcrypto/rc2/version b/src/lib/libcrypto/rc2/version
deleted file mode 100644
index 8ca161a613..0000000000
--- a/src/lib/libcrypto/rc2/version
+++ /dev/null
@@ -1,22 +0,0 @@
11.1 23/08/96 - eay
2 Changed RC2_set_key() so it now takes another argument. Many
3 thanks to Peter Gutmann <pgut01@cs.auckland.ac.nz> for the
4 clarification and original specification of RC2. BSAFE uses
5 this last parameter, 'bits'. It the key is 128 bits, BSAFE
6 also sets this parameter to 128. The old behaviour can be
7 duplicated by setting this parameter to 1024.
8
91.0 08/04/96 - eay
10 First version of SSLeay with rc2. This has been written from the spec
11 posted sci.crypt. It is in this directory under rrc2.doc
12 I have no test values for any mode other than ecb, my wrappers for the
13 other modes should be ok since they are basically the same as
14 the ones taken from idea and des :-). I have implemented them as
15 little-endian operators.
16 While rc2 is included because it is used with SSL, I don't know how
17 far I trust it. It is about the same speed as IDEA and DES.
18 So if you are paranoid, used Triple DES, else IDEA. If RC2
19 does get used more, perhaps more people will look for weaknesses in
20 it.
21
22
diff --git a/src/lib/libcrypto/rc4/rc4.h b/src/lib/libcrypto/rc4/rc4.h
index a20472372b..c994b39a31 100644
--- a/src/lib/libcrypto/rc4/rc4.h
+++ b/src/lib/libcrypto/rc4/rc4.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: rc4.h,v 1.16 2025/01/25 17:59:44 tb Exp $ */ 1/* $OpenBSD: rc4.h,v 1.17 2025/06/09 14:37:49 tb Exp $ */
2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -59,10 +59,15 @@
59#ifndef HEADER_RC4_H 59#ifndef HEADER_RC4_H
60#define HEADER_RC4_H 60#define HEADER_RC4_H
61 61
62#include <openssl/opensslconf.h> /* OPENSSL_NO_RC4, RC4_INT */ 62#include <openssl/opensslconf.h> /* OPENSSL_NO_RC4 */
63 63
64#include <stddef.h> 64#include <stddef.h>
65 65
66#ifndef RC4_INT
67/* XXX - typedef */
68#define RC4_INT unsigned int
69#endif
70
66#ifdef __cplusplus 71#ifdef __cplusplus
67extern "C" { 72extern "C" {
68#endif 73#endif
diff --git a/src/lib/libcrypto/rsa/rsa_ameth.c b/src/lib/libcrypto/rsa/rsa_ameth.c
index 5a87522289..00fa6afb3d 100644
--- a/src/lib/libcrypto/rsa/rsa_ameth.c
+++ b/src/lib/libcrypto/rsa/rsa_ameth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_ameth.c,v 1.62 2024/11/02 07:11:14 tb Exp $ */ 1/* $OpenBSD: rsa_ameth.c,v 1.63 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -66,7 +66,6 @@
66#include <openssl/bio.h> 66#include <openssl/bio.h>
67#include <openssl/bn.h> 67#include <openssl/bn.h>
68#include <openssl/cms.h> 68#include <openssl/cms.h>
69#include <openssl/err.h>
70#include <openssl/evp.h> 69#include <openssl/evp.h>
71#include <openssl/objects.h> 70#include <openssl/objects.h>
72#include <openssl/pkcs7.h> 71#include <openssl/pkcs7.h>
@@ -76,6 +75,7 @@
76 75
77#include "asn1_local.h" 76#include "asn1_local.h"
78#include "bn_local.h" 77#include "bn_local.h"
78#include "err_local.h"
79#include "evp_local.h" 79#include "evp_local.h"
80#include "rsa_local.h" 80#include "rsa_local.h"
81#include "x509_local.h" 81#include "x509_local.h"
diff --git a/src/lib/libcrypto/rsa/rsa_blinding.c b/src/lib/libcrypto/rsa/rsa_blinding.c
index cac5bd91d2..590b45f5a1 100644
--- a/src/lib/libcrypto/rsa/rsa_blinding.c
+++ b/src/lib/libcrypto/rsa/rsa_blinding.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_blinding.c,v 1.3 2023/08/09 12:09:06 tb Exp $ */ 1/* $OpenBSD: rsa_blinding.c,v 1.4 2025/05/10 05:54:38 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -114,10 +114,10 @@
114 114
115#include <openssl/opensslconf.h> 115#include <openssl/opensslconf.h>
116 116
117#include <openssl/err.h>
118#include <openssl/rsa.h> 117#include <openssl/rsa.h>
119 118
120#include "bn_local.h" 119#include "bn_local.h"
120#include "err_local.h"
121#include "rsa_local.h" 121#include "rsa_local.h"
122 122
123#define BN_BLINDING_COUNTER 32 123#define BN_BLINDING_COUNTER 32
diff --git a/src/lib/libcrypto/rsa/rsa_chk.c b/src/lib/libcrypto/rsa/rsa_chk.c
index b7666e0fed..87d261f88e 100644
--- a/src/lib/libcrypto/rsa/rsa_chk.c
+++ b/src/lib/libcrypto/rsa/rsa_chk.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_chk.c,v 1.18 2023/07/08 12:26:45 beck Exp $ */ 1/* $OpenBSD: rsa_chk.c,v 1.19 2025/05/10 05:54:38 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -49,10 +49,10 @@
49 */ 49 */
50 50
51#include <openssl/bn.h> 51#include <openssl/bn.h>
52#include <openssl/err.h>
53#include <openssl/rsa.h> 52#include <openssl/rsa.h>
54 53
55#include "bn_local.h" 54#include "bn_local.h"
55#include "err_local.h"
56#include "rsa_local.h" 56#include "rsa_local.h"
57 57
58int 58int
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c
index c2e1e22f9a..65ccfc35e1 100644
--- a/src/lib/libcrypto/rsa/rsa_eay.c
+++ b/src/lib/libcrypto/rsa/rsa_eay.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_eay.c,v 1.65 2023/08/09 12:09:06 tb Exp $ */ 1/* $OpenBSD: rsa_eay.c,v 1.66 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -115,10 +115,10 @@
115#include <openssl/opensslconf.h> 115#include <openssl/opensslconf.h>
116 116
117#include <openssl/bn.h> 117#include <openssl/bn.h>
118#include <openssl/err.h>
119#include <openssl/rsa.h> 118#include <openssl/rsa.h>
120 119
121#include "bn_local.h" 120#include "bn_local.h"
121#include "err_local.h"
122#include "rsa_local.h" 122#include "rsa_local.h"
123 123
124static int 124static int
diff --git a/src/lib/libcrypto/rsa/rsa_gen.c b/src/lib/libcrypto/rsa/rsa_gen.c
index ff64eb2f0e..ebd0aeffd5 100644
--- a/src/lib/libcrypto/rsa/rsa_gen.c
+++ b/src/lib/libcrypto/rsa/rsa_gen.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_gen.c,v 1.30 2023/07/08 12:26:45 beck Exp $ */ 1/* $OpenBSD: rsa_gen.c,v 1.31 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -60,10 +60,10 @@
60#include <time.h> 60#include <time.h>
61 61
62#include <openssl/bn.h> 62#include <openssl/bn.h>
63#include <openssl/err.h>
64#include <openssl/rsa.h> 63#include <openssl/rsa.h>
65 64
66#include "bn_local.h" 65#include "bn_local.h"
66#include "err_local.h"
67#include "rsa_local.h" 67#include "rsa_local.h"
68 68
69static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb); 69static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb);
diff --git a/src/lib/libcrypto/rsa/rsa_lib.c b/src/lib/libcrypto/rsa/rsa_lib.c
index 91f4938ec9..7b8babdf52 100644
--- a/src/lib/libcrypto/rsa/rsa_lib.c
+++ b/src/lib/libcrypto/rsa/rsa_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_lib.c,v 1.50 2024/03/27 01:22:30 tb Exp $ */ 1/* $OpenBSD: rsa_lib.c,v 1.51 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -62,12 +62,12 @@
62 62
63#include <openssl/bn.h> 63#include <openssl/bn.h>
64#include <openssl/crypto.h> 64#include <openssl/crypto.h>
65#include <openssl/err.h>
66#include <openssl/evp.h> 65#include <openssl/evp.h>
67#include <openssl/lhash.h> 66#include <openssl/lhash.h>
68#include <openssl/rsa.h> 67#include <openssl/rsa.h>
69 68
70#include "bn_local.h" 69#include "bn_local.h"
70#include "err_local.h"
71#include "evp_local.h" 71#include "evp_local.h"
72#include "rsa_local.h" 72#include "rsa_local.h"
73 73
diff --git a/src/lib/libcrypto/rsa/rsa_meth.c b/src/lib/libcrypto/rsa/rsa_meth.c
index 71608caa01..131c4484ab 100644
--- a/src/lib/libcrypto/rsa/rsa_meth.c
+++ b/src/lib/libcrypto/rsa/rsa_meth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_meth.c,v 1.7 2023/07/08 12:26:45 beck Exp $ */ 1/* $OpenBSD: rsa_meth.c,v 1.8 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> 3 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
4 * 4 *
@@ -18,7 +18,6 @@
18#include <stdlib.h> 18#include <stdlib.h>
19#include <string.h> 19#include <string.h>
20 20
21#include <openssl/err.h>
22#include <openssl/rsa.h> 21#include <openssl/rsa.h>
23 22
24#include "rsa_local.h" 23#include "rsa_local.h"
diff --git a/src/lib/libcrypto/rsa/rsa_none.c b/src/lib/libcrypto/rsa/rsa_none.c
index 9c53dcf595..b8764d54ef 100644
--- a/src/lib/libcrypto/rsa/rsa_none.c
+++ b/src/lib/libcrypto/rsa/rsa_none.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_none.c,v 1.12 2023/07/08 12:26:45 beck Exp $ */ 1/* $OpenBSD: rsa_none.c,v 1.13 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -60,9 +60,10 @@
60#include <string.h> 60#include <string.h>
61 61
62#include <openssl/bn.h> 62#include <openssl/bn.h>
63#include <openssl/err.h>
64#include <openssl/rsa.h> 63#include <openssl/rsa.h>
65 64
65#include "err_local.h"
66
66int 67int
67RSA_padding_add_none(unsigned char *to, int tlen, const unsigned char *from, 68RSA_padding_add_none(unsigned char *to, int tlen, const unsigned char *from,
68 int flen) 69 int flen)
diff --git a/src/lib/libcrypto/rsa/rsa_oaep.c b/src/lib/libcrypto/rsa/rsa_oaep.c
index d1e138c299..9a175f8c55 100644
--- a/src/lib/libcrypto/rsa/rsa_oaep.c
+++ b/src/lib/libcrypto/rsa/rsa_oaep.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_oaep.c,v 1.39 2024/03/26 05:37:28 joshua Exp $ */ 1/* $OpenBSD: rsa_oaep.c,v 1.40 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. 3 * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved.
4 * 4 *
@@ -74,12 +74,12 @@
74#include <string.h> 74#include <string.h>
75 75
76#include <openssl/bn.h> 76#include <openssl/bn.h>
77#include <openssl/err.h>
78#include <openssl/evp.h> 77#include <openssl/evp.h>
79#include <openssl/rsa.h> 78#include <openssl/rsa.h>
80#include <openssl/sha.h> 79#include <openssl/sha.h>
81 80
82#include "constant_time.h" 81#include "constant_time.h"
82#include "err_local.h"
83#include "evp_local.h" 83#include "evp_local.h"
84#include "rsa_local.h" 84#include "rsa_local.h"
85 85
diff --git a/src/lib/libcrypto/rsa/rsa_pk1.c b/src/lib/libcrypto/rsa/rsa_pk1.c
index 8e56a8c4cd..554e00e8f8 100644
--- a/src/lib/libcrypto/rsa/rsa_pk1.c
+++ b/src/lib/libcrypto/rsa/rsa_pk1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_pk1.c,v 1.17 2024/03/30 04:34:17 jsing Exp $ */ 1/* $OpenBSD: rsa_pk1.c,v 1.18 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -61,10 +61,10 @@
61#include <string.h> 61#include <string.h>
62 62
63#include <openssl/bn.h> 63#include <openssl/bn.h>
64#include <openssl/err.h>
65#include <openssl/rsa.h> 64#include <openssl/rsa.h>
66 65
67#include "bytestring.h" 66#include "bytestring.h"
67#include "err_local.h"
68 68
69int 69int
70RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, 70RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen,
diff --git a/src/lib/libcrypto/rsa/rsa_pmeth.c b/src/lib/libcrypto/rsa/rsa_pmeth.c
index 453570cf74..518b077dbc 100644
--- a/src/lib/libcrypto/rsa/rsa_pmeth.c
+++ b/src/lib/libcrypto/rsa/rsa_pmeth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_pmeth.c,v 1.43 2025/01/17 15:39:19 tb Exp $ */ 1/* $OpenBSD: rsa_pmeth.c,v 1.44 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -65,13 +65,13 @@
65 65
66#include <openssl/asn1t.h> 66#include <openssl/asn1t.h>
67#include <openssl/bn.h> 67#include <openssl/bn.h>
68#include <openssl/err.h>
69#include <openssl/evp.h> 68#include <openssl/evp.h>
70#include <openssl/rsa.h> 69#include <openssl/rsa.h>
71#include <openssl/x509.h> 70#include <openssl/x509.h>
72#include <openssl/x509v3.h> 71#include <openssl/x509v3.h>
73 72
74#include "bn_local.h" 73#include "bn_local.h"
74#include "err_local.h"
75#include "evp_local.h" 75#include "evp_local.h"
76#include "rsa_local.h" 76#include "rsa_local.h"
77 77
diff --git a/src/lib/libcrypto/rsa/rsa_prn.c b/src/lib/libcrypto/rsa/rsa_prn.c
index 1783563661..ef08f76249 100644
--- a/src/lib/libcrypto/rsa/rsa_prn.c
+++ b/src/lib/libcrypto/rsa/rsa_prn.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_prn.c,v 1.10 2023/07/08 12:26:45 beck Exp $ */ 1/* $OpenBSD: rsa_prn.c,v 1.11 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -58,10 +58,11 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60 60
61#include <openssl/err.h>
62#include <openssl/evp.h> 61#include <openssl/evp.h>
63#include <openssl/rsa.h> 62#include <openssl/rsa.h>
64 63
64#include "err_local.h"
65
65int 66int
66RSA_print_fp(FILE *fp, const RSA *x, int off) 67RSA_print_fp(FILE *fp, const RSA *x, int off)
67{ 68{
diff --git a/src/lib/libcrypto/rsa/rsa_pss.c b/src/lib/libcrypto/rsa/rsa_pss.c
index 610ae7c928..72e252ef06 100644
--- a/src/lib/libcrypto/rsa/rsa_pss.c
+++ b/src/lib/libcrypto/rsa/rsa_pss.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_pss.c,v 1.19 2024/03/26 05:26:27 joshua Exp $ */ 1/* $OpenBSD: rsa_pss.c,v 1.20 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2005. 3 * project 2005.
4 */ 4 */
@@ -61,11 +61,11 @@
61#include <string.h> 61#include <string.h>
62 62
63#include <openssl/bn.h> 63#include <openssl/bn.h>
64#include <openssl/err.h>
65#include <openssl/evp.h> 64#include <openssl/evp.h>
66#include <openssl/rsa.h> 65#include <openssl/rsa.h>
67#include <openssl/sha.h> 66#include <openssl/sha.h>
68 67
68#include "err_local.h"
69#include "evp_local.h" 69#include "evp_local.h"
70#include "rsa_local.h" 70#include "rsa_local.h"
71 71
diff --git a/src/lib/libcrypto/rsa/rsa_saos.c b/src/lib/libcrypto/rsa/rsa_saos.c
index 07a4f5d659..3052fa912f 100644
--- a/src/lib/libcrypto/rsa/rsa_saos.c
+++ b/src/lib/libcrypto/rsa/rsa_saos.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_saos.c,v 1.25 2023/07/08 12:26:45 beck Exp $ */ 1/* $OpenBSD: rsa_saos.c,v 1.26 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -60,11 +60,12 @@
60#include <string.h> 60#include <string.h>
61 61
62#include <openssl/bn.h> 62#include <openssl/bn.h>
63#include <openssl/err.h>
64#include <openssl/objects.h> 63#include <openssl/objects.h>
65#include <openssl/rsa.h> 64#include <openssl/rsa.h>
66#include <openssl/x509.h> 65#include <openssl/x509.h>
67 66
67#include "err_local.h"
68
68int 69int
69RSA_sign_ASN1_OCTET_STRING(int type, const unsigned char *m, unsigned int m_len, 70RSA_sign_ASN1_OCTET_STRING(int type, const unsigned char *m, unsigned int m_len,
70 unsigned char *sigret, unsigned int *siglen, RSA *rsa) 71 unsigned char *sigret, unsigned int *siglen, RSA *rsa)
diff --git a/src/lib/libcrypto/rsa/rsa_sign.c b/src/lib/libcrypto/rsa/rsa_sign.c
index 6edd20626d..09e6972293 100644
--- a/src/lib/libcrypto/rsa/rsa_sign.c
+++ b/src/lib/libcrypto/rsa/rsa_sign.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_sign.c,v 1.37 2025/01/05 15:39:12 tb Exp $ */ 1/* $OpenBSD: rsa_sign.c,v 1.38 2025/05/10 05:54:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -60,12 +60,12 @@
60#include <string.h> 60#include <string.h>
61 61
62#include <openssl/bn.h> 62#include <openssl/bn.h>
63#include <openssl/err.h>
64#include <openssl/objects.h> 63#include <openssl/objects.h>
65#include <openssl/rsa.h> 64#include <openssl/rsa.h>
66#include <openssl/x509.h> 65#include <openssl/x509.h>
67 66
68#include "asn1_local.h" 67#include "asn1_local.h"
68#include "err_local.h"
69#include "rsa_local.h" 69#include "rsa_local.h"
70#include "x509_local.h" 70#include "x509_local.h"
71 71
diff --git a/src/lib/libcrypto/rsa/rsa_x931.c b/src/lib/libcrypto/rsa/rsa_x931.c
index 52f3f803b2..8a0190d7fe 100644
--- a/src/lib/libcrypto/rsa/rsa_x931.c
+++ b/src/lib/libcrypto/rsa/rsa_x931.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_x931.c,v 1.12 2023/05/05 12:19:37 tb Exp $ */ 1/* $OpenBSD: rsa_x931.c,v 1.13 2025/05/10 05:54:38 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2005. 3 * project 2005.
4 */ 4 */
@@ -60,10 +60,11 @@
60#include <string.h> 60#include <string.h>
61 61
62#include <openssl/bn.h> 62#include <openssl/bn.h>
63#include <openssl/err.h>
64#include <openssl/objects.h> 63#include <openssl/objects.h>
65#include <openssl/rsa.h> 64#include <openssl/rsa.h>
66 65
66#include "err_local.h"
67
67int 68int
68RSA_padding_add_X931(unsigned char *to, int tlen, const unsigned char *from, 69RSA_padding_add_X931(unsigned char *to, int tlen, const unsigned char *from,
69 int flen) 70 int flen)
diff --git a/src/lib/libcrypto/sha/asm/sha1-586.pl b/src/lib/libcrypto/sha/asm/sha1-586.pl
index 5928e083c1..d2491766f3 100644
--- a/src/lib/libcrypto/sha/asm/sha1-586.pl
+++ b/src/lib/libcrypto/sha/asm/sha1-586.pl
@@ -104,13 +104,7 @@ require "x86asm.pl";
104 104
105&asm_init($ARGV[0],"sha1-586.pl",$ARGV[$#ARGV] eq "386"); 105&asm_init($ARGV[0],"sha1-586.pl",$ARGV[$#ARGV] eq "386");
106 106
107$xmm=$ymm=0; 107$xmm=$ymm=1;
108for (@ARGV) { $xmm=1 if (/-DOPENSSL_IA32_SSE2/); }
109
110$ymm=1 if ($xmm &&
111 `$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1`
112 =~ /GNU assembler version ([2-9]\.[0-9]+)/ &&
113 $1>=2.19); # first version supporting AVX
114 108
115&external_label("OPENSSL_ia32cap_P") if ($xmm); 109&external_label("OPENSSL_ia32cap_P") if ($xmm);
116 110
diff --git a/src/lib/libcrypto/sha/asm/sha512-586.pl b/src/lib/libcrypto/sha/asm/sha512-586.pl
index c1d0684e92..fe1ff487bc 100644
--- a/src/lib/libcrypto/sha/asm/sha512-586.pl
+++ b/src/lib/libcrypto/sha/asm/sha512-586.pl
@@ -38,8 +38,7 @@ require "x86asm.pl";
38 38
39&asm_init($ARGV[0],"sha512-586.pl",$ARGV[$#ARGV] eq "386"); 39&asm_init($ARGV[0],"sha512-586.pl",$ARGV[$#ARGV] eq "386");
40 40
41$sse2=0; 41$sse2=1;
42for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); }
43 42
44&external_label("OPENSSL_ia32cap_P") if ($sse2); 43&external_label("OPENSSL_ia32cap_P") if ($sse2);
45 44
diff --git a/src/lib/libcrypto/sha/sha1_aarch64.c b/src/lib/libcrypto/sha/sha1_aarch64.c
new file mode 100644
index 0000000000..04c87761e0
--- /dev/null
+++ b/src/lib/libcrypto/sha/sha1_aarch64.c
@@ -0,0 +1,34 @@
1/* $OpenBSD: sha1_aarch64.c,v 1.1 2025/06/28 12:51:08 jsing Exp $ */
2/*
3 * Copyright (c) 2025 Joel Sing <jsing@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#include <openssl/sha.h>
19
20#include "crypto_arch.h"
21
22void sha1_block_ce(SHA256_CTX *ctx, const void *in, size_t num);
23void sha1_block_generic(SHA256_CTX *ctx, const void *in, size_t num);
24
25void
26sha1_block_data_order(SHA256_CTX *ctx, const void *in, size_t num)
27{
28 if ((crypto_cpu_caps_aarch64 & CRYPTO_CPU_CAPS_AARCH64_SHA1) != 0) {
29 sha1_block_ce(ctx, in, num);
30 return;
31 }
32
33 sha1_block_generic(ctx, in, num);
34}
diff --git a/src/lib/libcrypto/sha/sha1_aarch64_ce.S b/src/lib/libcrypto/sha/sha1_aarch64_ce.S
new file mode 100644
index 0000000000..8ccf230298
--- /dev/null
+++ b/src/lib/libcrypto/sha/sha1_aarch64_ce.S
@@ -0,0 +1,214 @@
1/* $OpenBSD: sha1_aarch64_ce.S,v 1.1 2025/06/28 12:51:08 jsing Exp $ */
2/*
3 * Copyright (c) 2023,2025 Joel Sing <jsing@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18/*
19 * SHA-1 implementation using the ARM Cryptographic Extension (CE).
20 *
21 * There are six instructions for hardware acceleration of SHA-1 - the
22 * documentation for these instructions is woefully inadequate:
23 *
24 * sha1c: hash update (choose)
25 * sha1h: fixed rotate
26 * sha1m: hash update (majority)
27 * sha1p: hash update (parity)
28 * sha1su0: message schedule update with sigma0 for four rounds
29 * sha1su1: message schedule update with sigma1 for four rounds
30 */
31
32#define ctx x0
33#define in x1
34#define num x2
35
36/* Note: the lower 64 bits of v8 through v15 are callee saved. */
37
38#define hc0 v16
39#define hc1 v17
40#define hc1s s17
41
42#define hs0 v18
43#define hs1 v19
44#define hs1s s19
45
46#define w0 v20
47#define w1 v21
48#define w2 v22
49#define w3 v23
50
51#define k0 v24
52#define k1 v25
53#define k2 v26
54#define k3 v27
55
56#define tmp0 v28
57#define tmp1 s29
58
59#define tmp2 w11
60
61/*
62 * Update message schedule for m0 (W0:W1:W2:W3), using m1 (W4:W5:W6:W7),
63 * m2 (W8:W9:W10:11) and m3 (W12:W13:W14:W15). The sha1su0 instruction computes
64 * W0 = W8 ^ W2 ^ W0, while sha1su1 computes rol(W0 ^ W13, 1).
65 */
66#define sha1_message_schedule_update(m0, m1, m2, m3) \
67 sha1su0 m0.4s, m1.4s, m2.4s; \
68 sha1su1 m0.4s, m3.4s;
69
70/*
71 * Compute four SHA-1 rounds by adding W0:W1:W2:W3 + K0:K1:K2:K3, then
72 * computing the remainder of each round (including the shuffle) via
73 * sha1{c,p,m}/sha1h.
74 */
75
76#define sha1_round1(h0, h1, w, k) \
77 add tmp0.4s, w.4s, k.4s; /* Tt = Wt + Kt */ \
78 mov tmp1, h0.s[0]; \
79 sha1c h0, h1, tmp0.4s; \
80 sha1h h1, tmp1;
81
82#define sha1_round2(h0, h1, w, k) \
83 add tmp0.4s, w.4s, k.4s; /* Tt = Wt + Kt */ \
84 mov tmp1, h0.s[0]; \
85 sha1p h0, h1, tmp0.4s; \
86 sha1h h1, tmp1;
87
88#define sha1_round3(h0, h1, w, k) \
89 add tmp0.4s, w.4s, k.4s; /* Tt = Wt + Kt */ \
90 mov tmp1, h0.s[0]; \
91 sha1m h0, h1, tmp0.4s; \
92 sha1h h1, tmp1;
93
94#define sha1_round4(h0, h1, w, k) \
95 add tmp0.4s, w.4s, k.4s; /* Tt = Wt + Kt */ \
96 mov tmp1, h0.s[0]; \
97 sha1p h0, h1, tmp0.4s; \
98 sha1h h1, tmp1;
99
100.arch armv8-a+sha2
101
102.text
103
104/*
105 * void sha1_block_ce(SHA256_CTX *ctx, const void *in, size_t num);
106 *
107 * Standard ARM ABI: x0 = ctx, x1 = in, x2 = num
108 */
109.globl sha1_block_ce
110.type sha1_block_ce,@function
111sha1_block_ce:
112
113 /*
114 * Load SHA-1 round constants.
115 */
116
117 /* Round 1 - 0x5a827999 */
118 movz tmp2, #0x5a82, lsl #16
119 movk tmp2, #0x7999
120 dup k0.4s, tmp2
121
122 /* Round 2 - 0x6ed9eba1 */
123 movz tmp2, #0x6ed9, lsl #16
124 movk tmp2, #0xeba1
125 dup k1.4s, tmp2
126
127 /* Round 3 - 0x8f1bbcdc */
128 movz tmp2, #0x8f1b, lsl #16
129 movk tmp2, #0xbcdc
130 dup k2.4s, tmp2
131
132 /* Round 4 - 0xca62c1d6 */
133 movz tmp2, #0xca62, lsl #16
134 movk tmp2, #0xc1d6
135 dup k3.4s, tmp2
136
137 /* Load current hash state from context (hc0 = a:b:c:d, hc1 = e). */
138 ld1 {hc0.4s}, [ctx]
139 ldr hc1s, [ctx, #(4*4)]
140
141block_loop:
142 /* Copy current hash state. */
143 mov hs0.4s, hc0.4s
144 mov hs1s, hc1.s[0]
145
146 /* Load and byte swap message schedule. */
147 ld1 {w0.16b, w1.16b, w2.16b, w3.16b}, [in], #64
148 rev32 w0.16b, w0.16b
149 rev32 w1.16b, w1.16b
150 rev32 w2.16b, w2.16b
151 rev32 w3.16b, w3.16b
152
153 /* Rounds 0 through 15 (four rounds at a time). */
154 sha1_round1(hs0, hs1s, w0, k0)
155 sha1_round1(hs0, hs1s, w1, k0)
156 sha1_round1(hs0, hs1s, w2, k0)
157 sha1_round1(hs0, hs1s, w3, k0)
158
159 /* Rounds 16 through 31 (four rounds at a time). */
160 sha1_message_schedule_update(w0, w1, w2, w3)
161 sha1_message_schedule_update(w1, w2, w3, w0)
162 sha1_message_schedule_update(w2, w3, w0, w1)
163 sha1_message_schedule_update(w3, w0, w1, w2)
164
165 sha1_round1(hs0, hs1s, w0, k0)
166 sha1_round2(hs0, hs1s, w1, k1)
167 sha1_round2(hs0, hs1s, w2, k1)
168 sha1_round2(hs0, hs1s, w3, k1)
169
170 /* Rounds 32 through 47 (four rounds at a time). */
171 sha1_message_schedule_update(w0, w1, w2, w3)
172 sha1_message_schedule_update(w1, w2, w3, w0)
173 sha1_message_schedule_update(w2, w3, w0, w1)
174 sha1_message_schedule_update(w3, w0, w1, w2)
175
176 sha1_round2(hs0, hs1s, w0, k1)
177 sha1_round2(hs0, hs1s, w1, k1)
178 sha1_round3(hs0, hs1s, w2, k2)
179 sha1_round3(hs0, hs1s, w3, k2)
180
181 /* Rounds 48 through 63 (four rounds at a time). */
182 sha1_message_schedule_update(w0, w1, w2, w3)
183 sha1_message_schedule_update(w1, w2, w3, w0)
184 sha1_message_schedule_update(w2, w3, w0, w1)
185 sha1_message_schedule_update(w3, w0, w1, w2)
186
187 sha1_round3(hs0, hs1s, w0, k2)
188 sha1_round3(hs0, hs1s, w1, k2)
189 sha1_round3(hs0, hs1s, w2, k2)
190 sha1_round4(hs0, hs1s, w3, k3)
191
192 /* Rounds 64 through 79 (four rounds at a time). */
193 sha1_message_schedule_update(w0, w1, w2, w3)
194 sha1_message_schedule_update(w1, w2, w3, w0)
195 sha1_message_schedule_update(w2, w3, w0, w1)
196 sha1_message_schedule_update(w3, w0, w1, w2)
197
198 sha1_round4(hs0, hs1s, w0, k3)
199 sha1_round4(hs0, hs1s, w1, k3)
200 sha1_round4(hs0, hs1s, w2, k3)
201 sha1_round4(hs0, hs1s, w3, k3)
202
203 /* Add intermediate state to hash state. */
204 add hc0.4s, hc0.4s, hs0.4s
205 add hc1.4s, hc1.4s, hs1.4s
206
207 sub num, num, #1
208 cbnz num, block_loop
209
210 /* Store hash state to context. */
211 st1 {hc0.4s}, [ctx]
212 str hc1s, [ctx, #(4*4)]
213
214 ret
diff --git a/src/lib/libcrypto/sha/sha3.c b/src/lib/libcrypto/sha/sha3.c
index 6a7196d582..fde0da94ff 100644
--- a/src/lib/libcrypto/sha/sha3.c
+++ b/src/lib/libcrypto/sha/sha3.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sha3.c,v 1.16 2024/11/23 15:38:12 jsing Exp $ */ 1/* $OpenBSD: sha3.c,v 1.20 2025/04/18 07:36:11 jsing Exp $ */
2/* 2/*
3 * The MIT License (MIT) 3 * The MIT License (MIT)
4 * 4 *
@@ -26,12 +26,11 @@
26#include <endian.h> 26#include <endian.h>
27#include <string.h> 27#include <string.h>
28 28
29#include "crypto_internal.h"
29#include "sha3_internal.h" 30#include "sha3_internal.h"
30 31
31#define KECCAKF_ROUNDS 24 32#define KECCAKF_ROUNDS 24
32 33
33#define ROTL64(x, y) (((x) << (y)) | ((x) >> (64 - (y))))
34
35static const uint64_t sha3_keccakf_rndc[24] = { 34static const uint64_t sha3_keccakf_rndc[24] = {
36 0x0000000000000001, 0x0000000000008082, 0x800000000000808a, 35 0x0000000000000001, 0x0000000000008082, 0x800000000000808a,
37 0x8000000080008000, 0x000000000000808b, 0x0000000080000001, 36 0x8000000080008000, 0x000000000000808b, 0x0000000080000001,
@@ -54,7 +53,7 @@ static const int sha3_keccakf_piln[24] = {
54static void 53static void
55sha3_keccakf(uint64_t st[25]) 54sha3_keccakf(uint64_t st[25])
56{ 55{
57 uint64_t t, bc[5]; 56 uint64_t t0, t1, bc[5];
58 int i, j, r; 57 int i, j, r;
59 58
60 for (i = 0; i < 25; i++) 59 for (i = 0; i < 25; i++)
@@ -67,18 +66,18 @@ sha3_keccakf(uint64_t st[25])
67 bc[i] = st[i] ^ st[i + 5] ^ st[i + 10] ^ st[i + 15] ^ st[i + 20]; 66 bc[i] = st[i] ^ st[i + 5] ^ st[i + 10] ^ st[i + 15] ^ st[i + 20];
68 67
69 for (i = 0; i < 5; i++) { 68 for (i = 0; i < 5; i++) {
70 t = bc[(i + 4) % 5] ^ ROTL64(bc[(i + 1) % 5], 1); 69 t0 = bc[(i + 4) % 5] ^ crypto_rol_u64(bc[(i + 1) % 5], 1);
71 for (j = 0; j < 25; j += 5) 70 for (j = 0; j < 25; j += 5)
72 st[j + i] ^= t; 71 st[j + i] ^= t0;
73 } 72 }
74 73
75 /* Rho Pi */ 74 /* Rho Pi */
76 t = st[1]; 75 t0 = st[1];
77 for (i = 0; i < 24; i++) { 76 for (i = 0; i < 24; i++) {
78 j = sha3_keccakf_piln[i]; 77 j = sha3_keccakf_piln[i];
79 bc[0] = st[j]; 78 t1 = st[j];
80 st[j] = ROTL64(t, sha3_keccakf_rotc[i]); 79 st[j] = crypto_rol_u64(t0, sha3_keccakf_rotc[i]);
81 t = bc[0]; 80 t0 = t1;
82 } 81 }
83 82
84 /* Chi */ 83 /* Chi */
@@ -98,75 +97,77 @@ sha3_keccakf(uint64_t st[25])
98} 97}
99 98
100int 99int
101sha3_init(sha3_ctx *c, int mdlen) 100sha3_init(sha3_ctx *ctx, int mdlen)
102{ 101{
103 if (mdlen < 0 || mdlen >= KECCAK_BYTE_WIDTH / 2) 102 if (mdlen < 0 || mdlen >= KECCAK_BYTE_WIDTH / 2)
104 return 0; 103 return 0;
105 104
106 memset(c, 0, sizeof(*c)); 105 memset(ctx, 0, sizeof(*ctx));
107 106
108 c->mdlen = mdlen; 107 ctx->mdlen = mdlen;
109 c->rsize = KECCAK_BYTE_WIDTH - 2 * mdlen; 108 ctx->rsize = KECCAK_BYTE_WIDTH - 2 * mdlen;
110 109
111 return 1; 110 return 1;
112} 111}
113 112
114int 113int
115sha3_update(sha3_ctx *c, const void *data, size_t len) 114sha3_update(sha3_ctx *ctx, const void *_data, size_t len)
116{ 115{
116 const uint8_t *data = _data;
117 size_t i, j; 117 size_t i, j;
118 118
119 j = c->pt; 119 j = ctx->pt;
120 for (i = 0; i < len; i++) { 120 for (i = 0; i < len; i++) {
121 c->state.b[j++] ^= ((const uint8_t *) data)[i]; 121 ctx->state.b[j++] ^= data[i];
122 if (j >= c->rsize) { 122 if (j >= ctx->rsize) {
123 sha3_keccakf(c->state.q); 123 sha3_keccakf(ctx->state.q);
124 j = 0; 124 j = 0;
125 } 125 }
126 } 126 }
127 c->pt = j; 127 ctx->pt = j;
128 128
129 return 1; 129 return 1;
130} 130}
131 131
132int 132int
133sha3_final(void *md, sha3_ctx *c) 133sha3_final(void *_md, sha3_ctx *ctx)
134{ 134{
135 uint8_t *md = _md;
135 int i; 136 int i;
136 137
137 c->state.b[c->pt] ^= 0x06; 138 ctx->state.b[ctx->pt] ^= 0x06;
138 c->state.b[c->rsize - 1] ^= 0x80; 139 ctx->state.b[ctx->rsize - 1] ^= 0x80;
139 sha3_keccakf(c->state.q); 140 sha3_keccakf(ctx->state.q);
140 141
141 for (i = 0; i < c->mdlen; i++) { 142 for (i = 0; i < ctx->mdlen; i++)
142 ((uint8_t *) md)[i] = c->state.b[i]; 143 md[i] = ctx->state.b[i];
143 }
144 144
145 return 1; 145 return 1;
146} 146}
147 147
148/* SHAKE128 and SHAKE256 extensible-output functionality. */ 148/* SHAKE128 and SHAKE256 extensible-output functionality. */
149void 149void
150shake_xof(sha3_ctx *c) 150shake_xof(sha3_ctx *ctx)
151{ 151{
152 c->state.b[c->pt] ^= 0x1F; 152 ctx->state.b[ctx->pt] ^= 0x1f;
153 c->state.b[c->rsize - 1] ^= 0x80; 153 ctx->state.b[ctx->rsize - 1] ^= 0x80;
154 sha3_keccakf(c->state.q); 154 sha3_keccakf(ctx->state.q);
155 c->pt = 0; 155 ctx->pt = 0;
156} 156}
157 157
158void 158void
159shake_out(sha3_ctx *c, void *out, size_t len) 159shake_out(sha3_ctx *ctx, void *_out, size_t len)
160{ 160{
161 uint8_t *out = _out;
161 size_t i, j; 162 size_t i, j;
162 163
163 j = c->pt; 164 j = ctx->pt;
164 for (i = 0; i < len; i++) { 165 for (i = 0; i < len; i++) {
165 if (j >= c->rsize) { 166 if (j >= ctx->rsize) {
166 sha3_keccakf(c->state.q); 167 sha3_keccakf(ctx->state.q);
167 j = 0; 168 j = 0;
168 } 169 }
169 ((uint8_t *) out)[i] = c->state.b[j++]; 170 out[i] = ctx->state.b[j++];
170 } 171 }
171 c->pt = j; 172 ctx->pt = j;
172} 173}
diff --git a/src/lib/libcrypto/sha/sha3_internal.h b/src/lib/libcrypto/sha/sha3_internal.h
index 53a4980c19..db09d06cc0 100644
--- a/src/lib/libcrypto/sha/sha3_internal.h
+++ b/src/lib/libcrypto/sha/sha3_internal.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: sha3_internal.h,v 1.15 2023/04/25 19:32:19 tb Exp $ */ 1/* $OpenBSD: sha3_internal.h,v 1.16 2025/04/18 07:36:11 jsing Exp $ */
2/* 2/*
3 * The MIT License (MIT) 3 * The MIT License (MIT)
4 * 4 *
@@ -66,16 +66,16 @@ typedef struct sha3_ctx_st {
66 size_t mdlen; 66 size_t mdlen;
67} sha3_ctx; 67} sha3_ctx;
68 68
69int sha3_init(sha3_ctx *c, int mdlen); 69int sha3_init(sha3_ctx *ctx, int mdlen);
70int sha3_update(sha3_ctx *c, const void *data, size_t len); 70int sha3_update(sha3_ctx *ctx, const void *data, size_t len);
71int sha3_final(void *md, sha3_ctx *c); 71int sha3_final(void *md, sha3_ctx *ctx);
72 72
73/* SHAKE128 and SHAKE256 extensible-output functions. */ 73/* SHAKE128 and SHAKE256 extensible-output functions. */
74#define shake128_init(c) sha3_init(c, 16) 74#define shake128_init(ctx) sha3_init((ctx), 16)
75#define shake256_init(c) sha3_init(c, 32) 75#define shake256_init(ctx) sha3_init((ctx), 32)
76#define shake_update sha3_update 76#define shake_update sha3_update
77 77
78void shake_xof(sha3_ctx *c); 78void shake_xof(sha3_ctx *ctx);
79void shake_out(sha3_ctx *c, void *out, size_t len); 79void shake_out(sha3_ctx *ctx, void *out, size_t len);
80 80
81#endif 81#endif
diff --git a/src/lib/libcrypto/shlib_version b/src/lib/libcrypto/shlib_version
index a5cb76dd4f..79adf54372 100644
--- a/src/lib/libcrypto/shlib_version
+++ b/src/lib/libcrypto/shlib_version
@@ -1,3 +1,3 @@
1# Don't forget to give libssl and libtls the same type of bump! 1# Don't forget to give libssl and libtls the same type of bump!
2major=56 2major=57
3minor=0 3minor=0
diff --git a/src/lib/libcrypto/sm2/sm2_crypt.c b/src/lib/libcrypto/sm2/sm2_crypt.c
index 63fe1e6ab9..3bc1f21fb6 100644
--- a/src/lib/libcrypto/sm2/sm2_crypt.c
+++ b/src/lib/libcrypto/sm2/sm2_crypt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sm2_crypt.c,v 1.3 2024/02/09 07:43:52 tb Exp $ */ 1/* $OpenBSD: sm2_crypt.c,v 1.4 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2017, 2019 Ribose Inc 3 * Copyright (c) 2017, 2019 Ribose Inc
4 * 4 *
@@ -22,10 +22,10 @@
22#include <openssl/asn1.h> 22#include <openssl/asn1.h>
23#include <openssl/asn1t.h> 23#include <openssl/asn1t.h>
24#include <openssl/bn.h> 24#include <openssl/bn.h>
25#include <openssl/err.h>
26#include <openssl/evp.h> 25#include <openssl/evp.h>
27#include <openssl/sm2.h> 26#include <openssl/sm2.h>
28 27
28#include "err_local.h"
29#include "sm2_local.h" 29#include "sm2_local.h"
30 30
31typedef struct SM2_Ciphertext_st SM2_Ciphertext; 31typedef struct SM2_Ciphertext_st SM2_Ciphertext;
diff --git a/src/lib/libcrypto/sm2/sm2_pmeth.c b/src/lib/libcrypto/sm2/sm2_pmeth.c
index 441f5475d1..786e48a992 100644
--- a/src/lib/libcrypto/sm2/sm2_pmeth.c
+++ b/src/lib/libcrypto/sm2/sm2_pmeth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sm2_pmeth.c,v 1.2 2022/11/26 16:08:54 tb Exp $ */ 1/* $OpenBSD: sm2_pmeth.c,v 1.3 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2017, 2019 Ribose Inc 3 * Copyright (c) 2017, 2019 Ribose Inc
4 * 4 *
@@ -22,9 +22,9 @@
22#include <openssl/sm2.h> 22#include <openssl/sm2.h>
23#include <openssl/asn1t.h> 23#include <openssl/asn1t.h>
24#include <openssl/x509.h> 24#include <openssl/x509.h>
25#include <openssl/err.h>
26#include <openssl/evp.h> 25#include <openssl/evp.h>
27 26
27#include "err_local.h"
28#include "evp_local.h" 28#include "evp_local.h"
29#include "sm2_local.h" 29#include "sm2_local.h"
30 30
diff --git a/src/lib/libcrypto/sm2/sm2_sign.c b/src/lib/libcrypto/sm2/sm2_sign.c
index a5e3a8aee5..1a88d860bc 100644
--- a/src/lib/libcrypto/sm2/sm2_sign.c
+++ b/src/lib/libcrypto/sm2/sm2_sign.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sm2_sign.c,v 1.4 2023/07/05 17:36:19 tb Exp $ */ 1/* $OpenBSD: sm2_sign.c,v 1.5 2025/05/10 05:54:38 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2017, 2019 Ribose Inc 3 * Copyright (c) 2017, 2019 Ribose Inc
4 * 4 *
@@ -21,10 +21,10 @@
21 21
22#include <openssl/sm2.h> 22#include <openssl/sm2.h>
23#include <openssl/evp.h> 23#include <openssl/evp.h>
24#include <openssl/err.h>
25#include <openssl/bn.h> 24#include <openssl/bn.h>
26 25
27#include "bn_local.h" 26#include "bn_local.h"
27#include "err_local.h"
28#include "sm2_local.h" 28#include "sm2_local.h"
29 29
30static BIGNUM * 30static BIGNUM *
diff --git a/src/lib/libcrypto/ts/ts_asn1.c b/src/lib/libcrypto/ts/ts_asn1.c
index feb2da68f9..aa3f4ba867 100644
--- a/src/lib/libcrypto/ts/ts_asn1.c
+++ b/src/lib/libcrypto/ts/ts_asn1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ts_asn1.c,v 1.15 2024/04/15 15:52:46 tb Exp $ */ 1/* $OpenBSD: ts_asn1.c,v 1.16 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Nils Larsch for the OpenSSL project 2004. 2/* Written by Nils Larsch for the OpenSSL project 2004.
3 */ 3 */
4/* ==================================================================== 4/* ====================================================================
@@ -58,9 +58,9 @@
58#include <openssl/opensslconf.h> 58#include <openssl/opensslconf.h>
59 59
60#include <openssl/ts.h> 60#include <openssl/ts.h>
61#include <openssl/err.h>
62#include <openssl/asn1t.h> 61#include <openssl/asn1t.h>
63 62
63#include "err_local.h"
64#include "ts_local.h" 64#include "ts_local.h"
65 65
66static const ASN1_TEMPLATE TS_MSG_IMPRINT_seq_tt[] = { 66static const ASN1_TEMPLATE TS_MSG_IMPRINT_seq_tt[] = {
diff --git a/src/lib/libcrypto/ts/ts_conf.c b/src/lib/libcrypto/ts/ts_conf.c
index bd499238f5..0acefa902f 100644
--- a/src/lib/libcrypto/ts/ts_conf.c
+++ b/src/lib/libcrypto/ts/ts_conf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ts_conf.c,v 1.15 2024/08/26 22:01:28 op Exp $ */ 1/* $OpenBSD: ts_conf.c,v 1.16 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL 2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
3 * project 2002. 3 * project 2002.
4 */ 4 */
@@ -63,7 +63,6 @@
63#include <openssl/opensslconf.h> 63#include <openssl/opensslconf.h>
64 64
65#include <openssl/crypto.h> 65#include <openssl/crypto.h>
66#include <openssl/err.h>
67#include <openssl/pem.h> 66#include <openssl/pem.h>
68#include <openssl/ts.h> 67#include <openssl/ts.h>
69 68
diff --git a/src/lib/libcrypto/ts/ts_req_utils.c b/src/lib/libcrypto/ts/ts_req_utils.c
index d679418060..fa3123863c 100644
--- a/src/lib/libcrypto/ts/ts_req_utils.c
+++ b/src/lib/libcrypto/ts/ts_req_utils.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ts_req_utils.c,v 1.9 2023/07/07 19:37:54 beck Exp $ */ 1/* $OpenBSD: ts_req_utils.c,v 1.10 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL 2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
3 * project 2002. 3 * project 2002.
4 */ 4 */
@@ -58,11 +58,11 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60 60
61#include <openssl/err.h>
62#include <openssl/objects.h> 61#include <openssl/objects.h>
63#include <openssl/ts.h> 62#include <openssl/ts.h>
64#include <openssl/x509v3.h> 63#include <openssl/x509v3.h>
65 64
65#include "err_local.h"
66#include "ts_local.h" 66#include "ts_local.h"
67 67
68int 68int
diff --git a/src/lib/libcrypto/ts/ts_rsp_sign.c b/src/lib/libcrypto/ts/ts_rsp_sign.c
index e3101340c5..b8cc7e2baf 100644
--- a/src/lib/libcrypto/ts/ts_rsp_sign.c
+++ b/src/lib/libcrypto/ts/ts_rsp_sign.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ts_rsp_sign.c,v 1.35 2024/03/26 00:39:22 beck Exp $ */ 1/* $OpenBSD: ts_rsp_sign.c,v 1.37 2025/07/31 02:02:35 tb Exp $ */
2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL 2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
3 * project 2002. 3 * project 2002.
4 */ 4 */
@@ -60,11 +60,11 @@
60 60
61#include <string.h> 61#include <string.h>
62 62
63#include <openssl/err.h>
64#include <openssl/objects.h> 63#include <openssl/objects.h>
65#include <openssl/pkcs7.h> 64#include <openssl/pkcs7.h>
66#include <openssl/ts.h> 65#include <openssl/ts.h>
67 66
67#include "err_local.h"
68#include "evp_local.h" 68#include "evp_local.h"
69#include "ts_local.h" 69#include "ts_local.h"
70#include "x509_local.h" 70#include "x509_local.h"
@@ -955,28 +955,32 @@ static int
955ESS_add_signing_cert(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT *sc) 955ESS_add_signing_cert(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT *sc)
956{ 956{
957 ASN1_STRING *seq = NULL; 957 ASN1_STRING *seq = NULL;
958 unsigned char *p, *pp = NULL; 958 unsigned char *data = NULL;
959 int len; 959 int len = 0;
960 int ret = 0;
960 961
961 len = i2d_ESS_SIGNING_CERT(sc, NULL); 962 if ((len = i2d_ESS_SIGNING_CERT(sc, &data)) <= 0) {
962 if (!(pp = malloc(len))) { 963 len = 0;
963 TSerror(ERR_R_MALLOC_FAILURE);
964 goto err; 964 goto err;
965 } 965 }
966 p = pp; 966
967 i2d_ESS_SIGNING_CERT(sc, &p); 967 if ((seq = ASN1_STRING_new()) == NULL)
968 if (!(seq = ASN1_STRING_new()) || !ASN1_STRING_set(seq, pp, len)) {
969 TSerror(ERR_R_MALLOC_FAILURE);
970 goto err; 968 goto err;
971 }
972 free(pp);
973 pp = NULL;
974 return PKCS7_add_signed_attribute(si,
975 NID_id_smime_aa_signingCertificate, V_ASN1_SEQUENCE, seq);
976 969
977err: 970 ASN1_STRING_set0(seq, data, len);
971 data = NULL;
972 len = 0;
973
974 if (!PKCS7_add_signed_attribute(si, NID_id_smime_aa_signingCertificate,
975 V_ASN1_SEQUENCE, seq))
976 goto err;
977 seq = NULL;
978
979 ret = 1;
980
981 err:
978 ASN1_STRING_free(seq); 982 ASN1_STRING_free(seq);
979 free(pp); 983 freezero(data, len);
980 984
981 return 0; 985 return ret;
982} 986}
diff --git a/src/lib/libcrypto/ts/ts_rsp_utils.c b/src/lib/libcrypto/ts/ts_rsp_utils.c
index 34994adce8..ecdb46773f 100644
--- a/src/lib/libcrypto/ts/ts_rsp_utils.c
+++ b/src/lib/libcrypto/ts/ts_rsp_utils.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ts_rsp_utils.c,v 1.11 2023/07/07 19:37:54 beck Exp $ */ 1/* $OpenBSD: ts_rsp_utils.c,v 1.12 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL 2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
3 * project 2002. 3 * project 2002.
4 */ 4 */
@@ -58,11 +58,11 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60 60
61#include <openssl/err.h>
62#include <openssl/objects.h> 61#include <openssl/objects.h>
63#include <openssl/pkcs7.h> 62#include <openssl/pkcs7.h>
64#include <openssl/ts.h> 63#include <openssl/ts.h>
65 64
65#include "err_local.h"
66#include "ts_local.h" 66#include "ts_local.h"
67 67
68/* Function definitions. */ 68/* Function definitions. */
diff --git a/src/lib/libcrypto/ts/ts_rsp_verify.c b/src/lib/libcrypto/ts/ts_rsp_verify.c
index 69236f68ab..d38bb3b460 100644
--- a/src/lib/libcrypto/ts/ts_rsp_verify.c
+++ b/src/lib/libcrypto/ts/ts_rsp_verify.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ts_rsp_verify.c,v 1.30 2023/07/07 07:25:21 beck Exp $ */ 1/* $OpenBSD: ts_rsp_verify.c,v 1.31 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL 2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
3 * project 2002. 3 * project 2002.
4 */ 4 */
@@ -59,11 +59,11 @@
59#include <stdio.h> 59#include <stdio.h>
60#include <string.h> 60#include <string.h>
61 61
62#include <openssl/err.h>
63#include <openssl/objects.h> 62#include <openssl/objects.h>
64#include <openssl/pkcs7.h> 63#include <openssl/pkcs7.h>
65#include <openssl/ts.h> 64#include <openssl/ts.h>
66 65
66#include "err_local.h"
67#include "evp_local.h" 67#include "evp_local.h"
68#include "ts_local.h" 68#include "ts_local.h"
69#include "x509_local.h" 69#include "x509_local.h"
diff --git a/src/lib/libcrypto/ts/ts_verify_ctx.c b/src/lib/libcrypto/ts/ts_verify_ctx.c
index 5a2d95c680..23e2557308 100644
--- a/src/lib/libcrypto/ts/ts_verify_ctx.c
+++ b/src/lib/libcrypto/ts/ts_verify_ctx.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ts_verify_ctx.c,v 1.14 2023/07/07 07:25:21 beck Exp $ */ 1/* $OpenBSD: ts_verify_ctx.c,v 1.15 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL 2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
3 * project 2003. 3 * project 2003.
4 */ 4 */
@@ -58,10 +58,10 @@
58 58
59#include <string.h> 59#include <string.h>
60 60
61#include <openssl/err.h>
62#include <openssl/objects.h> 61#include <openssl/objects.h>
63#include <openssl/ts.h> 62#include <openssl/ts.h>
64 63
64#include "err_local.h"
65#include "ts_local.h" 65#include "ts_local.h"
66 66
67TS_VERIFY_CTX * 67TS_VERIFY_CTX *
diff --git a/src/lib/libcrypto/ui/ui_lib.c b/src/lib/libcrypto/ui/ui_lib.c
index 73d899afcc..cc9de59c19 100644
--- a/src/lib/libcrypto/ui/ui_lib.c
+++ b/src/lib/libcrypto/ui/ui_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ui_lib.c,v 1.51 2023/02/16 08:38:17 tb Exp $ */ 1/* $OpenBSD: ui_lib.c,v 1.52 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL 2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
3 * project 2001. 3 * project 2001.
4 */ 4 */
@@ -61,9 +61,9 @@
61#include <openssl/opensslconf.h> 61#include <openssl/opensslconf.h>
62 62
63#include <openssl/buffer.h> 63#include <openssl/buffer.h>
64#include <openssl/err.h>
65#include <openssl/ui.h> 64#include <openssl/ui.h>
66 65
66#include "err_local.h"
67#include "ui_local.h" 67#include "ui_local.h"
68 68
69static const UI_METHOD *default_UI_meth = NULL; 69static const UI_METHOD *default_UI_meth = NULL;
diff --git a/src/lib/libcrypto/x509/by_dir.c b/src/lib/libcrypto/x509/by_dir.c
index 2b2733a04b..9b239c1e9d 100644
--- a/src/lib/libcrypto/x509/by_dir.c
+++ b/src/lib/libcrypto/x509/by_dir.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: by_dir.c,v 1.48 2024/08/31 10:19:17 tb Exp $ */ 1/* $OpenBSD: by_dir.c,v 1.49 2025/05/10 05:54:39 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -64,9 +64,9 @@
64 64
65#include <openssl/opensslconf.h> 65#include <openssl/opensslconf.h>
66 66
67#include <openssl/err.h>
68#include <openssl/x509.h> 67#include <openssl/x509.h>
69 68
69#include "err_local.h"
70#include "x509_local.h" 70#include "x509_local.h"
71 71
72typedef struct lookup_dir_hashes_st { 72typedef struct lookup_dir_hashes_st {
diff --git a/src/lib/libcrypto/x509/by_file.c b/src/lib/libcrypto/x509/by_file.c
index 9b0fd2542c..86d4cd6b60 100644
--- a/src/lib/libcrypto/x509/by_file.c
+++ b/src/lib/libcrypto/x509/by_file.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: by_file.c,v 1.31 2024/08/31 10:19:17 tb Exp $ */ 1/* $OpenBSD: by_file.c,v 1.32 2025/05/10 05:54:39 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -62,10 +62,10 @@
62#include <unistd.h> 62#include <unistd.h>
63 63
64#include <openssl/buffer.h> 64#include <openssl/buffer.h>
65#include <openssl/err.h>
66#include <openssl/pem.h> 65#include <openssl/pem.h>
67#include <openssl/x509.h> 66#include <openssl/x509.h>
68 67
68#include "err_local.h"
69#include "x509_local.h" 69#include "x509_local.h"
70 70
71static int by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, 71static int by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc,
diff --git a/src/lib/libcrypto/x509/by_mem.c b/src/lib/libcrypto/x509/by_mem.c
index 71afefa8a4..66093dd445 100644
--- a/src/lib/libcrypto/x509/by_mem.c
+++ b/src/lib/libcrypto/x509/by_mem.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: by_mem.c,v 1.10 2024/08/31 10:19:17 tb Exp $ */ 1/* $OpenBSD: by_mem.c,v 1.11 2025/05/10 05:54:39 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -63,11 +63,11 @@
63#include <unistd.h> 63#include <unistd.h>
64 64
65#include <openssl/buffer.h> 65#include <openssl/buffer.h>
66#include <openssl/err.h>
67#include <openssl/pem.h> 66#include <openssl/pem.h>
68#include <openssl/lhash.h> 67#include <openssl/lhash.h>
69#include <openssl/x509.h> 68#include <openssl/x509.h>
70 69
70#include "err_local.h"
71#include "x509_local.h" 71#include "x509_local.h"
72 72
73static int by_mem_ctrl(X509_LOOKUP *, int, const char *, long, char **); 73static int by_mem_ctrl(X509_LOOKUP *, int, const char *, long, char **);
diff --git a/src/lib/libcrypto/x509/x509.h b/src/lib/libcrypto/x509/x509.h
index a198b23202..729a06d0ed 100644
--- a/src/lib/libcrypto/x509/x509.h
+++ b/src/lib/libcrypto/x509/x509.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509.h,v 1.121 2025/03/09 15:17:22 tb Exp $ */ 1/* $OpenBSD: x509.h,v 1.123 2025/07/16 15:59:26 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -178,6 +178,7 @@ DECLARE_STACK_OF(X509)
178#define X509_FLAG_NO_SIGDUMP (1L << 9) 178#define X509_FLAG_NO_SIGDUMP (1L << 9)
179#define X509_FLAG_NO_AUX (1L << 10) 179#define X509_FLAG_NO_AUX (1L << 10)
180#define X509_FLAG_NO_ATTRIBUTES (1L << 11) 180#define X509_FLAG_NO_ATTRIBUTES (1L << 11)
181#define X509_FLAG_NO_IDS (1L << 12)
181 182
182/* Flags specific to X509_NAME_print_ex() */ 183/* Flags specific to X509_NAME_print_ex() */
183 184
@@ -244,23 +245,7 @@ typedef struct X509_crl_info_st X509_CRL_INFO;
244DECLARE_STACK_OF(X509_CRL) 245DECLARE_STACK_OF(X509_CRL)
245 246
246typedef struct private_key_st { 247typedef struct private_key_st {
247 int version;
248 /* The PKCS#8 data types */
249 X509_ALGOR *enc_algor;
250 ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */
251
252 /* When decrypted, the following will not be NULL */
253 EVP_PKEY *dec_pkey; 248 EVP_PKEY *dec_pkey;
254
255 /* used to encrypt and decrypt */
256 int key_length;
257 char *key_data;
258 int key_free; /* true if we should auto free key_data */
259
260 /* expanded version of 'enc_algor' */
261 EVP_CIPHER_INFO cipher;
262
263 int references;
264} X509_PKEY; 249} X509_PKEY;
265 250
266#ifndef OPENSSL_NO_EVP 251#ifndef OPENSSL_NO_EVP
@@ -646,9 +631,6 @@ int X509_CRL_get0_by_serial(X509_CRL *crl,
646 X509_REVOKED **ret, ASN1_INTEGER *serial); 631 X509_REVOKED **ret, ASN1_INTEGER *serial);
647int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x); 632int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x);
648 633
649X509_PKEY * X509_PKEY_new(void );
650void X509_PKEY_free(X509_PKEY *a);
651
652NETSCAPE_SPKI *NETSCAPE_SPKI_new(void); 634NETSCAPE_SPKI *NETSCAPE_SPKI_new(void);
653void NETSCAPE_SPKI_free(NETSCAPE_SPKI *a); 635void NETSCAPE_SPKI_free(NETSCAPE_SPKI *a);
654NETSCAPE_SPKI *d2i_NETSCAPE_SPKI(NETSCAPE_SPKI **a, const unsigned char **in, long len); 636NETSCAPE_SPKI *d2i_NETSCAPE_SPKI(NETSCAPE_SPKI **a, const unsigned char **in, long len);
diff --git a/src/lib/libcrypto/x509/x509_addr.c b/src/lib/libcrypto/x509/x509_addr.c
index 2208cc434e..b4ee92a14b 100644
--- a/src/lib/libcrypto/x509/x509_addr.c
+++ b/src/lib/libcrypto/x509/x509_addr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_addr.c,v 1.93 2024/07/13 15:08:58 tb Exp $ */ 1/* $OpenBSD: x509_addr.c,v 1.94 2025/05/10 05:54:39 tb Exp $ */
2/* 2/*
3 * Contributed to the OpenSSL Project by the American Registry for 3 * Contributed to the OpenSSL Project by the American Registry for
4 * Internet Numbers ("ARIN"). 4 * Internet Numbers ("ARIN").
@@ -69,12 +69,12 @@
69#include <openssl/asn1t.h> 69#include <openssl/asn1t.h>
70#include <openssl/buffer.h> 70#include <openssl/buffer.h>
71#include <openssl/conf.h> 71#include <openssl/conf.h>
72#include <openssl/err.h>
73#include <openssl/x509.h> 72#include <openssl/x509.h>
74#include <openssl/x509v3.h> 73#include <openssl/x509v3.h>
75 74
76#include "asn1_local.h" 75#include "asn1_local.h"
77#include "bytestring.h" 76#include "bytestring.h"
77#include "err_local.h"
78#include "x509_local.h" 78#include "x509_local.h"
79 79
80#ifndef OPENSSL_NO_RFC3779 80#ifndef OPENSSL_NO_RFC3779
diff --git a/src/lib/libcrypto/x509/x509_akey.c b/src/lib/libcrypto/x509/x509_akey.c
index 926508c4cd..524fea8009 100644
--- a/src/lib/libcrypto/x509/x509_akey.c
+++ b/src/lib/libcrypto/x509/x509_akey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_akey.c,v 1.3 2024/08/31 10:03:03 tb Exp $ */ 1/* $OpenBSD: x509_akey.c,v 1.4 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -62,9 +62,9 @@
62#include <openssl/asn1.h> 62#include <openssl/asn1.h>
63#include <openssl/asn1t.h> 63#include <openssl/asn1t.h>
64#include <openssl/conf.h> 64#include <openssl/conf.h>
65#include <openssl/err.h>
66#include <openssl/x509v3.h> 65#include <openssl/x509v3.h>
67 66
67#include "err_local.h"
68#include "x509_local.h" 68#include "x509_local.h"
69 69
70static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_KEYID(X509V3_EXT_METHOD *method, 70static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_KEYID(X509V3_EXT_METHOD *method,
diff --git a/src/lib/libcrypto/x509/x509_alt.c b/src/lib/libcrypto/x509/x509_alt.c
index 34734a55bd..ca91493848 100644
--- a/src/lib/libcrypto/x509/x509_alt.c
+++ b/src/lib/libcrypto/x509/x509_alt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_alt.c,v 1.19 2025/03/06 07:20:01 tb Exp $ */ 1/* $OpenBSD: x509_alt.c,v 1.20 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -60,9 +60,9 @@
60#include <string.h> 60#include <string.h>
61 61
62#include <openssl/conf.h> 62#include <openssl/conf.h>
63#include <openssl/err.h>
64#include <openssl/x509v3.h> 63#include <openssl/x509v3.h>
65 64
65#include "err_local.h"
66#include "x509_internal.h" 66#include "x509_internal.h"
67 67
68static GENERAL_NAMES *v2i_subject_alt(X509V3_EXT_METHOD *method, 68static GENERAL_NAMES *v2i_subject_alt(X509V3_EXT_METHOD *method,
diff --git a/src/lib/libcrypto/x509/x509_asid.c b/src/lib/libcrypto/x509/x509_asid.c
index 40ee201a9f..45a154e7d9 100644
--- a/src/lib/libcrypto/x509/x509_asid.c
+++ b/src/lib/libcrypto/x509/x509_asid.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_asid.c,v 1.45 2024/07/13 15:08:58 tb Exp $ */ 1/* $OpenBSD: x509_asid.c,v 1.46 2025/05/10 05:54:39 tb Exp $ */
2/* 2/*
3 * Contributed to the OpenSSL Project by the American Registry for 3 * Contributed to the OpenSSL Project by the American Registry for
4 * Internet Numbers ("ARIN"). 4 * Internet Numbers ("ARIN").
@@ -68,10 +68,10 @@
68#include <openssl/asn1t.h> 68#include <openssl/asn1t.h>
69#include <openssl/bn.h> 69#include <openssl/bn.h>
70#include <openssl/conf.h> 70#include <openssl/conf.h>
71#include <openssl/err.h>
72#include <openssl/x509.h> 71#include <openssl/x509.h>
73#include <openssl/x509v3.h> 72#include <openssl/x509v3.h>
74 73
74#include "err_local.h"
75#include "x509_local.h" 75#include "x509_local.h"
76 76
77#ifndef OPENSSL_NO_RFC3779 77#ifndef OPENSSL_NO_RFC3779
diff --git a/src/lib/libcrypto/x509/x509_att.c b/src/lib/libcrypto/x509/x509_att.c
index 4931cbbc17..a442a17746 100644
--- a/src/lib/libcrypto/x509/x509_att.c
+++ b/src/lib/libcrypto/x509/x509_att.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_att.c,v 1.25 2024/08/31 10:46:40 tb Exp $ */ 1/* $OpenBSD: x509_att.c,v 1.26 2025/05/10 05:54:39 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -59,13 +59,13 @@
59#include <stdio.h> 59#include <stdio.h>
60 60
61#include <openssl/asn1.h> 61#include <openssl/asn1.h>
62#include <openssl/err.h>
63#include <openssl/evp.h> 62#include <openssl/evp.h>
64#include <openssl/objects.h> 63#include <openssl/objects.h>
65#include <openssl/stack.h> 64#include <openssl/stack.h>
66#include <openssl/x509.h> 65#include <openssl/x509.h>
67#include <openssl/x509v3.h> 66#include <openssl/x509v3.h>
68 67
68#include "err_local.h"
69#include "x509_local.h" 69#include "x509_local.h"
70 70
71int 71int
diff --git a/src/lib/libcrypto/x509/x509_bcons.c b/src/lib/libcrypto/x509/x509_bcons.c
index 99cb5afe9a..c10f822ccc 100644
--- a/src/lib/libcrypto/x509/x509_bcons.c
+++ b/src/lib/libcrypto/x509/x509_bcons.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_bcons.c,v 1.6 2024/08/31 10:03:03 tb Exp $ */ 1/* $OpenBSD: x509_bcons.c,v 1.7 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -62,9 +62,9 @@
62#include <openssl/asn1.h> 62#include <openssl/asn1.h>
63#include <openssl/asn1t.h> 63#include <openssl/asn1t.h>
64#include <openssl/conf.h> 64#include <openssl/conf.h>
65#include <openssl/err.h>
66#include <openssl/x509v3.h> 65#include <openssl/x509v3.h>
67 66
67#include "err_local.h"
68#include "x509_local.h" 68#include "x509_local.h"
69 69
70static STACK_OF(CONF_VALUE) *i2v_BASIC_CONSTRAINTS(X509V3_EXT_METHOD *method, 70static STACK_OF(CONF_VALUE) *i2v_BASIC_CONSTRAINTS(X509V3_EXT_METHOD *method,
diff --git a/src/lib/libcrypto/x509/x509_bitst.c b/src/lib/libcrypto/x509/x509_bitst.c
index 2bc4f9911a..89289b7af0 100644
--- a/src/lib/libcrypto/x509/x509_bitst.c
+++ b/src/lib/libcrypto/x509/x509_bitst.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_bitst.c,v 1.8 2024/08/31 10:23:13 tb Exp $ */ 1/* $OpenBSD: x509_bitst.c,v 1.9 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -60,9 +60,9 @@
60#include <string.h> 60#include <string.h>
61 61
62#include <openssl/conf.h> 62#include <openssl/conf.h>
63#include <openssl/err.h>
64#include <openssl/x509v3.h> 63#include <openssl/x509v3.h>
65 64
65#include "err_local.h"
66#include "x509_local.h" 66#include "x509_local.h"
67 67
68static const BIT_STRING_BITNAME ns_cert_type_table[] = { 68static const BIT_STRING_BITNAME ns_cert_type_table[] = {
diff --git a/src/lib/libcrypto/x509/x509_cmp.c b/src/lib/libcrypto/x509/x509_cmp.c
index 2c1e427093..2479dcdd0d 100644
--- a/src/lib/libcrypto/x509/x509_cmp.c
+++ b/src/lib/libcrypto/x509/x509_cmp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_cmp.c,v 1.44 2024/03/25 03:41:16 joshua Exp $ */ 1/* $OpenBSD: x509_cmp.c,v 1.45 2025/05/10 05:54:39 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -63,11 +63,11 @@
63#include <openssl/opensslconf.h> 63#include <openssl/opensslconf.h>
64 64
65#include <openssl/asn1.h> 65#include <openssl/asn1.h>
66#include <openssl/err.h>
67#include <openssl/objects.h> 66#include <openssl/objects.h>
68#include <openssl/x509.h> 67#include <openssl/x509.h>
69#include <openssl/x509v3.h> 68#include <openssl/x509v3.h>
70 69
70#include "err_local.h"
71#include "evp_local.h" 71#include "evp_local.h"
72#include "x509_local.h" 72#include "x509_local.h"
73 73
diff --git a/src/lib/libcrypto/x509/x509_conf.c b/src/lib/libcrypto/x509/x509_conf.c
index e5b18c2f77..2089f72bc7 100644
--- a/src/lib/libcrypto/x509/x509_conf.c
+++ b/src/lib/libcrypto/x509/x509_conf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_conf.c,v 1.29 2025/03/06 07:20:01 tb Exp $ */ 1/* $OpenBSD: x509_conf.c,v 1.31 2025/06/02 12:18:21 jsg Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -62,11 +62,11 @@
62#include <string.h> 62#include <string.h>
63 63
64#include <openssl/conf.h> 64#include <openssl/conf.h>
65#include <openssl/err.h>
66#include <openssl/x509.h> 65#include <openssl/x509.h>
67#include <openssl/x509v3.h> 66#include <openssl/x509v3.h>
68 67
69#include "conf_local.h" 68#include "conf_local.h"
69#include "err_local.h"
70#include "x509_local.h" 70#include "x509_local.h"
71 71
72static int v3_check_critical(const char **value); 72static int v3_check_critical(const char **value);
@@ -242,8 +242,9 @@ v3_check_critical(const char **value)
242 if ((strlen(p) < 9) || strncmp(p, "critical,", 9)) 242 if ((strlen(p) < 9) || strncmp(p, "critical,", 9))
243 return 0; 243 return 0;
244 p += 9; 244 p += 9;
245 while (isspace((unsigned char)*p)) p++; 245 while (isspace((unsigned char)*p))
246 *value = p; 246 p++;
247 *value = p;
247 return 1; 248 return 1;
248} 249}
249 250
diff --git a/src/lib/libcrypto/x509/x509_cpols.c b/src/lib/libcrypto/x509/x509_cpols.c
index 6bae2a0482..b6a456023f 100644
--- a/src/lib/libcrypto/x509/x509_cpols.c
+++ b/src/lib/libcrypto/x509/x509_cpols.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_cpols.c,v 1.15 2025/03/06 07:20:01 tb Exp $ */ 1/* $OpenBSD: x509_cpols.c,v 1.16 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -62,9 +62,9 @@
62#include <openssl/asn1.h> 62#include <openssl/asn1.h>
63#include <openssl/asn1t.h> 63#include <openssl/asn1t.h>
64#include <openssl/conf.h> 64#include <openssl/conf.h>
65#include <openssl/err.h>
66#include <openssl/x509v3.h> 65#include <openssl/x509v3.h>
67 66
67#include "err_local.h"
68#include "x509_local.h" 68#include "x509_local.h"
69 69
70/* Certificate policies extension support: this one is a bit complex... */ 70/* Certificate policies extension support: this one is a bit complex... */
diff --git a/src/lib/libcrypto/x509/x509_crld.c b/src/lib/libcrypto/x509/x509_crld.c
index 81f2010df5..75afcefca8 100644
--- a/src/lib/libcrypto/x509/x509_crld.c
+++ b/src/lib/libcrypto/x509/x509_crld.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_crld.c,v 1.9 2025/03/06 07:20:01 tb Exp $ */ 1/* $OpenBSD: x509_crld.c,v 1.10 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -62,9 +62,9 @@
62#include <openssl/asn1.h> 62#include <openssl/asn1.h>
63#include <openssl/asn1t.h> 63#include <openssl/asn1t.h>
64#include <openssl/conf.h> 64#include <openssl/conf.h>
65#include <openssl/err.h>
66#include <openssl/x509v3.h> 65#include <openssl/x509v3.h>
67 66
67#include "err_local.h"
68#include "x509_local.h" 68#include "x509_local.h"
69 69
70static void *v2i_crld(const X509V3_EXT_METHOD *method, 70static void *v2i_crld(const X509V3_EXT_METHOD *method,
diff --git a/src/lib/libcrypto/x509/x509_extku.c b/src/lib/libcrypto/x509/x509_extku.c
index da5036a09a..35460ca46b 100644
--- a/src/lib/libcrypto/x509/x509_extku.c
+++ b/src/lib/libcrypto/x509/x509_extku.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_extku.c,v 1.6 2024/08/31 10:03:03 tb Exp $ */ 1/* $OpenBSD: x509_extku.c,v 1.7 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -60,9 +60,9 @@
60 60
61#include <openssl/asn1t.h> 61#include <openssl/asn1t.h>
62#include <openssl/conf.h> 62#include <openssl/conf.h>
63#include <openssl/err.h>
64#include <openssl/x509v3.h> 63#include <openssl/x509v3.h>
65 64
65#include "err_local.h"
66#include "x509_local.h" 66#include "x509_local.h"
67 67
68static void *v2i_EXTENDED_KEY_USAGE(const X509V3_EXT_METHOD *method, 68static void *v2i_EXTENDED_KEY_USAGE(const X509V3_EXT_METHOD *method,
diff --git a/src/lib/libcrypto/x509/x509_genn.c b/src/lib/libcrypto/x509/x509_genn.c
index 1ea7155795..5214c394ed 100644
--- a/src/lib/libcrypto/x509/x509_genn.c
+++ b/src/lib/libcrypto/x509/x509_genn.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_genn.c,v 1.7 2024/07/08 14:47:44 beck Exp $ */ 1/* $OpenBSD: x509_genn.c,v 1.8 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -63,6 +63,8 @@
63#include <openssl/conf.h> 63#include <openssl/conf.h>
64#include <openssl/x509v3.h> 64#include <openssl/x509v3.h>
65 65
66#include "err_local.h"
67
66static const ASN1_TEMPLATE OTHERNAME_seq_tt[] = { 68static const ASN1_TEMPLATE OTHERNAME_seq_tt[] = {
67 { 69 {
68 .flags = 0, 70 .flags = 0,
diff --git a/src/lib/libcrypto/x509/x509_ia5.c b/src/lib/libcrypto/x509/x509_ia5.c
index 4f62a9134c..b8886c6cb8 100644
--- a/src/lib/libcrypto/x509/x509_ia5.c
+++ b/src/lib/libcrypto/x509/x509_ia5.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_ia5.c,v 1.2 2024/07/13 15:08:58 tb Exp $ */ 1/* $OpenBSD: x509_ia5.c,v 1.3 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -61,9 +61,10 @@
61 61
62#include <openssl/asn1.h> 62#include <openssl/asn1.h>
63#include <openssl/conf.h> 63#include <openssl/conf.h>
64#include <openssl/err.h>
65#include <openssl/x509v3.h> 64#include <openssl/x509v3.h>
66 65
66#include "err_local.h"
67
67static char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5); 68static char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5);
68static ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, 69static ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method,
69 X509V3_CTX *ctx, char *str); 70 X509V3_CTX *ctx, char *str);
diff --git a/src/lib/libcrypto/x509/x509_info.c b/src/lib/libcrypto/x509/x509_info.c
index d1de346ee6..c91642a02e 100644
--- a/src/lib/libcrypto/x509/x509_info.c
+++ b/src/lib/libcrypto/x509/x509_info.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_info.c,v 1.5 2024/07/13 15:08:58 tb Exp $ */ 1/* $OpenBSD: x509_info.c,v 1.6 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -62,9 +62,10 @@
62#include <openssl/asn1.h> 62#include <openssl/asn1.h>
63#include <openssl/asn1t.h> 63#include <openssl/asn1t.h>
64#include <openssl/conf.h> 64#include <openssl/conf.h>
65#include <openssl/err.h>
66#include <openssl/x509v3.h> 65#include <openssl/x509v3.h>
67 66
67#include "err_local.h"
68
68static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS( 69static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(
69 X509V3_EXT_METHOD *method, AUTHORITY_INFO_ACCESS *ainfo, 70 X509V3_EXT_METHOD *method, AUTHORITY_INFO_ACCESS *ainfo,
70 STACK_OF(CONF_VALUE) *ret); 71 STACK_OF(CONF_VALUE) *ret);
diff --git a/src/lib/libcrypto/x509/x509_lib.c b/src/lib/libcrypto/x509/x509_lib.c
index 6fa66ab88e..0285ac0d3a 100644
--- a/src/lib/libcrypto/x509/x509_lib.c
+++ b/src/lib/libcrypto/x509/x509_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_lib.c,v 1.24 2024/07/13 15:08:58 tb Exp $ */ 1/* $OpenBSD: x509_lib.c,v 1.25 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -60,9 +60,9 @@
60#include <stdio.h> 60#include <stdio.h>
61 61
62#include <openssl/conf.h> 62#include <openssl/conf.h>
63#include <openssl/err.h>
64#include <openssl/x509v3.h> 63#include <openssl/x509v3.h>
65 64
65#include "err_local.h"
66#include "x509_local.h" 66#include "x509_local.h"
67 67
68const X509V3_EXT_METHOD * 68const X509V3_EXT_METHOD *
diff --git a/src/lib/libcrypto/x509/x509_lu.c b/src/lib/libcrypto/x509/x509_lu.c
index 0367794fca..1ac3436a6e 100644
--- a/src/lib/libcrypto/x509/x509_lu.c
+++ b/src/lib/libcrypto/x509/x509_lu.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_lu.c,v 1.67 2025/03/09 15:20:20 tb Exp $ */ 1/* $OpenBSD: x509_lu.c,v 1.68 2025/05/10 05:54:39 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -59,11 +59,11 @@
59#include <stdio.h> 59#include <stdio.h>
60#include <string.h> 60#include <string.h>
61 61
62#include <openssl/err.h>
63#include <openssl/lhash.h> 62#include <openssl/lhash.h>
64#include <openssl/x509.h> 63#include <openssl/x509.h>
65#include <openssl/x509v3.h> 64#include <openssl/x509v3.h>
66 65
66#include "err_local.h"
67#include "x509_local.h" 67#include "x509_local.h"
68 68
69static int X509_OBJECT_up_ref_count(X509_OBJECT *a); 69static int X509_OBJECT_up_ref_count(X509_OBJECT *a);
diff --git a/src/lib/libcrypto/x509/x509_ncons.c b/src/lib/libcrypto/x509/x509_ncons.c
index 148a66e887..f197488d70 100644
--- a/src/lib/libcrypto/x509/x509_ncons.c
+++ b/src/lib/libcrypto/x509/x509_ncons.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_ncons.c,v 1.11 2024/07/13 15:08:58 tb Exp $ */ 1/* $OpenBSD: x509_ncons.c,v 1.12 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -61,9 +61,9 @@
61 61
62#include <openssl/asn1t.h> 62#include <openssl/asn1t.h>
63#include <openssl/conf.h> 63#include <openssl/conf.h>
64#include <openssl/err.h>
65#include <openssl/x509v3.h> 64#include <openssl/x509v3.h>
66 65
66#include "err_local.h"
67#include "x509_local.h" 67#include "x509_local.h"
68 68
69static void *v2i_NAME_CONSTRAINTS(const X509V3_EXT_METHOD *method, 69static void *v2i_NAME_CONSTRAINTS(const X509V3_EXT_METHOD *method,
diff --git a/src/lib/libcrypto/x509/x509_ocsp.c b/src/lib/libcrypto/x509/x509_ocsp.c
index 6531b4c420..d0a0d49890 100644
--- a/src/lib/libcrypto/x509/x509_ocsp.c
+++ b/src/lib/libcrypto/x509/x509_ocsp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_ocsp.c,v 1.4 2024/12/24 09:14:33 schwarze Exp $ */ 1/* $OpenBSD: x509_ocsp.c,v 1.5 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -65,10 +65,10 @@
65 65
66#include <openssl/asn1.h> 66#include <openssl/asn1.h>
67#include <openssl/conf.h> 67#include <openssl/conf.h>
68#include <openssl/err.h>
69#include <openssl/ocsp.h> 68#include <openssl/ocsp.h>
70#include <openssl/x509v3.h> 69#include <openssl/x509v3.h>
71 70
71#include "err_local.h"
72#include "ocsp_local.h" 72#include "ocsp_local.h"
73 73
74/* OCSP extensions and a couple of CRL entry extensions 74/* OCSP extensions and a couple of CRL entry extensions
diff --git a/src/lib/libcrypto/x509/x509_pcons.c b/src/lib/libcrypto/x509/x509_pcons.c
index 66dc57abf6..404fa28724 100644
--- a/src/lib/libcrypto/x509/x509_pcons.c
+++ b/src/lib/libcrypto/x509/x509_pcons.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_pcons.c,v 1.6 2024/08/31 10:03:03 tb Exp $ */ 1/* $OpenBSD: x509_pcons.c,v 1.7 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -62,9 +62,9 @@
62#include <openssl/asn1.h> 62#include <openssl/asn1.h>
63#include <openssl/asn1t.h> 63#include <openssl/asn1t.h>
64#include <openssl/conf.h> 64#include <openssl/conf.h>
65#include <openssl/err.h>
66#include <openssl/x509v3.h> 65#include <openssl/x509v3.h>
67 66
67#include "err_local.h"
68#include "x509_local.h" 68#include "x509_local.h"
69 69
70static STACK_OF(CONF_VALUE) * 70static STACK_OF(CONF_VALUE) *
diff --git a/src/lib/libcrypto/x509/x509_pmaps.c b/src/lib/libcrypto/x509/x509_pmaps.c
index 5039f65f2e..141a3a6f90 100644
--- a/src/lib/libcrypto/x509/x509_pmaps.c
+++ b/src/lib/libcrypto/x509/x509_pmaps.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_pmaps.c,v 1.6 2024/08/31 10:03:03 tb Exp $ */ 1/* $OpenBSD: x509_pmaps.c,v 1.7 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -61,9 +61,9 @@
61 61
62#include <openssl/asn1t.h> 62#include <openssl/asn1t.h>
63#include <openssl/conf.h> 63#include <openssl/conf.h>
64#include <openssl/err.h>
65#include <openssl/x509v3.h> 64#include <openssl/x509v3.h>
66 65
66#include "err_local.h"
67#include "x509_local.h" 67#include "x509_local.h"
68 68
69static void *v2i_POLICY_MAPPINGS(const X509V3_EXT_METHOD *method, 69static void *v2i_POLICY_MAPPINGS(const X509V3_EXT_METHOD *method,
diff --git a/src/lib/libcrypto/x509/x509_policy.c b/src/lib/libcrypto/x509/x509_policy.c
index 4321a9669d..8267e8dc49 100644
--- a/src/lib/libcrypto/x509/x509_policy.c
+++ b/src/lib/libcrypto/x509/x509_policy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_policy.c,v 1.29 2025/01/06 17:42:39 tb Exp $ */ 1/* $OpenBSD: x509_policy.c,v 1.32 2025/05/10 05:54:39 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2022, Google Inc. 3 * Copyright (c) 2022, Google Inc.
4 * 4 *
@@ -17,12 +17,12 @@
17 17
18#include <string.h> 18#include <string.h>
19 19
20#include <openssl/err.h>
21#include <openssl/objects.h> 20#include <openssl/objects.h>
22#include <openssl/stack.h> 21#include <openssl/stack.h>
23#include <openssl/x509.h> 22#include <openssl/x509.h>
24#include <openssl/x509v3.h> 23#include <openssl/x509v3.h>
25 24
25#include "err_local.h"
26#include "stack_local.h" 26#include "stack_local.h"
27#include "x509_internal.h" 27#include "x509_internal.h"
28#include "x509_local.h" 28#include "x509_local.h"
@@ -498,7 +498,7 @@ delete_if_mapped(X509_POLICY_NODE *node, void *data)
498 * with P1 in |parent_policies|. 498 * with P1 in |parent_policies|.
499 * 499 *
500 * This is equivalent to the |X509_POLICY_LEVEL| that would result if the next 500 * This is equivalent to the |X509_POLICY_LEVEL| that would result if the next
501 * certificats contained anyPolicy. |process_certificate_policies| will filter 501 * certificate contained anyPolicy. |process_certificate_policies| will filter
502 * this result down to compute the actual level. 502 * this result down to compute the actual level.
503 */ 503 */
504static X509_POLICY_LEVEL * 504static X509_POLICY_LEVEL *
diff --git a/src/lib/libcrypto/x509/x509_prn.c b/src/lib/libcrypto/x509/x509_prn.c
index 3bf7c803e5..23c649a7b9 100644
--- a/src/lib/libcrypto/x509/x509_prn.c
+++ b/src/lib/libcrypto/x509/x509_prn.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_prn.c,v 1.6 2023/05/08 05:30:38 tb Exp $ */ 1/* $OpenBSD: x509_prn.c,v 1.7 2025/06/02 12:18:22 jsg Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -87,8 +87,9 @@ X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, int ml)
87 for (i = 0; i < sk_CONF_VALUE_num(val); i++) { 87 for (i = 0; i < sk_CONF_VALUE_num(val); i++) {
88 if (ml) 88 if (ml)
89 BIO_printf(out, "%*s", indent, ""); 89 BIO_printf(out, "%*s", indent, "");
90 else if (i > 0) BIO_printf(out, ", "); 90 else if (i > 0)
91 nval = sk_CONF_VALUE_value(val, i); 91 BIO_printf(out, ", ");
92 nval = sk_CONF_VALUE_value(val, i);
92 if (!nval->name) 93 if (!nval->name)
93 BIO_puts(out, nval->value); 94 BIO_puts(out, nval->value);
94 else if (!nval->value) 95 else if (!nval->value)
diff --git a/src/lib/libcrypto/x509/x509_purp.c b/src/lib/libcrypto/x509/x509_purp.c
index 619a4b890a..36dfe6abee 100644
--- a/src/lib/libcrypto/x509/x509_purp.c
+++ b/src/lib/libcrypto/x509/x509_purp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_purp.c,v 1.43 2024/07/12 18:15:10 beck Exp $ */ 1/* $OpenBSD: x509_purp.c,v 1.44 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2001. 3 * project 2001.
4 */ 4 */
@@ -61,7 +61,6 @@
61 61
62#include <openssl/opensslconf.h> 62#include <openssl/opensslconf.h>
63 63
64#include <openssl/err.h>
65#include <openssl/x509v3.h> 64#include <openssl/x509v3.h>
66#include <openssl/x509_vfy.h> 65#include <openssl/x509_vfy.h>
67 66
diff --git a/src/lib/libcrypto/x509/x509_r2x.c b/src/lib/libcrypto/x509/x509_r2x.c
index 39b392259b..4ca8a87935 100644
--- a/src/lib/libcrypto/x509/x509_r2x.c
+++ b/src/lib/libcrypto/x509/x509_r2x.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_r2x.c,v 1.17 2023/04/25 09:46:36 job Exp $ */ 1/* $OpenBSD: x509_r2x.c,v 1.18 2025/05/10 05:54:39 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -61,11 +61,11 @@
61#include <openssl/asn1.h> 61#include <openssl/asn1.h>
62#include <openssl/bn.h> 62#include <openssl/bn.h>
63#include <openssl/buffer.h> 63#include <openssl/buffer.h>
64#include <openssl/err.h>
65#include <openssl/evp.h> 64#include <openssl/evp.h>
66#include <openssl/objects.h> 65#include <openssl/objects.h>
67#include <openssl/x509.h> 66#include <openssl/x509.h>
68 67
68#include "err_local.h"
69#include "x509_local.h" 69#include "x509_local.h"
70 70
71X509 * 71X509 *
diff --git a/src/lib/libcrypto/x509/x509_req.c b/src/lib/libcrypto/x509/x509_req.c
index 704acbd897..df1119a55c 100644
--- a/src/lib/libcrypto/x509/x509_req.c
+++ b/src/lib/libcrypto/x509/x509_req.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_req.c,v 1.43 2024/08/31 10:16:52 tb Exp $ */ 1/* $OpenBSD: x509_req.c,v 1.44 2025/05/10 05:54:39 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -64,13 +64,13 @@
64#include <openssl/asn1t.h> 64#include <openssl/asn1t.h>
65#include <openssl/bn.h> 65#include <openssl/bn.h>
66#include <openssl/buffer.h> 66#include <openssl/buffer.h>
67#include <openssl/err.h>
68#include <openssl/evp.h> 67#include <openssl/evp.h>
69#include <openssl/objects.h> 68#include <openssl/objects.h>
70#include <openssl/pem.h> 69#include <openssl/pem.h>
71#include <openssl/x509.h> 70#include <openssl/x509.h>
72 71
73#include "asn1_local.h" 72#include "asn1_local.h"
73#include "err_local.h"
74#include "evp_local.h" 74#include "evp_local.h"
75#include "x509_local.h" 75#include "x509_local.h"
76 76
diff --git a/src/lib/libcrypto/x509/x509_skey.c b/src/lib/libcrypto/x509/x509_skey.c
index d2c90b6f1c..e9e915a0c7 100644
--- a/src/lib/libcrypto/x509/x509_skey.c
+++ b/src/lib/libcrypto/x509/x509_skey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_skey.c,v 1.6 2024/07/13 15:08:58 tb Exp $ */ 1/* $OpenBSD: x509_skey.c,v 1.7 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -59,9 +59,9 @@
59#include <stdio.h> 59#include <stdio.h>
60#include <string.h> 60#include <string.h>
61 61
62#include <openssl/err.h>
63#include <openssl/x509v3.h> 62#include <openssl/x509v3.h>
64 63
64#include "err_local.h"
65#include "x509_local.h" 65#include "x509_local.h"
66 66
67static ASN1_OCTET_STRING *s2i_skey_id(X509V3_EXT_METHOD *method, 67static ASN1_OCTET_STRING *s2i_skey_id(X509V3_EXT_METHOD *method,
diff --git a/src/lib/libcrypto/x509/x509_utl.c b/src/lib/libcrypto/x509/x509_utl.c
index 08383849c9..4be8630d89 100644
--- a/src/lib/libcrypto/x509/x509_utl.c
+++ b/src/lib/libcrypto/x509/x509_utl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_utl.c,v 1.26 2025/01/26 13:51:41 tb Exp $ */ 1/* $OpenBSD: x509_utl.c,v 1.27 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -64,11 +64,11 @@
64#include <openssl/asn1.h> 64#include <openssl/asn1.h>
65#include <openssl/bn.h> 65#include <openssl/bn.h>
66#include <openssl/conf.h> 66#include <openssl/conf.h>
67#include <openssl/err.h>
68#include <openssl/x509v3.h> 67#include <openssl/x509v3.h>
69 68
70#include "bytestring.h" 69#include "bytestring.h"
71#include "conf_local.h" 70#include "conf_local.h"
71#include "err_local.h"
72 72
73/* 73/*
74 * Match reference identifiers starting with "." to any sub-domain. This 74 * Match reference identifiers starting with "." to any sub-domain. This
diff --git a/src/lib/libcrypto/x509/x509_v3.c b/src/lib/libcrypto/x509/x509_v3.c
index 688aed15a2..ee14d2dcef 100644
--- a/src/lib/libcrypto/x509/x509_v3.c
+++ b/src/lib/libcrypto/x509/x509_v3.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_v3.c,v 1.43 2024/07/12 09:57:04 tb Exp $ */ 1/* $OpenBSD: x509_v3.c,v 1.44 2025/05/10 05:54:39 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -59,12 +59,12 @@
59#include <stdio.h> 59#include <stdio.h>
60 60
61#include <openssl/asn1.h> 61#include <openssl/asn1.h>
62#include <openssl/err.h>
63#include <openssl/objects.h> 62#include <openssl/objects.h>
64#include <openssl/stack.h> 63#include <openssl/stack.h>
65#include <openssl/x509.h> 64#include <openssl/x509.h>
66#include <openssl/x509v3.h> 65#include <openssl/x509v3.h>
67 66
67#include "err_local.h"
68#include "x509_local.h" 68#include "x509_local.h"
69 69
70int 70int
diff --git a/src/lib/libcrypto/x509/x509_vfy.c b/src/lib/libcrypto/x509/x509_vfy.c
index c93ae81bd8..3d0abda615 100644
--- a/src/lib/libcrypto/x509/x509_vfy.c
+++ b/src/lib/libcrypto/x509/x509_vfy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_vfy.c,v 1.147 2025/03/04 08:43:25 tb Exp $ */ 1/* $OpenBSD: x509_vfy.c,v 1.148 2025/05/10 05:54:39 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -67,7 +67,6 @@
67#include <openssl/asn1.h> 67#include <openssl/asn1.h>
68#include <openssl/buffer.h> 68#include <openssl/buffer.h>
69#include <openssl/crypto.h> 69#include <openssl/crypto.h>
70#include <openssl/err.h>
71#include <openssl/evp.h> 70#include <openssl/evp.h>
72#include <openssl/lhash.h> 71#include <openssl/lhash.h>
73#include <openssl/objects.h> 72#include <openssl/objects.h>
@@ -75,6 +74,7 @@
75#include <openssl/x509v3.h> 74#include <openssl/x509v3.h>
76 75
77#include "asn1_local.h" 76#include "asn1_local.h"
77#include "err_local.h"
78#include "x509_internal.h" 78#include "x509_internal.h"
79#include "x509_issuer_cache.h" 79#include "x509_issuer_cache.h"
80#include "x509_local.h" 80#include "x509_local.h"
diff --git a/src/lib/libcrypto/x509/x509_vpm.c b/src/lib/libcrypto/x509/x509_vpm.c
index 4b333e2a2d..19091b12aa 100644
--- a/src/lib/libcrypto/x509/x509_vpm.c
+++ b/src/lib/libcrypto/x509/x509_vpm.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_vpm.c,v 1.47 2025/03/12 04:58:04 tb Exp $ */ 1/* $OpenBSD: x509_vpm.c,v 1.56 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2004. 3 * project 2004.
4 */ 4 */
@@ -61,12 +61,12 @@
61 61
62#include <openssl/buffer.h> 62#include <openssl/buffer.h>
63#include <openssl/crypto.h> 63#include <openssl/crypto.h>
64#include <openssl/err.h>
65#include <openssl/lhash.h> 64#include <openssl/lhash.h>
66#include <openssl/stack.h> 65#include <openssl/stack.h>
67#include <openssl/x509.h> 66#include <openssl/x509.h>
68#include <openssl/x509v3.h> 67#include <openssl/x509v3.h>
69 68
69#include "err_local.h"
70#include "x509_local.h" 70#include "x509_local.h"
71 71
72/* X509_VERIFY_PARAM functions */ 72/* X509_VERIFY_PARAM functions */
@@ -113,7 +113,7 @@ sk_OPENSSL_STRING_deep_copy(const STACK_OF(OPENSSL_STRING) *sk)
113} 113}
114 114
115static int 115static int
116x509_param_set_hosts_internal(X509_VERIFY_PARAM *vpm, int mode, 116x509_param_set_hosts_internal(X509_VERIFY_PARAM *param, int mode,
117 const char *name, size_t namelen) 117 const char *name, size_t namelen)
118{ 118{
119 char *copy; 119 char *copy;
@@ -126,9 +126,9 @@ x509_param_set_hosts_internal(X509_VERIFY_PARAM *vpm, int mode,
126 if (name && memchr(name, '\0', namelen)) 126 if (name && memchr(name, '\0', namelen))
127 return 0; 127 return 0;
128 128
129 if (mode == SET_HOST && vpm->hosts) { 129 if (mode == SET_HOST && param->hosts) {
130 sk_OPENSSL_STRING_pop_free(vpm->hosts, str_free); 130 sk_OPENSSL_STRING_pop_free(param->hosts, str_free);
131 vpm->hosts = NULL; 131 param->hosts = NULL;
132 } 132 }
133 if (name == NULL || namelen == 0) 133 if (name == NULL || namelen == 0)
134 return 1; 134 return 1;
@@ -136,17 +136,17 @@ x509_param_set_hosts_internal(X509_VERIFY_PARAM *vpm, int mode,
136 if (copy == NULL) 136 if (copy == NULL)
137 return 0; 137 return 0;
138 138
139 if (vpm->hosts == NULL && 139 if (param->hosts == NULL &&
140 (vpm->hosts = sk_OPENSSL_STRING_new_null()) == NULL) { 140 (param->hosts = sk_OPENSSL_STRING_new_null()) == NULL) {
141 free(copy); 141 free(copy);
142 return 0; 142 return 0;
143 } 143 }
144 144
145 if (!sk_OPENSSL_STRING_push(vpm->hosts, copy)) { 145 if (!sk_OPENSSL_STRING_push(param->hosts, copy)) {
146 free(copy); 146 free(copy);
147 if (sk_OPENSSL_STRING_num(vpm->hosts) == 0) { 147 if (sk_OPENSSL_STRING_num(param->hosts) == 0) {
148 sk_OPENSSL_STRING_free(vpm->hosts); 148 sk_OPENSSL_STRING_free(param->hosts);
149 vpm->hosts = NULL; 149 param->hosts = NULL;
150 } 150 }
151 return 0; 151 return 0;
152 } 152 }
@@ -654,6 +654,8 @@ static const X509_VERIFY_PARAM default_table[] = {
654 } 654 }
655}; 655};
656 656
657#define N_DEFAULT_VERIFY_PARAMS (sizeof(default_table) / sizeof(default_table[0]))
658
657static STACK_OF(X509_VERIFY_PARAM) *param_table = NULL; 659static STACK_OF(X509_VERIFY_PARAM) *param_table = NULL;
658 660
659static int 661static int
@@ -687,9 +689,11 @@ LCRYPTO_ALIAS(X509_VERIFY_PARAM_add0_table);
687int 689int
688X509_VERIFY_PARAM_get_count(void) 690X509_VERIFY_PARAM_get_count(void)
689{ 691{
690 int num = sizeof(default_table) / sizeof(X509_VERIFY_PARAM); 692 int num = N_DEFAULT_VERIFY_PARAMS;
691 if (param_table) 693
694 if (param_table != NULL)
692 num += sk_X509_VERIFY_PARAM_num(param_table); 695 num += sk_X509_VERIFY_PARAM_num(param_table);
696
693 return num; 697 return num;
694} 698}
695LCRYPTO_ALIAS(X509_VERIFY_PARAM_get_count); 699LCRYPTO_ALIAS(X509_VERIFY_PARAM_get_count);
@@ -697,9 +701,14 @@ LCRYPTO_ALIAS(X509_VERIFY_PARAM_get_count);
697const X509_VERIFY_PARAM * 701const X509_VERIFY_PARAM *
698X509_VERIFY_PARAM_get0(int id) 702X509_VERIFY_PARAM_get0(int id)
699{ 703{
700 int num = sizeof(default_table) / sizeof(X509_VERIFY_PARAM); 704 int num = N_DEFAULT_VERIFY_PARAMS;
705
706 if (id < 0)
707 return NULL;
708
701 if (id < num) 709 if (id < num)
702 return default_table + id; 710 return &default_table[id];
711
703 return sk_X509_VERIFY_PARAM_value(param_table, id - num); 712 return sk_X509_VERIFY_PARAM_value(param_table, id - num);
704} 713}
705LCRYPTO_ALIAS(X509_VERIFY_PARAM_get0); 714LCRYPTO_ALIAS(X509_VERIFY_PARAM_get0);
@@ -707,22 +716,20 @@ LCRYPTO_ALIAS(X509_VERIFY_PARAM_get0);
707const X509_VERIFY_PARAM * 716const X509_VERIFY_PARAM *
708X509_VERIFY_PARAM_lookup(const char *name) 717X509_VERIFY_PARAM_lookup(const char *name)
709{ 718{
710 X509_VERIFY_PARAM pm; 719 X509_VERIFY_PARAM param;
711 unsigned int i, limit; 720 size_t i;
721 int idx;
712 722
713 pm.name = (char *)name; 723 memset(&param, 0, sizeof(param));
714 if (param_table) { 724 param.name = (char *)name;
715 size_t idx; 725 if ((idx = sk_X509_VERIFY_PARAM_find(param_table, &param)) != -1)
716 if ((idx = sk_X509_VERIFY_PARAM_find(param_table, &pm)) != -1) 726 return sk_X509_VERIFY_PARAM_value(param_table, idx);
717 return sk_X509_VERIFY_PARAM_value(param_table, idx);
718 }
719 727
720 limit = sizeof(default_table) / sizeof(X509_VERIFY_PARAM); 728 for (i = 0; i < N_DEFAULT_VERIFY_PARAMS; i++) {
721 for (i = 0; i < limit; i++) { 729 if (strcmp(default_table[i].name, name) == 0)
722 if (strcmp(default_table[i].name, name) == 0) {
723 return &default_table[i]; 730 return &default_table[i];
724 }
725 } 731 }
732
726 return NULL; 733 return NULL;
727} 734}
728LCRYPTO_ALIAS(X509_VERIFY_PARAM_lookup); 735LCRYPTO_ALIAS(X509_VERIFY_PARAM_lookup);
diff --git a/src/lib/libcrypto/x509/x509name.c b/src/lib/libcrypto/x509/x509name.c
index d2df06ccc6..9a582d34e4 100644
--- a/src/lib/libcrypto/x509/x509name.c
+++ b/src/lib/libcrypto/x509/x509name.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509name.c,v 1.35 2023/05/29 11:54:50 beck Exp $ */ 1/* $OpenBSD: x509name.c,v 1.36 2025/05/10 05:54:39 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -60,13 +60,13 @@
60#include <string.h> 60#include <string.h>
61 61
62#include <openssl/asn1.h> 62#include <openssl/asn1.h>
63#include <openssl/err.h>
64#include <openssl/evp.h> 63#include <openssl/evp.h>
65#include <openssl/objects.h> 64#include <openssl/objects.h>
66#include <openssl/stack.h> 65#include <openssl/stack.h>
67#include <openssl/x509.h> 66#include <openssl/x509.h>
68 67
69#include "bytestring.h" 68#include "bytestring.h"
69#include "err_local.h"
70#include "x509_local.h" 70#include "x509_local.h"
71 71
72int 72int
diff --git a/src/lib/libcrypto/x509/x509spki.c b/src/lib/libcrypto/x509/x509spki.c
index 04c9a6f01b..ef5f9e34c8 100644
--- a/src/lib/libcrypto/x509/x509spki.c
+++ b/src/lib/libcrypto/x509/x509spki.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509spki.c,v 1.16 2023/02/16 08:38:17 tb Exp $ */ 1/* $OpenBSD: x509spki.c,v 1.17 2025/05/10 05:54:39 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -60,9 +60,10 @@
60#include <stdlib.h> 60#include <stdlib.h>
61#include <string.h> 61#include <string.h>
62 62
63#include <openssl/err.h>
64#include <openssl/x509.h> 63#include <openssl/x509.h>
65 64
65#include "err_local.h"
66
66int 67int
67NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey) 68NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey)
68{ 69{
diff --git a/src/lib/libcrypto/x509/x_all.c b/src/lib/libcrypto/x509/x_all.c
index 5997714061..b5d50ae4ee 100644
--- a/src/lib/libcrypto/x509/x_all.c
+++ b/src/lib/libcrypto/x509/x_all.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x_all.c,v 1.32 2024/06/19 08:00:53 tb Exp $ */ 1/* $OpenBSD: x_all.c,v 1.33 2025/07/10 18:50:23 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -399,7 +399,11 @@ LCRYPTO_ALIAS(i2d_PKCS8PrivateKeyInfo_fp);
399int 399int
400X509_verify(X509 *a, EVP_PKEY *r) 400X509_verify(X509 *a, EVP_PKEY *r)
401{ 401{
402 if (X509_ALGOR_cmp(a->sig_alg, a->cert_info->signature)) 402 /*
403 * The Certificate's signature AlgorithmIdentifier must match the one
404 * inside the TBSCertificate, see RFC 5280, 4.1.1.2, 4.1.2.3.
405 */
406 if (X509_ALGOR_cmp(a->sig_alg, a->cert_info->signature) != 0)
403 return 0; 407 return 0;
404 return ASN1_item_verify(&X509_CINF_it, a->sig_alg, 408 return ASN1_item_verify(&X509_CINF_it, a->sig_alg,
405 a->signature, a->cert_info, r); 409 a->signature, a->cert_info, r);
diff --git a/src/lib/libssl/LICENSE b/src/lib/libssl/LICENSE
index 892e14a450..c41ff4d1ca 100644
--- a/src/lib/libssl/LICENSE
+++ b/src/lib/libssl/LICENSE
@@ -1,7 +1,7 @@
1 1
2 LibReSSL files are retained under the copyright of the authors. New 2 LibreSSL files are retained under the copyright of the authors. New
3 additions are ISC licensed as per OpenBSD's normal licensing policy, 3 additions are ISC licensed as per OpenBSD's normal licensing policy,
4 or are placed in the public domain. 4 or are placed in the public domain.
5 5
6 The OpenSSL code is distributed under the terms of the original OpenSSL 6 The OpenSSL code is distributed under the terms of the original OpenSSL
7 licenses which follow: 7 licenses which follow:
@@ -25,7 +25,7 @@
25 * are met: 25 * are met:
26 * 26 *
27 * 1. Redistributions of source code must retain the above copyright 27 * 1. Redistributions of source code must retain the above copyright
28 * notice, this list of conditions and the following disclaimer. 28 * notice, this list of conditions and the following disclaimer.
29 * 29 *
30 * 2. Redistributions in binary form must reproduce the above copyright 30 * 2. Redistributions in binary form must reproduce the above copyright
31 * notice, this list of conditions and the following disclaimer in 31 * notice, this list of conditions and the following disclaimer in
@@ -80,21 +80,21 @@
80 * This package is an SSL implementation written 80 * This package is an SSL implementation written
81 * by Eric Young (eay@cryptsoft.com). 81 * by Eric Young (eay@cryptsoft.com).
82 * The implementation was written so as to conform with Netscapes SSL. 82 * The implementation was written so as to conform with Netscapes SSL.
83 * 83 *
84 * This library is free for commercial and non-commercial use as long as 84 * This library is free for commercial and non-commercial use as long as
85 * the following conditions are aheared to. The following conditions 85 * the following conditions are aheared to. The following conditions
86 * apply to all code found in this distribution, be it the RC4, RSA, 86 * apply to all code found in this distribution, be it the RC4, RSA,
87 * lhash, DES, etc., code; not just the SSL code. The SSL documentation 87 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
88 * included with this distribution is covered by the same copyright terms 88 * included with this distribution is covered by the same copyright terms
89 * except that the holder is Tim Hudson (tjh@cryptsoft.com). 89 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
90 * 90 *
91 * Copyright remains Eric Young's, and as such any Copyright notices in 91 * Copyright remains Eric Young's, and as such any Copyright notices in
92 * the code are not to be removed. 92 * the code are not to be removed.
93 * If this package is used in a product, Eric Young should be given attribution 93 * If this package is used in a product, Eric Young should be given attribution
94 * as the author of the parts of the library used. 94 * as the author of the parts of the library used.
95 * This can be in the form of a textual message at program startup or 95 * This can be in the form of a textual message at program startup or
96 * in documentation (online or textual) provided with the package. 96 * in documentation (online or textual) provided with the package.
97 * 97 *
98 * Redistribution and use in source and binary forms, with or without 98 * Redistribution and use in source and binary forms, with or without
99 * modification, are permitted provided that the following conditions 99 * modification, are permitted provided that the following conditions
100 * are met: 100 * are met:
@@ -109,10 +109,10 @@
109 * Eric Young (eay@cryptsoft.com)" 109 * Eric Young (eay@cryptsoft.com)"
110 * The word 'cryptographic' can be left out if the rouines from the library 110 * The word 'cryptographic' can be left out if the rouines from the library
111 * being used are not cryptographic related :-). 111 * being used are not cryptographic related :-).
112 * 4. If you include any Windows specific code (or a derivative thereof) from 112 * 4. If you include any Windows specific code (or a derivative thereof) from
113 * the apps directory (application code) you must include an acknowledgement: 113 * the apps directory (application code) you must include an acknowledgement:
114 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 114 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
115 * 115 *
116 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 116 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
117 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 117 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
118 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 118 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -124,7 +124,7 @@
124 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 124 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
125 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 125 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
126 * SUCH DAMAGE. 126 * SUCH DAMAGE.
127 * 127 *
128 * The licence and distribution terms for any publically available version or 128 * The licence and distribution terms for any publically available version or
129 * derivative of this code cannot be changed. i.e. this code cannot simply be 129 * derivative of this code cannot be changed. i.e. this code cannot simply be
130 * copied and put under another distribution licence 130 * copied and put under another distribution licence
diff --git a/src/lib/libssl/bio_ssl.c b/src/lib/libssl/bio_ssl.c
index 6dd1699606..13e4f30539 100644
--- a/src/lib/libssl/bio_ssl.c
+++ b/src/lib/libssl/bio_ssl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_ssl.c,v 1.40 2023/07/19 13:34:33 tb Exp $ */ 1/* $OpenBSD: bio_ssl.c,v 1.41 2025/06/02 12:18:22 jsg Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -229,9 +229,7 @@ ssl_write(BIO *b, const char *out, int outl)
229 229
230 BIO_clear_retry_flags(b); 230 BIO_clear_retry_flags(b);
231 231
232/* ret=SSL_do_handshake(ssl); 232 ret = SSL_write(ssl, out, outl);
233 if (ret > 0) */
234 ret = SSL_write(ssl, out, outl);
235 233
236 switch (SSL_get_error(ssl, ret)) { 234 switch (SSL_get_error(ssl, ret)) {
237 case SSL_ERROR_NONE: 235 case SSL_ERROR_NONE:
diff --git a/src/lib/libssl/bs_ber.c b/src/lib/libssl/bs_ber.c
index ea9fb253be..923ec06f3d 100644
--- a/src/lib/libssl/bs_ber.c
+++ b/src/lib/libssl/bs_ber.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bs_ber.c,v 1.12 2024/05/25 15:14:26 tb Exp $ */ 1/* $OpenBSD: bs_ber.c,v 1.13 2025/03/28 12:13:03 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2014, Google Inc. 3 * Copyright (c) 2014, Google Inc.
4 * 4 *
@@ -161,7 +161,7 @@ cbs_convert_indefinite(CBS *in, CBB *out, char squash_header,
161 * This is a hack, but it sufficies to handle 161 * This is a hack, but it sufficies to handle
162 * NSS's output. If we find an indefinite 162 * NSS's output. If we find an indefinite
163 * length, context-specific tag with a definite, 163 * length, context-specific tag with a definite,
164 * primtive tag inside it, then we assume that 164 * primitive tag inside it, then we assume that
165 * the context-specific tag is implicit and the 165 * the context-specific tag is implicit and the
166 * tags within are fragments of a primitive type 166 * tags within are fragments of a primitive type
167 * that need to be concatenated. 167 * that need to be concatenated.
diff --git a/src/lib/libssl/man/BIO_f_ssl.3 b/src/lib/libssl/man/BIO_f_ssl.3
index 3b74a3d6a4..e23a15e121 100644
--- a/src/lib/libssl/man/BIO_f_ssl.3
+++ b/src/lib/libssl/man/BIO_f_ssl.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_f_ssl.3,v 1.16 2024/01/13 18:37:51 tb Exp $ 1.\" $OpenBSD: BIO_f_ssl.3,v 1.17 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL f672aee4 Feb 9 11:52:40 2016 -0500 2.\" full merge up to: OpenSSL f672aee4 Feb 9 11:52:40 2016 -0500
3.\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 3.\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800
4.\" 4.\"
@@ -50,7 +50,7 @@
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\" 52.\"
53.Dd $Mdocdate: January 13 2024 $ 53.Dd $Mdocdate: June 8 2025 $
54.Dt BIO_F_SSL 3 54.Dt BIO_F_SSL 3
55.Os 55.Os
56.Sh NAME 56.Sh NAME
@@ -69,6 +69,7 @@
69.Nm BIO_do_handshake 69.Nm BIO_do_handshake
70.Nd SSL BIO 70.Nd SSL BIO
71.Sh SYNOPSIS 71.Sh SYNOPSIS
72.Lb libssl libcrypto
72.In openssl/bio.h 73.In openssl/bio.h
73.In openssl/ssl.h 74.In openssl/ssl.h
74.Ft const BIO_METHOD * 75.Ft const BIO_METHOD *
diff --git a/src/lib/libssl/man/DTLSv1_listen.3 b/src/lib/libssl/man/DTLSv1_listen.3
index 047ec0a7ff..bdba1c59b0 100644
--- a/src/lib/libssl/man/DTLSv1_listen.3
+++ b/src/lib/libssl/man/DTLSv1_listen.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: DTLSv1_listen.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: DTLSv1_listen.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL 7795475f Dec 18 13:18:31 2015 -0500 2.\" OpenSSL 7795475f Dec 18 13:18:31 2015 -0500
3.\" 3.\"
4.\" This file was written by Matt Caswell <matt@openssl.org>. 4.\" This file was written by Matt Caswell <matt@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt DTLSV1_LISTEN 3 52.Dt DTLSV1_LISTEN 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm DTLSv1_listen 55.Nm DTLSv1_listen
56.Nd listen for incoming DTLS connections 56.Nd listen for incoming DTLS connections
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libssl libcrypto
58.In openssl/ssl.h 59.In openssl/ssl.h
59.Ft int 60.Ft int
60.Fo DTLSv1_listen 61.Fo DTLSv1_listen
diff --git a/src/lib/libssl/man/OPENSSL_init_ssl.3 b/src/lib/libssl/man/OPENSSL_init_ssl.3
index f37dccfaac..ec840f5e1c 100644
--- a/src/lib/libssl/man/OPENSSL_init_ssl.3
+++ b/src/lib/libssl/man/OPENSSL_init_ssl.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: OPENSSL_init_ssl.3,v 1.4 2019/06/14 13:41:31 schwarze Exp $ 1.\" $OpenBSD: OPENSSL_init_ssl.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $
2.\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org> 2.\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org>
3.\" 3.\"
4.\" Permission to use, copy, modify, and distribute this software for any 4.\" Permission to use, copy, modify, and distribute this software for any
@@ -13,13 +13,14 @@
13.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15.\" 15.\"
16.Dd $Mdocdate: June 14 2019 $ 16.Dd $Mdocdate: June 8 2025 $
17.Dt OPENSSL_INIT_SSL 3 17.Dt OPENSSL_INIT_SSL 3
18.Os 18.Os
19.Sh NAME 19.Sh NAME
20.Nm OPENSSL_init_ssl 20.Nm OPENSSL_init_ssl
21.Nd initialise the crypto and ssl libraries 21.Nd initialise the crypto and ssl libraries
22.Sh SYNOPSIS 22.Sh SYNOPSIS
23.Lb libssl libcrypto
23.In openssl/ssl.h 24.In openssl/ssl.h
24.Ft int 25.Ft int
25.Fo OPENSSL_init_ssl 26.Fo OPENSSL_init_ssl
diff --git a/src/lib/libssl/man/PEM_read_SSL_SESSION.3 b/src/lib/libssl/man/PEM_read_SSL_SESSION.3
index 3eb1414c62..93bd0b8ebd 100644
--- a/src/lib/libssl/man/PEM_read_SSL_SESSION.3
+++ b/src/lib/libssl/man/PEM_read_SSL_SESSION.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PEM_read_SSL_SESSION.3,v 1.4 2019/06/12 09:36:30 schwarze Exp $ 1.\" $OpenBSD: PEM_read_SSL_SESSION.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL doc/man3/PEM_read_CMS.pod b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL doc/man3/PEM_read_CMS.pod b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Rich Salz <rsalz@openssl.org>. 4.\" This file was written by Rich Salz <rsalz@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 12 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt PEM_READ_SSL_SESSION 3 52.Dt PEM_READ_SSL_SESSION 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -58,6 +58,7 @@
58.Nm PEM_write_bio_SSL_SESSION 58.Nm PEM_write_bio_SSL_SESSION
59.Nd encode and decode SSL session objects in PEM format 59.Nd encode and decode SSL session objects in PEM format
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libssl libcrypto
61.In openssl/ssl.h 62.In openssl/ssl.h
62.Ft SSL_SESSION * 63.Ft SSL_SESSION *
63.Fo PEM_read_SSL_SESSION 64.Fo PEM_read_SSL_SESSION
diff --git a/src/lib/libssl/man/SSL_CIPHER_get_name.3 b/src/lib/libssl/man/SSL_CIPHER_get_name.3
index 86c1d3c0ba..fc92eb9723 100644
--- a/src/lib/libssl/man/SSL_CIPHER_get_name.3
+++ b/src/lib/libssl/man/SSL_CIPHER_get_name.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CIPHER_get_name.3,v 1.17 2024/07/16 10:19:38 tb Exp $ 1.\" $OpenBSD: SSL_CIPHER_get_name.3,v 1.19 2025/06/13 18:34:00 schwarze Exp $
2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 3.\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800
4.\" 4.\"
@@ -52,7 +52,7 @@
52.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 52.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
53.\" OF THE POSSIBILITY OF SUCH DAMAGE. 53.\" OF THE POSSIBILITY OF SUCH DAMAGE.
54.\" 54.\"
55.Dd $Mdocdate: July 16 2024 $ 55.Dd $Mdocdate: June 13 2025 $
56.Dt SSL_CIPHER_GET_NAME 3 56.Dt SSL_CIPHER_GET_NAME 3
57.Os 57.Os
58.Sh NAME 58.Sh NAME
@@ -70,6 +70,7 @@
70.Nm SSL_CIPHER_description 70.Nm SSL_CIPHER_description
71.Nd get SSL_CIPHER properties 71.Nd get SSL_CIPHER properties
72.Sh SYNOPSIS 72.Sh SYNOPSIS
73.Lb libssl libcrypto
73.In openssl/ssl.h 74.In openssl/ssl.h
74.Ft const char * 75.Ft const char *
75.Fn SSL_CIPHER_get_name "const SSL_CIPHER *cipher" 76.Fn SSL_CIPHER_get_name "const SSL_CIPHER *cipher"
@@ -81,7 +82,7 @@
81.Fn SSL_CIPHER_get_cipher_nid "const SSL_CIPHER *cipher" 82.Fn SSL_CIPHER_get_cipher_nid "const SSL_CIPHER *cipher"
82.Ft int 83.Ft int
83.Fn SSL_CIPHER_get_digest_nid "const SSL_CIPHER *cipher" 84.Fn SSL_CIPHER_get_digest_nid "const SSL_CIPHER *cipher"
84.Ft "const EVP_MD *" 85.Ft const EVP_MD *
85.Fn SSL_CIPHER_get_handshake_digest "const SSL_CIPHER *cipher" 86.Fn SSL_CIPHER_get_handshake_digest "const SSL_CIPHER *cipher"
86.Ft int 87.Ft int
87.Fn SSL_CIPHER_get_kx_nid "const SSL_CIPHER *cipher" 88.Fn SSL_CIPHER_get_kx_nid "const SSL_CIPHER *cipher"
diff --git a/src/lib/libssl/man/SSL_COMP_add_compression_method.3 b/src/lib/libssl/man/SSL_COMP_add_compression_method.3
index f9e25358d7..0b990ca88e 100644
--- a/src/lib/libssl/man/SSL_COMP_add_compression_method.3
+++ b/src/lib/libssl/man/SSL_COMP_add_compression_method.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_COMP_add_compression_method.3,v 1.7 2024/08/31 10:51:48 tb Exp $ 1.\" $OpenBSD: SSL_COMP_add_compression_method.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: August 31 2024 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt SSL_COMP_ADD_COMPRESSION_METHOD 3 18.Dt SSL_COMP_ADD_COMPRESSION_METHOD 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm SSL_COMP_get_compression_methods 21.Nm SSL_COMP_get_compression_methods
22.Nd handle SSL/TLS integrated compression methods 22.Nd handle SSL/TLS integrated compression methods
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libssl libcrypto
24.In openssl/ssl.h 25.In openssl/ssl.h
25.Ft STACK_OF(SSL_COMP) * 26.Ft STACK_OF(SSL_COMP) *
26.Fn SSL_COMP_get_compression_methods void 27.Fn SSL_COMP_get_compression_methods void
diff --git a/src/lib/libssl/man/SSL_CTX_add1_chain_cert.3 b/src/lib/libssl/man/SSL_CTX_add1_chain_cert.3
index 86eb27a523..91c4c80758 100644
--- a/src/lib/libssl/man/SSL_CTX_add1_chain_cert.3
+++ b/src/lib/libssl/man/SSL_CTX_add1_chain_cert.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_add1_chain_cert.3,v 1.2 2025/01/18 10:45:12 tb Exp $ 1.\" $OpenBSD: SSL_CTX_add1_chain_cert.3,v 1.3 2025/06/08 22:52:00 schwarze Exp $
2.\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 2.\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org> 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: January 18 2025 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_CTX_ADD1_CHAIN_CERT 3 53.Dt SSL_CTX_ADD1_CHAIN_CERT 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -67,6 +67,7 @@
67.Nm SSL_clear_chain_certs 67.Nm SSL_clear_chain_certs
68.Nd extra chain certificate processing 68.Nd extra chain certificate processing
69.Sh SYNOPSIS 69.Sh SYNOPSIS
70.Lb libssl libcrypto
70.In openssl/ssl.h 71.In openssl/ssl.h
71.Ft int 72.Ft int
72.Fo SSL_CTX_set0_chain 73.Fo SSL_CTX_set0_chain
diff --git a/src/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 b/src/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3
index b9694b0cbc..891c22a40a 100644
--- a/src/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3
+++ b/src/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_add_extra_chain_cert.3,v 1.8 2025/01/18 10:45:12 tb Exp $ 1.\" $OpenBSD: SSL_CTX_add_extra_chain_cert.3,v 1.9 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org> and 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org> and
@@ -50,7 +50,7 @@
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\" 52.\"
53.Dd $Mdocdate: January 18 2025 $ 53.Dd $Mdocdate: June 8 2025 $
54.Dt SSL_CTX_ADD_EXTRA_CHAIN_CERT 3 54.Dt SSL_CTX_ADD_EXTRA_CHAIN_CERT 3
55.Os 55.Os
56.Sh NAME 56.Sh NAME
@@ -60,6 +60,7 @@
60.Nm SSL_CTX_clear_extra_chain_certs 60.Nm SSL_CTX_clear_extra_chain_certs
61.Nd add, retrieve, and clear extra chain certificates 61.Nd add, retrieve, and clear extra chain certificates
62.Sh SYNOPSIS 62.Sh SYNOPSIS
63.Lb libssl libcrypto
63.In openssl/ssl.h 64.In openssl/ssl.h
64.Ft long 65.Ft long
65.Fn SSL_CTX_add_extra_chain_cert "SSL_CTX *ctx" "X509 *x509" 66.Fn SSL_CTX_add_extra_chain_cert "SSL_CTX *ctx" "X509 *x509"
diff --git a/src/lib/libssl/man/SSL_CTX_add_session.3 b/src/lib/libssl/man/SSL_CTX_add_session.3
index 443bdb542a..df634bcdda 100644
--- a/src/lib/libssl/man/SSL_CTX_add_session.3
+++ b/src/lib/libssl/man/SSL_CTX_add_session.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_add_session.3,v 1.5 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_add_session.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL SSL_CTX_add_session.pod 1722496f Jun 8 15:18:38 2017 -0400 2.\" OpenSSL SSL_CTX_add_session.pod 1722496f Jun 8 15:18:38 2017 -0400
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org> and 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org> and
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: March 27 2018 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_CTX_ADD_SESSION 3 53.Dt SSL_CTX_ADD_SESSION 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -57,6 +57,7 @@
57.Nm SSL_CTX_remove_session 57.Nm SSL_CTX_remove_session
58.Nd manipulate session cache 58.Nd manipulate session cache
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libssl libcrypto
60.In openssl/ssl.h 61.In openssl/ssl.h
61.Ft int 62.Ft int
62.Fn SSL_CTX_add_session "SSL_CTX *ctx" "SSL_SESSION *c" 63.Fn SSL_CTX_add_session "SSL_CTX *ctx" "SSL_SESSION *c"
diff --git a/src/lib/libssl/man/SSL_CTX_ctrl.3 b/src/lib/libssl/man/SSL_CTX_ctrl.3
index c91ddff374..4d254d8f48 100644
--- a/src/lib/libssl/man/SSL_CTX_ctrl.3
+++ b/src/lib/libssl/man/SSL_CTX_ctrl.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_ctrl.3,v 1.7 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_ctrl.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_CTRL 3 52.Dt SSL_CTX_CTRL 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -58,6 +58,7 @@
58.Nm SSL_callback_ctrl 58.Nm SSL_callback_ctrl
59.Nd internal handling functions for SSL_CTX and SSL objects 59.Nd internal handling functions for SSL_CTX and SSL objects
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libssl libcrypto
61.In openssl/ssl.h 62.In openssl/ssl.h
62.Ft long 63.Ft long
63.Fn SSL_CTX_ctrl "SSL_CTX *ctx" "int cmd" "long larg" "void *parg" 64.Fn SSL_CTX_ctrl "SSL_CTX *ctx" "int cmd" "long larg" "void *parg"
diff --git a/src/lib/libssl/man/SSL_CTX_flush_sessions.3 b/src/lib/libssl/man/SSL_CTX_flush_sessions.3
index 2ef781cb4a..deabf5200a 100644
--- a/src/lib/libssl/man/SSL_CTX_flush_sessions.3
+++ b/src/lib/libssl/man/SSL_CTX_flush_sessions.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_flush_sessions.3,v 1.5 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_flush_sessions.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL SSL_CTX_flush_sessions.pod 1722496f Jun 8 15:18:38 2017 -0400 2.\" OpenSSL SSL_CTX_flush_sessions.pod 1722496f Jun 8 15:18:38 2017 -0400
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_FLUSH_SESSIONS 3 52.Dt SSL_CTX_FLUSH_SESSIONS 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_CTX_flush_sessions 55.Nm SSL_CTX_flush_sessions
56.Nd remove expired sessions 56.Nd remove expired sessions
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libssl libcrypto
58.In openssl/ssl.h 59.In openssl/ssl.h
59.Ft void 60.Ft void
60.Fn SSL_CTX_flush_sessions "SSL_CTX *ctx" "long tm" 61.Fn SSL_CTX_flush_sessions "SSL_CTX *ctx" "long tm"
diff --git a/src/lib/libssl/man/SSL_CTX_free.3 b/src/lib/libssl/man/SSL_CTX_free.3
index 47f247631b..0afef7cd0e 100644
--- a/src/lib/libssl/man/SSL_CTX_free.3
+++ b/src/lib/libssl/man/SSL_CTX_free.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_free.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_free.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_FREE 3 52.Dt SSL_CTX_FREE 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_CTX_free 55.Nm SSL_CTX_free
56.Nd free an allocated SSL_CTX object 56.Nd free an allocated SSL_CTX object
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libssl libcrypto
58.In openssl/ssl.h 59.In openssl/ssl.h
59.Ft void 60.Ft void
60.Fn SSL_CTX_free "SSL_CTX *ctx" 61.Fn SSL_CTX_free "SSL_CTX *ctx"
diff --git a/src/lib/libssl/man/SSL_CTX_get0_certificate.3 b/src/lib/libssl/man/SSL_CTX_get0_certificate.3
index 63c86bd5e0..226e6cd87a 100644
--- a/src/lib/libssl/man/SSL_CTX_get0_certificate.3
+++ b/src/lib/libssl/man/SSL_CTX_get0_certificate.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_get0_certificate.3,v 1.3 2019/06/12 09:36:30 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_get0_certificate.3,v 1.4 2025/06/08 22:47:20 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,15 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 12 2019 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt SSL_CTX_GET0_CERTIFICATE 3 18.Dt SSL_CTX_GET0_CERTIFICATE 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm SSL_CTX_get0_certificate 21.Nm SSL_CTX_get0_certificate
22.Nd get the active certificate from an SSL context 22.Nd get the active certificate from an SSL context
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libssl libcrypto
25.In openssl/ssl.h
24.Ft X509 * 26.Ft X509 *
25.Fo SSL_CTX_get0_certificate 27.Fo SSL_CTX_get0_certificate
26.Fa "const SSL_CTX *ctx" 28.Fa "const SSL_CTX *ctx"
diff --git a/src/lib/libssl/man/SSL_CTX_get_ex_new_index.3 b/src/lib/libssl/man/SSL_CTX_get_ex_new_index.3
index 3dbaf2e981..30a02cc317 100644
--- a/src/lib/libssl/man/SSL_CTX_get_ex_new_index.3
+++ b/src/lib/libssl/man/SSL_CTX_get_ex_new_index.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_get_ex_new_index.3,v 1.3 2018/03/21 08:06:34 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_get_ex_new_index.3,v 1.4 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 2.\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 21 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_GET_EX_NEW_INDEX 3 52.Dt SSL_CTX_GET_EX_NEW_INDEX 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -57,6 +57,7 @@
57.Nm SSL_CTX_get_ex_data 57.Nm SSL_CTX_get_ex_data
58.Nd internal application specific data functions 58.Nd internal application specific data functions
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libssl libcrypto
60.In openssl/ssl.h 61.In openssl/ssl.h
61.Ft int 62.Ft int
62.Fo SSL_CTX_get_ex_new_index 63.Fo SSL_CTX_get_ex_new_index
diff --git a/src/lib/libssl/man/SSL_CTX_get_verify_mode.3 b/src/lib/libssl/man/SSL_CTX_get_verify_mode.3
index 7c87775069..88187f7f3c 100644
--- a/src/lib/libssl/man/SSL_CTX_get_verify_mode.3
+++ b/src/lib/libssl/man/SSL_CTX_get_verify_mode.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_get_verify_mode.3,v 1.5 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_get_verify_mode.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_GET_VERIFY_MODE 3 52.Dt SSL_CTX_GET_VERIFY_MODE 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -60,6 +60,7 @@
60.Nm SSL_CTX_get_verify_callback 60.Nm SSL_CTX_get_verify_callback
61.Nd get currently set verification parameters 61.Nd get currently set verification parameters
62.Sh SYNOPSIS 62.Sh SYNOPSIS
63.Lb libssl libcrypto
63.In openssl/ssl.h 64.In openssl/ssl.h
64.Ft int 65.Ft int
65.Fn SSL_CTX_get_verify_mode "const SSL_CTX *ctx" 66.Fn SSL_CTX_get_verify_mode "const SSL_CTX *ctx"
diff --git a/src/lib/libssl/man/SSL_CTX_load_verify_locations.3 b/src/lib/libssl/man/SSL_CTX_load_verify_locations.3
index 373df2402e..0cc22f433d 100644
--- a/src/lib/libssl/man/SSL_CTX_load_verify_locations.3
+++ b/src/lib/libssl/man/SSL_CTX_load_verify_locations.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_load_verify_locations.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_load_verify_locations.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 2.\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: March 27 2018 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_CTX_LOAD_VERIFY_LOCATIONS 3 53.Dt SSL_CTX_LOAD_VERIFY_LOCATIONS 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -57,6 +57,7 @@
57.Nm SSL_CTX_set_default_verify_paths 57.Nm SSL_CTX_set_default_verify_paths
58.Nd set default locations for trusted CA certificates 58.Nd set default locations for trusted CA certificates
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libssl libcrypto
60.In openssl/ssl.h 61.In openssl/ssl.h
61.Ft int 62.Ft int
62.Fo SSL_CTX_load_verify_locations 63.Fo SSL_CTX_load_verify_locations
diff --git a/src/lib/libssl/man/SSL_CTX_new.3 b/src/lib/libssl/man/SSL_CTX_new.3
index 4b50a03de4..2afad5378c 100644
--- a/src/lib/libssl/man/SSL_CTX_new.3
+++ b/src/lib/libssl/man/SSL_CTX_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_new.3,v 1.17 2022/07/13 22:05:53 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_new.3,v 1.18 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL 21cd6e00 Oct 21 14:40:15 2015 +0100 2.\" full merge up to: OpenSSL 21cd6e00 Oct 21 14:40:15 2015 +0100
3.\" selective merge up to: OpenSSL 8f75443f May 24 14:04:26 2019 +0200 3.\" selective merge up to: OpenSSL 8f75443f May 24 14:04:26 2019 +0200
4.\" 4.\"
@@ -50,7 +50,7 @@
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\" 52.\"
53.Dd $Mdocdate: July 13 2022 $ 53.Dd $Mdocdate: June 8 2025 $
54.Dt SSL_CTX_NEW 3 54.Dt SSL_CTX_NEW 3
55.Os 55.Os
56.Sh NAME 56.Sh NAME
@@ -82,6 +82,7 @@
82.Nm DTLSv1_2_client_method 82.Nm DTLSv1_2_client_method
83.Nd create a new SSL_CTX object as a framework for TLS enabled functions 83.Nd create a new SSL_CTX object as a framework for TLS enabled functions
84.Sh SYNOPSIS 84.Sh SYNOPSIS
85.Lb libssl libcrypto
85.In openssl/ssl.h 86.In openssl/ssl.h
86.Ft SSL_CTX * 87.Ft SSL_CTX *
87.Fn SSL_CTX_new "const SSL_METHOD *method" 88.Fn SSL_CTX_new "const SSL_METHOD *method"
diff --git a/src/lib/libssl/man/SSL_CTX_sess_number.3 b/src/lib/libssl/man/SSL_CTX_sess_number.3
index 76d436cd17..854f6256eb 100644
--- a/src/lib/libssl/man/SSL_CTX_sess_number.3
+++ b/src/lib/libssl/man/SSL_CTX_sess_number.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_sess_number.3,v 1.9 2019/06/12 09:36:30 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_sess_number.3,v 1.10 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL SSL_CTX_sess_number.pod 7bd27895 Mar 29 11:45:29 2017 +1000 2.\" OpenSSL SSL_CTX_sess_number.pod 7bd27895 Mar 29 11:45:29 2017 +1000
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 12 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_SESS_NUMBER 3 52.Dt SSL_CTX_SESS_NUMBER 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -66,6 +66,7 @@
66.Nm SSL_CTX_sess_cache_full 66.Nm SSL_CTX_sess_cache_full
67.Nd obtain session cache statistics 67.Nd obtain session cache statistics
68.Sh SYNOPSIS 68.Sh SYNOPSIS
69.Lb libssl libcrypto
69.In openssl/ssl.h 70.In openssl/ssl.h
70.Ft long 71.Ft long
71.Fn SSL_CTX_sess_number "SSL_CTX *ctx" 72.Fn SSL_CTX_sess_number "SSL_CTX *ctx"
diff --git a/src/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 b/src/lib/libssl/man/SSL_CTX_sess_set_cache_size.3
index 6d5fede0b6..e8bfe50a3c 100644
--- a/src/lib/libssl/man/SSL_CTX_sess_set_cache_size.3
+++ b/src/lib/libssl/man/SSL_CTX_sess_set_cache_size.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_sess_set_cache_size.3,v 1.5 2019/06/12 09:36:30 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_sess_set_cache_size.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 12 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_SESS_SET_CACHE_SIZE 3 52.Dt SSL_CTX_SESS_SET_CACHE_SIZE 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -56,6 +56,7 @@
56.Nm SSL_CTX_sess_get_cache_size 56.Nm SSL_CTX_sess_get_cache_size
57.Nd manipulate session cache size 57.Nd manipulate session cache size
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libssl libcrypto
59.In openssl/ssl.h 60.In openssl/ssl.h
60.Ft long 61.Ft long
61.Fn SSL_CTX_sess_set_cache_size "SSL_CTX *ctx" "long t" 62.Fn SSL_CTX_sess_set_cache_size "SSL_CTX *ctx" "long t"
diff --git a/src/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 b/src/lib/libssl/man/SSL_CTX_sess_set_get_cb.3
index e99f2be671..62a6698399 100644
--- a/src/lib/libssl/man/SSL_CTX_sess_set_get_cb.3
+++ b/src/lib/libssl/man/SSL_CTX_sess_set_get_cb.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_sess_set_get_cb.3,v 1.7 2022/03/29 18:15:52 naddy Exp $ 1.\" $OpenBSD: SSL_CTX_sess_set_get_cb.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: March 29 2022 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_CTX_SESS_SET_GET_CB 3 53.Dt SSL_CTX_SESS_SET_GET_CB 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -61,6 +61,7 @@
61.Nm SSL_CTX_sess_get_get_cb 61.Nm SSL_CTX_sess_get_get_cb
62.Nd provide callback functions for server side external session caching 62.Nd provide callback functions for server side external session caching
63.Sh SYNOPSIS 63.Sh SYNOPSIS
64.Lb libssl libcrypto
64.In openssl/ssl.h 65.In openssl/ssl.h
65.Ft void 66.Ft void
66.Fo SSL_CTX_sess_set_new_cb 67.Fo SSL_CTX_sess_set_new_cb
diff --git a/src/lib/libssl/man/SSL_CTX_sessions.3 b/src/lib/libssl/man/SSL_CTX_sessions.3
index 964d1a7346..627c694cd8 100644
--- a/src/lib/libssl/man/SSL_CTX_sessions.3
+++ b/src/lib/libssl/man/SSL_CTX_sessions.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_sessions.3,v 1.5 2018/04/25 14:19:39 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_sessions.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: April 25 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_SESSIONS 3 52.Dt SSL_CTX_SESSIONS 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_CTX_sessions 55.Nm SSL_CTX_sessions
56.Nd access internal session cache 56.Nd access internal session cache
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libssl libcrypto
58.In openssl/ssl.h 59.In openssl/ssl.h
59.Ft LHASH_OF(SSL_SESSION) * 60.Ft LHASH_OF(SSL_SESSION) *
60.Fn SSL_CTX_sessions "SSL_CTX *ctx" 61.Fn SSL_CTX_sessions "SSL_CTX *ctx"
diff --git a/src/lib/libssl/man/SSL_CTX_set1_groups.3 b/src/lib/libssl/man/SSL_CTX_set1_groups.3
index 0d1eb36ea7..8cd620d3b4 100644
--- a/src/lib/libssl/man/SSL_CTX_set1_groups.3
+++ b/src/lib/libssl/man/SSL_CTX_set1_groups.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set1_groups.3,v 1.2 2017/08/19 19:36:39 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_set1_groups.3,v 1.3 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL SSL_CTX_set1_curves.pod de4d764e Nov 9 14:51:06 2016 +0000 2.\" OpenSSL SSL_CTX_set1_curves.pod de4d764e Nov 9 14:51:06 2016 +0000
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: August 19 2017 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_SET1_GROUPS 3 52.Dt SSL_CTX_SET1_GROUPS 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -62,6 +62,7 @@
62.Nm SSL_set1_curves_list 62.Nm SSL_set1_curves_list
63.Nd choose supported EC groups 63.Nd choose supported EC groups
64.Sh SYNOPSIS 64.Sh SYNOPSIS
65.Lb libssl libcrypto
65.In openssl/ssl.h 66.In openssl/ssl.h
66.Ft int 67.Ft int
67.Fo SSL_CTX_set1_groups 68.Fo SSL_CTX_set1_groups
diff --git a/src/lib/libssl/man/SSL_CTX_set_alpn_select_cb.3 b/src/lib/libssl/man/SSL_CTX_set_alpn_select_cb.3
index 2317c57af4..ff69408247 100644
--- a/src/lib/libssl/man/SSL_CTX_set_alpn_select_cb.3
+++ b/src/lib/libssl/man/SSL_CTX_set_alpn_select_cb.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_alpn_select_cb.3,v 1.11 2025/02/04 14:00:05 tb Exp $ 1.\" $OpenBSD: SSL_CTX_set_alpn_select_cb.3,v 1.12 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL 87b81496 Apr 19 12:38:27 2017 -0400 2.\" OpenSSL 87b81496 Apr 19 12:38:27 2017 -0400
3.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 3.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
4.\" 4.\"
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: February 4 2025 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_CTX_SET_ALPN_SELECT_CB 3 53.Dt SSL_CTX_SET_ALPN_SELECT_CB 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -60,6 +60,7 @@
60.Nm SSL_get0_alpn_selected 60.Nm SSL_get0_alpn_selected
61.Nd handle application layer protocol negotiation (ALPN) 61.Nd handle application layer protocol negotiation (ALPN)
62.Sh SYNOPSIS 62.Sh SYNOPSIS
63.Lb libssl libcrypto
63.In openssl/ssl.h 64.In openssl/ssl.h
64.Ft int 65.Ft int
65.Fo SSL_CTX_set_alpn_protos 66.Fo SSL_CTX_set_alpn_protos
diff --git a/src/lib/libssl/man/SSL_CTX_set_cert_store.3 b/src/lib/libssl/man/SSL_CTX_set_cert_store.3
index 1be1ba2f68..75c145fd78 100644
--- a/src/lib/libssl/man/SSL_CTX_set_cert_store.3
+++ b/src/lib/libssl/man/SSL_CTX_set_cert_store.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_cert_store.3,v 1.8 2024/08/03 04:53:01 tb Exp $ 1.\" $OpenBSD: SSL_CTX_set_cert_store.3,v 1.9 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: August 3 2024 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_SET_CERT_STORE 3 52.Dt SSL_CTX_SET_CERT_STORE 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -57,6 +57,7 @@
57.Nm SSL_CTX_get_cert_store 57.Nm SSL_CTX_get_cert_store
58.Nd manipulate X509 certificate verification storage 58.Nd manipulate X509 certificate verification storage
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libssl libcrypto
60.In openssl/ssl.h 61.In openssl/ssl.h
61.Ft void 62.Ft void
62.Fn SSL_CTX_set_cert_store "SSL_CTX *ctx" "X509_STORE *store" 63.Fn SSL_CTX_set_cert_store "SSL_CTX *ctx" "X509_STORE *store"
diff --git a/src/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 b/src/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3
index 0e12b48c78..2e2beac850 100644
--- a/src/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3
+++ b/src/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_cert_verify_callback.3,v 1.5 2019/06/08 15:25:43 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_set_cert_verify_callback.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 8 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_SET_CERT_VERIFY_CALLBACK 3 52.Dt SSL_CTX_SET_CERT_VERIFY_CALLBACK 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_CTX_set_cert_verify_callback 55.Nm SSL_CTX_set_cert_verify_callback
56.Nd set peer certificate verification procedure 56.Nd set peer certificate verification procedure
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libssl libcrypto
58.In openssl/ssl.h 59.In openssl/ssl.h
59.Ft void 60.Ft void
60.Fo SSL_CTX_set_cert_verify_callback 61.Fo SSL_CTX_set_cert_verify_callback
diff --git a/src/lib/libssl/man/SSL_CTX_set_cipher_list.3 b/src/lib/libssl/man/SSL_CTX_set_cipher_list.3
index b3f0dc3541..6201dc9f55 100644
--- a/src/lib/libssl/man/SSL_CTX_set_cipher_list.3
+++ b/src/lib/libssl/man/SSL_CTX_set_cipher_list.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_cipher_list.3,v 1.18 2025/01/18 12:20:02 tb Exp $ 1.\" $OpenBSD: SSL_CTX_set_cipher_list.3,v 1.19 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: January 18 2025 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt SSL_CTX_SET_CIPHER_LIST 3 69.Dt SSL_CTX_SET_CIPHER_LIST 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -73,6 +73,7 @@
73.Nm SSL_set_cipher_list 73.Nm SSL_set_cipher_list
74.Nd choose list of available SSL_CIPHERs 74.Nd choose list of available SSL_CIPHERs
75.Sh SYNOPSIS 75.Sh SYNOPSIS
76.Lb libssl libcrypto
76.In openssl/ssl.h 77.In openssl/ssl.h
77.Ft int 78.Ft int
78.Fn SSL_CTX_set_cipher_list "SSL_CTX *ctx" "const char *control" 79.Fn SSL_CTX_set_cipher_list "SSL_CTX *ctx" "const char *control"
diff --git a/src/lib/libssl/man/SSL_CTX_set_client_CA_list.3 b/src/lib/libssl/man/SSL_CTX_set_client_CA_list.3
index d19fb93ed0..520be04318 100644
--- a/src/lib/libssl/man/SSL_CTX_set_client_CA_list.3
+++ b/src/lib/libssl/man/SSL_CTX_set_client_CA_list.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_client_CA_list.3,v 1.6 2020/03/30 10:28:59 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_set_client_CA_list.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,16 +48,17 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 30 2020 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_SET_CLIENT_CA_LIST 3 52.Dt SSL_CTX_SET_CLIENT_CA_LIST 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_CTX_set_client_CA_list , 55.Nm SSL_CTX_set_client_CA_list ,
56.Nm SSL_set_client_CA_list , 56.Nm SSL_set_client_CA_list ,
57.Nm SSL_CTX_add_client_CA , 57.Nm SSL_CTX_add_client_CA ,
58.Nm SSL_add_client_CA 58.Nm SSL_add_client_CA
59.Nd set list of CAs sent to the client when requesting a client certificate 59.Nd set list of CAs sent to the client when requesting a client certificate
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libssl libcrypto
61.In openssl/ssl.h 62.In openssl/ssl.h
62.Ft void 63.Ft void
63.Fn SSL_CTX_set_client_CA_list "SSL_CTX *ctx" "STACK_OF(X509_NAME) *list" 64.Fn SSL_CTX_set_client_CA_list "SSL_CTX *ctx" "STACK_OF(X509_NAME) *list"
diff --git a/src/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 b/src/lib/libssl/man/SSL_CTX_set_client_cert_cb.3
index a2433b5e92..2cf8275602 100644
--- a/src/lib/libssl/man/SSL_CTX_set_client_cert_cb.3
+++ b/src/lib/libssl/man/SSL_CTX_set_client_cert_cb.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_client_cert_cb.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_set_client_cert_cb.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_SET_CLIENT_CERT_CB 3 52.Dt SSL_CTX_SET_CLIENT_CERT_CB 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -56,6 +56,7 @@
56.Nm SSL_CTX_get_client_cert_cb 56.Nm SSL_CTX_get_client_cert_cb
57.Nd handle client certificate callback function 57.Nd handle client certificate callback function
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libssl libcrypto
59.In openssl/ssl.h 60.In openssl/ssl.h
60.Ft void 61.Ft void
61.Fo SSL_CTX_set_client_cert_cb 62.Fo SSL_CTX_set_client_cert_cb
diff --git a/src/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 b/src/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3
index 94b4ea543d..e3da1bec66 100644
--- a/src/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3
+++ b/src/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_default_passwd_cb.3,v 1.9 2023/09/19 09:40:35 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_set_default_passwd_cb.3,v 1.10 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 2.\" full merge up to: OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400
3.\" selective merge up to: OpenSSL 18bad535 Apr 9 15:13:55 2019 +0100 3.\" selective merge up to: OpenSSL 18bad535 Apr 9 15:13:55 2019 +0100
4.\" 4.\"
@@ -67,7 +67,7 @@
67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
69.\" 69.\"
70.Dd $Mdocdate: September 19 2023 $ 70.Dd $Mdocdate: June 8 2025 $
71.Dt SSL_CTX_SET_DEFAULT_PASSWD_CB 3 71.Dt SSL_CTX_SET_DEFAULT_PASSWD_CB 3
72.Os 72.Os
73.Sh NAME 73.Sh NAME
@@ -77,6 +77,7 @@
77.Nm SSL_CTX_get_default_passwd_cb_userdata 77.Nm SSL_CTX_get_default_passwd_cb_userdata
78.Nd set or get passwd callback for encrypted PEM file handling 78.Nd set or get passwd callback for encrypted PEM file handling
79.Sh SYNOPSIS 79.Sh SYNOPSIS
80.Lb libssl libcrypto
80.In openssl/ssl.h 81.In openssl/ssl.h
81.Ft void 82.Ft void
82.Fn SSL_CTX_set_default_passwd_cb "SSL_CTX *ctx" "pem_password_cb *cb" 83.Fn SSL_CTX_set_default_passwd_cb "SSL_CTX *ctx" "pem_password_cb *cb"
diff --git a/src/lib/libssl/man/SSL_CTX_set_generate_session_id.3 b/src/lib/libssl/man/SSL_CTX_set_generate_session_id.3
index d85383d776..29c102ac50 100644
--- a/src/lib/libssl/man/SSL_CTX_set_generate_session_id.3
+++ b/src/lib/libssl/man/SSL_CTX_set_generate_session_id.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_generate_session_id.3,v 1.5 2018/03/22 21:09:18 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_set_generate_session_id.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 22 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_SET_GENERATE_SESSION_ID 3 52.Dt SSL_CTX_SET_GENERATE_SESSION_ID 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -58,6 +58,7 @@
58.Nm GEN_SESSION_CB 58.Nm GEN_SESSION_CB
59.Nd manipulate generation of SSL session IDs (server only) 59.Nd manipulate generation of SSL session IDs (server only)
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libssl libcrypto
61.In openssl/ssl.h 62.In openssl/ssl.h
62.Ft typedef int 63.Ft typedef int
63.Fo (*GEN_SESSION_CB) 64.Fo (*GEN_SESSION_CB)
diff --git a/src/lib/libssl/man/SSL_CTX_set_info_callback.3 b/src/lib/libssl/man/SSL_CTX_set_info_callback.3
index 76eb8bee61..ec251b5b69 100644
--- a/src/lib/libssl/man/SSL_CTX_set_info_callback.3
+++ b/src/lib/libssl/man/SSL_CTX_set_info_callback.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_info_callback.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_set_info_callback.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_SET_INFO_CALLBACK 3 52.Dt SSL_CTX_SET_INFO_CALLBACK 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -58,6 +58,7 @@
58.Nm SSL_get_info_callback 58.Nm SSL_get_info_callback
59.Nd handle information callback for SSL connections 59.Nd handle information callback for SSL connections
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libssl libcrypto
61.In openssl/ssl.h 62.In openssl/ssl.h
62.Ft void 63.Ft void
63.Fo SSL_CTX_set_info_callback 64.Fo SSL_CTX_set_info_callback
diff --git a/src/lib/libssl/man/SSL_CTX_set_keylog_callback.3 b/src/lib/libssl/man/SSL_CTX_set_keylog_callback.3
index 24b8f9992f..0cb36b07c6 100644
--- a/src/lib/libssl/man/SSL_CTX_set_keylog_callback.3
+++ b/src/lib/libssl/man/SSL_CTX_set_keylog_callback.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_keylog_callback.3,v 1.3 2024/05/16 08:39:30 tb Exp $ 1.\" $OpenBSD: SSL_CTX_set_keylog_callback.3,v 1.4 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL pod checked up to: 61f805c1 Jan 16 01:01:46 2018 +0800 2.\" OpenSSL pod checked up to: 61f805c1 Jan 16 01:01:46 2018 +0800
3.\" 3.\"
4.\" Copyright (c) 2021 Bob Beck <beck@openbsd.org> 4.\" Copyright (c) 2021 Bob Beck <beck@openbsd.org>
@@ -15,7 +15,7 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 17.\"
18.Dd $Mdocdate: May 16 2024 $ 18.Dd $Mdocdate: June 8 2025 $
19.Dt SSL_CTX_SET_KEYLOG_CALLBACK 3 19.Dt SSL_CTX_SET_KEYLOG_CALLBACK 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
@@ -23,6 +23,7 @@
23.Nm SSL_CTX_get_keylog_callback 23.Nm SSL_CTX_get_keylog_callback
24.Nd set and get the unused key logging callback 24.Nd set and get the unused key logging callback
25.Sh SYNOPSIS 25.Sh SYNOPSIS
26.Lb libssl libcrypto
26.In openssl/ssl.h 27.In openssl/ssl.h
27.Ft typedef void 28.Ft typedef void
28.Fo (*SSL_CTX_keylog_cb_func) 29.Fo (*SSL_CTX_keylog_cb_func)
diff --git a/src/lib/libssl/man/SSL_CTX_set_max_cert_list.3 b/src/lib/libssl/man/SSL_CTX_set_max_cert_list.3
index 89513b1006..700f534f54 100644
--- a/src/lib/libssl/man/SSL_CTX_set_max_cert_list.3
+++ b/src/lib/libssl/man/SSL_CTX_set_max_cert_list.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_max_cert_list.3,v 1.6 2019/06/12 09:36:30 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_set_max_cert_list.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 12 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_SET_MAX_CERT_LIST 3 52.Dt SSL_CTX_SET_MAX_CERT_LIST 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -58,6 +58,7 @@
58.Nm SSL_get_max_cert_list 58.Nm SSL_get_max_cert_list
59.Nd manipulate allowed size for the peer's certificate chain 59.Nd manipulate allowed size for the peer's certificate chain
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libssl libcrypto
61.In openssl/ssl.h 62.In openssl/ssl.h
62.Ft long 63.Ft long
63.Fn SSL_CTX_set_max_cert_list "SSL_CTX *ctx" "long size" 64.Fn SSL_CTX_set_max_cert_list "SSL_CTX *ctx" "long size"
diff --git a/src/lib/libssl/man/SSL_CTX_set_min_proto_version.3 b/src/lib/libssl/man/SSL_CTX_set_min_proto_version.3
index a2597cda83..50a5fc448d 100644
--- a/src/lib/libssl/man/SSL_CTX_set_min_proto_version.3
+++ b/src/lib/libssl/man/SSL_CTX_set_min_proto_version.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_min_proto_version.3,v 1.5 2021/04/15 16:40:32 tb Exp $ 1.\" $OpenBSD: SSL_CTX_set_min_proto_version.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL 3edabd3c Sep 14 09:28:39 2017 +0200 2.\" full merge up to: OpenSSL 3edabd3c Sep 14 09:28:39 2017 +0200
3.\" 3.\"
4.\" This file was written by Kurt Roeckx <kurt@roeckx.be> and 4.\" This file was written by Kurt Roeckx <kurt@roeckx.be> and
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: April 15 2021 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_CTX_SET_MIN_PROTO_VERSION 3 53.Dt SSL_CTX_SET_MIN_PROTO_VERSION 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -63,6 +63,7 @@
63.Nm SSL_get_max_proto_version 63.Nm SSL_get_max_proto_version
64.Nd get and set minimum and maximum supported protocol version 64.Nd get and set minimum and maximum supported protocol version
65.Sh SYNOPSIS 65.Sh SYNOPSIS
66.Lb libssl libcrypto
66.In openssl/ssl.h 67.In openssl/ssl.h
67.Ft int 68.Ft int
68.Fo SSL_CTX_set_min_proto_version 69.Fo SSL_CTX_set_min_proto_version
diff --git a/src/lib/libssl/man/SSL_CTX_set_mode.3 b/src/lib/libssl/man/SSL_CTX_set_mode.3
index fca1a977d0..62a7a6deda 100644
--- a/src/lib/libssl/man/SSL_CTX_set_mode.3
+++ b/src/lib/libssl/man/SSL_CTX_set_mode.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_mode.3,v 1.7 2020/10/08 16:02:38 tb Exp $ 1.\" $OpenBSD: SSL_CTX_set_mode.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL 8671b898 Jun 3 02:48:34 2008 +0000 2.\" full merge up to: OpenSSL 8671b898 Jun 3 02:48:34 2008 +0000
3.\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 3.\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
4.\" 4.\"
@@ -50,7 +50,7 @@
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\" 52.\"
53.Dd $Mdocdate: October 8 2020 $ 53.Dd $Mdocdate: June 8 2025 $
54.Dt SSL_CTX_SET_MODE 3 54.Dt SSL_CTX_SET_MODE 3
55.Os 55.Os
56.Sh NAME 56.Sh NAME
@@ -62,6 +62,7 @@
62.Nm SSL_get_mode 62.Nm SSL_get_mode
63.Nd manipulate SSL engine mode 63.Nd manipulate SSL engine mode
64.Sh SYNOPSIS 64.Sh SYNOPSIS
65.Lb libssl libcrypto
65.In openssl/ssl.h 66.In openssl/ssl.h
66.Ft long 67.Ft long
67.Fn SSL_CTX_set_mode "SSL_CTX *ctx" "long mode" 68.Fn SSL_CTX_set_mode "SSL_CTX *ctx" "long mode"
diff --git a/src/lib/libssl/man/SSL_CTX_set_msg_callback.3 b/src/lib/libssl/man/SSL_CTX_set_msg_callback.3
index a27333e6d9..65df06016a 100644
--- a/src/lib/libssl/man/SSL_CTX_set_msg_callback.3
+++ b/src/lib/libssl/man/SSL_CTX_set_msg_callback.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_msg_callback.3,v 1.5 2021/04/15 16:43:27 tb Exp $ 1.\" $OpenBSD: SSL_CTX_set_msg_callback.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL SSL_CTX_set_msg_callback.pod e9b77246 Jan 20 19:58:49 2017 +0100 2.\" OpenSSL SSL_CTX_set_msg_callback.pod e9b77246 Jan 20 19:58:49 2017 +0100
3.\" OpenSSL SSL_CTX_set_msg_callback.pod b97fdb57 Nov 11 09:33:09 2016 +0100 3.\" OpenSSL SSL_CTX_set_msg_callback.pod b97fdb57 Nov 11 09:33:09 2016 +0100
4.\" 4.\"
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: April 15 2021 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_CTX_SET_MSG_CALLBACK 3 53.Dt SSL_CTX_SET_MSG_CALLBACK 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -59,6 +59,7 @@
59.Nm SSL_set_msg_callback_arg 59.Nm SSL_set_msg_callback_arg
60.Nd install callback for observing protocol messages 60.Nd install callback for observing protocol messages
61.Sh SYNOPSIS 61.Sh SYNOPSIS
62.Lb libssl libcrypto
62.In openssl/ssl.h 63.In openssl/ssl.h
63.Ft void 64.Ft void
64.Fo SSL_CTX_set_msg_callback 65.Fo SSL_CTX_set_msg_callback
diff --git a/src/lib/libssl/man/SSL_CTX_set_num_tickets.3 b/src/lib/libssl/man/SSL_CTX_set_num_tickets.3
index cb6d7e000a..093387725a 100644
--- a/src/lib/libssl/man/SSL_CTX_set_num_tickets.3
+++ b/src/lib/libssl/man/SSL_CTX_set_num_tickets.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_num_tickets.3,v 1.2 2021/10/23 17:20:50 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_set_num_tickets.3,v 1.3 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL pod checked up to: 5402f96a Sep 11 09:58:52 2021 +0100 2.\" OpenSSL pod checked up to: 5402f96a Sep 11 09:58:52 2021 +0100
3.\" 3.\"
4.\" Copyright (c) 2021 Bob Beck <beck@openbsd.org> 4.\" Copyright (c) 2021 Bob Beck <beck@openbsd.org>
@@ -15,7 +15,7 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 17.\"
18.Dd $Mdocdate: October 23 2021 $ 18.Dd $Mdocdate: June 8 2025 $
19.Dt SSL_CTX_SET_NUM_TICKETS 3 19.Dt SSL_CTX_SET_NUM_TICKETS 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
@@ -25,6 +25,7 @@
25.Nm SSL_get_num_tickets 25.Nm SSL_get_num_tickets
26.Nd set and get the number of TLS 1.3 session tickets to be sent 26.Nd set and get the number of TLS 1.3 session tickets to be sent
27.Sh SYNOPSIS 27.Sh SYNOPSIS
28.Lb libssl libcrypto
28.In openssl/ssl.h 29.In openssl/ssl.h
29.Ft int 30.Ft int
30.Fn SSL_CTX_set_num_tickets "SSL_CTX *ctx" "size_t num_tickets" 31.Fn SSL_CTX_set_num_tickets "SSL_CTX *ctx" "size_t num_tickets"
diff --git a/src/lib/libssl/man/SSL_CTX_set_options.3 b/src/lib/libssl/man/SSL_CTX_set_options.3
index 5df0b07785..5e81c978bd 100644
--- a/src/lib/libssl/man/SSL_CTX_set_options.3
+++ b/src/lib/libssl/man/SSL_CTX_set_options.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_options.3,v 1.16 2022/03/31 17:27:18 naddy Exp $ 1.\" $OpenBSD: SSL_CTX_set_options.3,v 1.17 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL 7946ab33 Dec 6 17:56:41 2015 +0100 2.\" full merge up to: OpenSSL 7946ab33 Dec 6 17:56:41 2015 +0100
3.\" selective merge up to: OpenSSL edb79c3a Mar 29 10:07:14 2017 +1000 3.\" selective merge up to: OpenSSL edb79c3a Mar 29 10:07:14 2017 +1000
4.\" 4.\"
@@ -52,7 +52,7 @@
52.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 52.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
53.\" OF THE POSSIBILITY OF SUCH DAMAGE. 53.\" OF THE POSSIBILITY OF SUCH DAMAGE.
54.\" 54.\"
55.Dd $Mdocdate: March 31 2022 $ 55.Dd $Mdocdate: June 8 2025 $
56.Dt SSL_CTX_SET_OPTIONS 3 56.Dt SSL_CTX_SET_OPTIONS 3
57.Os 57.Os
58.Sh NAME 58.Sh NAME
@@ -65,6 +65,7 @@
65.Nm SSL_get_secure_renegotiation_support 65.Nm SSL_get_secure_renegotiation_support
66.Nd manipulate SSL options 66.Nd manipulate SSL options
67.Sh SYNOPSIS 67.Sh SYNOPSIS
68.Lb libssl libcrypto
68.In openssl/ssl.h 69.In openssl/ssl.h
69.Ft long 70.Ft long
70.Fn SSL_CTX_set_options "SSL_CTX *ctx" "long options" 71.Fn SSL_CTX_set_options "SSL_CTX *ctx" "long options"
diff --git a/src/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 b/src/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3
index 71463f1eca..20b882167b 100644
--- a/src/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3
+++ b/src/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_quiet_shutdown.3,v 1.6 2020/03/30 10:28:59 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_set_quiet_shutdown.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 30 2020 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_SET_QUIET_SHUTDOWN 3 52.Dt SSL_CTX_SET_QUIET_SHUTDOWN 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -58,6 +58,7 @@
58.Nm SSL_get_quiet_shutdown 58.Nm SSL_get_quiet_shutdown
59.Nd manipulate shutdown behaviour 59.Nd manipulate shutdown behaviour
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libssl libcrypto
61.In openssl/ssl.h 62.In openssl/ssl.h
62.Ft void 63.Ft void
63.Fn SSL_CTX_set_quiet_shutdown "SSL_CTX *ctx" "int mode" 64.Fn SSL_CTX_set_quiet_shutdown "SSL_CTX *ctx" "int mode"
diff --git a/src/lib/libssl/man/SSL_CTX_set_read_ahead.3 b/src/lib/libssl/man/SSL_CTX_set_read_ahead.3
index eae76eb472..208ecfbf1a 100644
--- a/src/lib/libssl/man/SSL_CTX_set_read_ahead.3
+++ b/src/lib/libssl/man/SSL_CTX_set_read_ahead.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_read_ahead.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_set_read_ahead.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Matt Caswell <matt@openssl.org>. 4.\" This file was written by Matt Caswell <matt@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_SET_READ_AHEAD 3 52.Dt SSL_CTX_SET_READ_AHEAD 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -59,6 +59,7 @@
59.Nm SSL_CTX_get_default_read_ahead 59.Nm SSL_CTX_get_default_read_ahead
60.Nd manage whether to read as many input bytes as possible 60.Nd manage whether to read as many input bytes as possible
61.Sh SYNOPSIS 61.Sh SYNOPSIS
62.Lb libssl libcrypto
62.In openssl/ssl.h 63.In openssl/ssl.h
63.Ft void 64.Ft void
64.Fo SSL_CTX_set_read_ahead 65.Fo SSL_CTX_set_read_ahead
diff --git a/src/lib/libssl/man/SSL_CTX_set_security_level.3 b/src/lib/libssl/man/SSL_CTX_set_security_level.3
index 89adb3d65d..2d3afa5785 100644
--- a/src/lib/libssl/man/SSL_CTX_set_security_level.3
+++ b/src/lib/libssl/man/SSL_CTX_set_security_level.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_security_level.3,v 1.2 2025/01/18 10:45:12 tb Exp $ 1.\" $OpenBSD: SSL_CTX_set_security_level.3,v 1.3 2025/06/08 22:52:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: January 18 2025 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt SSL_CTX_SET_SECURITY_LEVEL 3 18.Dt SSL_CTX_SET_SECURITY_LEVEL 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -24,6 +24,7 @@
24.Nm SSL_get_security_level 24.Nm SSL_get_security_level
25.Nd change security level for TLS 25.Nd change security level for TLS
26.Sh SYNOPSIS 26.Sh SYNOPSIS
27.Lb libssl libcrypto
27.In openssl/ssl.h 28.In openssl/ssl.h
28.Ft void 29.Ft void
29.Fo SSL_CTX_set_security_level 30.Fo SSL_CTX_set_security_level
diff --git a/src/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 b/src/lib/libssl/man/SSL_CTX_set_session_cache_mode.3
index 1fe67b2a7e..d19ff79545 100644
--- a/src/lib/libssl/man/SSL_CTX_set_session_cache_mode.3
+++ b/src/lib/libssl/man/SSL_CTX_set_session_cache_mode.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_session_cache_mode.3,v 1.7 2019/06/12 09:36:30 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_set_session_cache_mode.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL 67adf0a7 Dec 25 19:58:38 2016 +0100 2.\" OpenSSL 67adf0a7 Dec 25 19:58:38 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org> and 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org> and
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: June 12 2019 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_CTX_SET_SESSION_CACHE_MODE 3 53.Dt SSL_CTX_SET_SESSION_CACHE_MODE 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -57,6 +57,7 @@
57.Nm SSL_CTX_get_session_cache_mode 57.Nm SSL_CTX_get_session_cache_mode
58.Nd enable/disable session caching 58.Nd enable/disable session caching
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libssl libcrypto
60.In openssl/ssl.h 61.In openssl/ssl.h
61.Ft long 62.Ft long
62.Fn SSL_CTX_set_session_cache_mode "SSL_CTX ctx" "long mode" 63.Fn SSL_CTX_set_session_cache_mode "SSL_CTX ctx" "long mode"
diff --git a/src/lib/libssl/man/SSL_CTX_set_session_id_context.3 b/src/lib/libssl/man/SSL_CTX_set_session_id_context.3
index 06fd9348ae..53923888db 100644
--- a/src/lib/libssl/man/SSL_CTX_set_session_id_context.3
+++ b/src/lib/libssl/man/SSL_CTX_set_session_id_context.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_session_id_context.3,v 1.6 2019/06/08 15:25:43 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_set_session_id_context.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 8 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_SET_SESSION_ID_CONTEXT 3 52.Dt SSL_CTX_SET_SESSION_ID_CONTEXT 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -56,6 +56,7 @@
56.Nm SSL_set_session_id_context 56.Nm SSL_set_session_id_context
57.Nd set context within which session can be reused (server side only) 57.Nd set context within which session can be reused (server side only)
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libssl libcrypto
59.In openssl/ssl.h 60.In openssl/ssl.h
60.Ft int 61.Ft int
61.Fo SSL_CTX_set_session_id_context 62.Fo SSL_CTX_set_session_id_context
diff --git a/src/lib/libssl/man/SSL_CTX_set_ssl_version.3 b/src/lib/libssl/man/SSL_CTX_set_ssl_version.3
index b1bdb92bb0..fe9febe431 100644
--- a/src/lib/libssl/man/SSL_CTX_set_ssl_version.3
+++ b/src/lib/libssl/man/SSL_CTX_set_ssl_version.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_ssl_version.3,v 1.5 2021/05/11 19:48:56 tb Exp $ 1.\" $OpenBSD: SSL_CTX_set_ssl_version.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: May 11 2021 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_SET_SSL_VERSION 3 52.Dt SSL_CTX_SET_SSL_VERSION 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -58,6 +58,7 @@
58.Nm SSL_get_ssl_method 58.Nm SSL_get_ssl_method
59.Nd choose a new TLS/SSL method 59.Nd choose a new TLS/SSL method
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libssl libcrypto
61.In openssl/ssl.h 62.In openssl/ssl.h
62.Ft int 63.Ft int
63.Fn SSL_CTX_set_ssl_version "SSL_CTX *ctx" "const SSL_METHOD *method" 64.Fn SSL_CTX_set_ssl_version "SSL_CTX *ctx" "const SSL_METHOD *method"
diff --git a/src/lib/libssl/man/SSL_CTX_set_timeout.3 b/src/lib/libssl/man/SSL_CTX_set_timeout.3
index ab99e2016e..da2f811528 100644
--- a/src/lib/libssl/man/SSL_CTX_set_timeout.3
+++ b/src/lib/libssl/man/SSL_CTX_set_timeout.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_timeout.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_set_timeout.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_SET_TIMEOUT 3 52.Dt SSL_CTX_SET_TIMEOUT 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -56,6 +56,7 @@
56.Nm SSL_CTX_get_timeout 56.Nm SSL_CTX_get_timeout
57.Nd manipulate timeout values for session caching 57.Nd manipulate timeout values for session caching
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libssl libcrypto
59.In openssl/ssl.h 60.In openssl/ssl.h
60.Ft long 61.Ft long
61.Fn SSL_CTX_set_timeout "SSL_CTX *ctx" "long t" 62.Fn SSL_CTX_set_timeout "SSL_CTX *ctx" "long t"
diff --git a/src/lib/libssl/man/SSL_CTX_set_tlsext_servername_callback.3 b/src/lib/libssl/man/SSL_CTX_set_tlsext_servername_callback.3
index 2b54406de8..b6cece259c 100644
--- a/src/lib/libssl/man/SSL_CTX_set_tlsext_servername_callback.3
+++ b/src/lib/libssl/man/SSL_CTX_set_tlsext_servername_callback.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_tlsext_servername_callback.3,v 1.6 2021/09/01 13:56:03 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_set_tlsext_servername_callback.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL 190b9a03 Jun 28 15:46:13 2017 +0800 2.\" full merge up to: OpenSSL 190b9a03 Jun 28 15:46:13 2017 +0800
3.\" selective merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200 3.\" selective merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200
4.\" 4.\"
@@ -51,7 +51,7 @@
51.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
52.\" OF THE POSSIBILITY OF SUCH DAMAGE. 52.\" OF THE POSSIBILITY OF SUCH DAMAGE.
53.\" 53.\"
54.Dd $Mdocdate: September 1 2021 $ 54.Dd $Mdocdate: June 8 2025 $
55.Dt SSL_CTX_SET_TLSEXT_SERVERNAME_CALLBACK 3 55.Dt SSL_CTX_SET_TLSEXT_SERVERNAME_CALLBACK 3
56.Os 56.Os
57.Sh NAME 57.Sh NAME
@@ -62,6 +62,7 @@
62.Nm SSL_set_tlsext_host_name 62.Nm SSL_set_tlsext_host_name
63.Nd handle server name indication (SNI) 63.Nd handle server name indication (SNI)
64.Sh SYNOPSIS 64.Sh SYNOPSIS
65.Lb libssl libcrypto
65.In openssl/ssl.h 66.In openssl/ssl.h
66.Ft long 67.Ft long
67.Fo SSL_CTX_set_tlsext_servername_callback 68.Fo SSL_CTX_set_tlsext_servername_callback
@@ -84,7 +85,7 @@
84.Fc 85.Fc
85.Ft int 86.Ft int
86.Fo SSL_set_tlsext_host_name 87.Fo SSL_set_tlsext_host_name
87.Fa "const SSL *ssl" 88.Fa "SSL *ssl"
88.Fa "const char *name" 89.Fa "const char *name"
89.Fc 90.Fc
90.Sh DESCRIPTION 91.Sh DESCRIPTION
diff --git a/src/lib/libssl/man/SSL_CTX_set_tlsext_status_cb.3 b/src/lib/libssl/man/SSL_CTX_set_tlsext_status_cb.3
index d5979af1e8..c9763f9d2f 100644
--- a/src/lib/libssl/man/SSL_CTX_set_tlsext_status_cb.3
+++ b/src/lib/libssl/man/SSL_CTX_set_tlsext_status_cb.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_tlsext_status_cb.3,v 1.8 2021/09/11 18:58:41 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_set_tlsext_status_cb.3,v 1.9 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL 43c34894 Nov 30 16:04:51 2015 +0000 2.\" full merge up to: OpenSSL 43c34894 Nov 30 16:04:51 2015 +0000
3.\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 3.\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
4.\" 4.\"
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: September 11 2021 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_CTX_SET_TLSEXT_STATUS_CB 3 53.Dt SSL_CTX_SET_TLSEXT_STATUS_CB 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -63,6 +63,7 @@
63.Nm SSL_set_tlsext_status_ocsp_resp 63.Nm SSL_set_tlsext_status_ocsp_resp
64.Nd OCSP Certificate Status Request functions 64.Nd OCSP Certificate Status Request functions
65.Sh SYNOPSIS 65.Sh SYNOPSIS
66.Lb libssl libcrypto
66.In openssl/tls1.h 67.In openssl/tls1.h
67.Ft long 68.Ft long
68.Fo SSL_CTX_set_tlsext_status_cb 69.Fo SSL_CTX_set_tlsext_status_cb
diff --git a/src/lib/libssl/man/SSL_CTX_set_tlsext_ticket_key_cb.3 b/src/lib/libssl/man/SSL_CTX_set_tlsext_ticket_key_cb.3
index b6ccabaeca..0427f7dcf5 100644
--- a/src/lib/libssl/man/SSL_CTX_set_tlsext_ticket_key_cb.3
+++ b/src/lib/libssl/man/SSL_CTX_set_tlsext_ticket_key_cb.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_tlsext_ticket_key_cb.3,v 1.8 2022/01/25 18:01:20 tb Exp $ 1.\" $OpenBSD: SSL_CTX_set_tlsext_ticket_key_cb.3,v 1.9 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Rich Salz <rsalz@akamai.com> 4.\" This file was written by Rich Salz <rsalz@akamai.com>
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: January 25 2022 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_SET_TLSEXT_TICKET_KEY_CB 3 52.Dt SSL_CTX_SET_TLSEXT_TICKET_KEY_CB 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_CTX_set_tlsext_ticket_key_cb 55.Nm SSL_CTX_set_tlsext_ticket_key_cb
56.Nd set a callback for session ticket processing 56.Nd set a callback for session ticket processing
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libssl libcrypto
58.In openssl/tls1.h 59.In openssl/tls1.h
59.Ft long 60.Ft long
60.Fo SSL_CTX_set_tlsext_ticket_key_cb 61.Fo SSL_CTX_set_tlsext_ticket_key_cb
diff --git a/src/lib/libssl/man/SSL_CTX_set_tlsext_use_srtp.3 b/src/lib/libssl/man/SSL_CTX_set_tlsext_use_srtp.3
index 04c4833c6a..4acd452ad5 100644
--- a/src/lib/libssl/man/SSL_CTX_set_tlsext_use_srtp.3
+++ b/src/lib/libssl/man/SSL_CTX_set_tlsext_use_srtp.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_tlsext_use_srtp.3,v 1.6 2021/06/11 19:41:39 jmc Exp $ 1.\" $OpenBSD: SSL_CTX_set_tlsext_use_srtp.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL b0edda11 Mar 20 13:00:17 2018 +0000 2.\" full merge up to: OpenSSL b0edda11 Mar 20 13:00:17 2018 +0000
3.\" 3.\"
4.\" This file was written by Matt Caswell <matt@openssl.org>. 4.\" This file was written by Matt Caswell <matt@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 11 2021 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_SET_TLSEXT_USE_SRTP 3 52.Dt SSL_CTX_SET_TLSEXT_USE_SRTP 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -58,6 +58,7 @@
58.Nm SSL_get_selected_srtp_profile 58.Nm SSL_get_selected_srtp_profile
59.Nd Configure and query SRTP support 59.Nd Configure and query SRTP support
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libssl libcrypto
61.In openssl/srtp.h 62.In openssl/srtp.h
62.Ft int 63.Ft int
63.Fo SSL_CTX_set_tlsext_use_srtp 64.Fo SSL_CTX_set_tlsext_use_srtp
diff --git a/src/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 b/src/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3
index c6f5253431..9fa830656a 100644
--- a/src/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3
+++ b/src/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_tmp_dh_callback.3,v 1.11 2025/01/18 10:45:12 tb Exp $ 1.\" $OpenBSD: SSL_CTX_set_tmp_dh_callback.3,v 1.12 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: January 18 2025 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_SET_TMP_DH_CALLBACK 3 52.Dt SSL_CTX_SET_TMP_DH_CALLBACK 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -58,6 +58,7 @@
58.Nm SSL_set_tmp_dh 58.Nm SSL_set_tmp_dh
59.Nd handle DH keys for ephemeral key exchange 59.Nd handle DH keys for ephemeral key exchange
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libssl libcrypto
61.In openssl/ssl.h 62.In openssl/ssl.h
62.Ft void 63.Ft void
63.Fo SSL_CTX_set_tmp_dh_callback 64.Fo SSL_CTX_set_tmp_dh_callback
diff --git a/src/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 b/src/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3
index b4c3a3c647..7009ac6ab5 100644
--- a/src/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3
+++ b/src/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_tmp_rsa_callback.3,v 1.9 2022/03/29 14:27:59 naddy Exp $ 1.\" $OpenBSD: SSL_CTX_set_tmp_rsa_callback.3,v 1.10 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL 0b30fc90 Dec 19 15:23:05 2013 -0500 2.\" OpenSSL 0b30fc90 Dec 19 15:23:05 2013 -0500
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 29 2022 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_CTX_SET_TMP_RSA_CALLBACK 3 52.Dt SSL_CTX_SET_TMP_RSA_CALLBACK 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -60,6 +60,7 @@
60.Nm SSL_need_tmp_RSA 60.Nm SSL_need_tmp_RSA
61.Nd handle RSA keys for ephemeral key exchange 61.Nd handle RSA keys for ephemeral key exchange
62.Sh SYNOPSIS 62.Sh SYNOPSIS
63.Lb libssl libcrypto
63.In openssl/ssl.h 64.In openssl/ssl.h
64.Ft void 65.Ft void
65.Fo SSL_CTX_set_tmp_rsa_callback 66.Fo SSL_CTX_set_tmp_rsa_callback
diff --git a/src/lib/libssl/man/SSL_CTX_set_verify.3 b/src/lib/libssl/man/SSL_CTX_set_verify.3
index 1ed86407e9..656c85afd4 100644
--- a/src/lib/libssl/man/SSL_CTX_set_verify.3
+++ b/src/lib/libssl/man/SSL_CTX_set_verify.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_verify.3,v 1.9 2021/06/12 16:59:53 jmc Exp $ 1.\" $OpenBSD: SSL_CTX_set_verify.3,v 1.10 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 2.\" full merge up to: OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400
3.\" selective merge up to: OpenSSL 1cb7eff4 Sep 10 13:56:40 2019 +0100 3.\" selective merge up to: OpenSSL 1cb7eff4 Sep 10 13:56:40 2019 +0100
4.\" 4.\"
@@ -50,7 +50,7 @@
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\" 52.\"
53.Dd $Mdocdate: June 12 2021 $ 53.Dd $Mdocdate: June 8 2025 $
54.Dt SSL_CTX_SET_VERIFY 3 54.Dt SSL_CTX_SET_VERIFY 3
55.Os 55.Os
56.Sh NAME 56.Sh NAME
@@ -60,6 +60,7 @@
60.Nm SSL_set_verify_depth 60.Nm SSL_set_verify_depth
61.Nd set peer certificate verification parameters 61.Nd set peer certificate verification parameters
62.Sh SYNOPSIS 62.Sh SYNOPSIS
63.Lb libssl libcrypto
63.In openssl/ssl.h 64.In openssl/ssl.h
64.Ft void 65.Ft void
65.Fo SSL_CTX_set_verify 66.Fo SSL_CTX_set_verify
diff --git a/src/lib/libssl/man/SSL_CTX_use_certificate.3 b/src/lib/libssl/man/SSL_CTX_use_certificate.3
index c88a6971b2..27ec834d16 100644
--- a/src/lib/libssl/man/SSL_CTX_use_certificate.3
+++ b/src/lib/libssl/man/SSL_CTX_use_certificate.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_use_certificate.3,v 1.17 2025/01/18 10:45:12 tb Exp $ 1.\" $OpenBSD: SSL_CTX_use_certificate.3,v 1.18 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL 3aaa1bd0 Mar 28 16:35:25 2017 +1000 2.\" full merge up to: OpenSSL 3aaa1bd0 Mar 28 16:35:25 2017 +1000
3.\" selective merge up to: OpenSSL d1f7a1e6 Apr 26 14:05:40 2018 +0100 3.\" selective merge up to: OpenSSL d1f7a1e6 Apr 26 14:05:40 2018 +0100
4.\" 4.\"
@@ -50,7 +50,7 @@
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\" 52.\"
53.Dd $Mdocdate: January 18 2025 $ 53.Dd $Mdocdate: June 8 2025 $
54.Dt SSL_CTX_USE_CERTIFICATE 3 54.Dt SSL_CTX_USE_CERTIFICATE 3
55.Os 55.Os
56.Sh NAME 56.Sh NAME
@@ -79,6 +79,7 @@
79.Nm SSL_check_private_key 79.Nm SSL_check_private_key
80.Nd load certificate and key data 80.Nd load certificate and key data
81.Sh SYNOPSIS 81.Sh SYNOPSIS
82.Lb libssl libcrypto
82.In openssl/ssl.h 83.In openssl/ssl.h
83.Ft int 84.Ft int
84.Fn SSL_CTX_use_certificate "SSL_CTX *ctx" "X509 *x" 85.Fn SSL_CTX_use_certificate "SSL_CTX *ctx" "X509 *x"
diff --git a/src/lib/libssl/man/SSL_SESSION_free.3 b/src/lib/libssl/man/SSL_SESSION_free.3
index 3f785e95e5..af02a273a0 100644
--- a/src/lib/libssl/man/SSL_SESSION_free.3
+++ b/src/lib/libssl/man/SSL_SESSION_free.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_SESSION_free.3,v 1.7 2019/06/12 09:36:30 schwarze Exp $ 1.\" $OpenBSD: SSL_SESSION_free.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL b31db505 Mar 24 16:01:50 2017 +0000 2.\" full merge up to: OpenSSL b31db505 Mar 24 16:01:50 2017 +0000
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org> 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>
@@ -50,7 +50,7 @@
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\" 52.\"
53.Dd $Mdocdate: June 12 2019 $ 53.Dd $Mdocdate: June 8 2025 $
54.Dt SSL_SESSION_FREE 3 54.Dt SSL_SESSION_FREE 3
55.Os 55.Os
56.Sh NAME 56.Sh NAME
@@ -58,6 +58,7 @@
58.Nm SSL_SESSION_free 58.Nm SSL_SESSION_free
59.Nd SSL_SESSION reference counting 59.Nd SSL_SESSION reference counting
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libssl libcrypto
61.In openssl/ssl.h 62.In openssl/ssl.h
62.Ft int 63.Ft int
63.Fn SSL_SESSION_up_ref "SSL_SESSION *session" 64.Fn SSL_SESSION_up_ref "SSL_SESSION *session"
diff --git a/src/lib/libssl/man/SSL_SESSION_get0_cipher.3 b/src/lib/libssl/man/SSL_SESSION_get0_cipher.3
index 239a426dbd..4e5b0bb057 100644
--- a/src/lib/libssl/man/SSL_SESSION_get0_cipher.3
+++ b/src/lib/libssl/man/SSL_SESSION_get0_cipher.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_SESSION_get0_cipher.3,v 1.1 2021/05/12 14:16:25 tb Exp $ 1.\" $OpenBSD: SSL_SESSION_get0_cipher.3,v 1.2 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL d42e7759f Mar 30 19:40:04 2017 +0200 2.\" full merge up to: OpenSSL d42e7759f Mar 30 19:40:04 2017 +0200
3.\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 3.\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
4.\" 4.\"
@@ -49,13 +49,14 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: May 12 2021 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_SESSION_GET0_CIPHER 3 53.Dt SSL_SESSION_GET0_CIPHER 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
56.Nm SSL_SESSION_get0_cipher 56.Nm SSL_SESSION_get0_cipher
57.Nd retrieve the SSL cipher associated with a session 57.Nd retrieve the SSL cipher associated with a session
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libssl libcrypto
59.In openssl/ssl.h 60.In openssl/ssl.h
60.Ft const SSL_CIPHER * 61.Ft const SSL_CIPHER *
61.Fo SSL_SESSION_get0_cipher 62.Fo SSL_SESSION_get0_cipher
diff --git a/src/lib/libssl/man/SSL_SESSION_get0_peer.3 b/src/lib/libssl/man/SSL_SESSION_get0_peer.3
index 6b1ef6680e..98ae1bab9d 100644
--- a/src/lib/libssl/man/SSL_SESSION_get0_peer.3
+++ b/src/lib/libssl/man/SSL_SESSION_get0_peer.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_SESSION_get0_peer.3,v 1.2 2018/03/23 05:50:30 schwarze Exp $ 1.\" $OpenBSD: SSL_SESSION_get0_peer.3,v 1.3 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL SSL_SESSION_get0_peer.pod b31db505 Mar 24 16:01:50 2017 +0000 2.\" OpenSSL SSL_SESSION_get0_peer.pod b31db505 Mar 24 16:01:50 2017 +0000
3.\" 3.\"
4.\" This file was written by Matt Caswell <matt@openssl.org> 4.\" This file was written by Matt Caswell <matt@openssl.org>
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 23 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_SESSION_GET0_PEER 3 52.Dt SSL_SESSION_GET0_PEER 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_SESSION_get0_peer 55.Nm SSL_SESSION_get0_peer
56.Nd get details about peer's certificate for a session 56.Nd get details about peer's certificate for a session
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libssl libcrypto
58.In openssl/ssl.h 59.In openssl/ssl.h
59.Ft X509 * 60.Ft X509 *
60.Fo SSL_SESSION_get0_peer 61.Fo SSL_SESSION_get0_peer
diff --git a/src/lib/libssl/man/SSL_SESSION_get_compress_id.3 b/src/lib/libssl/man/SSL_SESSION_get_compress_id.3
index aedc216a15..da0d48ff6c 100644
--- a/src/lib/libssl/man/SSL_SESSION_get_compress_id.3
+++ b/src/lib/libssl/man/SSL_SESSION_get_compress_id.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_SESSION_get_compress_id.3,v 1.3 2018/03/23 05:50:30 schwarze Exp $ 1.\" $OpenBSD: SSL_SESSION_get_compress_id.3,v 1.4 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL SSL_SESSION_get_compress_id.pod b31db505 Mar 24 16:01:50 2017 2.\" OpenSSL SSL_SESSION_get_compress_id.pod b31db505 Mar 24 16:01:50 2017
3.\" 3.\"
4.\" This file was written by Matt Caswell <matt@openssl.org> 4.\" This file was written by Matt Caswell <matt@openssl.org>
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 23 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_SESSION_GET_COMPRESS_ID 3 52.Dt SSL_SESSION_GET_COMPRESS_ID 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_SESSION_get_compress_id 55.Nm SSL_SESSION_get_compress_id
56.Nd get details about the compression associated with a session 56.Nd get details about the compression associated with a session
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libssl libcrypto
58.In openssl/ssl.h 59.In openssl/ssl.h
59.Ft unsigned int 60.Ft unsigned int
60.Fo SSL_SESSION_get_compress_id 61.Fo SSL_SESSION_get_compress_id
diff --git a/src/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 b/src/lib/libssl/man/SSL_SESSION_get_ex_new_index.3
index 9fd6949b6a..55cde1c66b 100644
--- a/src/lib/libssl/man/SSL_SESSION_get_ex_new_index.3
+++ b/src/lib/libssl/man/SSL_SESSION_get_ex_new_index.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_SESSION_get_ex_new_index.3,v 1.3 2018/03/21 08:06:34 schwarze Exp $ 1.\" $OpenBSD: SSL_SESSION_get_ex_new_index.3,v 1.4 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 2.\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 21 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_SESSION_GET_EX_NEW_INDEX 3 52.Dt SSL_SESSION_GET_EX_NEW_INDEX 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -57,6 +57,7 @@
57.Nm SSL_SESSION_get_ex_data 57.Nm SSL_SESSION_get_ex_data
58.Nd internal application specific data functions 58.Nd internal application specific data functions
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libssl libcrypto
60.In openssl/ssl.h 61.In openssl/ssl.h
61.Ft int 62.Ft int
62.Fo SSL_SESSION_get_ex_new_index 63.Fo SSL_SESSION_get_ex_new_index
diff --git a/src/lib/libssl/man/SSL_SESSION_get_id.3 b/src/lib/libssl/man/SSL_SESSION_get_id.3
index 6d0de1e52e..eb14d24111 100644
--- a/src/lib/libssl/man/SSL_SESSION_get_id.3
+++ b/src/lib/libssl/man/SSL_SESSION_get_id.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_SESSION_get_id.3,v 1.6 2018/03/24 00:55:37 schwarze Exp $ 1.\" $OpenBSD: SSL_SESSION_get_id.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL SSL_SESSION_set1_id 17b60280 Dec 21 09:08:25 2017 +0100 3.\" OpenSSL SSL_SESSION_set1_id 17b60280 Dec 21 09:08:25 2017 +0100
4.\" 4.\"
@@ -50,7 +50,7 @@
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\" 52.\"
53.Dd $Mdocdate: March 24 2018 $ 53.Dd $Mdocdate: June 8 2025 $
54.Dt SSL_SESSION_GET_ID 3 54.Dt SSL_SESSION_GET_ID 3
55.Os 55.Os
56.Sh NAME 56.Sh NAME
@@ -58,6 +58,7 @@
58.Nm SSL_SESSION_set1_id 58.Nm SSL_SESSION_set1_id
59.Nd get and set the SSL session ID 59.Nd get and set the SSL session ID
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libssl libcrypto
61.In openssl/ssl.h 62.In openssl/ssl.h
62.Ft const unsigned char * 63.Ft const unsigned char *
63.Fo SSL_SESSION_get_id 64.Fo SSL_SESSION_get_id
diff --git a/src/lib/libssl/man/SSL_SESSION_get_protocol_version.3 b/src/lib/libssl/man/SSL_SESSION_get_protocol_version.3
index f14c0490e9..dad9eab7ef 100644
--- a/src/lib/libssl/man/SSL_SESSION_get_protocol_version.3
+++ b/src/lib/libssl/man/SSL_SESSION_get_protocol_version.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_SESSION_get_protocol_version.3,v 1.2 2018/03/24 00:55:37 schwarze Exp $ 1.\" $OpenBSD: SSL_SESSION_get_protocol_version.3,v 1.3 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by TJ Saunders <tj@castaglia.org> 4.\" This file was written by TJ Saunders <tj@castaglia.org>
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 24 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_SESSION_GET_PROTOCOL_VERSION 3 52.Dt SSL_SESSION_GET_PROTOCOL_VERSION 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_SESSION_get_protocol_version 55.Nm SSL_SESSION_get_protocol_version
56.Nd get the session protocol version 56.Nd get the session protocol version
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libssl libcrypto
58.In openssl/ssl.h 59.In openssl/ssl.h
59.Ft int 60.Ft int
60.Fo SSL_SESSION_get_protocol_version 61.Fo SSL_SESSION_get_protocol_version
diff --git a/src/lib/libssl/man/SSL_SESSION_get_time.3 b/src/lib/libssl/man/SSL_SESSION_get_time.3
index aaadec5137..28aeedf72c 100644
--- a/src/lib/libssl/man/SSL_SESSION_get_time.3
+++ b/src/lib/libssl/man/SSL_SESSION_get_time.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_SESSION_get_time.3,v 1.8 2019/06/08 15:25:43 schwarze Exp $ 1.\" $OpenBSD: SSL_SESSION_get_time.3,v 1.9 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: June 8 2019 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_SESSION_GET_TIME 3 53.Dt SSL_SESSION_GET_TIME 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -63,6 +63,7 @@
63.Nm SSL_set_timeout 63.Nm SSL_set_timeout
64.Nd retrieve and manipulate session time and timeout settings 64.Nd retrieve and manipulate session time and timeout settings
65.Sh SYNOPSIS 65.Sh SYNOPSIS
66.Lb libssl libcrypto
66.In openssl/ssl.h 67.In openssl/ssl.h
67.Ft long 68.Ft long
68.Fn SSL_SESSION_get_time "const SSL_SESSION *s" 69.Fn SSL_SESSION_get_time "const SSL_SESSION *s"
diff --git a/src/lib/libssl/man/SSL_SESSION_has_ticket.3 b/src/lib/libssl/man/SSL_SESSION_has_ticket.3
index 322b49feef..07b894c4f8 100644
--- a/src/lib/libssl/man/SSL_SESSION_has_ticket.3
+++ b/src/lib/libssl/man/SSL_SESSION_has_ticket.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_SESSION_has_ticket.3,v 1.2 2018/03/24 00:55:37 schwarze Exp $ 1.\" $OpenBSD: SSL_SESSION_has_ticket.3,v 1.3 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL f2baac27 Feb 8 15:43:16 2015 +0000 2.\" full merge up to: OpenSSL f2baac27 Feb 8 15:43:16 2015 +0000
3.\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 3.\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800
4.\" 4.\"
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: March 24 2018 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_SESSION_HAS_TICKET 3 53.Dt SSL_SESSION_HAS_TICKET 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -57,6 +57,7 @@
57.Nm SSL_SESSION_get_ticket_lifetime_hint 57.Nm SSL_SESSION_get_ticket_lifetime_hint
58.Nd get details about the ticket associated with a session 58.Nd get details about the ticket associated with a session
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libssl libcrypto
60.In openssl/ssl.h 61.In openssl/ssl.h
61.Ft int 62.Ft int
62.Fo SSL_SESSION_has_ticket 63.Fo SSL_SESSION_has_ticket
diff --git a/src/lib/libssl/man/SSL_SESSION_is_resumable.3 b/src/lib/libssl/man/SSL_SESSION_is_resumable.3
index 48d7d17889..ddc037c1aa 100644
--- a/src/lib/libssl/man/SSL_SESSION_is_resumable.3
+++ b/src/lib/libssl/man/SSL_SESSION_is_resumable.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_SESSION_is_resumable.3,v 1.1 2021/09/14 14:08:15 schwarze Exp $ 1.\" $OpenBSD: SSL_SESSION_is_resumable.3,v 1.2 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 2.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
3.\" 3.\"
4.\" This file was written by Matt Caswell <matt@openssl.org>. 4.\" This file was written by Matt Caswell <matt@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: September 14 2021 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_SESSION_IS_RESUMABLE 3 52.Dt SSL_SESSION_IS_RESUMABLE 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_SESSION_is_resumable 55.Nm SSL_SESSION_is_resumable
56.Nd determine whether an SSL_SESSION object can be used for resumption 56.Nd determine whether an SSL_SESSION object can be used for resumption
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libssl libcrypto
58.In openssl/ssl.h 59.In openssl/ssl.h
59.Ft int 60.Ft int
60.Fo SSL_SESSION_is_resumable 61.Fo SSL_SESSION_is_resumable
diff --git a/src/lib/libssl/man/SSL_SESSION_new.3 b/src/lib/libssl/man/SSL_SESSION_new.3
index 2dcdb264c1..88d1995850 100644
--- a/src/lib/libssl/man/SSL_SESSION_new.3
+++ b/src/lib/libssl/man/SSL_SESSION_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_SESSION_new.3,v 1.9 2021/09/14 14:08:15 schwarze Exp $ 1.\" $OpenBSD: SSL_SESSION_new.3,v 1.10 2025/06/08 22:52:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: September 14 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt SSL_SESSION_NEW 3 18.Dt SSL_SESSION_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm SSL_SESSION_new 21.Nm SSL_SESSION_new
22.Nd construct a new SSL_SESSION object 22.Nd construct a new SSL_SESSION object
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libssl libcrypto
24.In openssl/ssl.h 25.In openssl/ssl.h
25.Ft SSL_SESSION * 26.Ft SSL_SESSION *
26.Fn SSL_SESSION_new void 27.Fn SSL_SESSION_new void
diff --git a/src/lib/libssl/man/SSL_SESSION_print.3 b/src/lib/libssl/man/SSL_SESSION_print.3
index e92debde0e..65742140d0 100644
--- a/src/lib/libssl/man/SSL_SESSION_print.3
+++ b/src/lib/libssl/man/SSL_SESSION_print.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_SESSION_print.3,v 1.4 2019/06/12 09:36:30 schwarze Exp $ 1.\" $OpenBSD: SSL_SESSION_print.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 12 2019 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt SSL_SESSION_PRINT 3 18.Dt SSL_SESSION_PRINT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm SSL_SESSION_print_fp 22.Nm SSL_SESSION_print_fp
23.Nd print some properties of an SSL_SESSION object 23.Nd print some properties of an SSL_SESSION object
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libssl libcrypto
25.In openssl/ssl.h 26.In openssl/ssl.h
26.Ft int 27.Ft int
27.Fo SSL_SESSION_print 28.Fo SSL_SESSION_print
diff --git a/src/lib/libssl/man/SSL_SESSION_set1_id_context.3 b/src/lib/libssl/man/SSL_SESSION_set1_id_context.3
index dd7595baca..24f1de4fda 100644
--- a/src/lib/libssl/man/SSL_SESSION_set1_id_context.3
+++ b/src/lib/libssl/man/SSL_SESSION_set1_id_context.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_SESSION_set1_id_context.3,v 1.4 2018/03/24 00:55:37 schwarze Exp $ 1.\" $OpenBSD: SSL_SESSION_set1_id_context.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL SSL_SESSION_get0_id_context b31db505 Mar 24 16:01:50 2017 3.\" OpenSSL SSL_SESSION_get0_id_context b31db505 Mar 24 16:01:50 2017
4.\" 4.\"
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: March 24 2018 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_SESSION_SET1_ID_CONTEXT 3 53.Dt SSL_SESSION_SET1_ID_CONTEXT 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -57,6 +57,7 @@
57.Nm SSL_SESSION_set1_id_context 57.Nm SSL_SESSION_set1_id_context
58.Nd get and set the SSL ID context associated with a session 58.Nd get and set the SSL ID context associated with a session
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libssl libcrypto
60.In openssl/ssl.h 61.In openssl/ssl.h
61.Ft const unsigned char * 62.Ft const unsigned char *
62.Fo SSL_SESSION_get0_id_context 63.Fo SSL_SESSION_get0_id_context
diff --git a/src/lib/libssl/man/SSL_accept.3 b/src/lib/libssl/man/SSL_accept.3
index fb1d89eb57..ecb757aaa5 100644
--- a/src/lib/libssl/man/SSL_accept.3
+++ b/src/lib/libssl/man/SSL_accept.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_accept.3,v 1.6 2019/06/08 15:25:43 schwarze Exp $ 1.\" $OpenBSD: SSL_accept.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -49,13 +49,14 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: June 8 2019 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_ACCEPT 3 53.Dt SSL_ACCEPT 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
56.Nm SSL_accept 56.Nm SSL_accept
57.Nd wait for a TLS/SSL client to initiate a TLS/SSL handshake 57.Nd wait for a TLS/SSL client to initiate a TLS/SSL handshake
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libssl libcrypto
59.In openssl/ssl.h 60.In openssl/ssl.h
60.Ft int 61.Ft int
61.Fn SSL_accept "SSL *ssl" 62.Fn SSL_accept "SSL *ssl"
diff --git a/src/lib/libssl/man/SSL_alert_type_string.3 b/src/lib/libssl/man/SSL_alert_type_string.3
index 354865e546..0f051cc0a6 100644
--- a/src/lib/libssl/man/SSL_alert_type_string.3
+++ b/src/lib/libssl/man/SSL_alert_type_string.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_alert_type_string.3,v 1.7 2024/10/13 08:25:09 jsg Exp $ 1.\" $OpenBSD: SSL_alert_type_string.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: October 13 2024 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_ALERT_TYPE_STRING 3 52.Dt SSL_ALERT_TYPE_STRING 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -58,6 +58,7 @@
58.Nm SSL_alert_desc_string_long 58.Nm SSL_alert_desc_string_long
59.Nd get textual description of alert information 59.Nd get textual description of alert information
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libssl libcrypto
61.In openssl/ssl.h 62.In openssl/ssl.h
62.Ft const char * 63.Ft const char *
63.Fn SSL_alert_type_string "int value" 64.Fn SSL_alert_type_string "int value"
diff --git a/src/lib/libssl/man/SSL_clear.3 b/src/lib/libssl/man/SSL_clear.3
index 809c3b20f4..5e4da1257f 100644
--- a/src/lib/libssl/man/SSL_clear.3
+++ b/src/lib/libssl/man/SSL_clear.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_clear.3,v 1.5 2021/06/11 19:41:39 jmc Exp $ 1.\" $OpenBSD: SSL_clear.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -49,13 +49,14 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: June 11 2021 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_CLEAR 3 53.Dt SSL_CLEAR 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
56.Nm SSL_clear 56.Nm SSL_clear
57.Nd reset SSL object to allow another connection 57.Nd reset SSL object to allow another connection
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libssl libcrypto
59.In openssl/ssl.h 60.In openssl/ssl.h
60.Ft int 61.Ft int
61.Fn SSL_clear "SSL *ssl" 62.Fn SSL_clear "SSL *ssl"
diff --git a/src/lib/libssl/man/SSL_connect.3 b/src/lib/libssl/man/SSL_connect.3
index d5b962a480..a0cd8f8443 100644
--- a/src/lib/libssl/man/SSL_connect.3
+++ b/src/lib/libssl/man/SSL_connect.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_connect.3,v 1.6 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_connect.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -49,13 +49,14 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: March 27 2018 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_CONNECT 3 53.Dt SSL_CONNECT 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
56.Nm SSL_connect 56.Nm SSL_connect
57.Nd initiate the TLS/SSL handshake with a TLS/SSL server 57.Nd initiate the TLS/SSL handshake with a TLS/SSL server
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libssl libcrypto
59.In openssl/ssl.h 60.In openssl/ssl.h
60.Ft int 61.Ft int
61.Fn SSL_connect "SSL *ssl" 62.Fn SSL_connect "SSL *ssl"
diff --git a/src/lib/libssl/man/SSL_copy_session_id.3 b/src/lib/libssl/man/SSL_copy_session_id.3
index a7a7a8aa99..75a52e8879 100644
--- a/src/lib/libssl/man/SSL_copy_session_id.3
+++ b/src/lib/libssl/man/SSL_copy_session_id.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_copy_session_id.3,v 1.7 2019/06/12 09:36:30 schwarze Exp $ 1.\" $OpenBSD: SSL_copy_session_id.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 12 2019 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt SSL_COPY_SESSION_ID 3 18.Dt SSL_COPY_SESSION_ID 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm SSL_copy_session_id 21.Nm SSL_copy_session_id
22.Nd copy session details between SSL objects 22.Nd copy session details between SSL objects
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libssl libcrypto
24.In openssl/ssl.h 25.In openssl/ssl.h
25.Ft int 26.Ft int
26.Fo SSL_copy_session_id 27.Fo SSL_copy_session_id
diff --git a/src/lib/libssl/man/SSL_do_handshake.3 b/src/lib/libssl/man/SSL_do_handshake.3
index e9327b4229..78b41db2f4 100644
--- a/src/lib/libssl/man/SSL_do_handshake.3
+++ b/src/lib/libssl/man/SSL_do_handshake.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_do_handshake.3,v 1.6 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_do_handshake.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Martin Sjoegren <martin@strakt.com>. 4.\" This file was written by Martin Sjoegren <martin@strakt.com>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_DO_HANDSHAKE 3 52.Dt SSL_DO_HANDSHAKE 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_do_handshake 55.Nm SSL_do_handshake
56.Nd perform a TLS/SSL handshake 56.Nd perform a TLS/SSL handshake
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libssl libcrypto
58.In openssl/ssl.h 59.In openssl/ssl.h
59.Ft int 60.Ft int
60.Fn SSL_do_handshake "SSL *ssl" 61.Fn SSL_do_handshake "SSL *ssl"
diff --git a/src/lib/libssl/man/SSL_dup.3 b/src/lib/libssl/man/SSL_dup.3
index a83440b431..f7d999fb62 100644
--- a/src/lib/libssl/man/SSL_dup.3
+++ b/src/lib/libssl/man/SSL_dup.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_dup.3,v 1.5 2022/07/13 22:05:53 schwarze Exp $ 1.\" $OpenBSD: SSL_dup.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: July 13 2022 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt SSL_DUP 3 18.Dt SSL_DUP 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm SSL_dup 21.Nm SSL_dup
22.Nd deep copy of an SSL object 22.Nd deep copy of an SSL object
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libssl libcrypto
24.In openssl/ssl.h 25.In openssl/ssl.h
25.Ft SSL * 26.Ft SSL *
26.Fo SSL_dup 27.Fo SSL_dup
diff --git a/src/lib/libssl/man/SSL_dup_CA_list.3 b/src/lib/libssl/man/SSL_dup_CA_list.3
index d073b07176..553c03bd8c 100644
--- a/src/lib/libssl/man/SSL_dup_CA_list.3
+++ b/src/lib/libssl/man/SSL_dup_CA_list.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_dup_CA_list.3,v 1.6 2019/06/12 09:36:30 schwarze Exp $ 1.\" $OpenBSD: SSL_dup_CA_list.3,v 1.7 2025/06/08 22:47:20 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 12 2019 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt SSL_DUP_CA_LIST 3 18.Dt SSL_DUP_CA_LIST 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,8 @@
22.Nd deep copy of a stack of X.509 Name objects 22.Nd deep copy of a stack of X.509 Name objects
23.\" The capital "N" in "Name" is intentional (X.509 syntax). 23.\" The capital "N" in "Name" is intentional (X.509 syntax).
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libssl libcrypto
26.In openssl/ssl.h
25.Ft STACK_OF(X509_NAME) * 27.Ft STACK_OF(X509_NAME) *
26.Fo SSL_dup_CA_list 28.Fo SSL_dup_CA_list
27.Fa "const STACK_OF(X509_NAME) *sk" 29.Fa "const STACK_OF(X509_NAME) *sk"
diff --git a/src/lib/libssl/man/SSL_export_keying_material.3 b/src/lib/libssl/man/SSL_export_keying_material.3
index e32a5c5d61..d3daa3a5a3 100644
--- a/src/lib/libssl/man/SSL_export_keying_material.3
+++ b/src/lib/libssl/man/SSL_export_keying_material.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_export_keying_material.3,v 1.3 2019/06/12 09:36:30 schwarze Exp $ 1.\" $OpenBSD: SSL_export_keying_material.3,v 1.4 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL a599574b Jun 28 17:18:27 2017 +0100 2.\" OpenSSL a599574b Jun 28 17:18:27 2017 +0100
3.\" OpenSSL 23cec1f4 Jun 21 13:55:02 2017 +0100 3.\" OpenSSL 23cec1f4 Jun 21 13:55:02 2017 +0100
4.\" 4.\"
@@ -49,13 +49,14 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: June 12 2019 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_EXPORT_KEYING_MATERIAL 3 53.Dt SSL_EXPORT_KEYING_MATERIAL 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
56.Nm SSL_export_keying_material 56.Nm SSL_export_keying_material
57.Nd obtain keying material for application use 57.Nd obtain keying material for application use
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libssl libcrypto
59.In openssl/ssl.h 60.In openssl/ssl.h
60.Ft int 61.Ft int
61.Fo SSL_export_keying_material 62.Fo SSL_export_keying_material
diff --git a/src/lib/libssl/man/SSL_free.3 b/src/lib/libssl/man/SSL_free.3
index c713ded121..b630bc8a2e 100644
--- a/src/lib/libssl/man/SSL_free.3
+++ b/src/lib/libssl/man/SSL_free.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_free.3,v 1.6 2021/06/11 19:41:39 jmc Exp $ 1.\" $OpenBSD: SSL_free.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 11 2021 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_FREE 3 52.Dt SSL_FREE 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_free 55.Nm SSL_free
56.Nd free an allocated SSL structure 56.Nd free an allocated SSL structure
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libssl libcrypto
58.In openssl/ssl.h 59.In openssl/ssl.h
59.Ft void 60.Ft void
60.Fn SSL_free "SSL *ssl" 61.Fn SSL_free "SSL *ssl"
diff --git a/src/lib/libssl/man/SSL_get_SSL_CTX.3 b/src/lib/libssl/man/SSL_get_SSL_CTX.3
index 60fda555bc..eaf1b6ff11 100644
--- a/src/lib/libssl/man/SSL_get_SSL_CTX.3
+++ b/src/lib/libssl/man/SSL_get_SSL_CTX.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_SSL_CTX.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_get_SSL_CTX.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_GET_SSL_CTX 3 52.Dt SSL_GET_SSL_CTX 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_get_SSL_CTX 55.Nm SSL_get_SSL_CTX
56.Nd get the SSL_CTX from which an SSL is created 56.Nd get the SSL_CTX from which an SSL is created
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libssl libcrypto
58.In openssl/ssl.h 59.In openssl/ssl.h
59.Ft SSL_CTX * 60.Ft SSL_CTX *
60.Fn SSL_get_SSL_CTX "const SSL *ssl" 61.Fn SSL_get_SSL_CTX "const SSL *ssl"
diff --git a/src/lib/libssl/man/SSL_get_certificate.3 b/src/lib/libssl/man/SSL_get_certificate.3
index eb53ea49bf..72ae7ec541 100644
--- a/src/lib/libssl/man/SSL_get_certificate.3
+++ b/src/lib/libssl/man/SSL_get_certificate.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_certificate.3,v 1.5 2019/06/12 09:36:30 schwarze Exp $ 1.\" $OpenBSD: SSL_get_certificate.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 12 2019 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt SSL_GET_CERTIFICATE 3 18.Dt SSL_GET_CERTIFICATE 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm SSL_get_privatekey 22.Nm SSL_get_privatekey
23.Nd get SSL certificate and private key 23.Nd get SSL certificate and private key
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libssl libcrypto
25.In openssl/ssl.h 26.In openssl/ssl.h
26.Ft X509 * 27.Ft X509 *
27.Fo SSL_get_certificate 28.Fo SSL_get_certificate
diff --git a/src/lib/libssl/man/SSL_get_ciphers.3 b/src/lib/libssl/man/SSL_get_ciphers.3
index 8030f0bbb1..d723f7959e 100644
--- a/src/lib/libssl/man/SSL_get_ciphers.3
+++ b/src/lib/libssl/man/SSL_get_ciphers.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_ciphers.3,v 1.11 2020/09/16 07:25:15 schwarze Exp $ 1.\" $OpenBSD: SSL_get_ciphers.3,v 1.12 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" selective merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 3.\" selective merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100
4.\" 4.\"
@@ -69,7 +69,7 @@
69.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 69.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
70.\" OF THE POSSIBILITY OF SUCH DAMAGE. 70.\" OF THE POSSIBILITY OF SUCH DAMAGE.
71.\" 71.\"
72.Dd $Mdocdate: September 16 2020 $ 72.Dd $Mdocdate: June 8 2025 $
73.Dt SSL_GET_CIPHERS 3 73.Dt SSL_GET_CIPHERS 3
74.Os 74.Os
75.Sh NAME 75.Sh NAME
@@ -80,6 +80,7 @@
80.Nm SSL_get_cipher_list 80.Nm SSL_get_cipher_list
81.Nd get lists of available SSL_CIPHERs 81.Nd get lists of available SSL_CIPHERs
82.Sh SYNOPSIS 82.Sh SYNOPSIS
83.Lb libssl libcrypto
83.In openssl/ssl.h 84.In openssl/ssl.h
84.Ft STACK_OF(SSL_CIPHER) * 85.Ft STACK_OF(SSL_CIPHER) *
85.Fn SSL_get_ciphers "const SSL *ssl" 86.Fn SSL_get_ciphers "const SSL *ssl"
diff --git a/src/lib/libssl/man/SSL_get_client_CA_list.3 b/src/lib/libssl/man/SSL_get_client_CA_list.3
index e80e5cb6f5..8be7020489 100644
--- a/src/lib/libssl/man/SSL_get_client_CA_list.3
+++ b/src/lib/libssl/man/SSL_get_client_CA_list.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_client_CA_list.3,v 1.5 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_get_client_CA_list.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: March 27 2018 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_GET_CLIENT_CA_LIST 3 53.Dt SSL_GET_CLIENT_CA_LIST 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -57,6 +57,7 @@
57.Nm SSL_CTX_get_client_CA_list 57.Nm SSL_CTX_get_client_CA_list
58.Nd get list of client CAs 58.Nd get list of client CAs
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libssl libcrypto
60.In openssl/ssl.h 61.In openssl/ssl.h
61.Ft STACK_OF(X509_NAME) * 62.Ft STACK_OF(X509_NAME) *
62.Fn SSL_get_client_CA_list "const SSL *s" 63.Fn SSL_get_client_CA_list "const SSL *s"
diff --git a/src/lib/libssl/man/SSL_get_client_random.3 b/src/lib/libssl/man/SSL_get_client_random.3
index eda74db355..131972b688 100644
--- a/src/lib/libssl/man/SSL_get_client_random.3
+++ b/src/lib/libssl/man/SSL_get_client_random.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_client_random.3,v 1.2 2018/03/24 00:55:37 schwarze Exp $ 1.\" $OpenBSD: SSL_get_client_random.3,v 1.3 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
3.\" 3.\"
4.\" This file was written by Nick Mathewson <nickm@torproject.org> 4.\" This file was written by Nick Mathewson <nickm@torproject.org>
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 24 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_GET_CLIENT_RANDOM 3 52.Dt SSL_GET_CLIENT_RANDOM 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -57,6 +57,7 @@
57.Nm SSL_SESSION_get_master_key 57.Nm SSL_SESSION_get_master_key
58.Nd get internal TLS handshake random values and master key 58.Nd get internal TLS handshake random values and master key
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libssl libcrypto
60.In openssl/ssl.h 61.In openssl/ssl.h
61.Ft size_t 62.Ft size_t
62.Fo SSL_get_client_random 63.Fo SSL_get_client_random
diff --git a/src/lib/libssl/man/SSL_get_current_cipher.3 b/src/lib/libssl/man/SSL_get_current_cipher.3
index 6b951d03ca..37f6409023 100644
--- a/src/lib/libssl/man/SSL_get_current_cipher.3
+++ b/src/lib/libssl/man/SSL_get_current_cipher.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_current_cipher.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_get_current_cipher.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,17 +48,18 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_GET_CURRENT_CIPHER 3 52.Dt SSL_GET_CURRENT_CIPHER 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_get_current_cipher , 55.Nm SSL_get_current_cipher ,
56.Nm SSL_get_cipher , 56.Nm SSL_get_cipher ,
57.Nm SSL_get_cipher_name , 57.Nm SSL_get_cipher_name ,
58.Nm SSL_get_cipher_bits , 58.Nm SSL_get_cipher_bits ,
59.Nm SSL_get_cipher_version 59.Nm SSL_get_cipher_version
60.Nd get SSL_CIPHER of a connection 60.Nd get SSL_CIPHER of a connection
61.Sh SYNOPSIS 61.Sh SYNOPSIS
62.Lb libssl libcrypto
62.In openssl/ssl.h 63.In openssl/ssl.h
63.Ft const SSL_CIPHER * 64.Ft const SSL_CIPHER *
64.Fn SSL_get_current_cipher "const SSL *ssl" 65.Fn SSL_get_current_cipher "const SSL *ssl"
diff --git a/src/lib/libssl/man/SSL_get_default_timeout.3 b/src/lib/libssl/man/SSL_get_default_timeout.3
index 47737d8ee0..ef119780a3 100644
--- a/src/lib/libssl/man/SSL_get_default_timeout.3
+++ b/src/lib/libssl/man/SSL_get_default_timeout.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_default_timeout.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_get_default_timeout.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_GET_DEFAULT_TIMEOUT 3 52.Dt SSL_GET_DEFAULT_TIMEOUT 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_get_default_timeout 55.Nm SSL_get_default_timeout
56.Nd get default session timeout value 56.Nd get default session timeout value
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libssl libcrypto
58.In openssl/ssl.h 59.In openssl/ssl.h
59.Ft long 60.Ft long
60.Fn SSL_get_default_timeout "const SSL *ssl" 61.Fn SSL_get_default_timeout "const SSL *ssl"
diff --git a/src/lib/libssl/man/SSL_get_error.3 b/src/lib/libssl/man/SSL_get_error.3
index 5d325b3f56..ba64b779ac 100644
--- a/src/lib/libssl/man/SSL_get_error.3
+++ b/src/lib/libssl/man/SSL_get_error.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_error.3,v 1.5 2018/04/29 07:37:01 guenther Exp $ 1.\" $OpenBSD: SSL_get_error.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 2.\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400
3.\" 3.\"
4.\" This file was written by Bodo Moeller <bodo@openssl.org>. 4.\" This file was written by Bodo Moeller <bodo@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: April 29 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_GET_ERROR 3 52.Dt SSL_GET_ERROR 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_get_error 55.Nm SSL_get_error
56.Nd obtain result code for TLS/SSL I/O operation 56.Nd obtain result code for TLS/SSL I/O operation
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libssl libcrypto
58.In openssl/ssl.h 59.In openssl/ssl.h
59.Ft int 60.Ft int
60.Fn SSL_get_error "const SSL *ssl" "int ret" 61.Fn SSL_get_error "const SSL *ssl" "int ret"
diff --git a/src/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 b/src/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3
index a249cda6ac..234034ac2d 100644
--- a/src/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3
+++ b/src/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_ex_data_X509_STORE_CTX_idx.3,v 1.5 2022/02/06 00:29:02 jsg Exp $ 1.\" $OpenBSD: SSL_get_ex_data_X509_STORE_CTX_idx.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 2.\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: February 6 2022 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_GET_EX_DATA_X509_STORE_CTX_IDX 3 52.Dt SSL_GET_EX_DATA_X509_STORE_CTX_IDX 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_get_ex_data_X509_STORE_CTX_idx 55.Nm SSL_get_ex_data_X509_STORE_CTX_idx
56.Nd get ex_data index to access SSL structure from X509_STORE_CTX 56.Nd get ex_data index to access SSL structure from X509_STORE_CTX
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libssl libcrypto
58.In openssl/ssl.h 59.In openssl/ssl.h
59.Ft int 60.Ft int
60.Fn SSL_get_ex_data_X509_STORE_CTX_idx void 61.Fn SSL_get_ex_data_X509_STORE_CTX_idx void
diff --git a/src/lib/libssl/man/SSL_get_ex_new_index.3 b/src/lib/libssl/man/SSL_get_ex_new_index.3
index cecd25fa44..811df94fc7 100644
--- a/src/lib/libssl/man/SSL_get_ex_new_index.3
+++ b/src/lib/libssl/man/SSL_get_ex_new_index.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_ex_new_index.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_get_ex_new_index.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 2.\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_GET_EX_NEW_INDEX 3 52.Dt SSL_GET_EX_NEW_INDEX 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -57,6 +57,7 @@
57.Nm SSL_get_ex_data 57.Nm SSL_get_ex_data
58.Nd internal application specific data functions 58.Nd internal application specific data functions
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libssl libcrypto
60.In openssl/ssl.h 61.In openssl/ssl.h
61.Ft int 62.Ft int
62.Fo SSL_get_ex_new_index 63.Fo SSL_get_ex_new_index
diff --git a/src/lib/libssl/man/SSL_get_fd.3 b/src/lib/libssl/man/SSL_get_fd.3
index 1e093424cb..3a7948d35f 100644
--- a/src/lib/libssl/man/SSL_get_fd.3
+++ b/src/lib/libssl/man/SSL_get_fd.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_fd.3,v 1.6 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_get_fd.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_GET_FD 3 52.Dt SSL_GET_FD 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -57,6 +57,7 @@
57.Nm SSL_get_wfd 57.Nm SSL_get_wfd
58.Nd get file descriptor linked to an SSL object 58.Nd get file descriptor linked to an SSL object
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libssl libcrypto
60.In openssl/ssl.h 61.In openssl/ssl.h
61.Ft int 62.Ft int
62.Fn SSL_get_fd "const SSL *ssl" 63.Fn SSL_get_fd "const SSL *ssl"
diff --git a/src/lib/libssl/man/SSL_get_finished.3 b/src/lib/libssl/man/SSL_get_finished.3
index 3cfb655ea0..e5c8a36cf6 100644
--- a/src/lib/libssl/man/SSL_get_finished.3
+++ b/src/lib/libssl/man/SSL_get_finished.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_finished.3,v 1.2 2021/01/30 10:48:15 tb Exp $ 1.\" $OpenBSD: SSL_get_finished.3,v 1.3 2025/06/08 22:52:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2020 Theo Buehler <tb@openbsd.org> 3.\" Copyright (c) 2020 Theo Buehler <tb@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: January 30 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt SSL_GET_FINISHED 3 18.Dt SSL_GET_FINISHED 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -22,6 +22,7 @@
22.Nm SSL_get_peer_finished 22.Nm SSL_get_peer_finished
23.Nd get last sent or last expected finished message 23.Nd get last sent or last expected finished message
24.Sh SYNOPSIS 24.Sh SYNOPSIS
25.Lb libssl libcrypto
25.In openssl/ssl.h 26.In openssl/ssl.h
26.Ft size_t 27.Ft size_t
27.Fn SSL_get_finished "const SSL *ssl" "void *buf" "size_t count" 28.Fn SSL_get_finished "const SSL *ssl" "void *buf" "size_t count"
diff --git a/src/lib/libssl/man/SSL_get_peer_cert_chain.3 b/src/lib/libssl/man/SSL_get_peer_cert_chain.3
index eb2ae53dc4..c4f778aac6 100644
--- a/src/lib/libssl/man/SSL_get_peer_cert_chain.3
+++ b/src/lib/libssl/man/SSL_get_peer_cert_chain.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_peer_cert_chain.3,v 1.5 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_get_peer_cert_chain.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL SSL_get_peer_cert_chain.pod 1f164c6f Jan 18 01:40:36 2017 +0100 2.\" OpenSSL SSL_get_peer_cert_chain.pod 1f164c6f Jan 18 01:40:36 2017 +0100
3.\" OpenSSL SSL_get_peer_cert_chain.pod 9b86974e Aug 17 15:21:33 2015 -0400 3.\" OpenSSL SSL_get_peer_cert_chain.pod 9b86974e Aug 17 15:21:33 2015 -0400
4.\" 4.\"
@@ -50,13 +50,14 @@
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\" 52.\"
53.Dd $Mdocdate: March 27 2018 $ 53.Dd $Mdocdate: June 8 2025 $
54.Dt SSL_GET_PEER_CERT_CHAIN 3 54.Dt SSL_GET_PEER_CERT_CHAIN 3
55.Os 55.Os
56.Sh NAME 56.Sh NAME
57.Nm SSL_get_peer_cert_chain 57.Nm SSL_get_peer_cert_chain
58.Nd get the X509 certificate chain sent by the peer 58.Nd get the X509 certificate chain sent by the peer
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libssl libcrypto
60.In openssl/ssl.h 61.In openssl/ssl.h
61.Ft STACK_OF(X509) * 62.Ft STACK_OF(X509) *
62.Fn SSL_get_peer_cert_chain "const SSL *ssl" 63.Fn SSL_get_peer_cert_chain "const SSL *ssl"
diff --git a/src/lib/libssl/man/SSL_get_peer_certificate.3 b/src/lib/libssl/man/SSL_get_peer_certificate.3
index 99f9330288..9ac35a607d 100644
--- a/src/lib/libssl/man/SSL_get_peer_certificate.3
+++ b/src/lib/libssl/man/SSL_get_peer_certificate.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_peer_certificate.3,v 1.6 2021/06/26 17:36:28 tb Exp $ 1.\" $OpenBSD: SSL_get_peer_certificate.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 26 2021 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_GET_PEER_CERTIFICATE 3 52.Dt SSL_GET_PEER_CERTIFICATE 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_get_peer_certificate 55.Nm SSL_get_peer_certificate
56.Nd get the X509 certificate of the peer 56.Nd get the X509 certificate of the peer
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libssl libcrypto
58.In openssl/ssl.h 59.In openssl/ssl.h
59.Ft X509 * 60.Ft X509 *
60.Fn SSL_get_peer_certificate "const SSL *ssl" 61.Fn SSL_get_peer_certificate "const SSL *ssl"
diff --git a/src/lib/libssl/man/SSL_get_rbio.3 b/src/lib/libssl/man/SSL_get_rbio.3
index 38096fbecf..7179277f71 100644
--- a/src/lib/libssl/man/SSL_get_rbio.3
+++ b/src/lib/libssl/man/SSL_get_rbio.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_rbio.3,v 1.5 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_get_rbio.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_GET_RBIO 3 52.Dt SSL_GET_RBIO 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -56,6 +56,7 @@
56.Nm SSL_get_wbio 56.Nm SSL_get_wbio
57.Nd get BIO linked to an SSL object 57.Nd get BIO linked to an SSL object
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libssl libcrypto
59.In openssl/ssl.h 60.In openssl/ssl.h
60.Ft BIO * 61.Ft BIO *
61.Fn SSL_get_rbio "SSL *ssl" 62.Fn SSL_get_rbio "SSL *ssl"
diff --git a/src/lib/libssl/man/SSL_get_server_tmp_key.3 b/src/lib/libssl/man/SSL_get_server_tmp_key.3
index aeeb358240..c55036d526 100644
--- a/src/lib/libssl/man/SSL_get_server_tmp_key.3
+++ b/src/lib/libssl/man/SSL_get_server_tmp_key.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_server_tmp_key.3,v 1.4 2019/06/12 09:36:30 schwarze Exp $ 1.\" $OpenBSD: SSL_get_server_tmp_key.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL SSL_get_server_tmp_key.pod 508fafd8 Apr 3 15:41:21 2017 +0100 2.\" OpenSSL SSL_get_server_tmp_key.pod 508fafd8 Apr 3 15:41:21 2017 +0100
3.\" 3.\"
4.\" This file was written by Matt Caswell <matt@openssl.org> 4.\" This file was written by Matt Caswell <matt@openssl.org>
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 12 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_GET_SERVER_TMP_KEY 3 52.Dt SSL_GET_SERVER_TMP_KEY 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_get_server_tmp_key 55.Nm SSL_get_server_tmp_key
56.Nd temporary server key during a handshake 56.Nd temporary server key during a handshake
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libssl libcrypto
58.In openssl/ssl.h 59.In openssl/ssl.h
59.Ft long 60.Ft long
60.Fo SSL_get_server_tmp_key 61.Fo SSL_get_server_tmp_key
diff --git a/src/lib/libssl/man/SSL_get_session.3 b/src/lib/libssl/man/SSL_get_session.3
index 2ab43fdd3e..597888a0bd 100644
--- a/src/lib/libssl/man/SSL_get_session.3
+++ b/src/lib/libssl/man/SSL_get_session.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_session.3,v 1.8 2022/03/31 17:27:18 naddy Exp $ 1.\" $OpenBSD: SSL_get_session.3,v 1.9 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: March 31 2022 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_GET_SESSION 3 53.Dt SSL_GET_SESSION 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -58,6 +58,7 @@
58.Nm SSL_get1_session 58.Nm SSL_get1_session
59.Nd retrieve TLS/SSL session data 59.Nd retrieve TLS/SSL session data
60.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libssl libcrypto
61.In openssl/ssl.h 62.In openssl/ssl.h
62.Ft SSL_SESSION * 63.Ft SSL_SESSION *
63.Fn SSL_get_session "const SSL *ssl" 64.Fn SSL_get_session "const SSL *ssl"
diff --git a/src/lib/libssl/man/SSL_get_shared_ciphers.3 b/src/lib/libssl/man/SSL_get_shared_ciphers.3
index 207e8c42eb..9011780527 100644
--- a/src/lib/libssl/man/SSL_get_shared_ciphers.3
+++ b/src/lib/libssl/man/SSL_get_shared_ciphers.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_shared_ciphers.3,v 1.5 2021/01/09 10:50:02 tb Exp $ 1.\" $OpenBSD: SSL_get_shared_ciphers.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: January 9 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt SSL_GET_SHARED_CIPHERS 3 18.Dt SSL_GET_SHARED_CIPHERS 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm SSL_get_shared_ciphers 21.Nm SSL_get_shared_ciphers
22.Nd ciphers supported by both client and server 22.Nd ciphers supported by both client and server
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libssl libcrypto
24.In openssl/ssl.h 25.In openssl/ssl.h
25.Ft char * 26.Ft char *
26.Fo SSL_get_shared_ciphers 27.Fo SSL_get_shared_ciphers
diff --git a/src/lib/libssl/man/SSL_get_state.3 b/src/lib/libssl/man/SSL_get_state.3
index 297bbce876..0e1a20e6f7 100644
--- a/src/lib/libssl/man/SSL_get_state.3
+++ b/src/lib/libssl/man/SSL_get_state.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_state.3,v 1.5 2019/06/12 09:36:30 schwarze Exp $ 1.\" $OpenBSD: SSL_get_state.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 12 2019 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt SSL_GET_STATE 3 18.Dt SSL_GET_STATE 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -27,6 +27,7 @@
27.Nm SSL_is_init_finished 27.Nm SSL_is_init_finished
28.Nd inspect the state of the SSL state machine 28.Nd inspect the state of the SSL state machine
29.Sh SYNOPSIS 29.Sh SYNOPSIS
30.Lb libssl libcrypto
30.In openssl/ssl.h 31.In openssl/ssl.h
31.Ft int 32.Ft int
32.Fo SSL_get_state 33.Fo SSL_get_state
diff --git a/src/lib/libssl/man/SSL_get_verify_result.3 b/src/lib/libssl/man/SSL_get_verify_result.3
index 180cf1bb73..32a397f4a2 100644
--- a/src/lib/libssl/man/SSL_get_verify_result.3
+++ b/src/lib/libssl/man/SSL_get_verify_result.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_verify_result.3,v 1.6 2021/06/26 17:36:28 tb Exp $ 1.\" $OpenBSD: SSL_get_verify_result.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 26 2021 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_GET_VERIFY_RESULT 3 52.Dt SSL_GET_VERIFY_RESULT 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_get_verify_result 55.Nm SSL_get_verify_result
56.Nd get result of peer certificate verification 56.Nd get result of peer certificate verification
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libssl libcrypto
58.In openssl/ssl.h 59.In openssl/ssl.h
59.Ft long 60.Ft long
60.Fn SSL_get_verify_result "const SSL *ssl" 61.Fn SSL_get_verify_result "const SSL *ssl"
diff --git a/src/lib/libssl/man/SSL_get_version.3 b/src/lib/libssl/man/SSL_get_version.3
index a6cefb055b..d32dd34e0e 100644
--- a/src/lib/libssl/man/SSL_get_version.3
+++ b/src/lib/libssl/man/SSL_get_version.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_version.3,v 1.9 2021/04/15 16:13:22 tb Exp $ 1.\" $OpenBSD: SSL_get_version.3,v 1.10 2025/06/08 22:49:42 schwarze Exp $
2.\" full merge up to: OpenSSL e417070c Jun 8 11:37:06 2016 -0400 2.\" full merge up to: OpenSSL e417070c Jun 8 11:37:06 2016 -0400
3.\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 3.\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
4.\" 4.\"
@@ -49,21 +49,16 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: April 15 2021 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_GET_VERSION 3 53.Dt SSL_GET_VERSION 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
56.Nm SSL_get_version , 56.Nm SSL_get_version ,
57.Nm SSL_is_dtls , 57.Nm SSL_is_dtls ,
58.Nm SSL_version 58.Nm SSL_version
59.\" The following are intentionally undocumented because
60.\" - the longer term plan is to remove them
61.\" - nothing appears to be using them in the wild
62.\" - and they have the wrong namespace prefix
63.\" Nm TLS1_get_version
64.\" Nm TLS1_get_client_version
65.Nd get the protocol information of a connection 59.Nd get the protocol information of a connection
66.Sh SYNOPSIS 60.Sh SYNOPSIS
61.Lb libssl libcrypto
67.In openssl/ssl.h 62.In openssl/ssl.h
68.Ft const char * 63.Ft const char *
69.Fn SSL_get_version "const SSL *ssl" 64.Fn SSL_get_version "const SSL *ssl"
diff --git a/src/lib/libssl/man/SSL_library_init.3 b/src/lib/libssl/man/SSL_library_init.3
index 053c1e6fcb..d25a248617 100644
--- a/src/lib/libssl/man/SSL_library_init.3
+++ b/src/lib/libssl/man/SSL_library_init.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_library_init.3,v 1.7 2019/06/14 13:41:31 schwarze Exp $ 1.\" $OpenBSD: SSL_library_init.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 14 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_LIBRARY_INIT 3 52.Dt SSL_LIBRARY_INIT 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -57,6 +57,7 @@
57.Nm SSLeay_add_ssl_algorithms 57.Nm SSLeay_add_ssl_algorithms
58.Nd initialize SSL library by registering algorithms 58.Nd initialize SSL library by registering algorithms
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libssl libcrypto
60.In openssl/ssl.h 61.In openssl/ssl.h
61.Ft int 62.Ft int
62.Fn SSL_library_init void 63.Fn SSL_library_init void
diff --git a/src/lib/libssl/man/SSL_load_client_CA_file.3 b/src/lib/libssl/man/SSL_load_client_CA_file.3
index f782d96dce..e57900c941 100644
--- a/src/lib/libssl/man/SSL_load_client_CA_file.3
+++ b/src/lib/libssl/man/SSL_load_client_CA_file.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_load_client_CA_file.3,v 1.9 2019/06/12 09:36:30 schwarze Exp $ 1.\" $OpenBSD: SSL_load_client_CA_file.3,v 1.10 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: June 12 2019 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt SSL_LOAD_CLIENT_CA_FILE 3 69.Dt SSL_LOAD_CLIENT_CA_FILE 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -74,6 +74,7 @@
74.Nm SSL_add_dir_cert_subjects_to_stack 74.Nm SSL_add_dir_cert_subjects_to_stack
75.Nd load certificate names from files 75.Nd load certificate names from files
76.Sh SYNOPSIS 76.Sh SYNOPSIS
77.Lb libssl libcrypto
77.In openssl/ssl.h 78.In openssl/ssl.h
78.Ft STACK_OF(X509_NAME) * 79.Ft STACK_OF(X509_NAME) *
79.Fn SSL_load_client_CA_file "const char *file" 80.Fn SSL_load_client_CA_file "const char *file"
diff --git a/src/lib/libssl/man/SSL_new.3 b/src/lib/libssl/man/SSL_new.3
index 22c5dbf2db..3906a346d7 100644
--- a/src/lib/libssl/man/SSL_new.3
+++ b/src/lib/libssl/man/SSL_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_new.3,v 1.7 2022/07/13 22:05:53 schwarze Exp $ 1.\" $OpenBSD: SSL_new.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL 1c7ae3dd Mar 29 19:17:55 2017 +1000 2.\" full merge up to: OpenSSL 1c7ae3dd Mar 29 19:17:55 2017 +1000
3.\" 3.\"
4.\" This file was written by Richard Levitte <levitte@openssl.org> 4.\" This file was written by Richard Levitte <levitte@openssl.org>
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: July 13 2022 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_NEW 3 53.Dt SSL_NEW 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -57,6 +57,7 @@
57.Nm SSL_up_ref 57.Nm SSL_up_ref
58.Nd create a new SSL structure for a connection 58.Nd create a new SSL structure for a connection
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libssl libcrypto
60.In openssl/ssl.h 61.In openssl/ssl.h
61.Ft SSL * 62.Ft SSL *
62.Fn SSL_new "SSL_CTX *ctx" 63.Fn SSL_new "SSL_CTX *ctx"
diff --git a/src/lib/libssl/man/SSL_num_renegotiations.3 b/src/lib/libssl/man/SSL_num_renegotiations.3
index 6a81b76a60..d366f97c4a 100644
--- a/src/lib/libssl/man/SSL_num_renegotiations.3
+++ b/src/lib/libssl/man/SSL_num_renegotiations.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_num_renegotiations.3,v 1.5 2019/06/12 09:36:30 schwarze Exp $ 1.\" $OpenBSD: SSL_num_renegotiations.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 12 2019 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt SSL_NUM_RENEGOTIATIONS 3 18.Dt SSL_NUM_RENEGOTIATIONS 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -23,6 +23,7 @@
23.Nm SSL_total_renegotiations 23.Nm SSL_total_renegotiations
24.Nd renegotiation counters 24.Nd renegotiation counters
25.Sh SYNOPSIS 25.Sh SYNOPSIS
26.Lb libssl libcrypto
26.In openssl/ssl.h 27.In openssl/ssl.h
27.Ft long 28.Ft long
28.Fo SSL_num_renegotiations 29.Fo SSL_num_renegotiations
diff --git a/src/lib/libssl/man/SSL_pending.3 b/src/lib/libssl/man/SSL_pending.3
index bbc2e9bdd2..c304302ed8 100644
--- a/src/lib/libssl/man/SSL_pending.3
+++ b/src/lib/libssl/man/SSL_pending.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_pending.3,v 1.5 2020/01/23 03:40:18 beck Exp $ 1.\" $OpenBSD: SSL_pending.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 2.\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>, 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>,
@@ -50,13 +50,14 @@
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\" 52.\"
53.Dd $Mdocdate: January 23 2020 $ 53.Dd $Mdocdate: June 8 2025 $
54.Dt SSL_PENDING 3 54.Dt SSL_PENDING 3
55.Os 55.Os
56.Sh NAME 56.Sh NAME
57.Nm SSL_pending 57.Nm SSL_pending
58.Nd obtain number of readable bytes buffered in an SSL object 58.Nd obtain number of readable bytes buffered in an SSL object
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libssl libcrypto
60.In openssl/ssl.h 61.In openssl/ssl.h
61.Ft int 62.Ft int
62.Fn SSL_pending "const SSL *ssl" 63.Fn SSL_pending "const SSL *ssl"
diff --git a/src/lib/libssl/man/SSL_read.3 b/src/lib/libssl/man/SSL_read.3
index bb72a8ed82..3d42fd8a90 100644
--- a/src/lib/libssl/man/SSL_read.3
+++ b/src/lib/libssl/man/SSL_read.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_read.3,v 1.8 2021/10/24 15:10:13 schwarze Exp $ 1.\" $OpenBSD: SSL_read.3,v 1.9 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL 5a2443ae Nov 14 11:37:36 2016 +0000 2.\" full merge up to: OpenSSL 5a2443ae Nov 14 11:37:36 2016 +0000
3.\" partial merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 3.\" partial merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
4.\" 4.\"
@@ -51,7 +51,7 @@
51.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
52.\" OF THE POSSIBILITY OF SUCH DAMAGE. 52.\" OF THE POSSIBILITY OF SUCH DAMAGE.
53.\" 53.\"
54.Dd $Mdocdate: October 24 2021 $ 54.Dd $Mdocdate: June 8 2025 $
55.Dt SSL_READ 3 55.Dt SSL_READ 3
56.Os 56.Os
57.Sh NAME 57.Sh NAME
@@ -61,6 +61,7 @@
61.Nm SSL_peek 61.Nm SSL_peek
62.Nd read bytes from a TLS connection 62.Nd read bytes from a TLS connection
63.Sh SYNOPSIS 63.Sh SYNOPSIS
64.Lb libssl libcrypto
64.In openssl/ssl.h 65.In openssl/ssl.h
65.Ft int 66.Ft int
66.Fn SSL_read_ex "SSL *ssl" "void *buf" "size_t num" "size_t *readbytes" 67.Fn SSL_read_ex "SSL *ssl" "void *buf" "size_t num" "size_t *readbytes"
diff --git a/src/lib/libssl/man/SSL_read_early_data.3 b/src/lib/libssl/man/SSL_read_early_data.3
index 1435c15935..d36b1e49f7 100644
--- a/src/lib/libssl/man/SSL_read_early_data.3
+++ b/src/lib/libssl/man/SSL_read_early_data.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_read_early_data.3,v 1.4 2021/11/26 13:48:22 jsg Exp $ 1.\" $OpenBSD: SSL_read_early_data.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $
2.\" content checked up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200 2.\" content checked up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200
3.\" 3.\"
4.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> 4.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,7 +15,7 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 17.\"
18.Dd $Mdocdate: November 26 2021 $ 18.Dd $Mdocdate: June 8 2025 $
19.Dt SSL_READ_EARLY_DATA 3 19.Dt SSL_READ_EARLY_DATA 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
@@ -30,6 +30,7 @@
30.Nm SSL_get_early_data_status 30.Nm SSL_get_early_data_status
31.Nd transmit application data during the handshake 31.Nd transmit application data during the handshake
32.Sh SYNOPSIS 32.Sh SYNOPSIS
33.Lb libssl libcrypto
33.In openssl/ssl.h 34.In openssl/ssl.h
34.Ft int 35.Ft int
35.Fo SSL_CTX_set_max_early_data 36.Fo SSL_CTX_set_max_early_data
diff --git a/src/lib/libssl/man/SSL_renegotiate.3 b/src/lib/libssl/man/SSL_renegotiate.3
index 8188d37323..badfe8c6cb 100644
--- a/src/lib/libssl/man/SSL_renegotiate.3
+++ b/src/lib/libssl/man/SSL_renegotiate.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_renegotiate.3,v 1.9 2019/06/12 09:36:30 schwarze Exp $ 1.\" $OpenBSD: SSL_renegotiate.3,v 1.10 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL SSL_key_update.pod 4fbfe86a Feb 16 17:04:40 2017 +0000 2.\" OpenSSL SSL_key_update.pod 4fbfe86a Feb 16 17:04:40 2017 +0000
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: June 12 2019 $ 68.Dd $Mdocdate: June 8 2025 $
69.Dt SSL_RENEGOTIATE 3 69.Dt SSL_RENEGOTIATE 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -74,6 +74,7 @@
74.Nm SSL_renegotiate_pending 74.Nm SSL_renegotiate_pending
75.Nd initiate a new TLS handshake 75.Nd initiate a new TLS handshake
76.Sh SYNOPSIS 76.Sh SYNOPSIS
77.Lb libssl libcrypto
77.In openssl/ssl.h 78.In openssl/ssl.h
78.Ft int 79.Ft int
79.Fo SSL_renegotiate 80.Fo SSL_renegotiate
diff --git a/src/lib/libssl/man/SSL_rstate_string.3 b/src/lib/libssl/man/SSL_rstate_string.3
index 99613ba3c0..624c1b08ab 100644
--- a/src/lib/libssl/man/SSL_rstate_string.3
+++ b/src/lib/libssl/man/SSL_rstate_string.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_rstate_string.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_rstate_string.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_RSTATE_STRING 3 52.Dt SSL_RSTATE_STRING 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -56,6 +56,7 @@
56.Nm SSL_rstate_string_long 56.Nm SSL_rstate_string_long
57.Nd get textual description of state of an SSL object during read operation 57.Nd get textual description of state of an SSL object during read operation
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libssl libcrypto
59.In openssl/ssl.h 60.In openssl/ssl.h
60.Ft const char * 61.Ft const char *
61.Fn SSL_rstate_string "SSL *ssl" 62.Fn SSL_rstate_string "SSL *ssl"
diff --git a/src/lib/libssl/man/SSL_session_reused.3 b/src/lib/libssl/man/SSL_session_reused.3
index add61a904b..3340144660 100644
--- a/src/lib/libssl/man/SSL_session_reused.3
+++ b/src/lib/libssl/man/SSL_session_reused.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_session_reused.3,v 1.6 2019/06/12 09:36:30 schwarze Exp $ 1.\" $OpenBSD: SSL_session_reused.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 12 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_SESSION_REUSED 3 52.Dt SSL_SESSION_REUSED 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_session_reused 55.Nm SSL_session_reused
56.Nd query whether a reused session was negotiated during handshake 56.Nd query whether a reused session was negotiated during handshake
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libssl libcrypto
58.In openssl/ssl.h 59.In openssl/ssl.h
59.Ft int 60.Ft int
60.Fn SSL_session_reused "SSL *ssl" 61.Fn SSL_session_reused "SSL *ssl"
diff --git a/src/lib/libssl/man/SSL_set1_host.3 b/src/lib/libssl/man/SSL_set1_host.3
index 2a3935c3f2..2c6cdbe5a1 100644
--- a/src/lib/libssl/man/SSL_set1_host.3
+++ b/src/lib/libssl/man/SSL_set1_host.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_set1_host.3,v 1.4 2021/03/31 16:56:46 tb Exp $ 1.\" $OpenBSD: SSL_set1_host.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $
2.\" selective merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200 2.\" selective merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200
3.\" 3.\"
4.\" This file was written by Viktor Dukhovni <viktor@openssl.org> 4.\" This file was written by Viktor Dukhovni <viktor@openssl.org>
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 31 2021 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_SET1_HOST 3 52.Dt SSL_SET1_HOST 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -57,6 +57,7 @@
57.Nm SSL_get0_peername 57.Nm SSL_get0_peername
58.Nd SSL server verification parameters 58.Nd SSL server verification parameters
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libssl libcrypto
60.In openssl/ssl.h 61.In openssl/ssl.h
61.Ft int 62.Ft int
62.Fo SSL_set1_host 63.Fo SSL_set1_host
diff --git a/src/lib/libssl/man/SSL_set1_param.3 b/src/lib/libssl/man/SSL_set1_param.3
index cd8ad40ad0..2d255a0991 100644
--- a/src/lib/libssl/man/SSL_set1_param.3
+++ b/src/lib/libssl/man/SSL_set1_param.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_set1_param.3,v 1.6 2022/09/10 10:22:46 jsg Exp $ 1.\" $OpenBSD: SSL_set1_param.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL man3/SSL_CTX_get0_param 99d63d46 Oct 26 13:56:48 2016 -0400 3.\" OpenSSL man3/SSL_CTX_get0_param 99d63d46 Oct 26 13:56:48 2016 -0400
4.\" 4.\"
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: September 10 2022 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_SET1_PARAM 3 53.Dt SSL_SET1_PARAM 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -59,6 +59,7 @@
59.Nm SSL_set1_param 59.Nm SSL_set1_param
60.Nd get and set verification parameters 60.Nd get and set verification parameters
61.Sh SYNOPSIS 61.Sh SYNOPSIS
62.Lb libssl libcrypto
62.In openssl/ssl.h 63.In openssl/ssl.h
63.Ft X509_VERIFY_PARAM * 64.Ft X509_VERIFY_PARAM *
64.Fo SSL_CTX_get0_param 65.Fo SSL_CTX_get0_param
diff --git a/src/lib/libssl/man/SSL_set_SSL_CTX.3 b/src/lib/libssl/man/SSL_set_SSL_CTX.3
index 2abaefb292..3a909dabe6 100644
--- a/src/lib/libssl/man/SSL_set_SSL_CTX.3
+++ b/src/lib/libssl/man/SSL_set_SSL_CTX.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_set_SSL_CTX.3,v 1.4 2022/07/13 22:05:53 schwarze Exp $ 1.\" $OpenBSD: SSL_set_SSL_CTX.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: July 13 2022 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt SSL_SET_SSL_CTX 3 18.Dt SSL_SET_SSL_CTX 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm SSL_set_SSL_CTX 21.Nm SSL_set_SSL_CTX
22.Nd modify an SSL connection object to use another context 22.Nd modify an SSL connection object to use another context
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libssl libcrypto
24.In openssl/ssl.h 25.In openssl/ssl.h
25.Ft SSL_CTX * 26.Ft SSL_CTX *
26.Fo SSL_set_SSL_CTX 27.Fo SSL_set_SSL_CTX
diff --git a/src/lib/libssl/man/SSL_set_bio.3 b/src/lib/libssl/man/SSL_set_bio.3
index e727f442d6..98ce9a7080 100644
--- a/src/lib/libssl/man/SSL_set_bio.3
+++ b/src/lib/libssl/man/SSL_set_bio.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_set_bio.3,v 1.6 2020/10/08 18:21:30 tb Exp $ 1.\" $OpenBSD: SSL_set_bio.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL acb5b343 Sep 16 16:00:38 2000 +0000 2.\" OpenSSL acb5b343 Sep 16 16:00:38 2000 +0000
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: October 8 2020 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_SET_BIO 3 52.Dt SSL_SET_BIO 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_set_bio 55.Nm SSL_set_bio
56.Nd connect the SSL object with a BIO 56.Nd connect the SSL object with a BIO
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libssl libcrypto
58.In openssl/ssl.h 59.In openssl/ssl.h
59.Ft void 60.Ft void
60.Fn SSL_set_bio "SSL *ssl" "BIO *rbio" "BIO *wbio" 61.Fn SSL_set_bio "SSL *ssl" "BIO *rbio" "BIO *wbio"
diff --git a/src/lib/libssl/man/SSL_set_connect_state.3 b/src/lib/libssl/man/SSL_set_connect_state.3
index c2072c4370..b7d126d046 100644
--- a/src/lib/libssl/man/SSL_set_connect_state.3
+++ b/src/lib/libssl/man/SSL_set_connect_state.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_set_connect_state.3,v 1.6 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_set_connect_state.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" selective merge up to: OpenSSL dbd007d7 Jul 28 13:31:27 2017 +0800 3.\" selective merge up to: OpenSSL dbd007d7 Jul 28 13:31:27 2017 +0800
4.\" 4.\"
@@ -50,7 +50,7 @@
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\" 52.\"
53.Dd $Mdocdate: March 27 2018 $ 53.Dd $Mdocdate: June 8 2025 $
54.Dt SSL_SET_CONNECT_STATE 3 54.Dt SSL_SET_CONNECT_STATE 3
55.Os 55.Os
56.Sh NAME 56.Sh NAME
@@ -59,6 +59,7 @@
59.Nm SSL_is_server 59.Nm SSL_is_server
60.Nd prepare SSL object to work in client or server mode 60.Nd prepare SSL object to work in client or server mode
61.Sh SYNOPSIS 61.Sh SYNOPSIS
62.Lb libssl libcrypto
62.In openssl/ssl.h 63.In openssl/ssl.h
63.Ft void 64.Ft void
64.Fn SSL_set_connect_state "SSL *ssl" 65.Fn SSL_set_connect_state "SSL *ssl"
diff --git a/src/lib/libssl/man/SSL_set_fd.3 b/src/lib/libssl/man/SSL_set_fd.3
index 7b9727e9ad..3c4441e677 100644
--- a/src/lib/libssl/man/SSL_set_fd.3
+++ b/src/lib/libssl/man/SSL_set_fd.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_set_fd.3,v 1.5 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_set_fd.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_SET_FD 3 52.Dt SSL_SET_FD 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -57,6 +57,7 @@
57.Nm SSL_set_wfd 57.Nm SSL_set_wfd
58.Nd connect the SSL object with a file descriptor 58.Nd connect the SSL object with a file descriptor
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libssl libcrypto
60.In openssl/ssl.h 61.In openssl/ssl.h
61.Ft int 62.Ft int
62.Fn SSL_set_fd "SSL *ssl" "int fd" 63.Fn SSL_set_fd "SSL *ssl" "int fd"
diff --git a/src/lib/libssl/man/SSL_set_max_send_fragment.3 b/src/lib/libssl/man/SSL_set_max_send_fragment.3
index 7de087a743..d5265ebb74 100644
--- a/src/lib/libssl/man/SSL_set_max_send_fragment.3
+++ b/src/lib/libssl/man/SSL_set_max_send_fragment.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_set_max_send_fragment.3,v 1.5 2019/06/12 09:36:30 schwarze Exp $ 1.\" $OpenBSD: SSL_set_max_send_fragment.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL doc/man3/SSL_CTX_set_split_send_fragment.pod 2.\" OpenSSL doc/man3/SSL_CTX_set_split_send_fragment.pod
3.\" OpenSSL 6782e5fd Oct 21 16:16:20 2016 +0100 3.\" OpenSSL 6782e5fd Oct 21 16:16:20 2016 +0100
4.\" 4.\"
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: June 12 2019 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_SET_MAX_SEND_FRAGMENT 3 53.Dt SSL_SET_MAX_SEND_FRAGMENT 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -57,6 +57,7 @@
57.Nm SSL_set_max_send_fragment 57.Nm SSL_set_max_send_fragment
58.Nd control fragment sizes 58.Nd control fragment sizes
59.Sh SYNOPSIS 59.Sh SYNOPSIS
60.Lb libssl libcrypto
60.In openssl/ssl.h 61.In openssl/ssl.h
61.Ft long 62.Ft long
62.Fo SSL_CTX_set_max_send_fragment 63.Fo SSL_CTX_set_max_send_fragment
diff --git a/src/lib/libssl/man/SSL_set_psk_use_session_callback.3 b/src/lib/libssl/man/SSL_set_psk_use_session_callback.3
index 7f2bfcc010..d53f5b97c9 100644
--- a/src/lib/libssl/man/SSL_set_psk_use_session_callback.3
+++ b/src/lib/libssl/man/SSL_set_psk_use_session_callback.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_set_psk_use_session_callback.3,v 1.1 2021/09/14 14:30:57 schwarze Exp $ 1.\" $OpenBSD: SSL_set_psk_use_session_callback.3,v 1.2 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL man3/SSL_CTX_set_psk_client_callback.pod 2.\" OpenSSL man3/SSL_CTX_set_psk_client_callback.pod
3.\" checked up to 24a535ea Sep 22 13:14:20 2020 +0100 3.\" checked up to 24a535ea Sep 22 13:14:20 2020 +0100
4.\" 4.\"
@@ -16,7 +16,7 @@
16.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18.\" 18.\"
19.Dd $Mdocdate: September 14 2021 $ 19.Dd $Mdocdate: June 8 2025 $
20.Dt SSL_SET_PSK_USE_SESSION_CALLBACK 3 20.Dt SSL_SET_PSK_USE_SESSION_CALLBACK 3
21.Os 21.Os
22.Sh NAME 22.Sh NAME
@@ -24,6 +24,7 @@
24.Nm SSL_psk_use_session_cb_func 24.Nm SSL_psk_use_session_cb_func
25.Nd set TLS pre-shared key client callback 25.Nd set TLS pre-shared key client callback
26.Sh SYNOPSIS 26.Sh SYNOPSIS
27.Lb libssl libcrypto
27.In openssl/ssl.h 28.In openssl/ssl.h
28.Ft typedef int 29.Ft typedef int
29.Fo (*SSL_psk_use_session_cb_func) 30.Fo (*SSL_psk_use_session_cb_func)
diff --git a/src/lib/libssl/man/SSL_set_session.3 b/src/lib/libssl/man/SSL_set_session.3
index 7d85f5ad0c..db3fc6a85c 100644
--- a/src/lib/libssl/man/SSL_set_session.3
+++ b/src/lib/libssl/man/SSL_set_session.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_set_session.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_set_session.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL 05ea606a May 20 20:52:46 2016 -0400 2.\" OpenSSL 05ea606a May 20 20:52:46 2016 -0400
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_SET_SESSION 3 52.Dt SSL_SET_SESSION 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_set_session 55.Nm SSL_set_session
56.Nd set a TLS/SSL session to be used during TLS/SSL connect 56.Nd set a TLS/SSL session to be used during TLS/SSL connect
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libssl libcrypto
58.In openssl/ssl.h 59.In openssl/ssl.h
59.Ft int 60.Ft int
60.Fn SSL_set_session "SSL *ssl" "SSL_SESSION *session" 61.Fn SSL_set_session "SSL *ssl" "SSL_SESSION *session"
diff --git a/src/lib/libssl/man/SSL_set_shutdown.3 b/src/lib/libssl/man/SSL_set_shutdown.3
index ef8c004f76..1c1d59e927 100644
--- a/src/lib/libssl/man/SSL_set_shutdown.3
+++ b/src/lib/libssl/man/SSL_set_shutdown.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_set_shutdown.3,v 1.7 2024/12/19 06:45:21 jmc Exp $ 1.\" $OpenBSD: SSL_set_shutdown.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: December 19 2024 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_SET_SHUTDOWN 3 52.Dt SSL_SET_SHUTDOWN 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -56,6 +56,7 @@
56.Nm SSL_get_shutdown 56.Nm SSL_get_shutdown
57.Nd manipulate shutdown state of an SSL connection 57.Nd manipulate shutdown state of an SSL connection
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libssl libcrypto
59.In openssl/ssl.h 60.In openssl/ssl.h
60.Ft void 61.Ft void
61.Fn SSL_set_shutdown "SSL *ssl" "int mode" 62.Fn SSL_set_shutdown "SSL *ssl" "int mode"
diff --git a/src/lib/libssl/man/SSL_set_tmp_ecdh.3 b/src/lib/libssl/man/SSL_set_tmp_ecdh.3
index 8fd2d9fd5b..0794efdfb7 100644
--- a/src/lib/libssl/man/SSL_set_tmp_ecdh.3
+++ b/src/lib/libssl/man/SSL_set_tmp_ecdh.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_set_tmp_ecdh.3,v 1.6 2021/11/30 15:58:08 jsing Exp $ 1.\" $OpenBSD: SSL_set_tmp_ecdh.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: November 30 2021 $ 17.Dd $Mdocdate: June 8 2025 $
18.Dt SSL_SET_TMP_ECDH 3 18.Dt SSL_SET_TMP_ECDH 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -26,6 +26,7 @@
26.Nm SSL_CTX_set_tmp_ecdh_callback 26.Nm SSL_CTX_set_tmp_ecdh_callback
27.Nd select a curve for ECDH ephemeral key exchange 27.Nd select a curve for ECDH ephemeral key exchange
28.Sh SYNOPSIS 28.Sh SYNOPSIS
29.Lb libssl libcrypto
29.In openssl/ssl.h 30.In openssl/ssl.h
30.Ft long 31.Ft long
31.Fo SSL_set_tmp_ecdh 32.Fo SSL_set_tmp_ecdh
diff --git a/src/lib/libssl/man/SSL_set_verify_result.3 b/src/lib/libssl/man/SSL_set_verify_result.3
index 4b7cc6ec3c..f43d375bc9 100644
--- a/src/lib/libssl/man/SSL_set_verify_result.3
+++ b/src/lib/libssl/man/SSL_set_verify_result.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_set_verify_result.3,v 1.5 2020/03/29 17:05:02 schwarze Exp $ 1.\" $OpenBSD: SSL_set_verify_result.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,13 +48,14 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 29 2020 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_SET_VERIFY_RESULT 3 52.Dt SSL_SET_VERIFY_RESULT 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm SSL_set_verify_result 55.Nm SSL_set_verify_result
56.Nd override result of peer certificate verification 56.Nd override result of peer certificate verification
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.Lb libssl libcrypto
58.In openssl/ssl.h 59.In openssl/ssl.h
59.Ft void 60.Ft void
60.Fn SSL_set_verify_result "SSL *ssl" "long verify_result" 61.Fn SSL_set_verify_result "SSL *ssl" "long verify_result"
diff --git a/src/lib/libssl/man/SSL_shutdown.3 b/src/lib/libssl/man/SSL_shutdown.3
index bfb1e91ea7..ad49a47d8e 100644
--- a/src/lib/libssl/man/SSL_shutdown.3
+++ b/src/lib/libssl/man/SSL_shutdown.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_shutdown.3,v 1.5 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_shutdown.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -49,13 +49,14 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: March 27 2018 $ 52.Dd $Mdocdate: June 8 2025 $
53.Dt SSL_SHUTDOWN 3 53.Dt SSL_SHUTDOWN 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
56.Nm SSL_shutdown 56.Nm SSL_shutdown
57.Nd shut down a TLS/SSL connection 57.Nd shut down a TLS/SSL connection
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libssl libcrypto
59.In openssl/ssl.h 60.In openssl/ssl.h
60.Ft int 61.Ft int
61.Fn SSL_shutdown "SSL *ssl" 62.Fn SSL_shutdown "SSL *ssl"
diff --git a/src/lib/libssl/man/SSL_state_string.3 b/src/lib/libssl/man/SSL_state_string.3
index 1070335448..d202056eec 100644
--- a/src/lib/libssl/man/SSL_state_string.3
+++ b/src/lib/libssl/man/SSL_state_string.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_state_string.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_state_string.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_STATE_STRING 3 52.Dt SSL_STATE_STRING 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -56,6 +56,7 @@
56.Nm SSL_state_string_long 56.Nm SSL_state_string_long
57.Nd get textual description of state of an SSL object 57.Nd get textual description of state of an SSL object
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libssl libcrypto
59.In openssl/ssl.h 60.In openssl/ssl.h
60.Ft const char * 61.Ft const char *
61.Fn SSL_state_string "const SSL *ssl" 62.Fn SSL_state_string "const SSL *ssl"
diff --git a/src/lib/libssl/man/SSL_want.3 b/src/lib/libssl/man/SSL_want.3
index 24e8645ba8..c7c2ee4885 100644
--- a/src/lib/libssl/man/SSL_want.3
+++ b/src/lib/libssl/man/SSL_want.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_want.3,v 1.5 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: SSL_want.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 2.\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: March 27 2018 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt SSL_WANT 3 52.Dt SSL_WANT 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -59,6 +59,7 @@
59.Nm SSL_want_x509_lookup 59.Nm SSL_want_x509_lookup
60.Nd obtain state information TLS/SSL I/O operation 60.Nd obtain state information TLS/SSL I/O operation
61.Sh SYNOPSIS 61.Sh SYNOPSIS
62.Lb libssl libcrypto
62.In openssl/ssl.h 63.In openssl/ssl.h
63.Ft int 64.Ft int
64.Fn SSL_want "const SSL *ssl" 65.Fn SSL_want "const SSL *ssl"
diff --git a/src/lib/libssl/man/SSL_write.3 b/src/lib/libssl/man/SSL_write.3
index 2c6fbcef08..54d0953e82 100644
--- a/src/lib/libssl/man/SSL_write.3
+++ b/src/lib/libssl/man/SSL_write.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_write.3,v 1.7 2021/10/24 15:10:13 schwarze Exp $ 1.\" $OpenBSD: SSL_write.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $
2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" partial merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 3.\" partial merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
4.\" 4.\"
@@ -51,7 +51,7 @@
51.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
52.\" OF THE POSSIBILITY OF SUCH DAMAGE. 52.\" OF THE POSSIBILITY OF SUCH DAMAGE.
53.\" 53.\"
54.Dd $Mdocdate: October 24 2021 $ 54.Dd $Mdocdate: June 8 2025 $
55.Dt SSL_WRITE 3 55.Dt SSL_WRITE 3
56.Os 56.Os
57.Sh NAME 57.Sh NAME
@@ -59,6 +59,7 @@
59.Nm SSL_write 59.Nm SSL_write
60.Nd write bytes to a TLS connection 60.Nd write bytes to a TLS connection
61.Sh SYNOPSIS 61.Sh SYNOPSIS
62.Lb libssl libcrypto
62.In openssl/ssl.h 63.In openssl/ssl.h
63.Ft int 64.Ft int
64.Fn SSL_write_ex "SSL *ssl" "const void *buf" "size_t num" "size_t *written" 65.Fn SSL_write_ex "SSL *ssl" "const void *buf" "size_t num" "size_t *written"
diff --git a/src/lib/libssl/man/d2i_SSL_SESSION.3 b/src/lib/libssl/man/d2i_SSL_SESSION.3
index 7a2bc529ab..6b0dfc86b9 100644
--- a/src/lib/libssl/man/d2i_SSL_SESSION.3
+++ b/src/lib/libssl/man/d2i_SSL_SESSION.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_SSL_SESSION.3,v 1.7 2019/06/08 15:25:43 schwarze Exp $ 1.\" $OpenBSD: d2i_SSL_SESSION.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 8 2019 $ 51.Dd $Mdocdate: June 8 2025 $
52.Dt D2I_SSL_SESSION 3 52.Dt D2I_SSL_SESSION 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -56,6 +56,7 @@
56.Nm i2d_SSL_SESSION 56.Nm i2d_SSL_SESSION
57.Nd convert SSL_SESSION object from/to ASN1 representation 57.Nd convert SSL_SESSION object from/to ASN1 representation
58.Sh SYNOPSIS 58.Sh SYNOPSIS
59.Lb libssl libcrypto
59.In openssl/ssl.h 60.In openssl/ssl.h
60.Ft SSL_SESSION * 61.Ft SSL_SESSION *
61.Fn d2i_SSL_SESSION "SSL_SESSION **a" "const unsigned char **pp" "long length" 62.Fn d2i_SSL_SESSION "SSL_SESSION **a" "const unsigned char **pp" "long length"
diff --git a/src/lib/libssl/pqueue.c b/src/lib/libssl/pqueue.c
index 602969deb0..aafd0a704e 100644
--- a/src/lib/libssl/pqueue.c
+++ b/src/lib/libssl/pqueue.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pqueue.c,v 1.5 2014/06/12 15:49:31 deraadt Exp $ */ 1/* $OpenBSD: pqueue.c,v 1.7 2025/05/04 10:53:38 tb Exp $ */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -68,7 +68,7 @@ typedef struct _pqueue {
68} pqueue_s; 68} pqueue_s;
69 69
70pitem * 70pitem *
71pitem_new(unsigned char *prio64be, void *data) 71pitem_new(const unsigned char *prio64be, void *data)
72{ 72{
73 pitem *item = malloc(sizeof(pitem)); 73 pitem *item = malloc(sizeof(pitem));
74 74
@@ -154,7 +154,7 @@ pqueue_pop(pqueue_s *pq)
154} 154}
155 155
156pitem * 156pitem *
157pqueue_find(pqueue_s *pq, unsigned char *prio64be) 157pqueue_find(pqueue_s *pq, const unsigned char *prio64be)
158{ 158{
159 pitem *next; 159 pitem *next;
160 160
diff --git a/src/lib/libssl/pqueue.h b/src/lib/libssl/pqueue.h
index cdda4a3961..79ddf7a105 100644
--- a/src/lib/libssl/pqueue.h
+++ b/src/lib/libssl/pqueue.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: pqueue.h,v 1.4 2016/11/04 18:28:58 guenther Exp $ */ 1/* $OpenBSD: pqueue.h,v 1.7 2025/05/04 10:53:38 tb Exp $ */
2 2
3/* 3/*
4 * DTLS implementation written by Nagendra Modadugu 4 * DTLS implementation written by Nagendra Modadugu
@@ -61,7 +61,7 @@
61#ifndef HEADER_PQUEUE_H 61#ifndef HEADER_PQUEUE_H
62#define HEADER_PQUEUE_H 62#define HEADER_PQUEUE_H
63 63
64__BEGIN_HIDDEN_DECLS 64__BEGIN_HIDDEN_DECLS
65 65
66typedef struct _pqueue *pqueue; 66typedef struct _pqueue *pqueue;
67 67
@@ -73,7 +73,7 @@ typedef struct _pitem {
73 73
74typedef struct _pitem *piterator; 74typedef struct _pitem *piterator;
75 75
76pitem *pitem_new(unsigned char *prio64be, void *data); 76pitem *pitem_new(const unsigned char *prio64be, void *data);
77void pitem_free(pitem *item); 77void pitem_free(pitem *item);
78 78
79pqueue pqueue_new(void); 79pqueue pqueue_new(void);
@@ -82,12 +82,12 @@ void pqueue_free(pqueue pq);
82pitem *pqueue_insert(pqueue pq, pitem *item); 82pitem *pqueue_insert(pqueue pq, pitem *item);
83pitem *pqueue_peek(pqueue pq); 83pitem *pqueue_peek(pqueue pq);
84pitem *pqueue_pop(pqueue pq); 84pitem *pqueue_pop(pqueue pq);
85pitem *pqueue_find(pqueue pq, unsigned char *prio64be); 85pitem *pqueue_find(pqueue pq, const unsigned char *prio64be);
86pitem *pqueue_iterator(pqueue pq); 86pitem *pqueue_iterator(pqueue pq);
87pitem *pqueue_next(piterator *iter); 87pitem *pqueue_next(piterator *iter);
88 88
89int pqueue_size(pqueue pq); 89int pqueue_size(pqueue pq);
90 90
91__END_HIDDEN_DECLS 91__END_HIDDEN_DECLS
92 92
93#endif /* ! HEADER_PQUEUE_H */ 93#endif /* ! HEADER_PQUEUE_H */
diff --git a/src/lib/libssl/shlib_version b/src/lib/libssl/shlib_version
index c2665004b4..97e30d617d 100644
--- a/src/lib/libssl/shlib_version
+++ b/src/lib/libssl/shlib_version
@@ -1,3 +1,3 @@
1# Don't forget to give libtls the same type of bump! 1# Don't forget to give libtls the same type of bump!
2major=59 2major=60
3minor=1 3minor=0
diff --git a/src/lib/libssl/ssl.h b/src/lib/libssl/ssl.h
index a1ed22b778..e8a11ebdb9 100644
--- a/src/lib/libssl/ssl.h
+++ b/src/lib/libssl/ssl.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl.h,v 1.247 2025/03/12 14:03:55 jsing Exp $ */ 1/* $OpenBSD: ssl.h,v 1.248 2025/04/18 07:34:01 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -231,9 +231,9 @@ extern "C" {
231#define SSL_TXT_kRSA "kRSA" 231#define SSL_TXT_kRSA "kRSA"
232#define SSL_TXT_kDHr "kDHr" /* no such ciphersuites supported! */ 232#define SSL_TXT_kDHr "kDHr" /* no such ciphersuites supported! */
233#define SSL_TXT_kDHd "kDHd" /* no such ciphersuites supported! */ 233#define SSL_TXT_kDHd "kDHd" /* no such ciphersuites supported! */
234#define SSL_TXT_kDH "kDH" /* no such ciphersuites supported! */ 234#define SSL_TXT_kDH "kDH" /* no such ciphersuites supported! */
235#define SSL_TXT_kEDH "kEDH" 235#define SSL_TXT_kEDH "kEDH"
236#define SSL_TXT_kKRB5 "kKRB5" 236#define SSL_TXT_kKRB5 "kKRB5"
237#define SSL_TXT_kECDHr "kECDHr" 237#define SSL_TXT_kECDHr "kECDHr"
238#define SSL_TXT_kECDHe "kECDHe" 238#define SSL_TXT_kECDHe "kECDHe"
239#define SSL_TXT_kECDH "kECDH" 239#define SSL_TXT_kECDH "kECDH"
@@ -245,7 +245,7 @@ extern "C" {
245#define SSL_TXT_aDSS "aDSS" 245#define SSL_TXT_aDSS "aDSS"
246#define SSL_TXT_aDH "aDH" /* no such ciphersuites supported! */ 246#define SSL_TXT_aDH "aDH" /* no such ciphersuites supported! */
247#define SSL_TXT_aECDH "aECDH" 247#define SSL_TXT_aECDH "aECDH"
248#define SSL_TXT_aKRB5 "aKRB5" 248#define SSL_TXT_aKRB5 "aKRB5"
249#define SSL_TXT_aECDSA "aECDSA" 249#define SSL_TXT_aECDSA "aECDSA"
250#define SSL_TXT_aPSK "aPSK" 250#define SSL_TXT_aPSK "aPSK"
251 251
@@ -260,7 +260,7 @@ extern "C" {
260#define SSL_TXT_EECDH "EECDH" /* previous name for ECDHE */ 260#define SSL_TXT_EECDH "EECDH" /* previous name for ECDHE */
261#define SSL_TXT_AECDH "AECDH" 261#define SSL_TXT_AECDH "AECDH"
262#define SSL_TXT_ECDSA "ECDSA" 262#define SSL_TXT_ECDSA "ECDSA"
263#define SSL_TXT_KRB5 "KRB5" 263#define SSL_TXT_KRB5 "KRB5"
264#define SSL_TXT_PSK "PSK" 264#define SSL_TXT_PSK "PSK"
265#define SSL_TXT_SRP "SRP" 265#define SSL_TXT_SRP "SRP"
266 266
@@ -1117,7 +1117,7 @@ const SSL_CIPHER *SSL_get_current_cipher(const SSL *s);
1117int SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits); 1117int SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits);
1118const char * SSL_CIPHER_get_version(const SSL_CIPHER *c); 1118const char * SSL_CIPHER_get_version(const SSL_CIPHER *c);
1119const char * SSL_CIPHER_get_name(const SSL_CIPHER *c); 1119const char * SSL_CIPHER_get_name(const SSL_CIPHER *c);
1120unsigned long SSL_CIPHER_get_id(const SSL_CIPHER *c); 1120unsigned long SSL_CIPHER_get_id(const SSL_CIPHER *c);
1121uint16_t SSL_CIPHER_get_value(const SSL_CIPHER *c); 1121uint16_t SSL_CIPHER_get_value(const SSL_CIPHER *c);
1122const SSL_CIPHER *SSL_CIPHER_find(SSL *ssl, const unsigned char *ptr); 1122const SSL_CIPHER *SSL_CIPHER_find(SSL *ssl, const unsigned char *ptr);
1123int SSL_CIPHER_get_cipher_nid(const SSL_CIPHER *c); 1123int SSL_CIPHER_get_cipher_nid(const SSL_CIPHER *c);
@@ -1272,16 +1272,16 @@ int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm);
1272SSL *SSL_new(SSL_CTX *ctx); 1272SSL *SSL_new(SSL_CTX *ctx);
1273void SSL_free(SSL *ssl); 1273void SSL_free(SSL *ssl);
1274int SSL_up_ref(SSL *ssl); 1274int SSL_up_ref(SSL *ssl);
1275int SSL_accept(SSL *ssl); 1275int SSL_accept(SSL *ssl);
1276int SSL_connect(SSL *ssl); 1276int SSL_connect(SSL *ssl);
1277int SSL_is_dtls(const SSL *s); 1277int SSL_is_dtls(const SSL *s);
1278int SSL_is_server(const SSL *s); 1278int SSL_is_server(const SSL *s);
1279int SSL_read(SSL *ssl, void *buf, int num); 1279int SSL_read(SSL *ssl, void *buf, int num);
1280int SSL_peek(SSL *ssl, void *buf, int num); 1280int SSL_peek(SSL *ssl, void *buf, int num);
1281int SSL_write(SSL *ssl, const void *buf, int num); 1281int SSL_write(SSL *ssl, const void *buf, int num);
1282int SSL_read_ex(SSL *ssl, void *buf, size_t num, size_t *bytes_read); 1282int SSL_read_ex(SSL *ssl, void *buf, size_t num, size_t *bytes_read);
1283int SSL_peek_ex(SSL *ssl, void *buf, size_t num, size_t *bytes_peeked); 1283int SSL_peek_ex(SSL *ssl, void *buf, size_t num, size_t *bytes_peeked);
1284int SSL_write_ex(SSL *ssl, const void *buf, size_t num, size_t *bytes_written); 1284int SSL_write_ex(SSL *ssl, const void *buf, size_t num, size_t *bytes_written);
1285 1285
1286#if defined(LIBRESSL_HAS_TLS1_3) || defined(LIBRESSL_INTERNAL) 1286#if defined(LIBRESSL_HAS_TLS1_3) || defined(LIBRESSL_INTERNAL)
1287uint32_t SSL_CTX_get_max_early_data(const SSL_CTX *ctx); 1287uint32_t SSL_CTX_get_max_early_data(const SSL_CTX *ctx);
diff --git a/src/lib/libssl/ssl3.h b/src/lib/libssl/ssl3.h
index 1b1110b4e9..03dda33530 100644
--- a/src/lib/libssl/ssl3.h
+++ b/src/lib/libssl/ssl3.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl3.h,v 1.60 2024/03/02 11:47:41 tb Exp $ */ 1/* $OpenBSD: ssl3.h,v 1.61 2025/04/18 07:34:01 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -134,7 +134,7 @@ extern "C" {
134 134
135#define SSL3_CK_RSA_NULL_MD5 0x03000001 135#define SSL3_CK_RSA_NULL_MD5 0x03000001
136#define SSL3_CK_RSA_NULL_SHA 0x03000002 136#define SSL3_CK_RSA_NULL_SHA 0x03000002
137#define SSL3_CK_RSA_RC4_40_MD5 0x03000003 137#define SSL3_CK_RSA_RC4_40_MD5 0x03000003
138#define SSL3_CK_RSA_RC4_128_MD5 0x03000004 138#define SSL3_CK_RSA_RC4_128_MD5 0x03000004
139#define SSL3_CK_RSA_RC4_128_SHA 0x03000005 139#define SSL3_CK_RSA_RC4_128_SHA 0x03000005
140#define SSL3_CK_RSA_RC2_40_MD5 0x03000006 140#define SSL3_CK_RSA_RC2_40_MD5 0x03000006
@@ -145,10 +145,10 @@ extern "C" {
145 145
146#define SSL3_CK_DH_DSS_DES_40_CBC_SHA 0x0300000B 146#define SSL3_CK_DH_DSS_DES_40_CBC_SHA 0x0300000B
147#define SSL3_CK_DH_DSS_DES_64_CBC_SHA 0x0300000C 147#define SSL3_CK_DH_DSS_DES_64_CBC_SHA 0x0300000C
148#define SSL3_CK_DH_DSS_DES_192_CBC3_SHA 0x0300000D 148#define SSL3_CK_DH_DSS_DES_192_CBC3_SHA 0x0300000D
149#define SSL3_CK_DH_RSA_DES_40_CBC_SHA 0x0300000E 149#define SSL3_CK_DH_RSA_DES_40_CBC_SHA 0x0300000E
150#define SSL3_CK_DH_RSA_DES_64_CBC_SHA 0x0300000F 150#define SSL3_CK_DH_RSA_DES_64_CBC_SHA 0x0300000F
151#define SSL3_CK_DH_RSA_DES_192_CBC3_SHA 0x03000010 151#define SSL3_CK_DH_RSA_DES_192_CBC3_SHA 0x03000010
152 152
153#define SSL3_CK_EDH_DSS_DES_40_CBC_SHA 0x03000011 153#define SSL3_CK_EDH_DSS_DES_40_CBC_SHA 0x03000011
154#define SSL3_CK_EDH_DSS_DES_64_CBC_SHA 0x03000012 154#define SSL3_CK_EDH_DSS_DES_64_CBC_SHA 0x03000012
@@ -168,22 +168,22 @@ extern "C" {
168#define SSL3_CK_KRB5_DES_64_CBC_SHA 0x0300001E 168#define SSL3_CK_KRB5_DES_64_CBC_SHA 0x0300001E
169#define SSL3_CK_KRB5_DES_192_CBC3_SHA 0x0300001F 169#define SSL3_CK_KRB5_DES_192_CBC3_SHA 0x0300001F
170#define SSL3_CK_KRB5_RC4_128_SHA 0x03000020 170#define SSL3_CK_KRB5_RC4_128_SHA 0x03000020
171#define SSL3_CK_KRB5_IDEA_128_CBC_SHA 0x03000021 171#define SSL3_CK_KRB5_IDEA_128_CBC_SHA 0x03000021
172#define SSL3_CK_KRB5_DES_64_CBC_MD5 0x03000022 172#define SSL3_CK_KRB5_DES_64_CBC_MD5 0x03000022
173#define SSL3_CK_KRB5_DES_192_CBC3_MD5 0x03000023 173#define SSL3_CK_KRB5_DES_192_CBC3_MD5 0x03000023
174#define SSL3_CK_KRB5_RC4_128_MD5 0x03000024 174#define SSL3_CK_KRB5_RC4_128_MD5 0x03000024
175#define SSL3_CK_KRB5_IDEA_128_CBC_MD5 0x03000025 175#define SSL3_CK_KRB5_IDEA_128_CBC_MD5 0x03000025
176 176
177#define SSL3_CK_KRB5_DES_40_CBC_SHA 0x03000026 177#define SSL3_CK_KRB5_DES_40_CBC_SHA 0x03000026
178#define SSL3_CK_KRB5_RC2_40_CBC_SHA 0x03000027 178#define SSL3_CK_KRB5_RC2_40_CBC_SHA 0x03000027
179#define SSL3_CK_KRB5_RC4_40_SHA 0x03000028 179#define SSL3_CK_KRB5_RC4_40_SHA 0x03000028
180#define SSL3_CK_KRB5_DES_40_CBC_MD5 0x03000029 180#define SSL3_CK_KRB5_DES_40_CBC_MD5 0x03000029
181#define SSL3_CK_KRB5_RC2_40_CBC_MD5 0x0300002A 181#define SSL3_CK_KRB5_RC2_40_CBC_MD5 0x0300002A
182#define SSL3_CK_KRB5_RC4_40_MD5 0x0300002B 182#define SSL3_CK_KRB5_RC4_40_MD5 0x0300002B
183 183
184#define SSL3_TXT_RSA_NULL_MD5 "NULL-MD5" 184#define SSL3_TXT_RSA_NULL_MD5 "NULL-MD5"
185#define SSL3_TXT_RSA_NULL_SHA "NULL-SHA" 185#define SSL3_TXT_RSA_NULL_SHA "NULL-SHA"
186#define SSL3_TXT_RSA_RC4_40_MD5 "EXP-RC4-MD5" 186#define SSL3_TXT_RSA_RC4_40_MD5 "EXP-RC4-MD5"
187#define SSL3_TXT_RSA_RC4_128_MD5 "RC4-MD5" 187#define SSL3_TXT_RSA_RC4_128_MD5 "RC4-MD5"
188#define SSL3_TXT_RSA_RC4_128_SHA "RC4-SHA" 188#define SSL3_TXT_RSA_RC4_128_SHA "RC4-SHA"
189#define SSL3_TXT_RSA_RC2_40_MD5 "EXP-RC2-CBC-MD5" 189#define SSL3_TXT_RSA_RC2_40_MD5 "EXP-RC2-CBC-MD5"
@@ -194,10 +194,10 @@ extern "C" {
194 194
195#define SSL3_TXT_DH_DSS_DES_40_CBC_SHA "EXP-DH-DSS-DES-CBC-SHA" 195#define SSL3_TXT_DH_DSS_DES_40_CBC_SHA "EXP-DH-DSS-DES-CBC-SHA"
196#define SSL3_TXT_DH_DSS_DES_64_CBC_SHA "DH-DSS-DES-CBC-SHA" 196#define SSL3_TXT_DH_DSS_DES_64_CBC_SHA "DH-DSS-DES-CBC-SHA"
197#define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA "DH-DSS-DES-CBC3-SHA" 197#define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA "DH-DSS-DES-CBC3-SHA"
198#define SSL3_TXT_DH_RSA_DES_40_CBC_SHA "EXP-DH-RSA-DES-CBC-SHA" 198#define SSL3_TXT_DH_RSA_DES_40_CBC_SHA "EXP-DH-RSA-DES-CBC-SHA"
199#define SSL3_TXT_DH_RSA_DES_64_CBC_SHA "DH-RSA-DES-CBC-SHA" 199#define SSL3_TXT_DH_RSA_DES_64_CBC_SHA "DH-RSA-DES-CBC-SHA"
200#define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA "DH-RSA-DES-CBC3-SHA" 200#define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA "DH-RSA-DES-CBC3-SHA"
201 201
202#define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA "EXP-EDH-DSS-DES-CBC-SHA" 202#define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA "EXP-EDH-DSS-DES-CBC-SHA"
203#define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA "EDH-DSS-DES-CBC-SHA" 203#define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA "EDH-DSS-DES-CBC-SHA"
@@ -215,18 +215,18 @@ extern "C" {
215#define SSL3_TXT_KRB5_DES_64_CBC_SHA "KRB5-DES-CBC-SHA" 215#define SSL3_TXT_KRB5_DES_64_CBC_SHA "KRB5-DES-CBC-SHA"
216#define SSL3_TXT_KRB5_DES_192_CBC3_SHA "KRB5-DES-CBC3-SHA" 216#define SSL3_TXT_KRB5_DES_192_CBC3_SHA "KRB5-DES-CBC3-SHA"
217#define SSL3_TXT_KRB5_RC4_128_SHA "KRB5-RC4-SHA" 217#define SSL3_TXT_KRB5_RC4_128_SHA "KRB5-RC4-SHA"
218#define SSL3_TXT_KRB5_IDEA_128_CBC_SHA "KRB5-IDEA-CBC-SHA" 218#define SSL3_TXT_KRB5_IDEA_128_CBC_SHA "KRB5-IDEA-CBC-SHA"
219#define SSL3_TXT_KRB5_DES_64_CBC_MD5 "KRB5-DES-CBC-MD5" 219#define SSL3_TXT_KRB5_DES_64_CBC_MD5 "KRB5-DES-CBC-MD5"
220#define SSL3_TXT_KRB5_DES_192_CBC3_MD5 "KRB5-DES-CBC3-MD5" 220#define SSL3_TXT_KRB5_DES_192_CBC3_MD5 "KRB5-DES-CBC3-MD5"
221#define SSL3_TXT_KRB5_RC4_128_MD5 "KRB5-RC4-MD5" 221#define SSL3_TXT_KRB5_RC4_128_MD5 "KRB5-RC4-MD5"
222#define SSL3_TXT_KRB5_IDEA_128_CBC_MD5 "KRB5-IDEA-CBC-MD5" 222#define SSL3_TXT_KRB5_IDEA_128_CBC_MD5 "KRB5-IDEA-CBC-MD5"
223 223
224#define SSL3_TXT_KRB5_DES_40_CBC_SHA "EXP-KRB5-DES-CBC-SHA" 224#define SSL3_TXT_KRB5_DES_40_CBC_SHA "EXP-KRB5-DES-CBC-SHA"
225#define SSL3_TXT_KRB5_RC2_40_CBC_SHA "EXP-KRB5-RC2-CBC-SHA" 225#define SSL3_TXT_KRB5_RC2_40_CBC_SHA "EXP-KRB5-RC2-CBC-SHA"
226#define SSL3_TXT_KRB5_RC4_40_SHA "EXP-KRB5-RC4-SHA" 226#define SSL3_TXT_KRB5_RC4_40_SHA "EXP-KRB5-RC4-SHA"
227#define SSL3_TXT_KRB5_DES_40_CBC_MD5 "EXP-KRB5-DES-CBC-MD5" 227#define SSL3_TXT_KRB5_DES_40_CBC_MD5 "EXP-KRB5-DES-CBC-MD5"
228#define SSL3_TXT_KRB5_RC2_40_CBC_MD5 "EXP-KRB5-RC2-CBC-MD5" 228#define SSL3_TXT_KRB5_RC2_40_CBC_MD5 "EXP-KRB5-RC2-CBC-MD5"
229#define SSL3_TXT_KRB5_RC4_40_MD5 "EXP-KRB5-RC4-MD5" 229#define SSL3_TXT_KRB5_RC4_40_MD5 "EXP-KRB5-RC4-MD5"
230 230
231#define SSL3_SSL_SESSION_ID_LENGTH 32 231#define SSL3_SSL_SESSION_ID_LENGTH 32
232#define SSL3_MAX_SSL_SESSION_ID_LENGTH 32 232#define SSL3_MAX_SSL_SESSION_ID_LENGTH 32
diff --git a/src/lib/libssl/ssl_err.c b/src/lib/libssl/ssl_err.c
index eac2d9e61f..90822490e2 100644
--- a/src/lib/libssl/ssl_err.c
+++ b/src/lib/libssl/ssl_err.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_err.c,v 1.53 2024/10/09 08:00:29 tb Exp $ */ 1/* $OpenBSD: ssl_err.c,v 1.55 2025/05/10 05:49:21 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -669,8 +669,7 @@ SSL_state_func_code(int state) {
669} 669}
670 670
671void 671void
672SSL_error_internal(const SSL *s, int r, char *f, int l) 672SSL_error_internal(const SSL *s, int r, const char *f, int l)
673{ 673{
674 ERR_PUT_error(ERR_LIB_SSL, 674 ERR_PUT_error(ERR_LIB_SSL, SSL_state_func_code(s->s3->hs.state), r, f, l);
675 (SSL_state_func_code(s->s3->hs.state)), r, f, l);
676} 675}
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c
index ce68981493..630724e670 100644
--- a/src/lib/libssl/ssl_lib.c
+++ b/src/lib/libssl/ssl_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_lib.c,v 1.331 2025/03/12 14:03:55 jsing Exp $ */ 1/* $OpenBSD: ssl_lib.c,v 1.333 2025/06/09 10:14:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -1298,7 +1298,7 @@ SSL_shutdown(SSL *s)
1298 return (-1); 1298 return (-1);
1299 } 1299 }
1300 1300
1301 if (s != NULL && !SSL_in_init(s)) 1301 if (!SSL_in_init(s))
1302 return (s->method->ssl_shutdown(s)); 1302 return (s->method->ssl_shutdown(s));
1303 1303
1304 return (1); 1304 return (1);
@@ -3008,8 +3008,9 @@ SSL_dup(SSL *s)
3008 3008
3009 /* Dup the client_CA list */ 3009 /* Dup the client_CA list */
3010 if (s->client_CA != NULL) { 3010 if (s->client_CA != NULL) {
3011 if ((sk = sk_X509_NAME_dup(s->client_CA)) == NULL) goto err; 3011 if ((sk = sk_X509_NAME_dup(s->client_CA)) == NULL)
3012 ret->client_CA = sk; 3012 goto err;
3013 ret->client_CA = sk;
3013 for (i = 0; i < sk_X509_NAME_num(sk); i++) { 3014 for (i = 0; i < sk_X509_NAME_num(sk); i++) {
3014 xn = sk_X509_NAME_value(sk, i); 3015 xn = sk_X509_NAME_value(sk, i);
3015 if (sk_X509_NAME_set(sk, i, 3016 if (sk_X509_NAME_set(sk, i,
diff --git a/src/lib/libssl/ssl_local.h b/src/lib/libssl/ssl_local.h
index 6095940388..acb87f8650 100644
--- a/src/lib/libssl/ssl_local.h
+++ b/src/lib/libssl/ssl_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_local.h,v 1.27 2025/03/09 15:12:18 tb Exp $ */ 1/* $OpenBSD: ssl_local.h,v 1.33 2025/05/10 06:04:36 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -203,7 +203,7 @@ __BEGIN_HIDDEN_DECLS
203/* Bits for algorithm_auth (server authentication) */ 203/* Bits for algorithm_auth (server authentication) */
204#define SSL_aRSA 0x00000001L /* RSA auth */ 204#define SSL_aRSA 0x00000001L /* RSA auth */
205#define SSL_aNULL 0x00000004L /* no auth (i.e. use ADH or AECDH) */ 205#define SSL_aNULL 0x00000004L /* no auth (i.e. use ADH or AECDH) */
206#define SSL_aECDSA 0x00000040L /* ECDSA auth*/ 206#define SSL_aECDSA 0x00000040L /* ECDSA auth*/
207#define SSL_aTLS1_3 0x00000400L /* TLSv1.3 authentication */ 207#define SSL_aTLS1_3 0x00000400L /* TLSv1.3 authentication */
208 208
209/* Bits for algorithm_enc (symmetric encryption) */ 209/* Bits for algorithm_enc (symmetric encryption) */
@@ -289,12 +289,8 @@ __BEGIN_HIDDEN_DECLS
289 * SSL_aDSS <- DSA_SIGN 289 * SSL_aDSS <- DSA_SIGN
290 */ 290 */
291 291
292/* From ECC-TLS draft, used in encoding the curve type in 292/* From RFC 4492, section 5.4. Only named curves are supported. */
293 * ECParameters 293#define NAMED_CURVE_TYPE 3
294 */
295#define EXPLICIT_PRIME_CURVE_TYPE 1
296#define EXPLICIT_CHAR2_CURVE_TYPE 2
297#define NAMED_CURVE_TYPE 3
298 294
299typedef struct ssl_cert_pkey_st { 295typedef struct ssl_cert_pkey_st {
300 X509 *x509; 296 X509 *x509;
@@ -396,7 +392,7 @@ struct ssl_method_st {
396 * PSK_identity_hint [ 7 ] EXPLICIT OCTET STRING, -- optional PSK identity hint 392 * PSK_identity_hint [ 7 ] EXPLICIT OCTET STRING, -- optional PSK identity hint
397 * PSK_identity [ 8 ] EXPLICIT OCTET STRING, -- optional PSK identity 393 * PSK_identity [ 8 ] EXPLICIT OCTET STRING, -- optional PSK identity
398 * Ticket_lifetime_hint [9] EXPLICIT INTEGER, -- server's lifetime hint for session ticket 394 * Ticket_lifetime_hint [9] EXPLICIT INTEGER, -- server's lifetime hint for session ticket
399 * Ticket [10] EXPLICIT OCTET STRING, -- session ticket (clients only) 395 * Ticket [10] EXPLICIT OCTET STRING, -- session ticket (clients only)
400 * Compression_meth [11] EXPLICIT OCTET STRING, -- optional compression method 396 * Compression_meth [11] EXPLICIT OCTET STRING, -- optional compression method
401 * SRP_username [ 12 ] EXPLICIT OCTET STRING -- optional SRP username 397 * SRP_username [ 12 ] EXPLICIT OCTET STRING -- optional SRP username
402 * } 398 * }
@@ -1054,7 +1050,7 @@ struct ssl_st {
1054 1050
1055 int renegotiate;/* 1 if we are renegotiating. 1051 int renegotiate;/* 1 if we are renegotiating.
1056 * 2 if we are a server and are inside a handshake 1052 * 2 if we are a server and are inside a handshake
1057 * (i.e. not just sending a HelloRequest) */ 1053 * (i.e. not just sending a HelloRequest) */
1058 1054
1059 int rstate; /* where we are when reading */ 1055 int rstate; /* where we are when reading */
1060 1056
@@ -1078,7 +1074,7 @@ typedef struct ssl3_record_internal_st {
1078 1074
1079typedef struct ssl3_buffer_internal_st { 1075typedef struct ssl3_buffer_internal_st {
1080 unsigned char *buf; /* at least SSL3_RT_MAX_PACKET_SIZE bytes, 1076 unsigned char *buf; /* at least SSL3_RT_MAX_PACKET_SIZE bytes,
1081 * see ssl3_setup_buffers() */ 1077 * see ssl3_setup_buffers() */
1082 size_t len; /* buffer size */ 1078 size_t len; /* buffer size */
1083 int offset; /* where to 'copy from' */ 1079 int offset; /* where to 'copy from' */
1084 int left; /* how many bytes left */ 1080 int left; /* how many bytes left */
@@ -1443,9 +1439,10 @@ int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx, unsigned char *md_out,
1443 unsigned int mac_secret_length); 1439 unsigned int mac_secret_length);
1444int SSL_state_func_code(int _state); 1440int SSL_state_func_code(int _state);
1445 1441
1446#define SSLerror(s, r) SSL_error_internal(s, r, OPENSSL_FILE, OPENSSL_LINE) 1442void SSL_error_internal(const SSL *s, int r, const char *f, int l);
1447#define SSLerrorx(r) ERR_PUT_error(ERR_LIB_SSL,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) 1443#define SSLerror(s, r) SSL_error_internal(s, r, OPENSSL_FILE, OPENSSL_LINE)
1448void SSL_error_internal(const SSL *s, int r, char *f, int l); 1444#define SSLerrorx(r) ERR_PUT_error(ERR_LIB_SSL,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
1445#define SYSerror(r) ERR_PUT_error(ERR_LIB_SYS,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE)
1449 1446
1450#ifndef OPENSSL_NO_SRTP 1447#ifndef OPENSSL_NO_SRTP
1451 1448
diff --git a/src/lib/libssl/ssl_stat.c b/src/lib/libssl/ssl_stat.c
index b19944ca83..9966217ca3 100644
--- a/src/lib/libssl/ssl_stat.c
+++ b/src/lib/libssl/ssl_stat.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_stat.c,v 1.23 2024/10/12 03:54:18 tb Exp $ */ 1/* $OpenBSD: ssl_stat.c,v 1.24 2025/05/22 08:25:26 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -438,72 +438,7 @@ LSSL_ALIAS(SSL_alert_type_string);
438const char * 438const char *
439SSL_alert_desc_string(int value) 439SSL_alert_desc_string(int value)
440{ 440{
441 switch (value & 0xff) { 441 return "!!";
442 case SSL_AD_CLOSE_NOTIFY:
443 return "CN";
444 case SSL_AD_UNEXPECTED_MESSAGE:
445 return "UM";
446 case SSL_AD_BAD_RECORD_MAC:
447 return "BM";
448 case SSL_AD_RECORD_OVERFLOW:
449 return "RO";
450 case SSL_AD_DECOMPRESSION_FAILURE:
451 return "DF";
452 case SSL_AD_HANDSHAKE_FAILURE:
453 return "HF";
454 case SSL_AD_BAD_CERTIFICATE:
455 return "BC";
456 case SSL_AD_UNSUPPORTED_CERTIFICATE:
457 return "UC";
458 case SSL_AD_CERTIFICATE_REVOKED:
459 return "CR";
460 case SSL_AD_CERTIFICATE_EXPIRED:
461 return "CE";
462 case SSL_AD_CERTIFICATE_UNKNOWN:
463 return "CU";
464 case SSL_AD_ILLEGAL_PARAMETER:
465 return "IP";
466 case SSL_AD_UNKNOWN_CA:
467 return "CA";
468 case SSL_AD_ACCESS_DENIED:
469 return "AD";
470 case SSL_AD_DECODE_ERROR:
471 return "DE";
472 case SSL_AD_DECRYPT_ERROR:
473 return "CY";
474 case SSL_AD_PROTOCOL_VERSION:
475 return "PV";
476 case SSL_AD_INSUFFICIENT_SECURITY:
477 return "IS";
478 case SSL_AD_INTERNAL_ERROR:
479 return "IE";
480 case SSL_AD_INAPPROPRIATE_FALLBACK:
481 return "IF";
482 case SSL_AD_USER_CANCELLED:
483 return "US";
484 case SSL_AD_NO_RENEGOTIATION:
485 return "NR";
486 case SSL_AD_MISSING_EXTENSION:
487 return "ME";
488 case SSL_AD_UNSUPPORTED_EXTENSION:
489 return "UE";
490 case SSL_AD_CERTIFICATE_UNOBTAINABLE:
491 return "CO";
492 case SSL_AD_UNRECOGNIZED_NAME:
493 return "UN";
494 case SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE:
495 return "BR";
496 case SSL_AD_BAD_CERTIFICATE_HASH_VALUE:
497 return "BH";
498 case SSL_AD_UNKNOWN_PSK_IDENTITY:
499 return "UP";
500 case SSL_AD_CERTIFICATE_REQUIRED:
501 return "CQ"; /* XXX */
502 case SSL_AD_NO_APPLICATION_PROTOCOL:
503 return "AP";
504 default:
505 return "UK";
506 }
507} 442}
508LSSL_ALIAS(SSL_alert_desc_string); 443LSSL_ALIAS(SSL_alert_desc_string);
509 444
diff --git a/src/lib/libssl/ssl_tlsext.c b/src/lib/libssl/ssl_tlsext.c
index 08bf5593ec..9209597601 100644
--- a/src/lib/libssl/ssl_tlsext.c
+++ b/src/lib/libssl/ssl_tlsext.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_tlsext.c,v 1.154 2024/07/09 12:27:27 beck Exp $ */ 1/* $OpenBSD: ssl_tlsext.c,v 1.156 2025/06/07 10:23:21 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> 4 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org>
@@ -2410,13 +2410,12 @@ tlsext_randomize_build_order(SSL *s)
2410{ 2410{
2411 const struct tls_extension *psk_ext; 2411 const struct tls_extension *psk_ext;
2412 size_t idx, new_idx; 2412 size_t idx, new_idx;
2413 size_t alpn_idx = 0, sni_idx = 0;
2414 2413
2415 free(s->tlsext_build_order); 2414 free(s->tlsext_build_order);
2416 s->tlsext_build_order_len = 0; 2415 s->tlsext_build_order_len = 0;
2417 2416
2418 if ((s->tlsext_build_order = calloc(sizeof(*s->tlsext_build_order), 2417 if ((s->tlsext_build_order = calloc(N_TLS_EXTENSIONS,
2419 N_TLS_EXTENSIONS)) == NULL) 2418 sizeof(*s->tlsext_build_order))) == NULL)
2420 return 0; 2419 return 0;
2421 s->tlsext_build_order_len = N_TLS_EXTENSIONS; 2420 s->tlsext_build_order_len = N_TLS_EXTENSIONS;
2422 2421
@@ -2433,28 +2432,6 @@ tlsext_randomize_build_order(SSL *s)
2433 s->tlsext_build_order[new_idx] = &tls_extensions[idx]; 2432 s->tlsext_build_order[new_idx] = &tls_extensions[idx];
2434 } 2433 }
2435 2434
2436 /*
2437 * XXX - Apache2 special until year 2025: ensure that SNI precedes ALPN
2438 * for clients so that virtual host setups work correctly.
2439 */
2440
2441 if (s->server)
2442 return 1;
2443
2444 for (idx = 0; idx < N_TLS_EXTENSIONS; idx++) {
2445 if (s->tlsext_build_order[idx]->type == TLSEXT_TYPE_alpn)
2446 alpn_idx = idx;
2447 if (s->tlsext_build_order[idx]->type == TLSEXT_TYPE_server_name)
2448 sni_idx = idx;
2449 }
2450 if (alpn_idx < sni_idx) {
2451 const struct tls_extension *tmp;
2452
2453 tmp = s->tlsext_build_order[alpn_idx];
2454 s->tlsext_build_order[alpn_idx] = s->tlsext_build_order[sni_idx];
2455 s->tlsext_build_order[sni_idx] = tmp;
2456 }
2457
2458 return 1; 2435 return 1;
2459} 2436}
2460 2437
@@ -2466,8 +2443,8 @@ tlsext_linearize_build_order(SSL *s)
2466 free(s->tlsext_build_order); 2443 free(s->tlsext_build_order);
2467 s->tlsext_build_order_len = 0; 2444 s->tlsext_build_order_len = 0;
2468 2445
2469 if ((s->tlsext_build_order = calloc(sizeof(*s->tlsext_build_order), 2446 if ((s->tlsext_build_order = calloc(N_TLS_EXTENSIONS,
2470 N_TLS_EXTENSIONS)) == NULL) 2447 sizeof(*s->tlsext_build_order))) == NULL)
2471 return 0; 2448 return 0;
2472 s->tlsext_build_order_len = N_TLS_EXTENSIONS; 2449 s->tlsext_build_order_len = N_TLS_EXTENSIONS;
2473 2450
diff --git a/src/lib/libssl/t1_lib.c b/src/lib/libssl/t1_lib.c
index b200f78098..57cd180d09 100644
--- a/src/lib/libssl/t1_lib.c
+++ b/src/lib/libssl/t1_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t1_lib.c,v 1.204 2025/01/18 14:17:05 tb Exp $ */ 1/* $OpenBSD: t1_lib.c,v 1.206 2025/05/31 15:17:11 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -151,6 +151,7 @@ tls1_clear(SSL *s)
151} 151}
152 152
153struct supported_group { 153struct supported_group {
154 uint16_t group_id;
154 int nid; 155 int nid;
155 int bits; 156 int bits;
156}; 157};
@@ -160,119 +161,148 @@ struct supported_group {
160 * https://www.iana.org/assignments/tls-parameters/#tls-parameters-8 161 * https://www.iana.org/assignments/tls-parameters/#tls-parameters-8
161 */ 162 */
162static const struct supported_group nid_list[] = { 163static const struct supported_group nid_list[] = {
163 [1] = { 164 {
165 .group_id = 1,
164 .nid = NID_sect163k1, 166 .nid = NID_sect163k1,
165 .bits = 80, 167 .bits = 80,
166 }, 168 },
167 [2] = { 169 {
170 .group_id = 2,
168 .nid = NID_sect163r1, 171 .nid = NID_sect163r1,
169 .bits = 80, 172 .bits = 80,
170 }, 173 },
171 [3] = { 174 {
175 .group_id = 3,
172 .nid = NID_sect163r2, 176 .nid = NID_sect163r2,
173 .bits = 80, 177 .bits = 80,
174 }, 178 },
175 [4] = { 179 {
180 .group_id = 4,
176 .nid = NID_sect193r1, 181 .nid = NID_sect193r1,
177 .bits = 80, 182 .bits = 80,
178 }, 183 },
179 [5] = { 184 {
185 .group_id = 5,
180 .nid = NID_sect193r2, 186 .nid = NID_sect193r2,
181 .bits = 80, 187 .bits = 80,
182 }, 188 },
183 [6] = { 189 {
190 .group_id = 6,
184 .nid = NID_sect233k1, 191 .nid = NID_sect233k1,
185 .bits = 112, 192 .bits = 112,
186 }, 193 },
187 [7] = { 194 {
195 .group_id = 7,
188 .nid = NID_sect233r1, 196 .nid = NID_sect233r1,
189 .bits = 112, 197 .bits = 112,
190 }, 198 },
191 [8] = { 199 {
200 .group_id = 8,
192 .nid = NID_sect239k1, 201 .nid = NID_sect239k1,
193 .bits = 112, 202 .bits = 112,
194 }, 203 },
195 [9] = { 204 {
205 .group_id = 9,
196 .nid = NID_sect283k1, 206 .nid = NID_sect283k1,
197 .bits = 128, 207 .bits = 128,
198 }, 208 },
199 [10] = { 209 {
210 .group_id = 10,
200 .nid = NID_sect283r1, 211 .nid = NID_sect283r1,
201 .bits = 128, 212 .bits = 128,
202 }, 213 },
203 [11] = { 214 {
215 .group_id = 11,
204 .nid = NID_sect409k1, 216 .nid = NID_sect409k1,
205 .bits = 192, 217 .bits = 192,
206 }, 218 },
207 [12] = { 219 {
220 .group_id = 12,
208 .nid = NID_sect409r1, 221 .nid = NID_sect409r1,
209 .bits = 192, 222 .bits = 192,
210 }, 223 },
211 [13] = { 224 {
225 .group_id = 13,
212 .nid = NID_sect571k1, 226 .nid = NID_sect571k1,
213 .bits = 256, 227 .bits = 256,
214 }, 228 },
215 [14] = { 229 {
230 .group_id = 14,
216 .nid = NID_sect571r1, 231 .nid = NID_sect571r1,
217 .bits = 256, 232 .bits = 256,
218 }, 233 },
219 [15] = { 234 {
235 .group_id = 15,
220 .nid = NID_secp160k1, 236 .nid = NID_secp160k1,
221 .bits = 80, 237 .bits = 80,
222 }, 238 },
223 [16] = { 239 {
240 .group_id = 16,
224 .nid = NID_secp160r1, 241 .nid = NID_secp160r1,
225 .bits = 80, 242 .bits = 80,
226 }, 243 },
227 [17] = { 244 {
245 .group_id = 17,
228 .nid = NID_secp160r2, 246 .nid = NID_secp160r2,
229 .bits = 80, 247 .bits = 80,
230 }, 248 },
231 [18] = { 249 {
250 .group_id = 18,
232 .nid = NID_secp192k1, 251 .nid = NID_secp192k1,
233 .bits = 80, 252 .bits = 80,
234 }, 253 },
235 [19] = { 254 {
255 .group_id = 19,
236 .nid = NID_X9_62_prime192v1, /* aka secp192r1 */ 256 .nid = NID_X9_62_prime192v1, /* aka secp192r1 */
237 .bits = 80, 257 .bits = 80,
238 }, 258 },
239 [20] = { 259 {
260 .group_id = 20,
240 .nid = NID_secp224k1, 261 .nid = NID_secp224k1,
241 .bits = 112, 262 .bits = 112,
242 }, 263 },
243 [21] = { 264 {
265 .group_id = 21,
244 .nid = NID_secp224r1, 266 .nid = NID_secp224r1,
245 .bits = 112, 267 .bits = 112,
246 }, 268 },
247 [22] = { 269 {
270 .group_id = 22,
248 .nid = NID_secp256k1, 271 .nid = NID_secp256k1,
249 .bits = 128, 272 .bits = 128,
250 }, 273 },
251 [23] = { 274 {
275 .group_id = 23,
252 .nid = NID_X9_62_prime256v1, /* aka secp256r1 */ 276 .nid = NID_X9_62_prime256v1, /* aka secp256r1 */
253 .bits = 128, 277 .bits = 128,
254 }, 278 },
255 [24] = { 279 {
280 .group_id = 24,
256 .nid = NID_secp384r1, 281 .nid = NID_secp384r1,
257 .bits = 192, 282 .bits = 192,
258 }, 283 },
259 [25] = { 284 {
285 .group_id = 25,
260 .nid = NID_secp521r1, 286 .nid = NID_secp521r1,
261 .bits = 256, 287 .bits = 256,
262 }, 288 },
263 [26] = { 289 {
290 .group_id = 26,
264 .nid = NID_brainpoolP256r1, 291 .nid = NID_brainpoolP256r1,
265 .bits = 128, 292 .bits = 128,
266 }, 293 },
267 [27] = { 294 {
295 .group_id = 27,
268 .nid = NID_brainpoolP384r1, 296 .nid = NID_brainpoolP384r1,
269 .bits = 192, 297 .bits = 192,
270 }, 298 },
271 [28] = { 299 {
300 .group_id = 28,
272 .nid = NID_brainpoolP512r1, 301 .nid = NID_brainpoolP512r1,
273 .bits = 256, 302 .bits = 256,
274 }, 303 },
275 [29] = { 304 {
305 .group_id = 29,
276 .nid = NID_X25519, 306 .nid = NID_X25519,
277 .bits = 128, 307 .bits = 128,
278 }, 308 },
@@ -339,18 +369,41 @@ static const uint16_t ecgroups_server_default[] = {
339 24, /* secp384r1 (24) */ 369 24, /* secp384r1 (24) */
340}; 370};
341 371
372static const struct supported_group *
373tls1_supported_group_by_id(uint16_t group_id)
374{
375 int i;
376
377 for (i = 0; i < NID_LIST_LEN; i++) {
378 if (group_id == nid_list[i].group_id)
379 return &nid_list[i];
380 }
381
382 return NULL;
383}
384
385static const struct supported_group *
386tls1_supported_group_by_nid(int nid)
387{
388 int i;
389
390 for (i = 0; i < NID_LIST_LEN; i++) {
391 if (nid == nid_list[i].nid)
392 return &nid_list[i];
393 }
394
395 return NULL;
396}
397
342int 398int
343tls1_ec_group_id2nid(uint16_t group_id, int *out_nid) 399tls1_ec_group_id2nid(uint16_t group_id, int *out_nid)
344{ 400{
345 int nid; 401 const struct supported_group *sg;
346
347 if (group_id >= NID_LIST_LEN)
348 return 0;
349 402
350 if ((nid = nid_list[group_id].nid) == 0) 403 if ((sg = tls1_supported_group_by_id(group_id)) == NULL)
351 return 0; 404 return 0;
352 405
353 *out_nid = nid; 406 *out_nid = sg->nid;
354 407
355 return 1; 408 return 1;
356} 409}
@@ -358,15 +411,12 @@ tls1_ec_group_id2nid(uint16_t group_id, int *out_nid)
358int 411int
359tls1_ec_group_id2bits(uint16_t group_id, int *out_bits) 412tls1_ec_group_id2bits(uint16_t group_id, int *out_bits)
360{ 413{
361 int bits; 414 const struct supported_group *sg;
362
363 if (group_id >= NID_LIST_LEN)
364 return 0;
365 415
366 if ((bits = nid_list[group_id].bits) == 0) 416 if ((sg = tls1_supported_group_by_id(group_id)) == NULL)
367 return 0; 417 return 0;
368 418
369 *out_bits = bits; 419 *out_bits = sg->bits;
370 420
371 return 1; 421 return 1;
372} 422}
@@ -374,19 +424,14 @@ tls1_ec_group_id2bits(uint16_t group_id, int *out_bits)
374int 424int
375tls1_ec_nid2group_id(int nid, uint16_t *out_group_id) 425tls1_ec_nid2group_id(int nid, uint16_t *out_group_id)
376{ 426{
377 uint16_t group_id; 427 const struct supported_group *sg;
378 428
379 if (nid == 0) 429 if ((sg = tls1_supported_group_by_nid(nid)) == NULL)
380 return 0; 430 return 0;
381 431
382 for (group_id = 0; group_id < NID_LIST_LEN; group_id++) { 432 *out_group_id = sg->group_id;
383 if (nid_list[group_id].nid == nid) {
384 *out_group_id = group_id;
385 return 1;
386 }
387 }
388 433
389 return 0; 434 return 1;
390} 435}
391 436
392/* 437/*
diff --git a/src/lib/libssl/tls1.h b/src/lib/libssl/tls1.h
index d018fced5c..2d5dffc6cf 100644
--- a/src/lib/libssl/tls1.h
+++ b/src/lib/libssl/tls1.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls1.h,v 1.60 2024/10/23 01:57:19 jsg Exp $ */ 1/* $OpenBSD: tls1.h,v 1.61 2025/04/18 07:34:01 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -197,7 +197,7 @@ extern "C" {
197/* Codes 110-114 from RFC 3546. */ 197/* Codes 110-114 from RFC 3546. */
198#define TLS1_AD_UNSUPPORTED_EXTENSION 110 198#define TLS1_AD_UNSUPPORTED_EXTENSION 110
199#define TLS1_AD_CERTIFICATE_UNOBTAINABLE 111 199#define TLS1_AD_CERTIFICATE_UNOBTAINABLE 111
200#define TLS1_AD_UNRECOGNIZED_NAME 112 200#define TLS1_AD_UNRECOGNIZED_NAME 112
201#define TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE 113 201#define TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE 113
202#define TLS1_AD_BAD_CERTIFICATE_HASH_VALUE 114 202#define TLS1_AD_BAD_CERTIFICATE_HASH_VALUE 114
203/* Code 115 from RFC 4279. */ 203/* Code 115 from RFC 4279. */
@@ -455,7 +455,7 @@ SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB,(void (*)(void))cb)
455#define TLS1_CK_DH_RSA_WITH_SEED_SHA 0x03000098 455#define TLS1_CK_DH_RSA_WITH_SEED_SHA 0x03000098
456#define TLS1_CK_DHE_DSS_WITH_SEED_SHA 0x03000099 456#define TLS1_CK_DHE_DSS_WITH_SEED_SHA 0x03000099
457#define TLS1_CK_DHE_RSA_WITH_SEED_SHA 0x0300009A 457#define TLS1_CK_DHE_RSA_WITH_SEED_SHA 0x0300009A
458#define TLS1_CK_ADH_WITH_SEED_SHA 0x0300009B 458#define TLS1_CK_ADH_WITH_SEED_SHA 0x0300009B
459 459
460/* TLS v1.2 GCM ciphersuites from RFC 5288. */ 460/* TLS v1.2 GCM ciphersuites from RFC 5288. */
461#define TLS1_CK_RSA_WITH_AES_128_GCM_SHA256 0x0300009C 461#define TLS1_CK_RSA_WITH_AES_128_GCM_SHA256 0x0300009C
diff --git a/src/lib/libssl/tls13_lib.c b/src/lib/libssl/tls13_lib.c
index 331a3ad1a7..c3470b2931 100644
--- a/src/lib/libssl/tls13_lib.c
+++ b/src/lib/libssl/tls13_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_lib.c,v 1.77 2024/01/27 14:23:51 jsing Exp $ */ 1/* $OpenBSD: tls13_lib.c,v 1.78 2025/06/07 10:25:12 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2019 Bob Beck <beck@openbsd.org> 4 * Copyright (c) 2019 Bob Beck <beck@openbsd.org>
@@ -538,7 +538,7 @@ tls13_ctx_new(int mode, SSL *ssl)
538{ 538{
539 struct tls13_ctx *ctx = NULL; 539 struct tls13_ctx *ctx = NULL;
540 540
541 if ((ctx = calloc(sizeof(struct tls13_ctx), 1)) == NULL) 541 if ((ctx = calloc(1, sizeof(*ctx))) == NULL)
542 goto err; 542 goto err;
543 543
544 ctx->hs = &ssl->s3->hs; 544 ctx->hs = &ssl->s3->hs;
diff --git a/src/lib/libtls/man/tls_accept_socket.3 b/src/lib/libtls/man/tls_accept_socket.3
index 931b9346ec..8922708e0f 100644
--- a/src/lib/libtls/man/tls_accept_socket.3
+++ b/src/lib/libtls/man/tls_accept_socket.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: tls_accept_socket.3,v 1.4 2018/05/26 12:35:26 schwarze Exp $ 1.\" $OpenBSD: tls_accept_socket.3,v 1.5 2025/07/07 10:54:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2015 Ted Unangst <tedu@openbsd.org> 3.\" Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
4.\" Copyright (c) 2015 Joel Sing <jsing@openbsd.org> 4.\" Copyright (c) 2015 Joel Sing <jsing@openbsd.org>
@@ -16,7 +16,7 @@
16.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18.\" 18.\"
19.Dd $Mdocdate: May 26 2018 $ 19.Dd $Mdocdate: July 7 2025 $
20.Dt TLS_ACCEPT_SOCKET 3 20.Dt TLS_ACCEPT_SOCKET 3
21.Os 21.Os
22.Sh NAME 22.Sh NAME
@@ -25,6 +25,7 @@
25.Nm tls_accept_cbs 25.Nm tls_accept_cbs
26.Nd accept an incoming client connection in a TLS server 26.Nd accept an incoming client connection in a TLS server
27.Sh SYNOPSIS 27.Sh SYNOPSIS
28.Lb libtls libssl libcrypto
28.In tls.h 29.In tls.h
29.Ft int 30.Ft int
30.Fo tls_accept_socket 31.Fo tls_accept_socket
diff --git a/src/lib/libtls/man/tls_client.3 b/src/lib/libtls/man/tls_client.3
index 98f58d4c20..235c779519 100644
--- a/src/lib/libtls/man/tls_client.3
+++ b/src/lib/libtls/man/tls_client.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: tls_client.3,v 1.4 2017/08/12 03:41:48 jsing Exp $ 1.\" $OpenBSD: tls_client.3,v 1.5 2025/07/07 10:54:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> 3.\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: August 12 2017 $ 17.Dd $Mdocdate: July 7 2025 $
18.Dt TLS_CLIENT 3 18.Dt TLS_CLIENT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -25,6 +25,7 @@
25.Nm tls_free 25.Nm tls_free
26.Nd configure a TLS connection 26.Nd configure a TLS connection
27.Sh SYNOPSIS 27.Sh SYNOPSIS
28.Lb libtls libssl libcrypto
28.In tls.h 29.In tls.h
29.Ft struct tls * 30.Ft struct tls *
30.Fn tls_client void 31.Fn tls_client void
diff --git a/src/lib/libtls/man/tls_config_ocsp_require_stapling.3 b/src/lib/libtls/man/tls_config_ocsp_require_stapling.3
index a0694d304f..d776b61ad6 100644
--- a/src/lib/libtls/man/tls_config_ocsp_require_stapling.3
+++ b/src/lib/libtls/man/tls_config_ocsp_require_stapling.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: tls_config_ocsp_require_stapling.3,v 1.5 2017/01/31 20:53:50 jmc Exp $ 1.\" $OpenBSD: tls_config_ocsp_require_stapling.3,v 1.6 2025/07/07 10:54:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Bob Beck <beck@openbsd.org> 3.\" Copyright (c) 2016 Bob Beck <beck@openbsd.org>
4.\" 4.\"
@@ -14,13 +14,14 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: January 31 2017 $ 17.Dd $Mdocdate: July 7 2025 $
18.Dt TLS_CONFIG_OCSP_REQUIRE_STAPLING 3 18.Dt TLS_CONFIG_OCSP_REQUIRE_STAPLING 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
21.Nm tls_config_ocsp_require_stapling 21.Nm tls_config_ocsp_require_stapling
22.Nd OCSP configuration for libtls 22.Nd OCSP configuration for libtls
23.Sh SYNOPSIS 23.Sh SYNOPSIS
24.Lb libtls libssl libcrypto
24.In tls.h 25.In tls.h
25.Ft void 26.Ft void
26.Fn tls_config_ocsp_require_stapling "struct tls_config *config" 27.Fn tls_config_ocsp_require_stapling "struct tls_config *config"
diff --git a/src/lib/libtls/man/tls_config_set_protocols.3 b/src/lib/libtls/man/tls_config_set_protocols.3
index 32b8cce757..403bc10b82 100644
--- a/src/lib/libtls/man/tls_config_set_protocols.3
+++ b/src/lib/libtls/man/tls_config_set_protocols.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: tls_config_set_protocols.3,v 1.12 2023/07/02 06:37:27 beck Exp $ 1.\" $OpenBSD: tls_config_set_protocols.3,v 1.13 2025/07/07 10:54:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> 3.\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org>
4.\" Copyright (c) 2015, 2016 Joel Sing <jsing@openbsd.org> 4.\" Copyright (c) 2015, 2016 Joel Sing <jsing@openbsd.org>
@@ -16,7 +16,7 @@
16.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18.\" 18.\"
19.Dd $Mdocdate: July 2 2023 $ 19.Dd $Mdocdate: July 7 2025 $
20.Dt TLS_CONFIG_SET_PROTOCOLS 3 20.Dt TLS_CONFIG_SET_PROTOCOLS 3
21.Os 21.Os
22.Sh NAME 22.Sh NAME
@@ -26,10 +26,12 @@
26.Nm tls_config_set_ciphers , 26.Nm tls_config_set_ciphers ,
27.Nm tls_config_set_dheparams , 27.Nm tls_config_set_dheparams ,
28.Nm tls_config_set_ecdhecurves , 28.Nm tls_config_set_ecdhecurves ,
29.\" .Nm tls_config_set_ecdhecurve is intentionally undocumented.
29.Nm tls_config_prefer_ciphers_client , 30.Nm tls_config_prefer_ciphers_client ,
30.Nm tls_config_prefer_ciphers_server 31.Nm tls_config_prefer_ciphers_server
31.Nd TLS protocol and cipher selection 32.Nd TLS protocol and cipher selection
32.Sh SYNOPSIS 33.Sh SYNOPSIS
34.Lb libtls libssl libcrypto
33.In tls.h 35.In tls.h
34.Ft int 36.Ft int
35.Fo tls_config_set_protocols 37.Fo tls_config_set_protocols
diff --git a/src/lib/libtls/man/tls_config_set_session_id.3 b/src/lib/libtls/man/tls_config_set_session_id.3
index d969e01e33..a869b3f24c 100644
--- a/src/lib/libtls/man/tls_config_set_session_id.3
+++ b/src/lib/libtls/man/tls_config_set_session_id.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: tls_config_set_session_id.3,v 1.5 2018/02/10 06:07:43 jsing Exp $ 1.\" $OpenBSD: tls_config_set_session_id.3,v 1.6 2025/07/07 10:54:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2017 Claudio Jeker <claudio@openbsd.org> 3.\" Copyright (c) 2017 Claudio Jeker <claudio@openbsd.org>
4.\" Copyright (c) 2018 Joel Sing <jsing@openbsd.org> 4.\" Copyright (c) 2018 Joel Sing <jsing@openbsd.org>
@@ -15,7 +15,7 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 17.\"
18.Dd $Mdocdate: February 10 2018 $ 18.Dd $Mdocdate: July 7 2025 $
19.Dt TLS_CONFIG_SET_SESSION_ID 3 19.Dt TLS_CONFIG_SET_SESSION_ID 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
@@ -25,6 +25,7 @@
25.Nm tls_config_add_ticket_key 25.Nm tls_config_add_ticket_key
26.Nd configure resuming of TLS handshakes 26.Nd configure resuming of TLS handshakes
27.Sh SYNOPSIS 27.Sh SYNOPSIS
28.Lb libtls libssl libcrypto
28.In tls.h 29.In tls.h
29.Ft int 30.Ft int
30.Fo tls_config_set_session_fd 31.Fo tls_config_set_session_fd
diff --git a/src/lib/libtls/man/tls_config_verify.3 b/src/lib/libtls/man/tls_config_verify.3
index 4a43c834d7..d5b29e858e 100644
--- a/src/lib/libtls/man/tls_config_verify.3
+++ b/src/lib/libtls/man/tls_config_verify.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: tls_config_verify.3,v 1.4 2017/03/02 11:05:50 jmc Exp $ 1.\" $OpenBSD: tls_config_verify.3,v 1.5 2025/07/07 10:54:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> 3.\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org>
4.\" Copyright (c) 2015 Joel Sing <jsing@openbsd.org> 4.\" Copyright (c) 2015 Joel Sing <jsing@openbsd.org>
@@ -15,7 +15,7 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 17.\"
18.Dd $Mdocdate: March 2 2017 $ 18.Dd $Mdocdate: July 7 2025 $
19.Dt TLS_CONFIG_VERIFY 3 19.Dt TLS_CONFIG_VERIFY 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
@@ -25,6 +25,7 @@
25.Nm tls_config_insecure_noverifytime 25.Nm tls_config_insecure_noverifytime
26.Nd insecure TLS configuration 26.Nd insecure TLS configuration
27.Sh SYNOPSIS 27.Sh SYNOPSIS
28.Lb libtls libssl libcrypto
28.In tls.h 29.In tls.h
29.Ft void 30.Ft void
30.Fn tls_config_verify "struct tls_config *config" 31.Fn tls_config_verify "struct tls_config *config"
diff --git a/src/lib/libtls/man/tls_conn_version.3 b/src/lib/libtls/man/tls_conn_version.3
index 8fb30624d7..3a386cf11f 100644
--- a/src/lib/libtls/man/tls_conn_version.3
+++ b/src/lib/libtls/man/tls_conn_version.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: tls_conn_version.3,v 1.11 2024/12/10 08:42:12 tb Exp $ 1.\" $OpenBSD: tls_conn_version.3,v 1.12 2025/07/07 10:54:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2015 Bob Beck <beck@openbsd.org> 3.\" Copyright (c) 2015 Bob Beck <beck@openbsd.org>
4.\" Copyright (c) 2016, 2018 Joel Sing <jsing@openbsd.org> 4.\" Copyright (c) 2016, 2018 Joel Sing <jsing@openbsd.org>
@@ -15,7 +15,7 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 17.\"
18.Dd $Mdocdate: December 10 2024 $ 18.Dd $Mdocdate: July 7 2025 $
19.Dt TLS_CONN_VERSION 3 19.Dt TLS_CONN_VERSION 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
@@ -36,6 +36,7 @@
36.Nm tls_peer_cert_notafter 36.Nm tls_peer_cert_notafter
37.Nd inspect an established TLS connection 37.Nd inspect an established TLS connection
38.Sh SYNOPSIS 38.Sh SYNOPSIS
39.Lb libtls libssl libcrypto
39.In tls.h 40.In tls.h
40.Ft const char * 41.Ft const char *
41.Fn tls_conn_version "struct tls *ctx" 42.Fn tls_conn_version "struct tls *ctx"
diff --git a/src/lib/libtls/man/tls_connect.3 b/src/lib/libtls/man/tls_connect.3
index 4c4f01c256..95a18864b2 100644
--- a/src/lib/libtls/man/tls_connect.3
+++ b/src/lib/libtls/man/tls_connect.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: tls_connect.3,v 1.4 2018/07/09 19:51:18 tb Exp $ 1.\" $OpenBSD: tls_connect.3,v 1.5 2025/07/07 10:54:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> 3.\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org>
4.\" Copyright (c) 2014, 2015 Joel Sing <jsing@openbsd.org> 4.\" Copyright (c) 2014, 2015 Joel Sing <jsing@openbsd.org>
@@ -16,7 +16,7 @@
16.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18.\" 18.\"
19.Dd $Mdocdate: July 9 2018 $ 19.Dd $Mdocdate: July 7 2025 $
20.Dt TLS_CONNECT 3 20.Dt TLS_CONNECT 3
21.Os 21.Os
22.Sh NAME 22.Sh NAME
@@ -27,6 +27,7 @@
27.Nm tls_connect_cbs 27.Nm tls_connect_cbs
28.Nd instruct a TLS client to establish a connection 28.Nd instruct a TLS client to establish a connection
29.Sh SYNOPSIS 29.Sh SYNOPSIS
30.Lb libtls libssl libcrypto
30.In tls.h 31.In tls.h
31.Ft int 32.Ft int
32.Fo tls_connect 33.Fo tls_connect
diff --git a/src/lib/libtls/man/tls_init.3 b/src/lib/libtls/man/tls_init.3
index 557998107c..69879c04c7 100644
--- a/src/lib/libtls/man/tls_init.3
+++ b/src/lib/libtls/man/tls_init.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: tls_init.3,v 1.13 2018/07/09 19:47:20 tb Exp $ 1.\" $OpenBSD: tls_init.3,v 1.14 2025/07/07 10:54:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> 3.\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org>
4.\" Copyright (c) 2016 Joel Sing <jsing@openbsd.org> 4.\" Copyright (c) 2016 Joel Sing <jsing@openbsd.org>
@@ -16,7 +16,7 @@
16.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18.\" 18.\"
19.Dd $Mdocdate: July 9 2018 $ 19.Dd $Mdocdate: July 7 2025 $
20.Dt TLS_INIT 3 20.Dt TLS_INIT 3
21.Os 21.Os
22.Sh NAME 22.Sh NAME
@@ -26,6 +26,7 @@
26.Nm tls_config_error 26.Nm tls_config_error
27.Nd initialize TLS client and server API 27.Nd initialize TLS client and server API
28.Sh SYNOPSIS 28.Sh SYNOPSIS
29.Lb libtls libssl libcrypto
29.In tls.h 30.In tls.h
30.Ft int 31.Ft int
31.Fn tls_init void 32.Fn tls_init void
diff --git a/src/lib/libtls/man/tls_load_file.3 b/src/lib/libtls/man/tls_load_file.3
index cf33b575ef..33f486d530 100644
--- a/src/lib/libtls/man/tls_load_file.3
+++ b/src/lib/libtls/man/tls_load_file.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: tls_load_file.3,v 1.14 2022/01/01 02:18:28 jsg Exp $ 1.\" $OpenBSD: tls_load_file.3,v 1.15 2025/07/07 10:54:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> 3.\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org>
4.\" Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org> 4.\" Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -17,7 +17,7 @@
17.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19.\" 19.\"
20.Dd $Mdocdate: January 1 2022 $ 20.Dd $Mdocdate: July 7 2025 $
21.Dt TLS_LOAD_FILE 3 21.Dt TLS_LOAD_FILE 3
22.Os 22.Os
23.Sh NAME 23.Sh NAME
@@ -49,6 +49,7 @@
49.Nm tls_default_ca_cert_file 49.Nm tls_default_ca_cert_file
50.Nd TLS certificate and key configuration 50.Nd TLS certificate and key configuration
51.Sh SYNOPSIS 51.Sh SYNOPSIS
52.Lb libtls libssl libcrypto
52.In tls.h 53.In tls.h
53.Ft uint8_t * 54.Ft uint8_t *
54.Fo tls_load_file 55.Fo tls_load_file
diff --git a/src/lib/libtls/man/tls_ocsp_process_response.3 b/src/lib/libtls/man/tls_ocsp_process_response.3
index 6e3aa4aecc..e7b57a6827 100644
--- a/src/lib/libtls/man/tls_ocsp_process_response.3
+++ b/src/lib/libtls/man/tls_ocsp_process_response.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: tls_ocsp_process_response.3,v 1.6 2018/07/24 02:01:34 tb Exp $ 1.\" $OpenBSD: tls_ocsp_process_response.3,v 1.7 2025/07/07 10:54:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016 Bob Beck <beck@openbsd.org> 3.\" Copyright (c) 2016 Bob Beck <beck@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: July 24 2018 $ 17.Dd $Mdocdate: July 7 2025 $
18.Dt TLS_OCSP_PROCESS_RESPONSE 3 18.Dt TLS_OCSP_PROCESS_RESPONSE 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -29,6 +29,7 @@
29.Nm tls_peer_ocsp_next_update 29.Nm tls_peer_ocsp_next_update
30.Nd inspect an OCSP response 30.Nd inspect an OCSP response
31.Sh SYNOPSIS 31.Sh SYNOPSIS
32.Lb libtls libssl libcrypto
32.In tls.h 33.In tls.h
33.Ft int 34.Ft int
34.Fo tls_ocsp_process_response 35.Fo tls_ocsp_process_response
diff --git a/src/lib/libtls/man/tls_read.3 b/src/lib/libtls/man/tls_read.3
index f9d949eef5..f72e63cf63 100644
--- a/src/lib/libtls/man/tls_read.3
+++ b/src/lib/libtls/man/tls_read.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: tls_read.3,v 1.8 2023/09/18 17:25:15 schwarze Exp $ 1.\" $OpenBSD: tls_read.3,v 1.9 2025/07/07 10:54:00 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2014, 2015 Ted Unangst <tedu@openbsd.org> 3.\" Copyright (c) 2014, 2015 Ted Unangst <tedu@openbsd.org>
4.\" Copyright (c) 2015 Doug Hogan <doug@openbsd.org> 4.\" Copyright (c) 2015 Doug Hogan <doug@openbsd.org>
@@ -18,7 +18,7 @@
18.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 18.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20.\" 20.\"
21.Dd $Mdocdate: September 18 2023 $ 21.Dd $Mdocdate: July 7 2025 $
22.Dt TLS_READ 3 22.Dt TLS_READ 3
23.Os 23.Os
24.Sh NAME 24.Sh NAME
@@ -29,6 +29,7 @@
29.Nm tls_close 29.Nm tls_close
30.Nd use a TLS connection 30.Nd use a TLS connection
31.Sh SYNOPSIS 31.Sh SYNOPSIS
32.Lb libtls libssl libcrypto
32.In tls.h 33.In tls.h
33.Ft ssize_t 34.Ft ssize_t
34.Fo tls_read 35.Fo tls_read
diff --git a/src/lib/libtls/shlib_version b/src/lib/libtls/shlib_version
index 3040494c17..ed8f7473b5 100644
--- a/src/lib/libtls/shlib_version
+++ b/src/lib/libtls/shlib_version
@@ -1,2 +1,2 @@
1major=32 1major=33
2minor=1 2minor=0
diff --git a/src/lib/libtls/tls_server.c b/src/lib/libtls/tls_server.c
index a94b4221ed..42a697327a 100644
--- a/src/lib/libtls/tls_server.c
+++ b/src/lib/libtls/tls_server.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls_server.c,v 1.51 2024/03/26 08:54:48 joshua Exp $ */ 1/* $OpenBSD: tls_server.c,v 1.52 2025/06/04 10:25:30 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -75,7 +75,7 @@ tls_server_alpn_cb(SSL *ssl, const unsigned char **out, unsigned char *outlen,
75 OPENSSL_NPN_NEGOTIATED) 75 OPENSSL_NPN_NEGOTIATED)
76 return (SSL_TLSEXT_ERR_OK); 76 return (SSL_TLSEXT_ERR_OK);
77 77
78 return (SSL_TLSEXT_ERR_NOACK); 78 return (SSL_TLSEXT_ERR_ALERT_FATAL);
79} 79}
80 80
81static int 81static int
diff --git a/src/regress/lib/libc/Makefile b/src/regress/lib/libc/Makefile
index 3cd970e49d..7a8db225ef 100644
--- a/src/regress/lib/libc/Makefile
+++ b/src/regress/lib/libc/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.59 2024/07/14 09:48:48 jca Exp $ 1# $OpenBSD: Makefile,v 1.62 2025/08/04 06:10:40 tb Exp $
2 2
3SUBDIR+= _setjmp 3SUBDIR+= _setjmp
4SUBDIR+= alloca arc4random-fork atexit 4SUBDIR+= alloca arc4random-fork atexit
@@ -9,8 +9,9 @@ SUBDIR+= elf_aux_info
9SUBDIR+= env explicit_bzero 9SUBDIR+= env explicit_bzero
10SUBDIR+= ffs fmemopen fnmatch fpclassify fread 10SUBDIR+= ffs fmemopen fnmatch fpclassify fread
11SUBDIR+= gcvt getaddrinfo getcap getopt getopt_long glob 11SUBDIR+= gcvt getaddrinfo getcap getopt getopt_long glob
12SUBDIR+= hash
12SUBDIR+= hsearch 13SUBDIR+= hsearch
13SUBDIR+= ieeefp ifnameindex 14SUBDIR+= ieeefp ifnameindex illumos
14SUBDIR+= ldexp locale longjmp 15SUBDIR+= ldexp locale longjmp
15SUBDIR+= malloc mkstemp modf 16SUBDIR+= malloc mkstemp modf
16SUBDIR+= netdb 17SUBDIR+= netdb
@@ -18,9 +19,9 @@ SUBDIR+= open_memstream orientation
18SUBDIR+= popen printf 19SUBDIR+= popen printf
19SUBDIR+= qsort 20SUBDIR+= qsort
20SUBDIR+= regex 21SUBDIR+= regex
21SUBDIR+= setjmp setjmp-signal sigsetjmp sigthr sleep sprintf stdio_threading 22SUBDIR+= setjmp setjmp-signal sigsetjmp sigthr sleep sprintf stdio
22SUBDIR+= stpncpy strchr strerror strlcat strlcpy strnlen strtod strtol strtonum 23SUBDIR+= stdio_threading stpncpy strchr strerror strlcat strlcpy strnlen
23SUBDIR+= sys 24SUBDIR+= strtod strtol strtonum sys
24SUBDIR+= telldir time timingsafe 25SUBDIR+= telldir time timingsafe
25SUBDIR+= uuid 26SUBDIR+= uuid
26SUBDIR+= vis 27SUBDIR+= vis
diff --git a/src/regress/lib/libc/arc4random-fork/arc4random-fork.c b/src/regress/lib/libc/arc4random-fork/arc4random-fork.c
index 4bc9c634f1..9b334945af 100644
--- a/src/regress/lib/libc/arc4random-fork/arc4random-fork.c
+++ b/src/regress/lib/libc/arc4random-fork/arc4random-fork.c
@@ -111,7 +111,7 @@ main(int argc, char *argv[])
111 } 111 }
112 112
113 if (flagprefork) 113 if (flagprefork)
114 arc4random(); 114 (void)arc4random();
115 115
116 bufparent = mmap(NULL, sizeof(Buf), PROT_READ|PROT_WRITE, 116 bufparent = mmap(NULL, sizeof(Buf), PROT_READ|PROT_WRITE,
117 MAP_ANON|MAP_PRIVATE, -1, 0); 117 MAP_ANON|MAP_PRIVATE, -1, 0);
diff --git a/src/regress/lib/libc/explicit_bzero/explicit_bzero.c b/src/regress/lib/libc/explicit_bzero/explicit_bzero.c
index 496bafb208..30c86290e8 100644
--- a/src/regress/lib/libc/explicit_bzero/explicit_bzero.c
+++ b/src/regress/lib/libc/explicit_bzero/explicit_bzero.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: explicit_bzero.c,v 1.9 2022/02/10 08:39:32 tb Exp $ */ 1/* $OpenBSD: explicit_bzero.c,v 1.10 2025/05/31 15:31:40 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Google Inc. 3 * Copyright (c) 2014 Google Inc.
4 * 4 *
@@ -28,9 +28,11 @@
28 28
29#if defined(__has_feature) 29#if defined(__has_feature)
30#if __has_feature(address_sanitizer) 30#if __has_feature(address_sanitizer)
31#ifndef __SANITIZE_ADDRESS__
31#define __SANITIZE_ADDRESS__ 32#define __SANITIZE_ADDRESS__
32#endif 33#endif
33#endif 34#endif
35#endif
34#ifdef __SANITIZE_ADDRESS__ 36#ifdef __SANITIZE_ADDRESS__
35#define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address)) 37#define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
36#else 38#else
diff --git a/src/regress/lib/libc/hash/Makefile b/src/regress/lib/libc/hash/Makefile
new file mode 100644
index 0000000000..9bd69bf8df
--- /dev/null
+++ b/src/regress/lib/libc/hash/Makefile
@@ -0,0 +1,5 @@
1# $OpenBSD: Makefile,v 1.2 2025/04/14 18:33:56 tb Exp $
2
3PROG = hash_test
4
5.include <bsd.regress.mk>
diff --git a/src/regress/lib/libc/hash/hash_test.c b/src/regress/lib/libc/hash/hash_test.c
new file mode 100644
index 0000000000..c04a0458fe
--- /dev/null
+++ b/src/regress/lib/libc/hash/hash_test.c
@@ -0,0 +1,935 @@
1/* $OpenBSD: hash_test.c,v 1.3 2025/08/02 06:05:13 tb Exp $ */
2
3/*
4 * Copyright (c) 2025 Theo Buehler <tb@openbsd.org>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#include <sys/types.h>
20
21#include <md5.h>
22#include <rmd160.h>
23#include <sha1.h>
24#include <sha2.h>
25#include <stdio.h>
26#include <string.h>
27
28#define MAX_DIGEST_LENGTH SHA512_DIGEST_LENGTH
29
30struct hash_test_case {
31 const char *in;
32 const uint8_t out[MAX_DIGEST_LENGTH];
33};
34
35enum {
36 hash_md5,
37 hash_rmd160,
38 hash_sha1,
39 hash_sha224,
40 hash_sha256,
41 hash_sha384,
42 hash_sha512,
43 hash_sha512_256,
44 NUM_HASHES,
45};
46
47/* RFC 1321, Appendix A.5 */
48static const struct hash_test_case md5_tests[] = {
49 {
50 .out = {
51 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04,
52 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e,
53 },
54 },
55 {
56 .in = "",
57 .out = {
58 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04,
59 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e,
60 },
61 },
62 {
63 .in = "a",
64 .out = {
65 0x0c, 0xc1, 0x75, 0xb9, 0xc0, 0xf1, 0xb6, 0xa8,
66 0x31, 0xc3, 0x99, 0xe2, 0x69, 0x77, 0x26, 0x61,
67 },
68 },
69 {
70 .in = "abc",
71 .out = {
72 0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0,
73 0xd6, 0x96, 0x3f, 0x7d, 0x28, 0xe1, 0x7f, 0x72,
74 },
75 },
76 {
77 .in = "message digest",
78 .out = {
79 0xf9, 0x6b, 0x69, 0x7d, 0x7c, 0xb7, 0x93, 0x8d,
80 0x52, 0x5a, 0x2f, 0x31, 0xaa, 0xf1, 0x61, 0xd0,
81 },
82 },
83 {
84 .in = "abcdefghijklmnopqrstuvwxyz",
85 .out = {
86 0xc3, 0xfc, 0xd3, 0xd7, 0x61, 0x92, 0xe4, 0x00,
87 0x7d, 0xfb, 0x49, 0x6c, 0xca, 0x67, 0xe1, 0x3b,
88 },
89 },
90 {
91 .in = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
92 "abcdefghijklmnopqrstuvwxyz0123456789",
93 .out = {
94 0xd1, 0x74, 0xab, 0x98, 0xd2, 0x77, 0xd9, 0xf5,
95 0xa5, 0x61, 0x1c, 0x2c, 0x9f, 0x41, 0x9d, 0x9f,
96 },
97 },
98 {
99 .in = "1234567890123456789012345678901234567890"
100 "1234567890123456789012345678901234567890",
101 .out = {
102 0x57, 0xed, 0xf4, 0xa2, 0x2b, 0xe3, 0xc9, 0x55,
103 0xac, 0x49, 0xda, 0x2e, 0x21, 0x07, 0xb6, 0x7a,
104 },
105 },
106};
107
108#define N_MD5_TESTS (sizeof(md5_tests) / sizeof(md5_tests[0]))
109
110static void
111md5_init(void *ctx)
112{
113 MD5Init(ctx);
114}
115
116static void
117md5_update(void *ctx, const uint8_t *data, size_t len)
118{
119 MD5Update(ctx, data, len);
120}
121
122static void
123md5_final(void *digest, void *ctx)
124{
125 MD5Final(digest, ctx);
126}
127
128/* https://homes.esat.kuleuven.be/~bosselae/ripemd160.html */
129static const struct hash_test_case rmd160_tests[] = {
130 {
131 .out = {
132 0x9c, 0x11, 0x85, 0xa5, 0xc5, 0xe9, 0xfc, 0x54,
133 0x61, 0x28, 0x08, 0x97, 0x7e, 0xe8, 0xf5, 0x48,
134 0xb2, 0x25, 0x8d, 0x31,
135 },
136 },
137 {
138 .in = "",
139 .out = {
140 0x9c, 0x11, 0x85, 0xa5, 0xc5, 0xe9, 0xfc, 0x54,
141 0x61, 0x28, 0x08, 0x97, 0x7e, 0xe8, 0xf5, 0x48,
142 0xb2, 0x25, 0x8d, 0x31,
143 },
144 },
145 {
146 .in = "a",
147 .out = {
148 0x0b, 0xdc, 0x9d, 0x2d, 0x25, 0x6b, 0x3e, 0xe9,
149 0xda, 0xae, 0x34, 0x7b, 0xe6, 0xf4, 0xdc, 0x83,
150 0x5a, 0x46, 0x7f, 0xfe,
151 },
152 },
153 {
154 .in = "abc",
155 .out = {
156 0x8e, 0xb2, 0x08, 0xf7, 0xe0, 0x5d, 0x98, 0x7a,
157 0x9b, 0x04, 0x4a, 0x8e, 0x98, 0xc6, 0xb0, 0x87,
158 0xf1, 0x5a, 0x0b, 0xfc,
159 },
160 },
161 {
162 .in = "message digest",
163 .out = {
164 0x5d, 0x06, 0x89, 0xef, 0x49, 0xd2, 0xfa, 0xe5,
165 0x72, 0xb8, 0x81, 0xb1, 0x23, 0xa8, 0x5f, 0xfa,
166 0x21, 0x59, 0x5f, 0x36,
167 },
168 },
169 {
170 .in = "abcdefghijklmnopqrstuvwxyz",
171 .out = {
172 0xf7, 0x1c, 0x27, 0x10, 0x9c, 0x69, 0x2c, 0x1b,
173 0x56, 0xbb, 0xdc, 0xeb, 0x5b, 0x9d, 0x28, 0x65,
174 0xb3, 0x70, 0x8d, 0xbc,
175 },
176 },
177 {
178 .in = "abcdbcdecdefdefgefghfghighijhijkijkljkl"
179 "mklmnlmnomnopnopq",
180 .out = {
181 0x12, 0xa0, 0x53, 0x38, 0x4a, 0x9c, 0x0c, 0x88,
182 0xe4, 0x05, 0xa0, 0x6c, 0x27, 0xdc, 0xf4, 0x9a,
183 0xda, 0x62, 0xeb, 0x2b,
184 },
185 },
186 {
187 .in = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
188 "0123456789",
189 .out = {
190 0xb0, 0xe2, 0x0b, 0x6e, 0x31, 0x16, 0x64, 0x02,
191 0x86, 0xed, 0x3a, 0x87, 0xa5, 0x71, 0x30, 0x79,
192 0xb2, 0x1f, 0x51, 0x89,
193 },
194 },
195 {
196 .in = "1234567890123456789012345678901234567890"
197 "1234567890123456789012345678901234567890",
198 .out = {
199 0x9b, 0x75, 0x2e, 0x45, 0x57, 0x3d, 0x4b, 0x39,
200 0xf4, 0xdb, 0xd3, 0x32, 0x3c, 0xab, 0x82, 0xbf,
201 0x63, 0x32, 0x6b, 0xfb,
202 },
203 },
204};
205
206#define N_RMD160_TESTS (sizeof(rmd160_tests) / sizeof(rmd160_tests[0]))
207
208static void
209rmd160_init(void *ctx)
210{
211 RMD160Init(ctx);
212}
213
214static void
215rmd160_update(void *ctx, const uint8_t *data, size_t len)
216{
217 RMD160Update(ctx, data, len);
218}
219
220static void
221rmd160_final(void *digest, void *ctx)
222{
223 RMD160Final(digest, ctx);
224}
225
226/* RFC 3174 - Appendix A (plus two zero-length tests) */
227static const struct hash_test_case sha1_tests[] = {
228 {
229 .out = {
230 0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b, 0x0d,
231 0x32, 0x55, 0xbf, 0xef, 0x95, 0x60, 0x18, 0x90,
232 0xaf, 0xd8, 0x07, 0x09,
233 },
234 },
235 {
236 .in = "",
237 .out = {
238 0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b, 0x0d,
239 0x32, 0x55, 0xbf, 0xef, 0x95, 0x60, 0x18, 0x90,
240 0xaf, 0xd8, 0x07, 0x09,
241 },
242 },
243 {
244 .in = "abc",
245 .out = {
246 0xa9, 0x99, 0x3e, 0x36, 0x47, 0x06, 0x81, 0x6a,
247 0xba, 0x3e, 0x25, 0x71, 0x78, 0x50, 0xc2, 0x6c,
248 0x9c, 0xd0, 0xd8, 0x9d,
249 },
250 },
251 {
252 .in = "abcdbcdecdefdefgefghfghighijhi"
253 "jkijkljklmklmnlmnomnopnopq",
254 .out = {
255 0x84, 0x98, 0x3e, 0x44, 0x1c, 0x3b, 0xd2, 0x6e,
256 0xba, 0xae, 0x4a, 0xa1, 0xf9, 0x51, 0x29, 0xe5,
257 0xe5, 0x46, 0x70, 0xf1,
258 },
259 },
260 {
261 .in = "0123456701234567012345670123456701234567012345670123456701234567"
262 "0123456701234567012345670123456701234567012345670123456701234567"
263 "0123456701234567012345670123456701234567012345670123456701234567"
264 "0123456701234567012345670123456701234567012345670123456701234567"
265 "0123456701234567012345670123456701234567012345670123456701234567"
266 "0123456701234567012345670123456701234567012345670123456701234567"
267 "0123456701234567012345670123456701234567012345670123456701234567"
268 "0123456701234567012345670123456701234567012345670123456701234567"
269 "0123456701234567012345670123456701234567012345670123456701234567"
270 "0123456701234567012345670123456701234567012345670123456701234567",
271 .out = {
272 0xde, 0xa3, 0x56, 0xa2, 0xcd, 0xdd, 0x90, 0xc7,
273 0xa7, 0xec, 0xed, 0xc5, 0xeb, 0xb5, 0x63, 0x93,
274 0x4f, 0x46, 0x04, 0x52,
275 },
276 },
277};
278
279#define N_SHA1_TESTS (sizeof(sha1_tests) / sizeof(sha1_tests[0]))
280
281static void
282sha1_init(void *ctx)
283{
284 SHA1Init(ctx);
285}
286
287static void
288sha1_update(void *ctx, const uint8_t *data, size_t len)
289{
290 SHA1Update(ctx, data, len);
291}
292
293static void
294sha1_final(void *digest, void *ctx)
295{
296 SHA1Final(digest, ctx);
297}
298
299static const struct hash_test_case sha224_tests[] = {
300 {
301 .out = {
302 0xd1, 0x4a, 0x02, 0x8c, 0x2a, 0x3a, 0x2b, 0xc9,
303 0x47, 0x61, 0x02, 0xbb, 0x28, 0x82, 0x34, 0xc4,
304 0x15, 0xa2, 0xb0, 0x1f, 0x82, 0x8e, 0xa6, 0x2a,
305 0xc5, 0xb3, 0xe4, 0x2f,
306 },
307 },
308 {
309 .in = "",
310 .out = {
311 0xd1, 0x4a, 0x02, 0x8c, 0x2a, 0x3a, 0x2b, 0xc9,
312 0x47, 0x61, 0x02, 0xbb, 0x28, 0x82, 0x34, 0xc4,
313 0x15, 0xa2, 0xb0, 0x1f, 0x82, 0x8e, 0xa6, 0x2a,
314 0xc5, 0xb3, 0xe4, 0x2f,
315 },
316 },
317 {
318 .in = "abc",
319 .out = {
320 0x23, 0x09, 0x7d, 0x22, 0x34, 0x05, 0xd8, 0x22,
321 0x86, 0x42, 0xa4, 0x77, 0xbd, 0xa2, 0x55, 0xb3,
322 0x2a, 0xad, 0xbc, 0xe4, 0xbd, 0xa0, 0xb3, 0xf7,
323 0xe3, 0x6c, 0x9d, 0xa7,
324 },
325 },
326 {
327 .in = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
328 .out = {
329 0x75, 0x38, 0x8b, 0x16, 0x51, 0x27, 0x76, 0xcc,
330 0x5d, 0xba, 0x5d, 0xa1, 0xfd, 0x89, 0x01, 0x50,
331 0xb0, 0xc6, 0x45, 0x5c, 0xb4, 0xf5, 0x8b, 0x19,
332 0x52, 0x52, 0x25, 0x25,
333 },
334 },
335 {
336 .in = "0123456701234567012345670123456701234567012345670123456701234567"
337 "0123456701234567012345670123456701234567012345670123456701234567"
338 "0123456701234567012345670123456701234567012345670123456701234567"
339 "0123456701234567012345670123456701234567012345670123456701234567"
340 "0123456701234567012345670123456701234567012345670123456701234567"
341 "0123456701234567012345670123456701234567012345670123456701234567"
342 "0123456701234567012345670123456701234567012345670123456701234567"
343 "0123456701234567012345670123456701234567012345670123456701234567"
344 "0123456701234567012345670123456701234567012345670123456701234567"
345 "0123456701234567012345670123456701234567012345670123456701234567",
346 .out = {
347 0x56, 0x7f, 0x69, 0xf1, 0x68, 0xcd, 0x78, 0x44,
348 0xe6, 0x52, 0x59, 0xce, 0x65, 0x8f, 0xe7, 0xaa,
349 0xdf, 0xa2, 0x52, 0x16, 0xe6, 0x8e, 0xca, 0x0e,
350 0xb7, 0xab, 0x82, 0x62,
351 },
352 },
353 {
354 .in = "\x07",
355 .out = {
356 0x00, 0xec, 0xd5, 0xf1, 0x38, 0x42, 0x2b, 0x8a,
357 0xd7, 0x4c, 0x97, 0x99, 0xfd, 0x82, 0x6c, 0x53,
358 0x1b, 0xad, 0x2f, 0xca, 0xbc, 0x74, 0x50, 0xbe,
359 0xe2, 0xaa, 0x8c, 0x2a,
360 },
361 },
362};
363
364#define N_SHA224_TESTS (sizeof(sha224_tests) / sizeof(sha224_tests[0]))
365
366static void
367sha224_init(void *ctx)
368{
369 SHA224Init(ctx);
370}
371
372static void
373sha224_update(void *ctx, const uint8_t *data, size_t len)
374{
375 SHA224Update(ctx, data, len);
376}
377
378static void
379sha224_final(void *digest, void *ctx)
380{
381 SHA224Final(digest, ctx);
382}
383
384static const struct hash_test_case sha256_tests[] = {
385 {
386 .out = {
387 0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14,
388 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24,
389 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c,
390 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55,
391 },
392 },
393 {
394 .in = "",
395 .out = {
396 0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14,
397 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24,
398 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c,
399 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55,
400 },
401 },
402 {
403 .in = "abc",
404 .out = {
405 0xBA, 0x78, 0x16, 0xBF, 0x8F, 0x01, 0xCF, 0xEA,
406 0x41, 0x41, 0x40, 0xDE, 0x5D, 0xAE, 0x22, 0x23,
407 0xB0, 0x03, 0x61, 0xA3, 0x96, 0x17, 0x7A, 0x9C,
408 0xB4, 0x10, 0xFF, 0x61, 0xF2, 0x00, 0x15, 0xAD,
409 },
410 },
411 {
412 .in = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
413 .out = {
414 0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8,
415 0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39,
416 0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67,
417 0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1,
418 },
419 },
420 {
421 .in = "0123456701234567012345670123456701234567012345670123456701234567"
422 "0123456701234567012345670123456701234567012345670123456701234567"
423 "0123456701234567012345670123456701234567012345670123456701234567"
424 "0123456701234567012345670123456701234567012345670123456701234567"
425 "0123456701234567012345670123456701234567012345670123456701234567"
426 "0123456701234567012345670123456701234567012345670123456701234567"
427 "0123456701234567012345670123456701234567012345670123456701234567"
428 "0123456701234567012345670123456701234567012345670123456701234567"
429 "0123456701234567012345670123456701234567012345670123456701234567"
430 "0123456701234567012345670123456701234567012345670123456701234567",
431 .out = {
432 0x59, 0x48, 0x47, 0x32, 0x84, 0x51, 0xBD, 0xFA,
433 0x85, 0x05, 0x62, 0x25, 0x46, 0x2C, 0xC1, 0xD8,
434 0x67, 0xD8, 0x77, 0xFB, 0x38, 0x8D, 0xF0, 0xCE,
435 0x35, 0xF2, 0x5A, 0xB5, 0x56, 0x2B, 0xFB, 0xB5,
436 },
437 },
438 {
439 .in = "\x19",
440 .out = {
441 0x68, 0xaa, 0x2e, 0x2e, 0xe5, 0xdf, 0xf9, 0x6e,
442 0x33, 0x55, 0xe6, 0xc7, 0xee, 0x37, 0x3e, 0x3d,
443 0x6a, 0x4e, 0x17, 0xf7, 0x5f, 0x95, 0x18, 0xd8,
444 0x43, 0x70, 0x9c, 0x0c, 0x9b, 0xc3, 0xe3, 0xd4,
445 },
446 },
447};
448
449#define N_SHA256_TESTS (sizeof(sha256_tests) / sizeof(sha256_tests[0]))
450
451static void
452sha256_init(void *ctx)
453{
454 SHA256Init(ctx);
455}
456
457static void
458sha256_update(void *ctx, const uint8_t *data, size_t len)
459{
460 SHA256Update(ctx, data, len);
461}
462
463static void
464sha256_final(void *digest, void *ctx)
465{
466 SHA256Final(digest, ctx);
467}
468
469static const struct hash_test_case sha384_tests[] = {
470 {
471 .out = {
472 0x38, 0xb0, 0x60, 0xa7, 0x51, 0xac, 0x96, 0x38,
473 0x4c, 0xd9, 0x32, 0x7e, 0xb1, 0xb1, 0xe3, 0x6a,
474 0x21, 0xfd, 0xb7, 0x11, 0x14, 0xbe, 0x07, 0x43,
475 0x4c, 0x0c, 0xc7, 0xbf, 0x63, 0xf6, 0xe1, 0xda,
476 0x27, 0x4e, 0xde, 0xbf, 0xe7, 0x6f, 0x65, 0xfb,
477 0xd5, 0x1a, 0xd2, 0xf1, 0x48, 0x98, 0xb9, 0x5b,
478 },
479 },
480 {
481 .in = "",
482 .out = {
483 0x38, 0xb0, 0x60, 0xa7, 0x51, 0xac, 0x96, 0x38,
484 0x4c, 0xd9, 0x32, 0x7e, 0xb1, 0xb1, 0xe3, 0x6a,
485 0x21, 0xfd, 0xb7, 0x11, 0x14, 0xbe, 0x07, 0x43,
486 0x4c, 0x0c, 0xc7, 0xbf, 0x63, 0xf6, 0xe1, 0xda,
487 0x27, 0x4e, 0xde, 0xbf, 0xe7, 0x6f, 0x65, 0xfb,
488 0xd5, 0x1a, 0xd2, 0xf1, 0x48, 0x98, 0xb9, 0x5b,
489 },
490 },
491 {
492 .in = "abc",
493 .out = {
494 0xcb, 0x00, 0x75, 0x3f, 0x45, 0xa3, 0x5e, 0x8b,
495 0xb5, 0xa0, 0x3d, 0x69, 0x9a, 0xc6, 0x50, 0x07,
496 0x27, 0x2c, 0x32, 0xab, 0x0e, 0xde, 0xd1, 0x63,
497 0x1A, 0x8B, 0x60, 0x5A, 0x43, 0xFF, 0x5B, 0xED,
498 0x80, 0x86, 0x07, 0x2B, 0xA1, 0xE7, 0xCC, 0x23,
499 0x58, 0xBA, 0xEC, 0xA1, 0x34, 0xC8, 0x25, 0xA7,
500 },
501 },
502 {
503 .in = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
504 "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
505 .out = {
506 0x09, 0x33, 0x0c, 0x33, 0xf7, 0x11, 0x47, 0xe8,
507 0x3d, 0x19, 0x2f, 0xc7, 0x82, 0xcd, 0x1b, 0x47,
508 0x53, 0x11, 0x1b, 0x17, 0x3b, 0x3b, 0x05, 0xd2,
509 0x2f, 0xa0, 0x80, 0x86, 0xe3, 0xb0, 0xf7, 0x12,
510 0xfc, 0xc7, 0xc7, 0x1a, 0x55, 0x7e, 0x2d, 0xb9,
511 0x66, 0xc3, 0xe9, 0xfa, 0x91, 0x74, 0x60, 0x39,
512 },
513 },
514 {
515 .in = "0123456701234567012345670123456701234567012345670123456701234567"
516 "0123456701234567012345670123456701234567012345670123456701234567"
517 "0123456701234567012345670123456701234567012345670123456701234567"
518 "0123456701234567012345670123456701234567012345670123456701234567"
519 "0123456701234567012345670123456701234567012345670123456701234567"
520 "0123456701234567012345670123456701234567012345670123456701234567"
521 "0123456701234567012345670123456701234567012345670123456701234567"
522 "0123456701234567012345670123456701234567012345670123456701234567"
523 "0123456701234567012345670123456701234567012345670123456701234567"
524 "0123456701234567012345670123456701234567012345670123456701234567",
525 .out = {
526 0x2f, 0xc6, 0x4a, 0x4f, 0x50, 0x0d, 0xdb, 0x68,
527 0x28, 0xf6, 0xa3, 0x43, 0x0b, 0x8d, 0xd7, 0x2a,
528 0x36, 0x8e, 0xb7, 0xf3, 0xa8, 0x32, 0x2a, 0x70,
529 0xbc, 0x84, 0x27, 0x5b, 0x9c, 0x0b, 0x3a, 0xb0,
530 0x0d, 0x27, 0xa5, 0xcc, 0x3c, 0x2d, 0x22, 0x4a,
531 0xa6, 0xb6, 0x1a, 0x0d, 0x79, 0xfb, 0x45, 0x96,
532 },
533 },
534 {
535 .in = "\xb9",
536 .out = {
537 0xbc, 0x80, 0x89, 0xa1, 0x90, 0x07, 0xc0, 0xb1,
538 0x41, 0x95, 0xf4, 0xec, 0xc7, 0x40, 0x94, 0xfe,
539 0xc6, 0x4f, 0x01, 0xf9, 0x09, 0x29, 0x28, 0x2c,
540 0x2f, 0xb3, 0x92, 0x88, 0x15, 0x78, 0x20, 0x8a,
541 0xd4, 0x66, 0x82, 0x8b, 0x1c, 0x6c, 0x28, 0x3d,
542 0x27, 0x22, 0xcf, 0x0a, 0xd1, 0xab, 0x69, 0x38,
543 },
544 },
545};
546
547#define N_SHA384_TESTS (sizeof(sha384_tests) / sizeof(sha384_tests[0]))
548
549static void
550sha384_init(void *ctx)
551{
552 SHA384Init(ctx);
553}
554
555static void
556sha384_update(void *ctx, const uint8_t *data, size_t len)
557{
558 SHA384Update(ctx, data, len);
559}
560
561static void
562sha384_final(void *digest, void *ctx)
563{
564 SHA384Final(digest, ctx);
565}
566
567static const struct hash_test_case sha512_tests[] = {
568 {
569 .out = {
570 0xcf, 0x83, 0xe1, 0x35, 0x7e, 0xef, 0xb8, 0xbd,
571 0xf1, 0x54, 0x28, 0x50, 0xd6, 0x6d, 0x80, 0x07,
572 0xd6, 0x20, 0xe4, 0x05, 0x0b, 0x57, 0x15, 0xdc,
573 0x83, 0xf4, 0xa9, 0x21, 0xd3, 0x6c, 0xe9, 0xce,
574 0x47, 0xd0, 0xd1, 0x3c, 0x5d, 0x85, 0xf2, 0xb0,
575 0xff, 0x83, 0x18, 0xd2, 0x87, 0x7e, 0xec, 0x2f,
576 0x63, 0xb9, 0x31, 0xbd, 0x47, 0x41, 0x7a, 0x81,
577 0xa5, 0x38, 0x32, 0x7a, 0xf9, 0x27, 0xda, 0x3e,
578 },
579 },
580 {
581 .in = "",
582 .out = {
583 0xcf, 0x83, 0xe1, 0x35, 0x7e, 0xef, 0xb8, 0xbd,
584 0xf1, 0x54, 0x28, 0x50, 0xd6, 0x6d, 0x80, 0x07,
585 0xd6, 0x20, 0xe4, 0x05, 0x0b, 0x57, 0x15, 0xdc,
586 0x83, 0xf4, 0xa9, 0x21, 0xd3, 0x6c, 0xe9, 0xce,
587 0x47, 0xd0, 0xd1, 0x3c, 0x5d, 0x85, 0xf2, 0xb0,
588 0xff, 0x83, 0x18, 0xd2, 0x87, 0x7e, 0xec, 0x2f,
589 0x63, 0xb9, 0x31, 0xbd, 0x47, 0x41, 0x7a, 0x81,
590 0xa5, 0x38, 0x32, 0x7a, 0xf9, 0x27, 0xda, 0x3e,
591 },
592 },
593 {
594 .in = "abc",
595 .out = {
596 0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba,
597 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31,
598 0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2,
599 0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a,
600 0x21, 0x92, 0x99, 0x2a, 0x27, 0x4f, 0xc1, 0xa8,
601 0x36, 0xba, 0x3c, 0x23, 0xa3, 0xfe, 0xeb, 0xbd,
602 0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e,
603 0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f,
604 },
605 },
606 {
607 .in = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
608 "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
609 .out = {
610 0x8e, 0x95, 0x9b, 0x75, 0xda, 0xe3, 0x13, 0xda,
611 0x8c, 0xf4, 0xf7, 0x28, 0x14, 0xfc, 0x14, 0x3f,
612 0x8f, 0x77, 0x79, 0xc6, 0xeb, 0x9f, 0x7f, 0xa1,
613 0x72, 0x99, 0xae, 0xad, 0xb6, 0x88, 0x90, 0x18,
614 0x50, 0x1d, 0x28, 0x9e, 0x49, 0x00, 0xf7, 0xe4,
615 0x33, 0x1b, 0x99, 0xde, 0xc4, 0xb5, 0x43, 0x3a,
616 0xc7, 0xd3, 0x29, 0xee, 0xb6, 0xdd, 0x26, 0x54,
617 0x5e, 0x96, 0xe5, 0x5b, 0x87, 0x4b, 0xe9, 0x09,
618 },
619 },
620 {
621 .in = "0123456701234567012345670123456701234567012345670123456701234567"
622 "0123456701234567012345670123456701234567012345670123456701234567"
623 "0123456701234567012345670123456701234567012345670123456701234567"
624 "0123456701234567012345670123456701234567012345670123456701234567"
625 "0123456701234567012345670123456701234567012345670123456701234567"
626 "0123456701234567012345670123456701234567012345670123456701234567"
627 "0123456701234567012345670123456701234567012345670123456701234567"
628 "0123456701234567012345670123456701234567012345670123456701234567"
629 "0123456701234567012345670123456701234567012345670123456701234567"
630 "0123456701234567012345670123456701234567012345670123456701234567",
631 .out = {
632 0x89, 0xd0, 0x5b, 0xa6, 0x32, 0xc6, 0x99, 0xc3,
633 0x12, 0x31, 0xde, 0xd4, 0xff, 0xc1, 0x27, 0xd5,
634 0xa8, 0x94, 0xda, 0xd4, 0x12, 0xc0, 0xe0, 0x24,
635 0xdb, 0x87, 0x2d, 0x1a, 0xbd, 0x2b, 0xa8, 0x14,
636 0x1a, 0x0f, 0x85, 0x07, 0x2a, 0x9b, 0xe1, 0xe2,
637 0xaa, 0x04, 0xcf, 0x33, 0xc7, 0x65, 0xcb, 0x51,
638 0x08, 0x13, 0xa3, 0x9c, 0xd5, 0xa8, 0x4c, 0x4a,
639 0xca, 0xa6, 0x4d, 0x3f, 0x3f, 0xb7, 0xba, 0xe9,
640 },
641 },
642 {
643 .in = "\xd0",
644 .out = {
645 0x99, 0x92, 0x20, 0x29, 0x38, 0xe8, 0x82, 0xe7,
646 0x3e, 0x20, 0xf6, 0xb6, 0x9e, 0x68, 0xa0, 0xa7,
647 0x14, 0x90, 0x90, 0x42, 0x3d, 0x93, 0xc8, 0x1b,
648 0xab, 0x3f, 0x21, 0x67, 0x8d, 0x4a, 0xce, 0xee,
649 0xe5, 0x0e, 0x4e, 0x8c, 0xaf, 0xad, 0xa4, 0xc8,
650 0x5a, 0x54, 0xea, 0x83, 0x06, 0x82, 0x6c, 0x4a,
651 0xd6, 0xe7, 0x4c, 0xec, 0xe9, 0x63, 0x1b, 0xfa,
652 0x8a, 0x54, 0x9b, 0x4a, 0xb3, 0xfb, 0xba, 0x15,
653 },
654 },
655};
656
657#define N_SHA512_TESTS (sizeof(sha512_tests) / sizeof(sha512_tests[0]))
658
659static void
660sha512_init(void *ctx)
661{
662 SHA512Init(ctx);
663}
664
665static void
666sha512_update(void *ctx, const uint8_t *data, size_t len)
667{
668 SHA512Update(ctx, data, len);
669}
670
671static void
672sha512_final(void *digest, void *ctx)
673{
674 SHA512Final(digest, ctx);
675}
676
677static const struct hash_test_case sha512_256_tests[] = {
678 {
679 .out = {
680 0xc6, 0x72, 0xb8, 0xd1, 0xef, 0x56, 0xed, 0x28,
681 0xab, 0x87, 0xc3, 0x62, 0x2c, 0x51, 0x14, 0x06,
682 0x9b, 0xdd, 0x3a, 0xd7, 0xb8, 0xf9, 0x73, 0x74,
683 0x98, 0xd0, 0xc0, 0x1e, 0xce, 0xf0, 0x96, 0x7a,
684 },
685 },
686 {
687 .in = "",
688 .out = {
689 0xc6, 0x72, 0xb8, 0xd1, 0xef, 0x56, 0xed, 0x28,
690 0xab, 0x87, 0xc3, 0x62, 0x2c, 0x51, 0x14, 0x06,
691 0x9b, 0xdd, 0x3a, 0xd7, 0xb8, 0xf9, 0x73, 0x74,
692 0x98, 0xd0, 0xc0, 0x1e, 0xce, 0xf0, 0x96, 0x7a,
693 },
694 },
695 {
696 .in = "abc",
697 .out = {
698 0x53, 0x04, 0x8e, 0x26, 0x81, 0x94, 0x1e, 0xf9,
699 0x9b, 0x2e, 0x29, 0xb7, 0x6b, 0x4c, 0x7d, 0xab,
700 0xe4, 0xc2, 0xd0, 0xc6, 0x34, 0xfc, 0x6d, 0x46,
701 0xe0, 0xe2, 0xf1, 0x31, 0x07, 0xe7, 0xaf, 0x23,
702 },
703 },
704 {
705 .in = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
706 "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
707 .out = {
708 0x39, 0x28, 0xe1, 0x84, 0xfb, 0x86, 0x90, 0xf8,
709 0x40, 0xda, 0x39, 0x88, 0x12, 0x1d, 0x31, 0xbe,
710 0x65, 0xcb, 0x9d, 0x3e, 0xf8, 0x3e, 0xe6, 0x14,
711 0x6f, 0xea, 0xc8, 0x61, 0xe1, 0x9b, 0x56, 0x3a,
712 },
713 },
714 {
715 .in = "0123456701234567012345670123456701234567012345670123456701234567"
716 "0123456701234567012345670123456701234567012345670123456701234567"
717 "0123456701234567012345670123456701234567012345670123456701234567"
718 "0123456701234567012345670123456701234567012345670123456701234567"
719 "0123456701234567012345670123456701234567012345670123456701234567"
720 "0123456701234567012345670123456701234567012345670123456701234567"
721 "0123456701234567012345670123456701234567012345670123456701234567"
722 "0123456701234567012345670123456701234567012345670123456701234567"
723 "0123456701234567012345670123456701234567012345670123456701234567"
724 "0123456701234567012345670123456701234567012345670123456701234567",
725 .out = {
726 0xcf, 0x78, 0xe4, 0xba, 0x93, 0x5b, 0x4d, 0x9e,
727 0xb9, 0x10, 0x52, 0xae, 0xdd, 0xf8, 0xe2, 0xd6,
728 0x06, 0xc5, 0x90, 0xf7, 0x08, 0x57, 0x36, 0x93,
729 0xea, 0x94, 0xbe, 0x82, 0x6a, 0x66, 0x6e, 0xe4,
730 },
731 },
732};
733
734#define N_SHA512_256_TESTS (sizeof(sha512_256_tests) / sizeof(sha512_256_tests[0]))
735
736static void
737sha512_256_init(void *ctx)
738{
739 SHA512_256Init(ctx);
740}
741
742static void
743sha512_256_update(void *ctx, const uint8_t *data, size_t len)
744{
745 SHA512_256Update(ctx, data, len);
746}
747
748static void
749sha512_256_final(void *digest, void *ctx)
750{
751 SHA512_256Final(digest, ctx);
752}
753
754struct hash_ctx {
755 uint8_t *digest;
756 size_t digest_len;
757 void *ctx;
758 void (*init)(void *);
759 void (*update)(void *, const uint8_t *, size_t);
760 void (*final)(void *, void *);
761};
762
763static const struct hash_tests {
764 const char *name;
765 size_t num_tests;
766 const struct hash_test_case *tests;
767} hash_tests[] = {
768 [hash_md5] = {
769 .name = "RFC 1321 MD5",
770 .num_tests = N_MD5_TESTS,
771 .tests = md5_tests,
772 },
773 [hash_rmd160] = {
774 .name = "Bosselaers RMD160",
775 .num_tests = N_RMD160_TESTS,
776 .tests = rmd160_tests,
777 },
778 [hash_sha1] = {
779 .name = "RFC 3174 SHA1",
780 .num_tests = N_SHA1_TESTS,
781 .tests = sha1_tests,
782 },
783 [hash_sha224] = {
784 .name = "RFC 6234 SHA224",
785 .num_tests = N_SHA224_TESTS,
786 .tests = sha224_tests,
787 },
788 [hash_sha256] = {
789 .name = "RFC 6234 SHA256",
790 .num_tests = N_SHA256_TESTS,
791 .tests = sha256_tests,
792 },
793 [hash_sha384] = {
794 .name = "RFC 6234 SHA384",
795 .num_tests = N_SHA384_TESTS,
796 .tests = sha384_tests,
797 },
798 [hash_sha512] = {
799 .name = "RFC 6234 SHA512",
800 .num_tests = N_SHA512_TESTS,
801 .tests = sha512_tests,
802 },
803 [hash_sha512_256] = {
804 .name = "RFC 6234 SHA512_256 (generated)",
805 .num_tests = N_SHA512_256_TESTS,
806 .tests = sha512_256_tests,
807 },
808};
809
810static int
811hash_test_case(struct hash_ctx *ctx, const struct hash_test_case *tc,
812 const char *name, size_t testno)
813{
814 size_t in_len = tc->in != NULL ? strlen(tc->in) : 0;
815
816 ctx->init(ctx->ctx);
817 ctx->update(ctx->ctx, (const uint8_t *)tc->in, in_len);
818 ctx->final(ctx->digest, ctx->ctx);
819
820 if (memcmp(tc->out, ctx->digest, ctx->digest_len) != 0) {
821 fprintf(stderr, "FAIL: %s test %zu\n", name, testno);
822 return 1;
823 }
824
825 return 0;
826}
827
828static int
829hash_test(struct hash_ctx *ctx, const struct hash_tests *tests)
830{
831 size_t i;
832 int failed = 0;
833
834 for (i = 0; i < tests->num_tests; i++) {
835 const struct hash_test_case *tc = &tests->tests[i];
836
837 failed |= hash_test_case(ctx, tc, tests->name, i);
838 }
839
840 return failed;
841}
842
843int
844main(void)
845{
846 uint8_t md5_digest[MD5_DIGEST_LENGTH];
847 uint8_t rmd160_digest[RMD160_DIGEST_LENGTH];
848 uint8_t sha1_digest[SHA1_DIGEST_LENGTH];
849 uint8_t sha224_digest[SHA224_DIGEST_LENGTH];
850 uint8_t sha256_digest[SHA256_DIGEST_LENGTH];
851 uint8_t sha384_digest[SHA384_DIGEST_LENGTH];
852 uint8_t sha512_digest[SHA512_DIGEST_LENGTH];
853 uint8_t sha512_256_digest[SHA512_256_DIGEST_LENGTH];
854 MD5_CTX md5_ctx;
855 RMD160_CTX rmd160_ctx;
856 SHA1_CTX sha1_ctx;
857 SHA2_CTX sha224_ctx;
858 SHA2_CTX sha256_ctx;
859 SHA2_CTX sha384_ctx;
860 SHA2_CTX sha512_ctx;
861 SHA2_CTX sha512_256_ctx;
862 struct hash_ctx ctx[] = {
863 [hash_md5] = {
864 .digest = md5_digest,
865 .digest_len = sizeof(md5_digest),
866 .ctx = &md5_ctx,
867 .init = md5_init,
868 .update = md5_update,
869 .final = md5_final,
870 },
871 [hash_rmd160] = {
872 .digest = rmd160_digest,
873 .digest_len = sizeof(rmd160_digest),
874 .ctx = &rmd160_ctx,
875 .init = rmd160_init,
876 .update = rmd160_update,
877 .final = rmd160_final,
878 },
879 [hash_sha1] = {
880 .digest = sha1_digest,
881 .digest_len = sizeof(sha1_digest),
882 .ctx = &sha1_ctx,
883 .init = sha1_init,
884 .update = sha1_update,
885 .final = sha1_final,
886 },
887 [hash_sha224] = {
888 .digest = sha224_digest,
889 .digest_len = sizeof(sha224_digest),
890 .ctx = &sha224_ctx,
891 .init = sha224_init,
892 .update = sha224_update,
893 .final = sha224_final,
894 },
895 [hash_sha256] = {
896 .digest = sha256_digest,
897 .digest_len = sizeof(sha256_digest),
898 .ctx = &sha256_ctx,
899 .init = sha256_init,
900 .update = sha256_update,
901 .final = sha256_final,
902 },
903 [hash_sha384] = {
904 .digest = sha384_digest,
905 .digest_len = sizeof(sha384_digest),
906 .ctx = &sha384_ctx,
907 .init = sha384_init,
908 .update = sha384_update,
909 .final = sha384_final,
910 },
911 [hash_sha512] = {
912 .digest = sha512_digest,
913 .digest_len = sizeof(sha512_digest),
914 .ctx = &sha512_ctx,
915 .init = sha512_init,
916 .update = sha512_update,
917 .final = sha512_final,
918 },
919 [hash_sha512_256] = {
920 .digest = sha512_256_digest,
921 .digest_len = sizeof(sha512_256_digest),
922 .ctx = &sha512_256_ctx,
923 .init = sha512_256_init,
924 .update = sha512_256_update,
925 .final = sha512_256_final,
926 },
927 };
928 int i;
929 int failed = 0;
930
931 for (i = 0; i < NUM_HASHES; i++)
932 failed |= hash_test(&ctx[i], &hash_tests[i]);
933
934 return failed;
935}
diff --git a/src/regress/lib/libc/illumos/Makefile b/src/regress/lib/libc/illumos/Makefile
new file mode 100644
index 0000000000..cf2d22eb44
--- /dev/null
+++ b/src/regress/lib/libc/illumos/Makefile
@@ -0,0 +1,7 @@
1# $OpenBSD: Makefile,v 1.1.1.1 2025/08/02 06:16:34 tb Exp $
2
3SUBDIR += oclo
4
5install:
6
7.include <bsd.subdir.mk>
diff --git a/src/regress/lib/libc/illumos/Makefile.inc b/src/regress/lib/libc/illumos/Makefile.inc
new file mode 100644
index 0000000000..4296b6e690
--- /dev/null
+++ b/src/regress/lib/libc/illumos/Makefile.inc
@@ -0,0 +1,9 @@
1# $OpenBSD: Makefile.inc,v 1.1.1.1 2025/08/02 06:16:34 tb Exp $
2
3ILLUMOS_OS_TESTDIR = /usr/local/share/illumos-os-tests
4
5.if !exists(${ILLUMOS_OS_TESTDIR})
6regress:
7 @echo package illumos-os-tests is required for this regress
8 @echo SKIPPED
9.endif
diff --git a/src/regress/lib/libc/illumos/oclo/Makefile b/src/regress/lib/libc/illumos/oclo/Makefile
new file mode 100644
index 0000000000..c2c24202c3
--- /dev/null
+++ b/src/regress/lib/libc/illumos/oclo/Makefile
@@ -0,0 +1,16 @@
1# $OpenBSD: Makefile,v 1.1.1.1 2025/08/02 06:16:34 tb Exp $
2
3.if exists(/usr/local/share/illumos-os-tests)
4
5PROGS = oclo
6PROGS += oclo_errors
7PROGS += ocloexec_verify
8
9LDADD_ocloexec_verify = -lkvm
10
11WARNINGS = yes
12
13.PATH: /usr/local/share/illumos-os-tests/tests/oclo
14.endif
15
16.include <bsd.regress.mk>
diff --git a/src/regress/lib/libc/malloc/malloc_errs/malloc_errs.c b/src/regress/lib/libc/malloc/malloc_errs/malloc_errs.c
index 486c247f0d..57d799f49d 100644
--- a/src/regress/lib/libc/malloc/malloc_errs/malloc_errs.c
+++ b/src/regress/lib/libc/malloc/malloc_errs/malloc_errs.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: malloc_errs.c,v 1.5 2024/04/14 17:47:41 otto Exp $ */ 1/* $OpenBSD: malloc_errs.c,v 1.6 2025/05/24 06:40:29 otto Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Otto Moerbeek <otto@drijf.net> 3 * Copyright (c) 2023 Otto Moerbeek <otto@drijf.net>
4 * 4 *
@@ -286,11 +286,10 @@ int main(int argc, char *argv[])
286 int i, status; 286 int i, status;
287 pid_t pid; 287 pid_t pid;
288 char num[10]; 288 char num[10];
289 char options[10]; 289 char options[40];
290 extern char* malloc_options; 290 char const *env[2];
291 291
292 if (argc == 3) { 292 if (argc == 2) {
293 malloc_options = argv[2];
294 /* prevent coredumps */ 293 /* prevent coredumps */
295 setrlimit(RLIMIT_CORE, &lim); 294 setrlimit(RLIMIT_CORE, &lim);
296 i = atoi(argv[1]); 295 i = atoi(argv[1]);
@@ -303,9 +302,11 @@ int main(int argc, char *argv[])
303 pid = fork(); 302 pid = fork();
304 switch (pid) { 303 switch (pid) {
305 case 0: 304 case 0:
306 snprintf(options, sizeof(options), "us%s", tests[i].flags); 305 snprintf(options, sizeof(options), "MALLOC_OPTIONS=us%s", tests[i].flags);
307 snprintf(num, sizeof(num), "%d", i); 306 snprintf(num, sizeof(num), "%d", i);
308 execl(argv[0], argv[0], num, options, NULL); 307 env[0] = options;
308 env[1] = NULL;
309 execle(argv[0], argv[0], num, NULL, env);
309 err(1, "exec"); 310 err(1, "exec");
310 break; 311 break;
311 case -1: 312 case -1:
diff --git a/src/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c b/src/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c
index 799d2b9117..7e53c32dbc 100644
--- a/src/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c
+++ b/src/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: malloc_ulimit1.c,v 1.5 2019/06/12 11:31:36 bluhm Exp $ */ 1/* $OpenBSD: malloc_ulimit1.c,v 1.6 2025/05/24 06:47:27 otto Exp $ */
2 2
3/* Public Domain, 2006, Otto Moerbeek <otto@drijf.net> */ 3/* Public Domain, 2006, Otto Moerbeek <otto@drijf.net> */
4 4
@@ -23,7 +23,7 @@
23#define FACTOR 1024 23#define FACTOR 1024
24 24
25/* This test takes forever with junking turned on. */ 25/* This test takes forever with junking turned on. */
26char *malloc_options = "jj"; 26const char * const malloc_options = "jj";
27 27
28int 28int
29main() 29main()
diff --git a/src/regress/lib/libc/stdio/Makefile b/src/regress/lib/libc/stdio/Makefile
new file mode 100644
index 0000000000..f1e980f688
--- /dev/null
+++ b/src/regress/lib/libc/stdio/Makefile
@@ -0,0 +1,29 @@
1# $OpenBSD: Makefile,v 1.4 2025/06/03 14:35:27 yasuoka Exp $
2
3PROGS= test_fflush
4CLEANFILES= test_fflush.tmp
5
6PROGS+= test_ungetwc
7CLEANFILES+= test_ungetwc.tmp
8
9PROGS+= test___freading
10CLEANFILES+= test___freading.tmp
11
12PROGS+= test___fwriting
13CLEANFILES+= test___fwriting.tmp
14
15PROGS+= test___fpending
16CLEANFILES+= test___fpending.tmp
17
18PROGS+= test___freadahead
19CLEANFILES+= test___freadahead.tmp
20
21PROGS+= test___freadptr
22CLEANFILES+= test___freadptr.tmp
23
24PROGS+= test___fseterr
25CLEANFILES+= test___fseterr.tmp
26
27WARNINGS= yes
28
29.include <bsd.regress.mk>
diff --git a/src/regress/lib/libc/stdio/test___fpending.c b/src/regress/lib/libc/stdio/test___fpending.c
new file mode 100644
index 0000000000..96ace2e481
--- /dev/null
+++ b/src/regress/lib/libc/stdio/test___fpending.c
@@ -0,0 +1,58 @@
1/* $OpenBSD: test___fpending.c,v 1.1 2025/05/25 00:20:54 yasuoka Exp $ */
2
3/*
4 * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#include <assert.h>
20#include <stdio.h>
21#include <stdio_ext.h>
22#include <stdlib.h>
23
24/* we use assert() */
25#undef NDEBUG
26
27#define TMPFILENAME "test___fpending.tmp"
28
29void test___fpending0(void);
30
31void
32test___fpending0(void)
33{
34 FILE *fp;
35 int r;
36 size_t s;
37
38 fp = fopen(TMPFILENAME, "w");
39 assert(fp != NULL);
40 r = fputs("Hello world", fp);
41 assert(r >= 0);
42 s = __fpending(fp);
43 assert(s > 0); /* assume buffered */
44 r = fflush(fp);
45 assert(r == 0);
46 s = __fpending(fp);
47 assert(s == 0); /* buffer must be 0 */
48 r = fclose(fp);
49 assert(r == 0);
50}
51
52int
53main(int argc, char *argv[])
54{
55 test___fpending0();
56
57 exit(0);
58}
diff --git a/src/regress/lib/libc/stdio/test___freadahead.c b/src/regress/lib/libc/stdio/test___freadahead.c
new file mode 100644
index 0000000000..66d5e3492a
--- /dev/null
+++ b/src/regress/lib/libc/stdio/test___freadahead.c
@@ -0,0 +1,71 @@
1/* $OpenBSD: test___freadahead.c,v 1.2 2025/06/03 14:35:27 yasuoka Exp $ */
2
3/*
4 * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#include <assert.h>
20#include <errno.h>
21#include <stdio.h>
22#include <stdio_ext.h>
23#include <stdlib.h>
24
25/* we use assert() */
26#undef NDEBUG
27
28#define TMPFILENAME "test___freadahead.tmp"
29
30void test___freadahead0(void);
31
32void
33test___freadahead0(void)
34{
35 FILE *fp;
36 int r;
37 size_t s;
38
39 fp = fopen(TMPFILENAME, "w");
40 assert(fp != NULL);
41 r = fputs("Hello world", fp);
42 assert(r >= 0);
43 r = fclose(fp);
44
45 fp = fopen(TMPFILENAME, "r");
46 s = __freadahead(fp);
47 assert(s == 0);
48 assert(fgetc(fp) == 'H');
49 s = __freadahead(fp);
50 assert(s == 10);
51 r = fflush(fp);
52#if 0
53 /* fflush() to reading file is not supported (yet) */
54 assert(errno == EBADF);
55#else
56 assert(r == 0);
57 s = __freadahead(fp);
58 assert(s == 0);
59#endif
60
61 r = fclose(fp);
62 assert(r == 0);
63}
64
65int
66main(int argc, char *argv[])
67{
68 test___freadahead0();
69
70 exit(0);
71}
diff --git a/src/regress/lib/libc/stdio/test___freading.c b/src/regress/lib/libc/stdio/test___freading.c
new file mode 100644
index 0000000000..f74eb78d35
--- /dev/null
+++ b/src/regress/lib/libc/stdio/test___freading.c
@@ -0,0 +1,125 @@
1/* $OpenBSD: test___freading.c,v 1.2 2025/06/12 07:39:26 yasuoka Exp $ */
2
3/*
4 * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#include <assert.h>
20#include <stdio.h>
21#include <stdio_ext.h>
22#include <stdlib.h>
23#include <string.h>
24#include <unistd.h>
25
26/* we use assert() */
27#undef NDEBUG
28
29#define TMPFILENAME "test___freading.tmp"
30
31void setup(void);
32
33void test___freading0(void);
34void test___freading1(void);
35void test___freading2(void);
36
37void
38setup(void)
39{
40 FILE *fp;
41
42 /* common setup */
43 unlink(TMPFILENAME);
44 fp = fopen(TMPFILENAME, "w+");
45 assert(fp != NULL);
46 fputs("Hello world\n", fp);
47 fclose(fp);
48}
49
50void
51test___freading0(void)
52{
53 FILE *fp;
54 int r;
55 char buf[80];
56
57 fp = popen("echo Hello world", "r");
58 assert(fp != NULL);
59 assert(__freading(fp) != 0);
60 assert(fgets(buf, sizeof(buf), fp) != NULL);
61 assert(strcmp(buf, "Hello world\n") == 0);
62 r = pclose(fp);
63 assert(r == 0);
64}
65
66void
67test___freading1(void)
68{
69 FILE *fp;
70 int r;
71
72 /* when the last operaiton is read, __freading() returns true */
73 fp = fopen(TMPFILENAME, "w+");
74 assert(fp != NULL);
75 assert(__freading(fp) == 0);
76 r = fputs("Hello world\n", fp);
77 assert(r >= 0);
78 assert(__freading(fp) == 0);
79 rewind(fp);
80 assert(fgetc(fp) == 'H');
81 assert(__freading(fp) != 0);
82 /* write */
83 fseek(fp, 0, SEEK_END);
84 r = fputs("\n", fp);
85 assert(__freading(fp) == 0);
86 /* ungetc */
87 rewind(fp);
88 assert(ungetc('X', fp) != 0);
89 assert(__freading(fp) != 0); /* reading */
90
91 r = fclose(fp);
92 assert(r == 0);
93}
94
95void
96test___freading2(void)
97{
98 int r;
99 FILE *fp;
100
101 /*
102 * until v1.10 of fpurge.c mistakenly enables the writing buffer
103 * without _SRD flag set.
104 */
105 fp = fopen(TMPFILENAME, "r+");
106 assert(fp != NULL);
107 assert(fgetc(fp) == 'H');
108 fpurge(fp);
109 fseek(fp, 0, SEEK_CUR);
110 assert(fputc('X', fp) == 'X');
111 assert(__freading(fp) == 0);
112
113 r = fclose(fp);
114 assert(r == 0);
115}
116
117int
118main(int argc, char *argv[])
119{
120 test___freading0();
121 test___freading1();
122 test___freading2();
123
124 exit(0);
125}
diff --git a/src/regress/lib/libc/stdio/test___freadptr.c b/src/regress/lib/libc/stdio/test___freadptr.c
new file mode 100644
index 0000000000..cce362f2ae
--- /dev/null
+++ b/src/regress/lib/libc/stdio/test___freadptr.c
@@ -0,0 +1,78 @@
1/* $OpenBSD: test___freadptr.c,v 1.1 2025/05/25 00:20:54 yasuoka Exp $ */
2
3/*
4 * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#include <sys/types.h>
20#include <assert.h>
21#include <stdio.h>
22#include <stdio_ext.h>
23#include <stdlib.h>
24#include <string.h>
25
26/* we use assert() */
27#undef NDEBUG
28
29#define TMPFILENAME "test___freadptr.tmp"
30
31void test___freadptr0(void);
32
33/* test __freadptr() and __freadptrinc() */
34void
35test___freadptr0(void)
36{
37 FILE *fp;
38 int r;
39 ssize_t s;
40 const char *p;
41
42 fp = fopen(TMPFILENAME, "w");
43 assert(fp != NULL);
44 r = fputs("Hello world", fp);
45 assert(r >= 0);
46 r = fclose(fp);
47
48 fp = fopen(TMPFILENAME, "r");
49 assert(fgetc(fp) == 'H');
50 p = __freadptr(fp, &s);
51 assert(p != NULL);
52 assert(s > 4); /* this test assume this (not by the spec) */
53 assert(*p == 'e');
54 assert(strncmp(p, "ello world", s) == 0);
55
56 __freadptrinc(fp, 4);
57 assert(fgetc(fp) == ' ');
58
59 ungetc('A', fp);
60 ungetc('A', fp);
61 ungetc('A', fp);
62 p = __freadptr(fp, &s);
63 assert(s > 0);
64 assert(*p == 'A');
65 /* ptr will contains only the pushback buffer */
66 assert(strncmp(p, "AAAworld", s) == 0);
67
68 r = fclose(fp);
69 assert(r == 0);
70}
71
72int
73main(int argc, char *argv[])
74{
75 test___freadptr0();
76
77 exit(0);
78}
diff --git a/src/regress/lib/libc/stdio/test___fseterr.c b/src/regress/lib/libc/stdio/test___fseterr.c
new file mode 100644
index 0000000000..70fb491c6c
--- /dev/null
+++ b/src/regress/lib/libc/stdio/test___fseterr.c
@@ -0,0 +1,60 @@
1/* $OpenBSD: test___fseterr.c,v 1.1 2025/05/25 00:20:54 yasuoka Exp $ */
2
3/*
4 * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#include <assert.h>
20#include <stdio.h>
21#include <stdio_ext.h>
22#include <stdlib.h>
23
24/* we use assert() */
25#undef NDEBUG
26
27#define TMPFILENAME "test___fseterr.tmp"
28
29void test___fseterr0(void);
30
31void
32test___fseterr0(void)
33{
34 FILE *fp;
35 int r;
36
37 fp = fopen(TMPFILENAME, "w+");
38 assert(fp != NULL);
39
40 assert(!ferror(fp));
41
42 r = fprintf(fp, "hello world\n");
43 assert(r > 0);
44
45 __fseterr(fp);
46 assert(ferror(fp));
47
48 r = fprintf(fp, "hello world\n");
49 assert(r == -1);
50
51 fclose(fp);
52}
53
54int
55main(int argc, char *argv[])
56{
57 test___fseterr0();
58
59 exit(0);
60}
diff --git a/src/regress/lib/libc/stdio/test___fwriting.c b/src/regress/lib/libc/stdio/test___fwriting.c
new file mode 100644
index 0000000000..eb4671d3cf
--- /dev/null
+++ b/src/regress/lib/libc/stdio/test___fwriting.c
@@ -0,0 +1,83 @@
1/* $OpenBSD: test___fwriting.c,v 1.1 2025/05/25 00:20:54 yasuoka Exp $ */
2
3/*
4 * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#include <assert.h>
20#include <stdio.h>
21#include <stdio_ext.h>
22#include <stdlib.h>
23
24/* we use assert() */
25#undef NDEBUG
26
27#define TMPFILENAME "test___fwriting.tmp"
28
29void test___fwriting0(void);
30void test___fwriting1(void);
31
32void
33test___fwriting0(void)
34{
35 FILE *fp;
36 int r;
37
38 fp = fopen(TMPFILENAME, "w"); /* write only */
39 assert(fp != NULL);
40 assert(__fwriting(fp) != 0); /* writing is true immediately */
41 r = fputs("Hello world\n", fp);
42 assert(r >= 0);
43 r = fclose(fp);
44 assert(r == 0);
45
46 fp = fopen(TMPFILENAME, "a"); /* append only */
47 assert(fp != NULL);
48 assert(__fwriting(fp) != 0); /* writing immediately */
49 r = fclose(fp);
50 assert(r == 0);
51}
52
53void
54test___fwriting1(void)
55{
56 FILE *fp;
57 int r;
58
59 fp = fopen(TMPFILENAME, "w+"); /* read / write */
60 assert(fp != NULL);
61 r = fputs("Hello world\n", fp);
62 assert(r >= 0);
63 assert(__fwriting(fp) != 0);
64 rewind(fp);
65 assert(fgetc(fp) == 'H'); /* read */
66 assert(__fwriting(fp) == 0); /* writing becomes false */
67 fputc('e', fp);
68 assert(__fwriting(fp) != 0); /* writing becomes true */
69 ungetc('e', fp);
70 assert(__fwriting(fp) == 0); /* ungetc -> writing becomes false */
71
72 r = fclose(fp);
73 assert(r == 0);
74}
75
76int
77main(int argc, char *argv[])
78{
79 test___fwriting0();
80 test___fwriting1();
81
82 exit(0);
83}
diff --git a/src/regress/lib/libc/stdio/test_fflush.c b/src/regress/lib/libc/stdio/test_fflush.c
new file mode 100644
index 0000000000..a0586b7d14
--- /dev/null
+++ b/src/regress/lib/libc/stdio/test_fflush.c
@@ -0,0 +1,345 @@
1/* $OpenBSD: test_fflush.c,v 1.3 2025/06/08 08:53:53 yasuoka Exp $ */
2
3/*
4 * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#include <assert.h>
20#include <locale.h>
21#include <stdio.h>
22#include <stdlib.h>
23#include <string.h>
24#include <unistd.h>
25#include <wchar.h>
26
27/* we use assert() */
28#undef NDEBUG
29
30#define TMPFILENAME "test_fflush.tmp"
31
32void setup(void);
33
34void test_fflush_read0(void);
35void test_fflush_read1(void);
36void test_fflush_read2(void);
37void test_fflush_read3(void);
38void test_fflush_read4(void);
39void setupw(void);
40void test_fflush_read5(void);
41void test_fflush_read6(void);
42
43void
44setup(void)
45{
46 FILE *fp;
47
48 /* common setup */
49 unlink(TMPFILENAME);
50 fp = fopen(TMPFILENAME, "w+");
51 assert(fp != NULL);
52 fputs("Hello world\n", fp);
53 fclose(fp);
54}
55
56/* fflush work with reading file and seekable */
57void
58test_fflush_read0(void)
59{
60 int r;
61 char buf[80];
62 FILE *fp;
63
64 setup();
65
66 /* In POSIX 2008, fflush() must work with the file object for reading */
67 fp = fopen(TMPFILENAME, "r");
68 assert(fp != NULL);
69 assert(fgetc(fp) == 'H');
70 r = fflush(fp);
71 assert(r == 0);
72
73 /* the position is moved to 1 */
74 assert(ftell(fp) == 1);
75
76 /* can read rest of that */
77 fgets(buf, sizeof(buf), fp);
78 assert(strcmp(buf, "ello world\n") == 0);
79 r = fclose(fp);
80 assert(r == 0);
81}
82
83/* fflush work with reading file and seekable + unget */
84void
85test_fflush_read1(void)
86{
87 int r;
88 char buf[80];
89 FILE *fp;
90
91 setup();
92
93 fp = fopen(TMPFILENAME, "r");
94 assert(fp != NULL);
95 assert(fgetc(fp) == 'H');
96 assert(fgetc(fp) == 'e');
97 assert(fgetc(fp) == 'l');
98 assert(fgetc(fp) == 'l');
99 assert(fgetc(fp) == 'o');
100
101 /* push the 'AAAA' back */
102 ungetc('A', fp);
103 ungetc('A', fp);
104 ungetc('A', fp);
105 ungetc('A', fp);
106
107 /* can read rest of that */
108 fgets(buf, sizeof(buf), fp);
109 assert(strcmp(buf, "AAAA world\n") == 0);
110 r = fclose(fp);
111 assert(r == 0);
112
113 /* do the same thing + fflush */
114
115 fp = fopen(TMPFILENAME, "r");
116 assert(fp != NULL);
117 assert(fgetc(fp) == 'H');
118 assert(fgetc(fp) == 'e');
119 assert(fgetc(fp) == 'l');
120 assert(fgetc(fp) == 'l');
121 assert(fgetc(fp) == 'o');
122
123 /* push 'AAAA' back */
124 ungetc('A', fp);
125 ungetc('A', fp);
126 ungetc('A', fp);
127 ungetc('A', fp);
128
129 /* then fflush */
130 r = fflush(fp);
131 assert(r == 0);
132
133 /* fllush() clears the all pushed back chars */
134
135 /* can read rest of that */
136 fgets(buf, sizeof(buf), fp);
137 assert(strcmp(buf, " world\n") == 0);
138 r = fclose(fp);
139 assert(r == 0);
140}
141
142/* fflush() to reading and non-seekable stream */
143void
144test_fflush_read2(void)
145{
146 int r;
147 FILE *fp;
148 char buf[80];
149
150 /* In POSIX-2008, fflush() must work with the file object for reading */
151 fp = popen("echo Hello world", "r");
152 assert(fp != NULL);
153 assert(fgetc(fp) == 'H');
154 r = fflush(fp);
155 assert(r == 0);
156
157 /*
158 * FILE object for read and NOT seekable. In that case, fflush does
159 * nothing, but must keep the buffer.
160 */
161
162 /* can read rest of that */
163 fgets(buf, sizeof(buf), fp);
164 assert(strcmp(buf, "ello world\n") == 0);
165 r = pclose(fp);
166 assert(r == 0);
167}
168
169/* fflush() to the file which doesn't have any buffer */
170void
171test_fflush_read3(void)
172{
173 int r;
174 FILE *fp;
175
176 setup();
177
178 /* In POSIX-2008, fflush() must work with the file object for reading */
179 fp = fopen(TMPFILENAME, "r");
180 assert(fp != NULL);
181 r = fflush(fp);
182 assert(r == 0);
183 r = fclose(fp);
184 assert(r == 0);
185}
186
187/* freopen() should call fflush() internal */
188void
189test_fflush_read4(void)
190{
191 int r;
192 FILE *fp;
193 off_t pos;
194 char buf[80];
195
196 setup();
197
198 /* In POSIX-2008, fflush() must work with the file object for reading */
199 fp = fopen(TMPFILENAME, "r");
200 assert(fp != NULL);
201
202 assert(fgetc(fp) == 'H'); /* read 1 */
203
204 pos = lseek(fileno(fp), 0, SEEK_CUR);
205 assert(pos >= 1);
206 assert(pos > 1); /* this test assume the buffer is used */
207
208 /* freopen() should call fflush() internal */
209 fp = freopen(TMPFILENAME, "r", fp);
210 assert(fp != NULL);
211
212 /* can read rest of that on fp */
213 fgets(buf, sizeof(buf), fp);
214 assert(strcmp(buf, "Hello world\n") == 0);
215
216 r = fclose(fp);
217 assert(r == 0);
218}
219
220void
221setupw(void)
222{
223 FILE *fp;
224
225 /* common setup */
226 unlink(TMPFILENAME);
227 fp = fopen(TMPFILENAME, "w+");
228 assert(fp != NULL);
229 /* Konnitiwa Sekai(in Kanji) */
230 fputws(L"\u3053\u3093\u306b\u3061\u308f \u4e16\u754c\n", fp);
231 fclose(fp);
232}
233
234/* fflush work with reading file and seekable + ungetwc */
235void
236test_fflush_read5(void)
237{
238 int r;
239 wchar_t buf[80];
240 FILE *fp;
241
242 setupw();
243
244 fp = fopen(TMPFILENAME, "r");
245
246 assert(fp != NULL);
247 assert(fgetwc(fp) == L'\u3053'); /* Ko */
248 assert(fgetwc(fp) == L'\u3093'); /* N */
249 assert(fgetwc(fp) == L'\u306b'); /* Ni */
250 assert(fgetwc(fp) == L'\u3061'); /* Ti */
251 assert(fgetwc(fp) == L'\u308f'); /* Wa */
252
253 /* push 263A(smile) back */
254 assert(ungetwc(L'\u263a', fp));
255
256 /* we support 1 push back wchar_t */
257 assert(fgetwc(fp) == L'\u263a');
258
259 /* can read reset of that */
260 fgetws(buf, sizeof(buf), fp);
261 assert(wcscmp(buf, L" \u4e16\u754c\n") == 0);
262
263 r = fclose(fp);
264 assert(r == 0);
265
266 /* do the same thing + fflush */
267 fp = fopen(TMPFILENAME, "r");
268
269 assert(fp != NULL);
270 assert(fgetwc(fp) == L'\u3053'); /* Ko */
271 assert(fgetwc(fp) == L'\u3093'); /* N */
272 assert(fgetwc(fp) == L'\u306b'); /* Ni */
273 assert(fgetwc(fp) == L'\u3061'); /* Ti */
274 assert(fgetwc(fp) == L'\u308f'); /* Wa */
275
276 /* push 263A(smile) back */
277 assert(ungetwc(L'\u263a', fp));
278
279 /* we support 1 push back wchar_t */
280 assert(fgetwc(fp) == L'\u263a');
281
282 /* then fflush */
283 r = fflush(fp);
284 assert(r == 0);
285
286 /* fllush() clears the all pushed back chars */
287
288 /* can read rest of that */
289 fgetws(buf, sizeof(buf), fp);
290 assert(wcscmp(buf, L" \u4e16\u754c\n") == 0);
291 r = fclose(fp);
292 assert(r == 0);
293}
294
295void
296test_fflush_read6(void)
297{
298 int r, c;
299 FILE *fp;
300
301 setup();
302 fp = fopen(TMPFILENAME, "r");
303 assert(fp != NULL);
304
305 /*
306 * https://pubs.opengroup.org/onlinepubs/9699919799/functions/fflush.html
307 * .. any characters pushed back onto the stream by ungetc() or ungetwc()
308 * that have not subsequently been read from the stream shall be discarded
309 * (without further changing the file offset).
310 */
311
312 assert(fgetc(fp) == 'H');
313 c = getc(fp);
314 ungetc(c, fp); /* push back the character has been read */
315 r = fflush(fp);
316 assert(r == 0);
317 assert(getc(fp) == c);
318
319 fseek(fp, 0, SEEK_SET);
320 assert(fgetc(fp) == 'H');
321 c = getc(fp);
322 ungetc('X', fp); /* push back the character has not been read */
323 r = fflush(fp);
324 assert(r == 0);
325 assert(getc(fp) == 'l');
326
327 r = fclose(fp);
328 assert(r == 0);
329}
330
331int
332main(int argc, char *argv[])
333{
334 setlocale(LC_ALL, "C.UTF-8");
335
336 test_fflush_read0();
337 test_fflush_read1();
338 test_fflush_read2();
339 test_fflush_read3();
340 test_fflush_read4();
341 test_fflush_read5();
342 test_fflush_read6();
343
344 exit(0);
345}
diff --git a/src/regress/lib/libc/stdio/test_ungetwc.c b/src/regress/lib/libc/stdio/test_ungetwc.c
new file mode 100644
index 0000000000..bb4e853020
--- /dev/null
+++ b/src/regress/lib/libc/stdio/test_ungetwc.c
@@ -0,0 +1,90 @@
1/* $OpenBSD: test_ungetwc.c,v 1.1 2025/05/25 05:32:45 yasuoka Exp $ */
2
3/*
4 * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#include <assert.h>
20#include <stdio.h>
21#include <stdlib.h>
22#include <string.h>
23#include <unistd.h>
24#include <locale.h>
25#include <wchar.h>
26
27/* we use assert() */
28#undef NDEBUG
29
30#define TMPFILENAME "test_ungetwc.tmp"
31
32void setupw(void);
33void test_fflush_ungetwc0(void);
34
35void
36setupw(void)
37{
38 FILE *fp;
39
40 /* common setup */
41 unlink(TMPFILENAME);
42 fp = fopen(TMPFILENAME, "w+");
43 assert(fp != NULL);
44 /* Konnitiwa Sekai(in Kanji) */
45 fputws(L"\u3053\u3093\u306b\u3061\u308f \u4e16\u754c\n", fp);
46 fclose(fp);
47}
48
49/* fflush work with reading file and seekable + ungetwc */
50void
51test_fflush_ungetwc0(void)
52{
53 int r;
54 wchar_t buf[80];
55 FILE *fp;
56
57 setupw();
58
59 fp = fopen(TMPFILENAME, "r");
60
61 assert(fp != NULL);
62 assert(fgetwc(fp) == L'\u3053'); /* Ko */
63 assert(fgetwc(fp) == L'\u3093'); /* N */
64 assert(fgetwc(fp) == L'\u306b'); /* Ni */
65 assert(fgetwc(fp) == L'\u3061'); /* Ti */
66 assert(fgetwc(fp) == L'\u308f'); /* Wa */
67
68 /* push 263A(smile) back */
69 assert(ungetwc(L'\u263a', fp));
70
71 /* we support 1 push back wchar_t */
72 assert(fgetwc(fp) == L'\u263a');
73
74 /* can read reset of that */
75 fgetws(buf, sizeof(buf), fp);
76 assert(wcscmp(buf, L" \u4e16\u754c\n") == 0);
77
78 r = fclose(fp);
79 assert(r == 0);
80}
81
82int
83main(int argc, char *argv[])
84{
85 setlocale(LC_ALL, "C.UTF-8");
86
87 test_fflush_ungetwc0();
88
89 exit(0);
90}
diff --git a/src/regress/lib/libcrypto/aes/aes_test.c b/src/regress/lib/libcrypto/aes/aes_test.c
index 37bee05ca7..8d5947a031 100644
--- a/src/regress/lib/libcrypto/aes/aes_test.c
+++ b/src/regress/lib/libcrypto/aes/aes_test.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: aes_test.c,v 1.3 2023/09/28 08:21:43 tb Exp $ */ 1/* $OpenBSD: aes_test.c,v 1.5 2025/07/05 14:32:47 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2022 Joshua Sing <joshua@hypera.dev> 3 * Copyright (c) 2022 Joshua Sing <joshua@hypera.dev>
4 * 4 *
@@ -524,6 +524,161 @@ static const struct aes_test aes_tests[] = {
524 }, 524 },
525 .out_len = 64, 525 .out_len = 64,
526 }, 526 },
527
528 /* XTS128 - Test vectors from NIST SP 800-38A */
529 {
530 /* XTSGenAES128 1 */
531 .mode = NID_aes_128_xts,
532 .key = {
533 0xa1, 0xb9, 0x0c, 0xba, 0x3f, 0x06, 0xac, 0x35,
534 0x3b, 0x2c, 0x34, 0x38, 0x76, 0x08, 0x17, 0x62,
535 0x09, 0x09, 0x23, 0x02, 0x6e, 0x91, 0x77, 0x18,
536 0x15, 0xf2, 0x9d, 0xab, 0x01, 0x93, 0x2f, 0x2f,
537 },
538 .iv = {
539 0x4f, 0xae, 0xf7, 0x11, 0x7c, 0xda, 0x59, 0xc6,
540 0x6e, 0x4b, 0x92, 0x01, 0x3e, 0x76, 0x8a, 0xd5,
541 },
542 .iv_len = 16,
543 .in = {
544 0xeb, 0xab, 0xce, 0x95, 0xb1, 0x4d, 0x3c, 0x8d,
545 0x6f, 0xb3, 0x50, 0x39, 0x07, 0x90, 0x31, 0x1c,
546 },
547 .in_len = 16,
548 .out = {
549 0x77, 0x8a, 0xe8, 0xb4, 0x3c, 0xb9, 0x8d, 0x5a,
550 0x82, 0x50, 0x81, 0xd5, 0xbe, 0x47, 0x1c, 0x63,
551 },
552 .out_len = 16,
553 },
554 {
555 /* XTSGenAES128 385 */
556 .mode = NID_aes_128_xts,
557 .key = {
558 0xb8, 0xdb, 0x0b, 0x9e, 0x63, 0xf5, 0xf0, 0xe6,
559 0x60, 0x97, 0x98, 0xa6, 0xcb, 0x42, 0xbb, 0x5b,
560 0x5d, 0x71, 0x39, 0xbb, 0x95, 0x57, 0x99, 0xf5,
561 0x2a, 0x7c, 0x58, 0x1f, 0x84, 0x63, 0x31, 0x76,
562 },
563 .iv = {
564 0x8d, 0x46, 0xf9, 0x67, 0x01, 0x16, 0x7a, 0x1d,
565 0x77, 0xcd, 0x1e, 0x44, 0xda, 0x92, 0xf3, 0xa8,
566 },
567 .iv_len = 16,
568 .in = {
569 0xb4, 0x64, 0x4d, 0xc1, 0xb3, 0x8d, 0xd5, 0x98,
570 0xca, 0x84, 0x0a, 0x82, 0xd4, 0xd9, 0xc0, 0x65,
571 0x67, 0x23, 0xb1, 0x58, 0x01, 0xaa, 0x18, 0xe6,
572 0x6e,
573 },
574 .in_len = 25,
575 .out = {
576 0x09, 0x28, 0x8c, 0xf5, 0x1f, 0x1e, 0xb4, 0xad,
577 0xb8, 0x54, 0x23, 0xd0, 0xe0, 0xd6, 0xe9, 0x58,
578 0x18, 0x87, 0x06, 0xaf, 0x26, 0x0e, 0x24, 0x67,
579 0x4e,
580 },
581 .out_len = 25,
582 },
583 {
584 /* XTSGenAES128 404 */
585 .mode = NID_aes_128_xts,
586 .key = {
587 0xbe, 0x5c, 0xf1, 0xf9, 0x9d, 0x51, 0x59, 0xf2,
588 0x11, 0xdb, 0xc4, 0xc1, 0x47, 0xf7, 0x9c, 0x55,
589 0x6b, 0x2d, 0xa5, 0xc6, 0x91, 0xde, 0xed, 0x74,
590 0x0d, 0x01, 0x57, 0xea, 0xb8, 0xc9, 0xc8, 0x9a,
591 },
592 .iv = {
593 0x89, 0x24, 0x86, 0x24, 0xb6, 0x96, 0xcf, 0x9c,
594 0xb1, 0xb5, 0x77, 0x9c, 0xdc, 0xbc, 0xfe, 0x1c,
595 },
596 .iv_len = 16,
597 .in = {
598 0x3b, 0x80, 0xf8, 0x22, 0xc4, 0xee, 0xe1, 0x31,
599 0x3f, 0x79, 0xca, 0x3d, 0xb1, 0x34, 0xd9, 0xca,
600 0x8b, 0x09, 0xa3, 0x53, 0x4d, 0x4e, 0x18, 0xe6,
601 0x43, 0x9e, 0x1c, 0xdb, 0x86, 0x18, 0x2a, 0x4f,
602 },
603 .in_len = 32,
604 .out = {
605 0x4b, 0x6a, 0xf4, 0x3a, 0x88, 0xb6, 0x33, 0xeb,
606 0xd1, 0xe1, 0x27, 0xc1, 0xec, 0x90, 0xcc, 0x47,
607 0xa2, 0xf1, 0x6e, 0x3b, 0xc7, 0x9f, 0x88, 0x45,
608 0xe3, 0xbd, 0x00, 0x25, 0xda, 0x87, 0x26, 0x45,
609 },
610 .out_len = 32,
611 },
612 {
613 /* XTSGenAES256 1 */
614 .mode = NID_aes_256_xts,
615 .key = {
616 0x1e, 0xa6, 0x61, 0xc5, 0x8d, 0x94, 0x3a, 0x0e,
617 0x48, 0x01, 0xe4, 0x2f, 0x4b, 0x09, 0x47, 0x14,
618 0x9e, 0x7f, 0x9f, 0x8e, 0x3e, 0x68, 0xd0, 0xc7,
619 0x50, 0x52, 0x10, 0xbd, 0x31, 0x1a, 0x0e, 0x7c,
620 0xd6, 0xe1, 0x3f, 0xfd, 0xf2, 0x41, 0x8d, 0x8d,
621 0x19, 0x11, 0xc0, 0x04, 0xcd, 0xa5, 0x8d, 0xa3,
622 0xd6, 0x19, 0xb7, 0xe2, 0xb9, 0x14, 0x1e, 0x58,
623 0x31, 0x8e, 0xea, 0x39, 0x2c, 0xf4, 0x1b, 0x08,
624 },
625 .iv = {
626 0xad, 0xf8, 0xd9, 0x26, 0x27, 0x46, 0x4a, 0xd2,
627 0xf0, 0x42, 0x8e, 0x84, 0xa9, 0xf8, 0x75, 0x64,
628 },
629 .iv_len = 16,
630 .in = {
631 0x2e, 0xed, 0xea, 0x52, 0xcd, 0x82, 0x15, 0xe1,
632 0xac, 0xc6, 0x47, 0xe8, 0x10, 0xbb, 0xc3, 0x64,
633 0x2e, 0x87, 0x28, 0x7f, 0x8d, 0x2e, 0x57, 0xe3,
634 0x6c, 0x0a, 0x24, 0xfb, 0xc1, 0x2a, 0x20, 0x2e,
635 },
636 .in_len = 32,
637 .out = {
638 0xcb, 0xaa, 0xd0, 0xe2, 0xf6, 0xce, 0xa3, 0xf5,
639 0x0b, 0x37, 0xf9, 0x34, 0xd4, 0x6a, 0x9b, 0x13,
640 0x0b, 0x9d, 0x54, 0xf0, 0x7e, 0x34, 0xf3, 0x6a,
641 0xf7, 0x93, 0xe8, 0x6f, 0x73, 0xc6, 0xd7, 0xdb,
642 },
643 .out_len = 32,
644 },
645 {
646 /* XTSGenAES256 172 */
647 .mode = NID_aes_256_xts,
648 .key= {
649 0x5c, 0x7f, 0x7a, 0x36, 0x08, 0x01, 0x78, 0x43,
650 0x00, 0x83, 0xff, 0x54, 0x92, 0xef, 0x77, 0x26,
651 0x0f, 0x68, 0x0a, 0x15, 0xa7, 0x66, 0x24, 0xb8,
652 0x9e, 0x85, 0x4c, 0x94, 0xf0, 0x48, 0x8a, 0x9e,
653 0x7d, 0xaa, 0x4f, 0x33, 0x01, 0x1f, 0x91, 0xdf,
654 0x5e, 0x33, 0x80, 0x53, 0xf4, 0x6c, 0xee, 0x65,
655 0x0f, 0xb0, 0xee, 0x69, 0xf8, 0xc2, 0x15, 0x75,
656 0x5a, 0x4a, 0x63, 0xcd, 0x42, 0x28, 0xc2, 0x19,
657 },
658 .iv = {
659 0xa4, 0x01, 0xd7, 0x3c, 0x88, 0x75, 0xe7, 0x59,
660 0xaa, 0x3e, 0xef, 0x53, 0xe0, 0xfb, 0x62, 0x63,
661 },
662 .iv_len = 16,
663 .in = {
664 0xb1, 0xe6, 0x29, 0xa6, 0x2a, 0x03, 0xca, 0x96,
665 0x9b, 0x16, 0x91, 0x52, 0x02, 0xbc, 0xaa, 0x09,
666 0xe7, 0x8a, 0xe1, 0x85, 0x1b, 0xc8, 0x85, 0x81,
667 0x16, 0x49, 0x68, 0xa5, 0x65, 0x6c, 0x82, 0xc0,
668 0xe5, 0xc4, 0x03, 0xba, 0x54, 0xb9, 0xb5, 0xed,
669 0x9b, 0xab, 0xe8, 0xb0, 0x75, 0x1d, 0x1b, 0x34,
670 },
671 .in_len = 48,
672 .out = {
673 0xf5, 0xbc, 0xa6, 0x0f, 0xb9, 0x35, 0x2b, 0x1d,
674 0xe0, 0x4d, 0x71, 0x29, 0x40, 0x56, 0x26, 0xb3,
675 0xa4, 0x74, 0xa2, 0x64, 0xfb, 0xac, 0x2d, 0x6b,
676 0xe1, 0x19, 0xe1, 0xd5, 0x7a, 0xa9, 0x98, 0xd0,
677 0xe0, 0xe4, 0xd9, 0xf9, 0xc9, 0x76, 0x21, 0x0d,
678 0x93, 0xc4, 0x65, 0xa3, 0xe3, 0x60, 0xcd, 0x92,
679 },
680 .out_len = 48,
681 },
527}; 682};
528 683
529#define N_AES_TESTS (sizeof(aes_tests) / sizeof(aes_tests[0])) 684#define N_AES_TESTS (sizeof(aes_tests) / sizeof(aes_tests[0]))
@@ -542,7 +697,10 @@ aes_ecb_test(size_t test_number, const char *label, int key_bits,
542 697
543 /* Encryption */ 698 /* Encryption */
544 memset(out, 0, sizeof(out)); 699 memset(out, 0, sizeof(out));
545 AES_set_encrypt_key(at->key, key_bits, &key); 700 if (AES_set_encrypt_key(at->key, key_bits, &key) != 0) {
701 fprintf(stderr, "FAIL (%s:%zu): AES_set_encrypt_key failed\n", label, test_number);
702 return 0;
703 }
546 AES_ecb_encrypt(at->in, out, &key, 1); 704 AES_ecb_encrypt(at->in, out, &key, 1);
547 705
548 if (memcmp(at->out, out, at->out_len) != 0) { 706 if (memcmp(at->out, out, at->out_len) != 0) {
@@ -553,7 +711,10 @@ aes_ecb_test(size_t test_number, const char *label, int key_bits,
553 711
554 /* Decryption */ 712 /* Decryption */
555 memset(out, 0, sizeof(out)); 713 memset(out, 0, sizeof(out));
556 AES_set_decrypt_key(at->key, key_bits, &key); 714 if (AES_set_decrypt_key(at->key, key_bits, &key) != 0) {
715 fprintf(stderr, "FAIL (%s:%zu): AES_set_decrypt_key failed\n", label, test_number);
716 return 0;
717 }
557 AES_ecb_encrypt(at->out, out, &key, 0); 718 AES_ecb_encrypt(at->out, out, &key, 0);
558 719
559 if (memcmp(at->in, out, at->in_len) != 0) { 720 if (memcmp(at->in, out, at->in_len) != 0) {
@@ -582,7 +743,10 @@ aes_cbc_test(size_t test_number, const char *label, int key_bits,
582 /* Encryption */ 743 /* Encryption */
583 memset(out, 0, sizeof(out)); 744 memset(out, 0, sizeof(out));
584 memcpy(iv, at->iv, at->iv_len); 745 memcpy(iv, at->iv, at->iv_len);
585 AES_set_encrypt_key(at->key, key_bits, &key); 746 if (AES_set_encrypt_key(at->key, key_bits, &key) != 0) {
747 fprintf(stderr, "FAIL (%s:%zu): AES_set_encrypt_key failed\n", label, test_number);
748 return 0;
749 }
586 AES_cbc_encrypt(at->in, out, at->in_len, &key, iv, 1); 750 AES_cbc_encrypt(at->in, out, at->in_len, &key, iv, 1);
587 751
588 if (memcmp(at->out, out, at->out_len) != 0) { 752 if (memcmp(at->out, out, at->out_len) != 0) {
@@ -594,7 +758,10 @@ aes_cbc_test(size_t test_number, const char *label, int key_bits,
594 /* Decryption */ 758 /* Decryption */
595 memset(out, 0, sizeof(out)); 759 memset(out, 0, sizeof(out));
596 memcpy(iv, at->iv, at->iv_len); 760 memcpy(iv, at->iv, at->iv_len);
597 AES_set_decrypt_key(at->key, key_bits, &key); 761 if (AES_set_decrypt_key(at->key, key_bits, &key) != 0) {
762 fprintf(stderr, "FAIL (%s:%zu): AES_set_decrypt_key failed\n", label, test_number);
763 return 0;
764 }
598 AES_cbc_encrypt(at->out, out, at->out_len, &key, iv, 0); 765 AES_cbc_encrypt(at->out, out, at->out_len, &key, iv, 0);
599 766
600 if (memcmp(at->in, out, at->in_len) != 0) { 767 if (memcmp(at->in, out, at->in_len) != 0) {
@@ -607,6 +774,96 @@ aes_cbc_test(size_t test_number, const char *label, int key_bits,
607} 774}
608 775
609static int 776static int
777aes_cfb128_test(size_t test_number, const char *label, int key_bits,
778 const struct aes_test *at)
779{
780 AES_KEY key;
781 uint8_t out[64];
782 uint8_t iv[16];
783 int num = 0;
784
785 /* CFB mode has no padding */
786
787 /* Encryption */
788 memset(out, 0, sizeof(out));
789 memcpy(iv, at->iv, at->iv_len);
790 if (AES_set_encrypt_key(at->key, key_bits, &key) != 0) {
791 fprintf(stderr, "FAIL (%s:%zu): AES_set_encrypt_key failed\n", label, test_number);
792 return 0;
793 }
794 AES_cfb128_encrypt(at->in, out, at->in_len, &key, iv, &num, AES_ENCRYPT);
795
796 if (memcmp(at->out, out, at->out_len) != 0) {
797 fprintf(stderr, "FAIL (%s:%zu): encryption mismatch\n",
798 label, test_number);
799 return 0;
800 }
801
802 /* Decryption */
803 memset(out, 0, sizeof(out));
804 memcpy(iv, at->iv, at->iv_len);
805 num = 0;
806 if (AES_set_encrypt_key(at->key, key_bits, &key) != 0) {
807 fprintf(stderr, "FAIL (%s:%zu): AES_set_encrypt_key failed\n", label, test_number);
808 return 0;
809 }
810 AES_cfb128_encrypt(at->out, out, at->out_len, &key, iv, &num, AES_DECRYPT);
811
812 if (memcmp(at->in, out, at->in_len) != 0) {
813 fprintf(stderr, "FAIL (%s:%zu): decryption mismatch\n",
814 label, test_number);
815 return 0;
816 }
817
818 return 1;
819}
820
821static int
822aes_ofb128_test(size_t test_number, const char *label, int key_bits,
823 const struct aes_test *at)
824{
825 AES_KEY key;
826 uint8_t out[64];
827 uint8_t iv[16];
828 int num = 0;
829
830 /* OFB mode has no padding */
831
832 /* Encryption */
833 memset(out, 0, sizeof(out));
834 memcpy(iv, at->iv, at->iv_len);
835 if (AES_set_encrypt_key(at->key, key_bits, &key) != 0) {
836 fprintf(stderr, "FAIL (%s:%zu): AES_set_encrypt_key failed\n", label, test_number);
837 return 0;
838 }
839 AES_ofb128_encrypt(at->in, out, at->in_len, &key, iv, &num);
840
841 if (memcmp(at->out, out, at->out_len) != 0) {
842 fprintf(stderr, "FAIL (%s:%zu): encryption mismatch\n",
843 label, test_number);
844 return 0;
845 }
846
847 /* Decryption */
848 memset(out, 0, sizeof(out));
849 memcpy(iv, at->iv, at->iv_len);
850 num = 0;
851 if (AES_set_encrypt_key(at->key, key_bits, &key) != 0) {
852 fprintf(stderr, "FAIL (%s:%zu): AES_set_encrypt_key failed\n", label, test_number);
853 return 0;
854 }
855 AES_ofb128_encrypt(at->out, out, at->out_len, &key, iv, &num);
856
857 if (memcmp(at->in, out, at->in_len) != 0) {
858 fprintf(stderr, "FAIL (%s:%zu): decryption mismatch\n",
859 label, test_number);
860 return 0;
861 }
862
863 return 1;
864}
865
866static int
610aes_evp_test(size_t test_number, const struct aes_test *at, const char *label, 867aes_evp_test(size_t test_number, const struct aes_test *at, const char *label,
611 int key_bits, const EVP_CIPHER *cipher) 868 int key_bits, const EVP_CIPHER *cipher)
612{ 869{
@@ -649,6 +906,10 @@ aes_evp_test(size_t test_number, const struct aes_test *at, const char *label,
649 if (in_len > at->in_len - i) 906 if (in_len > at->in_len - i)
650 in_len = at->in_len - i; 907 in_len = at->in_len - i;
651 908
909 /* XTS needs to be single shot. */
910 if (EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_XTS_MODE)
911 in_len = at->in_len;
912
652 if (!EVP_EncryptUpdate(ctx, out + total_len, &out_len, 913 if (!EVP_EncryptUpdate(ctx, out + total_len, &out_len,
653 at->in + i, in_len)) { 914 at->in + i, in_len)) {
654 fprintf(stderr, 915 fprintf(stderr,
@@ -715,6 +976,10 @@ aes_evp_test(size_t test_number, const struct aes_test *at, const char *label,
715 if (in_len > at->out_len - i) 976 if (in_len > at->out_len - i)
716 in_len = at->out_len - i; 977 in_len = at->out_len - i;
717 978
979 /* XTS needs to be single shot. */
980 if (EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_XTS_MODE)
981 in_len = at->in_len;
982
718 if (!EVP_DecryptUpdate(ctx, out + total_len, &out_len, 983 if (!EVP_DecryptUpdate(ctx, out + total_len, &out_len,
719 at->out + i, in_len)) { 984 at->out + i, in_len)) {
720 fprintf(stderr, 985 fprintf(stderr,
@@ -881,6 +1146,16 @@ aes_cipher_from_nid(int nid, const char **out_label,
881 *out_cipher = EVP_aes_256_ccm(); 1146 *out_cipher = EVP_aes_256_ccm();
882 break; 1147 break;
883 1148
1149 /* XTS */
1150 case NID_aes_128_xts:
1151 *out_label = SN_aes_128_xts;
1152 *out_cipher = EVP_aes_128_xts();
1153 break;
1154 case NID_aes_256_xts:
1155 *out_label = SN_aes_256_xts;
1156 *out_cipher = EVP_aes_256_xts();
1157 break;
1158
884 /* Unknown */ 1159 /* Unknown */
885 default: 1160 default:
886 return 0; 1161 return 0;
@@ -902,8 +1177,10 @@ aes_test(void)
902 for (i = 0; i < N_AES_TESTS; i++) { 1177 for (i = 0; i < N_AES_TESTS; i++) {
903 at = &aes_tests[i]; 1178 at = &aes_tests[i];
904 key_bits = aes_key_bits_from_nid(at->mode); 1179 key_bits = aes_key_bits_from_nid(at->mode);
905 if (!aes_cipher_from_nid(at->mode, &label, &cipher)) 1180 if (!aes_cipher_from_nid(at->mode, &label, &cipher)) {
1181 fprintf(stderr, "unknown cipher\n");
906 goto failed; 1182 goto failed;
1183 }
907 1184
908 switch (at->mode) { 1185 switch (at->mode) {
909 /* ECB */ 1186 /* ECB */
@@ -926,14 +1203,16 @@ aes_test(void)
926 case NID_aes_128_cfb128: 1203 case NID_aes_128_cfb128:
927 case NID_aes_192_cfb128: 1204 case NID_aes_192_cfb128:
928 case NID_aes_256_cfb128: 1205 case NID_aes_256_cfb128:
929 /* XXX - CFB128 non-EVP tests */ 1206 if (!aes_cfb128_test(i, label, key_bits, at))
1207 goto failed;
930 break; 1208 break;
931 1209
932 /* OFB128 */ 1210 /* OFB128 */
933 case NID_aes_128_ofb128: 1211 case NID_aes_128_ofb128:
934 case NID_aes_192_ofb128: 1212 case NID_aes_192_ofb128:
935 case NID_aes_256_ofb128: 1213 case NID_aes_256_ofb128:
936 /* XXX - OFB128 non-EVP tests */ 1214 if (!aes_ofb128_test(i, label, key_bits, at))
1215 goto failed;
937 break; 1216 break;
938 1217
939 /* GCM */ 1218 /* GCM */
@@ -947,7 +1226,13 @@ aes_test(void)
947 case NID_aes_128_ccm: 1226 case NID_aes_128_ccm:
948 case NID_aes_192_ccm: 1227 case NID_aes_192_ccm:
949 case NID_aes_256_ccm: 1228 case NID_aes_256_ccm:
950 /* XXX - CCM non-EVP tests */ 1229 /* CCM is EVP-only */
1230 break;
1231
1232 /* XTS */
1233 case NID_aes_128_xts:
1234 case NID_aes_256_xts:
1235 /* XTS is EVP-only */
951 break; 1236 break;
952 1237
953 /* Unknown */ 1238 /* Unknown */
diff --git a/src/regress/lib/libcrypto/asn1/asn1time.c b/src/regress/lib/libcrypto/asn1/asn1time.c
index 7223ad9c9b..e0e5139808 100644
--- a/src/regress/lib/libcrypto/asn1/asn1time.c
+++ b/src/regress/lib/libcrypto/asn1/asn1time.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1time.c,v 1.30 2024/07/21 13:25:11 tb Exp $ */ 1/* $OpenBSD: asn1time.c,v 1.31 2025/05/22 04:54:14 joshua Exp $ */
2/* 2/*
3 * Copyright (c) 2015 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2015 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2024 Google Inc. 4 * Copyright (c) 2024 Google Inc.
@@ -33,6 +33,7 @@ struct asn1_time_test {
33 const char *data; 33 const char *data;
34 const unsigned char der[32]; 34 const unsigned char der[32];
35 time_t time; 35 time_t time;
36 int generalized_time;
36}; 37};
37 38
38static const struct asn1_time_test asn1_invtime_tests[] = { 39static const struct asn1_time_test asn1_invtime_tests[] = {
@@ -73,20 +74,19 @@ static const struct asn1_time_test asn1_invtime_tests[] = {
73 { 74 {
74 .str = "aaaaaaaaaaaaaaZ", 75 .str = "aaaaaaaaaaaaaaZ",
75 }, 76 },
76 /* utc time with omitted seconds, should fail */
77 { 77 {
78 /* UTC time with omitted seconds, should fail */
78 .str = "1609082343Z", 79 .str = "1609082343Z",
79 }, 80 },
80};
81
82static const struct asn1_time_test asn1_invgentime_tests[] = {
83 /* Generalized time with omitted seconds, should fail */
84 { 81 {
82 /* Generalized time with omitted seconds, should fail */
85 .str = "201612081934Z", 83 .str = "201612081934Z",
84 .generalized_time = 1,
86 }, 85 },
87 /* Valid UTC time, should fail as a generalized time */
88 { 86 {
87 /* Valid UTC time, should fail as a generalized time */
89 .str = "160908234300Z", 88 .str = "160908234300Z",
89 .generalized_time = 1,
90 }, 90 },
91}; 91};
92 92
@@ -235,7 +235,7 @@ asn1_compare_str(int test_no, const struct asn1_string_st *asn1str,
235} 235}
236 236
237static int 237static int
238asn1_invtime_test(int test_no, const struct asn1_time_test *att, int gen) 238asn1_invtime_test(int test_no, const struct asn1_time_test *att)
239{ 239{
240 ASN1_GENERALIZEDTIME *gt = NULL; 240 ASN1_GENERALIZEDTIME *gt = NULL;
241 ASN1_UTCTIME *ut = NULL; 241 ASN1_UTCTIME *ut = NULL;
@@ -255,7 +255,7 @@ asn1_invtime_test(int test_no, const struct asn1_time_test *att, int gen)
255 goto done; 255 goto done;
256 } 256 }
257 257
258 if (gen) { 258 if (att->generalized_time) {
259 failure = 0; 259 failure = 0;
260 goto done; 260 goto done;
261 } 261 }
@@ -842,13 +842,7 @@ main(int argc, char **argv)
842 fprintf(stderr, "Invalid time tests...\n"); 842 fprintf(stderr, "Invalid time tests...\n");
843 for (i = 0; i < N_INVTIME_TESTS; i++) { 843 for (i = 0; i < N_INVTIME_TESTS; i++) {
844 att = &asn1_invtime_tests[i]; 844 att = &asn1_invtime_tests[i];
845 failed |= asn1_invtime_test(i, att, 0); 845 failed |= asn1_invtime_test(i, att);
846 }
847
848 fprintf(stderr, "Invalid generalized time tests...\n");
849 for (i = 0; i < N_INVGENTIME_TESTS; i++) {
850 att = &asn1_invgentime_tests[i];
851 failed |= asn1_invtime_test(i, att, 1);
852 } 846 }
853 847
854 fprintf(stderr, "GENERALIZEDTIME tests...\n"); 848 fprintf(stderr, "GENERALIZEDTIME tests...\n");
diff --git a/src/regress/lib/libcrypto/bio/bio_dump.c b/src/regress/lib/libcrypto/bio/bio_dump.c
index 22db80fa3d..fd2bb285fb 100644
--- a/src/regress/lib/libcrypto/bio/bio_dump.c
+++ b/src/regress/lib/libcrypto/bio/bio_dump.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_dump.c,v 1.4 2024/02/09 12:48:32 tb Exp $ */ 1/* $OpenBSD: bio_dump.c,v 1.5 2025/05/18 06:41:51 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> 3 * Copyright (c) 2024 Theo Buehler <tb@openbsd.org>
4 * 4 *
@@ -809,7 +809,7 @@ bio_dump_test(const struct bio_dump_testcase *tc)
809 tc->indent, ret, got_len, strlen(tc->output)); 809 tc->indent, ret, got_len, strlen(tc->output));
810 goto err; 810 goto err;
811 } 811 }
812 if (strncmp(tc->output, got, got_len) != 0) { 812 if (got_len > 0 && strncmp(tc->output, got, got_len) != 0) {
813 fprintf(stderr, "%d: mismatch\n", tc->indent); 813 fprintf(stderr, "%d: mismatch\n", tc->indent);
814 goto err; 814 goto err;
815 } 815 }
diff --git a/src/regress/lib/libcrypto/c2sp/Makefile b/src/regress/lib/libcrypto/c2sp/Makefile
index 9b2c944ba4..73ee0b8c22 100644
--- a/src/regress/lib/libcrypto/c2sp/Makefile
+++ b/src/regress/lib/libcrypto/c2sp/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.4 2024/10/28 16:27:14 tb Exp $ 1# $OpenBSD: Makefile,v 1.7 2025/07/23 07:35:21 tb Exp $
2 2
3C2SP_TESTVECTORS = /usr/local/share/c2sp-testvectors/ 3C2SP_TESTVECTORS = /usr/local/share/c2sp-testvectors/
4 4
@@ -13,12 +13,12 @@ PROGS += cctv
13SRCS_cctv = 13SRCS_cctv =
14 14
15cctv: cctv.go 15cctv: cctv.go
16 go build -o $@ ${.CURDIR}/cctv.go 16 env GOCACHE=${.OBJDIR}/go-build go build -o $@ ${.CURDIR}/cctv.go
17 17
18OSSL_LIB = /usr/local/lib/eopenssl 18OSSL_LIB = /usr/local/lib/eopenssl
19OSSL_INC = /usr/local/include/eopenssl 19OSSL_INC = /usr/local/include/eopenssl
20 20
21. for V in 11 32 33 34 21. for V in 35
22. if exists(/usr/local/bin/eopenssl$V) 22. if exists(/usr/local/bin/eopenssl$V)
23PROGS += cctv-openssl$V 23PROGS += cctv-openssl$V
24SRCS_cctv-openssl$V = 24SRCS_cctv-openssl$V =
@@ -29,10 +29,17 @@ CGO_LDFLAGS_$V += -L${OSSL_LIB}$V
29 29
30cctv-openssl$V: cctv.go 30cctv-openssl$V: cctv.go
31 env CGO_CFLAGS="${CGO_CFLAGS_$V}" CGO_LDFLAGS="${CGO_LDFLAGS_$V}" \ 31 env CGO_CFLAGS="${CGO_CFLAGS_$V}" CGO_LDFLAGS="${CGO_LDFLAGS_$V}" \
32 GOCACHE=${.OBJDIR}/go-build \
32 go build -o $@ ${.CURDIR}/cctv.go 33 go build -o $@ ${.CURDIR}/cctv.go
33. endif 34. endif
34. endfor 35. endfor
35 36
37REGRESS_CLEANUP = clean-go-cache
38
39clean-go-cache:
40 env GOCACHE=${.OBJDIR}/go-build go clean -cache
41 rm -rf ${.OBJDIR}/go-build
42
36.endif 43.endif
37 44
38.include <bsd.regress.mk> 45.include <bsd.regress.mk>
diff --git a/src/regress/lib/libcrypto/certs/Makefile b/src/regress/lib/libcrypto/certs/Makefile
index 621c60907f..f7ba9fcad8 100644
--- a/src/regress/lib/libcrypto/certs/Makefile
+++ b/src/regress/lib/libcrypto/certs/Makefile
@@ -1,21 +1,24 @@
1# $OpenBSD: Makefile,v 1.1 2020/07/14 18:27:28 jsing Exp $ 1# $OpenBSD: Makefile,v 1.2 2025/07/09 05:04:35 tb Exp $
2 2
3.if ! (make(clean) || make(cleandir) || make(obj)) 3.if !exists(/usr/local/bin/go)
4GO_VERSION != sh -c "(go version) 2>/dev/null || true"
5.endif
6
7.if empty(GO_VERSION)
8regress: 4regress:
9 @echo package go is required for this regress 5 @echo package go is required for this regress
10 @echo SKIPPED 6 @echo SKIPPED
11.endif 7.else
12 8
13REGRESS_TARGETS=regress-go-verify 9REGRESS_TARGETS=regress-go-verify
10REGRESS_CLEANUP=clean-go-cache
14 11
15certs: 12certs:
16 cd ${.CURDIR} && sh ./make-certs.sh 13 cd ${.CURDIR} && sh ./make-certs.sh
17 14
18regress-go-verify: 15regress-go-verify:
19 cd ${.CURDIR} && go test -test.v . 16 cd ${.CURDIR} && env GOCACHE=${.OBJDIR}/go-build go test -test.v .
17
18clean-go-cache:
19 env GOCACHE=${.OBJDIR}/go-build go clean -cache
20 rm -rf ${.OBJDIR}/go-build
21
22.endif
20 23
21.include <bsd.regress.mk> 24.include <bsd.regress.mk>
diff --git a/src/regress/lib/libcrypto/ec/Makefile b/src/regress/lib/libcrypto/ec/Makefile
index b21eacb4bc..1d976c77d0 100644
--- a/src/regress/lib/libcrypto/ec/Makefile
+++ b/src/regress/lib/libcrypto/ec/Makefile
@@ -1,12 +1,13 @@
1# $OpenBSD: Makefile,v 1.11 2025/03/08 20:09:35 tb Exp $ 1# $OpenBSD: Makefile,v 1.13 2025/08/03 08:29:39 jsing Exp $
2 2
3.ifdef EOPENSSL33 3.ifdef EOPENSSL35
4LDADD += -Wl,-rpath,/usr/local/lib/eopenssl33 -L/usr/local/lib/eopenssl33 4LDADD += -Wl,-rpath,/usr/local/lib/eopenssl35 -L/usr/local/lib/eopenssl35
5CFLAGS += -I/usr/local/include/eopenssl33/ 5CFLAGS += -I/usr/local/include/eopenssl35/
6CFLAGS += -DOPENSSL_SUPPRESS_DEPRECATED 6CFLAGS += -DOPENSSL_SUPPRESS_DEPRECATED
7.endif 7.endif
8 8
9PROGS += ectest 9PROGS += ectest
10PROGS += ec_arithmetic
10PROGS += ec_asn1_test 11PROGS += ec_asn1_test
11PROGS += ec_point_conversion 12PROGS += ec_point_conversion
12 13
diff --git a/src/regress/lib/libcrypto/ec/ec_arithmetic.c b/src/regress/lib/libcrypto/ec/ec_arithmetic.c
new file mode 100644
index 0000000000..c6f7cd4f8c
--- /dev/null
+++ b/src/regress/lib/libcrypto/ec/ec_arithmetic.c
@@ -0,0 +1,210 @@
1/* $OpenBSD: ec_arithmetic.c,v 1.1 2025/08/03 08:29:39 jsing Exp $ */
2/*
3 * Copyright (c) 2022,2025 Joel Sing <jsing@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#include <sys/time.h>
19
20#include <err.h>
21#include <signal.h>
22#include <stdio.h>
23#include <string.h>
24#include <time.h>
25#include <unistd.h>
26
27#include <openssl/bn.h>
28#include <openssl/ec.h>
29#include <openssl/objects.h>
30
31static void
32benchmark_ec_point_add(const EC_GROUP *group, EC_POINT *result,
33 const BIGNUM *scalar, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx)
34{
35 if (!EC_POINT_add(group, result, a, b, ctx))
36 errx(1, "EC_POINT_add");
37}
38
39static void
40benchmark_ec_point_dbl(const EC_GROUP *group, EC_POINT *result,
41 const BIGNUM *scalar, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx)
42{
43 if (!EC_POINT_dbl(group, result, a, ctx))
44 errx(1, "EC_POINT_dbl");
45}
46
47static void
48benchmark_ec_point_mul_generator(const EC_GROUP *group, EC_POINT *result,
49 const BIGNUM *scalar, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx)
50{
51 if (!EC_POINT_mul(group, result, scalar, NULL, NULL, ctx))
52 errx(1, "EC_POINT_mul");
53}
54
55struct benchmark {
56 int curve;
57 const char *desc;
58 void (*func)(const EC_GROUP *, EC_POINT *, const BIGNUM *,
59 const EC_POINT *, const EC_POINT *, BN_CTX *);
60};
61
62static const struct benchmark benchmarks[] = {
63 {
64 .curve = NID_X9_62_prime256v1,
65 .desc = "EC_POINT_add() p256",
66 .func = benchmark_ec_point_add,
67 },
68 {
69 .curve = NID_secp384r1,
70 .desc = "EC_POINT_add() p384",
71 .func = benchmark_ec_point_add,
72 },
73 {
74 .curve = NID_secp521r1,
75 .desc = "EC_POINT_add() p521",
76 .func = benchmark_ec_point_add,
77 },
78 {
79 .curve = NID_X9_62_prime256v1,
80 .desc = "EC_POINT_dbl() p256",
81 .func = benchmark_ec_point_dbl,
82 },
83 {
84 .curve = NID_secp384r1,
85 .desc = "EC_POINT_dbl() p384",
86 .func = benchmark_ec_point_dbl,
87 },
88 {
89 .curve = NID_secp521r1,
90 .desc = "EC_POINT_dbl() p521",
91 .func = benchmark_ec_point_dbl,
92 },
93 {
94 .curve = NID_X9_62_prime256v1,
95 .desc = "EC_POINT_mul() generator p256",
96 .func = benchmark_ec_point_mul_generator,
97 },
98 {
99 .curve = NID_secp384r1,
100 .desc = "EC_POINT_mul() generator p384",
101 .func = benchmark_ec_point_mul_generator,
102 },
103 {
104 .curve = NID_secp521r1,
105 .desc = "EC_POINT_mul() generator p521",
106 .func = benchmark_ec_point_mul_generator,
107 },
108};
109
110#define N_BENCHMARKS (sizeof(benchmarks) / sizeof(benchmarks[0]))
111
112static volatile sig_atomic_t benchmark_stop;
113
114static void
115benchmark_sig_alarm(int sig)
116{
117 benchmark_stop = 1;
118}
119
120static void
121benchmark_run(const struct benchmark *bm, int seconds)
122{
123 struct timespec start, end, duration;
124 EC_GROUP *group = NULL;
125 EC_POINT *a = NULL, *b = NULL, *result = NULL;
126 BIGNUM *order = NULL, *scalar = NULL;
127 BN_CTX *ctx = NULL;
128 int i;
129
130 signal(SIGALRM, benchmark_sig_alarm);
131
132 if ((ctx = BN_CTX_new()) == NULL)
133 errx(1, "BN_CTX_new");
134
135 if ((group = EC_GROUP_new_by_curve_name(bm->curve)) == NULL)
136 errx(1, "EC_GROUP_new_by_curve_name");
137 if ((order = BN_new()) == NULL)
138 errx(1, "BN_new");
139 if (!EC_GROUP_get_order(group, order, ctx))
140 errx(1, "EC_GROUP_get_order");
141
142 if ((scalar = BN_new()) == NULL)
143 errx(1, "BN_new");
144 if (!BN_rand_range(scalar, order))
145 errx(1, "BN_rand_range");
146 if (!BN_set_bit(scalar, EC_GROUP_order_bits(group) - 1))
147 errx(1, "BN_set_bit");
148
149 if ((result = EC_POINT_new(group)) == NULL)
150 errx(1, "EC_POINT_new");
151 if ((a = EC_POINT_new(group)) == NULL)
152 errx(1, "EC_POINT_new");
153 if ((b = EC_POINT_new(group)) == NULL)
154 errx(1, "EC_POINT_new");
155
156 if (!EC_POINT_mul(group, a, scalar, NULL, NULL, ctx))
157 errx(1, "EC_POINT_mul");
158 if (!EC_POINT_mul(group, b, scalar, NULL, NULL, ctx))
159 errx(1, "EC_POINT_mul");
160
161 benchmark_stop = 0;
162 i = 0;
163 alarm(seconds);
164
165 clock_gettime(CLOCK_MONOTONIC, &start);
166
167 fprintf(stderr, "Benchmarking %s for %ds: ", bm->desc, seconds);
168 while (!benchmark_stop) {
169 bm->func(group, result, scalar, a, b, ctx);
170 i++;
171 }
172 clock_gettime(CLOCK_MONOTONIC, &end);
173 timespecsub(&end, &start, &duration);
174 fprintf(stderr, "%d iterations in %f seconds\n", i,
175 duration.tv_sec + duration.tv_nsec / 1000000000.0);
176
177 EC_GROUP_free(group);
178 EC_POINT_free(result);
179 EC_POINT_free(a);
180 EC_POINT_free(b);
181 BN_free(order);
182 BN_free(scalar);
183 BN_CTX_free(ctx);
184}
185
186static void
187benchmark_ec_mul_single(void)
188{
189 const struct benchmark *bm;
190 size_t i;
191
192 for (i = 0; i < N_BENCHMARKS; i++) {
193 bm = &benchmarks[i];
194 benchmark_run(bm, 5);
195 }
196}
197
198int
199main(int argc, char **argv)
200{
201 int benchmark = 0, failed = 0;
202
203 if (argc == 2 && strcmp(argv[1], "--benchmark") == 0)
204 benchmark = 1;
205
206 if (benchmark && !failed)
207 benchmark_ec_mul_single();
208
209 return failed;
210}
diff --git a/src/regress/lib/libcrypto/ec/ec_asn1_test.c b/src/regress/lib/libcrypto/ec/ec_asn1_test.c
index 03358e69ca..50e6304baf 100644
--- a/src/regress/lib/libcrypto/ec/ec_asn1_test.c
+++ b/src/regress/lib/libcrypto/ec/ec_asn1_test.c
@@ -1,7 +1,7 @@
1/* $OpenBSD: ec_asn1_test.c,v 1.32 2025/03/08 20:09:35 tb Exp $ */ 1/* $OpenBSD: ec_asn1_test.c,v 1.36 2025/07/23 07:42:33 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2017, 2021 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2017, 2021 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> 4 * Copyright (c) 2024, 2025 Theo Buehler <tb@openbsd.org>
5 * 5 *
6 * Permission to use, copy, modify, and distribute this software for any 6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above 7 * purpose with or without fee is hereby granted, provided that the above
@@ -17,12 +17,17 @@
17 */ 17 */
18 18
19#include <err.h> 19#include <err.h>
20#include <stdio.h>
21#include <stdint.h>
22#include <stdlib.h>
20#include <string.h> 23#include <string.h>
21 24
22#include <openssl/bio.h> 25#include <openssl/bio.h>
26#include <openssl/bn.h>
23#include <openssl/ec.h> 27#include <openssl/ec.h>
24#include <openssl/err.h> 28#include <openssl/err.h>
25#include <openssl/objects.h> 29#include <openssl/objects.h>
30#include <openssl/sha.h>
26 31
27#include "ec_local.h" 32#include "ec_local.h"
28 33
@@ -1281,126 +1286,6 @@ static const struct ec_private_key {
1281 }, 1286 },
1282 }, 1287 },
1283 { 1288 {
1284 .name = "prime239v1",
1285 .der_len = 115,
1286 .der = {
1287 0x30, 0x71, 0x02, 0x01, 0x01, 0x04, 0x1e, 0x6e,
1288 0x26, 0x5e, 0xde, 0x5b, 0x67, 0xd6, 0x38, 0x52,
1289 0xe7, 0x1e, 0x8d, 0x44, 0xb1, 0xfb, 0xf8, 0xaf,
1290 0xf9, 0x94, 0x2c, 0xe2, 0x0d, 0xa8, 0x5f, 0x03,
1291 0x67, 0x53, 0x7b, 0x8b, 0x2e, 0xa0, 0x0a, 0x06,
1292 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01,
1293 0x04, 0xa1, 0x40, 0x03, 0x3e, 0x00, 0x04, 0x33,
1294 0xc6, 0xe5, 0x8a, 0xc1, 0x8b, 0x7c, 0x96, 0x19,
1295 0xc9, 0xe1, 0x54, 0x7f, 0x81, 0x9e, 0x59, 0x62,
1296 0xec, 0xc0, 0x1e, 0xe5, 0x53, 0xd5, 0xae, 0x6b,
1297 0xd3, 0xe0, 0x09, 0x07, 0xc5, 0x27, 0x81, 0xa6,
1298 0x8d, 0x39, 0x8e, 0xfe, 0x01, 0xc2, 0x1d, 0xda,
1299 0xde, 0x7b, 0xdc, 0x76, 0x27, 0x17, 0xf9, 0x6f,
1300 0xe3, 0x04, 0xef, 0x5d, 0x65, 0x75, 0x98, 0x7f,
1301 0x2d, 0xd0, 0x68,
1302 },
1303 .hex = "0433C6E58AC18B7C"
1304 "9619C9E1547F819E"
1305 "5962ECC01EE553D5"
1306 "AE6BD3E00907C527"
1307 "81A68D398EFE01C2"
1308 "1DDADE7BDC762717"
1309 "F96FE304EF5D6575"
1310 "987F2DD068",
1311 .oct_len = 61,
1312 .oct = {
1313 0x04, 0x33, 0xc6, 0xe5, 0x8a, 0xc1, 0x8b, 0x7c,
1314 0x96, 0x19, 0xc9, 0xe1, 0x54, 0x7f, 0x81, 0x9e,
1315 0x59, 0x62, 0xec, 0xc0, 0x1e, 0xe5, 0x53, 0xd5,
1316 0xae, 0x6b, 0xd3, 0xe0, 0x09, 0x07, 0xc5, 0x27,
1317 0x81, 0xa6, 0x8d, 0x39, 0x8e, 0xfe, 0x01, 0xc2,
1318 0x1d, 0xda, 0xde, 0x7b, 0xdc, 0x76, 0x27, 0x17,
1319 0xf9, 0x6f, 0xe3, 0x04, 0xef, 0x5d, 0x65, 0x75,
1320 0x98, 0x7f, 0x2d, 0xd0, 0x68,
1321 },
1322 },
1323 {
1324 .name = "prime239v2",
1325 .der_len = 115,
1326 .der = {
1327 0x30, 0x71, 0x02, 0x01, 0x01, 0x04, 0x1e, 0x30,
1328 0x2f, 0x01, 0x10, 0xe9, 0x09, 0x15, 0xdd, 0xe3,
1329 0xdd, 0xae, 0xcb, 0x9d, 0x3a, 0x58, 0x92, 0x02,
1330 0x1e, 0x6e, 0x02, 0x57, 0xa8, 0x36, 0x0b, 0x20,
1331 0x0b, 0x7e, 0xf4, 0xad, 0x0b, 0xa0, 0x0a, 0x06,
1332 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01,
1333 0x05, 0xa1, 0x40, 0x03, 0x3e, 0x00, 0x04, 0x3c,
1334 0x10, 0x27, 0x7b, 0xac, 0xdf, 0x86, 0xc9, 0x4f,
1335 0xf8, 0x39, 0x87, 0x02, 0x39, 0xaf, 0x41, 0xbc,
1336 0x4b, 0x67, 0xd8, 0x5e, 0x04, 0x96, 0x84, 0xb5,
1337 0x60, 0x50, 0x48, 0x6a, 0x20, 0x1d, 0x2b, 0x7e,
1338 0x9f, 0xaf, 0xf8, 0x8e, 0x7e, 0xa4, 0xcd, 0x00,
1339 0xad, 0xb1, 0xad, 0x22, 0x69, 0x32, 0x10, 0x6c,
1340 0xe0, 0xcc, 0xdd, 0x45, 0xd8, 0xa6, 0x29, 0x2f,
1341 0xad, 0x6b, 0xf9,
1342 },
1343 .hex = "043C10277BACDF86"
1344 "C94FF839870239AF"
1345 "41BC4B67D85E0496"
1346 "84B56050486A201D"
1347 "2B7E9FAFF88E7EA4"
1348 "CD00ADB1AD226932"
1349 "106CE0CCDD45D8A6"
1350 "292FAD6BF9",
1351 .oct_len = 61,
1352 .oct = {
1353 0x04, 0x3c, 0x10, 0x27, 0x7b, 0xac, 0xdf, 0x86,
1354 0xc9, 0x4f, 0xf8, 0x39, 0x87, 0x02, 0x39, 0xaf,
1355 0x41, 0xbc, 0x4b, 0x67, 0xd8, 0x5e, 0x04, 0x96,
1356 0x84, 0xb5, 0x60, 0x50, 0x48, 0x6a, 0x20, 0x1d,
1357 0x2b, 0x7e, 0x9f, 0xaf, 0xf8, 0x8e, 0x7e, 0xa4,
1358 0xcd, 0x00, 0xad, 0xb1, 0xad, 0x22, 0x69, 0x32,
1359 0x10, 0x6c, 0xe0, 0xcc, 0xdd, 0x45, 0xd8, 0xa6,
1360 0x29, 0x2f, 0xad, 0x6b, 0xf9,
1361 },
1362 },
1363 {
1364 .name = "prime239v3",
1365 .der_len = 115,
1366 .der = {
1367 0x30, 0x71, 0x02, 0x01, 0x01, 0x04, 0x1e, 0x26,
1368 0x3f, 0x23, 0x4c, 0xe7, 0xbd, 0xa8, 0xe4, 0xfe,
1369 0x7c, 0xf6, 0x18, 0x6a, 0xb2, 0xa6, 0x39, 0x15,
1370 0x6d, 0x72, 0xe8, 0x9e, 0x3f, 0x0f, 0x10, 0x1e,
1371 0xe5, 0xdf, 0xac, 0xe8, 0x2f, 0xa0, 0x0a, 0x06,
1372 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01,
1373 0x06, 0xa1, 0x40, 0x03, 0x3e, 0x00, 0x04, 0x37,
1374 0xba, 0x07, 0x7f, 0xd9, 0x46, 0x5a, 0x33, 0x03,
1375 0x31, 0x77, 0x38, 0xef, 0xee, 0xcc, 0x3d, 0xe1,
1376 0xaa, 0x57, 0xe3, 0x8d, 0xb7, 0xcd, 0xe3, 0x01,
1377 0xf4, 0xd6, 0x75, 0x49, 0x72, 0x61, 0x4c, 0xbf,
1378 0xc0, 0x1f, 0x8b, 0x5f, 0x98, 0x9b, 0xa7, 0xe5,
1379 0x6a, 0xb7, 0xfe, 0x63, 0xdb, 0xb0, 0x40, 0xcb,
1380 0x26, 0x81, 0x2a, 0x91, 0x14, 0x0f, 0xc7, 0x31,
1381 0x13, 0x78, 0x16,
1382 },
1383 .hex = "0437BA077FD9465A"
1384 "3303317738EFEECC"
1385 "3DE1AA57E38DB7CD"
1386 "E301F4D675497261"
1387 "4CBFC01F8B5F989B"
1388 "A7E56AB7FE63DBB0"
1389 "40CB26812A91140F"
1390 "C731137816",
1391 .oct_len = 61,
1392 .oct = {
1393 0x04, 0x37, 0xba, 0x07, 0x7f, 0xd9, 0x46, 0x5a,
1394 0x33, 0x03, 0x31, 0x77, 0x38, 0xef, 0xee, 0xcc,
1395 0x3d, 0xe1, 0xaa, 0x57, 0xe3, 0x8d, 0xb7, 0xcd,
1396 0xe3, 0x01, 0xf4, 0xd6, 0x75, 0x49, 0x72, 0x61,
1397 0x4c, 0xbf, 0xc0, 0x1f, 0x8b, 0x5f, 0x98, 0x9b,
1398 0xa7, 0xe5, 0x6a, 0xb7, 0xfe, 0x63, 0xdb, 0xb0,
1399 0x40, 0xcb, 0x26, 0x81, 0x2a, 0x91, 0x14, 0x0f,
1400 0xc7, 0x31, 0x13, 0x78, 0x16,
1401 },
1402 },
1403 {
1404 .name = "prime256v1", 1289 .name = "prime256v1",
1405 .der_len = 121, 1290 .der_len = 121,
1406 .der = { 1291 .der = {
@@ -2468,6 +2353,197 @@ ec_group_check_private_keys(void)
2468 return failed; 2353 return failed;
2469} 2354}
2470 2355
2356static void
2357ec_group_sha1_bignum(BIGNUM *out, const BIGNUM *in)
2358{
2359 char md[SHA_DIGEST_LENGTH];
2360 unsigned char *bin;
2361 size_t bin_len;
2362
2363 if (BN_num_bytes(in) <= 0)
2364 errx(1, "%s: invalid bignum", __func__);
2365
2366 bin_len = BN_num_bytes(in);
2367 if ((bin = calloc(1, bin_len)) == NULL)
2368 err(1, "calloc");
2369 if (BN_bn2bin(in, bin) <= 0)
2370 errx(1, "BN_bn2bin");
2371
2372 SHA1(bin, bin_len, md);
2373 free(bin);
2374
2375 if (BN_bin2bn(md, sizeof(md), out) == NULL)
2376 errx(1, "BN_bin2bn");
2377}
2378
2379static int
2380ec_group_check_seed(const EC_builtin_curve *curve, BN_CTX *ctx)
2381{
2382 EC_GROUP *group = NULL;
2383 BIGNUM *p, *a, *b, *pow2, *r, *seed_bn, *w;
2384 const unsigned char *seed;
2385 size_t seed_len;
2386 int i, g, h, s, t;
2387 int failed = 1;
2388
2389 if ((group = EC_GROUP_new_by_curve_name(curve->nid)) == NULL)
2390 errx(1, "EC_GROUP_new_by_curve_name");
2391
2392 BN_CTX_start(ctx);
2393
2394 if ((p = BN_CTX_get(ctx)) == NULL)
2395 errx(1, "p = BN_CTX_get()");
2396 if ((a = BN_CTX_get(ctx)) == NULL)
2397 errx(1, "a = BN_CTX_get()");
2398 if ((b = BN_CTX_get(ctx)) == NULL)
2399 errx(1, "b = BN_CTX_get()");
2400 if ((r = BN_CTX_get(ctx)) == NULL)
2401 errx(1, "r = BN_CTX_get()");
2402 if ((pow2 = BN_CTX_get(ctx)) == NULL)
2403 errx(1, "pow2 = BN_CTX_get()");
2404 if ((seed_bn = BN_CTX_get(ctx)) == NULL)
2405 errx(1, "seed_bn = BN_CTX_get()");
2406 if ((w = BN_CTX_get(ctx)) == NULL)
2407 errx(1, "w = BN_CTX_get()");
2408
2409 /*
2410 * If the curve has a seed, verify that its parameters a and b have
2411 * been selected using that seed, loosely following X9.62, F.3.4.b.
2412 * Otherwise there's nothing to do.
2413 */
2414 if ((seed = EC_GROUP_get0_seed(group)) == NULL)
2415 goto done;
2416 seed_len = EC_GROUP_get_seed_len(group);
2417
2418 /*
2419 * This isn't a requirement but happens to be the case for NIST
2420 * curves - the only built-in curves that have a seed.
2421 */
2422 if (seed_len != SHA_DIGEST_LENGTH) {
2423 fprintf(stderr, "%s FAIL: unexpected seed length. "
2424 "want %d, got %zu\n", __func__, SHA_DIGEST_LENGTH, seed_len);
2425 goto err;
2426 }
2427
2428 /* Seed length in bits, per F.3.3.b. */
2429 g = 8 * seed_len;
2430
2431 /*
2432 * Prepare to build the verifiably random element r of GFp by
2433 * concatenating the SHA-1 of modifications of the seed as a number.
2434 */
2435 if (BN_bin2bn(seed, seed_len, seed_bn) == NULL)
2436 errx(1, "BN_bin2bn");
2437
2438 if (!EC_GROUP_get_curve(group, p, a, b, ctx))
2439 errx(1, "EC_GROUP_get_curve");
2440
2441 t = BN_num_bits(p); /* bit length needed. */
2442 s = (t - 1) / 160; /* number of SHA-1 fitting in bit length. */
2443 h = t - 160 * s; /* remaining number of bits in r. */
2444
2445 /*
2446 * Steps 1 - 3: compute hash of the seed and take h - 1 rightmost bits.
2447 */
2448
2449 ec_group_sha1_bignum(r, seed_bn);
2450 BN_zero(pow2);
2451 if (!BN_set_bit(pow2, h - 1))
2452 errx(1, "BN_set_bit");
2453 if (!BN_mod(r, r, pow2, ctx))
2454 errx(1, "BN_nnmod");
2455
2456 /*
2457 * Steps 4 - 6: for i from 1 to s do Wi = SHA-1(SEED + i mod 2^g),
2458 * With W0 = r as already computed, let r = W0 || W1 || ... || Ws.
2459 */
2460
2461 BN_zero(pow2);
2462 if (!BN_set_bit(pow2, g))
2463 errx(1, "BN_set_bit");
2464
2465 for (i = 0; i < s; i++) {
2466 /*
2467 * This is a bit silly since the seed isn't going to have all
2468 * its bits set, so BN_add_word(seed_bn, 1) would do, but for
2469 * the sake of correctness...
2470 */
2471 if (!BN_mod_add(seed_bn, seed_bn, BN_value_one(), pow2, ctx))
2472 errx(1, "BN_mod_add");
2473
2474 ec_group_sha1_bignum(w, seed_bn);
2475
2476 if (!BN_lshift(r, r, 8 * SHA_DIGEST_LENGTH))
2477 errx(1, "BN_lshift");
2478 if (!BN_add(r, r, w))
2479 errx(1, "BN_add");
2480 }
2481
2482 /*
2483 * Step 7: check that r * b^2 == a^3 (mod p)
2484 */
2485
2486 /* Compute r = r * b^2 (mod p). */
2487 if (!BN_mod_sqr(b, b, p, ctx))
2488 errx(1, "BN_mod_sqr");
2489 if (!BN_mod_mul(r, r, b, p, ctx))
2490 errx(1, "BN_mod_mul");
2491
2492 /* Compute a = a^3 (mod p). */
2493 if (!BN_mod_sqr(b, a, p, ctx))
2494 errx(1, "BN_mod_sqr");
2495 if (!BN_mod_mul(a, a, b, p, ctx))
2496 errx(1, "BN_mod_mul");
2497
2498 /*
2499 * XXX - this assumes that a, b, p >= 0, so the results are in [0, p).
2500 * This is currently enforced in the EC code.
2501 */
2502 if (BN_cmp(r, a) != 0) {
2503 fprintf(stderr, "FAIL: %s verification failed for %s\nr * b^2:\t",
2504 __func__, curve->comment);
2505 BN_print_fp(stderr, r);
2506 fprintf(stderr, "\na^3:\t\t");
2507 BN_print_fp(stderr, a);
2508 fprintf(stderr, "\n");
2509 goto err;
2510 }
2511
2512 done:
2513 failed = 0;
2514
2515 err:
2516 BN_CTX_end(ctx);
2517 EC_GROUP_free(group);
2518
2519 return failed;
2520}
2521
2522static int
2523ec_group_check_seeds(void)
2524{
2525 BN_CTX *ctx = NULL;
2526 EC_builtin_curve *all_curves = NULL;
2527 size_t curve_id, ncurves;
2528 int failed = 0;
2529
2530 if ((ctx = BN_CTX_new()) == NULL)
2531 errx(1, "BN_CTX_new");
2532
2533 ncurves = EC_get_builtin_curves(NULL, 0);
2534 if ((all_curves = calloc(ncurves, sizeof(*all_curves))) == NULL)
2535 err(1, "calloc builtin curves");
2536 EC_get_builtin_curves(all_curves, ncurves);
2537
2538 for (curve_id = 0; curve_id < ncurves; curve_id++)
2539 failed |= ec_group_check_seed(&all_curves[curve_id], ctx);
2540
2541 free(all_curves);
2542 BN_CTX_free(ctx);
2543
2544 return failed;
2545}
2546
2471int 2547int
2472main(int argc, char **argv) 2548main(int argc, char **argv)
2473{ 2549{
@@ -2479,6 +2555,7 @@ main(int argc, char **argv)
2479 failed |= ec_group_roundtrip_builtin_curves(); 2555 failed |= ec_group_roundtrip_builtin_curves();
2480 failed |= ec_group_non_builtin_curves(); 2556 failed |= ec_group_non_builtin_curves();
2481 failed |= ec_group_check_private_keys(); 2557 failed |= ec_group_check_private_keys();
2558 failed |= ec_group_check_seeds();
2482 2559
2483 return failed; 2560 return failed;
2484} 2561}
diff --git a/src/regress/lib/libcrypto/ec/ectest.c b/src/regress/lib/libcrypto/ec/ectest.c
index fc44f9c886..3e81954174 100644
--- a/src/regress/lib/libcrypto/ec/ectest.c
+++ b/src/regress/lib/libcrypto/ec/ectest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ectest.c,v 1.35 2025/01/24 11:49:13 tb Exp $ */ 1/* $OpenBSD: ectest.c,v 1.36 2025/07/23 07:40:07 tb Exp $ */
2/* 2/*
3 * Originally written by Bodo Moeller for the OpenSSL project. 3 * Originally written by Bodo Moeller for the OpenSSL project.
4 */ 4 */
@@ -71,14 +71,11 @@
71 71
72#include <stdio.h> 72#include <stdio.h>
73#include <stdlib.h> 73#include <stdlib.h>
74#include <string.h>
75#include <time.h>
76 74
75#include <openssl/bn.h>
76#include <openssl/crypto.h>
77#include <openssl/ec.h> 77#include <openssl/ec.h>
78#include <openssl/err.h> 78#include <openssl/err.h>
79#include <openssl/obj_mac.h>
80#include <openssl/objects.h>
81#include <openssl/bn.h>
82#include <openssl/opensslconf.h> 79#include <openssl/opensslconf.h>
83 80
84#define ABORT do { \ 81#define ABORT do { \
diff --git a/src/regress/lib/libcrypto/evp/evp_pkey_cleanup.c b/src/regress/lib/libcrypto/evp/evp_pkey_cleanup.c
index d4825f68e8..1d2fa60be7 100644
--- a/src/regress/lib/libcrypto/evp/evp_pkey_cleanup.c
+++ b/src/regress/lib/libcrypto/evp/evp_pkey_cleanup.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_pkey_cleanup.c,v 1.5 2024/02/29 20:02:00 tb Exp $ */ 1/* $OpenBSD: evp_pkey_cleanup.c,v 1.6 2025/05/21 03:53:20 kenjiro Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> 4 * Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
@@ -38,6 +38,8 @@ int pkey_ids[] = {
38 EVP_PKEY_RSA, 38 EVP_PKEY_RSA,
39 EVP_PKEY_RSA_PSS, 39 EVP_PKEY_RSA_PSS,
40 EVP_PKEY_X25519, 40 EVP_PKEY_X25519,
41 EVP_PKEY_HKDF,
42 EVP_PKEY_TLS1_PRF,
41}; 43};
42 44
43static const size_t N_PKEY_IDS = sizeof(pkey_ids) / sizeof(pkey_ids[0]); 45static const size_t N_PKEY_IDS = sizeof(pkey_ids) / sizeof(pkey_ids[0]);
diff --git a/src/regress/lib/libcrypto/evp/evp_test.c b/src/regress/lib/libcrypto/evp/evp_test.c
index a699832c45..0bd8b4d092 100644
--- a/src/regress/lib/libcrypto/evp/evp_test.c
+++ b/src/regress/lib/libcrypto/evp/evp_test.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_test.c,v 1.20 2024/07/09 17:24:12 tb Exp $ */ 1/* $OpenBSD: evp_test.c,v 1.21 2025/05/22 00:13:47 kenjiro Exp $ */
2/* 2/*
3 * Copyright (c) 2017, 2022 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2017, 2022 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2023, 2024 Theo Buehler <tb@openbsd.org> 4 * Copyright (c) 2023, 2024 Theo Buehler <tb@openbsd.org>
@@ -802,6 +802,85 @@ kdf_compare_bytes(const char *label, const unsigned char *d1, int len1,
802} 802}
803 803
804static int 804static int
805evp_kdf_hkdf_basic(void)
806{
807 EVP_PKEY_CTX *pctx;
808 unsigned char out[42];
809 size_t outlen = sizeof(out);
810 int failed = 1;
811
812 /* Test vector from RFC 5869, Appendix A.1. */
813 const unsigned char ikm[] = {
814 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
815 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
816 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
817 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
818 0x0b, 0x0b,
819 };
820 const unsigned char salt[] = {
821 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
822 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
823 0x0c,
824 };
825 const unsigned char info[] = {
826 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5,
827 0xf6, 0xf7, 0xf8, 0xf9,
828 };
829 const unsigned char expected[42] = {
830 0x3c, 0xb2, 0x5f, 0x25, 0xfa, 0xac, 0xd5, 0x7a,
831 0x90, 0x43, 0x4f, 0x64, 0xd0, 0x36, 0x2f, 0x2a,
832 0x2d, 0x2d, 0x0a, 0x90, 0xcf, 0x1a, 0x5a, 0x4c,
833 0x5d, 0xb0, 0x2d, 0x56, 0xec, 0xc4, 0xc5, 0xbf,
834 0x34, 0x00, 0x72, 0x08, 0xd5, 0xb8, 0x87, 0x18,
835 0x58, 0x65,
836 };
837
838 if ((pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_HKDF, NULL)) == NULL) {
839 fprintf(stderr, "FAIL: EVP_PKEY_CTX_new_id\n");
840 goto err;
841 }
842
843 if (EVP_PKEY_derive_init(pctx) <= 0) {
844 fprintf(stderr, "FAIL: EVP_PKEY_derive_init\n");
845 goto err;
846 }
847
848 if (EVP_PKEY_CTX_set_hkdf_md(pctx, EVP_sha256()) <= 0) {
849 fprintf(stderr, "FAIL: EVP_PKEY_CTX_set_hkdf_md\n");
850 goto err;
851 }
852
853 if (EVP_PKEY_CTX_set1_hkdf_salt(pctx, salt, sizeof(salt)) <= 0) {
854 fprintf(stderr, "FAIL: EVP_PKEY_CTX_set1_hkdf_salt\n");
855 goto err;
856 }
857
858 if (EVP_PKEY_CTX_set1_hkdf_key(pctx, ikm, sizeof(ikm)) <= 0) {
859 fprintf(stderr, "FAIL: EVP_PKEY_CTX_set1_hkdf_key\n");
860 goto err;
861 }
862
863 if (EVP_PKEY_CTX_add1_hkdf_info(pctx, info, sizeof(info)) <= 0) {
864 fprintf(stderr, "FAIL: EVP_PKEY_CTX_add1_hkdf_info\n");
865 goto err;
866 }
867
868 if (EVP_PKEY_derive(pctx, out, &outlen) <= 0) {
869 fprintf(stderr, "FAIL: EVP_PKEY_derive\n");
870 goto err;
871 }
872
873 if (!kdf_compare_bytes("HKDF test", out, outlen, expected, sizeof(expected)))
874 goto err;
875
876 failed = 0;
877
878 err:
879 EVP_PKEY_CTX_free(pctx);
880 return failed;
881}
882
883static int
805evp_kdf_tls1_prf_basic(void) 884evp_kdf_tls1_prf_basic(void)
806{ 885{
807 EVP_PKEY_CTX *pctx; 886 EVP_PKEY_CTX *pctx;
@@ -1038,6 +1117,7 @@ main(int argc, char **argv)
1038 failed |= obj_name_do_all_test(); 1117 failed |= obj_name_do_all_test();
1039 failed |= evp_get_cipherbyname_test(); 1118 failed |= evp_get_cipherbyname_test();
1040 failed |= evp_get_digestbyname_test(); 1119 failed |= evp_get_digestbyname_test();
1120 failed |= evp_kdf_hkdf_basic();
1041 failed |= evp_kdf_tls1_prf_basic(); 1121 failed |= evp_kdf_tls1_prf_basic();
1042 failed |= evp_kdf_tls1_prf(); 1122 failed |= evp_kdf_tls1_prf();
1043 1123
diff --git a/src/regress/lib/libcrypto/gcm128/gcm128test.c b/src/regress/lib/libcrypto/gcm128/gcm128test.c
index def7653c7b..78631979fe 100644
--- a/src/regress/lib/libcrypto/gcm128/gcm128test.c
+++ b/src/regress/lib/libcrypto/gcm128/gcm128test.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: gcm128test.c,v 1.7 2022/09/05 21:06:31 tb Exp $ */ 1/* $OpenBSD: gcm128test.c,v 1.8 2025/05/16 14:03:49 jsing Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2010 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2010 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -57,11 +57,6 @@
57#include <openssl/aes.h> 57#include <openssl/aes.h>
58#include <openssl/modes.h> 58#include <openssl/modes.h>
59 59
60/* XXX - something like this should be in the public headers. */
61struct gcm128_context {
62 uint64_t opaque[64];
63};
64
65struct gcm128_test { 60struct gcm128_test {
66 const uint8_t K[128]; 61 const uint8_t K[128];
67 size_t K_len; 62 size_t K_len;
@@ -856,7 +851,7 @@ struct gcm128_test gcm128_tests[] = {
856static int 851static int
857do_gcm128_test(int test_no, struct gcm128_test *tv) 852do_gcm128_test(int test_no, struct gcm128_test *tv)
858{ 853{
859 GCM128_CONTEXT ctx; 854 GCM128_CONTEXT *ctx;
860 AES_KEY key; 855 AES_KEY key;
861 uint8_t *out = NULL; 856 uint8_t *out = NULL;
862 size_t out_len; 857 size_t out_len;
@@ -873,13 +868,16 @@ do_gcm128_test(int test_no, struct gcm128_test *tv)
873 868
874 if (out_len != 0) 869 if (out_len != 0)
875 memset(out, 0, out_len); 870 memset(out, 0, out_len);
876 CRYPTO_gcm128_init(&ctx, &key, (block128_f)AES_encrypt); 871
877 CRYPTO_gcm128_setiv(&ctx, tv->IV, tv->IV_len); 872 if ((ctx = CRYPTO_gcm128_new(&key, (block128_f)AES_encrypt)) == NULL)
873 err(1, "CRYPTO_gcm128_new");
874
875 CRYPTO_gcm128_setiv(ctx, tv->IV, tv->IV_len);
878 if (tv->A_len > 0) 876 if (tv->A_len > 0)
879 CRYPTO_gcm128_aad(&ctx, tv->A, tv->A_len); 877 CRYPTO_gcm128_aad(ctx, tv->A, tv->A_len);
880 if (tv->P_len > 0) 878 if (tv->P_len > 0)
881 CRYPTO_gcm128_encrypt(&ctx, tv->P, out, out_len); 879 CRYPTO_gcm128_encrypt(ctx, tv->P, out, out_len);
882 if (CRYPTO_gcm128_finish(&ctx, tv->T, 16)) { 880 if (CRYPTO_gcm128_finish(ctx, tv->T, 16)) {
883 fprintf(stderr, "TEST %d: CRYPTO_gcm128_finish failed\n", 881 fprintf(stderr, "TEST %d: CRYPTO_gcm128_finish failed\n",
884 test_no); 882 test_no);
885 goto fail; 883 goto fail;
@@ -891,12 +889,12 @@ do_gcm128_test(int test_no, struct gcm128_test *tv)
891 889
892 if (out_len != 0) 890 if (out_len != 0)
893 memset(out, 0, out_len); 891 memset(out, 0, out_len);
894 CRYPTO_gcm128_setiv(&ctx, tv->IV, tv->IV_len); 892 CRYPTO_gcm128_setiv(ctx, tv->IV, tv->IV_len);
895 if (tv->A_len > 0) 893 if (tv->A_len > 0)
896 CRYPTO_gcm128_aad(&ctx, tv->A, tv->A_len); 894 CRYPTO_gcm128_aad(ctx, tv->A, tv->A_len);
897 if (tv->C_len > 0) 895 if (tv->C_len > 0)
898 CRYPTO_gcm128_decrypt(&ctx, tv->C, out, out_len); 896 CRYPTO_gcm128_decrypt(ctx, tv->C, out, out_len);
899 if (CRYPTO_gcm128_finish(&ctx, tv->T, 16)) { 897 if (CRYPTO_gcm128_finish(ctx, tv->T, 16)) {
900 fprintf(stderr, "TEST %d: CRYPTO_gcm128_finish failed\n", 898 fprintf(stderr, "TEST %d: CRYPTO_gcm128_finish failed\n",
901 test_no); 899 test_no);
902 goto fail; 900 goto fail;
@@ -909,6 +907,8 @@ do_gcm128_test(int test_no, struct gcm128_test *tv)
909 ret = 0; 907 ret = 0;
910 908
911fail: 909fail:
910 CRYPTO_gcm128_release(ctx);
911
912 free(out); 912 free(out);
913 return (ret); 913 return (ret);
914} 914}
diff --git a/src/regress/lib/libcrypto/man/check_complete.pl b/src/regress/lib/libcrypto/man/check_complete.pl
index 5f2d12ec73..3cbf02f16a 100755
--- a/src/regress/lib/libcrypto/man/check_complete.pl
+++ b/src/regress/lib/libcrypto/man/check_complete.pl
@@ -1,6 +1,6 @@
1#!/usr/bin/perl 1#!/usr/bin/perl
2# 2#
3# Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3# Copyright (c) 2021,2022,2023,2024,2025 Ingo Schwarze <schwarze@openbsd.org>
4# 4#
5# Permission to use, copy, modify, and distribute this software for any 5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above 6# purpose with or without fee is hereby granted, provided that the above
@@ -30,6 +30,9 @@ my %internal = (
30 BN_MASK2 BN_MASK2h BN_MASK2h1 BN_MASK2l 30 BN_MASK2 BN_MASK2h BN_MASK2h1 BN_MASK2l
31 BN_TBIT BN_ULLONG 31 BN_TBIT BN_ULLONG
32 )], 32 )],
33 conf => [qw(
34 conf_st conf_method_st
35 )],
33 evp => [qw( 36 evp => [qw(
34 ASN1_PKEY_CTRL_CMS_ENVELOPE ASN1_PKEY_CTRL_CMS_RI_TYPE 37 ASN1_PKEY_CTRL_CMS_ENVELOPE ASN1_PKEY_CTRL_CMS_RI_TYPE
35 ASN1_PKEY_CTRL_CMS_SIGN 38 ASN1_PKEY_CTRL_CMS_SIGN
@@ -116,7 +119,7 @@ my %postponed = (
116 119
117my $MANW = 'man -M /usr/share/man -w'; 120my $MANW = 'man -M /usr/share/man -w';
118my $srcdir = '/usr/src/lib/libcrypto/man'; 121my $srcdir = '/usr/src/lib/libcrypto/man';
119my $hfile = '/usr/include/openssl'; 122my $hfile = '/usr/include';
120 123
121my $in_cplusplus = 0; 124my $in_cplusplus = 0;
122my $in_comment = 0; 125my $in_comment = 0;
@@ -133,6 +136,7 @@ if (defined $ARGV[0] && $ARGV[0] eq '-v') {
133 shift @ARGV; 136 shift @ARGV;
134} 137}
135$#ARGV == 0 or die "usage: $0 [-v] headername"; 138$#ARGV == 0 or die "usage: $0 [-v] headername";
139$hfile .= "/openssl" unless $ARGV[0] eq 'tls';
136$hfile .= "/$ARGV[0].h"; 140$hfile .= "/$ARGV[0].h";
137open my $in_fh, '<', $hfile or die "$hfile: $!"; 141open my $in_fh, '<', $hfile or die "$hfile: $!";
138 142
@@ -236,6 +240,7 @@ try_again:
236 # Uninteresting lines. 240 # Uninteresting lines.
237 241
238 if (/^\s*$/ || 242 if (/^\s*$/ ||
243 /^DECLARE_LHASH_OF\(\w+\);$/ ||
239 /^DECLARE_STACK_OF\(\w+\)$/ || 244 /^DECLARE_STACK_OF\(\w+\)$/ ||
240 /^DECLARE_PKCS12_STACK_OF\(\w+\)$/ || 245 /^DECLARE_PKCS12_STACK_OF\(\w+\)$/ ||
241 /^TYPEDEF_D2I2D_OF\(\w+\);$/ || 246 /^TYPEDEF_D2I2D_OF\(\w+\);$/ ||
@@ -288,7 +293,7 @@ try_again:
288 print "D- $line\n" if $verbose; 293 print "D- $line\n" if $verbose;
289 next; 294 next;
290 } 295 }
291 if ($id =~ /^(?:ASN1|BIO|BN|EVP|X509(?:V3)?)_[FR]_\w+$/) { 296 if ($id =~ /^(?:ASN1|BIO|BN|CONF|EVP|X509(?:V3)?)_[FR]_\w+$/) {
292 print "D- $line\n" if $verbose; 297 print "D- $line\n" if $verbose;
293 next; 298 next;
294 } 299 }
diff --git a/src/regress/lib/libcrypto/md/Makefile b/src/regress/lib/libcrypto/md/Makefile
index 94bec95e05..1df57283b2 100644
--- a/src/regress/lib/libcrypto/md/Makefile
+++ b/src/regress/lib/libcrypto/md/Makefile
@@ -1,9 +1,15 @@
1# $OpenBSD: Makefile,v 1.1.1.1 2022/09/02 13:34:48 tb Exp $ 1# $OpenBSD: Makefile,v 1.2 2025/05/22 03:24:47 joshua Exp $
2 2
3PROG= md_test 3PROG = md_test
4LDADD= -lcrypto 4LDADD = -lcrypto
5DPADD= ${LIBCRYPTO} 5DPADD = ${LIBCRYPTO}
6WARNINGS= Yes 6WARNINGS = Yes
7CFLAGS+= -DLIBRESSL_INTERNAL -Werror 7CFLAGS += -DLIBRESSL_INTERNAL -Werror
8CFLAGS += -I${.CURDIR}/../test
9SRCS += md_test.c
10SRCS += test.c
11SRCS += test_util.c
12
13.PATH: ${.CURDIR}/../test
8 14
9.include <bsd.regress.mk> 15.include <bsd.regress.mk>
diff --git a/src/regress/lib/libcrypto/md/md_test.c b/src/regress/lib/libcrypto/md/md_test.c
index 590bb50ee3..752f2e4958 100644
--- a/src/regress/lib/libcrypto/md/md_test.c
+++ b/src/regress/lib/libcrypto/md/md_test.c
@@ -1,6 +1,6 @@
1/* $OpenBSD: md_test.c,v 1.3 2025/01/19 10:17:39 tb Exp $ */ 1/* $OpenBSD: md_test.c,v 1.4 2025/05/22 03:24:47 joshua Exp $ */
2/* 2/*
3 * Copyright (c) 2022 Joshua Sing <joshua@hypera.dev> 3 * Copyright (c) 2022, 2025 Joshua Sing <joshua@joshuasing.dev>
4 * 4 *
5 * Permission to use, copy, modify, and distribute this software for any 5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above 6 * purpose with or without fee is hereby granted, provided that the above
@@ -22,6 +22,8 @@
22#include <stdint.h> 22#include <stdint.h>
23#include <string.h> 23#include <string.h>
24 24
25#include "test.h"
26
25struct md_test { 27struct md_test {
26 const int algorithm; 28 const int algorithm;
27 const uint8_t in[128]; 29 const uint8_t in[128];
@@ -30,7 +32,7 @@ struct md_test {
30}; 32};
31 33
32static const struct md_test md_tests[] = { 34static const struct md_test md_tests[] = {
33 /* MD4 (RFC 1320 test vectors) */ 35 /* MD4 (RFC 1320 test vectors) */
34 { 36 {
35 .algorithm = NID_md4, 37 .algorithm = NID_md4,
36 .in = "", 38 .in = "",
@@ -99,7 +101,7 @@ static const struct md_test md_tests[] = {
99 } 101 }
100 }, 102 },
101 103
102 /* MD5 (RFC 1321 test vectors) */ 104 /* MD5 (RFC 1321 test vectors) */
103 { 105 {
104 .algorithm = NID_md5, 106 .algorithm = NID_md5,
105 .in = "", 107 .in = "",
@@ -175,25 +177,21 @@ typedef unsigned char *(*md_hash_func)(const unsigned char *, size_t,
175 unsigned char *); 177 unsigned char *);
176 178
177static int 179static int
178md_hash_from_algorithm(int algorithm, const char **out_label, 180md_hash_from_algorithm(int algorithm, md_hash_func *out_func,
179 md_hash_func *out_func, const EVP_MD **out_md, size_t *out_len) 181 const EVP_MD **out_md, size_t *out_len)
180{ 182{
181 switch (algorithm) { 183 switch (algorithm) {
182 case NID_md4: 184 case NID_md4:
183 *out_label = SN_md4;
184 *out_func = MD4; 185 *out_func = MD4;
185 *out_md = EVP_md4(); 186 *out_md = EVP_md4();
186 *out_len = MD4_DIGEST_LENGTH; 187 *out_len = MD4_DIGEST_LENGTH;
187 break; 188 break;
188 case NID_md5: 189 case NID_md5:
189 *out_label = SN_md5;
190 *out_func = MD5; 190 *out_func = MD5;
191 *out_md = EVP_md5(); 191 *out_md = EVP_md5();
192 *out_len = MD5_DIGEST_LENGTH; 192 *out_len = MD5_DIGEST_LENGTH;
193 break; 193 break;
194 default: 194 default:
195 fprintf(stderr, "FAIL: unknown algorithm (%d)\n",
196 algorithm);
197 return 0; 195 return 0;
198 } 196 }
199 197
@@ -201,108 +199,100 @@ md_hash_from_algorithm(int algorithm, const char **out_label,
201} 199}
202 200
203static void 201static void
204hexdump(const unsigned char *buf, size_t len) 202test_md_tv(struct test *t, const void *arg)
205{
206 size_t i;
207
208 for (i = 1; i <= len; i++)
209 fprintf(stderr, " 0x%02hhx,%s", buf[i - 1], i % 8 ? "" : "\n");
210
211 fprintf(stderr, "\n");
212}
213
214static int
215md_test(void)
216{ 203{
217 unsigned char *(*md_func)(const unsigned char *, size_t, unsigned char *); 204 const struct md_test *st = arg;
218 const struct md_test *st; 205 md_hash_func md_func;
219 EVP_MD_CTX *hash = NULL;
220 const EVP_MD *md; 206 const EVP_MD *md;
207 EVP_MD_CTX *hash = NULL;
221 uint8_t out[EVP_MAX_MD_SIZE]; 208 uint8_t out[EVP_MAX_MD_SIZE];
222 size_t in_len, out_len; 209 size_t in_len, out_len;
223 size_t i;
224 const char *label;
225 int failed = 1;
226 210
227 if ((hash = EVP_MD_CTX_new()) == NULL) { 211 if (!md_hash_from_algorithm(st->algorithm, &md_func, &md, &out_len)) {
228 fprintf(stderr, "FAIL: EVP_MD_CTX_new() failed\n"); 212 test_errorf(t, "md_hash_from_algorithm: unknown algorithm: %d",
229 goto failed; 213 st->algorithm);
214 goto fail;
230 } 215 }
231 216
232 for (i = 0; i < N_MD_TESTS; i++) { 217 if ((hash = EVP_MD_CTX_new()) == NULL) {
233 st = &md_tests[i]; 218 test_errorf(t, "EVP_MD_CTX_new()");
234 if (!md_hash_from_algorithm(st->algorithm, &label, &md_func, 219 goto fail;
235 &md, &out_len)) 220 }
236 goto failed;
237
238 /* Digest */
239 memset(out, 0, sizeof(out));
240 md_func(st->in, st->in_len, out);
241 if (memcmp(st->out, out, out_len) != 0) {
242 fprintf(stderr, "FAIL (%s): mismatch\n", label);
243 goto failed;
244 }
245 221
246 /* EVP single-shot digest */ 222 /* Digest */
247 memset(out, 0, sizeof(out)); 223 memset(out, 0, sizeof(out));
248 if (!EVP_Digest(st->in, st->in_len, out, NULL, md, NULL)) { 224 md_func(st->in, st->in_len, out);
249 fprintf(stderr, "FAIL (%s): EVP_Digest failed\n", 225 if (memcmp(st->out, out, out_len) != 0) {
250 label); 226 test_errorf(t, "MD: digest output mismatch");
251 goto failed; 227 test_hexdiff(t, out, out_len, st->out);
252 } 228 }
253 229
254 if (memcmp(st->out, out, out_len) != 0) { 230 /* EVP single-shot digest */
255 fprintf(stderr, "FAIL (%s): EVP single-shot mismatch\n", 231 memset(out, 0, sizeof(out));
256 label); 232 if (!EVP_Digest(st->in, st->in_len, out, NULL, md, NULL)) {
257 goto failed; 233 test_errorf(t, "EVP_Digest()");
258 } 234 goto fail;
235 }
236 if (memcmp(st->out, out, out_len) != 0) {
237 test_errorf(t, "EVP_Digest: digest output mismatch");
238 test_hexdiff(t, out, out_len, st->out);
239 }
259 240
260 /* EVP digest */ 241 /* EVP digest */
261 memset(out, 0, sizeof(out)); 242 memset(out, 0, sizeof(out));
262 if (!EVP_DigestInit_ex(hash, md, NULL)) { 243 if (!EVP_DigestInit_ex(hash, md, NULL)) {
263 fprintf(stderr, "FAIL (%s): EVP_DigestInit_ex failed\n", 244 test_errorf(t, "EVP_DigestInit_ex()");
264 label); 245 goto fail;
265 goto failed; 246 }
266 }
267 247
268 in_len = st->in_len / 2; 248 in_len = st->in_len / 2;
269 if (!EVP_DigestUpdate(hash, st->in, in_len)) { 249 if (!EVP_DigestUpdate(hash, st->in, in_len)) {
270 fprintf(stderr, 250 test_errorf(t, "EVP_DigestUpdate: first half failed");
271 "FAIL (%s): EVP_DigestUpdate first half failed\n", 251 goto fail;
272 label); 252 }
273 goto failed;
274 }
275 253
276 if (!EVP_DigestUpdate(hash, st->in + in_len, 254 if (!EVP_DigestUpdate(hash, st->in + in_len,
277 st->in_len - in_len)) { 255 st->in_len - in_len)) {
278 fprintf(stderr, 256 test_errorf(t, "EVP_DigestUpdate: second half failed");
279 "FAIL (%s): EVP_DigestUpdate second half failed\n", 257 goto fail;
280 label); 258 }
281 goto failed;
282 }
283 259
284 if (!EVP_DigestFinal_ex(hash, out, NULL)) { 260 if (!EVP_DigestFinal_ex(hash, out, NULL)) {
285 fprintf(stderr, 261 test_errorf(t, "EVP_DigestFinal_ex()");
286 "FAIL (%s): EVP_DigestFinal_ex failed\n", 262 goto fail;
287 label); 263 }
288 goto failed;
289 }
290 264
291 if (memcmp(st->out, out, out_len) != 0) { 265 if (memcmp(st->out, out, out_len) != 0) {
292 fprintf(stderr, "FAIL (%s): EVP mismatch\n", label); 266 test_errorf(t, "EVP: digest output mismatch");
293 goto failed; 267 test_hexdiff(t, out, out_len, st->out);
294 }
295 } 268 }
296 269
297 failed = 0;
298 270
299 failed: 271 fail:
300 EVP_MD_CTX_free(hash); 272 EVP_MD_CTX_free(hash);
301 return failed;
302} 273}
303 274
304static int 275static void
305md5_large_test(void) 276test_md(struct test *t, const void *arg)
277{
278 const struct md_test *st;
279 size_t i;
280 char *name;
281
282 for (i = 0; i < N_MD_TESTS; i++) {
283 st = &md_tests[i];
284 if (asprintf(&name, "%s: '%s'", OBJ_nid2sn(st->algorithm), st->in) == -1) {
285 test_errorf(t, "create test name");
286 return;
287 }
288
289 test_run(t, name, test_md_tv, st);
290 free(name);
291 }
292}
293
294static void
295test_md5_large(struct test *t, const void *arg)
306{ 296{
307 MD5_CTX ctx; 297 MD5_CTX ctx;
308 uint8_t in[1024]; 298 uint8_t in[1024];
@@ -310,12 +300,10 @@ md5_large_test(void)
310 unsigned int out_len; 300 unsigned int out_len;
311 size_t in_len; 301 size_t in_len;
312 size_t i; 302 size_t i;
313 const char *label;
314 uint8_t want[] = { 303 uint8_t want[] = {
315 0xd8, 0xbc, 0xae, 0x13, 0xb5, 0x5a, 0xb0, 0xfc, 304 0xd8, 0xbc, 0xae, 0x13, 0xb5, 0x5a, 0xb0, 0xfc,
316 0x7f, 0x8a, 0xe1, 0x78, 0x27, 0x8d, 0x44, 0x1b, 305 0x7f, 0x8a, 0xe1, 0x78, 0x27, 0x8d, 0x44, 0x1b,
317 }; 306 };
318 int failed = 1;
319 307
320 memset(in, 'A', sizeof(in)); 308 memset(in, 'A', sizeof(in));
321 in_len = sizeof(in); 309 in_len = sizeof(in);
@@ -323,44 +311,34 @@ md5_large_test(void)
323 memset(out, 0, sizeof(out)); 311 memset(out, 0, sizeof(out));
324 out_len = 16; 312 out_len = 16;
325 313
326 label = "md5";
327
328 MD5_Init(&ctx); 314 MD5_Init(&ctx);
329 315
330 for (i = 0; i < (1<<29) + 1; i += in_len) { 316 for (i = 0; i < (1<<29) + 1; i += in_len) {
331 if (!MD5_Update(&ctx, in, in_len)) { 317 if (!MD5_Update(&ctx, in, in_len)) {
332 fprintf(stderr, "FAIL (%s): MD5_Update failed\n", label); 318 test_errorf(t, "MD5_Update()");
333 goto failed; 319 return;
334 } 320 }
335 } 321 }
336 if (!MD5_Final(out, &ctx)) { 322 if (!MD5_Final(out, &ctx)) {
337 fprintf(stderr, "FAIL (%s): MD5_Final failed\n", label); 323 test_errorf(t, "MD5_Final()");
338 goto failed; 324 return;
339 } 325 }
340 326
341 if (memcmp(out, want, out_len) != 0) { 327 if (memcmp(out, want, out_len) != 0) {
342 fprintf(stderr, "FAIL (%s): MD5 mismatch\n", label); 328 test_errorf(t, "MD5 digest output mismatch");
343 hexdump(out, out_len); 329 test_hexdump(t, out, out_len);
344 goto failed;
345 } 330 }
346 if (ctx.Nh != 0x1 || ctx.Nl != 0x2000) { 331 if (ctx.Nh != 0x1 || ctx.Nl != 0x2000)
347 fprintf(stderr, "FAIL (%s): MD5 incorrect bit length\n", label); 332 test_errorf(t, "MD5 incorrect bit length");
348 goto failed;
349 }
350
351 failed = 0;
352
353 failed:
354 return failed;
355} 333}
356 334
357int 335int
358main(int argc, char **argv) 336main(int argc, char **argv)
359{ 337{
360 int failed = 0; 338 struct test *t = test_init();
361 339
362 failed |= md_test(); 340 test_run(t, "md", test_md, NULL);
363 failed |= md5_large_test(); 341 test_run(t, "md5 large", test_md5_large, NULL);
364 342
365 return failed; 343 return test_result(t);
366} 344}
diff --git a/src/regress/lib/libcrypto/mlkem/mlkem_iteration_tests.c b/src/regress/lib/libcrypto/mlkem/mlkem_iteration_tests.c
index 5a61248090..b93243023c 100644
--- a/src/regress/lib/libcrypto/mlkem/mlkem_iteration_tests.c
+++ b/src/regress/lib/libcrypto/mlkem/mlkem_iteration_tests.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: mlkem_iteration_tests.c,v 1.2 2024/12/26 07:26:45 tb Exp $ */ 1/* $OpenBSD: mlkem_iteration_tests.c,v 1.5 2025/05/20 00:33:41 beck Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Google Inc. 3 * Copyright (c) 2024 Google Inc.
4 * Copyright (c) 2024 Bob Beck <beck@obtuse.com> 4 * Copyright (c) 2024 Bob Beck <beck@obtuse.com>
@@ -73,7 +73,7 @@ struct iteration_ctx {
73 void *priv; 73 void *priv;
74 void *pub; 74 void *pub;
75 75
76 mlkem_encode_private_key_fn encode_private_key; 76 mlkem_marshal_private_key_fn marshal_private_key;
77 mlkem_encap_external_entropy_fn encap_external_entropy; 77 mlkem_encap_external_entropy_fn encap_external_entropy;
78 mlkem_generate_key_external_entropy_fn generate_key_external_entropy; 78 mlkem_generate_key_external_entropy_fn generate_key_external_entropy;
79 mlkem_public_from_private_fn public_from_private; 79 mlkem_public_from_private_fn public_from_private;
@@ -116,8 +116,10 @@ MlkemIterativeTest(struct iteration_ctx *ctx)
116 } 116 }
117 117
118 /* generate ek as encoded_public_key */ 118 /* generate ek as encoded_public_key */
119 ctx->generate_key_external_entropy(ctx->encoded_public_key, 119 if (!ctx->generate_key_external_entropy(ctx->encoded_public_key,
120 ctx->priv, seed); 120 ctx->priv, seed)) {
121 errx(1, "generate_key_external_entropy");
122 }
121 ctx->public_from_private(ctx->pub, ctx->priv); 123 ctx->public_from_private(ctx->pub, ctx->priv);
122 124
123 /* hash in ek */ 125 /* hash in ek */
@@ -125,7 +127,7 @@ MlkemIterativeTest(struct iteration_ctx *ctx)
125 ctx->encoded_public_key_len); 127 ctx->encoded_public_key_len);
126 128
127 /* marshal priv to dk as encoded_private_key */ 129 /* marshal priv to dk as encoded_private_key */
128 if (!ctx->encode_private_key(ctx->priv, &encoded_private_key, 130 if (!ctx->marshal_private_key(ctx->priv, &encoded_private_key,
129 &encoded_private_key_len)) 131 &encoded_private_key_len))
130 errx(1, "encode private key"); 132 errx(1, "encode private key");
131 133
@@ -183,7 +185,7 @@ main(void)
183 .priv = &priv768, 185 .priv = &priv768,
184 .pub = &pub768, 186 .pub = &pub768,
185 .encap_external_entropy = mlkem768_encap_external_entropy, 187 .encap_external_entropy = mlkem768_encap_external_entropy,
186 .encode_private_key = mlkem768_encode_private_key, 188 .marshal_private_key = mlkem768_marshal_private_key,
187 .generate_key_external_entropy = 189 .generate_key_external_entropy =
188 mlkem768_generate_key_external_entropy, 190 mlkem768_generate_key_external_entropy,
189 .public_from_private = mlkem768_public_from_private, 191 .public_from_private = mlkem768_public_from_private,
@@ -208,7 +210,7 @@ main(void)
208 .priv = &priv1024, 210 .priv = &priv1024,
209 .pub = &pub1024, 211 .pub = &pub1024,
210 .encap_external_entropy = mlkem1024_encap_external_entropy, 212 .encap_external_entropy = mlkem1024_encap_external_entropy,
211 .encode_private_key = mlkem1024_encode_private_key, 213 .marshal_private_key = mlkem1024_marshal_private_key,
212 .generate_key_external_entropy = 214 .generate_key_external_entropy =
213 mlkem1024_generate_key_external_entropy, 215 mlkem1024_generate_key_external_entropy,
214 .public_from_private = mlkem1024_public_from_private, 216 .public_from_private = mlkem1024_public_from_private,
diff --git a/src/regress/lib/libcrypto/mlkem/mlkem_tests.c b/src/regress/lib/libcrypto/mlkem/mlkem_tests.c
index 2801a58890..8e04dc6ad2 100644
--- a/src/regress/lib/libcrypto/mlkem/mlkem_tests.c
+++ b/src/regress/lib/libcrypto/mlkem/mlkem_tests.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: mlkem_tests.c,v 1.2 2024/12/26 00:10:19 tb Exp $ */ 1/* $OpenBSD: mlkem_tests.c,v 1.6 2025/05/20 00:33:41 beck Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Google Inc. 3 * Copyright (c) 2024 Google Inc.
4 * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> 4 * Copyright (c) 2024 Theo Buehler <tb@openbsd.org>
@@ -112,7 +112,8 @@ MlkemDecapFileTest(struct decap_ctx *decap)
112 parse_get_cbs(p, DECAP_PRIVATE_KEY, &private_key); 112 parse_get_cbs(p, DECAP_PRIVATE_KEY, &private_key);
113 parse_get_int(p, DECAP_RESULT, &should_fail); 113 parse_get_int(p, DECAP_RESULT, &should_fail);
114 114
115 if (!decap->parse_private_key(decap->private_key, &private_key)) { 115 if (!decap->parse_private_key(decap->private_key,
116 CBS_data(&private_key), CBS_len(&private_key))) {
116 if ((failed = !should_fail)) 117 if ((failed = !should_fail))
117 parse_info(p, "parse private key"); 118 parse_info(p, "parse private key");
118 goto err; 119 goto err;
@@ -207,7 +208,8 @@ MlkemNistDecapFileTest(struct decap_ctx *decap)
207 MLKEM_SHARED_SECRET_BYTES, CBS_len(&k))) 208 MLKEM_SHARED_SECRET_BYTES, CBS_len(&k)))
208 goto err; 209 goto err;
209 210
210 if (!decap->parse_private_key(decap->private_key, &dk)) { 211 if (!decap->parse_private_key(decap->private_key, CBS_data(&dk),
212 CBS_len(&dk))) {
211 parse_info(p, "parse private key"); 213 parse_info(p, "parse private key");
212 goto err; 214 goto err;
213 } 215 }
@@ -360,7 +362,8 @@ MlkemEncapFileTest(struct encap_ctx *encap)
360 parse_get_cbs(p, ENCAP_SHARED_SECRET, &shared_secret); 362 parse_get_cbs(p, ENCAP_SHARED_SECRET, &shared_secret);
361 parse_get_int(p, ENCAP_RESULT, &should_fail); 363 parse_get_int(p, ENCAP_RESULT, &should_fail);
362 364
363 if (!encap->parse_public_key(encap->public_key, &public_key)) { 365 if (!encap->parse_public_key(encap->public_key, CBS_data(&public_key),
366 CBS_len(&public_key))) {
364 if ((failed = !should_fail)) 367 if ((failed = !should_fail))
365 parse_info(p, "parse public key"); 368 parse_info(p, "parse public key");
366 goto err; 369 goto err;
@@ -441,7 +444,7 @@ struct keygen_ctx {
441 size_t public_key_len; 444 size_t public_key_len;
442 445
443 mlkem_generate_key_external_entropy_fn generate_key_external_entropy; 446 mlkem_generate_key_external_entropy_fn generate_key_external_entropy;
444 mlkem_encode_private_key_fn encode_private_key; 447 mlkem_marshal_private_key_fn marshal_private_key;
445}; 448};
446 449
447enum keygen_states { 450enum keygen_states {
@@ -512,7 +515,7 @@ MlkemKeygenFileTest(struct keygen_ctx *keygen)
512 515
513 keygen->generate_key_external_entropy(keygen->encoded_public_key, 516 keygen->generate_key_external_entropy(keygen->encoded_public_key,
514 keygen->private_key, CBS_data(&seed)); 517 keygen->private_key, CBS_data(&seed));
515 if (!keygen->encode_private_key(keygen->private_key, 518 if (!keygen->marshal_private_key(keygen->private_key,
516 &encoded_private_key, &encoded_private_key_len)) { 519 &encoded_private_key, &encoded_private_key_len)) {
517 parse_info(p, "encode private key"); 520 parse_info(p, "encode private key");
518 goto err; 521 goto err;
@@ -611,7 +614,7 @@ MlkemNistKeygenFileTest(struct keygen_ctx *keygen)
611 614
612 keygen->generate_key_external_entropy(keygen->encoded_public_key, 615 keygen->generate_key_external_entropy(keygen->encoded_public_key,
613 keygen->private_key, seed); 616 keygen->private_key, seed);
614 if (!keygen->encode_private_key(keygen->private_key, 617 if (!keygen->marshal_private_key(keygen->private_key,
615 &encoded_private_key, &encoded_private_key_len)) { 618 &encoded_private_key, &encoded_private_key_len)) {
616 parse_info(p, "encode private key"); 619 parse_info(p, "encode private key");
617 goto err; 620 goto err;
@@ -655,10 +658,11 @@ mlkem_keygen_tests(const char *fn, size_t size, enum test_type test_type)
655 .encoded_public_key_len = sizeof(encoded_public_key768), 658 .encoded_public_key_len = sizeof(encoded_public_key768),
656 .private_key_len = MLKEM768_PRIVATE_KEY_BYTES, 659 .private_key_len = MLKEM768_PRIVATE_KEY_BYTES,
657 .public_key_len = MLKEM768_PUBLIC_KEY_BYTES, 660 .public_key_len = MLKEM768_PUBLIC_KEY_BYTES,
661
658 .generate_key_external_entropy = 662 .generate_key_external_entropy =
659 mlkem768_generate_key_external_entropy, 663 mlkem768_generate_key_external_entropy,
660 .encode_private_key = 664 .marshal_private_key =
661 mlkem768_encode_private_key, 665 mlkem768_marshal_private_key,
662 }; 666 };
663 struct MLKEM1024_private_key private_key1024; 667 struct MLKEM1024_private_key private_key1024;
664 uint8_t encoded_public_key1024[MLKEM1024_PUBLIC_KEY_BYTES]; 668 uint8_t encoded_public_key1024[MLKEM1024_PUBLIC_KEY_BYTES];
@@ -671,8 +675,8 @@ mlkem_keygen_tests(const char *fn, size_t size, enum test_type test_type)
671 675
672 .generate_key_external_entropy = 676 .generate_key_external_entropy =
673 mlkem1024_generate_key_external_entropy, 677 mlkem1024_generate_key_external_entropy,
674 .encode_private_key = 678 .marshal_private_key =
675 mlkem1024_encode_private_key, 679 mlkem1024_marshal_private_key,
676 }; 680 };
677 681
678 if (size == 768 && test_type == TEST_TYPE_NORMAL) 682 if (size == 768 && test_type == TEST_TYPE_NORMAL)
diff --git a/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.c b/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.c
index 1bb2ed3a8b..68bd5d4871 100644
--- a/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.c
+++ b/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: mlkem_tests_util.c,v 1.5 2024/12/26 00:04:24 tb Exp $ */ 1/* $OpenBSD: mlkem_tests_util.c,v 1.8 2025/05/20 00:33:41 beck Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Google Inc. 3 * Copyright (c) 2024 Google Inc.
4 * Copyright (c) 2024 Bob Beck <beck@obtuse.com> 4 * Copyright (c) 2024 Bob Beck <beck@obtuse.com>
@@ -61,91 +61,31 @@ compare_data(const uint8_t *want, const uint8_t *got, size_t len, const char *ms
61} 61}
62 62
63int 63int
64mlkem768_encode_private_key(const void *private_key, uint8_t **out_buf, 64mlkem768_marshal_private_key(const void *private_key, uint8_t **out_buf,
65 size_t *out_len) 65 size_t *out_len)
66{ 66{
67 CBB cbb; 67 return MLKEM768_marshal_private_key(private_key, out_buf, out_len);
68 int ret = 0;
69
70 if (!CBB_init(&cbb, MLKEM768_PUBLIC_KEY_BYTES))
71 goto err;
72 if (!MLKEM768_marshal_private_key(&cbb, private_key))
73 goto err;
74 if (!CBB_finish(&cbb, out_buf, out_len))
75 goto err;
76
77 ret = 1;
78
79 err:
80 CBB_cleanup(&cbb);
81
82 return ret;
83} 68}
84 69
85int 70int
86mlkem768_encode_public_key(const void *public_key, uint8_t **out_buf, 71mlkem768_marshal_public_key(const void *public_key, uint8_t **out_buf,
87 size_t *out_len) 72 size_t *out_len)
88{ 73{
89 CBB cbb; 74 return MLKEM768_marshal_public_key(out_buf, out_len, public_key);
90 int ret = 0;
91
92 if (!CBB_init(&cbb, MLKEM768_PUBLIC_KEY_BYTES))
93 goto err;
94 if (!MLKEM768_marshal_public_key(&cbb, public_key))
95 goto err;
96 if (!CBB_finish(&cbb, out_buf, out_len))
97 goto err;
98
99 ret = 1;
100
101 err:
102 CBB_cleanup(&cbb);
103
104 return ret;
105} 75}
106 76
107int 77int
108mlkem1024_encode_private_key(const void *private_key, uint8_t **out_buf, 78mlkem1024_marshal_private_key(const void *private_key, uint8_t **out_buf,
109 size_t *out_len) 79 size_t *out_len)
110{ 80{
111 CBB cbb; 81 return MLKEM1024_marshal_private_key(private_key, out_buf, out_len);
112 int ret = 0;
113
114 if (!CBB_init(&cbb, MLKEM1024_PUBLIC_KEY_BYTES))
115 goto err;
116 if (!MLKEM1024_marshal_private_key(&cbb, private_key))
117 goto err;
118 if (!CBB_finish(&cbb, out_buf, out_len))
119 goto err;
120
121 ret = 1;
122
123 err:
124 CBB_cleanup(&cbb);
125
126 return ret;
127} 82}
128 83
129int 84int
130mlkem1024_encode_public_key(const void *public_key, uint8_t **out_buf, 85mlkem1024_marshal_public_key(const void *public_key, uint8_t **out_buf,
131 size_t *out_len) 86 size_t *out_len)
132{ 87{
133 CBB cbb; 88 return MLKEM1024_marshal_public_key(out_buf, out_len, public_key);
134 int ret = 0;
135
136 if (!CBB_init(&cbb, MLKEM1024_PUBLIC_KEY_BYTES))
137 goto err;
138 if (!MLKEM1024_marshal_public_key(&cbb, public_key))
139 goto err;
140 if (!CBB_finish(&cbb, out_buf, out_len))
141 goto err;
142
143 ret = 1;
144
145 err:
146 CBB_cleanup(&cbb);
147
148 return ret;
149} 89}
150 90
151int 91int
@@ -173,32 +113,36 @@ mlkem768_encap_external_entropy(uint8_t *out_ciphertext,
173 public_key, entropy); 113 public_key, entropy);
174} 114}
175 115
176void 116int
177mlkem768_generate_key(uint8_t *out_encoded_public_key, 117mlkem768_generate_key(uint8_t *out_encoded_public_key,
178 uint8_t optional_out_seed[MLKEM_SEED_BYTES], void *out_private_key) 118 uint8_t optional_out_seed[MLKEM_SEED_BYTES], void *out_private_key)
179{ 119{
180 MLKEM768_generate_key(out_encoded_public_key, optional_out_seed, 120 return MLKEM768_generate_key(out_encoded_public_key, optional_out_seed,
181 out_private_key); 121 out_private_key);
182} 122}
183 123
184void 124int
185mlkem768_generate_key_external_entropy(uint8_t *out_encoded_public_key, 125mlkem768_generate_key_external_entropy(uint8_t *out_encoded_public_key,
186 void *out_private_key, const uint8_t entropy[MLKEM_SEED_BYTES]) 126 void *out_private_key, const uint8_t entropy[MLKEM_SEED_BYTES])
187{ 127{
188 MLKEM768_generate_key_external_entropy(out_encoded_public_key, 128 return MLKEM768_generate_key_external_entropy(out_encoded_public_key,
189 out_private_key, entropy); 129 out_private_key, entropy);
190} 130}
191 131
192int 132int
193mlkem768_parse_private_key(void *out_private_key, CBS *private_key_cbs) 133mlkem768_parse_private_key(void *out_private_key, const uint8_t *private_key,
134 size_t private_key_len)
194{ 135{
195 return MLKEM768_parse_private_key(out_private_key, private_key_cbs); 136 return MLKEM768_parse_private_key(out_private_key, private_key,
137 private_key_len);
196} 138}
197 139
198int 140int
199mlkem768_parse_public_key(void *out_public_key, CBS *public_key_cbs) 141mlkem768_parse_public_key(void *out_public_key, const uint8_t *public_key,
142 size_t public_key_len)
200{ 143{
201 return MLKEM768_parse_public_key(out_public_key, public_key_cbs); 144 return MLKEM768_parse_public_key(out_public_key, public_key,
145 public_key_len);
202} 146}
203 147
204void 148void
@@ -232,26 +176,28 @@ mlkem1024_encap_external_entropy(uint8_t *out_ciphertext,
232 public_key, entropy); 176 public_key, entropy);
233} 177}
234 178
235void 179int
236mlkem1024_generate_key(uint8_t *out_encoded_public_key, 180mlkem1024_generate_key(uint8_t *out_encoded_public_key,
237 uint8_t optional_out_seed[MLKEM_SEED_BYTES], void *out_private_key) 181 uint8_t optional_out_seed[MLKEM_SEED_BYTES], void *out_private_key)
238{ 182{
239 MLKEM1024_generate_key(out_encoded_public_key, optional_out_seed, 183 return MLKEM1024_generate_key(out_encoded_public_key, optional_out_seed,
240 out_private_key); 184 out_private_key);
241} 185}
242 186
243void 187int
244mlkem1024_generate_key_external_entropy(uint8_t *out_encoded_public_key, 188mlkem1024_generate_key_external_entropy(uint8_t *out_encoded_public_key,
245 void *out_private_key, const uint8_t entropy[MLKEM_SEED_BYTES]) 189 void *out_private_key, const uint8_t entropy[MLKEM_SEED_BYTES])
246{ 190{
247 MLKEM1024_generate_key_external_entropy(out_encoded_public_key, 191 return MLKEM1024_generate_key_external_entropy(out_encoded_public_key,
248 out_private_key, entropy); 192 out_private_key, entropy);
249} 193}
250 194
251int 195int
252mlkem1024_parse_private_key(void *out_private_key, CBS *private_key_cbs) 196mlkem1024_parse_private_key(void *out_private_key, const uint8_t *private_key,
197 size_t private_key_len)
253{ 198{
254 return MLKEM1024_parse_private_key(out_private_key, private_key_cbs); 199 return MLKEM1024_parse_private_key(out_private_key, private_key,
200 private_key_len);
255} 201}
256 202
257void 203void
@@ -261,7 +207,9 @@ mlkem1024_public_from_private(void *out_public_key, const void *private_key)
261} 207}
262 208
263int 209int
264mlkem1024_parse_public_key(void *out_public_key, CBS *public_key_cbs) 210mlkem1024_parse_public_key(void *out_public_key, const uint8_t *public_key,
211 size_t public_key_len)
265{ 212{
266 return MLKEM1024_parse_public_key(out_public_key, public_key_cbs); 213 return MLKEM1024_parse_public_key(out_public_key, public_key,
214 public_key_len);
267} 215}
diff --git a/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.h b/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.h
index 7fbe6f76a9..1235309f60 100644
--- a/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.h
+++ b/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: mlkem_tests_util.h,v 1.4 2024/12/26 00:04:24 tb Exp $ */ 1/* $OpenBSD: mlkem_tests_util.h,v 1.7 2025/05/20 00:33:41 beck Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Bob Beck <beck@obtuse.com> 3 * Copyright (c) 2024 Bob Beck <beck@obtuse.com>
4 * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> 4 * Copyright (c) 2024 Theo Buehler <tb@openbsd.org>
@@ -30,13 +30,13 @@
30int compare_data(const uint8_t *want, const uint8_t *got, size_t len, 30int compare_data(const uint8_t *want, const uint8_t *got, size_t len,
31 const char *msg); 31 const char *msg);
32 32
33int mlkem768_encode_private_key(const void *priv, uint8_t **out_buf, 33int mlkem768_marshal_private_key(const void *priv, uint8_t **out_buf,
34 size_t *out_len); 34 size_t *out_len);
35int mlkem768_encode_public_key(const void *pub, uint8_t **out_buf, 35int mlkem768_marshal_public_key(const void *pub, uint8_t **out_buf,
36 size_t *out_len); 36 size_t *out_len);
37int mlkem1024_encode_private_key(const void *priv, uint8_t **out_buf, 37int mlkem1024_marshal_private_key(const void *priv, uint8_t **out_buf,
38 size_t *out_len); 38 size_t *out_len);
39int mlkem1024_encode_public_key(const void *pub, uint8_t **out_buf, 39int mlkem1024_marshal_public_key(const void *pub, uint8_t **out_buf,
40 size_t *out_len); 40 size_t *out_len);
41 41
42int mlkem768_decap(uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], 42int mlkem768_decap(uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES],
@@ -46,12 +46,12 @@ void mlkem768_encap(uint8_t *out_ciphertext,
46void mlkem768_encap_external_entropy(uint8_t *out_ciphertext, 46void mlkem768_encap_external_entropy(uint8_t *out_ciphertext,
47 uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], const void *pub, 47 uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], const void *pub,
48 const uint8_t entropy[MLKEM_ENCAP_ENTROPY]); 48 const uint8_t entropy[MLKEM_ENCAP_ENTROPY]);
49void mlkem768_generate_key(uint8_t *out_encoded_public_key, 49int mlkem768_generate_key(uint8_t *out_encoded_public_key,
50 uint8_t optional_out_seed[MLKEM_SEED_BYTES], void *out_private_key); 50 uint8_t optional_out_seed[MLKEM_SEED_BYTES], void *out_private_key);
51void mlkem768_generate_key_external_entropy(uint8_t *out_encoded_public_key, 51int mlkem768_generate_key_external_entropy(uint8_t *out_encoded_public_key,
52 void *out_private_key, const uint8_t entropy[MLKEM_SEED_BYTES]); 52 void *out_private_key, const uint8_t entropy[MLKEM_SEED_BYTES]);
53int mlkem768_parse_private_key(void *priv, CBS *private_key_cbs); 53int mlkem768_parse_private_key(void *priv, const uint8_t *in, size_t in_len);
54int mlkem768_parse_public_key(void *pub, CBS *in); 54int mlkem768_parse_public_key(void *pub, const uint8_t *in, size_t in_len);
55void mlkem768_public_from_private(void *out_public_key, const void *private_key); 55void mlkem768_public_from_private(void *out_public_key, const void *private_key);
56 56
57int mlkem1024_decap(uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], 57int mlkem1024_decap(uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES],
@@ -61,16 +61,16 @@ void mlkem1024_encap(uint8_t *out_ciphertext,
61void mlkem1024_encap_external_entropy(uint8_t *out_ciphertext, 61void mlkem1024_encap_external_entropy(uint8_t *out_ciphertext,
62 uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], const void *pub, 62 uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], const void *pub,
63 const uint8_t entropy[MLKEM_ENCAP_ENTROPY]); 63 const uint8_t entropy[MLKEM_ENCAP_ENTROPY]);
64void mlkem1024_generate_key(uint8_t *out_encoded_public_key, 64int mlkem1024_generate_key(uint8_t *out_encoded_public_key,
65 uint8_t optional_out_seed[MLKEM_SEED_BYTES], void *out_private_key); 65 uint8_t optional_out_seed[MLKEM_SEED_BYTES], void *out_private_key);
66void mlkem1024_generate_key_external_entropy(uint8_t *out_encoded_public_key, 66int mlkem1024_generate_key_external_entropy(uint8_t *out_encoded_public_key,
67 void *out_private_key, const uint8_t entropy[MLKEM_SEED_BYTES]); 67 void *out_private_key, const uint8_t entropy[MLKEM_SEED_BYTES]);
68int mlkem1024_parse_private_key(void *priv, CBS *private_key_cbs); 68int mlkem1024_parse_private_key(void *priv, const uint8_t *in, size_t in_len);
69int mlkem1024_parse_public_key(void *pub, CBS *in); 69int mlkem1024_parse_public_key(void *pub, const uint8_t *in, size_t in_len);
70void mlkem1024_public_from_private(void *out_public_key, const void *private_key); 70void mlkem1024_public_from_private(void *out_public_key, const void *private_key);
71 71
72typedef int (*mlkem_encode_private_key_fn)(const void *, uint8_t **, size_t *); 72typedef int (*mlkem_marshal_private_key_fn)(const void *, uint8_t **, size_t *);
73typedef int (*mlkem_encode_public_key_fn)(const void *, uint8_t **, size_t *); 73typedef int (*mlkem_marshal_public_key_fn)(const void *, uint8_t **, size_t *);
74typedef int (*mlkem_decap_fn)(uint8_t [MLKEM_SHARED_SECRET_BYTES], 74typedef int (*mlkem_decap_fn)(uint8_t [MLKEM_SHARED_SECRET_BYTES],
75 const uint8_t *, size_t, const void *); 75 const uint8_t *, size_t, const void *);
76typedef void (*mlkem_encap_fn)(uint8_t *, uint8_t [MLKEM_SHARED_SECRET_BYTES], 76typedef void (*mlkem_encap_fn)(uint8_t *, uint8_t [MLKEM_SHARED_SECRET_BYTES],
@@ -78,11 +78,11 @@ typedef void (*mlkem_encap_fn)(uint8_t *, uint8_t [MLKEM_SHARED_SECRET_BYTES],
78typedef void (*mlkem_encap_external_entropy_fn)(uint8_t *, 78typedef void (*mlkem_encap_external_entropy_fn)(uint8_t *,
79 uint8_t [MLKEM_SHARED_SECRET_BYTES], const void *, 79 uint8_t [MLKEM_SHARED_SECRET_BYTES], const void *,
80 const uint8_t [MLKEM_ENCAP_ENTROPY]); 80 const uint8_t [MLKEM_ENCAP_ENTROPY]);
81typedef void (*mlkem_generate_key_fn)(uint8_t *, uint8_t *, void *); 81typedef int (*mlkem_generate_key_fn)(uint8_t *, uint8_t *, void *);
82typedef void (*mlkem_generate_key_external_entropy_fn)(uint8_t *, void *, 82typedef int (*mlkem_generate_key_external_entropy_fn)(uint8_t *, void *,
83 const uint8_t [MLKEM_SEED_BYTES]); 83 const uint8_t [MLKEM_SEED_BYTES]);
84typedef int (*mlkem_parse_private_key_fn)(void *, CBS *); 84typedef int (*mlkem_parse_private_key_fn)(void *, const uint8_t *, size_t);
85typedef int (*mlkem_parse_public_key_fn)(void *, CBS *); 85typedef int (*mlkem_parse_public_key_fn)(void *, const uint8_t *, size_t);
86typedef void (*mlkem_public_from_private_fn)(void *out_public_key, 86typedef void (*mlkem_public_from_private_fn)(void *out_public_key,
87 const void *private_key); 87 const void *private_key);
88 88
diff --git a/src/regress/lib/libcrypto/mlkem/mlkem_unittest.c b/src/regress/lib/libcrypto/mlkem/mlkem_unittest.c
index 23b3d8b261..adb1c47d8e 100644
--- a/src/regress/lib/libcrypto/mlkem/mlkem_unittest.c
+++ b/src/regress/lib/libcrypto/mlkem/mlkem_unittest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: mlkem_unittest.c,v 1.6 2024/12/26 12:35:25 tb Exp $ */ 1/* $OpenBSD: mlkem_unittest.c,v 1.11 2025/05/21 03:46:20 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Google Inc. 3 * Copyright (c) 2024 Google Inc.
4 * Copyright (c) 2024 Bob Beck <beck@obtuse.com> 4 * Copyright (c) 2024 Bob Beck <beck@obtuse.com>
@@ -41,8 +41,8 @@ struct unittest_ctx {
41 mlkem_generate_key_fn generate_key; 41 mlkem_generate_key_fn generate_key;
42 mlkem_parse_private_key_fn parse_private_key; 42 mlkem_parse_private_key_fn parse_private_key;
43 mlkem_parse_public_key_fn parse_public_key; 43 mlkem_parse_public_key_fn parse_public_key;
44 mlkem_encode_private_key_fn encode_private_key; 44 mlkem_marshal_private_key_fn marshal_private_key;
45 mlkem_encode_public_key_fn encode_public_key; 45 mlkem_marshal_public_key_fn marshal_public_key;
46 mlkem_public_from_private_fn public_from_private; 46 mlkem_public_from_private_fn public_from_private;
47}; 47};
48 48
@@ -54,36 +54,32 @@ MlKemUnitTest(struct unittest_ctx *ctx)
54 uint8_t first_two_bytes[2]; 54 uint8_t first_two_bytes[2];
55 uint8_t *encoded_private_key = NULL, *tmp_buf = NULL; 55 uint8_t *encoded_private_key = NULL, *tmp_buf = NULL;
56 size_t encoded_private_key_len, tmp_buf_len; 56 size_t encoded_private_key_len, tmp_buf_len;
57 CBS cbs;
58 int failed = 0; 57 int failed = 0;
59 58
60 ctx->generate_key(ctx->encoded_public_key, NULL, ctx->priv); 59 if (!ctx->generate_key(ctx->encoded_public_key, NULL, ctx->priv)) {
60 warnx("generate_key failed");
61 failed |= 1;
62 }
61 63
62 memcpy(first_two_bytes, ctx->encoded_public_key, sizeof(first_two_bytes)); 64 memcpy(first_two_bytes, ctx->encoded_public_key, sizeof(first_two_bytes));
63 memset(ctx->encoded_public_key, 0xff, sizeof(first_two_bytes)); 65 memset(ctx->encoded_public_key, 0xff, sizeof(first_two_bytes));
64 66
65 CBS_init(&cbs, ctx->encoded_public_key, ctx->encoded_public_key_len);
66
67 /* Parsing should fail because the first coefficient is >= kPrime. */ 67 /* Parsing should fail because the first coefficient is >= kPrime. */
68 if (ctx->parse_public_key(ctx->pub, &cbs)) { 68 if (ctx->parse_public_key(ctx->pub, ctx->encoded_public_key,
69 ctx->encoded_public_key_len)) {
69 warnx("parse_public_key should have failed"); 70 warnx("parse_public_key should have failed");
70 failed |= 1; 71 failed |= 1;
71 } 72 }
72 73
73 memcpy(ctx->encoded_public_key, first_two_bytes, sizeof(first_two_bytes)); 74 memcpy(ctx->encoded_public_key, first_two_bytes, sizeof(first_two_bytes));
74 CBS_init(&cbs, ctx->encoded_public_key, ctx->encoded_public_key_len); 75 if (!ctx->parse_public_key(ctx->pub, ctx->encoded_public_key,
75 if (!ctx->parse_public_key(ctx->pub, &cbs)) { 76 ctx->encoded_public_key_len)) {
76 warnx("MLKEM768_parse_public_key"); 77 warnx("MLKEM768_parse_public_key");
77 failed |= 1; 78 failed |= 1;
78 } 79 }
79 80
80 if (CBS_len(&cbs) != 0u) { 81 if (!ctx->marshal_public_key(ctx->pub, &tmp_buf, &tmp_buf_len)) {
81 warnx("CBS_len must be 0"); 82 warnx("marshal_public_key");
82 failed |= 1;
83 }
84
85 if (!ctx->encode_public_key(ctx->pub, &tmp_buf, &tmp_buf_len)) {
86 warnx("encode_public_key");
87 failed |= 1; 83 failed |= 1;
88 } 84 }
89 if (ctx->encoded_public_key_len != tmp_buf_len) { 85 if (ctx->encoded_public_key_len != tmp_buf_len) {
@@ -100,8 +96,8 @@ MlKemUnitTest(struct unittest_ctx *ctx)
100 tmp_buf = NULL; 96 tmp_buf = NULL;
101 97
102 ctx->public_from_private(ctx->pub2, ctx->priv); 98 ctx->public_from_private(ctx->pub2, ctx->priv);
103 if (!ctx->encode_public_key(ctx->pub2, &tmp_buf, &tmp_buf_len)) { 99 if (!ctx->marshal_public_key(ctx->pub2, &tmp_buf, &tmp_buf_len)) {
104 warnx("encode_public_key"); 100 warnx("marshal_public_key");
105 failed |= 1; 101 failed |= 1;
106 } 102 }
107 if (ctx->encoded_public_key_len != tmp_buf_len) { 103 if (ctx->encoded_public_key_len != tmp_buf_len) {
@@ -117,7 +113,7 @@ MlKemUnitTest(struct unittest_ctx *ctx)
117 free(tmp_buf); 113 free(tmp_buf);
118 tmp_buf = NULL; 114 tmp_buf = NULL;
119 115
120 if (!ctx->encode_private_key(ctx->priv, &encoded_private_key, 116 if (!ctx->marshal_private_key(ctx->priv, &encoded_private_key,
121 &encoded_private_key_len)) { 117 &encoded_private_key_len)) {
122 warnx("mlkem768_encode_private_key"); 118 warnx("mlkem768_encode_private_key");
123 failed |= 1; 119 failed |= 1;
@@ -125,23 +121,23 @@ MlKemUnitTest(struct unittest_ctx *ctx)
125 121
126 memcpy(first_two_bytes, encoded_private_key, sizeof(first_two_bytes)); 122 memcpy(first_two_bytes, encoded_private_key, sizeof(first_two_bytes));
127 memset(encoded_private_key, 0xff, sizeof(first_two_bytes)); 123 memset(encoded_private_key, 0xff, sizeof(first_two_bytes));
128 CBS_init(&cbs, encoded_private_key, encoded_private_key_len);
129 124
130 /* Parsing should fail because the first coefficient is >= kPrime. */ 125 /* Parsing should fail because the first coefficient is >= kPrime. */
131 if (ctx->parse_private_key(ctx->priv2, &cbs)) { 126 if (ctx->parse_private_key(ctx->priv2, encoded_private_key,
127 encoded_private_key_len)) {
132 warnx("MLKEM768_parse_private_key should have failed"); 128 warnx("MLKEM768_parse_private_key should have failed");
133 failed |= 1; 129 failed |= 1;
134 } 130 }
135 131
136 memcpy(encoded_private_key, first_two_bytes, sizeof(first_two_bytes)); 132 memcpy(encoded_private_key, first_two_bytes, sizeof(first_two_bytes));
137 CBS_init(&cbs, encoded_private_key, encoded_private_key_len);
138 133
139 if (!ctx->parse_private_key(ctx->priv2, &cbs)) { 134 if (!ctx->parse_private_key(ctx->priv2, encoded_private_key,
135 encoded_private_key_len)) {
140 warnx("MLKEM768_parse_private_key"); 136 warnx("MLKEM768_parse_private_key");
141 failed |= 1; 137 failed |= 1;
142 } 138 }
143 139
144 if (!ctx->encode_private_key(ctx->priv2, &tmp_buf, &tmp_buf_len)) { 140 if (!ctx->marshal_private_key(ctx->priv2, &tmp_buf, &tmp_buf_len)) {
145 warnx("encode_private_key"); 141 warnx("encode_private_key");
146 failed |= 1; 142 failed |= 1;
147 } 143 }
@@ -161,16 +157,22 @@ MlKemUnitTest(struct unittest_ctx *ctx)
161 tmp_buf = NULL; 157 tmp_buf = NULL;
162 158
163 ctx->encap(ctx->ciphertext, shared_secret1, ctx->pub); 159 ctx->encap(ctx->ciphertext, shared_secret1, ctx->pub);
164 ctx->decap(shared_secret2, ctx->ciphertext, ctx->ciphertext_len, 160 if (!ctx->decap(shared_secret2, ctx->ciphertext, ctx->ciphertext_len,
165 ctx->priv); 161 ctx->priv)) {
162 warnx("decap() failed using priv");
163 failed |= 1;
164 }
166 if (compare_data(shared_secret1, shared_secret2, MLKEM_SHARED_SECRET_BYTES, 165 if (compare_data(shared_secret1, shared_secret2, MLKEM_SHARED_SECRET_BYTES,
167 "shared secrets with priv") != 0) { 166 "shared secrets with priv") != 0) {
168 warnx("compare_data"); 167 warnx("compare_data");
169 failed |= 1; 168 failed |= 1;
170 } 169 }
171 170
172 ctx->decap(shared_secret2, ctx->ciphertext, ctx->ciphertext_len, 171 if (!ctx->decap(shared_secret2, ctx->ciphertext, ctx->ciphertext_len,
173 ctx->priv2); 172 ctx->priv2)) {
173 warnx("decap() failed using priv2");
174 failed |= 1;
175 }
174 if (compare_data(shared_secret1, shared_secret2, MLKEM_SHARED_SECRET_BYTES, 176 if (compare_data(shared_secret1, shared_secret2, MLKEM_SHARED_SECRET_BYTES,
175 "shared secrets with priv2") != 0) { 177 "shared secrets with priv2") != 0) {
176 warnx("compare_data"); 178 warnx("compare_data");
@@ -203,8 +205,8 @@ mlkem768_unittest(void)
203 .generate_key = mlkem768_generate_key, 205 .generate_key = mlkem768_generate_key,
204 .parse_private_key = mlkem768_parse_private_key, 206 .parse_private_key = mlkem768_parse_private_key,
205 .parse_public_key = mlkem768_parse_public_key, 207 .parse_public_key = mlkem768_parse_public_key,
206 .encode_private_key = mlkem768_encode_private_key, 208 .marshal_private_key = mlkem768_marshal_private_key,
207 .encode_public_key = mlkem768_encode_public_key, 209 .marshal_public_key = mlkem768_marshal_public_key,
208 .public_from_private = mlkem768_public_from_private, 210 .public_from_private = mlkem768_public_from_private,
209 }; 211 };
210 212
@@ -232,8 +234,8 @@ mlkem1024_unittest(void)
232 .generate_key = mlkem1024_generate_key, 234 .generate_key = mlkem1024_generate_key,
233 .parse_private_key = mlkem1024_parse_private_key, 235 .parse_private_key = mlkem1024_parse_private_key,
234 .parse_public_key = mlkem1024_parse_public_key, 236 .parse_public_key = mlkem1024_parse_public_key,
235 .encode_private_key = mlkem1024_encode_private_key, 237 .marshal_private_key = mlkem1024_marshal_private_key,
236 .encode_public_key = mlkem1024_encode_public_key, 238 .marshal_public_key = mlkem1024_marshal_public_key,
237 .public_from_private = mlkem1024_public_from_private, 239 .public_from_private = mlkem1024_public_from_private,
238 }; 240 };
239 241
@@ -248,7 +250,7 @@ main(void)
248 /* 250 /*
249 * XXX - this is split into two helper functions since having a few 251 * XXX - this is split into two helper functions since having a few
250 * ML-KEM key blobs on the stack makes Emscripten's stack explode, 252 * ML-KEM key blobs on the stack makes Emscripten's stack explode,
251 * leading to inscrutable silent failures unles ASAN is enabled. 253 * leading to inscrutable silent failures unless ASAN is enabled.
252 * Go figure. 254 * Go figure.
253 */ 255 */
254 256
diff --git a/src/regress/lib/libcrypto/mlkem/parse_test_file.c b/src/regress/lib/libcrypto/mlkem/parse_test_file.c
index 19f03439e2..9f3e5f3a1a 100644
--- a/src/regress/lib/libcrypto/mlkem/parse_test_file.c
+++ b/src/regress/lib/libcrypto/mlkem/parse_test_file.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: parse_test_file.c,v 1.3 2024/12/27 11:17:48 tb Exp $ */ 1/* $OpenBSD: parse_test_file.c,v 1.6 2025/06/03 10:29:37 tb Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> 4 * Copyright (c) 2024 Theo Buehler <tb@openbsd.org>
@@ -47,6 +47,8 @@ static void
47line_data_clear(struct line_data *ld) 47line_data_clear(struct line_data *ld)
48{ 48{
49 freezero(ld->data, ld->data_len); 49 freezero(ld->data, ld->data_len);
50 /* The dereference isn't enough for silly old gcc 14. */
51 assert(ld != NULL);
50 explicit_bzero(ld, sizeof(*ld)); 52 explicit_bzero(ld, sizeof(*ld));
51} 53}
52 54
@@ -644,7 +646,8 @@ parse_reinit(struct parse *p)
644 p->state.running_test_case = 0; 646 p->state.running_test_case = 0;
645 parse_line_data_clear(p); 647 parse_line_data_clear(p);
646 tctx->finish(p->ctx); 648 tctx->finish(p->ctx);
647 tctx->init(p->ctx, p); 649 if (!tctx->init(p->ctx, p))
650 parse_errx(p, "init failed");
648} 651}
649 652
650static int 653static int
@@ -706,7 +709,8 @@ parse_init(struct parse *p, const char *fn, const struct test_parse *tctx,
706 parse_state_init(&p->state, tctx->num_states, tctx->num_instructions); 709 parse_state_init(&p->state, tctx->num_states, tctx->num_instructions);
707 p->tctx = tctx; 710 p->tctx = tctx;
708 p->ctx = ctx; 711 p->ctx = ctx;
709 tctx->init(ctx, p); 712 if (!tctx->init(p->ctx, p))
713 parse_errx(p, "init failed");
710} 714}
711 715
712static int 716static int
@@ -732,7 +736,10 @@ parse_next_line(struct parse *p)
732static void 736static void
733parse_finish(struct parse *p) 737parse_finish(struct parse *p)
734{ 738{
739 const struct test_parse *tctx = p->tctx;
740
735 parse_state_finish(&p->state); 741 parse_state_finish(&p->state);
742 tctx->finish(p->ctx);
736 743
737 free(p->buf); 744 free(p->buf);
738 745
diff --git a/src/regress/lib/libcrypto/sha/Makefile b/src/regress/lib/libcrypto/sha/Makefile
index 6ec223116d..c6ab0398ba 100644
--- a/src/regress/lib/libcrypto/sha/Makefile
+++ b/src/regress/lib/libcrypto/sha/Makefile
@@ -1,9 +1,15 @@
1# $OpenBSD: Makefile,v 1.5 2022/09/01 14:02:41 tb Exp $ 1# $OpenBSD: Makefile,v 1.6 2025/05/22 03:35:40 joshua Exp $
2 2
3PROG = sha_test 3PROG = sha_test
4LDADD = -lcrypto 4LDADD = -lcrypto
5DPADD = ${LIBCRYPTO} 5DPADD = ${LIBCRYPTO}
6WARNINGS = Yes 6WARNINGS = Yes
7CFLAGS += -DLIBRESSL_INTERNAL -Werror 7CFLAGS += -DLIBRESSL_INTERNAL -Werror
8CFLAGS += -I${.CURDIR}/../test
9SRCS += sha_test.c
10SRCS += test.c
11SRCS += test_util.c
12
13.PATH: ${.CURDIR}/../test
8 14
9.include <bsd.regress.mk> 15.include <bsd.regress.mk>
diff --git a/src/regress/lib/libcrypto/sha/sha_test.c b/src/regress/lib/libcrypto/sha/sha_test.c
index 82a0c4cceb..904924c890 100644
--- a/src/regress/lib/libcrypto/sha/sha_test.c
+++ b/src/regress/lib/libcrypto/sha/sha_test.c
@@ -1,6 +1,6 @@
1/* $OpenBSD: sha_test.c,v 1.6 2023/07/19 15:11:42 joshua Exp $ */ 1/* $OpenBSD: sha_test.c,v 1.7 2025/05/22 03:35:40 joshua Exp $ */
2/* 2/*
3 * Copyright (c) 2022, 2023 Joshua Sing <joshua@hypera.dev> 3 * Copyright (c) 2022, 2023, 2025 Joshua Sing <joshua@joshuasing.dev>
4 * 4 *
5 * Permission to use, copy, modify, and distribute this software for any 5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above 6 * purpose with or without fee is hereby granted, provided that the above
@@ -21,6 +21,8 @@
21#include <stdint.h> 21#include <stdint.h>
22#include <string.h> 22#include <string.h>
23 23
24#include "test.h"
25
24struct sha_test { 26struct sha_test {
25 const int algorithm; 27 const int algorithm;
26 const uint8_t in[128]; 28 const uint8_t in[128];
@@ -677,260 +679,240 @@ typedef unsigned char *(*sha_hash_func)(const unsigned char *, size_t,
677 unsigned char *); 679 unsigned char *);
678 680
679static int 681static int
680sha_hash_from_algorithm(int algorithm, const char **out_label, 682sha_hash_from_algorithm(int algorithm, sha_hash_func *out_func,
681 sha_hash_func *out_func, const EVP_MD **out_md, size_t *out_len) 683 const EVP_MD **out_md)
682{ 684{
683 const char *label;
684 sha_hash_func sha_func; 685 sha_hash_func sha_func;
685 const EVP_MD *md; 686 const EVP_MD *md;
686 size_t len;
687 687
688 switch (algorithm) { 688 switch (algorithm) {
689 case NID_sha1: 689 case NID_sha1:
690 label = SN_sha1;
691 sha_func = SHA1; 690 sha_func = SHA1;
692 md = EVP_sha1(); 691 md = EVP_sha1();
693 len = SHA_DIGEST_LENGTH;
694 break; 692 break;
695 case NID_sha224: 693 case NID_sha224:
696 label = SN_sha224;
697 sha_func = SHA224; 694 sha_func = SHA224;
698 md = EVP_sha224(); 695 md = EVP_sha224();
699 len = SHA224_DIGEST_LENGTH;
700 break; 696 break;
701 case NID_sha256: 697 case NID_sha256:
702 label = SN_sha256;
703 sha_func = SHA256; 698 sha_func = SHA256;
704 md = EVP_sha256(); 699 md = EVP_sha256();
705 len = SHA256_DIGEST_LENGTH;
706 break; 700 break;
707 case NID_sha384: 701 case NID_sha384:
708 label = SN_sha384;
709 sha_func = SHA384; 702 sha_func = SHA384;
710 md = EVP_sha384(); 703 md = EVP_sha384();
711 len = SHA384_DIGEST_LENGTH;
712 break; 704 break;
713 case NID_sha512: 705 case NID_sha512:
714 label = SN_sha512;
715 sha_func = SHA512; 706 sha_func = SHA512;
716 md = EVP_sha512(); 707 md = EVP_sha512();
717 len = SHA512_DIGEST_LENGTH;
718 break; 708 break;
719 case NID_sha3_224: 709 case NID_sha3_224:
720 label = SN_sha3_224;
721 sha_func = NULL; 710 sha_func = NULL;
722 md = EVP_sha3_224(); 711 md = EVP_sha3_224();
723 len = 224 / 8;
724 break; 712 break;
725 case NID_sha3_256: 713 case NID_sha3_256:
726 label = SN_sha3_256;
727 sha_func = NULL; 714 sha_func = NULL;
728 md = EVP_sha3_256(); 715 md = EVP_sha3_256();
729 len = 256 / 8;
730 break; 716 break;
731 case NID_sha3_384: 717 case NID_sha3_384:
732 label = SN_sha3_384;
733 sha_func = NULL; 718 sha_func = NULL;
734 md = EVP_sha3_384(); 719 md = EVP_sha3_384();
735 len = 384 / 8;
736 break; 720 break;
737 case NID_sha3_512: 721 case NID_sha3_512:
738 label = SN_sha3_512;
739 sha_func = NULL; 722 sha_func = NULL;
740 md = EVP_sha3_512(); 723 md = EVP_sha3_512();
741 len = 512 / 8;
742 break; 724 break;
743 default: 725 default:
744 fprintf(stderr, "FAIL: unknown algorithm (%d)\n",
745 algorithm);
746 return 0; 726 return 0;
747 } 727 }
748 728
749 if (out_label != NULL)
750 *out_label = label;
751 if (out_func != NULL) 729 if (out_func != NULL)
752 *out_func = sha_func; 730 *out_func = sha_func;
753 if (out_md != NULL) 731 if (out_md != NULL)
754 *out_md = md; 732 *out_md = md;
755 if (out_len != NULL)
756 *out_len = len;
757 733
758 return 1; 734 return 1;
759} 735}
760 736
761static int 737static void
762sha_test(void) 738test_sha_tv(struct test *t, const void *arg)
763{ 739{
740 const struct sha_test *st = arg;
764 sha_hash_func sha_func; 741 sha_hash_func sha_func;
765 const struct sha_test *st;
766 EVP_MD_CTX *hash = NULL; 742 EVP_MD_CTX *hash = NULL;
767 const EVP_MD *md; 743 const EVP_MD *md;
768 uint8_t out[EVP_MAX_MD_SIZE]; 744 uint8_t out[EVP_MAX_MD_SIZE];
769 size_t in_len, out_len; 745 size_t in_len, out_len;
770 size_t i;
771 const char *label;
772 int failed = 1;
773 746
774 if ((hash = EVP_MD_CTX_new()) == NULL) { 747 if ((hash = EVP_MD_CTX_new()) == NULL) {
775 fprintf(stderr, "FAIL: EVP_MD_CTX_new() failed\n"); 748 test_errorf(t, "EVP_MD_CTX_new()");
776 goto failed; 749 goto fail;
777 } 750 }
778 751
779 for (i = 0; i < N_SHA_TESTS; i++) { 752 if (!sha_hash_from_algorithm(st->algorithm, &sha_func, &md))
780 st = &sha_tests[i]; 753 goto fail;
781 if (!sha_hash_from_algorithm(st->algorithm, &label, &sha_func,
782 &md, &out_len))
783 goto failed;
784
785 /* Digest */
786 if (sha_func != NULL) {
787 memset(out, 0, sizeof(out));
788 sha_func(st->in, st->in_len, out);
789 if (memcmp(st->out, out, out_len) != 0) {
790 fprintf(stderr, "FAIL (%s:%zu): mismatch\n",
791 label, i);
792 goto failed;
793 }
794 }
795 754
796 /* EVP single-shot digest */ 755 out_len = EVP_MD_size(md);
797 memset(out, 0, sizeof(out));
798 if (!EVP_Digest(st->in, st->in_len, out, NULL, md, NULL)) {
799 fprintf(stderr, "FAIL (%s:%zu): EVP_Digest failed\n",
800 label, i);
801 goto failed;
802 }
803 756
757 /* Digest */
758 if (sha_func != NULL) {
759 memset(out, 0, sizeof(out));
760 sha_func(st->in, st->in_len, out);
804 if (memcmp(st->out, out, out_len) != 0) { 761 if (memcmp(st->out, out, out_len) != 0) {
805 fprintf(stderr, 762 test_errorf(t, "SHA: digest output mismatch");
806 "FAIL (%s:%zu): EVP single-shot mismatch\n", 763 test_hexdiff(t, out, out_len, st->out);
807 label, i);
808 goto failed;
809 } 764 }
765 }
810 766
811 /* EVP digest */ 767 /* EVP single-shot digest */
812 memset(out, 0, sizeof(out)); 768 memset(out, 0, sizeof(out));
813 if (!EVP_DigestInit_ex(hash, md, NULL)) { 769 if (!EVP_Digest(st->in, st->in_len, out, NULL, md, NULL)) {
814 fprintf(stderr, 770 test_errorf(t, "EVP_Digest()");
815 "FAIL (%s:%zu): EVP_DigestInit_ex failed\n", 771 goto fail;
816 label, i); 772 }
817 goto failed;
818 }
819 773
820 in_len = st->in_len / 2; 774 if (memcmp(st->out, out, out_len) != 0) {
821 if (!EVP_DigestUpdate(hash, st->in, in_len)) { 775 test_errorf(t, "EVP single-shot: output diget mismatch");
822 fprintf(stderr, 776 test_hexdiff(t, out, out_len, st->out);
823 "FAIL (%s:%zu): EVP_DigestUpdate first half " 777 }
824 "failed\n", label, i);
825 goto failed;
826 }
827 778
828 if (!EVP_DigestUpdate(hash, st->in + in_len, 779 /* EVP digest */
829 st->in_len - in_len)) { 780 memset(out, 0, sizeof(out));
830 fprintf(stderr, 781 if (!EVP_DigestInit_ex(hash, md, NULL)) {
831 "FAIL (%s:%zu): EVP_DigestUpdate second half " 782 test_errorf(t, "EVP_DigestInit_ex() ");
832 "failed\n", label, i); 783 goto fail;
833 goto failed; 784 }
834 }
835 785
836 if (!EVP_DigestFinal_ex(hash, out, NULL)) { 786 in_len = st->in_len / 2;
837 fprintf(stderr, 787 if (!EVP_DigestUpdate(hash, st->in, in_len)) {
838 "FAIL (%s:%zu): EVP_DigestFinal_ex failed\n", 788 test_errorf(t, "EVP_DigestUpdate() first half");
839 label, i); 789 goto fail;
840 goto failed; 790 }
841 }
842 791
843 if (memcmp(st->out, out, out_len) != 0) { 792 if (!EVP_DigestUpdate(hash, st->in + in_len,
844 fprintf(stderr, "FAIL (%s:%zu): EVP mismatch\n", 793 st->in_len - in_len)) {
845 label, i); 794 test_errorf(t, "EVP_DigestUpdate() second half");
846 goto failed; 795 goto fail;
847 }
848 } 796 }
849 797
850 failed = 0; 798 if (!EVP_DigestFinal_ex(hash, out, NULL)) {
799 test_errorf(t, "EVP_DigestFinal_ex()");
800 goto fail;
801 }
851 802
852 failed: 803 if (memcmp(st->out, out, out_len) != 0) {
804 test_errorf(t, "EVP: digest output mismatch");
805 test_hexdiff(t, out, out_len, st->out);
806 }
807
808
809 fail:
853 EVP_MD_CTX_free(hash); 810 EVP_MD_CTX_free(hash);
854 return failed;
855} 811}
856 812
857static int 813static void
858sha_repetition_test(void) 814test_sha(struct test *t, const void *arg)
859{ 815{
860 const struct sha_repetition_test *st; 816 const struct sha_test *st;
817 size_t i;
818 char *name;
819
820 for (i = 0; i < N_SHA_TESTS; i++) {
821 st = &sha_tests[i];
822 if (asprintf(&name, "%s: '%s'", OBJ_nid2sn(st->algorithm), st->in) == -1) {
823 test_errorf(t, "create test name failed");
824 return;
825 }
826
827 test_run(t, name, test_sha_tv, st);
828 free(name);
829 }
830}
831
832static void
833test_sha_repetition_tv(struct test *t, const void *arg)
834{
835 const struct sha_repetition_test *st = arg;
861 EVP_MD_CTX *hash = NULL; 836 EVP_MD_CTX *hash = NULL;
862 const EVP_MD *md; 837 const EVP_MD *md;
863 uint8_t buf[1024]; 838 uint8_t buf[1024];
864 uint8_t out[EVP_MAX_MD_SIZE]; 839 uint8_t out[EVP_MAX_MD_SIZE];
865 size_t out_len, part_len; 840 size_t out_len, part_len;
866 size_t i, j; 841 size_t i;
867 const char *label;
868 int failed = 1;
869 842
870 if ((hash = EVP_MD_CTX_new()) == NULL) { 843 if ((hash = EVP_MD_CTX_new()) == NULL) {
871 fprintf(stderr, "FAIL: EVP_MD_CTX_new() failed\n"); 844 test_errorf(t, "EVP_MD_CTX_new()");
872 goto failed; 845 goto fail;
873 } 846 }
874 847
875 for (i = 0; i < N_SHA_REPETITION_TESTS; i++) { 848 if (!sha_hash_from_algorithm(st->algorithm, NULL, &md))
876 st = &sha_repetition_tests[i]; 849 goto fail;
877 if (!sha_hash_from_algorithm(st->algorithm, &label, NULL, &md,
878 &out_len))
879 goto failed;
880
881 /* EVP digest */
882 if (!EVP_DigestInit_ex(hash, md, NULL)) {
883 fprintf(stderr,
884 "FAIL (%s:%zu): EVP_DigestInit_ex failed\n",
885 label, i);
886 goto failed;
887 }
888 850
889 memset(buf, st->in, sizeof(buf)); 851 out_len = EVP_MD_size(md);
890 852
891 for (j = 0; j < st->in_repetitions;) { 853 /* EVP digest */
892 part_len = arc4random_uniform(sizeof(buf)); 854 if (!EVP_DigestInit_ex(hash, md, NULL)) {
893 if (part_len > st->in_repetitions - j) 855 test_errorf(t, "EVP_DigestInit_ex()");
894 part_len = st->in_repetitions - j; 856 goto fail;
857 }
895 858
896 if (!EVP_DigestUpdate(hash, buf, part_len)) { 859 memset(buf, st->in, sizeof(buf));
897 fprintf(stderr,
898 "FAIL (%s:%zu): EVP_DigestUpdate failed\n",
899 label, i);
900 goto failed;
901 }
902 860
903 j += part_len; 861 for (i = 0; i < st->in_repetitions;) {
904 } 862 part_len = arc4random_uniform(sizeof(buf));
863 if (part_len > st->in_repetitions - i)
864 part_len = st->in_repetitions - i;
905 865
906 if (!EVP_DigestFinal_ex(hash, out, NULL)) { 866 if (!EVP_DigestUpdate(hash, buf, part_len)) {
907 fprintf(stderr, 867 test_errorf(t, "EVP_DigestUpdate()");
908 "FAIL (%s:%zu): EVP_DigestFinal_ex failed\n", 868 goto fail;
909 label, i);
910 goto failed;
911 } 869 }
912 870
913 if (memcmp(st->out, out, out_len) != 0) { 871 i += part_len;
914 fprintf(stderr, "FAIL (%s:%zu): EVP mismatch\n", 872 }
915 label, i); 873
916 goto failed; 874 if (!EVP_DigestFinal_ex(hash, out, NULL)) {
917 } 875 test_errorf(t, "EVP_DigestFinal_ex()");
876 goto fail;
918 } 877 }
919 878
920 failed = 0; 879 if (memcmp(st->out, out, out_len) != 0) {
880 test_errorf(t, "EVP: digest output mismatch");
881 test_hexdiff(t, out, out_len, st->out);
882 goto fail;
883 }
921 884
922 failed: 885 fail:
923 EVP_MD_CTX_free(hash); 886 EVP_MD_CTX_free(hash);
924 return failed; 887}
888
889static void
890test_sha_repetition(struct test *t, const void *arg)
891{
892 const struct sha_repetition_test *st;
893 size_t i;
894 char *name;
895
896 for (i = 0; i < N_SHA_REPETITION_TESTS; i++) {
897 st = &sha_repetition_tests[i];
898 if (asprintf(&name, "%s: '%hhu' x %zu", OBJ_nid2sn(st->algorithm),
899 st->in, st->in_repetitions) == -1) {
900 test_errorf(t, "create test name failed");
901 return;
902 }
903
904 test_run(t, name, test_sha_repetition_tv, st);
905 free(name);
906 }
925} 907}
926 908
927int 909int
928main(int argc, char **argv) 910main(int argc, char **argv)
929{ 911{
930 int failed = 0; 912 struct test *t = test_init();
931 913
932 failed |= sha_test(); 914 test_run(t, "sha", test_sha, NULL);
933 failed |= sha_repetition_test(); 915 test_run(t, "sha repetition", test_sha_repetition, NULL);
934 916
935 return failed; 917 return test_result(t);
936} 918}
diff --git a/src/regress/lib/libcrypto/test/test.c b/src/regress/lib/libcrypto/test/test.c
new file mode 100644
index 0000000000..1188ec34ef
--- /dev/null
+++ b/src/regress/lib/libcrypto/test/test.c
@@ -0,0 +1,226 @@
1/* $OpenBSD: test.c,v 1.4 2025/05/31 11:36:48 tb Exp $ */
2/*
3 * Copyright (c) 2025 Joshua Sing <joshua@joshuasing.dev>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#include <err.h>
19#include <stdarg.h>
20#include <stdio.h>
21#include <stdlib.h>
22#include <string.h>
23#include <unistd.h>
24
25#include "test.h"
26
27struct test {
28 struct test *parent;
29 char *name;
30 FILE *out;
31 int skipped;
32 int failed;
33};
34
35static struct test *
36test_new(struct test *pt, const char *name)
37{
38 struct test *t;
39
40 if ((t = calloc(1, sizeof(*t))) == NULL)
41 err(1, "calloc");
42
43 if (name != NULL) {
44 if ((t->name = strdup(name)) == NULL)
45 err(1, "strdup");
46 }
47
48 if (pt != NULL)
49 t->out = pt->out;
50 t->parent = pt;
51
52 return t;
53}
54
55struct test *
56test_init(void)
57{
58 struct test *t;
59 char *tmp_file;
60 int out_fd;
61 char *v;
62
63 t = test_new(NULL, NULL);
64 t->out = stderr;
65
66 if (((v = getenv("TEST_VERBOSE")) != NULL) && strcmp(v, "0") != 0)
67 return t;
68
69 /* Create a temporary file for logging in non-verbose mode */
70 if ((tmp_file = strdup("/tmp/libressl-test.XXXXXXXX")) == NULL)
71 err(1, "strdup");
72 if ((out_fd = mkstemp(tmp_file)) == -1)
73 err(1, "mkstemp");
74
75 unlink(tmp_file);
76 free(tmp_file);
77 if ((t->out = fdopen(out_fd, "w+")) == NULL)
78 err(1, "fdopen");
79
80 return t;
81}
82
83static void
84test_cleanup(struct test *t)
85{
86 free(t->name);
87 free(t);
88}
89
90int
91test_result(struct test *t)
92{
93 int failed = t->failed;
94
95 if (t->parent == NULL && t->out != stderr)
96 fclose(t->out);
97
98 test_cleanup(t);
99
100 return failed;
101}
102
103void
104test_fail(struct test *t)
105{
106 t->failed = 1;
107
108 /* Also fail parent. */
109 if (t->parent != NULL)
110 test_fail(t->parent);
111}
112
113static void
114test_vprintf(struct test *t, const char *fmt, va_list ap)
115{
116 if (vfprintf(t->out, fmt, ap) == -1)
117 err(1, "vfprintf");
118}
119
120void
121test_printf(struct test *t, const char *fmt, ...)
122{
123 va_list ap;
124
125 va_start(ap, fmt);
126 test_vprintf(t, fmt, ap);
127 va_end(ap);
128}
129
130static void
131test_vlogf_internal(struct test *t, const char *label, const char *func,
132 const char *file, int line, const char *fmt, va_list ap)
133{
134 char *msg = NULL;
135 char *l = ": ";
136 const char *filename;
137
138 if (label == NULL) {
139 label = "";
140 l = "";
141 }
142
143 if (vasprintf(&msg, fmt, ap) == -1)
144 err(1, "vasprintf");
145
146 if ((filename = strrchr(file, '/')) != NULL)
147 filename++;
148 else
149 filename = file;
150
151 test_printf(t, "%s [%s:%d]%s%s: %s\n",
152 func, filename, line, l, label, msg);
153
154 free(msg);
155}
156
157void
158test_logf_internal(struct test *t, const char *label, const char *func,
159 const char *file, int line, const char *fmt, ...)
160{
161 va_list ap;
162
163 va_start(ap, fmt);
164 test_vlogf_internal(t, label, func, file, line, fmt, ap);
165 va_end(ap);
166}
167
168void
169test_skip(struct test *t, const char *reason)
170{
171 t->skipped = 1;
172 test_printf(t, "%s\n", reason);
173}
174
175void
176test_skipf(struct test *t, const char *fmt, ...)
177{
178 va_list ap;
179
180 t->skipped = 1;
181
182 va_start(ap, fmt);
183 test_vprintf(t, fmt, ap);
184 if (fputc('\n', t->out) == EOF)
185 err(1, "fputc");
186 va_end(ap);
187}
188
189void
190test_run(struct test *pt, const char *name, test_run_func *fn, const void *arg)
191{
192 struct test *t = test_new(pt, name);
193 char *status = "PASS";
194 char buf[1024];
195 size_t buflen;
196 int ferr;
197
198 /* Run test */
199 test_printf(t, "=== RUN %s\n", t->name);
200 fn(t, arg);
201
202 if (t->skipped)
203 status = "SKIP";
204 if (t->failed)
205 status = "FAIL";
206
207 test_printf(t, "--- %s: %s\n\n", status, t->name);
208
209 /* Print result of test */
210 if (t->failed && t->out != stderr) {
211 /* Copy logs to stderr */
212 rewind(t->out);
213 while ((buflen = fread(buf, 1, sizeof(buf), t->out)) > 0)
214 fwrite(buf, 1, buflen, stderr);
215 if ((ferr = ferror(t->out)) != 0)
216 errx(1, "ferror: %d", ferr);
217 }
218
219 if (t->out != NULL && t->out != stderr) {
220 /* Reset output file */
221 rewind(t->out);
222 ftruncate(fileno(t->out), 0);
223 }
224
225 test_cleanup(t);
226}
diff --git a/src/regress/lib/libcrypto/test/test.h b/src/regress/lib/libcrypto/test/test.h
new file mode 100644
index 0000000000..1c8391d4ec
--- /dev/null
+++ b/src/regress/lib/libcrypto/test/test.h
@@ -0,0 +1,137 @@
1/* $OpenBSD: test.h,v 1.4 2025/05/31 11:37:18 tb Exp $ */
2/*
3 * Copyright (c) 2025 Joshua Sing <joshua@joshuasing.dev>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#ifndef HEADER_TEST_H
19#define HEADER_TEST_H
20
21#include <stddef.h>
22#include <stdint.h>
23
24struct test;
25
26/*
27 * test_init creates a new root test struct.
28 *
29 * Additional tests may be run under the root test struct by calling test_run.
30 *
31 * If the TEST_VERBOSE environment variable is set and not equal to "0", then
32 * verbose mode will be enabled and all test logs will be written to stderr.
33 */
34struct test *test_init(void);
35
36/*
37 * test_result cleans up after all tests have completed and returns an
38 * appropriate exit code indicating the result of the tests.
39 */
40int test_result(struct test *_t);
41
42/*
43 * test_run_func is an individual test function. It is passed the test struct
44 * and an arbitrary argument which may be passed when test_run is called.
45 */
46typedef void (test_run_func)(struct test *_t, const void *_arg);
47
48/*
49 * test_fail marks the test and its parents as failed.
50 */
51void test_fail(struct test *_t);
52
53/*
54 * test_printf prints a test log message. When in verbose mode, the log message
55 * will be written to stderr, otherwise it will be buffered and only written to
56 * stderr if the test fails.
57 *
58 * This printf will write directly, without any additional formatting.
59 */
60void test_printf(struct test *_t, const char *_fmt, ...)
61 __attribute__((__format__ (printf, 2, 3)))
62 __attribute__((__nonnull__ (2)));
63
64/*
65 * test_logf_internal prints a test log message. When in verbose mode, the
66 * log message will be written to stderr, otherwise it will be buffered and
67 * only written to stderr if the test fails.
68 *
69 * label is an optional label indicating the severity of the log.
70 * func, file and line are used to show where the log comes from and are
71 * automatically set in the test log macros.
72 *
73 * This function should never be called directly.
74 */
75void test_logf_internal(struct test *_t, const char *_label, const char *_func,
76 const char *_file, int _line, const char *_fmt, ...)
77 __attribute__((__format__ (printf, 6, 7)))
78 __attribute__((__nonnull__ (6)));
79
80/*
81 * test_logf prints an informational log message. When in verbose mode, the log
82 * will be written to stderr, otherwise it will be buffered and only written to
83 * stderr if the test fails.
84 */
85#define test_logf(t, fmt, ...) \
86 do { \
87 test_logf_internal(t, NULL, __func__, __FILE__, __LINE__, fmt, ##__VA_ARGS__); \
88 } while (0)
89
90/*
91 * test_errorf prints an error message. It will also cause the test to fail.
92 * If the test cannot proceed, it is recommended to return or goto a cleanup
93 * label.
94 *
95 * Tests should not fail-fast if continuing will provide more detailed
96 * information about what is broken.
97 */
98#define test_errorf(t, fmt, ...) \
99 do { \
100 test_logf_internal(t, "ERROR", __func__, __FILE__, __LINE__, fmt, ##__VA_ARGS__); \
101 test_fail(t); \
102 } while (0)
103
104/*
105 * test_skip marks the test as skipped. Once called, the test should return.
106 */
107void test_skip(struct test *_t, const char *_reason);
108
109/*
110 * test_skipf marks the test as skipped with a formatted reason. Once called,
111 * the test should return.
112 */
113void test_skipf(struct test *_t, const char *_fmt, ...)
114 __attribute__((__format__ (printf, 2, 3)))
115 __attribute__((__nonnull__ (2)));
116
117/*
118 * test_run runs a test function. It will create a new test struct with the
119 * given test as the parent. An argument may be provided to pass data to the
120 * test function, otherwise NULL should be passed.
121 *
122 * Each test should have a unique and informational name.
123 */
124void test_run(struct test *_t, const char *_name, test_run_func *_fn, const void *_arg);
125
126/*
127 * test_hexdump prints the given data as hexadecimal.
128 */
129void test_hexdump(struct test *_t, const unsigned char *_buf, size_t _len);
130
131/*
132 * test_hexdiff prints the given data as hexadecimal. If a second comparison
133 * buffer is not NULL, any differing bytes will be marked with an astrix.
134 */
135void test_hexdiff(struct test *_t, const uint8_t *_buf, size_t _len, const uint8_t *_compare);
136
137#endif /* HEADER_TEST_H */
diff --git a/src/regress/lib/libcrypto/test/test_util.c b/src/regress/lib/libcrypto/test/test_util.c
new file mode 100644
index 0000000000..6ecb574788
--- /dev/null
+++ b/src/regress/lib/libcrypto/test/test_util.c
@@ -0,0 +1,51 @@
1/* $OpenBSD: test_util.c,v 1.1 2025/05/21 08:57:13 joshua Exp $ */
2/*
3 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2024 Theo Buehler <tb@openbsd.org>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#include <stdio.h>
20#include <stdint.h>
21
22#include "test.h"
23
24void
25test_hexdump(struct test *t, const unsigned char *buf, size_t len)
26{
27 size_t i;
28
29 for (i = 1; i <= len; i++)
30 test_printf(t, " 0x%02x,%s", buf[i - 1], i % 8 ? "" : "\n");
31
32 if ((len % 8) != 0)
33 test_printf(t, "\n");
34}
35
36void
37test_hexdiff(struct test *t, const uint8_t *buf, size_t len, const uint8_t *compare)
38{
39 const char *mark = "", *newline;
40 size_t i;
41
42 for (i = 1; i <= len; i++) {
43 if (compare != NULL)
44 mark = (buf[i - 1] != compare[i - 1]) ? "*" : " ";
45 newline = i % 8 ? "" : "\n";
46 test_printf(t, " %s0x%02x,%s", mark, buf[i - 1], newline);
47 }
48
49 if ((len % 8) != 0)
50 test_printf(t, "\n");
51}
diff --git a/src/regress/lib/libcrypto/wycheproof/Makefile b/src/regress/lib/libcrypto/wycheproof/Makefile
index f2f7910b5b..a68a270580 100644
--- a/src/regress/lib/libcrypto/wycheproof/Makefile
+++ b/src/regress/lib/libcrypto/wycheproof/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.9 2023/07/08 19:41:07 tb Exp $ 1# $OpenBSD: Makefile,v 1.10 2025/07/09 05:04:35 tb Exp $
2 2
3WYCHEPROOF_TESTVECTORS = /usr/local/share/wycheproof/testvectors/ 3WYCHEPROOF_TESTVECTORS = /usr/local/share/wycheproof/testvectors/
4 4
@@ -18,11 +18,17 @@ REGRESS_TARGETS += regress-wycheproof
18CLEANFILES += wycheproof 18CLEANFILES += wycheproof
19 19
20wycheproof: wycheproof.go 20wycheproof: wycheproof.go
21 go build -o wycheproof ${.CURDIR}/wycheproof.go 21 env GOCACHE=${.OBJDIR}/go-build go build -o wycheproof ${.CURDIR}/wycheproof.go
22 22
23regress-wycheproof: wycheproof 23regress-wycheproof: wycheproof
24 ./wycheproof 24 ./wycheproof
25 25
26REGRESS_CLEANUP = clean-go-cache
27
28clean-go-cache:
29 env GOCACHE=${.OBJDIR}/go-build go clean -cache
30 rm -rf ${.OBJDIR}/go-build
31
26. endif 32. endif
27 33
28PROGS += wycheproof-primes 34PROGS += wycheproof-primes
diff --git a/src/regress/lib/libcrypto/x509/Makefile b/src/regress/lib/libcrypto/x509/Makefile
index 80879f6e3c..94e9e476a0 100644
--- a/src/regress/lib/libcrypto/x509/Makefile
+++ b/src/regress/lib/libcrypto/x509/Makefile
@@ -1,7 +1,8 @@
1# $OpenBSD: Makefile,v 1.23 2024/06/16 17:57:08 tb Exp $ 1# $OpenBSD: Makefile,v 1.25 2025/05/05 06:33:34 tb Exp $
2 2
3PROGS = constraints verify x509attribute x509name x509req_ext callback 3PROGS = constraints verify x509attribute x509req_ext callback
4PROGS += expirecallback callbackfailures x509_asn1 x509_extensions_test 4PROGS += expirecallback callbackfailures x509_asn1 x509_extensions_test
5PROGS += x509_name_test
5LDADD = -lcrypto 6LDADD = -lcrypto
6DPADD = ${LIBCRYPTO} 7DPADD = ${LIBCRYPTO}
7 8
@@ -15,7 +16,7 @@ CFLAGS += -I${.CURDIR}/../../../../lib/libcrypto/bytestring
15 16
16SUBDIR += bettertls policy rfc3779 17SUBDIR += bettertls policy rfc3779
17 18
18CLEANFILES += x509name.result callback.out 19CLEANFILES += callback.out
19 20
20.if make(clean) || make(cleandir) 21.if make(clean) || make(cleandir)
21. if ${.OBJDIR} != ${.CURDIR} 22. if ${.OBJDIR} != ${.CURDIR}
@@ -28,10 +29,6 @@ run-regress-verify: verify
28 perl ${.CURDIR}/make-dir-roots.pl ${.CURDIR}/../certs . 29 perl ${.CURDIR}/make-dir-roots.pl ${.CURDIR}/../certs .
29 ./verify ${.CURDIR}/../certs 30 ./verify ${.CURDIR}/../certs
30 31
31run-regress-x509name: x509name
32 ./x509name > x509name.result
33 diff -u ${.CURDIR}/x509name.expected x509name.result
34
35run-regress-callback: callback 32run-regress-callback: callback
36 ./callback ${.CURDIR}/../certs 33 ./callback ${.CURDIR}/../certs
37 perl ${.CURDIR}/callback.pl callback.out 34 perl ${.CURDIR}/callback.pl callback.out
diff --git a/src/regress/lib/libcrypto/x509/bettertls/Makefile b/src/regress/lib/libcrypto/x509/bettertls/Makefile
index 2724140635..2a06239fc5 100644
--- a/src/regress/lib/libcrypto/x509/bettertls/Makefile
+++ b/src/regress/lib/libcrypto/x509/bettertls/Makefile
@@ -1,10 +1,10 @@
1# $OpenBSD: Makefile,v 1.6 2024/12/27 08:02:27 tb Exp $ 1# $OpenBSD: Makefile,v 1.7 2025/07/23 07:46:12 tb Exp $
2 2
3PROGS = verify 3PROGS = verify
4 4
5.ifdef EOPENSSL33 5.ifdef EOPENSSL35
6LDADD += -Wl,-rpath,/usr/local/lib/eopenssl33 -L/usr/local/lib/eopenssl33 6LDADD += -Wl,-rpath,/usr/local/lib/eopenssl35 -L/usr/local/lib/eopenssl35
7CFLAGS += -I/usr/local/include/eopenssl33/ 7CFLAGS += -I/usr/local/include/eopenssl35/
8.endif 8.endif
9 9
10LDADD += -lcrypto 10LDADD += -lcrypto
diff --git a/src/regress/lib/libcrypto/x509/x509_name_test.c b/src/regress/lib/libcrypto/x509/x509_name_test.c
new file mode 100644
index 0000000000..24e62cc766
--- /dev/null
+++ b/src/regress/lib/libcrypto/x509/x509_name_test.c
@@ -0,0 +1,420 @@
1/* $OpenBSD: x509_name_test.c,v 1.3 2025/05/05 06:33:34 tb Exp $ */
2
3/*
4 * Copyright (c) 2025 Theo Buehler <tb@openbsd.org>
5 * Copyright (c) 2025 Kenjiro Nakayama <nakayamakenjiro@gmail.com>
6 * Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org>
7 *
8 * Permission to use, copy, modify, and distribute this software for any
9 * purpose with or without fee is hereby granted, provided that the above
10 * copyright notice and this permission notice appear in all copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 */
20
21#include <err.h>
22#include <stdio.h>
23#include <string.h>
24
25#include <openssl/x509.h>
26
27static const struct x509_name_legacy {
28 const char *compat;
29 const char *oneline;
30 const uint8_t der[255];
31 size_t der_len;
32} x509_name_legacy_test[] = {
33 {
34 .compat =
35 "C=HU, "
36 "L=Budapest, "
37 "O=Microsec Ltd., "
38 "CN=Microsec e-Szigno Root CA 2009, "
39 "emailAddress=info@e-szigno.hu",
40 .oneline =
41 "/C=HU"
42 "/L=Budapest"
43 "/O=Microsec Ltd."
44 "/CN=Microsec e-Szigno Root CA 2009"
45 "/emailAddress=info@e-szigno.hu",
46 .der = {
47 0x30, 0x81, 0x82, 0x31, 0x0b, 0x30, 0x09, 0x06,
48 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x48, 0x55,
49 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04,
50 0x07, 0x0c, 0x08, 0x42, 0x75, 0x64, 0x61, 0x70,
51 0x65, 0x73, 0x74, 0x31, 0x16, 0x30, 0x14, 0x06,
52 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x0d, 0x4d, 0x69,
53 0x63, 0x72, 0x6f, 0x73, 0x65, 0x63, 0x20, 0x4c,
54 0x74, 0x64, 0x2e, 0x31, 0x27, 0x30, 0x25, 0x06,
55 0x03, 0x55, 0x04, 0x03, 0x0c, 0x1e, 0x4d, 0x69,
56 0x63, 0x72, 0x6f, 0x73, 0x65, 0x63, 0x20, 0x65,
57 0x2d, 0x53, 0x7a, 0x69, 0x67, 0x6e, 0x6f, 0x20,
58 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x43, 0x41, 0x20,
59 0x32, 0x30, 0x30, 0x39, 0x31, 0x1f, 0x30, 0x1d,
60 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
61 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6e, 0x66,
62 0x6f, 0x40, 0x65, 0x2d, 0x73, 0x7a, 0x69, 0x67,
63 0x6e, 0x6f, 0x2e, 0x68, 0x75,
64 },
65 .der_len = 133,
66 },
67
68 {
69 .compat =
70 "serialNumber=G63287510, "
71 "C=ES, "
72 "O=ANF Autoridad de Certificacion, "
73 "OU=ANF CA Raiz, "
74 "CN=ANF Secure Server Root CA",
75 .oneline =
76 "/serialNumber=G63287510"
77 "/C=ES"
78 "/O=ANF Autoridad de Certificacion"
79 "/OU=ANF CA Raiz"
80 "/CN=ANF Secure Server Root CA",
81 .der = {
82 0x30, 0x81, 0x84, 0x31, 0x12, 0x30, 0x10, 0x06,
83 0x03, 0x55, 0x04, 0x05, 0x13, 0x09, 0x47, 0x36,
84 0x33, 0x32, 0x38, 0x37, 0x35, 0x31, 0x30, 0x31,
85 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06,
86 0x13, 0x02, 0x45, 0x53, 0x31, 0x27, 0x30, 0x25,
87 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x1e, 0x41,
88 0x4e, 0x46, 0x20, 0x41, 0x75, 0x74, 0x6f, 0x72,
89 0x69, 0x64, 0x61, 0x64, 0x20, 0x64, 0x65, 0x20,
90 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63,
91 0x61, 0x63, 0x69, 0x6f, 0x6e, 0x31, 0x14, 0x30,
92 0x12, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x0b,
93 0x41, 0x4e, 0x46, 0x20, 0x43, 0x41, 0x20, 0x52,
94 0x61, 0x69, 0x7a, 0x31, 0x22, 0x30, 0x20, 0x06,
95 0x03, 0x55, 0x04, 0x03, 0x13, 0x19, 0x41, 0x4e,
96 0x46, 0x20, 0x53, 0x65, 0x63, 0x75, 0x72, 0x65,
97 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20,
98 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x43, 0x41,
99 },
100 .der_len = 135,
101 },
102
103 {
104 .compat =
105 "C=GB, "
106 "ST=Greater Manchester, "
107 "L=Salford, "
108 "O=COMODO CA Limited, "
109 "CN=COMODO Certification Authority",
110 .oneline =
111 "/C=GB"
112 "/ST=Greater Manchester"
113 "/L=Salford"
114 "/O=COMODO CA Limited"
115 "/CN=COMODO Certification Authority",
116 .der = {
117 0x30, 0x81, 0x81, 0x31, 0x0b, 0x30, 0x09, 0x06,
118 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x47, 0x42,
119 0x31, 0x1b, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04,
120 0x08, 0x13, 0x12, 0x47, 0x72, 0x65, 0x61, 0x74,
121 0x65, 0x72, 0x20, 0x4d, 0x61, 0x6e, 0x63, 0x68,
122 0x65, 0x73, 0x74, 0x65, 0x72, 0x31, 0x10, 0x30,
123 0x0e, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07,
124 0x53, 0x61, 0x6c, 0x66, 0x6f, 0x72, 0x64, 0x31,
125 0x1a, 0x30, 0x18, 0x06, 0x03, 0x55, 0x04, 0x0a,
126 0x13, 0x11, 0x43, 0x4f, 0x4d, 0x4f, 0x44, 0x4f,
127 0x20, 0x43, 0x41, 0x20, 0x4c, 0x69, 0x6d, 0x69,
128 0x74, 0x65, 0x64, 0x31, 0x27, 0x30, 0x25, 0x06,
129 0x03, 0x55, 0x04, 0x03, 0x13, 0x1e, 0x43, 0x4f,
130 0x4d, 0x4f, 0x44, 0x4f, 0x20, 0x43, 0x65, 0x72,
131 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,
132 0x6f, 0x6e, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f,
133 0x72, 0x69, 0x74, 0x79,
134 },
135 .der_len = 132,
136 },
137
138 {
139 .compat =
140 "C=HU, "
141 "L=Budapest, "
142 "O=Microsec Ltd., "
143 "2.5.4.97=VATHU-23584497, "
144 "CN=e-Szigno Root CA 2017",
145 .oneline =
146 "/C=HU"
147 "/L=Budapest"
148 "/O=Microsec Ltd."
149 "/2.5.4.97=VATHU-23584497"
150 "/CN=e-Szigno Root CA 2017",
151 .der = {
152 0x30, 0x71, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03,
153 0x55, 0x04, 0x06, 0x13, 0x02, 0x48, 0x55, 0x31,
154 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x07,
155 0x0c, 0x08, 0x42, 0x75, 0x64, 0x61, 0x70, 0x65,
156 0x73, 0x74, 0x31, 0x16, 0x30, 0x14, 0x06, 0x03,
157 0x55, 0x04, 0x0a, 0x0c, 0x0d, 0x4d, 0x69, 0x63,
158 0x72, 0x6f, 0x73, 0x65, 0x63, 0x20, 0x4c, 0x74,
159 0x64, 0x2e, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03,
160 0x55, 0x04, 0x61, 0x0c, 0x0e, 0x56, 0x41, 0x54,
161 0x48, 0x55, 0x2d, 0x32, 0x33, 0x35, 0x38, 0x34,
162 0x34, 0x39, 0x37, 0x31, 0x1e, 0x30, 0x1c, 0x06,
163 0x03, 0x55, 0x04, 0x03, 0x0c, 0x15, 0x65, 0x2d,
164 0x53, 0x7a, 0x69, 0x67, 0x6e, 0x6f, 0x20, 0x52,
165 0x6f, 0x6f, 0x74, 0x20, 0x43, 0x41, 0x20, 0x32,
166 0x30, 0x31, 0x37,
167 },
168 .der_len = 115,
169 },
170
171 {
172
173 .compat =
174 "C=ES, "
175 "O=FNMT-RCM, "
176 "OU=Ceres, "
177 "2.5.4.97=VATES-Q2826004J, "
178 "CN=AC RAIZ FNMT-RCM SERVIDORES SEGUROS",
179 .oneline =
180 "/C=ES"
181 "/O=FNMT-RCM"
182 "/OU=Ceres"
183 "/2.5.4.97=VATES-Q2826004J"
184 "/CN=AC RAIZ FNMT-RCM SERVIDORES SEGUROS",
185 .der = {
186 0x30, 0x78, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03,
187 0x55, 0x04, 0x06, 0x13, 0x02, 0x45, 0x53, 0x31,
188 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a,
189 0x0c, 0x08, 0x46, 0x4e, 0x4d, 0x54, 0x2d, 0x52,
190 0x43, 0x4d, 0x31, 0x0e, 0x30, 0x0c, 0x06, 0x03,
191 0x55, 0x04, 0x0b, 0x0c, 0x05, 0x43, 0x65, 0x72,
192 0x65, 0x73, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03,
193 0x55, 0x04, 0x61, 0x0c, 0x0f, 0x56, 0x41, 0x54,
194 0x45, 0x53, 0x2d, 0x51, 0x32, 0x38, 0x32, 0x36,
195 0x30, 0x30, 0x34, 0x4a, 0x31, 0x2c, 0x30, 0x2a,
196 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x23, 0x41,
197 0x43, 0x20, 0x52, 0x41, 0x49, 0x5a, 0x20, 0x46,
198 0x4e, 0x4d, 0x54, 0x2d, 0x52, 0x43, 0x4d, 0x20,
199 0x53, 0x45, 0x52, 0x56, 0x49, 0x44, 0x4f, 0x52,
200 0x45, 0x53, 0x20, 0x53, 0x45, 0x47, 0x55, 0x52,
201 0x4f, 0x53
202 },
203 .der_len = 122,
204 },
205};
206
207#define N_X509_NAME_COMPAT \
208 (sizeof(x509_name_legacy_test) / sizeof(x509_name_legacy_test[0]))
209
210static int
211x509_name_compat_testcase(const struct x509_name_legacy *test)
212{
213 const uint8_t *p;
214 X509_NAME *name = NULL;
215 unsigned char *der = NULL;
216 int der_len = 0;
217 BIO *bio = NULL;
218 char *got;
219 int got_len;
220 char *buf = NULL;
221 int failed = 1;
222
223 p = test->der;
224 if ((name = d2i_X509_NAME(NULL, &p, test->der_len)) == NULL)
225 errx(1, "d2i_X509_NAME");
226
227 if ((der_len = i2d_X509_NAME(name, &der)) <= 0) {
228 fprintf(stderr, "FAIL: %s: i2d_X509_NAME", __func__);
229 der_len = 0;
230 goto err;
231 }
232
233 if (test->der_len != (size_t)der_len) {
234 fprintf(stderr, "FAIL: %s: der len: want %zu, got %d\n",
235 __func__, test->der_len, der_len);
236 goto err;
237 }
238
239 if (memcmp(test->der, der, test->der_len) != 0) {
240 fprintf(stderr, "FAIL: %s: DER mismatch\n", __func__);
241 goto err;
242 }
243
244 if ((bio = BIO_new(BIO_s_mem())) == NULL)
245 errx(1, "BIO_new");
246
247 if (!X509_NAME_print_ex(bio, name, 0, XN_FLAG_COMPAT)) {
248 fprintf(stderr, "FAIL: %s: X509_NAME_print_ex", __func__);
249 goto err;
250 }
251
252 if ((got_len = BIO_get_mem_data(bio, &got)) < 0)
253 errx(1, "BIO_get_mem_data");
254
255 if (strcmp(test->compat, got) != 0) {
256 fprintf(stderr, "FAIL: %s compat:\nwant: \"%s\",\ngot: \"%s\"\n",
257 __func__, test->compat, got);
258 goto err;
259 }
260
261 if ((buf = X509_NAME_oneline(name, NULL, 0)) == NULL)
262 errx(1, "X509_NAME_oneline");
263
264 if (strcmp(test->oneline, buf) != 0) {
265 fprintf(stderr, "FAIL: %s oneline:\nwant: \"%s\",\ngot: \"%s\"\n",
266 __func__, test->compat, got);
267 goto err;
268 }
269
270 failed = 0;
271
272 err:
273 BIO_free(bio);
274 free(buf);
275 X509_NAME_free(name);
276 freezero(der, der_len);
277
278 return failed;
279}
280
281static int
282x509_name_compat_test(void)
283{
284 size_t i;
285 int failed = 0;
286
287 for (i = 0; i < N_X509_NAME_COMPAT; i++)
288 failed |= x509_name_compat_testcase(&x509_name_legacy_test[i]);
289
290 return failed;
291}
292
293static const struct x509_name_entry_test {
294 const char *field;
295 const char *value;
296 int loc;
297 int set;
298 const char *expected_str;
299 const int expected_set[4];
300 const int expected_count;
301} entry_tests[] = {
302 {
303 .field = "ST",
304 .value = "BaWue",
305 .loc = -1,
306 .set = 0,
307 .expected_str = "ST=BaWue",
308 .expected_set = { 0 },
309 .expected_count = 1,
310 },
311 {
312 .field = "O",
313 .value = "KIT",
314 .loc = -1,
315 .set = 0,
316 .expected_str = "ST=BaWue, O=KIT",
317 .expected_set = { 0, 1 },
318 .expected_count = 2,
319 },
320 {
321 .field = "L",
322 .value = "Karlsruhe",
323 .loc = 1,
324 .set = 0,
325 .expected_str = "ST=BaWue, L=Karlsruhe, O=KIT",
326 .expected_set = { 0, 1, 2 },
327 .expected_count = 3,
328 },
329 {
330 .field = "C",
331 .value = "DE",
332 .loc = 0,
333 .set = 1,
334 .expected_str = "C=DE + ST=BaWue, L=Karlsruhe, O=KIT",
335 .expected_set = { 0, 0, 1, 2 },
336 .expected_count = 4,
337 },
338};
339
340#define N_ENTRY_TESTS (sizeof(entry_tests) / sizeof(entry_tests[0]))
341
342static int
343verify_x509_name_output(X509_NAME *name, const struct x509_name_entry_test *tc)
344{
345 BIO *bio;
346 char *got;
347 long got_len;
348 int loc, ret;
349 int failed = 1;
350
351 if ((bio = BIO_new(BIO_s_mem())) == NULL)
352 goto fail;
353
354 if ((ret = X509_NAME_print_ex(bio, name, 0, XN_FLAG_SEP_CPLUS_SPC)) == -1)
355 goto fail;
356
357 if ((got_len = BIO_get_mem_data(bio, &got)) < 0)
358 goto fail;
359
360 if (ret != got_len || strlen(tc->expected_str) != (size_t)ret)
361 goto fail;
362
363 if (strncmp(tc->expected_str, got, got_len) != 0)
364 goto fail;
365
366 if (X509_NAME_entry_count(name) != tc->expected_count)
367 goto fail;
368
369 for (loc = 0; loc < X509_NAME_entry_count(name); loc++) {
370 X509_NAME_ENTRY *e = X509_NAME_get_entry(name, loc);
371 if (e == NULL || X509_NAME_ENTRY_set(e) != tc->expected_set[loc])
372 goto fail;
373 }
374
375 failed = 0;
376
377 fail:
378 BIO_free(bio);
379
380 return failed;
381}
382
383static int
384x509_name_add_entry_test(void)
385{
386 X509_NAME *name;
387 int failed = 1;
388
389 if ((name = X509_NAME_new()) == NULL)
390 goto done;
391
392 for (size_t i = 0; i < N_ENTRY_TESTS; i++) {
393 const struct x509_name_entry_test *t = &entry_tests[i];
394
395 if (!X509_NAME_add_entry_by_txt(name, t->field, MBSTRING_ASC,
396 (const unsigned char *)t->value, -1, t->loc, t->set))
397 goto done;
398
399 if (verify_x509_name_output(name, t))
400 goto done;
401 }
402
403 failed = 0;
404
405 done:
406 X509_NAME_free(name);
407
408 return failed;
409}
410
411int
412main(void)
413{
414 int failed = 0;
415
416 failed |= x509_name_compat_test();
417 failed |= x509_name_add_entry_test();
418
419 return failed;
420}
diff --git a/src/regress/lib/libcrypto/x509/x509name.c b/src/regress/lib/libcrypto/x509/x509name.c
deleted file mode 100644
index 9deeeb2986..0000000000
--- a/src/regress/lib/libcrypto/x509/x509name.c
+++ /dev/null
@@ -1,62 +0,0 @@
1/* $OpenBSD: x509name.c,v 1.3 2021/10/31 08:27:15 tb Exp $ */
2/*
3 * Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#include <err.h>
19#include <stdio.h>
20
21#include <openssl/x509.h>
22
23static void debug_print(X509_NAME *);
24
25static void
26debug_print(X509_NAME *name)
27{
28 int loc;
29
30 for (loc = 0; loc < X509_NAME_entry_count(name); loc++)
31 printf("%d:",
32 X509_NAME_ENTRY_set(X509_NAME_get_entry(name, loc)));
33 putchar(' ');
34 X509_NAME_print_ex_fp(stdout, name, 0, XN_FLAG_SEP_CPLUS_SPC);
35 putchar('\n');
36}
37
38int
39main(void)
40{
41 X509_NAME *name;
42
43 if ((name = X509_NAME_new()) == NULL)
44 err(1, NULL);
45 X509_NAME_add_entry_by_txt(name, "ST", MBSTRING_ASC,
46 "BaWue", -1, -1, 0);
47 X509_NAME_add_entry_by_txt(name, "O", MBSTRING_ASC,
48 "KIT", -1, -1, 0);
49 debug_print(name);
50
51 X509_NAME_add_entry_by_txt(name, "L", MBSTRING_ASC,
52 "Karlsruhe", -1, 1, 0);
53 debug_print(name);
54
55 X509_NAME_add_entry_by_txt(name, "C", MBSTRING_ASC,
56 "DE", -1, 0, 1);
57 debug_print(name);
58
59 X509_NAME_free(name);
60
61 return 0;
62}
diff --git a/src/regress/lib/libcrypto/x509/x509name.expected b/src/regress/lib/libcrypto/x509/x509name.expected
deleted file mode 100644
index 6cee7cc435..0000000000
--- a/src/regress/lib/libcrypto/x509/x509name.expected
+++ /dev/null
@@ -1,3 +0,0 @@
10:1: ST=BaWue, O=KIT
20:1:2: ST=BaWue, L=Karlsruhe, O=KIT
30:0:1:2: C=DE + ST=BaWue, L=Karlsruhe, O=KIT
diff --git a/src/regress/lib/libssl/interop/Makefile b/src/regress/lib/libssl/interop/Makefile
index bdc67f627a..e1e9633d37 100644
--- a/src/regress/lib/libssl/interop/Makefile
+++ b/src/regress/lib/libssl/interop/Makefile
@@ -1,6 +1,6 @@
1# $OpenBSD: Makefile,v 1.21 2025/01/15 10:54:17 tb Exp $ 1# $OpenBSD: Makefile,v 1.23 2025/07/25 16:33:15 tb Exp $
2 2
3SUBDIR = libressl openssl33 openssl34 3SUBDIR = libressl openssl35
4 4
5# the above binaries must have been built before we can continue 5# the above binaries must have been built before we can continue
6SUBDIR += netcat 6SUBDIR += netcat
diff --git a/src/regress/lib/libssl/interop/botan/Makefile b/src/regress/lib/libssl/interop/botan/Makefile
index 85877d4290..56bcdaf4bd 100644
--- a/src/regress/lib/libssl/interop/botan/Makefile
+++ b/src/regress/lib/libssl/interop/botan/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.10 2025/01/15 10:54:17 tb Exp $ 1# $OpenBSD: Makefile,v 1.12 2025/07/25 16:33:15 tb Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4 4
@@ -20,11 +20,8 @@ CXX = /usr/local/bin/eg++
20.endif 20.endif
21 21
22LIBRARIES = libressl 22LIBRARIES = libressl
23.if exists(/usr/local/bin/eopenssl33) 23.if exists(/usr/local/bin/eopenssl35)
24LIBRARIES += openssl33 24LIBRARIES += openssl35
25.endif
26.if exists(/usr/local/bin/eopenssl34)
27LIBRARIES += openssl34
28.endif 25.endif
29 26
30PROGS = client 27PROGS = client
diff --git a/src/regress/lib/libssl/interop/cert/Makefile b/src/regress/lib/libssl/interop/cert/Makefile
index 74c63c86a8..9698c56acd 100644
--- a/src/regress/lib/libssl/interop/cert/Makefile
+++ b/src/regress/lib/libssl/interop/cert/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.14 2025/01/15 10:54:17 tb Exp $ 1# $OpenBSD: Makefile,v 1.16 2025/07/25 16:33:15 tb Exp $
2 2
3# Connect a client to a server. Both can be current libressl, or 3# Connect a client to a server. Both can be current libressl, or
4# openssl 3.x. Create client and server certificates 4# openssl 3.x. Create client and server certificates
@@ -7,11 +7,8 @@
7# and check the result of certificate verification. 7# and check the result of certificate verification.
8 8
9LIBRARIES = libressl 9LIBRARIES = libressl
10.if exists(/usr/local/bin/eopenssl33) 10.if exists(/usr/local/bin/eopenssl35)
11LIBRARIES += openssl33 11LIBRARIES += openssl35
12.endif
13.if exists(/usr/local/bin/eopenssl34)
14LIBRARIES += openssl34
15.endif 12.endif
16 13
17.for cca in noca ca fakeca 14.for cca in noca ca fakeca
diff --git a/src/regress/lib/libssl/interop/cipher/Makefile b/src/regress/lib/libssl/interop/cipher/Makefile
index fa7e25f9ee..5bdc9089fe 100644
--- a/src/regress/lib/libssl/interop/cipher/Makefile
+++ b/src/regress/lib/libssl/interop/cipher/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.17 2025/01/15 10:54:17 tb Exp $ 1# $OpenBSD: Makefile,v 1.19 2025/07/25 16:33:15 tb Exp $
2 2
3# Connect a client to a server. Both can be current libressl, or 3# Connect a client to a server. Both can be current libressl, or
4# openssl 1.1 or 3.0. Create lists of supported ciphers 4# openssl 1.1 or 3.0. Create lists of supported ciphers
@@ -7,11 +7,8 @@
7# have used correct cipher by grepping in their session print out. 7# have used correct cipher by grepping in their session print out.
8 8
9LIBRARIES = libressl 9LIBRARIES = libressl
10.if exists(/usr/local/bin/eopenssl33) 10.if exists(/usr/local/bin/eopenssl35)
11LIBRARIES += openssl33 11LIBRARIES += openssl35
12.endif
13.if exists(/usr/local/bin/eopenssl34)
14LIBRARIES += openssl34
15.endif 12.endif
16 13
17CLEANFILES = *.tmp *.ciphers ciphers.mk 14CLEANFILES = *.tmp *.ciphers ciphers.mk
@@ -41,8 +38,7 @@ client-${clib}-server-${slib}.ciphers: \
41 uniq -d <$@.tmp >$@ 38 uniq -d <$@.tmp >$@
42 # we are only interested in ciphers supported by libressl 39 # we are only interested in ciphers supported by libressl
43 sort $@ client-libressl.ciphers >$@.tmp 40 sort $@ client-libressl.ciphers >$@.tmp
44. if "${clib}" == "openssl33" || "${slib}" == "openssl33" || \ 41. if "${clib}" == "openssl35" || "${slib}" == "openssl35"
45 "${clib}" == "openssl34" || "${slib}" == "openssl34"
46 # OpenSSL's SSL_CTX_set_cipher_list doesn't accept TLSv1.3 ciphers 42 # OpenSSL's SSL_CTX_set_cipher_list doesn't accept TLSv1.3 ciphers
47 sed -i '/^TLS_/d' $@.tmp 43 sed -i '/^TLS_/d' $@.tmp
48. endif 44. endif
@@ -70,8 +66,7 @@ regress: ciphers.mk
70.endif 66.endif
71 67
72LEVEL_libressl = 68LEVEL_libressl =
73LEVEL_openssl33 = ,@SECLEVEL=0 69LEVEL_openssl35 = ,@SECLEVEL=0
74LEVEL_openssl34 = ,@SECLEVEL=0
75 70
76.for clib in ${LIBRARIES} 71.for clib in ${LIBRARIES}
77.for slib in ${LIBRARIES} 72.for slib in ${LIBRARIES}
@@ -132,7 +127,7 @@ check-cipher-${cipher}-client-${clib}-server-${slib}: \
132. endif 127. endif
133. if "${clib}" == "libressl" 128. if "${clib}" == "libressl"
134 # libressl client may prefer chacha-poly if aes-ni is not supported 129 # libressl client may prefer chacha-poly if aes-ni is not supported
135. if "${slib}" == "openssl33" || "${slib}" == "openssl34" 130. if "${slib}" == "openssl35"
136 egrep -q ' Cipher *: TLS_(AES_256_GCM_SHA384|CHACHA20_POLY1305_SHA256)$$' ${@:S/^check/server/}.out 131 egrep -q ' Cipher *: TLS_(AES_256_GCM_SHA384|CHACHA20_POLY1305_SHA256)$$' ${@:S/^check/server/}.out
137. else 132. else
138 egrep -q ' Cipher *: TLS_(AES_256_GCM_SHA384|CHACHA20_POLY1305_SHA256)$$' ${@:S/^check/server/}.out 133 egrep -q ' Cipher *: TLS_(AES_256_GCM_SHA384|CHACHA20_POLY1305_SHA256)$$' ${@:S/^check/server/}.out
diff --git a/src/regress/lib/libssl/interop/netcat/Makefile b/src/regress/lib/libssl/interop/netcat/Makefile
index 3b8e3f95be..cff6b7ea76 100644
--- a/src/regress/lib/libssl/interop/netcat/Makefile
+++ b/src/regress/lib/libssl/interop/netcat/Makefile
@@ -1,11 +1,8 @@
1# $OpenBSD: Makefile,v 1.10 2025/01/15 10:54:17 tb Exp $ 1# $OpenBSD: Makefile,v 1.12 2025/07/25 16:33:15 tb Exp $
2 2
3LIBRARIES = libressl 3LIBRARIES = libressl
4.if exists(/usr/local/bin/eopenssl33) 4.if exists(/usr/local/bin/eopenssl35)
5LIBRARIES += openssl33 5LIBRARIES += openssl35
6.endif
7.if exists(/usr/local/bin/eopenssl34)
8LIBRARIES += openssl34
9.endif 6.endif
10 7
11# run netcat server and connect with test client 8# run netcat server and connect with test client
diff --git a/src/regress/lib/libssl/interop/openssl33/Makefile b/src/regress/lib/libssl/interop/openssl33/Makefile
deleted file mode 100644
index eff61704d0..0000000000
--- a/src/regress/lib/libssl/interop/openssl33/Makefile
+++ /dev/null
@@ -1,44 +0,0 @@
1# $OpenBSD: Makefile,v 1.1 2025/01/15 10:54:17 tb Exp $
2
3.if ! exists(/usr/local/bin/eopenssl33)
4regress:
5 # install openssl-3.3 from ports for interop tests
6 @echo 'Run "pkg_add openssl--%3.3" to run tests against OpenSSL 3.3'
7 @echo SKIPPED
8.else
9
10PROGS = client server
11CFLAGS += -DOPENSSL_SUPPRESS_DEPRECATED
12CPPFLAGS = -I /usr/local/include/eopenssl33
13LDFLAGS = -L /usr/local/lib/eopenssl33
14LDADD = -lssl -lcrypto
15DPADD = /usr/local/lib/eopenssl33/libssl.a \
16 /usr/local/lib/eopenssl33/libcrypto.a
17LD_LIBRARY_PATH = /usr/local/lib/eopenssl33
18REGRESS_TARGETS = run-self-client-server
19.for p in ${PROGS}
20REGRESS_TARGETS += run-ldd-$p run-version-$p run-protocol-$p
21.endfor
22
23.for p in ${PROGS}
24
25run-ldd-$p: ldd-$p.out
26 # check that $p is linked with OpenSSL 3.3
27 grep -q /usr/local/lib/eopenssl33/libcrypto.so ldd-$p.out
28 grep -q /usr/local/lib/eopenssl33/libssl.so ldd-$p.out
29 # check that $p is not linked with LibreSSL
30 ! grep -v libc.so ldd-$p.out | grep /usr/lib/
31
32run-version-$p: $p-self.out
33 # check that runtime version is OpenSSL 3.3
34 grep 'SSLEAY_VERSION: OpenSSL 3.3' $p-self.out
35
36run-protocol-$p: $p-self.out
37 # check that OpenSSL 3.3 protocol version is TLS 1.3
38 grep 'Protocol *: TLSv1.3' $p-self.out
39
40.endfor
41
42.endif # exists(/usr/local/bin/eopenssl33)
43
44.include <bsd.regress.mk>
diff --git a/src/regress/lib/libssl/interop/openssl34/Makefile b/src/regress/lib/libssl/interop/openssl34/Makefile
deleted file mode 100644
index 72246bb621..0000000000
--- a/src/regress/lib/libssl/interop/openssl34/Makefile
+++ /dev/null
@@ -1,44 +0,0 @@
1# $OpenBSD: Makefile,v 1.1 2025/01/15 10:54:17 tb Exp $
2
3.if ! exists(/usr/local/bin/eopenssl34)
4regress:
5 # install openssl-3.4 from ports for interop tests
6 @echo 'Run "pkg_add openssl--%3.4" to run tests against OpenSSL 3.4'
7 @echo SKIPPED
8.else
9
10PROGS = client server
11CFLAGS += -DOPENSSL_SUPPRESS_DEPRECATED
12CPPFLAGS = -I /usr/local/include/eopenssl34
13LDFLAGS = -L /usr/local/lib/eopenssl34
14LDADD = -lssl -lcrypto
15DPADD = /usr/local/lib/eopenssl34/libssl.a \
16 /usr/local/lib/eopenssl34/libcrypto.a
17LD_LIBRARY_PATH = /usr/local/lib/eopenssl34
18REGRESS_TARGETS = run-self-client-server
19.for p in ${PROGS}
20REGRESS_TARGETS += run-ldd-$p run-version-$p run-protocol-$p
21.endfor
22
23.for p in ${PROGS}
24
25run-ldd-$p: ldd-$p.out
26 # check that $p is linked with OpenSSL 3.4
27 grep -q /usr/local/lib/eopenssl34/libcrypto.so ldd-$p.out
28 grep -q /usr/local/lib/eopenssl34/libssl.so ldd-$p.out
29 # check that $p is not linked with LibreSSL
30 ! grep -v libc.so ldd-$p.out | grep /usr/lib/
31
32run-version-$p: $p-self.out
33 # check that runtime version is OpenSSL 3.4
34 grep 'SSLEAY_VERSION: OpenSSL 3.4' $p-self.out
35
36run-protocol-$p: $p-self.out
37 # check that OpenSSL 3.4 protocol version is TLS 1.3
38 grep 'Protocol *: TLSv1.3' $p-self.out
39
40.endfor
41
42.endif # exists(/usr/local/bin/eopenssl34)
43
44.include <bsd.regress.mk>
diff --git a/src/regress/lib/libssl/interop/openssl35/Makefile b/src/regress/lib/libssl/interop/openssl35/Makefile
new file mode 100644
index 0000000000..e11ad5dd20
--- /dev/null
+++ b/src/regress/lib/libssl/interop/openssl35/Makefile
@@ -0,0 +1,44 @@
1# $OpenBSD: Makefile,v 1.1 2025/07/09 17:48:02 tb Exp $
2
3.if ! exists(/usr/local/bin/eopenssl35)
4regress:
5 # install openssl-3.5 from ports for interop tests
6 @echo 'Run "pkg_add openssl--%3.5" to run tests against OpenSSL 3.5'
7 @echo SKIPPED
8.else
9
10PROGS = client server
11CFLAGS += -DOPENSSL_SUPPRESS_DEPRECATED
12CPPFLAGS = -I /usr/local/include/eopenssl35
13LDFLAGS = -L /usr/local/lib/eopenssl35
14LDADD = -lssl -lcrypto
15DPADD = /usr/local/lib/eopenssl35/libssl.a \
16 /usr/local/lib/eopenssl35/libcrypto.a
17LD_LIBRARY_PATH = /usr/local/lib/eopenssl35
18REGRESS_TARGETS = run-self-client-server
19.for p in ${PROGS}
20REGRESS_TARGETS += run-ldd-$p run-version-$p run-protocol-$p
21.endfor
22
23.for p in ${PROGS}
24
25run-ldd-$p: ldd-$p.out
26 # check that $p is linked with OpenSSL 3.5
27 grep -q /usr/local/lib/eopenssl35/libcrypto.so ldd-$p.out
28 grep -q /usr/local/lib/eopenssl35/libssl.so ldd-$p.out
29 # check that $p is not linked with LibreSSL
30 ! grep -v -e libc.so -e libpthread.so ldd-$p.out | grep /usr/lib/
31
32run-version-$p: $p-self.out
33 # check that runtime version is OpenSSL 3.5
34 grep 'SSLEAY_VERSION: OpenSSL 3.5' $p-self.out
35
36run-protocol-$p: $p-self.out
37 # check that OpenSSL 3.5 protocol version is TLS 1.3
38 grep 'Protocol *: TLSv1.3' $p-self.out
39
40.endfor
41
42.endif # exists(/usr/local/bin/eopenssl35)
43
44.include <bsd.regress.mk>
diff --git a/src/regress/lib/libssl/interop/session/Makefile b/src/regress/lib/libssl/interop/session/Makefile
index e9a353f99e..fff66b169b 100644
--- a/src/regress/lib/libssl/interop/session/Makefile
+++ b/src/regress/lib/libssl/interop/session/Makefile
@@ -1,11 +1,8 @@
1# $OpenBSD: Makefile,v 1.12 2025/01/15 10:54:17 tb Exp $ 1# $OpenBSD: Makefile,v 1.14 2025/07/25 16:33:15 tb Exp $
2 2
3LIBRARIES = libressl 3LIBRARIES = libressl
4.if exists(/usr/local/bin/eopenssl33) 4.if exists(/usr/local/bin/eopenssl35)
5#LIBRARIES += openssl33 5#LIBRARIES += openssl35
6.endif
7.if exists(/usr/local/bin/eopenssl34)
8#LIBRARIES += openssl34
9.endif 6.endif
10 7
11run-session-client-libressl-server-libressl: 8run-session-client-libressl-server-libressl:
diff --git a/src/regress/lib/libssl/interop/version/Makefile b/src/regress/lib/libssl/interop/version/Makefile
index 605fba252f..5ee7d4c4f3 100644
--- a/src/regress/lib/libssl/interop/version/Makefile
+++ b/src/regress/lib/libssl/interop/version/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.10 2025/01/15 10:54:17 tb Exp $ 1# $OpenBSD: Makefile,v 1.12 2025/07/25 16:33:15 tb Exp $
2 2
3# Connect a client to a server. Both can be current libressl, or 3# Connect a client to a server. Both can be current libressl, or
4# openssl 1.1 or openssl 3.0. Pin client or server to a fixed TLS 4# openssl 1.1 or openssl 3.0. Pin client or server to a fixed TLS
@@ -7,11 +7,8 @@
7# print out. 7# print out.
8 8
9LIBRARIES = libressl 9LIBRARIES = libressl
10.if exists(/usr/local/bin/eopenssl33) 10.if exists(/usr/local/bin/eopenssl35)
11LIBRARIES += openssl33 11LIBRARIES += openssl35
12.endif
13.if exists(/usr/local/bin/eopenssl34)
14LIBRARIES += openssl34
15.endif 12.endif
16 13
17VERSIONS = any TLS1_2 TLS1_3 14VERSIONS = any TLS1_2 TLS1_3
@@ -29,8 +26,7 @@ FAIL_${cver}_${sver} = !
29.for slib in ${LIBRARIES} 26.for slib in ${LIBRARIES}
30 27
31.if ("${cver}" != TLS1_3 && "${sver}" != TLS1_3) && \ 28.if ("${cver}" != TLS1_3 && "${sver}" != TLS1_3) && \
32 ((("${clib}" != openssl33 && "${slib}" != openssl33)) || \ 29 ((("${clib}" != openssl35 && "${slib}" != openssl35)) || \
33 (("${clib}" != openssl34 && "${slib}" != openssl34)) || \
34 (("${cver}" != any && "${sver}" != any) && \ 30 (("${cver}" != any && "${sver}" != any) && \
35 ("${cver}" != TLS1 && "${sver}" != TLS1) && \ 31 ("${cver}" != TLS1 && "${sver}" != TLS1) && \
36 ("${cver}" != TLS1_1 && "${sver}" != TLS1_1))) 32 ("${cver}" != TLS1_1 && "${sver}" != TLS1_1)))
diff --git a/src/regress/lib/libssl/openssl-ruby/Makefile b/src/regress/lib/libssl/openssl-ruby/Makefile
index af8083f662..19d2f2fc40 100644
--- a/src/regress/lib/libssl/openssl-ruby/Makefile
+++ b/src/regress/lib/libssl/openssl-ruby/Makefile
@@ -1,10 +1,10 @@
1# $OpenBSD: Makefile,v 1.14 2024/08/31 11:14:58 tb Exp $ 1# $OpenBSD: Makefile,v 1.17 2025/06/27 03:32:08 tb Exp $
2 2
3OPENSSL_RUBY_TESTS = /usr/local/share/openssl-ruby-tests 3OPENSSL_RUBY_TESTS = /usr/local/share/openssl-ruby-tests
4.if exists(/usr/local/bin/ruby32) 4.if exists(/usr/local/bin/ruby33)
5RUBY_BINREV = 32
6.else
7RUBY_BINREV = 33 5RUBY_BINREV = 33
6.else
7RUBY_BINREV = 34
8.endif 8.endif
9RUBY = ruby${RUBY_BINREV} 9RUBY = ruby${RUBY_BINREV}
10 10
@@ -71,6 +71,21 @@ ${_t}: ${_BUILD_COOKIE}
71 -n ${_t} 71 -n ${_t}
72.endfor 72.endfor
73 73
74# These tests can be a pain to run. To run a small set of individual
75# ssl tests, set the test names separated by spaces in the environment
76# variable RUBY_SSL_TEST_TARGETS - then you can type "make <test_name>"
77# to run a single ruby ssl test.
78.for _t in ${RUBY_SSL_TEST_TARGETS}
79REGRESS_TARGETS += ${_t}
80REGRESS_EXPECTED_FAILURES += ${_t}
81${_t}: ${_BUILD_COOKIE}
82 cd ${BUILDDIR} && \
83 ${RUBY} -I. -I${OPENSSL_RUBY_TESTS}/test/openssl \
84 -I${OPENSSL_RUBY_TESTS}/lib \
85 ${OPENSSL_RUBY_TESTS}/test/openssl/test_ssl.rb \
86 -n ${_t}
87.endfor
88
74CLEANFILES += ${_BUILD_COOKIE} ${_TEST_COOKIE} ${_BUILDDIR_COOKIE} 89CLEANFILES += ${_BUILD_COOKIE} ${_TEST_COOKIE} ${_BUILDDIR_COOKIE}
75 90
76. if make(clean) || make(cleandir) 91. if make(clean) || make(cleandir)
diff --git a/src/regress/lib/libssl/pqueue/Makefile b/src/regress/lib/libssl/pqueue/Makefile
index 48c2cb7e61..05fe9a268d 100644
--- a/src/regress/lib/libssl/pqueue/Makefile
+++ b/src/regress/lib/libssl/pqueue/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.1 2016/11/04 19:45:12 jsing Exp $ 1# $OpenBSD: Makefile,v 1.2 2025/05/04 11:04:02 tb Exp $
2 2
3PROG= pq_test 3PROG= pq_test
4SRC= ${.CURDIR}/../../../../lib/libssl 4SRC= ${.CURDIR}/../../../../lib/libssl
@@ -9,9 +9,4 @@ DPADD= ${LIBSSL} ${LIBCRYPTO}
9WARNINGS= Yes 9WARNINGS= Yes
10CFLAGS+= -DLIBRESSL_INTERNAL -Werror 10CFLAGS+= -DLIBRESSL_INTERNAL -Werror
11 11
12REGRESS_TARGETS= regress-pq_test
13
14regress-pq_test: ${PROG}
15 ${.OBJDIR}/pq_test | cmp -s ${.CURDIR}/expected.txt /dev/stdin
16
17.include <bsd.regress.mk> 12.include <bsd.regress.mk>
diff --git a/src/regress/lib/libssl/pqueue/expected.txt b/src/regress/lib/libssl/pqueue/expected.txt
deleted file mode 100644
index c59d6cd838..0000000000
--- a/src/regress/lib/libssl/pqueue/expected.txt
+++ /dev/null
@@ -1,3 +0,0 @@
1item 6966726167696c69
2item 7374696365787069
3item 737570657263616c
diff --git a/src/regress/lib/libssl/pqueue/pq_test.c b/src/regress/lib/libssl/pqueue/pq_test.c
index a078ba5366..822fdea961 100644
--- a/src/regress/lib/libssl/pqueue/pq_test.c
+++ b/src/regress/lib/libssl/pqueue/pq_test.c
@@ -59,60 +59,77 @@
59#include <stdio.h> 59#include <stdio.h>
60#include <stdlib.h> 60#include <stdlib.h>
61#include <string.h> 61#include <string.h>
62
62#include "pqueue.h" 63#include "pqueue.h"
63 64
64/* remember to change expected.txt if you change these values */ 65static const unsigned char *pq_expected[3] = {
65unsigned char prio1[8] = "supercal"; 66 "ifragili",
66unsigned char prio2[8] = "ifragili"; 67 "sticexpi",
67unsigned char prio3[8] = "sticexpi"; 68 "supercal"
69};
68 70
69static void 71static int
70pqueue_print(pqueue pq) 72test_pqueue(void)
71{ 73{
72 pitem *iter, *item; 74 const unsigned char *prio1 = pq_expected[2];
73 75 const unsigned char *prio2 = pq_expected[0];
74 iter = pqueue_iterator(pq); 76 const unsigned char *prio3 = pq_expected[1];
75 for (item = pqueue_next(&iter); item != NULL; 77 pqueue pq = NULL;
76 item = pqueue_next(&iter)) { 78 pitem *item = NULL;
77 printf("item\t%02x%02x%02x%02x%02x%02x%02x%02x\n", 79 pitem *iter = NULL;
78 item->priority[0], item->priority[1], 80 int i = 0;
79 item->priority[2], item->priority[3], 81 int failed = 1;
80 item->priority[4], item->priority[5],
81 item->priority[6], item->priority[7]);
82 }
83}
84 82
85int 83 if ((pq = pqueue_new()) == NULL)
86main(void) 84 goto failure;
87{
88 pitem *item;
89 pqueue pq;
90 85
91 pq = pqueue_new(); 86 if (!pqueue_insert(pq, pitem_new(prio3, NULL)))
87 goto failure;
88 if (!pqueue_insert(pq, pitem_new(prio1, NULL)))
89 goto failure;
90 if (!pqueue_insert(pq, pitem_new(prio2, NULL)))
91 goto failure;
92 92
93 item = pitem_new(prio3, NULL); 93 if (pqueue_size(pq) != 3)
94 pqueue_insert(pq, item); 94 goto failure;
95 95
96 item = pitem_new(prio1, NULL); 96 if ((item = pqueue_find(pq, prio1)) == NULL)
97 pqueue_insert(pq, item); 97 goto failure;
98 if ((item = pqueue_find(pq, prio2)) == NULL)
99 goto failure;
100 if ((item = pqueue_find(pq, prio3)) == NULL)
101 goto failure;
98 102
99 item = pitem_new(prio2, NULL); 103 if ((item = pqueue_peek(pq)) == NULL)
100 pqueue_insert(pq, item); 104 goto failure;
101 105
102 item = pqueue_find(pq, prio1); 106 if (memcmp(item->priority, pq_expected[0], 8))
103 fprintf(stderr, "found %p\n", item->priority); 107 goto failure;
104 108
105 item = pqueue_find(pq, prio2); 109 iter = pqueue_iterator(pq);
106 fprintf(stderr, "found %p\n", item->priority); 110 for (item = pqueue_next(&iter); item != NULL; item = pqueue_next(&iter)) {
111 if (memcmp(item->priority, pq_expected[i], 8) != 0)
112 goto failure;
113 i++;
114 }
107 115
108 item = pqueue_find(pq, prio3); 116 failed = (i != 3);
109 fprintf(stderr, "found %p\n", item ? item->priority: 0);
110 117
111 pqueue_print(pq); 118 failure:
112 119
113 for (item = pqueue_pop(pq); item != NULL; item = pqueue_pop(pq)) 120 for (item = pqueue_pop(pq); item != NULL; item = pqueue_pop(pq))
114 pitem_free(item); 121 pitem_free(item);
115
116 pqueue_free(pq); 122 pqueue_free(pq);
117 return 0; 123
124 return failed;
125}
126
127int
128main(void)
129{
130 int failed = 0;
131
132 failed |= test_pqueue();
133
134 return failed;
118} 135}
diff --git a/src/regress/lib/libssl/tlsext/tlsexttest.c b/src/regress/lib/libssl/tlsext/tlsexttest.c
index 4adf27421d..68584998ce 100644
--- a/src/regress/lib/libssl/tlsext/tlsexttest.c
+++ b/src/regress/lib/libssl/tlsext/tlsexttest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tlsexttest.c,v 1.92 2024/09/11 15:04:16 tb Exp $ */ 1/* $OpenBSD: tlsexttest.c,v 1.94 2025/05/03 08:37:28 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> 4 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org>
@@ -3740,6 +3740,11 @@ test_tlsext_keyshare_client(void)
3740 FAIL("Did not select a key share"); 3740 FAIL("Did not select a key share");
3741 goto done; 3741 goto done;
3742 } 3742 }
3743 if (tls_key_share_group(ssl->s3->hs.key_share) != 29) {
3744 FAIL("wrong key share group: got %d, expected 29\n",
3745 tls_key_share_group(ssl->s3->hs.key_share));
3746 goto done;
3747 }
3743 3748
3744 /* 3749 /*
3745 * Pretend the client did not send the supported groups extension. We 3750 * Pretend the client did not send the supported groups extension. We
@@ -4542,12 +4547,10 @@ test_tlsext_valid_hostnames(void)
4542#define N_TLSEXT_RANDOMIZATION_TESTS 1000 4547#define N_TLSEXT_RANDOMIZATION_TESTS 1000
4543 4548
4544static int 4549static int
4545test_tlsext_check_extension_order(SSL *ssl) 4550test_tlsext_check_psk_is_last_extension(SSL *ssl)
4546{ 4551{
4547 const struct tls_extension *ext; 4552 const struct tls_extension *ext;
4548 uint16_t type; 4553 uint16_t type;
4549 size_t alpn_idx, sni_idx;
4550 size_t i;
4551 4554
4552 if (ssl->tlsext_build_order_len == 0) { 4555 if (ssl->tlsext_build_order_len == 0) {
4553 FAIL("Unexpected zero build order length"); 4556 FAIL("Unexpected zero build order length");
@@ -4560,34 +4563,6 @@ test_tlsext_check_extension_order(SSL *ssl)
4560 return 1; 4563 return 1;
4561 } 4564 }
4562 4565
4563 if (ssl->server)
4564 return 0;
4565
4566 alpn_idx = sni_idx = ssl->tlsext_build_order_len;
4567 for (i = 0; i < ssl->tlsext_build_order_len; i++) {
4568 ext = ssl->tlsext_build_order[i];
4569 if (tls_extension_type(ext) == TLSEXT_TYPE_alpn)
4570 alpn_idx = i;
4571 if (tls_extension_type(ext) == TLSEXT_TYPE_server_name)
4572 sni_idx = i;
4573 }
4574
4575 if (alpn_idx == ssl->tlsext_build_order_len) {
4576 FAIL("could not find alpn extension\n");
4577 return 1;
4578 }
4579
4580 if (sni_idx == ssl->tlsext_build_order_len) {
4581 FAIL("could not find alpn extension\n");
4582 return 1;
4583 }
4584
4585 if (sni_idx >= alpn_idx) {
4586 FAIL("sni does not precede alpn: %zu >= %zu\n",
4587 sni_idx, alpn_idx);
4588 return 1;
4589 }
4590
4591 return 0; 4566 return 0;
4592} 4567}
4593 4568
@@ -4600,7 +4575,7 @@ test_tlsext_randomized_extensions(SSL *ssl)
4600 for (i = 0; i < N_TLSEXT_RANDOMIZATION_TESTS; i++) { 4575 for (i = 0; i < N_TLSEXT_RANDOMIZATION_TESTS; i++) {
4601 if (!tlsext_randomize_build_order(ssl)) 4576 if (!tlsext_randomize_build_order(ssl))
4602 errx(1, "failed to randomize extensions"); 4577 errx(1, "failed to randomize extensions");
4603 failed |= test_tlsext_check_extension_order(ssl); 4578 failed |= test_tlsext_check_psk_is_last_extension(ssl);
4604 } 4579 }
4605 4580
4606 return failed; 4581 return failed;
diff --git a/src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py b/src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py
index 91aedad165..ff678ec9a8 100644
--- a/src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py
+++ b/src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py
@@ -1,4 +1,4 @@
1# $OpenBSD: tlsfuzzer.py,v 1.56 2024/09/18 19:12:37 tb Exp $ 1# $OpenBSD: tlsfuzzer.py,v 1.57 2025/06/15 09:44:57 tb Exp $
2# 2#
3# Copyright (c) 2020 Theo Buehler <tb@openbsd.org> 3# Copyright (c) 2020 Theo Buehler <tb@openbsd.org>
4# 4#
@@ -72,7 +72,7 @@ def substitute_alert(want, got):
72 return f"Expected alert description \"{want}\" " \ 72 return f"Expected alert description \"{want}\" " \
73 + f"does not match received \"{got}\"" 73 + f"does not match received \"{got}\""
74 74
75# test-tls13-finished.py has 70 failing tests that expect a "decode_error" 75# test_tls13_finished.py has 70 failing tests that expect a "decode_error"
76# instead of the "decrypt_error" sent by tls13_server_finished_recv(). 76# instead of the "decrypt_error" sent by tls13_server_finished_recv().
77# Both alerts appear to be reasonable in this context, so work around this 77# Both alerts appear to be reasonable in this context, so work around this
78# in the test instead of the library. 78# in the test instead of the library.
@@ -164,46 +164,46 @@ def generate_test_tls13_finished_args():
164 return args 164 return args
165 165
166tls13_tests = TestGroup("TLSv1.3 tests", [ 166tls13_tests = TestGroup("TLSv1.3 tests", [
167 Test("test-tls13-ccs.py"), 167 Test("test_tls13_ccs.py"),
168 Test("test-tls13-conversation.py"), 168 Test("test_tls13_conversation.py"),
169 Test("test-tls13-count-tickets.py"), 169 Test("test_tls13_count_tickets.py"),
170 Test("test-tls13-empty-alert.py"), 170 Test("test_tls13_empty_alert.py"),
171 Test("test-tls13-finished.py", generate_test_tls13_finished_args()), 171 Test("test_tls13_finished.py", generate_test_tls13_finished_args()),
172 Test("test-tls13-finished-plaintext.py"), 172 Test("test_tls13_finished_plaintext.py"),
173 Test("test-tls13-hrr.py"), 173 Test("test_tls13_hrr.py"),
174 Test("test-tls13-keyshare-omitted.py"), 174 Test("test_tls13_keyshare_omitted.py"),
175 Test("test-tls13-legacy-version.py"), 175 Test("test_tls13_legacy_version.py"),
176 Test("test-tls13-nociphers.py"), 176 Test("test_tls13_nociphers.py"),
177 Test("test-tls13-record-padding.py"), 177 Test("test_tls13_record_padding.py"),
178 # Exclude QUIC transport parameters 178 # Exclude QUIC transport parameters
179 Test("test-tls13-shuffled-extentions.py", [ "--exc", "57" ]), 179 Test("test_tls13_shuffled_extentions.py", [ "--exc", "57" ]),
180 Test("test-tls13-zero-content-type.py"), 180 Test("test_tls13_zero_content_type.py"),
181 181
182 # The skipped tests fail due to a bug in BIO_gets() which masks the retry 182 # The skipped tests fail due to a bug in BIO_gets() which masks the retry
183 # signalled from an SSL_read() failure. Testing with httpd(8) shows we're 183 # signalled from an SSL_read() failure. Testing with httpd(8) shows we're
184 # handling these corner cases correctly since tls13_record_layer.c -r1.47. 184 # handling these corner cases correctly since tls13_record_layer.c -r1.47.
185 Test("test-tls13-zero-length-data.py", [ 185 Test("test_tls13_zero_length_data.py", [
186 "-e", "zero-length app data", 186 "-e", "zero-length app data",
187 "-e", "zero-length app data with large padding", 187 "-e", "zero-length app data with large padding",
188 "-e", "zero-length app data with padding", 188 "-e", "zero-length app data with padding",
189 ]), 189 ]),
190 190
191 # We don't currently handle NSTs 191 # We don't currently handle NSTs
192 Test("test-tls13-connection-abort.py", ["-e", "After NewSessionTicket"]), 192 Test("test_tls13_connection_abort.py", ["-e", "After NewSessionTicket"]),
193]) 193])
194 194
195# Tests that take a lot of time (> ~30s on an x280) 195# Tests that take a lot of time (> ~30s on an x280)
196tls13_slow_tests = TestGroup("slow TLSv1.3 tests", [ 196tls13_slow_tests = TestGroup("slow TLSv1.3 tests", [
197 # XXX: Investigate the occasional message 197 # XXX: Investigate the occasional message
198 # "Got shared secret with 1 most significant bytes equal to zero." 198 # "Got shared secret with 1 most significant bytes equal to zero."
199 Test("test-tls13-dhe-shared-secret-padding.py", tls13_unsupported_ciphers), 199 Test("test_tls13_dhe_shared_secret_padding.py", tls13_unsupported_ciphers),
200 200
201 Test("test-tls13-invalid-ciphers.py"), 201 Test("test_tls13_invalid_ciphers.py"),
202 Test("test-tls13-serverhello-random.py", tls13_unsupported_ciphers), 202 Test("test_tls13_serverhello_random.py", tls13_unsupported_ciphers),
203 203
204 # Mark two tests cases as xfail for now. The tests expect an arguably 204 # Mark two tests cases as xfail for now. The tests expect an arguably
205 # correct decode_error while we send a decrypt_error (like fizz/boring). 205 # correct decode_error while we send a decrypt_error (like fizz/boring).
206 Test("test-tls13-record-layer-limits.py", [ 206 Test("test_tls13_record_layer_limits.py", [
207 "-x", "max size payload (2**14) of Finished msg, with 16348 bytes of left padding, cipher TLS_AES_128_GCM_SHA256", 207 "-x", "max size payload (2**14) of Finished msg, with 16348 bytes of left padding, cipher TLS_AES_128_GCM_SHA256",
208 "-X", substitute_alert("decode_error", "decrypt_error"), 208 "-X", substitute_alert("decode_error", "decrypt_error"),
209 "-x", "max size payload (2**14) of Finished msg, with 16348 bytes of left padding, cipher TLS_CHACHA20_POLY1305_SHA256", 209 "-x", "max size payload (2**14) of Finished msg, with 16348 bytes of left padding, cipher TLS_CHACHA20_POLY1305_SHA256",
@@ -212,22 +212,22 @@ tls13_slow_tests = TestGroup("slow TLSv1.3 tests", [
212 # We don't accept an empty ECPF extension since it must advertise the 212 # We don't accept an empty ECPF extension since it must advertise the
213 # uncompressed point format. Exclude this extension type from the test. 213 # uncompressed point format. Exclude this extension type from the test.
214 Test( 214 Test(
215 "test-tls13-large-number-of-extensions.py", 215 "test_tls13_large_number_of_extensions.py",
216 tls13_args = ["--exc", "11"], 216 tls13_args = ["--exc", "11"],
217 ), 217 ),
218]) 218])
219 219
220tls13_extra_cert_tests = TestGroup("TLSv1.3 certificate tests", [ 220tls13_extra_cert_tests = TestGroup("TLSv1.3 certificate tests", [
221 # need to set up client certs to run these 221 # need to set up client certs to run these
222 Test("test-tls13-certificate-request.py"), 222 Test("test_tls13_certificate_request.py"),
223 Test("test-tls13-certificate-verify.py"), 223 Test("test_tls13_certificate_verify.py"),
224 Test("test-tls13-ecdsa-in-certificate-verify.py"), 224 Test("test_tls13_ecdsa_in_certificate_verify.py"),
225 Test("test-tls13-eddsa-in-certificate-verify.py"), 225 Test("test_tls13_eddsa_in_certificate_verify.py"),
226 226
227 # Test expects the server to have installed three certificates: 227 # Test expects the server to have installed three certificates:
228 # with P-256, P-384 and P-521 curve. Also SHA1+ECDSA is verified 228 # with P-256, P-384 and P-521 curve. Also SHA1+ECDSA is verified
229 # to not work. 229 # to not work.
230 Test("test-tls13-ecdsa-support.py"), 230 Test("test_tls13_ecdsa_support.py"),
231]) 231])
232 232
233tls13_failing_tests = TestGroup("failing TLSv1.3 tests", [ 233tls13_failing_tests = TestGroup("failing TLSv1.3 tests", [
@@ -235,7 +235,7 @@ tls13_failing_tests = TestGroup("failing TLSv1.3 tests", [
235 # With X25519, we accept weak peer public keys and fail when we actually 235 # With X25519, we accept weak peer public keys and fail when we actually
236 # compute the keyshare. Other tests seem to indicate that we could be 236 # compute the keyshare. Other tests seem to indicate that we could be
237 # stricter about what keyshares we accept. 237 # stricter about what keyshares we accept.
238 Test("test-tls13-crfg-curves.py", [ 238 Test("test_tls13_crfg_curves.py", [
239 '-e', 'all zero x448 key share', 239 '-e', 'all zero x448 key share',
240 '-e', 'empty x448 key share', 240 '-e', 'empty x448 key share',
241 '-e', 'sanity x448 with compression ansiX962_compressed_char2', 241 '-e', 'sanity x448 with compression ansiX962_compressed_char2',
@@ -245,7 +245,7 @@ tls13_failing_tests = TestGroup("failing TLSv1.3 tests", [
245 '-e', 'too small x448 key share', 245 '-e', 'too small x448 key share',
246 '-e', 'x448 key share of "1"', 246 '-e', 'x448 key share of "1"',
247 ]), 247 ]),
248 Test("test-tls13-ecdhe-curves.py", [ 248 Test("test_tls13_ecdhe_curves.py", [
249 '-e', 'sanity - x448', 249 '-e', 'sanity - x448',
250 '-e', 'x448 - key share from other curve', 250 '-e', 'x448 - key share from other curve',
251 '-e', 'x448 - point at infinity', 251 '-e', 'x448 - point at infinity',
@@ -258,21 +258,21 @@ tls13_failing_tests = TestGroup("failing TLSv1.3 tests", [
258 # We have the logic corresponding to NSS's fix for CVE-2020-25648 258 # We have the logic corresponding to NSS's fix for CVE-2020-25648
259 # https://hg.mozilla.org/projects/nss/rev/57bbefa793232586d27cee83e74411171e128361 259 # https://hg.mozilla.org/projects/nss/rev/57bbefa793232586d27cee83e74411171e128361
260 # so should not be affected by this issue. 260 # so should not be affected by this issue.
261 Test("test-tls13-multiple-ccs-messages.py"), 261 Test("test_tls13_multiple_ccs_messages.py"),
262 262
263 # https://github.com/openssl/openssl/issues/8369 263 # https://github.com/openssl/openssl/issues/8369
264 Test("test-tls13-obsolete-curves.py"), 264 Test("test_tls13_obsolete_curves.py"),
265 265
266 # 3 failing rsa_pss_pss tests 266 # 3 failing rsa_pss_pss tests
267 Test("test-tls13-rsa-signatures.py"), 267 Test("test_tls13_rsa_signatures.py"),
268 268
269 # The failing tests all expect an ri extension. What's up with that? 269 # The failing tests all expect an ri extension. What's up with that?
270 Test("test-tls13-version-negotiation.py"), 270 Test("test_tls13_version_negotiation.py"),
271]) 271])
272 272
273tls13_slow_failing_tests = TestGroup("slow, failing TLSv1.3 tests", [ 273tls13_slow_failing_tests = TestGroup("slow, failing TLSv1.3 tests", [
274 # Other test failures bugs in keyshare/tlsext negotiation? 274 # Other test failures bugs in keyshare/tlsext negotiation?
275 Test("test-tls13-unrecognised-groups.py"), # unexpected closure 275 Test("test_tls13_unrecognised_groups.py"), # unexpected closure
276 276
277 # 5 occasional failures: 277 # 5 occasional failures:
278 # 'app data split, conversation with KeyUpdate msg' 278 # 'app data split, conversation with KeyUpdate msg'
@@ -280,43 +280,43 @@ tls13_slow_failing_tests = TestGroup("slow, failing TLSv1.3 tests", [
280 # 'multiple KeyUpdate messages' 280 # 'multiple KeyUpdate messages'
281 # 'post-handshake KeyUpdate msg with update_not_request' 281 # 'post-handshake KeyUpdate msg with update_not_request'
282 # 'post-handshake KeyUpdate msg with update_request' 282 # 'post-handshake KeyUpdate msg with update_request'
283 Test("test-tls13-keyupdate.py"), 283 Test("test_tls13_keyupdate.py"),
284 284
285 Test("test-tls13-symetric-ciphers.py"), # unexpected message from peer 285 Test("test_tls13_symetric_ciphers.py"), # unexpected message from peer
286 286
287 # 6 tests fail: 'rsa_pkcs1_{md5,sha{1,224,256,384,512}} signature' 287 # 6 tests fail: 'rsa_pkcs1_{md5,sha{1,224,256,384,512}} signature'
288 # We send server hello, but the test expects handshake_failure 288 # We send server hello, but the test expects handshake_failure
289 Test("test-tls13-pkcs-signature.py"), 289 Test("test_tls13_pkcs_signature.py"),
290 # 8 tests fail: 'tls13 signature rsa_pss_{pss,rsae}_sha{256,384,512} 290 # 8 tests fail: 'tls13 signature rsa_pss_{pss,rsae}_sha{256,384,512}
291 Test("test-tls13-rsapss-signatures.py"), 291 Test("test_tls13_rsapss_signatures.py"),
292]) 292])
293 293
294tls13_unsupported_tests = TestGroup("TLSv1.3 tests for unsupported features", [ 294tls13_unsupported_tests = TestGroup("TLSv1.3 tests for unsupported features", [
295 # Tests for features we don't support 295 # Tests for features we don't support
296 Test("test-tls13-0rtt-garbage.py"), 296 Test("test_tls13_0rtt_garbage.py"),
297 Test("test-tls13-ffdhe-groups.py"), 297 Test("test_tls13_ffdhe_groups.py"),
298 Test("test-tls13-ffdhe-sanity.py"), 298 Test("test_tls13_ffdhe_sanity.py"),
299 Test("test-tls13-psk_dhe_ke.py"), 299 Test("test_tls13_psk_dhe_ke.py"),
300 Test("test-tls13-psk_ke.py"), 300 Test("test_tls13_psk_ke.py"),
301 301
302 # need server to react to HTTP GET for /keyupdate 302 # need server to react to HTTP GET for /keyupdate
303 Test("test-tls13-keyupdate-from-server.py"), 303 Test("test_tls13_keyupdate_from_server.py"),
304 304
305 # needs an echo server 305 # needs an echo server
306 Test("test-tls13-lengths.py"), 306 Test("test_tls13_lengths.py"),
307 307
308 # Weird test: tests servers that don't support 1.3 308 # Weird test: tests servers that don't support 1.3
309 Test("test-tls13-non-support.py"), 309 Test("test_tls13_non_support.py"),
310 310
311 # broken test script 311 # broken test script
312 # UnboundLocalError: local variable 'cert' referenced before assignment 312 # UnboundLocalError: local variable 'cert' referenced before assignment
313 Test("test-tls13-post-handshake-auth.py"), 313 Test("test_tls13_post_handshake_auth.py"),
314 314
315 # ExpectNewSessionTicket 315 # ExpectNewSessionTicket
316 Test("test-tls13-session-resumption.py"), 316 Test("test_tls13_session_resumption.py"),
317 317
318 # Server must be configured to support only rsa_pss_rsae_sha512 318 # Server must be configured to support only rsa_pss_rsae_sha512
319 Test("test-tls13-signature-algorithms.py"), 319 Test("test_tls13_signature_algorithms.py"),
320]) 320])
321 321
322tls12_exclude_legacy_protocols = [ 322tls12_exclude_legacy_protocols = [
@@ -345,52 +345,52 @@ tls12_exclude_legacy_protocols = [
345 345
346tls12_tests = TestGroup("TLSv1.2 tests", [ 346tls12_tests = TestGroup("TLSv1.2 tests", [
347 # Tests that pass as they are. 347 # Tests that pass as they are.
348 Test("test-aes-gcm-nonces.py"), 348 Test("test_aes_gcm_nonces.py"),
349 Test("test-connection-abort.py"), 349 Test("test_connection_abort.py"),
350 Test("test-conversation.py"), 350 Test("test_conversation.py"),
351 Test("test-cve-2016-2107.py"), 351 Test("test_cve_2016_2107.py"),
352 Test("test-cve-2016-6309.py"), 352 Test("test_cve_2016_6309.py"),
353 Test("test-dhe-rsa-key-exchange.py"), 353 Test("test_dhe_rsa_key_exchange.py"),
354 Test("test-early-application-data.py"), 354 Test("test_early_application_data.py"),
355 Test("test-empty-extensions.py"), 355 Test("test_empty_extensions.py"),
356 Test("test-extensions.py"), 356 Test("test_extensions.py"),
357 Test("test-fuzzed-MAC.py"), 357 Test("test_fuzzed_MAC.py"),
358 Test("test-fuzzed-ciphertext.py"), 358 Test("test_fuzzed_ciphertext.py"),
359 Test("test-fuzzed-finished.py"), 359 Test("test_fuzzed_finished.py"),
360 Test("test-fuzzed-padding.py"), 360 Test("test_fuzzed_padding.py"),
361 Test("test-fuzzed-plaintext.py"), # fails once in a while 361 Test("test_fuzzed_plaintext.py"), # fails once in a while
362 Test("test-hello-request-by-client.py"), 362 Test("test_hello_request_by_client.py"),
363 Test("test-invalid-cipher-suites.py"), 363 Test("test_invalid_cipher_suites.py"),
364 Test("test-invalid-content-type.py"), 364 Test("test_invalid_content_type.py"),
365 Test("test-invalid-session-id.py"), 365 Test("test_invalid_session_id.py"),
366 Test("test-invalid-version.py"), 366 Test("test_invalid_version.py"),
367 Test("test-large-number-of-extensions.py"), 367 Test("test_large_number_of_extensions.py"),
368 Test("test-lucky13.py"), 368 Test("test_lucky13.py"),
369 Test("test-message-skipping.py"), 369 Test("test_message_skipping.py"),
370 Test("test-no-heartbeat.py"), 370 Test("test_no_heartbeat.py"),
371 Test("test-record-layer-fragmentation.py"), 371 Test("test_record_layer_fragmentation.py"),
372 Test("test-sslv2-connection.py"), 372 Test("test_sslv2_connection.py"),
373 Test("test-truncating-of-finished.py"), 373 Test("test_truncating_of_finished.py"),
374 Test("test-truncating-of-kRSA-client-key-exchange.py"), 374 Test("test_truncating_of_kRSA_client_key_exchange.py"),
375 Test("test-unsupported-curve-fallback.py"), 375 Test("test_unsupported_curve_fallback.py"),
376 Test("test-version-numbers.py"), 376 Test("test_version_numbers.py"),
377 Test("test-zero-length-data.py"), 377 Test("test_zero_length_data.py"),
378 378
379 # Tests that need tweaking for unsupported features and ciphers. 379 # Tests that need tweaking for unsupported features and ciphers.
380 Test( 380 Test(
381 "test-atypical-padding.py", [ 381 "test_atypical_padding.py", [
382 "-e", "sanity - encrypt then MAC", 382 "-e", "sanity - encrypt then MAC",
383 "-e", "2^14 bytes of AppData with 256 bytes of padding (SHA1 + Encrypt then MAC)", 383 "-e", "2^14 bytes of AppData with 256 bytes of padding (SHA1 + Encrypt then MAC)",
384 ] 384 ]
385 ), 385 ),
386 Test( 386 Test(
387 "test-ccs.py", [ 387 "test_ccs.py", [
388 "-x", "two bytes long CCS", 388 "-x", "two bytes long CCS",
389 "-X", substitute_alert("unexpected_message", "decode_error"), 389 "-X", substitute_alert("unexpected_message", "decode_error"),
390 ] 390 ]
391 ), 391 ),
392 Test( 392 Test(
393 "test-dhe-rsa-key-exchange-signatures.py", [ 393 "test_dhe_rsa_key_exchange_signatures.py", [
394 "-e", "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA sha224 signature", 394 "-e", "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA sha224 signature",
395 "-e", "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 sha224 signature", 395 "-e", "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 sha224 signature",
396 "-e", "TLS_DHE_RSA_WITH_AES_128_CBC_SHA sha224 signature", 396 "-e", "TLS_DHE_RSA_WITH_AES_128_CBC_SHA sha224 signature",
@@ -398,14 +398,14 @@ tls12_tests = TestGroup("TLSv1.2 tests", [
398 "-e", "TLS_DHE_RSA_WITH_AES_256_CBC_SHA sha224 signature", 398 "-e", "TLS_DHE_RSA_WITH_AES_256_CBC_SHA sha224 signature",
399 ] 399 ]
400 ), 400 ),
401 Test("test-dhe-rsa-key-exchange-with-bad-messages.py", [ 401 Test("test_dhe_rsa_key_exchange_with_bad_messages.py", [
402 "-x", "invalid dh_Yc value - missing", 402 "-x", "invalid dh_Yc value - missing",
403 "-X", substitute_alert("decode_error", "illegal_parameter"), 403 "-X", substitute_alert("decode_error", "illegal_parameter"),
404 ]), 404 ]),
405 Test("test-dhe-key-share-random.py", tls12_exclude_legacy_protocols), 405 Test("test_dhe_key_share_random.py", tls12_exclude_legacy_protocols),
406 Test("test-export-ciphers-rejected.py", ["--min-ver", "TLSv1.2"]), 406 Test("test_export_ciphers_rejected.py", ["--min-ver", "TLSv1.2"]),
407 Test( 407 Test(
408 "test-downgrade-protection.py", 408 "test_downgrade_protection.py",
409 tls12_args = ["--server-max-protocol", "TLSv1.2"], 409 tls12_args = ["--server-max-protocol", "TLSv1.2"],
410 tls13_args = [ 410 tls13_args = [
411 "--server-max-protocol", "TLSv1.3", 411 "--server-max-protocol", "TLSv1.3",
@@ -414,7 +414,7 @@ tls12_tests = TestGroup("TLSv1.2 tests", [
414 ] 414 ]
415 ), 415 ),
416 Test( 416 Test(
417 "test-fallback-scsv.py", 417 "test_fallback_scsv.py",
418 tls13_args = [ 418 tls13_args = [
419 "--tls-1.3", 419 "--tls-1.3",
420 "-e", "FALLBACK - hello TLSv1.1 - pos 0", 420 "-e", "FALLBACK - hello TLSv1.1 - pos 0",
@@ -428,7 +428,7 @@ tls12_tests = TestGroup("TLSv1.2 tests", [
428 ] 428 ]
429 ), 429 ),
430 430
431 Test("test-invalid-compression-methods.py", [ 431 Test("test_invalid_compression_methods.py", [
432 "-x", "invalid compression methods", 432 "-x", "invalid compression methods",
433 "-X", substitute_alert("illegal_parameter", "decode_error"), 433 "-X", substitute_alert("illegal_parameter", "decode_error"),
434 "-x", "only deflate compression method", 434 "-x", "only deflate compression method",
@@ -437,134 +437,134 @@ tls12_tests = TestGroup("TLSv1.2 tests", [
437 437
438 # Skip extended_master_secret test. Since we don't support this 438 # Skip extended_master_secret test. Since we don't support this
439 # extension, we don't notice that it was dropped. 439 # extension, we don't notice that it was dropped.
440 Test("test-renegotiation-changed-clienthello.py", [ 440 Test("test_renegotiation_changed_clienthello.py", [
441 "-e", "drop extended_master_secret in renegotiation", 441 "-e", "drop extended_master_secret in renegotiation",
442 ]), 442 ]),
443 443
444 Test("test-sessionID-resumption.py", [ 444 Test("test_sessionID_resumption.py", [
445 "-x", "Client Hello too long session ID", 445 "-x", "Client Hello too long session ID",
446 "-X", substitute_alert("decode_error", "illegal_parameter"), 446 "-X", substitute_alert("decode_error", "illegal_parameter"),
447 ]), 447 ]),
448 448
449 # Without --sig-algs-drop-ok, two tests fail since we do not currently 449 # Without --sig-algs-drop-ok, two tests fail since we do not currently
450 # implement the signature_algorithms_cert extension (although we MUST). 450 # implement the signature_algorithms_cert extension (although we MUST).
451 Test("test-sig-algs-renegotiation-resumption.py", ["--sig-algs-drop-ok"]), 451 Test("test_sig_algs_renegotiation_resumption.py", ["--sig-algs-drop-ok"]),
452 452
453 Test("test-serverhello-random.py", args = tls12_exclude_legacy_protocols), 453 Test("test_serverhello_random.py", args = tls12_exclude_legacy_protocols),
454 454
455 Test("test-chacha20.py", [ "-e", "Chacha20 in TLS1.1" ]), 455 Test("test_chacha20.py", [ "-e", "Chacha20 in TLS1.1" ]),
456]) 456])
457 457
458tls12_slow_tests = TestGroup("slow TLSv1.2 tests", [ 458tls12_slow_tests = TestGroup("slow TLSv1.2 tests", [
459 Test("test-cve-2016-7054.py"), 459 Test("test_cve_2016_7054.py"),
460 Test("test-dhe-no-shared-secret-padding.py", tls12_exclude_legacy_protocols), 460 Test("test_dhe_no_shared_secret_padding.py", tls12_exclude_legacy_protocols),
461 Test("test-ecdhe-padded-shared-secret.py", tls12_exclude_legacy_protocols), 461 Test("test_ecdhe_padded_shared_secret.py", tls12_exclude_legacy_protocols),
462 Test("test-ecdhe-rsa-key-share-random.py", tls12_exclude_legacy_protocols), 462 Test("test_ecdhe_rsa_key_share_random.py", tls12_exclude_legacy_protocols),
463 # Start at extension number 58 to avoid QUIC transport parameters (57) 463 # Start at extension number 58 to avoid QUIC transport parameters (57)
464 Test("test-large-hello.py", [ "-m", "58" ]), 464 Test("test_large_hello.py", [ "-m", "58" ]),
465]) 465])
466 466
467tls12_failing_tests = TestGroup("failing TLSv1.2 tests", [ 467tls12_failing_tests = TestGroup("failing TLSv1.2 tests", [
468 # no shared cipher 468 # no shared cipher
469 Test("test-aesccm.py"), 469 Test("test_aesccm.py"),
470 # need server to set up alpn 470 # need server to set up alpn
471 Test("test-alpn-negotiation.py"), 471 Test("test_alpn_negotiation.py"),
472 # Failing on TLS_RSA_WITH_AES_128_CBC_SHA because server does not support it. 472 # Failing on TLS_RSA_WITH_AES_128_CBC_SHA because server does not support it.
473 Test("test-bleichenbacher-timing-pregenerate.py"), 473 Test("test_bleichenbacher_timing_pregenerate.py"),
474 # many tests fail due to unexpected server_name extension 474 # many tests fail due to unexpected server_name extension
475 Test("test-bleichenbacher-workaround.py"), 475 Test("test_bleichenbacher_workaround.py"),
476 476
477 # need client key and cert plus extra server setup 477 # need client key and cert plus extra server setup
478 Test("test-certificate-malformed.py"), 478 Test("test_certificate_malformed.py"),
479 Test("test-certificate-request.py"), 479 Test("test_certificate_request.py"),
480 Test("test-certificate-verify-malformed-sig.py"), 480 Test("test_certificate_verify_malformed_sig.py"),
481 Test("test-certificate-verify-malformed.py"), 481 Test("test_certificate_verify_malformed.py"),
482 Test("test-certificate-verify.py"), 482 Test("test_certificate_verify.py"),
483 Test("test-ecdsa-in-certificate-verify.py"), 483 Test("test_ecdsa_in_certificate_verify.py"),
484 Test("test-eddsa-in-certificate-verify.py"), 484 Test("test_eddsa_in_certificate_verify.py"),
485 Test("test-renegotiation-disabled-client-cert.py"), 485 Test("test_renegotiation_disabled_client_cert.py"),
486 Test("test-rsa-pss-sigs-on-certificate-verify.py"), 486 Test("test_rsa_pss_sigs_on_certificate_verify.py"),
487 Test("test-rsa-sigs-on-certificate-verify.py"), 487 Test("test_rsa_sigs_on_certificate_verify.py"),
488 488
489 # test doesn't expect session ticket 489 # test doesn't expect session ticket
490 Test("test-client-compatibility.py"), 490 Test("test_client_compatibility.py"),
491 # abrupt closure 491 # abrupt closure
492 Test("test-client-hello-max-size.py"), 492 Test("test_client_hello_max_size.py"),
493 # unknown signature algorithms 493 # unknown signature algorithms
494 Test("test-clienthello-md5.py"), 494 Test("test_clienthello_md5.py"),
495 495
496 # Tests expect an illegal_parameter or a decode_error alert. Should be 496 # Tests expect an illegal_parameter or a decode_error alert. Should be
497 # added to ssl3_get_client_key_exchange on kex function failure. 497 # added to ssl3_get_client_key_exchange on kex function failure.
498 Test("test-ecdhe-rsa-key-exchange-with-bad-messages.py"), 498 Test("test_ecdhe_rsa_key_exchange_with_bad_messages.py"),
499 499
500 # We send a handshake_failure due to no shared ciphers while the 500 # We send a handshake_failure due to no shared ciphers while the
501 # test expects to succeed. 501 # test expects to succeed.
502 Test("test-ecdhe-rsa-key-exchange.py"), 502 Test("test_ecdhe_rsa_key_exchange.py"),
503 503
504 # no shared cipher 504 # no shared cipher
505 Test("test-ecdsa-sig-flexibility.py"), 505 Test("test_ecdsa_sig_flexibility.py"),
506 506
507 # Tests expect SH but we send unexpected_message or handshake_failure 507 # Tests expect SH but we send unexpected_message or handshake_failure
508 # 'Application data inside Client Hello' 508 # 'Application data inside Client Hello'
509 # 'Application data inside Client Key Exchange' 509 # 'Application data inside Client Key Exchange'
510 # 'Application data inside Finished' 510 # 'Application data inside Finished'
511 Test("test-interleaved-application-data-and-fragmented-handshakes-in-renegotiation.py"), 511 Test("test_interleaved_application_data_and_fragmented_handshakes_in_renegotiation.py"),
512 # Tests expect SH but we send handshake_failure 512 # Tests expect SH but we send handshake_failure
513 # 'Application data before Change Cipher Spec' 513 # 'Application data before Change Cipher Spec'
514 # 'Application data before Client Key Exchange' 514 # 'Application data before Client Key Exchange'
515 # 'Application data before Finished' 515 # 'Application data before Finished'
516 Test("test-interleaved-application-data-in-renegotiation.py"), 516 Test("test_interleaved_application_data_in_renegotiation.py"),
517 517
518 # broken test script 518 # broken test script
519 # TypeError: '<' not supported between instances of 'int' and 'NoneType' 519 # TypeError: '<' not supported between instances of 'int' and 'NoneType'
520 Test("test-invalid-client-hello-w-record-overflow.py"), 520 Test("test_invalid_client_hello_w_record_overflow.py"),
521 521
522 # Lots of failures. abrupt closure 522 # Lots of failures. abrupt closure
523 Test("test-invalid-client-hello.py"), 523 Test("test_invalid_client_hello.py"),
524 524
525 # abrupt closure 525 # abrupt closure
526 # 'encrypted premaster set to all zero (n)' n in 256 384 512 526 # 'encrypted premaster set to all zero (n)' n in 256 384 512
527 Test("test-invalid-rsa-key-exchange-messages.py"), 527 Test("test_invalid_rsa_key_exchange_messages.py"),
528 528
529 # test expects illegal_parameter, we send unrecognized_name (which seems 529 # test expects illegal_parameter, we send unrecognized_name (which seems
530 # correct according to rfc 6066?) 530 # correct according to rfc 6066?)
531 Test("test-invalid-server-name-extension-resumption.py"), 531 Test("test_invalid_server_name_extension_resumption.py"),
532 # let through some server names without sending an alert 532 # let through some server names without sending an alert
533 # again illegal_parameter vs unrecognized_name 533 # again illegal_parameter vs unrecognized_name
534 Test("test-invalid-server-name-extension.py"), 534 Test("test_invalid_server_name_extension.py"),
535 535
536 # 4 failures: 536 # 4 failures:
537 # 'insecure (legacy) renegotiation with GET after 2nd handshake' 537 # 'insecure (legacy) renegotiation with GET after 2nd handshake'
538 # 'insecure (legacy) renegotiation with incomplete GET' 538 # 'insecure (legacy) renegotiation with incomplete GET'
539 # 'secure renegotiation with GET after 2nd handshake' 539 # 'secure renegotiation with GET after 2nd handshake'
540 # 'secure renegotiation with incomplete GET' 540 # 'secure renegotiation with incomplete GET'
541 Test("test-legacy-renegotiation.py"), 541 Test("test_legacy_renegotiation.py"),
542 542
543 # 1 failure (timeout): we don't send the unexpected_message alert 543 # 1 failure (timeout): we don't send the unexpected_message alert
544 # 'duplicate change cipher spec after Finished' 544 # 'duplicate change cipher spec after Finished'
545 Test("test-message-duplication.py"), 545 Test("test_message_duplication.py"),
546 546
547 # server should send status_request 547 # server should send status_request
548 Test("test-ocsp-stapling.py"), 548 Test("test_ocsp_stapling.py"),
549 549
550 # unexpected closure 550 # unexpected closure
551 Test("test-openssl-3712.py"), 551 Test("test_openssl_3712.py"),
552 552
553 # failed: 3 (expect an alert, we send AD) 553 # failed: 3 (expect an alert, we send AD)
554 # 'try insecure (legacy) renegotiation with incomplete GET' 554 # 'try insecure (legacy) renegotiation with incomplete GET'
555 # 'try secure renegotiation with GET after 2nd CH' 555 # 'try secure renegotiation with GET after 2nd CH'
556 # 'try secure renegotiation with incomplete GET' 556 # 'try secure renegotiation with incomplete GET'
557 Test("test-renegotiation-disabled.py"), 557 Test("test_renegotiation_disabled.py"),
558 558
559 # 'resumption of safe session with NULL cipher' 559 # 'resumption of safe session with NULL cipher'
560 # 'resumption with cipher from old CH but not selected by server' 560 # 'resumption with cipher from old CH but not selected by server'
561 Test("test-resumption-with-wrong-ciphers.py"), 561 Test("test_resumption_with_wrong_ciphers.py"),
562 562
563 # 'session resumption with empty session_id' 563 # 'session resumption with empty session_id'
564 # 'session resumption with random session_id' 564 # 'session resumption with random session_id'
565 # 'session resumption with renegotiation' 565 # 'session resumption with renegotiation'
566 # AssertionError: Server did not send extension(s): session_ticket 566 # AssertionError: Server did not send extension(s): session_ticket
567 Test("test-session-ticket-resumption.py"), 567 Test("test_session_ticket_resumption.py"),
568 568
569 # 5 failures: 569 # 5 failures:
570 # 'empty sigalgs' 570 # 'empty sigalgs'
@@ -572,7 +572,7 @@ tls12_failing_tests = TestGroup("failing TLSv1.2 tests", [
572 # 'rsa_pss_pss_sha256 only' 572 # 'rsa_pss_pss_sha256 only'
573 # 'rsa_pss_pss_sha384 only' 573 # 'rsa_pss_pss_sha384 only'
574 # 'rsa_pss_pss_sha512 only' 574 # 'rsa_pss_pss_sha512 only'
575 Test("test-sig-algs.py"), 575 Test("test_sig_algs.py"),
576 576
577 # 13 failures: 577 # 13 failures:
578 # 'duplicated n non-rsa schemes' for n in 202 2342 8119 23741 32744 578 # 'duplicated n non-rsa schemes' for n in 202 2342 8119 23741 32744
@@ -581,51 +581,51 @@ tls12_failing_tests = TestGroup("failing TLSv1.2 tests", [
581 # 'tolerance 32758 methods with sig_alg_cert' 581 # 'tolerance 32758 methods with sig_alg_cert'
582 # 'tolerance max 32744 number of methods with sig_alg_cert' 582 # 'tolerance max 32744 number of methods with sig_alg_cert'
583 # 'tolerance max (32760) number of methods' 583 # 'tolerance max (32760) number of methods'
584 Test("test-signature-algorithms.py"), 584 Test("test_signature_algorithms.py"),
585 585
586 # times out 586 # times out
587 Test("test-ssl-death-alert.py"), 587 Test("test_ssl_death_alert.py"),
588 588
589 # 17 pass, 13 fail. padding and truncation 589 # 17 pass, 13 fail. padding and truncation
590 Test("test-truncating-of-client-hello.py"), 590 Test("test_truncating_of_client_hello.py"),
591 591
592 # x448 tests need disabling plus x25519 corner cases need sorting out 592 # x448 tests need disabling plus x25519 corner cases need sorting out
593 Test("test-x25519.py"), 593 Test("test_x25519.py"),
594 594
595 # Needs TLS 1.0 or 1.1 595 # Needs TLS 1.0 or 1.1
596 Test("test-TLSv1_2-rejected-without-TLSv1_2.py"), 596 Test("test_TLSv1_2_rejected_without_TLSv1_2.py"),
597]) 597])
598 598
599tls12_unsupported_tests = TestGroup("TLSv1.2 for unsupported features", [ 599tls12_unsupported_tests = TestGroup("TLSv1.2 for unsupported features", [
600 # protocol_version 600 # protocol_version
601 Test("test-SSLv3-padding.py"), 601 Test("test_SSLv3_padding.py"),
602 # we don't do RSA key exchanges 602 # we don't do RSA key exchanges
603 Test("test-bleichenbacher-timing.py"), 603 Test("test_bleichenbacher_timing.py"),
604 # no encrypt-then-mac 604 # no encrypt-then-mac
605 Test("test-encrypt-then-mac-renegotiation.py"), 605 Test("test_encrypt_then_mac_renegotiation.py"),
606 Test("test-encrypt-then-mac.py"), 606 Test("test_encrypt_then_mac.py"),
607 # no EME support 607 # no EME support
608 Test("test-extended-master-secret-extension-with-client-cert.py"), 608 Test("test_extended_master_secret_extension_with_client_cert.py"),
609 Test("test-extended-master-secret-extension.py"), 609 Test("test_extended_master_secret_extension.py"),
610 # no ffdhe 610 # no ffdhe
611 Test("test-ffdhe-expected-params.py"), 611 Test("test_ffdhe_expected_params.py"),
612 Test("test-ffdhe-negotiation.py"), 612 Test("test_ffdhe_negotiation.py"),
613 # record_size_limit/max_fragment_length extension (RFC 8449) 613 # record_size_limit/max_fragment_length extension (RFC 8449)
614 Test("test-record-size-limit.py"), 614 Test("test_record_size_limit.py"),
615 # expects the server to send the heartbeat extension 615 # expects the server to send the heartbeat extension
616 Test("test-heartbeat.py"), 616 Test("test_heartbeat.py"),
617 # needs an echo server 617 # needs an echo server
618 Test("test-lengths.py"), 618 Test("test_lengths.py"),
619]) 619])
620 620
621# These tests take a ton of time to fail against an 1.3 server, 621# These tests take a ton of time to fail against an 1.3 server,
622# so don't run them against 1.3 pending further investigation. 622# so don't run them against 1.3 pending further investigation.
623legacy_tests = TestGroup("Legacy protocol tests", [ 623legacy_tests = TestGroup("Legacy protocol tests", [
624 Test("test-sslv2-force-cipher-3des.py"), 624 Test("test_sslv2_force_cipher_3des.py"),
625 Test("test-sslv2-force-cipher-non3des.py"), 625 Test("test_sslv2_force_cipher_non3des.py"),
626 Test("test-sslv2-force-cipher.py"), 626 Test("test_sslv2_force_cipher.py"),
627 Test("test-sslv2-force-export-cipher.py"), 627 Test("test_sslv2_force_export_cipher.py"),
628 Test("test-sslv2hello-protocol.py"), 628 Test("test_sslv2hello_protocol.py"),
629]) 629])
630 630
631all_groups = [ 631all_groups = [
diff --git a/src/regress/lib/libtls/tls/tlstest.c b/src/regress/lib/libtls/tls/tlstest.c
index b675c798b4..d52156128d 100644
--- a/src/regress/lib/libtls/tls/tlstest.c
+++ b/src/regress/lib/libtls/tls/tlstest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tlstest.c,v 1.16 2024/08/02 15:02:22 tb Exp $ */ 1/* $OpenBSD: tlstest.c,v 1.17 2025/06/04 10:28:00 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -531,6 +531,142 @@ do_tls_version_tests(void)
531 return failure; 531 return failure;
532} 532}
533 533
534static int
535test_tls_alpn(const char *client_alpn, const char *server_alpn,
536 const char *selected)
537{
538 struct tls_config *client_cfg, *server_cfg;
539 struct tls *client, *server, *server_cctx;
540 const char *got_server, *got_client;
541 int failed = 1;
542
543 if ((client = tls_client()) == NULL)
544 errx(1, "failed to create tls client");
545 if ((client_cfg = tls_config_new()) == NULL)
546 errx(1, "failed to create tls client config");
547 tls_config_insecure_noverifyname(client_cfg);
548 if (tls_config_set_alpn(client_cfg, client_alpn) == -1)
549 errx(1, "failed to set alpn: %s", tls_config_error(client_cfg));
550 if (tls_config_set_ca_file(client_cfg, cafile) == -1)
551 errx(1, "failed to set ca: %s", tls_config_error(client_cfg));
552
553 if ((server = tls_server()) == NULL)
554 errx(1, "failed to create tls server");
555 if ((server_cfg = tls_config_new()) == NULL)
556 errx(1, "failed to create tls server config");
557 if (tls_config_set_alpn(server_cfg, server_alpn) == -1)
558 errx(1, "failed to set alpn: %s", tls_config_error(server_cfg));
559 if (tls_config_set_keypair_file(server_cfg, certfile, keyfile) == -1)
560 errx(1, "failed to set keypair: %s",
561 tls_config_error(server_cfg));
562
563 if (tls_configure(client, client_cfg) == -1)
564 errx(1, "failed to configure client: %s", tls_error(client));
565 tls_reset(server);
566 if (tls_configure(server, server_cfg) == -1)
567 errx(1, "failed to configure server: %s", tls_error(server));
568
569 tls_config_free(client_cfg);
570 tls_config_free(server_cfg);
571
572 circular_init();
573
574 if (tls_accept_cbs(server, &server_cctx, server_read, server_write,
575 NULL) == -1)
576 errx(1, "failed to accept: %s", tls_error(server));
577
578 if (tls_connect_cbs(client, client_read, client_write, NULL,
579 "test") == -1)
580 errx(1, "failed to connect: %s", tls_error(client));
581
582 if (do_client_server_test("alpn", client, server_cctx) != 0)
583 goto fail;
584
585 got_server = tls_conn_alpn_selected(server_cctx);
586 got_client = tls_conn_alpn_selected(client);
587
588 if (got_server == NULL || got_client == NULL) {
589 printf("FAIL: expected ALPN for server and client, got "
590 "server: %p, client %p\n", got_server, got_client);
591 goto fail;
592 }
593
594 if (strcmp(got_server, got_client) != 0) {
595 printf("FAIL: ALPN mismatch: server %s, client %s\n",
596 got_server, got_client);
597 goto fail;
598 }
599
600 if (strcmp(selected, got_server) != 0) {
601 printf("FAIL: ALPN mismatch: want %s, got %s\n",
602 selected, got_server);
603 goto fail;
604 }
605
606 failed = 0;
607
608 fail:
609 tls_free(client);
610 tls_free(server);
611 tls_free(server_cctx);
612
613 return (failed);
614}
615
616static const struct test_alpn {
617 const char *client;
618 const char *server;
619 const char *selected;
620} tls_test_alpn[] = {
621 {
622 .client = "http/2,http/1.1",
623 .server = "http/1.1",
624 .selected = "http/1.1",
625 },
626 {
627 .client = "http/2,http/1.1",
628 .server = "http/2,http/1.1",
629 .selected = "http/2",
630 },
631 {
632 .client = "http/1.1,http/2",
633 .server = "http/2,http/1.1",
634 .selected = "http/2",
635 },
636 {
637 .client = "http/2,http/1.1",
638 .server = "http/1.1,http/2",
639 .selected = "http/1.1",
640 },
641 {
642 .client = "http/1.1",
643 .server = "http/2,http/1.1",
644 .selected = "http/1.1",
645 },
646};
647
648#define N_TLS_ALPN_TESTS (sizeof(tls_test_alpn) / sizeof(tls_test_alpn[0]))
649
650static int
651do_tls_alpn_tests(void)
652{
653 const struct test_alpn *ta;
654 int failure = 0;
655 size_t i;
656
657 printf("== TLS alpn tests ==\n");
658
659 for (i = 0; i < N_TLS_ALPN_TESTS; i++) {
660 ta = &tls_test_alpn[i];
661 printf("INFO: alpn test %zu - client alpn '%s' "
662 "and server alpn '%s'\n", i, ta->client, ta->server);
663 failure |= test_tls_alpn(ta->client, ta->server, ta->selected);
664 printf("\n");
665 }
666
667 return failure;
668}
669
534int 670int
535main(int argc, char **argv) 671main(int argc, char **argv)
536{ 672{
@@ -549,6 +685,7 @@ main(int argc, char **argv)
549 failure |= do_tls_tests(); 685 failure |= do_tls_tests();
550 failure |= do_tls_ordering_tests(); 686 failure |= do_tls_ordering_tests();
551 failure |= do_tls_version_tests(); 687 failure |= do_tls_version_tests();
688 failure |= do_tls_alpn_tests();
552 689
553 return (failure); 690 return (failure);
554} 691}
diff --git a/src/usr.bin/nc/nc.1 b/src/usr.bin/nc/nc.1
index 76b6dc018e..2ffdcd1ea6 100644
--- a/src/usr.bin/nc/nc.1
+++ b/src/usr.bin/nc/nc.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: nc.1,v 1.98 2024/04/01 12:40:18 deraadt Exp $ 1.\" $OpenBSD: nc.1,v 1.101 2025/06/24 13:37:39 tb Exp $
2.\" 2.\"
3.\" Copyright (c) 1996 David Sacerdote 3.\" Copyright (c) 1996 David Sacerdote
4.\" All rights reserved. 4.\" All rights reserved.
@@ -25,7 +25,7 @@
25.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27.\" 27.\"
28.Dd $Mdocdate: April 1 2024 $ 28.Dd $Mdocdate: June 24 2025 $
29.Dt NC 1 29.Dt NC 1
30.Os 30.Os
31.Sh NAME 31.Sh NAME
@@ -257,6 +257,10 @@ with the handshake.
257The following TLS options specify a value in the form of a 257The following TLS options specify a value in the form of a
258.Ar key Ns = Ns Ar value 258.Ar key Ns = Ns Ar value
259pair: 259pair:
260.Cm alpn ,
261which allows the TLS ALPN to be specified (see
262.Xr tls_config_set_alpn 3
263for further details);
260.Cm ciphers , 264.Cm ciphers ,
261which allows the supported TLS ciphers to be specified (see 265which allows the supported TLS ciphers to be specified (see
262.Xr tls_config_set_ciphers 3 266.Xr tls_config_set_ciphers 3
@@ -338,12 +342,18 @@ when talking to the proxy server.
338Supported protocols are 342Supported protocols are
339.Cm 4 343.Cm 4
340(SOCKS v.4), 344(SOCKS v.4),
345.Cm 4A
346(SOCKS v.4A),
341.Cm 5 347.Cm 5
342(SOCKS v.5) 348(SOCKS v.5)
343and 349and
344.Cm connect 350.Cm connect
345(HTTPS proxy). 351(HTTPS proxy).
346If the protocol is not specified, SOCKS version 5 is used. 352If the protocol is not specified, SOCKS version 5 is used.
353Note that the SOCKS v.4 protocol is very limited and can only be used when
354the destination host can be resolved to an IPv4 address.
355The other protocols pass the destination as a string to be interpreted
356by the remote proxy and do not have this limitation.
347.It Fl x Ar proxy_address Ns Op : Ns Ar port 357.It Fl x Ar proxy_address Ns Op : Ns Ar port
348Connect to 358Connect to
349.Ar destination 359.Ar destination
diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c
index 8c60fd1882..e3c9c939e2 100644
--- a/src/usr.bin/nc/netcat.c
+++ b/src/usr.bin/nc/netcat.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: netcat.c,v 1.229 2024/11/02 17:19:27 tb Exp $ */ 1/* $OpenBSD: netcat.c,v 1.234 2025/06/24 13:37:11 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> 3 * Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
4 * Copyright (c) 2015 Bob Beck. All rights reserved. 4 * Copyright (c) 2015 Bob Beck. All rights reserved.
@@ -108,6 +108,7 @@ char *tls_expectname; /* required name in peer cert */
108char *tls_expecthash; /* required hash of peer cert */ 108char *tls_expecthash; /* required hash of peer cert */
109char *tls_ciphers; /* TLS ciphers */ 109char *tls_ciphers; /* TLS ciphers */
110char *tls_protocols; /* TLS protocols */ 110char *tls_protocols; /* TLS protocols */
111char *tls_alpn; /* TLS ALPN */
111FILE *Zflag; /* file to save peer cert */ 112FILE *Zflag; /* file to save peer cert */
112 113
113int recvcount, recvlimit; 114int recvcount, recvlimit;
@@ -190,6 +191,8 @@ main(int argc, char *argv[])
190 socksv = -1; /* HTTP proxy CONNECT */ 191 socksv = -1; /* HTTP proxy CONNECT */
191 else if (strcmp(optarg, "4") == 0) 192 else if (strcmp(optarg, "4") == 0)
192 socksv = 4; /* SOCKS v.4 */ 193 socksv = 4; /* SOCKS v.4 */
194 else if (strcasecmp(optarg, "4A") == 0)
195 socksv = 44; /* SOCKS v.4A */
193 else if (strcmp(optarg, "5") == 0) 196 else if (strcmp(optarg, "5") == 0)
194 socksv = 5; /* SOCKS v.5 */ 197 socksv = 5; /* SOCKS v.5 */
195 else 198 else
@@ -532,6 +535,8 @@ main(int argc, char *argv[])
532 errx(1, "%s", tls_config_error(tls_cfg)); 535 errx(1, "%s", tls_config_error(tls_cfg));
533 if (tls_config_set_ciphers(tls_cfg, tls_ciphers) == -1) 536 if (tls_config_set_ciphers(tls_cfg, tls_ciphers) == -1)
534 errx(1, "%s", tls_config_error(tls_cfg)); 537 errx(1, "%s", tls_config_error(tls_cfg));
538 if (tls_alpn != NULL && tls_config_set_alpn(tls_cfg, tls_alpn) == -1)
539 errx(1, "%s", tls_config_error(tls_cfg));
535 if (!lflag && (TLSopt & TLS_CCERT)) 540 if (!lflag && (TLSopt & TLS_CCERT))
536 errx(1, "clientcert is only valid with -l"); 541 errx(1, "clientcert is only valid with -l");
537 if (TLSopt & TLS_NONAME) 542 if (TLSopt & TLS_NONAME)
@@ -1669,11 +1674,12 @@ process_tls_opt(char *s, int *flags)
1669 int flag; 1674 int flag;
1670 char **value; 1675 char **value;
1671 } *t, tlskeywords[] = { 1676 } *t, tlskeywords[] = {
1677 { "alpn", -1, &tls_alpn },
1672 { "ciphers", -1, &tls_ciphers }, 1678 { "ciphers", -1, &tls_ciphers },
1673 { "clientcert", TLS_CCERT, NULL }, 1679 { "clientcert", TLS_CCERT, NULL },
1674 { "muststaple", TLS_MUSTSTAPLE, NULL }, 1680 { "muststaple", TLS_MUSTSTAPLE, NULL },
1675 { "noverify", TLS_NOVERIFY, NULL },
1676 { "noname", TLS_NONAME, NULL }, 1681 { "noname", TLS_NONAME, NULL },
1682 { "noverify", TLS_NOVERIFY, NULL },
1677 { "protocols", -1, &tls_protocols }, 1683 { "protocols", -1, &tls_protocols },
1678 { NULL, -1, NULL }, 1684 { NULL, -1, NULL },
1679 }; 1685 };
@@ -1692,6 +1698,8 @@ process_tls_opt(char *s, int *flags)
1692 errx(1, "invalid tls value `%s'", s); 1698 errx(1, "invalid tls value `%s'", s);
1693 *t->value = v; 1699 *t->value = v;
1694 } else { 1700 } else {
1701 if (v != NULL)
1702 errx(1, "invalid tls value `%s'", s);
1695 *flags |= t->flag; 1703 *flags |= t->flag;
1696 } 1704 }
1697 return 1; 1705 return 1;
@@ -1718,7 +1726,7 @@ void
1718report_tls(struct tls *tls_ctx, char *host) 1726report_tls(struct tls *tls_ctx, char *host)
1719{ 1727{
1720 time_t t; 1728 time_t t;
1721 const char *ocsp_url; 1729 const char *alpn_proto, *ocsp_url;
1722 1730
1723 fprintf(stderr, "TLS handshake negotiated %s/%s with host %s\n", 1731 fprintf(stderr, "TLS handshake negotiated %s/%s with host %s\n",
1724 tls_conn_version(tls_ctx), tls_conn_cipher(tls_ctx), host); 1732 tls_conn_version(tls_ctx), tls_conn_cipher(tls_ctx), host);
@@ -1770,6 +1778,8 @@ report_tls(struct tls *tls_ctx, char *host)
1770 tls_peer_ocsp_result(tls_ctx)); 1778 tls_peer_ocsp_result(tls_ctx));
1771 break; 1779 break;
1772 } 1780 }
1781 if ((alpn_proto = tls_conn_alpn_selected(tls_ctx)) != NULL)
1782 fprintf(stderr, "Application Layer Protocol: %s\n", alpn_proto);
1773} 1783}
1774 1784
1775void 1785void
@@ -1842,7 +1852,7 @@ help(void)
1842 \t-v Verbose\n\ 1852 \t-v Verbose\n\
1843 \t-W recvlimit Terminate after receiving a number of packets\n\ 1853 \t-W recvlimit Terminate after receiving a number of packets\n\
1844 \t-w timeout Timeout for connects and final net reads\n\ 1854 \t-w timeout Timeout for connects and final net reads\n\
1845 \t-X proto Proxy protocol: \"4\", \"5\" (SOCKS) or \"connect\"\n\ 1855 \t-X proto Proxy protocol: \"4\", \"4A\", \"5\" (SOCKS) or \"connect\"\n\
1846 \t-x addr[:port]\tSpecify proxy address and port\n\ 1856 \t-x addr[:port]\tSpecify proxy address and port\n\
1847 \t-Z Peer certificate file\n\ 1857 \t-Z Peer certificate file\n\
1848 \t-z Zero-I/O mode [used for scanning]\n\ 1858 \t-z Zero-I/O mode [used for scanning]\n\
diff --git a/src/usr.bin/nc/socks.c b/src/usr.bin/nc/socks.c
index 7c7448c9c5..1f1fb96e2a 100644
--- a/src/usr.bin/nc/socks.c
+++ b/src/usr.bin/nc/socks.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: socks.c,v 1.31 2022/06/08 20:20:26 djm Exp $ */ 1/* $OpenBSD: socks.c,v 1.34 2025/05/22 06:40:26 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1999 Niklas Hallqvist. All rights reserved. 4 * Copyright (c) 1999 Niklas Hallqvist. All rights reserved.
@@ -293,19 +293,33 @@ socks_connect(const char *host, const char *port,
293 default: 293 default:
294 errx(1, "connection failed, unsupported address type"); 294 errx(1, "connection failed, unsupported address type");
295 } 295 }
296 } else if (socksv == 4) { 296 } else if (socksv == 4 || socksv == 44) {
297 /* This will exit on lookup failure */ 297 if (socksv == 4) {
298 decode_addrport(host, port, (struct sockaddr *)&addr, 298 /* This will exit on lookup failure */
299 sizeof(addr), 1, 0); 299 decode_addrport(host, port, (struct sockaddr *)&addr,
300 sizeof(addr), 1, 0);
301 }
300 302
301 /* Version 4 */ 303 /* Version 4 */
302 buf[0] = SOCKS_V4; 304 buf[0] = SOCKS_V4;
303 buf[1] = SOCKS_CONNECT; /* connect */ 305 buf[1] = SOCKS_CONNECT; /* connect */
304 memcpy(buf + 2, &in4->sin_port, sizeof in4->sin_port); 306 memcpy(buf + 2, &in4->sin_port, sizeof in4->sin_port);
305 memcpy(buf + 4, &in4->sin_addr, sizeof in4->sin_addr); 307 if (socksv == 4) {
308 memcpy(buf + 4, &in4->sin_addr, sizeof in4->sin_addr);
309 } else {
310 /* SOCKS4A uses addr of 0.0.0.x, and hostname later */
311 buf[4] = buf[5] = buf[6] = 0;
312 buf[7] = 1;
313 }
306 buf[8] = 0; /* empty username */ 314 buf[8] = 0; /* empty username */
307 wlen = 9; 315 wlen = 9;
308 316 if (socksv == 44) {
317 /* SOCKS4A has nul-terminated hostname after user */
318 if (strlcpy(buf + 9, host,
319 sizeof(buf) - 9) >= sizeof(buf) - 9)
320 errx(1, "hostname too big");
321 wlen = 9 + strlen(host) + 1;
322 }
309 cnt = atomicio(vwrite, proxyfd, buf, wlen); 323 cnt = atomicio(vwrite, proxyfd, buf, wlen);
310 if (cnt != wlen) 324 if (cnt != wlen)
311 err(1, "write failed (%zu/%zu)", cnt, wlen); 325 err(1, "write failed (%zu/%zu)", cnt, wlen);
@@ -373,16 +387,16 @@ socks_connect(const char *host, const char *port,
373 /* Read status reply */ 387 /* Read status reply */
374 proxy_read_line(proxyfd, buf, sizeof(buf)); 388 proxy_read_line(proxyfd, buf, sizeof(buf));
375 if (proxyuser != NULL && 389 if (proxyuser != NULL &&
376 (strncmp(buf, "HTTP/1.0 407 ", 12) == 0 || 390 (strncmp(buf, "HTTP/1.0 407 ", 13) == 0 ||
377 strncmp(buf, "HTTP/1.1 407 ", 12) == 0)) { 391 strncmp(buf, "HTTP/1.1 407 ", 13) == 0)) {
378 if (authretry > 1) { 392 if (authretry > 1) {
379 fprintf(stderr, "Proxy authentication " 393 fprintf(stderr, "Proxy authentication "
380 "failed\n"); 394 "failed\n");
381 } 395 }
382 close(proxyfd); 396 close(proxyfd);
383 goto again; 397 goto again;
384 } else if (strncmp(buf, "HTTP/1.0 200 ", 12) != 0 && 398 } else if (strncmp(buf, "HTTP/1.0 200 ", 13) != 0 &&
385 strncmp(buf, "HTTP/1.1 200 ", 12) != 0) 399 strncmp(buf, "HTTP/1.1 200 ", 13) != 0)
386 errx(1, "Proxy error: \"%s\"", buf); 400 errx(1, "Proxy error: \"%s\"", buf);
387 401
388 /* Headers continue until we hit an empty line */ 402 /* Headers continue until we hit an empty line */
diff --git a/src/usr.bin/openssl/apps.c b/src/usr.bin/openssl/apps.c
index 7c98f1e70c..46197dfd49 100644
--- a/src/usr.bin/openssl/apps.c
+++ b/src/usr.bin/openssl/apps.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: apps.c,v 1.70 2025/01/03 09:14:42 tb Exp $ */ 1/* $OpenBSD: apps.c,v 1.72 2025/03/18 13:03:08 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -1377,10 +1377,10 @@ int
1377save_index(const char *file, const char *suffix, CA_DB *db) 1377save_index(const char *file, const char *suffix, CA_DB *db)
1378{ 1378{
1379 char attrpath[PATH_MAX], dbfile[PATH_MAX]; 1379 char attrpath[PATH_MAX], dbfile[PATH_MAX];
1380 BIO *out = BIO_new(BIO_s_file()); 1380 BIO *out;
1381 int j; 1381 int ret = 0;
1382 1382
1383 if (out == NULL) { 1383 if ((out = BIO_new(BIO_s_file())) == NULL) {
1384 ERR_print_errors(bio_err); 1384 ERR_print_errors(bio_err);
1385 goto err; 1385 goto err;
1386 } 1386 }
@@ -1400,27 +1400,31 @@ save_index(const char *file, const char *suffix, CA_DB *db)
1400 BIO_printf(bio_err, "unable to open '%s'\n", dbfile); 1400 BIO_printf(bio_err, "unable to open '%s'\n", dbfile);
1401 goto err; 1401 goto err;
1402 } 1402 }
1403 j = TXT_DB_write(out, db->db); 1403
1404 if (j <= 0) 1404 if (TXT_DB_write(out, db->db) <= 0)
1405 goto err; 1405 goto err;
1406 1406
1407 BIO_free(out); 1407 BIO_free(out);
1408 1408 if ((out = BIO_new(BIO_s_file())) == NULL) {
1409 out = BIO_new(BIO_s_file()); 1409 ERR_print_errors(bio_err);
1410 goto err;
1411 }
1410 1412
1411 if (BIO_write_filename(out, attrpath) <= 0) { 1413 if (BIO_write_filename(out, attrpath) <= 0) {
1412 perror(attrpath); 1414 perror(attrpath);
1413 BIO_printf(bio_err, "unable to open '%s'\n", attrpath); 1415 BIO_printf(bio_err, "unable to open '%s'\n", attrpath);
1414 goto err; 1416 goto err;
1415 } 1417 }
1416 BIO_printf(out, "unique_subject = %s\n", 1418 if (BIO_printf(out, "unique_subject = %s\n",
1417 db->attributes.unique_subject ? "yes" : "no"); 1419 db->attributes.unique_subject ? "yes" : "no") <= 0)
1418 BIO_free(out); 1420 goto err;
1419 1421
1420 return 1; 1422 ret = 1;
1421 1423
1422 err: 1424 err:
1423 return 0; 1425 BIO_free(out);
1426
1427 return ret;
1424} 1428}
1425 1429
1426int 1430int
diff --git a/src/usr.bin/openssl/ca.c b/src/usr.bin/openssl/ca.c
index d69844620d..b644b746b9 100644
--- a/src/usr.bin/openssl/ca.c
+++ b/src/usr.bin/openssl/ca.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ca.c,v 1.61 2025/02/25 09:49:33 tb Exp $ */ 1/* $OpenBSD: ca.c,v 1.62 2025/04/14 08:39:27 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -104,7 +104,6 @@
104#define ENV_POLICY "policy" 104#define ENV_POLICY "policy"
105#define ENV_EXTENSIONS "x509_extensions" 105#define ENV_EXTENSIONS "x509_extensions"
106#define ENV_CRLEXT "crl_extensions" 106#define ENV_CRLEXT "crl_extensions"
107#define ENV_MSIE_HACK "msie_hack"
108#define ENV_NAMEOPT "name_opt" 107#define ENV_NAMEOPT "name_opt"
109#define ENV_CERTOPT "cert_opt" 108#define ENV_CERTOPT "cert_opt"
110#define ENV_EXTCOPY "copy_extensions" 109#define ENV_EXTCOPY "copy_extensions"
@@ -181,7 +180,6 @@ static struct {
181 int keyform; 180 int keyform;
182 char *md; 181 char *md;
183 int multirdn; 182 int multirdn;
184 int msie_hack;
185 int notext; 183 int notext;
186 char *outdir; 184 char *outdir;
187 char *outfile; 185 char *outfile;
@@ -451,11 +449,6 @@ static const struct option ca_options[] = {
451 .opt.arg = &cfg.md, 449 .opt.arg = &cfg.md,
452 }, 450 },
453 { 451 {
454 .name = "msie_hack",
455 .type = OPTION_FLAG,
456 .opt.flag = &cfg.msie_hack,
457 },
458 {
459 .name = "multivalue-rdn", 452 .name = "multivalue-rdn",
460 .desc = "Enable support for multivalued RDNs", 453 .desc = "Enable support for multivalued RDNs",
461 .type = OPTION_FLAG, 454 .type = OPTION_FLAG,
@@ -827,11 +820,6 @@ ca_main(int argc, char **argv)
827 ERR_clear_error(); 820 ERR_clear_error();
828 if ((f != NULL) && ((*f == 'y') || (*f == 'Y'))) 821 if ((f != NULL) && ((*f == 'y') || (*f == 'Y')))
829 cfg.preserve = 1; 822 cfg.preserve = 1;
830 f = NCONF_get_string(conf, BASE_SECTION, ENV_MSIE_HACK);
831 if (f == NULL)
832 ERR_clear_error();
833 if ((f != NULL) && ((*f == 'y') || (*f == 'Y')))
834 cfg.msie_hack = 1;
835 823
836 f = NCONF_get_string(conf, cfg.section, ENV_NAMEOPT); 824 f = NCONF_get_string(conf, cfg.section, ENV_NAMEOPT);
837 825
@@ -1681,7 +1669,7 @@ do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
1681 X509_NAME_ENTRY *ne; 1669 X509_NAME_ENTRY *ne;
1682 X509_NAME_ENTRY *tne, *push; 1670 X509_NAME_ENTRY *tne, *push;
1683 EVP_PKEY *pktmp; 1671 EVP_PKEY *pktmp;
1684 int ok = -1, i, j, last, nid; 1672 int ok = -1, i, j, last;
1685 const char *p; 1673 const char *p;
1686 CONF_VALUE *cv; 1674 CONF_VALUE *cv;
1687 OPENSSL_STRING row[DB_NUMBER]; 1675 OPENSSL_STRING row[DB_NUMBER];
@@ -1723,23 +1711,6 @@ do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
1723 if (obj == NULL) 1711 if (obj == NULL)
1724 goto err; 1712 goto err;
1725 1713
1726 if (cfg.msie_hack) {
1727 /* assume all type should be strings */
1728 nid = OBJ_obj2nid(X509_NAME_ENTRY_get_object(ne));
1729 if (nid == NID_undef)
1730 goto err;
1731
1732 if (str->type == V_ASN1_UNIVERSALSTRING)
1733 ASN1_UNIVERSALSTRING_to_string(str);
1734
1735 if ((str->type == V_ASN1_IA5STRING) &&
1736 (nid != NID_pkcs9_emailAddress))
1737 str->type = V_ASN1_T61STRING;
1738
1739 if ((nid == NID_pkcs9_emailAddress) &&
1740 (str->type == V_ASN1_PRINTABLESTRING))
1741 str->type = V_ASN1_IA5STRING;
1742 }
1743 /* If no EMAIL is wanted in the subject */ 1714 /* If no EMAIL is wanted in the subject */
1744 if ((OBJ_obj2nid(obj) == NID_pkcs9_emailAddress) && (!email_dn)) 1715 if ((OBJ_obj2nid(obj) == NID_pkcs9_emailAddress) && (!email_dn))
1745 continue; 1716 continue;
diff --git a/src/usr.bin/openssl/certhash.c b/src/usr.bin/openssl/certhash.c
index 5ee29b8d01..1ee1165516 100644
--- a/src/usr.bin/openssl/certhash.c
+++ b/src/usr.bin/openssl/certhash.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: certhash.c,v 1.21 2023/03/06 14:32:05 tb Exp $ */ 1/* $OpenBSD: certhash.c,v 1.22 2025/07/27 14:46:20 joshua Exp $ */
2/* 2/*
3 * Copyright (c) 2014, 2015 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014, 2015 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -297,11 +297,10 @@ hashinfo_from_linkname(const char *linkname, const char *target)
297} 297}
298 298
299static struct hashinfo * 299static struct hashinfo *
300certhash_cert(BIO *bio, const char *filename) 300certhash_cert(BIO *bio, const char *filename, const EVP_MD *digest)
301{ 301{
302 unsigned char fingerprint[EVP_MAX_MD_SIZE]; 302 unsigned char fingerprint[EVP_MAX_MD_SIZE];
303 struct hashinfo *hi = NULL; 303 struct hashinfo *hi = NULL;
304 const EVP_MD *digest;
305 X509 *cert = NULL; 304 X509 *cert = NULL;
306 unsigned long hash; 305 unsigned long hash;
307 unsigned int len; 306 unsigned int len;
@@ -311,7 +310,6 @@ certhash_cert(BIO *bio, const char *filename)
311 310
312 hash = X509_subject_name_hash(cert); 311 hash = X509_subject_name_hash(cert);
313 312
314 digest = EVP_sha256();
315 if (X509_digest(cert, digest, fingerprint, &len) != 1) { 313 if (X509_digest(cert, digest, fingerprint, &len) != 1) {
316 fprintf(stderr, "out of memory\n"); 314 fprintf(stderr, "out of memory\n");
317 goto err; 315 goto err;
@@ -326,11 +324,10 @@ certhash_cert(BIO *bio, const char *filename)
326} 324}
327 325
328static struct hashinfo * 326static struct hashinfo *
329certhash_crl(BIO *bio, const char *filename) 327certhash_crl(BIO *bio, const char *filename, const EVP_MD *digest)
330{ 328{
331 unsigned char fingerprint[EVP_MAX_MD_SIZE]; 329 unsigned char fingerprint[EVP_MAX_MD_SIZE];
332 struct hashinfo *hi = NULL; 330 struct hashinfo *hi = NULL;
333 const EVP_MD *digest;
334 X509_CRL *crl = NULL; 331 X509_CRL *crl = NULL;
335 unsigned long hash; 332 unsigned long hash;
336 unsigned int len; 333 unsigned int len;
@@ -340,7 +337,6 @@ certhash_crl(BIO *bio, const char *filename)
340 337
341 hash = X509_NAME_hash(X509_CRL_get_issuer(crl)); 338 hash = X509_NAME_hash(X509_CRL_get_issuer(crl));
342 339
343 digest = EVP_sha256();
344 if (X509_CRL_digest(crl, digest, fingerprint, &len) != 1) { 340 if (X509_CRL_digest(crl, digest, fingerprint, &len) != 1) {
345 fprintf(stderr, "out of memory\n"); 341 fprintf(stderr, "out of memory\n");
346 goto err; 342 goto err;
@@ -509,7 +505,7 @@ certhash_link(struct dirent *dep, struct hashinfo **links)
509 505
510static int 506static int
511certhash_file(struct dirent *dep, struct hashinfo **certs, 507certhash_file(struct dirent *dep, struct hashinfo **certs,
512 struct hashinfo **crls) 508 struct hashinfo **crls, const EVP_MD *digest)
513{ 509{
514 struct hashinfo *hi = NULL; 510 struct hashinfo *hi = NULL;
515 int has_cert, has_crl; 511 int has_cert, has_crl;
@@ -529,7 +525,7 @@ certhash_file(struct dirent *dep, struct hashinfo **certs,
529 goto err; 525 goto err;
530 } 526 }
531 527
532 if ((hi = certhash_cert(bio, dep->d_name)) != NULL) { 528 if ((hi = certhash_cert(bio, dep->d_name, digest)) != NULL) {
533 has_cert = 1; 529 has_cert = 1;
534 *certs = hashinfo_chain(*certs, hi); 530 *certs = hashinfo_chain(*certs, hi);
535 } 531 }
@@ -539,7 +535,7 @@ certhash_file(struct dirent *dep, struct hashinfo **certs,
539 goto err; 535 goto err;
540 } 536 }
541 537
542 if ((hi = certhash_crl(bio, dep->d_name)) != NULL) { 538 if ((hi = certhash_crl(bio, dep->d_name, digest)) != NULL) {
543 has_crl = hi->is_crl = 1; 539 has_crl = hi->is_crl = 1;
544 *crls = hashinfo_chain(*crls, hi); 540 *crls = hashinfo_chain(*crls, hi);
545 } 541 }
@@ -557,7 +553,7 @@ certhash_file(struct dirent *dep, struct hashinfo **certs,
557} 553}
558 554
559static int 555static int
560certhash_directory(const char *path) 556certhash_directory(const char *path, const EVP_MD *digest)
561{ 557{
562 struct hashinfo *links = NULL, *certs = NULL, *crls = NULL, *link; 558 struct hashinfo *links = NULL, *certs = NULL, *crls = NULL, *link;
563 int ret = 0; 559 int ret = 0;
@@ -579,7 +575,7 @@ certhash_directory(const char *path)
579 goto err; 575 goto err;
580 } 576 }
581 if (filename_is_pem(dep->d_name)) { 577 if (filename_is_pem(dep->d_name)) {
582 if (certhash_file(dep, &certs, &crls) == -1) 578 if (certhash_file(dep, &certs, &crls, digest) == -1)
583 goto err; 579 goto err;
584 } 580 }
585 } 581 }
@@ -678,7 +674,7 @@ certhash_main(int argc, char **argv)
678 ret = 1; 674 ret = 1;
679 continue; 675 continue;
680 } 676 }
681 ret |= certhash_directory(argv[i]); 677 ret |= certhash_directory(argv[i], EVP_sha256());
682 if (fchdir(cwdfd) == -1) { 678 if (fchdir(cwdfd) == -1) {
683 perror("failed to restore current directory"); 679 perror("failed to restore current directory");
684 ret = 1; 680 ret = 1;
diff --git a/src/usr.bin/openssl/cms.c b/src/usr.bin/openssl/cms.c
index 7420d0ab8c..458ddb0e3b 100644
--- a/src/usr.bin/openssl/cms.c
+++ b/src/usr.bin/openssl/cms.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms.c,v 1.36 2024/08/12 15:34:58 job Exp $ */ 1/* $OpenBSD: cms.c,v 1.38 2025/06/07 08:24:15 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -193,15 +193,33 @@ get_cipher_by_name(char *name)
193static int 193static int
194cms_opt_cipher(int argc, char **argv, int *argsused) 194cms_opt_cipher(int argc, char **argv, int *argsused)
195{ 195{
196 const EVP_CIPHER *cipher;
196 char *name = argv[0]; 197 char *name = argv[0];
197 198
198 if (*name++ != '-') 199 if (*name++ != '-')
199 return (1); 200 return (1);
200 201
201 if ((cfg.cipher = get_cipher_by_name(name)) == NULL) 202 if ((cipher = get_cipher_by_name(name)) == NULL)
202 if ((cfg.cipher = EVP_get_cipherbyname(name)) == NULL) 203 if ((cipher = EVP_get_cipherbyname(name)) == NULL)
203 return (1); 204 return (1);
204 205
206 /*
207 * XXX - this should really be done in CMS_{encrypt,decrypt}() until
208 * we have proper support for AuthEnvelopedData (RFC 5084), but this
209 * is good enough for now to avoid outputting garbage with this rusty
210 * swiss army knife.
211 */
212 if ((EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER) != 0) {
213 BIO_printf(bio_err, "AuthEnvelopedData is not supported\n");
214 return (1);
215 }
216 if (EVP_CIPHER_mode(cipher) == EVP_CIPH_XTS_MODE) {
217 BIO_printf(bio_err, "XTS mode not supported\n");
218 return (1);
219 }
220
221 cfg.cipher = cipher;
222
205 *argsused = 1; 223 *argsused = 1;
206 return (0); 224 return (0);
207} 225}
@@ -475,7 +493,7 @@ static const struct option cms_options[] = {
475 }, 493 },
476 { 494 {
477 .name = "aes256", 495 .name = "aes256",
478 .desc = "Encrypt PEM output with CBC AES", 496 .desc = "Encrypt PEM output with CBC AES (default)",
479 .type = OPTION_ARGV_FUNC, 497 .type = OPTION_ARGV_FUNC,
480 .opt.argvfunc = cms_opt_cipher, 498 .opt.argvfunc = cms_opt_cipher,
481 }, 499 },
@@ -509,7 +527,7 @@ static const struct option cms_options[] = {
509 }, 527 },
510 { 528 {
511 .name = "des3", 529 .name = "des3",
512 .desc = "Encrypt with triple DES (default)", 530 .desc = "Encrypt with triple DES",
513 .type = OPTION_ARGV_FUNC, 531 .type = OPTION_ARGV_FUNC,
514 .opt.argvfunc = cms_opt_cipher, 532 .opt.argvfunc = cms_opt_cipher,
515 }, 533 },
@@ -1291,14 +1309,8 @@ cms_main(int argc, char **argv)
1291 } 1309 }
1292 1310
1293 if (cfg.operation == SMIME_ENCRYPT) { 1311 if (cfg.operation == SMIME_ENCRYPT) {
1294 if (cfg.cipher == NULL) { 1312 if (cfg.cipher == NULL)
1295#ifndef OPENSSL_NO_DES 1313 cfg.cipher = EVP_aes_256_cbc();
1296 cfg.cipher = EVP_des_ede3_cbc();
1297#else
1298 BIO_printf(bio_err, "No cipher selected\n");
1299 goto end;
1300#endif
1301 }
1302 if (cfg.secret_key != NULL && 1314 if (cfg.secret_key != NULL &&
1303 cfg.secret_keyid == NULL) { 1315 cfg.secret_keyid == NULL) {
1304 BIO_printf(bio_err, "No secret key id\n"); 1316 BIO_printf(bio_err, "No secret key id\n");
diff --git a/src/usr.bin/openssl/gendsa.c b/src/usr.bin/openssl/gendsa.c
index 00635c4551..69a7994da7 100644
--- a/src/usr.bin/openssl/gendsa.c
+++ b/src/usr.bin/openssl/gendsa.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: gendsa.c,v 1.17 2023/03/06 14:32:06 tb Exp $ */ 1/* $OpenBSD: gendsa.c,v 1.18 2025/06/07 08:33:58 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -80,7 +80,8 @@ static struct {
80 char *passargout; 80 char *passargout;
81} cfg; 81} cfg;
82 82
83static const EVP_CIPHER *get_cipher_by_name(char *name) 83static const EVP_CIPHER *
84get_cipher_by_name(char *name)
84{ 85{
85 if (name == NULL || strcmp(name, "") == 0) 86 if (name == NULL || strcmp(name, "") == 0)
86 return (NULL); 87 return (NULL);
diff --git a/src/usr.bin/openssl/genrsa.c b/src/usr.bin/openssl/genrsa.c
index 0b5323fa5f..647780d8fa 100644
--- a/src/usr.bin/openssl/genrsa.c
+++ b/src/usr.bin/openssl/genrsa.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: genrsa.c,v 1.22 2023/03/06 14:32:06 tb Exp $ */ 1/* $OpenBSD: genrsa.c,v 1.23 2025/06/07 08:33:58 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -108,7 +108,8 @@ set_public_exponent(int argc, char **argv, int *argsused)
108 return (0); 108 return (0);
109} 109}
110 110
111static const EVP_CIPHER *get_cipher_by_name(char *name) 111static const EVP_CIPHER *
112get_cipher_by_name(char *name)
112{ 113{
113 if (name == NULL || strcmp(name, "") == 0) 114 if (name == NULL || strcmp(name, "") == 0)
114 return (NULL); 115 return (NULL);
diff --git a/src/usr.bin/openssl/ocsp.c b/src/usr.bin/openssl/ocsp.c
index d35940a7ae..01d28aa1f0 100644
--- a/src/usr.bin/openssl/ocsp.c
+++ b/src/usr.bin/openssl/ocsp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ocsp.c,v 1.26 2024/08/31 18:39:25 tb Exp $ */ 1/* $OpenBSD: ocsp.c,v 1.27 2025/05/09 12:50:59 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -194,18 +194,18 @@ x509v3_add_value(const char *name, const char *value,
194 int ret = 0; 194 int ret = 0;
195 195
196 if ((conf_value = calloc(1, sizeof(*conf_value))) == NULL) { 196 if ((conf_value = calloc(1, sizeof(*conf_value))) == NULL) {
197 X509V3error(ERR_R_MALLOC_FAILURE); 197 perror("calloc");
198 goto err; 198 goto err;
199 } 199 }
200 if (name != NULL) { 200 if (name != NULL) {
201 if ((conf_value->name = strdup(name)) == NULL) { 201 if ((conf_value->name = strdup(name)) == NULL) {
202 X509V3error(ERR_R_MALLOC_FAILURE); 202 perror("strdup");
203 goto err; 203 goto err;
204 } 204 }
205 } 205 }
206 if (value != NULL) { 206 if (value != NULL) {
207 if ((conf_value->value = strdup(value)) == NULL) { 207 if ((conf_value->value = strdup(value)) == NULL) {
208 X509V3error(ERR_R_MALLOC_FAILURE); 208 perror("strdup");
209 goto err; 209 goto err;
210 } 210 }
211 } 211 }
@@ -213,12 +213,12 @@ x509v3_add_value(const char *name, const char *value,
213 if ((extlist = *out_extlist) == NULL) 213 if ((extlist = *out_extlist) == NULL)
214 extlist = sk_CONF_VALUE_new_null(); 214 extlist = sk_CONF_VALUE_new_null();
215 if (extlist == NULL) { 215 if (extlist == NULL) {
216 X509V3error(ERR_R_MALLOC_FAILURE); 216 perror("sk_CONF_VALUE_new_null");
217 goto err; 217 goto err;
218 } 218 }
219 219
220 if (!sk_CONF_VALUE_push(extlist, conf_value)) { 220 if (!sk_CONF_VALUE_push(extlist, conf_value)) {
221 X509V3error(ERR_R_MALLOC_FAILURE); 221 perror("sk_CONF_VALUE_push");
222 goto err; 222 goto err;
223 } 223 }
224 conf_value = NULL; 224 conf_value = NULL;
diff --git a/src/usr.bin/openssl/openssl.1 b/src/usr.bin/openssl/openssl.1
index 6ceb53ef5c..40defdc38b 100644
--- a/src/usr.bin/openssl/openssl.1
+++ b/src/usr.bin/openssl/openssl.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: openssl.1,v 1.162 2025/01/19 10:24:17 tb Exp $ 1.\" $OpenBSD: openssl.1,v 1.167 2025/06/07 08:29:20 tb Exp $
2.\" ==================================================================== 2.\" ====================================================================
3.\" Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 3.\" Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
4.\" 4.\"
@@ -110,7 +110,7 @@
110.\" copied and put under another distribution licence 110.\" copied and put under another distribution licence
111.\" [including the GNU Public Licence.] 111.\" [including the GNU Public Licence.]
112.\" 112.\"
113.Dd $Mdocdate: January 19 2025 $ 113.Dd $Mdocdate: June 7 2025 $
114.Dt OPENSSL 1 114.Dt OPENSSL 1
115.Os 115.Os
116.Sh NAME 116.Sh NAME
@@ -325,7 +325,6 @@ into a nested structure.
325.Op Fl keyfile Ar file 325.Op Fl keyfile Ar file
326.Op Fl keyform Cm pem | der 326.Op Fl keyform Cm pem | der
327.Op Fl md Ar alg 327.Op Fl md Ar alg
328.Op Fl msie_hack
329.Op Fl multivalue-rdn 328.Op Fl multivalue-rdn
330.Op Fl name Ar section 329.Op Fl name Ar section
331.Op Fl noemailDN 330.Op Fl noemailDN
@@ -422,17 +421,6 @@ Possible values include
422and 421and
423.Ar sha1 . 422.Ar sha1 .
424This option also applies to CRLs. 423This option also applies to CRLs.
425.It Fl msie_hack
426This is a legacy option to make
427.Nm ca
428work with very old versions of the IE certificate enrollment control
429.Qq certenr3 .
430It used UniversalStrings for almost everything.
431Since the old control has various security bugs,
432its use is strongly discouraged.
433The newer control
434.Qq Xenroll
435does not need this option.
436.It Fl multivalue-rdn 424.It Fl multivalue-rdn
437This option causes the 425This option causes the
438.Fl subj 426.Fl subj
@@ -629,11 +617,9 @@ specified using
629.Cm default_ca 617.Cm default_ca
630or 618or
631.Fl name . 619.Fl name .
632The options 620The
633.Cm preserve 621.Cm preserve
634and 622option is read directly from the
635.Cm msie_hack
636are read directly from the
637.Cm ca 623.Cm ca
638section. 624section.
639.Pp 625.Pp
@@ -746,9 +732,6 @@ simply set this to
746.Qq no . 732.Qq no .
747If not present, the default is to allow for the EMAIL field in the 733If not present, the default is to allow for the EMAIL field in the
748certificate's DN. 734certificate's DN.
749.It Cm msie_hack
750The same as
751.Fl msie_hack .
752.It Cm name_opt , cert_opt 735.It Cm name_opt , cert_opt
753These options allow the format used to display the certificate details 736These options allow the format used to display the certificate details
754when asking the user to confirm signing. 737when asking the user to confirm signing.
@@ -1108,7 +1091,7 @@ The encryption algorithm to use.
1108128-, 192-, or 256-bit AES, 128-, 192-, or 256-bit CAMELLIA, 1091128-, 192-, or 256-bit AES, 128-, 192-, or 256-bit CAMELLIA,
1109DES (56 bits), triple DES (168 bits), 1092DES (56 bits), triple DES (168 bits),
1110or 40-, 64-, or 128-bit RC2, respectively; 1093or 40-, 64-, or 128-bit RC2, respectively;
1111if not specified, triple DES is 1094if not specified, 256-bit AES is
1112used. 1095used.
1113Only used with 1096Only used with
1114.Fl encrypt 1097.Fl encrypt
@@ -2990,9 +2973,6 @@ command processes private keys
2990(both encrypted and unencrypted) 2973(both encrypted and unencrypted)
2991in PKCS#8 format 2974in PKCS#8 format
2992with a variety of PKCS#5 (v1.5 and v2.0) and PKCS#12 algorithms. 2975with a variety of PKCS#5 (v1.5 and v2.0) and PKCS#12 algorithms.
2993The default encryption is only 56 bits;
2994keys encrypted using PKCS#5 v2.0 algorithms and high iteration counts
2995are more secure.
2996.Pp 2976.Pp
2997The options are as follows: 2977The options are as follows:
2998.Bl -tag -width Ds 2978.Bl -tag -width Ds
@@ -3038,16 +3018,12 @@ which allow strong encryption algorithms like triple DES or 128-bit RC2.
3038.El 3018.El
3039.It Fl v2 Ar alg 3019.It Fl v2 Ar alg
3040Use PKCS#5 v2.0 algorithms. 3020Use PKCS#5 v2.0 algorithms.
3041Supports algorithms such as 168-bit triple DES or 128-bit RC2, 3021These are block ciphers used in CBC mode.
3042however not many implementations support PKCS#5 v2.0 yet 3022The default is AES-256-CBC.
3043(if using private keys with 3023With the exception of AES, the choices available in RFC 8018
3044.Nm openssl 3024are considered decrepit.
3045this doesn't matter). 3025They can be enabled with des, des3, and rc2
3046.Pp 3026(rc5 is no longer supported).
3047.Ar alg
3048is the encryption algorithm to use;
3049valid values include des, des3, and rc2.
3050It is recommended that des3 is used.
3051.El 3027.El
3052.Tg pkcs12 3028.Tg pkcs12
3053.Sh PKCS12 3029.Sh PKCS12
@@ -5122,7 +5098,7 @@ The remaining options are as follows:
5122The encryption algorithm to use. 5098The encryption algorithm to use.
5123128-, 192-, or 256-bit AES, DES (56 bits), triple DES (168 bits), 5099128-, 192-, or 256-bit AES, DES (56 bits), triple DES (168 bits),
5124or 40-, 64-, or 128-bit RC2, respectively; 5100or 40-, 64-, or 128-bit RC2, respectively;
5125if not specified, 40-bit RC2 is 5101if not specified, 256-bit AES is
5126used. 5102used.
5127Only used with 5103Only used with
5128.Fl encrypt . 5104.Fl encrypt .
@@ -6165,7 +6141,7 @@ either using a list of comma-separated options or by specifying
6165.Fl nameopt 6141.Fl nameopt
6166multiple times. 6142multiple times.
6167The default behaviour is to use the 6143The default behaviour is to use the
6168.Cm oneline 6144.Cm compat
6169format. 6145format.
6170The options, 6146The options,
6171which can be preceded by a dash to turn them off, 6147which can be preceded by a dash to turn them off,
@@ -6247,7 +6223,7 @@ A one line format which is more readable than
6247.Cm RFC2253 . 6223.Cm RFC2253 .
6248Equivalent to 6224Equivalent to
6249.Cm esc_2253 , esc_ctrl , esc_msb , utf8 , 6225.Cm esc_2253 , esc_ctrl , esc_msb , utf8 ,
6250.Cm dump_nostr , dump_der , use_quote , sep_comma_plus_spc , 6226.Cm dump_nostr , dump_der , use_quote , sep_comma_plus_space ,
6251.Cm space_eq , 6227.Cm space_eq ,
6252and 6228and
6253.Cm sname . 6229.Cm sname .
diff --git a/src/usr.bin/openssl/openssl.c b/src/usr.bin/openssl/openssl.c
index 75a0e4d266..a1ef139009 100644
--- a/src/usr.bin/openssl/openssl.c
+++ b/src/usr.bin/openssl/openssl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: openssl.c,v 1.39 2025/01/02 13:10:03 tb Exp $ */ 1/* $OpenBSD: openssl.c,v 1.40 2025/05/25 04:54:41 joshua Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -235,9 +235,6 @@ FUNCTION functions[] = {
235 { FUNC_TYPE_MD, "sm3", dgst_main }, 235 { FUNC_TYPE_MD, "sm3", dgst_main },
236 { FUNC_TYPE_MD, "sm3WithRSAEncryption", dgst_main }, 236 { FUNC_TYPE_MD, "sm3WithRSAEncryption", dgst_main },
237#endif 237#endif
238#ifndef OPENSSL_NO_WHIRLPOOL
239 { FUNC_TYPE_MD, "whirlpool", dgst_main },
240#endif
241 238
242 /* Ciphers. */ 239 /* Ciphers. */
243 { FUNC_TYPE_CIPHER, "base64", enc_main }, 240 { FUNC_TYPE_CIPHER, "base64", enc_main },
diff --git a/src/usr.bin/openssl/pkcs12.c b/src/usr.bin/openssl/pkcs12.c
index 1407a96e03..efd6d59163 100644
--- a/src/usr.bin/openssl/pkcs12.c
+++ b/src/usr.bin/openssl/pkcs12.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pkcs12.c,v 1.29 2024/12/26 14:10:48 tb Exp $ */ 1/* $OpenBSD: pkcs12.c,v 1.30 2025/06/07 08:33:58 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -152,7 +152,8 @@ pkcs12_opt_passarg(char *arg)
152 return (0); 152 return (0);
153} 153}
154 154
155static const EVP_CIPHER *get_cipher_by_name(char *name) 155static const EVP_CIPHER *
156get_cipher_by_name(char *name)
156{ 157{
157 if (name == NULL || strcmp(name, "") == 0) 158 if (name == NULL || strcmp(name, "") == 0)
158 return (NULL); 159 return (NULL);
diff --git a/src/usr.bin/openssl/pkcs8.c b/src/usr.bin/openssl/pkcs8.c
index 10fad7aed1..5d7c52f865 100644
--- a/src/usr.bin/openssl/pkcs8.c
+++ b/src/usr.bin/openssl/pkcs8.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pkcs8.c,v 1.18 2025/01/02 12:31:44 tb Exp $ */ 1/* $OpenBSD: pkcs8.c,v 1.19 2025/05/24 02:35:25 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999-2004. 3 * project 1999-2004.
4 */ 4 */
@@ -224,8 +224,8 @@ pkcs8_main(int argc, char **argv)
224 BIO_printf(bio_err, "Error getting passwords\n"); 224 BIO_printf(bio_err, "Error getting passwords\n");
225 goto end; 225 goto end;
226 } 226 }
227 if ((cfg.pbe_nid == -1) && !cfg.cipher) 227 if (cfg.pbe_nid == -1 && cfg.cipher == NULL)
228 cfg.pbe_nid = NID_pbeWithMD5AndDES_CBC; 228 cfg.cipher = EVP_aes_256_cbc();
229 229
230 if (cfg.infile) { 230 if (cfg.infile) {
231 if (!(in = BIO_new_file(cfg.infile, "rb"))) { 231 if (!(in = BIO_new_file(cfg.infile, "rb"))) {
diff --git a/src/usr.bin/openssl/smime.c b/src/usr.bin/openssl/smime.c
index 46bfa08679..f9d7049ff9 100644
--- a/src/usr.bin/openssl/smime.c
+++ b/src/usr.bin/openssl/smime.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: smime.c,v 1.20 2023/04/14 15:27:13 tb Exp $ */ 1/* $OpenBSD: smime.c,v 1.21 2025/06/07 08:28:49 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -271,7 +271,7 @@ static const struct option smime_options[] = {
271 }, 271 },
272 { 272 {
273 .name = "aes256", 273 .name = "aes256",
274 .desc = "Encrypt PEM output with CBC AES", 274 .desc = "Encrypt PEM output with CBC AES (default)",
275 .type = OPTION_ARGV_FUNC, 275 .type = OPTION_ARGV_FUNC,
276 .opt.argvfunc = smime_opt_cipher, 276 .opt.argvfunc = smime_opt_cipher,
277 }, 277 },
@@ -313,7 +313,7 @@ static const struct option smime_options[] = {
313#ifndef OPENSSL_NO_RC2 313#ifndef OPENSSL_NO_RC2
314 { 314 {
315 .name = "rc2-40", 315 .name = "rc2-40",
316 .desc = "Encrypt with RC2-40 (default)", 316 .desc = "Encrypt with RC2-40",
317 .type = OPTION_ARGV_FUNC, 317 .type = OPTION_ARGV_FUNC,
318 .opt.argvfunc = smime_opt_cipher, 318 .opt.argvfunc = smime_opt_cipher,
319 }, 319 },
@@ -825,14 +825,8 @@ smime_main(int argc, char **argv)
825 } 825 }
826 826
827 if (cfg.operation == SMIME_ENCRYPT) { 827 if (cfg.operation == SMIME_ENCRYPT) {
828 if (cfg.cipher == NULL) { 828 if (cfg.cipher == NULL)
829#ifndef OPENSSL_NO_RC2 829 cfg.cipher = EVP_aes_256_cbc();
830 cfg.cipher = EVP_rc2_40_cbc();
831#else
832 BIO_printf(bio_err, "No cipher selected\n");
833 goto end;
834#endif
835 }
836 if ((encerts = sk_X509_new_null()) == NULL) 830 if ((encerts = sk_X509_new_null()) == NULL)
837 goto end; 831 goto end;
838 while (*args != NULL) { 832 while (*args != NULL) {
diff --git a/src/usr.bin/openssl/speed.c b/src/usr.bin/openssl/speed.c
index 9d03c6516e..3e9b4faa9d 100644
--- a/src/usr.bin/openssl/speed.c
+++ b/src/usr.bin/openssl/speed.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: speed.c,v 1.41 2025/01/02 13:37:43 tb Exp $ */ 1/* $OpenBSD: speed.c,v 1.46 2025/05/25 05:05:30 joshua Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -142,9 +142,6 @@
142#ifndef OPENSSL_NO_SHA 142#ifndef OPENSSL_NO_SHA
143#include <openssl/sha.h> 143#include <openssl/sha.h>
144#endif 144#endif
145#ifndef OPENSSL_NO_WHIRLPOOL
146#include <openssl/whrlpool.h>
147#endif
148 145
149#define BUFSIZE (1024*8+64) 146#define BUFSIZE (1024*8+64)
150volatile sig_atomic_t run; 147volatile sig_atomic_t run;
@@ -152,7 +149,6 @@ volatile sig_atomic_t run;
152static int mr = 0; 149static int mr = 0;
153static int usertime = 1; 150static int usertime = 1;
154 151
155static double Time_F(int s);
156static void print_message(const char *s, long num, int length); 152static void print_message(const char *s, long num, int length);
157static void 153static void
158pkey_print_message(const char *str, const char *str2, 154pkey_print_message(const char *str, const char *str2,
@@ -160,7 +156,7 @@ pkey_print_message(const char *str, const char *str2,
160static void print_result(int alg, int run_no, int count, double time_used); 156static void print_result(int alg, int run_no, int count, double time_used);
161static int do_multi(int multi); 157static int do_multi(int multi);
162 158
163#define ALGOR_NUM 32 159#define ALGOR_NUM 31
164#define SIZE_NUM 5 160#define SIZE_NUM 5
165#define RSA_NUM 4 161#define RSA_NUM 4
166#define DSA_NUM 3 162#define DSA_NUM 3
@@ -174,7 +170,7 @@ static const char *names[ALGOR_NUM] = {
174 "rc2 cbc", "rc5-32/12 cbc", "blowfish cbc", "cast cbc", 170 "rc2 cbc", "rc5-32/12 cbc", "blowfish cbc", "cast cbc",
175 "aes-128 cbc", "aes-192 cbc", "aes-256 cbc", 171 "aes-128 cbc", "aes-192 cbc", "aes-256 cbc",
176 "camellia-128 cbc", "camellia-192 cbc", "camellia-256 cbc", 172 "camellia-128 cbc", "camellia-192 cbc", "camellia-256 cbc",
177 "evp", "sha256", "sha512", "whirlpool", 173 "evp", "sha256", "sha512",
178 "aes-128 ige", "aes-192 ige", "aes-256 ige", "ghash", 174 "aes-128 ige", "aes-192 ige", "aes-256 ige", "ghash",
179 "aes-128 gcm", "aes-256 gcm", "chacha20 poly1305", 175 "aes-128 gcm", "aes-256 gcm", "chacha20 poly1305",
180}; 176};
@@ -895,6 +891,22 @@ static const unsigned char test4096[] = {
895 0xaf, 0xf8, 0x2a, 0x91, 0x9d, 0x50, 0x44, 0x21, 0x17, 891 0xaf, 0xf8, 0x2a, 0x91, 0x9d, 0x50, 0x44, 0x21, 0x17,
896}; 892};
897 893
894static const unsigned char key16[] = {
895 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
896 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12,
897};
898static const unsigned char key24[] = {
899 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
900 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12,
901 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34,
902};
903static const unsigned char key32[] = {
904 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
905 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12,
906 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34,
907 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56,
908};
909
898static void 910static void
899sig_done(int sig) 911sig_done(int sig)
900{ 912{
@@ -904,16 +916,14 @@ sig_done(int sig)
904#define START TM_RESET 916#define START TM_RESET
905#define STOP TM_GET 917#define STOP TM_GET
906 918
907
908static double 919static double
909Time_F(int s) 920time_f(int s)
910{ 921{
911 if (usertime) 922 if (usertime)
912 return app_timer_user(s); 923 return app_timer_user(s);
913 else
914 return app_timer_real(s);
915}
916 924
925 return app_timer_real(s);
926}
917 927
918static const int KDF1_SHA1_len = 20; 928static const int KDF1_SHA1_len = 20;
919static void * 929static void *
@@ -942,28 +952,7 @@ speed_main(int argc, char **argv)
942 long rsa_count; 952 long rsa_count;
943 unsigned rsa_num; 953 unsigned rsa_num;
944 unsigned char md[EVP_MAX_MD_SIZE]; 954 unsigned char md[EVP_MAX_MD_SIZE];
945#ifndef OPENSSL_NO_MD4 955
946 unsigned char md4[MD4_DIGEST_LENGTH];
947#endif
948#ifndef OPENSSL_NO_MD5
949 unsigned char md5[MD5_DIGEST_LENGTH];
950 unsigned char hmac[MD5_DIGEST_LENGTH];
951#endif
952#ifndef OPENSSL_NO_SHA
953 unsigned char sha[SHA_DIGEST_LENGTH];
954#ifndef OPENSSL_NO_SHA256
955 unsigned char sha256[SHA256_DIGEST_LENGTH];
956#endif
957#ifndef OPENSSL_NO_SHA512
958 unsigned char sha512[SHA512_DIGEST_LENGTH];
959#endif
960#endif
961#ifndef OPENSSL_NO_WHIRLPOOL
962 unsigned char whirlpool[WHIRLPOOL_DIGEST_LENGTH];
963#endif
964#ifndef OPENSSL_NO_RIPEMD
965 unsigned char rmd160[RIPEMD160_DIGEST_LENGTH];
966#endif
967#ifndef OPENSSL_NO_RC4 956#ifndef OPENSSL_NO_RC4
968 RC4_KEY rc4_ks; 957 RC4_KEY rc4_ks;
969#endif 958#endif
@@ -979,38 +968,8 @@ speed_main(int argc, char **argv)
979#ifndef OPENSSL_NO_CAST 968#ifndef OPENSSL_NO_CAST
980 CAST_KEY cast_ks; 969 CAST_KEY cast_ks;
981#endif 970#endif
982 static const unsigned char key16[16] =
983 {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
984 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12};
985#ifndef OPENSSL_NO_AES
986 static const unsigned char key24[24] =
987 {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
988 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12,
989 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34};
990 static const unsigned char key32[32] =
991 {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
992 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12,
993 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34,
994 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56};
995#endif
996#ifndef OPENSSL_NO_CAMELLIA
997 static const unsigned char ckey24[24] =
998 {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
999 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12,
1000 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34};
1001 static const unsigned char ckey32[32] =
1002 {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
1003 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12,
1004 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34,
1005 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56};
1006#endif
1007#ifndef OPENSSL_NO_AES
1008#define MAX_BLOCK_SIZE 128
1009#else
1010#define MAX_BLOCK_SIZE 64
1011#endif
1012 unsigned char DES_iv[8]; 971 unsigned char DES_iv[8];
1013 unsigned char iv[2 * MAX_BLOCK_SIZE / 8]; 972 unsigned char iv[2 * 16];
1014#ifndef OPENSSL_NO_DES 973#ifndef OPENSSL_NO_DES
1015 static DES_cblock key = {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0}; 974 static DES_cblock key = {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0};
1016 static DES_cblock key2 = {0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12}; 975 static DES_cblock key2 = {0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12};
@@ -1049,14 +1008,13 @@ speed_main(int argc, char **argv)
1049#define D_EVP 21 1008#define D_EVP 21
1050#define D_SHA256 22 1009#define D_SHA256 22
1051#define D_SHA512 23 1010#define D_SHA512 23
1052#define D_WHIRLPOOL 24 1011#define D_IGE_128_AES 24
1053#define D_IGE_128_AES 25 1012#define D_IGE_192_AES 25
1054#define D_IGE_192_AES 26 1013#define D_IGE_256_AES 26
1055#define D_IGE_256_AES 27 1014#define D_GHASH 27
1056#define D_GHASH 28 1015#define D_AES_128_GCM 28
1057#define D_AES_128_GCM 29 1016#define D_AES_256_GCM 29
1058#define D_AES_256_GCM 30 1017#define D_CHACHA20_POLY1305 30
1059#define D_CHACHA20_POLY1305 31
1060 double d = 0.0; 1018 double d = 0.0;
1061 long c[ALGOR_NUM][SIZE_NUM]; 1019 long c[ALGOR_NUM][SIZE_NUM];
1062#define R_DSA_512 0 1020#define R_DSA_512 0
@@ -1275,11 +1233,6 @@ speed_main(int argc, char **argv)
1275 else 1233 else
1276#endif 1234#endif
1277#endif 1235#endif
1278#ifndef OPENSSL_NO_WHIRLPOOL
1279 if (strcmp(*argv, "whirlpool") == 0)
1280 doit[D_WHIRLPOOL] = 1;
1281 else
1282#endif
1283#ifndef OPENSSL_NO_RIPEMD 1236#ifndef OPENSSL_NO_RIPEMD
1284 if (strcmp(*argv, "ripemd") == 0) 1237 if (strcmp(*argv, "ripemd") == 0)
1285 doit[D_RMD160] = 1; 1238 doit[D_RMD160] = 1;
@@ -1462,16 +1415,12 @@ speed_main(int argc, char **argv)
1462#ifndef OPENSSL_NO_SHA512 1415#ifndef OPENSSL_NO_SHA512
1463 BIO_printf(bio_err, "sha512 "); 1416 BIO_printf(bio_err, "sha512 ");
1464#endif 1417#endif
1465#ifndef OPENSSL_NO_WHIRLPOOL
1466 BIO_printf(bio_err, "whirlpool");
1467#endif
1468#ifndef OPENSSL_NO_RIPEMD160 1418#ifndef OPENSSL_NO_RIPEMD160
1469 BIO_printf(bio_err, "rmd160"); 1419 BIO_printf(bio_err, "rmd160");
1470#endif 1420#endif
1471#if !defined(OPENSSL_NO_MD2) || \ 1421#if !defined(OPENSSL_NO_MD2) || \
1472 !defined(OPENSSL_NO_MD4) || !defined(OPENSSL_NO_MD5) || \ 1422 !defined(OPENSSL_NO_MD4) || !defined(OPENSSL_NO_MD5) || \
1473 !defined(OPENSSL_NO_SHA1) || !defined(OPENSSL_NO_RIPEMD160) || \ 1423 !defined(OPENSSL_NO_SHA1) || !defined(OPENSSL_NO_RIPEMD160)
1474 !defined(OPENSSL_NO_WHIRLPOOL)
1475 BIO_printf(bio_err, "\n"); 1424 BIO_printf(bio_err, "\n");
1476#endif 1425#endif
1477 1426
@@ -1602,8 +1551,8 @@ speed_main(int argc, char **argv)
1602#endif 1551#endif
1603#ifndef OPENSSL_NO_CAMELLIA 1552#ifndef OPENSSL_NO_CAMELLIA
1604 Camellia_set_key(key16, 128, &camellia_ks1); 1553 Camellia_set_key(key16, 128, &camellia_ks1);
1605 Camellia_set_key(ckey24, 192, &camellia_ks2); 1554 Camellia_set_key(key24, 192, &camellia_ks2);
1606 Camellia_set_key(ckey32, 256, &camellia_ks3); 1555 Camellia_set_key(key32, 256, &camellia_ks3);
1607#endif 1556#endif
1608#ifndef OPENSSL_NO_IDEA 1557#ifndef OPENSSL_NO_IDEA
1609 idea_set_encrypt_key(key16, &idea_ks); 1558 idea_set_encrypt_key(key16, &idea_ks);
@@ -1634,10 +1583,10 @@ speed_main(int argc, char **argv)
1634 if (doit[D_MD4]) { 1583 if (doit[D_MD4]) {
1635 for (j = 0; j < SIZE_NUM; j++) { 1584 for (j = 0; j < SIZE_NUM; j++) {
1636 print_message(names[D_MD4], c[D_MD4][j], lengths[j]); 1585 print_message(names[D_MD4], c[D_MD4][j], lengths[j]);
1637 Time_F(START); 1586 time_f(START);
1638 for (count = 0, run = 1; COND(c[D_MD4][j]); count++) 1587 for (count = 0, run = 1; COND(c[D_MD4][j]); count++)
1639 EVP_Digest(&(buf[0]), (unsigned long) lengths[j], &(md4[0]), NULL, EVP_md4(), NULL); 1588 EVP_Digest(&(buf[0]), (unsigned long) lengths[j], md, NULL, EVP_md4(), NULL);
1640 d = Time_F(STOP); 1589 d = time_f(STOP);
1641 print_result(D_MD4, j, count, d); 1590 print_result(D_MD4, j, count, d);
1642 } 1591 }
1643 } 1592 }
@@ -1647,10 +1596,10 @@ speed_main(int argc, char **argv)
1647 if (doit[D_MD5]) { 1596 if (doit[D_MD5]) {
1648 for (j = 0; j < SIZE_NUM; j++) { 1597 for (j = 0; j < SIZE_NUM; j++) {
1649 print_message(names[D_MD5], c[D_MD5][j], lengths[j]); 1598 print_message(names[D_MD5], c[D_MD5][j], lengths[j]);
1650 Time_F(START); 1599 time_f(START);
1651 for (count = 0, run = 1; COND(c[D_MD5][j]); count++) 1600 for (count = 0, run = 1; COND(c[D_MD5][j]); count++)
1652 EVP_Digest(&(buf[0]), (unsigned long) lengths[j], &(md5[0]), NULL, EVP_get_digestbyname("md5"), NULL); 1601 EVP_Digest(&(buf[0]), (unsigned long) lengths[j], md, NULL, EVP_get_digestbyname("md5"), NULL);
1653 d = Time_F(STOP); 1602 d = time_f(STOP);
1654 print_result(D_MD5, j, count, d); 1603 print_result(D_MD5, j, count, d);
1655 } 1604 }
1656 } 1605 }
@@ -1670,7 +1619,7 @@ speed_main(int argc, char **argv)
1670 1619
1671 for (j = 0; j < SIZE_NUM; j++) { 1620 for (j = 0; j < SIZE_NUM; j++) {
1672 print_message(names[D_HMAC], c[D_HMAC][j], lengths[j]); 1621 print_message(names[D_HMAC], c[D_HMAC][j], lengths[j]);
1673 Time_F(START); 1622 time_f(START);
1674 for (count = 0, run = 1; COND(c[D_HMAC][j]); count++) { 1623 for (count = 0, run = 1; COND(c[D_HMAC][j]); count++) {
1675 if (!HMAC_Init_ex(hctx, NULL, 0, NULL, NULL)) { 1624 if (!HMAC_Init_ex(hctx, NULL, 0, NULL, NULL)) {
1676 HMAC_CTX_free(hctx); 1625 HMAC_CTX_free(hctx);
@@ -1680,12 +1629,12 @@ speed_main(int argc, char **argv)
1680 HMAC_CTX_free(hctx); 1629 HMAC_CTX_free(hctx);
1681 goto end; 1630 goto end;
1682 } 1631 }
1683 if (!HMAC_Final(hctx, &(hmac[0]), NULL)) { 1632 if (!HMAC_Final(hctx, md, NULL)) {
1684 HMAC_CTX_free(hctx); 1633 HMAC_CTX_free(hctx);
1685 goto end; 1634 goto end;
1686 } 1635 }
1687 } 1636 }
1688 d = Time_F(STOP); 1637 d = time_f(STOP);
1689 print_result(D_HMAC, j, count, d); 1638 print_result(D_HMAC, j, count, d);
1690 } 1639 }
1691 HMAC_CTX_free(hctx); 1640 HMAC_CTX_free(hctx);
@@ -1695,10 +1644,10 @@ speed_main(int argc, char **argv)
1695 if (doit[D_SHA1]) { 1644 if (doit[D_SHA1]) {
1696 for (j = 0; j < SIZE_NUM; j++) { 1645 for (j = 0; j < SIZE_NUM; j++) {
1697 print_message(names[D_SHA1], c[D_SHA1][j], lengths[j]); 1646 print_message(names[D_SHA1], c[D_SHA1][j], lengths[j]);
1698 Time_F(START); 1647 time_f(START);
1699 for (count = 0, run = 1; COND(c[D_SHA1][j]); count++) 1648 for (count = 0, run = 1; COND(c[D_SHA1][j]); count++)
1700 EVP_Digest(buf, (unsigned long) lengths[j], &(sha[0]), NULL, EVP_sha1(), NULL); 1649 EVP_Digest(buf, (unsigned long) lengths[j], md, NULL, EVP_sha1(), NULL);
1701 d = Time_F(STOP); 1650 d = time_f(STOP);
1702 print_result(D_SHA1, j, count, d); 1651 print_result(D_SHA1, j, count, d);
1703 } 1652 }
1704 } 1653 }
@@ -1706,10 +1655,10 @@ speed_main(int argc, char **argv)
1706 if (doit[D_SHA256]) { 1655 if (doit[D_SHA256]) {
1707 for (j = 0; j < SIZE_NUM; j++) { 1656 for (j = 0; j < SIZE_NUM; j++) {
1708 print_message(names[D_SHA256], c[D_SHA256][j], lengths[j]); 1657 print_message(names[D_SHA256], c[D_SHA256][j], lengths[j]);
1709 Time_F(START); 1658 time_f(START);
1710 for (count = 0, run = 1; COND(c[D_SHA256][j]); count++) 1659 for (count = 0, run = 1; COND(c[D_SHA256][j]); count++)
1711 SHA256(buf, lengths[j], sha256); 1660 SHA256(buf, lengths[j], md);
1712 d = Time_F(STOP); 1661 d = time_f(STOP);
1713 print_result(D_SHA256, j, count, d); 1662 print_result(D_SHA256, j, count, d);
1714 } 1663 }
1715 } 1664 }
@@ -1719,37 +1668,24 @@ speed_main(int argc, char **argv)
1719 if (doit[D_SHA512]) { 1668 if (doit[D_SHA512]) {
1720 for (j = 0; j < SIZE_NUM; j++) { 1669 for (j = 0; j < SIZE_NUM; j++) {
1721 print_message(names[D_SHA512], c[D_SHA512][j], lengths[j]); 1670 print_message(names[D_SHA512], c[D_SHA512][j], lengths[j]);
1722 Time_F(START); 1671 time_f(START);
1723 for (count = 0, run = 1; COND(c[D_SHA512][j]); count++) 1672 for (count = 0, run = 1; COND(c[D_SHA512][j]); count++)
1724 SHA512(buf, lengths[j], sha512); 1673 SHA512(buf, lengths[j], md);
1725 d = Time_F(STOP); 1674 d = time_f(STOP);
1726 print_result(D_SHA512, j, count, d); 1675 print_result(D_SHA512, j, count, d);
1727 } 1676 }
1728 } 1677 }
1729#endif 1678#endif
1730#endif 1679#endif
1731 1680
1732#ifndef OPENSSL_NO_WHIRLPOOL
1733 if (doit[D_WHIRLPOOL]) {
1734 for (j = 0; j < SIZE_NUM; j++) {
1735 print_message(names[D_WHIRLPOOL], c[D_WHIRLPOOL][j], lengths[j]);
1736 Time_F(START);
1737 for (count = 0, run = 1; COND(c[D_WHIRLPOOL][j]); count++)
1738 WHIRLPOOL(buf, lengths[j], whirlpool);
1739 d = Time_F(STOP);
1740 print_result(D_WHIRLPOOL, j, count, d);
1741 }
1742 }
1743#endif
1744
1745#ifndef OPENSSL_NO_RIPEMD 1681#ifndef OPENSSL_NO_RIPEMD
1746 if (doit[D_RMD160]) { 1682 if (doit[D_RMD160]) {
1747 for (j = 0; j < SIZE_NUM; j++) { 1683 for (j = 0; j < SIZE_NUM; j++) {
1748 print_message(names[D_RMD160], c[D_RMD160][j], lengths[j]); 1684 print_message(names[D_RMD160], c[D_RMD160][j], lengths[j]);
1749 Time_F(START); 1685 time_f(START);
1750 for (count = 0, run = 1; COND(c[D_RMD160][j]); count++) 1686 for (count = 0, run = 1; COND(c[D_RMD160][j]); count++)
1751 EVP_Digest(buf, (unsigned long) lengths[j], &(rmd160[0]), NULL, EVP_ripemd160(), NULL); 1687 EVP_Digest(buf, (unsigned long) lengths[j], md, NULL, EVP_ripemd160(), NULL);
1752 d = Time_F(STOP); 1688 d = time_f(STOP);
1753 print_result(D_RMD160, j, count, d); 1689 print_result(D_RMD160, j, count, d);
1754 } 1690 }
1755 } 1691 }
@@ -1758,11 +1694,11 @@ speed_main(int argc, char **argv)
1758 if (doit[D_RC4]) { 1694 if (doit[D_RC4]) {
1759 for (j = 0; j < SIZE_NUM; j++) { 1695 for (j = 0; j < SIZE_NUM; j++) {
1760 print_message(names[D_RC4], c[D_RC4][j], lengths[j]); 1696 print_message(names[D_RC4], c[D_RC4][j], lengths[j]);
1761 Time_F(START); 1697 time_f(START);
1762 for (count = 0, run = 1; COND(c[D_RC4][j]); count++) 1698 for (count = 0, run = 1; COND(c[D_RC4][j]); count++)
1763 RC4(&rc4_ks, (unsigned int) lengths[j], 1699 RC4(&rc4_ks, (unsigned int) lengths[j],
1764 buf, buf); 1700 buf, buf);
1765 d = Time_F(STOP); 1701 d = time_f(STOP);
1766 print_result(D_RC4, j, count, d); 1702 print_result(D_RC4, j, count, d);
1767 } 1703 }
1768 } 1704 }
@@ -1771,23 +1707,23 @@ speed_main(int argc, char **argv)
1771 if (doit[D_CBC_DES]) { 1707 if (doit[D_CBC_DES]) {
1772 for (j = 0; j < SIZE_NUM; j++) { 1708 for (j = 0; j < SIZE_NUM; j++) {
1773 print_message(names[D_CBC_DES], c[D_CBC_DES][j], lengths[j]); 1709 print_message(names[D_CBC_DES], c[D_CBC_DES][j], lengths[j]);
1774 Time_F(START); 1710 time_f(START);
1775 for (count = 0, run = 1; COND(c[D_CBC_DES][j]); count++) 1711 for (count = 0, run = 1; COND(c[D_CBC_DES][j]); count++)
1776 DES_ncbc_encrypt(buf, buf, lengths[j], &sch, 1712 DES_ncbc_encrypt(buf, buf, lengths[j], &sch,
1777 &DES_iv, DES_ENCRYPT); 1713 &DES_iv, DES_ENCRYPT);
1778 d = Time_F(STOP); 1714 d = time_f(STOP);
1779 print_result(D_CBC_DES, j, count, d); 1715 print_result(D_CBC_DES, j, count, d);
1780 } 1716 }
1781 } 1717 }
1782 if (doit[D_EDE3_DES]) { 1718 if (doit[D_EDE3_DES]) {
1783 for (j = 0; j < SIZE_NUM; j++) { 1719 for (j = 0; j < SIZE_NUM; j++) {
1784 print_message(names[D_EDE3_DES], c[D_EDE3_DES][j], lengths[j]); 1720 print_message(names[D_EDE3_DES], c[D_EDE3_DES][j], lengths[j]);
1785 Time_F(START); 1721 time_f(START);
1786 for (count = 0, run = 1; COND(c[D_EDE3_DES][j]); count++) 1722 for (count = 0, run = 1; COND(c[D_EDE3_DES][j]); count++)
1787 DES_ede3_cbc_encrypt(buf, buf, lengths[j], 1723 DES_ede3_cbc_encrypt(buf, buf, lengths[j],
1788 &sch, &sch2, &sch3, 1724 &sch, &sch2, &sch3,
1789 &DES_iv, DES_ENCRYPT); 1725 &DES_iv, DES_ENCRYPT);
1790 d = Time_F(STOP); 1726 d = time_f(STOP);
1791 print_result(D_EDE3_DES, j, count, d); 1727 print_result(D_EDE3_DES, j, count, d);
1792 } 1728 }
1793 } 1729 }
@@ -1796,72 +1732,72 @@ speed_main(int argc, char **argv)
1796 if (doit[D_CBC_128_AES]) { 1732 if (doit[D_CBC_128_AES]) {
1797 for (j = 0; j < SIZE_NUM; j++) { 1733 for (j = 0; j < SIZE_NUM; j++) {
1798 print_message(names[D_CBC_128_AES], c[D_CBC_128_AES][j], lengths[j]); 1734 print_message(names[D_CBC_128_AES], c[D_CBC_128_AES][j], lengths[j]);
1799 Time_F(START); 1735 time_f(START);
1800 for (count = 0, run = 1; COND(c[D_CBC_128_AES][j]); count++) 1736 for (count = 0, run = 1; COND(c[D_CBC_128_AES][j]); count++)
1801 AES_cbc_encrypt(buf, buf, 1737 AES_cbc_encrypt(buf, buf,
1802 (unsigned long) lengths[j], &aes_ks1, 1738 (unsigned long) lengths[j], &aes_ks1,
1803 iv, AES_ENCRYPT); 1739 iv, AES_ENCRYPT);
1804 d = Time_F(STOP); 1740 d = time_f(STOP);
1805 print_result(D_CBC_128_AES, j, count, d); 1741 print_result(D_CBC_128_AES, j, count, d);
1806 } 1742 }
1807 } 1743 }
1808 if (doit[D_CBC_192_AES]) { 1744 if (doit[D_CBC_192_AES]) {
1809 for (j = 0; j < SIZE_NUM; j++) { 1745 for (j = 0; j < SIZE_NUM; j++) {
1810 print_message(names[D_CBC_192_AES], c[D_CBC_192_AES][j], lengths[j]); 1746 print_message(names[D_CBC_192_AES], c[D_CBC_192_AES][j], lengths[j]);
1811 Time_F(START); 1747 time_f(START);
1812 for (count = 0, run = 1; COND(c[D_CBC_192_AES][j]); count++) 1748 for (count = 0, run = 1; COND(c[D_CBC_192_AES][j]); count++)
1813 AES_cbc_encrypt(buf, buf, 1749 AES_cbc_encrypt(buf, buf,
1814 (unsigned long) lengths[j], &aes_ks2, 1750 (unsigned long) lengths[j], &aes_ks2,
1815 iv, AES_ENCRYPT); 1751 iv, AES_ENCRYPT);
1816 d = Time_F(STOP); 1752 d = time_f(STOP);
1817 print_result(D_CBC_192_AES, j, count, d); 1753 print_result(D_CBC_192_AES, j, count, d);
1818 } 1754 }
1819 } 1755 }
1820 if (doit[D_CBC_256_AES]) { 1756 if (doit[D_CBC_256_AES]) {
1821 for (j = 0; j < SIZE_NUM; j++) { 1757 for (j = 0; j < SIZE_NUM; j++) {
1822 print_message(names[D_CBC_256_AES], c[D_CBC_256_AES][j], lengths[j]); 1758 print_message(names[D_CBC_256_AES], c[D_CBC_256_AES][j], lengths[j]);
1823 Time_F(START); 1759 time_f(START);
1824 for (count = 0, run = 1; COND(c[D_CBC_256_AES][j]); count++) 1760 for (count = 0, run = 1; COND(c[D_CBC_256_AES][j]); count++)
1825 AES_cbc_encrypt(buf, buf, 1761 AES_cbc_encrypt(buf, buf,
1826 (unsigned long) lengths[j], &aes_ks3, 1762 (unsigned long) lengths[j], &aes_ks3,
1827 iv, AES_ENCRYPT); 1763 iv, AES_ENCRYPT);
1828 d = Time_F(STOP); 1764 d = time_f(STOP);
1829 print_result(D_CBC_256_AES, j, count, d); 1765 print_result(D_CBC_256_AES, j, count, d);
1830 } 1766 }
1831 } 1767 }
1832 if (doit[D_IGE_128_AES]) { 1768 if (doit[D_IGE_128_AES]) {
1833 for (j = 0; j < SIZE_NUM; j++) { 1769 for (j = 0; j < SIZE_NUM; j++) {
1834 print_message(names[D_IGE_128_AES], c[D_IGE_128_AES][j], lengths[j]); 1770 print_message(names[D_IGE_128_AES], c[D_IGE_128_AES][j], lengths[j]);
1835 Time_F(START); 1771 time_f(START);
1836 for (count = 0, run = 1; COND(c[D_IGE_128_AES][j]); count++) 1772 for (count = 0, run = 1; COND(c[D_IGE_128_AES][j]); count++)
1837 AES_ige_encrypt(buf, buf2, 1773 AES_ige_encrypt(buf, buf2,
1838 (unsigned long) lengths[j], &aes_ks1, 1774 (unsigned long) lengths[j], &aes_ks1,
1839 iv, AES_ENCRYPT); 1775 iv, AES_ENCRYPT);
1840 d = Time_F(STOP); 1776 d = time_f(STOP);
1841 print_result(D_IGE_128_AES, j, count, d); 1777 print_result(D_IGE_128_AES, j, count, d);
1842 } 1778 }
1843 } 1779 }
1844 if (doit[D_IGE_192_AES]) { 1780 if (doit[D_IGE_192_AES]) {
1845 for (j = 0; j < SIZE_NUM; j++) { 1781 for (j = 0; j < SIZE_NUM; j++) {
1846 print_message(names[D_IGE_192_AES], c[D_IGE_192_AES][j], lengths[j]); 1782 print_message(names[D_IGE_192_AES], c[D_IGE_192_AES][j], lengths[j]);
1847 Time_F(START); 1783 time_f(START);
1848 for (count = 0, run = 1; COND(c[D_IGE_192_AES][j]); count++) 1784 for (count = 0, run = 1; COND(c[D_IGE_192_AES][j]); count++)
1849 AES_ige_encrypt(buf, buf2, 1785 AES_ige_encrypt(buf, buf2,
1850 (unsigned long) lengths[j], &aes_ks2, 1786 (unsigned long) lengths[j], &aes_ks2,
1851 iv, AES_ENCRYPT); 1787 iv, AES_ENCRYPT);
1852 d = Time_F(STOP); 1788 d = time_f(STOP);
1853 print_result(D_IGE_192_AES, j, count, d); 1789 print_result(D_IGE_192_AES, j, count, d);
1854 } 1790 }
1855 } 1791 }
1856 if (doit[D_IGE_256_AES]) { 1792 if (doit[D_IGE_256_AES]) {
1857 for (j = 0; j < SIZE_NUM; j++) { 1793 for (j = 0; j < SIZE_NUM; j++) {
1858 print_message(names[D_IGE_256_AES], c[D_IGE_256_AES][j], lengths[j]); 1794 print_message(names[D_IGE_256_AES], c[D_IGE_256_AES][j], lengths[j]);
1859 Time_F(START); 1795 time_f(START);
1860 for (count = 0, run = 1; COND(c[D_IGE_256_AES][j]); count++) 1796 for (count = 0, run = 1; COND(c[D_IGE_256_AES][j]); count++)
1861 AES_ige_encrypt(buf, buf2, 1797 AES_ige_encrypt(buf, buf2,
1862 (unsigned long) lengths[j], &aes_ks3, 1798 (unsigned long) lengths[j], &aes_ks3,
1863 iv, AES_ENCRYPT); 1799 iv, AES_ENCRYPT);
1864 d = Time_F(STOP); 1800 d = time_f(STOP);
1865 print_result(D_IGE_256_AES, j, count, d); 1801 print_result(D_IGE_256_AES, j, count, d);
1866 } 1802 }
1867 } 1803 }
@@ -1871,10 +1807,10 @@ speed_main(int argc, char **argv)
1871 1807
1872 for (j = 0; j < SIZE_NUM; j++) { 1808 for (j = 0; j < SIZE_NUM; j++) {
1873 print_message(names[D_GHASH], c[D_GHASH][j], lengths[j]); 1809 print_message(names[D_GHASH], c[D_GHASH][j], lengths[j]);
1874 Time_F(START); 1810 time_f(START);
1875 for (count = 0, run = 1; COND(c[D_GHASH][j]); count++) 1811 for (count = 0, run = 1; COND(c[D_GHASH][j]); count++)
1876 CRYPTO_gcm128_aad(ctx, buf, lengths[j]); 1812 CRYPTO_gcm128_aad(ctx, buf, lengths[j]);
1877 d = Time_F(STOP); 1813 d = time_f(STOP);
1878 print_result(D_GHASH, j, count, d); 1814 print_result(D_GHASH, j, count, d);
1879 } 1815 }
1880 CRYPTO_gcm128_release(ctx); 1816 CRYPTO_gcm128_release(ctx);
@@ -1897,11 +1833,11 @@ speed_main(int argc, char **argv)
1897 1833
1898 for (j = 0; j < SIZE_NUM; j++) { 1834 for (j = 0; j < SIZE_NUM; j++) {
1899 print_message(names[D_AES_128_GCM],c[D_AES_128_GCM][j],lengths[j]); 1835 print_message(names[D_AES_128_GCM],c[D_AES_128_GCM][j],lengths[j]);
1900 Time_F(START); 1836 time_f(START);
1901 for (count = 0, run = 1; COND(c[D_AES_128_GCM][j]); count++) 1837 for (count = 0, run = 1; COND(c[D_AES_128_GCM][j]); count++)
1902 EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce, 1838 EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce,
1903 nonce_len, buf, lengths[j], NULL, 0); 1839 nonce_len, buf, lengths[j], NULL, 0);
1904 d=Time_F(STOP); 1840 d = time_f(STOP);
1905 print_result(D_AES_128_GCM,j,count,d); 1841 print_result(D_AES_128_GCM,j,count,d);
1906 } 1842 }
1907 EVP_AEAD_CTX_free(ctx); 1843 EVP_AEAD_CTX_free(ctx);
@@ -1925,11 +1861,11 @@ speed_main(int argc, char **argv)
1925 1861
1926 for (j = 0; j < SIZE_NUM; j++) { 1862 for (j = 0; j < SIZE_NUM; j++) {
1927 print_message(names[D_AES_256_GCM],c[D_AES_256_GCM][j],lengths[j]); 1863 print_message(names[D_AES_256_GCM],c[D_AES_256_GCM][j],lengths[j]);
1928 Time_F(START); 1864 time_f(START);
1929 for (count = 0, run = 1; COND(c[D_AES_256_GCM][j]); count++) 1865 for (count = 0, run = 1; COND(c[D_AES_256_GCM][j]); count++)
1930 EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce, 1866 EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce,
1931 nonce_len, buf, lengths[j], NULL, 0); 1867 nonce_len, buf, lengths[j], NULL, 0);
1932 d=Time_F(STOP); 1868 d = time_f(STOP);
1933 print_result(D_AES_256_GCM, j, count, d); 1869 print_result(D_AES_256_GCM, j, count, d);
1934 } 1870 }
1935 EVP_AEAD_CTX_free(ctx); 1871 EVP_AEAD_CTX_free(ctx);
@@ -1955,11 +1891,11 @@ speed_main(int argc, char **argv)
1955 for (j = 0; j < SIZE_NUM; j++) { 1891 for (j = 0; j < SIZE_NUM; j++) {
1956 print_message(names[D_CHACHA20_POLY1305], 1892 print_message(names[D_CHACHA20_POLY1305],
1957 c[D_CHACHA20_POLY1305][j], lengths[j]); 1893 c[D_CHACHA20_POLY1305][j], lengths[j]);
1958 Time_F(START); 1894 time_f(START);
1959 for (count = 0, run = 1; COND(c[D_CHACHA20_POLY1305][j]); count++) 1895 for (count = 0, run = 1; COND(c[D_CHACHA20_POLY1305][j]); count++)
1960 EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce, 1896 EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce,
1961 nonce_len, buf, lengths[j], NULL, 0); 1897 nonce_len, buf, lengths[j], NULL, 0);
1962 d=Time_F(STOP); 1898 d = time_f(STOP);
1963 print_result(D_CHACHA20_POLY1305, j, count, d); 1899 print_result(D_CHACHA20_POLY1305, j, count, d);
1964 } 1900 }
1965 EVP_AEAD_CTX_free(ctx); 1901 EVP_AEAD_CTX_free(ctx);
@@ -1969,36 +1905,36 @@ speed_main(int argc, char **argv)
1969 if (doit[D_CBC_128_CML]) { 1905 if (doit[D_CBC_128_CML]) {
1970 for (j = 0; j < SIZE_NUM; j++) { 1906 for (j = 0; j < SIZE_NUM; j++) {
1971 print_message(names[D_CBC_128_CML], c[D_CBC_128_CML][j], lengths[j]); 1907 print_message(names[D_CBC_128_CML], c[D_CBC_128_CML][j], lengths[j]);
1972 Time_F(START); 1908 time_f(START);
1973 for (count = 0, run = 1; COND(c[D_CBC_128_CML][j]); count++) 1909 for (count = 0, run = 1; COND(c[D_CBC_128_CML][j]); count++)
1974 Camellia_cbc_encrypt(buf, buf, 1910 Camellia_cbc_encrypt(buf, buf,
1975 (unsigned long) lengths[j], &camellia_ks1, 1911 (unsigned long) lengths[j], &camellia_ks1,
1976 iv, CAMELLIA_ENCRYPT); 1912 iv, CAMELLIA_ENCRYPT);
1977 d = Time_F(STOP); 1913 d = time_f(STOP);
1978 print_result(D_CBC_128_CML, j, count, d); 1914 print_result(D_CBC_128_CML, j, count, d);
1979 } 1915 }
1980 } 1916 }
1981 if (doit[D_CBC_192_CML]) { 1917 if (doit[D_CBC_192_CML]) {
1982 for (j = 0; j < SIZE_NUM; j++) { 1918 for (j = 0; j < SIZE_NUM; j++) {
1983 print_message(names[D_CBC_192_CML], c[D_CBC_192_CML][j], lengths[j]); 1919 print_message(names[D_CBC_192_CML], c[D_CBC_192_CML][j], lengths[j]);
1984 Time_F(START); 1920 time_f(START);
1985 for (count = 0, run = 1; COND(c[D_CBC_192_CML][j]); count++) 1921 for (count = 0, run = 1; COND(c[D_CBC_192_CML][j]); count++)
1986 Camellia_cbc_encrypt(buf, buf, 1922 Camellia_cbc_encrypt(buf, buf,
1987 (unsigned long) lengths[j], &camellia_ks2, 1923 (unsigned long) lengths[j], &camellia_ks2,
1988 iv, CAMELLIA_ENCRYPT); 1924 iv, CAMELLIA_ENCRYPT);
1989 d = Time_F(STOP); 1925 d = time_f(STOP);
1990 print_result(D_CBC_192_CML, j, count, d); 1926 print_result(D_CBC_192_CML, j, count, d);
1991 } 1927 }
1992 } 1928 }
1993 if (doit[D_CBC_256_CML]) { 1929 if (doit[D_CBC_256_CML]) {
1994 for (j = 0; j < SIZE_NUM; j++) { 1930 for (j = 0; j < SIZE_NUM; j++) {
1995 print_message(names[D_CBC_256_CML], c[D_CBC_256_CML][j], lengths[j]); 1931 print_message(names[D_CBC_256_CML], c[D_CBC_256_CML][j], lengths[j]);
1996 Time_F(START); 1932 time_f(START);
1997 for (count = 0, run = 1; COND(c[D_CBC_256_CML][j]); count++) 1933 for (count = 0, run = 1; COND(c[D_CBC_256_CML][j]); count++)
1998 Camellia_cbc_encrypt(buf, buf, 1934 Camellia_cbc_encrypt(buf, buf,
1999 (unsigned long) lengths[j], &camellia_ks3, 1935 (unsigned long) lengths[j], &camellia_ks3,
2000 iv, CAMELLIA_ENCRYPT); 1936 iv, CAMELLIA_ENCRYPT);
2001 d = Time_F(STOP); 1937 d = time_f(STOP);
2002 print_result(D_CBC_256_CML, j, count, d); 1938 print_result(D_CBC_256_CML, j, count, d);
2003 } 1939 }
2004 } 1940 }
@@ -2007,12 +1943,12 @@ speed_main(int argc, char **argv)
2007 if (doit[D_CBC_IDEA]) { 1943 if (doit[D_CBC_IDEA]) {
2008 for (j = 0; j < SIZE_NUM; j++) { 1944 for (j = 0; j < SIZE_NUM; j++) {
2009 print_message(names[D_CBC_IDEA], c[D_CBC_IDEA][j], lengths[j]); 1945 print_message(names[D_CBC_IDEA], c[D_CBC_IDEA][j], lengths[j]);
2010 Time_F(START); 1946 time_f(START);
2011 for (count = 0, run = 1; COND(c[D_CBC_IDEA][j]); count++) 1947 for (count = 0, run = 1; COND(c[D_CBC_IDEA][j]); count++)
2012 idea_cbc_encrypt(buf, buf, 1948 idea_cbc_encrypt(buf, buf,
2013 (unsigned long) lengths[j], &idea_ks, 1949 (unsigned long) lengths[j], &idea_ks,
2014 iv, IDEA_ENCRYPT); 1950 iv, IDEA_ENCRYPT);
2015 d = Time_F(STOP); 1951 d = time_f(STOP);
2016 print_result(D_CBC_IDEA, j, count, d); 1952 print_result(D_CBC_IDEA, j, count, d);
2017 } 1953 }
2018 } 1954 }
@@ -2021,12 +1957,12 @@ speed_main(int argc, char **argv)
2021 if (doit[D_CBC_RC2]) { 1957 if (doit[D_CBC_RC2]) {
2022 for (j = 0; j < SIZE_NUM; j++) { 1958 for (j = 0; j < SIZE_NUM; j++) {
2023 print_message(names[D_CBC_RC2], c[D_CBC_RC2][j], lengths[j]); 1959 print_message(names[D_CBC_RC2], c[D_CBC_RC2][j], lengths[j]);
2024 Time_F(START); 1960 time_f(START);
2025 for (count = 0, run = 1; COND(c[D_CBC_RC2][j]); count++) 1961 for (count = 0, run = 1; COND(c[D_CBC_RC2][j]); count++)
2026 RC2_cbc_encrypt(buf, buf, 1962 RC2_cbc_encrypt(buf, buf,
2027 (unsigned long) lengths[j], &rc2_ks, 1963 (unsigned long) lengths[j], &rc2_ks,
2028 iv, RC2_ENCRYPT); 1964 iv, RC2_ENCRYPT);
2029 d = Time_F(STOP); 1965 d = time_f(STOP);
2030 print_result(D_CBC_RC2, j, count, d); 1966 print_result(D_CBC_RC2, j, count, d);
2031 } 1967 }
2032 } 1968 }
@@ -2035,12 +1971,12 @@ speed_main(int argc, char **argv)
2035 if (doit[D_CBC_BF]) { 1971 if (doit[D_CBC_BF]) {
2036 for (j = 0; j < SIZE_NUM; j++) { 1972 for (j = 0; j < SIZE_NUM; j++) {
2037 print_message(names[D_CBC_BF], c[D_CBC_BF][j], lengths[j]); 1973 print_message(names[D_CBC_BF], c[D_CBC_BF][j], lengths[j]);
2038 Time_F(START); 1974 time_f(START);
2039 for (count = 0, run = 1; COND(c[D_CBC_BF][j]); count++) 1975 for (count = 0, run = 1; COND(c[D_CBC_BF][j]); count++)
2040 BF_cbc_encrypt(buf, buf, 1976 BF_cbc_encrypt(buf, buf,
2041 (unsigned long) lengths[j], &bf_ks, 1977 (unsigned long) lengths[j], &bf_ks,
2042 iv, BF_ENCRYPT); 1978 iv, BF_ENCRYPT);
2043 d = Time_F(STOP); 1979 d = time_f(STOP);
2044 print_result(D_CBC_BF, j, count, d); 1980 print_result(D_CBC_BF, j, count, d);
2045 } 1981 }
2046 } 1982 }
@@ -2049,12 +1985,12 @@ speed_main(int argc, char **argv)
2049 if (doit[D_CBC_CAST]) { 1985 if (doit[D_CBC_CAST]) {
2050 for (j = 0; j < SIZE_NUM; j++) { 1986 for (j = 0; j < SIZE_NUM; j++) {
2051 print_message(names[D_CBC_CAST], c[D_CBC_CAST][j], lengths[j]); 1987 print_message(names[D_CBC_CAST], c[D_CBC_CAST][j], lengths[j]);
2052 Time_F(START); 1988 time_f(START);
2053 for (count = 0, run = 1; COND(c[D_CBC_CAST][j]); count++) 1989 for (count = 0, run = 1; COND(c[D_CBC_CAST][j]); count++)
2054 CAST_cbc_encrypt(buf, buf, 1990 CAST_cbc_encrypt(buf, buf,
2055 (unsigned long) lengths[j], &cast_ks, 1991 (unsigned long) lengths[j], &cast_ks,
2056 iv, CAST_ENCRYPT); 1992 iv, CAST_ENCRYPT);
2057 d = Time_F(STOP); 1993 d = time_f(STOP);
2058 print_result(D_CBC_CAST, j, count, d); 1994 print_result(D_CBC_CAST, j, count, d);
2059 } 1995 }
2060 } 1996 }
@@ -2087,7 +2023,7 @@ speed_main(int argc, char **argv)
2087 EVP_EncryptInit_ex(ctx, evp_cipher, NULL, key16, iv); 2023 EVP_EncryptInit_ex(ctx, evp_cipher, NULL, key16, iv);
2088 EVP_CIPHER_CTX_set_padding(ctx, 0); 2024 EVP_CIPHER_CTX_set_padding(ctx, 0);
2089 2025
2090 Time_F(START); 2026 time_f(START);
2091 if (decrypt) 2027 if (decrypt)
2092 for (count = 0, run = 1; COND(save_count * 4 * lengths[0] / lengths[j]); count++) 2028 for (count = 0, run = 1; COND(save_count * 4 * lengths[0] / lengths[j]); count++)
2093 EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[j]); 2029 EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[j]);
@@ -2098,7 +2034,7 @@ speed_main(int argc, char **argv)
2098 EVP_DecryptFinal_ex(ctx, buf, &outl); 2034 EVP_DecryptFinal_ex(ctx, buf, &outl);
2099 else 2035 else
2100 EVP_EncryptFinal_ex(ctx, buf, &outl); 2036 EVP_EncryptFinal_ex(ctx, buf, &outl);
2101 d = Time_F(STOP); 2037 d = time_f(STOP);
2102 EVP_CIPHER_CTX_free(ctx); 2038 EVP_CIPHER_CTX_free(ctx);
2103 } 2039 }
2104 if (evp_md) { 2040 if (evp_md) {
@@ -2106,11 +2042,11 @@ speed_main(int argc, char **argv)
2106 print_message(names[D_EVP], save_count, 2042 print_message(names[D_EVP], save_count,
2107 lengths[j]); 2043 lengths[j]);
2108 2044
2109 Time_F(START); 2045 time_f(START);
2110 for (count = 0, run = 1; COND(save_count * 4 * lengths[0] / lengths[j]); count++) 2046 for (count = 0, run = 1; COND(save_count * 4 * lengths[0] / lengths[j]); count++)
2111 EVP_Digest(buf, lengths[j], &(md[0]), NULL, evp_md, NULL); 2047 EVP_Digest(buf, lengths[j], &(md[0]), NULL, evp_md, NULL);
2112 2048
2113 d = Time_F(STOP); 2049 d = time_f(STOP);
2114 } 2050 }
2115 print_result(D_EVP, j, count, d); 2051 print_result(D_EVP, j, count, d);
2116 } 2052 }
@@ -2130,7 +2066,7 @@ speed_main(int argc, char **argv)
2130 rsa_c[j][0], rsa_bits[j], 2066 rsa_c[j][0], rsa_bits[j],
2131 RSA_SECONDS); 2067 RSA_SECONDS);
2132/* RSA_blinding_on(rsa_key[j],NULL); */ 2068/* RSA_blinding_on(rsa_key[j],NULL); */
2133 Time_F(START); 2069 time_f(START);
2134 for (count = 0, run = 1; COND(rsa_c[j][0]); count++) { 2070 for (count = 0, run = 1; COND(rsa_c[j][0]); count++) {
2135 ret = RSA_sign(NID_md5_sha1, buf, 36, buf2, 2071 ret = RSA_sign(NID_md5_sha1, buf, 36, buf2,
2136 &rsa_num, rsa_key[j]); 2072 &rsa_num, rsa_key[j]);
@@ -2142,7 +2078,7 @@ speed_main(int argc, char **argv)
2142 break; 2078 break;
2143 } 2079 }
2144 } 2080 }
2145 d = Time_F(STOP); 2081 d = time_f(STOP);
2146 BIO_printf(bio_err, mr ? "+R1:%ld:%d:%.2f\n" 2082 BIO_printf(bio_err, mr ? "+R1:%ld:%d:%.2f\n"
2147 : "%ld %d bit private RSA in %.2fs\n", 2083 : "%ld %d bit private RSA in %.2fs\n",
2148 count, rsa_bits[j], d); 2084 count, rsa_bits[j], d);
@@ -2159,7 +2095,7 @@ speed_main(int argc, char **argv)
2159 pkey_print_message("public", "rsa", 2095 pkey_print_message("public", "rsa",
2160 rsa_c[j][1], rsa_bits[j], 2096 rsa_c[j][1], rsa_bits[j],
2161 RSA_SECONDS); 2097 RSA_SECONDS);
2162 Time_F(START); 2098 time_f(START);
2163 for (count = 0, run = 1; COND(rsa_c[j][1]); count++) { 2099 for (count = 0, run = 1; COND(rsa_c[j][1]); count++) {
2164 ret = RSA_verify(NID_md5_sha1, buf, 36, buf2, 2100 ret = RSA_verify(NID_md5_sha1, buf, 36, buf2,
2165 rsa_num, rsa_key[j]); 2101 rsa_num, rsa_key[j]);
@@ -2171,7 +2107,7 @@ speed_main(int argc, char **argv)
2171 break; 2107 break;
2172 } 2108 }
2173 } 2109 }
2174 d = Time_F(STOP); 2110 d = time_f(STOP);
2175 BIO_printf(bio_err, mr ? "+R2:%ld:%d:%.2f\n" 2111 BIO_printf(bio_err, mr ? "+R2:%ld:%d:%.2f\n"
2176 : "%ld %d bit public RSA in %.2fs\n", 2112 : "%ld %d bit public RSA in %.2fs\n",
2177 count, rsa_bits[j], d); 2113 count, rsa_bits[j], d);
@@ -2204,7 +2140,7 @@ speed_main(int argc, char **argv)
2204 pkey_print_message("sign", "dsa", 2140 pkey_print_message("sign", "dsa",
2205 dsa_c[j][0], dsa_bits[j], 2141 dsa_c[j][0], dsa_bits[j],
2206 DSA_SECONDS); 2142 DSA_SECONDS);
2207 Time_F(START); 2143 time_f(START);
2208 for (count = 0, run = 1; COND(dsa_c[j][0]); count++) { 2144 for (count = 0, run = 1; COND(dsa_c[j][0]); count++) {
2209 ret = DSA_sign(EVP_PKEY_DSA, buf, 20, buf2, 2145 ret = DSA_sign(EVP_PKEY_DSA, buf, 20, buf2,
2210 &kk, dsa_key[j]); 2146 &kk, dsa_key[j]);
@@ -2216,7 +2152,7 @@ speed_main(int argc, char **argv)
2216 break; 2152 break;
2217 } 2153 }
2218 } 2154 }
2219 d = Time_F(STOP); 2155 d = time_f(STOP);
2220 BIO_printf(bio_err, mr ? "+R3:%ld:%d:%.2f\n" 2156 BIO_printf(bio_err, mr ? "+R3:%ld:%d:%.2f\n"
2221 : "%ld %d bit DSA signs in %.2fs\n", 2157 : "%ld %d bit DSA signs in %.2fs\n",
2222 count, dsa_bits[j], d); 2158 count, dsa_bits[j], d);
@@ -2234,7 +2170,7 @@ speed_main(int argc, char **argv)
2234 pkey_print_message("verify", "dsa", 2170 pkey_print_message("verify", "dsa",
2235 dsa_c[j][1], dsa_bits[j], 2171 dsa_c[j][1], dsa_bits[j],
2236 DSA_SECONDS); 2172 DSA_SECONDS);
2237 Time_F(START); 2173 time_f(START);
2238 for (count = 0, run = 1; COND(dsa_c[j][1]); count++) { 2174 for (count = 0, run = 1; COND(dsa_c[j][1]); count++) {
2239 ret = DSA_verify(EVP_PKEY_DSA, buf, 20, buf2, 2175 ret = DSA_verify(EVP_PKEY_DSA, buf, 20, buf2,
2240 kk, dsa_key[j]); 2176 kk, dsa_key[j]);
@@ -2246,7 +2182,7 @@ speed_main(int argc, char **argv)
2246 break; 2182 break;
2247 } 2183 }
2248 } 2184 }
2249 d = Time_F(STOP); 2185 d = time_f(STOP);
2250 BIO_printf(bio_err, mr ? "+R4:%ld:%d:%.2f\n" 2186 BIO_printf(bio_err, mr ? "+R4:%ld:%d:%.2f\n"
2251 : "%ld %d bit DSA verify in %.2fs\n", 2187 : "%ld %d bit DSA verify in %.2fs\n",
2252 count, dsa_bits[j], d); 2188 count, dsa_bits[j], d);
@@ -2287,7 +2223,7 @@ speed_main(int argc, char **argv)
2287 test_curves_bits[j], 2223 test_curves_bits[j],
2288 ECDSA_SECONDS); 2224 ECDSA_SECONDS);
2289 2225
2290 Time_F(START); 2226 time_f(START);
2291 for (count = 0, run = 1; COND(ecdsa_c[j][0]); 2227 for (count = 0, run = 1; COND(ecdsa_c[j][0]);
2292 count++) { 2228 count++) {
2293 ret = ECDSA_sign(0, buf, 20, 2229 ret = ECDSA_sign(0, buf, 20,
@@ -2300,7 +2236,7 @@ speed_main(int argc, char **argv)
2300 break; 2236 break;
2301 } 2237 }
2302 } 2238 }
2303 d = Time_F(STOP); 2239 d = time_f(STOP);
2304 2240
2305 BIO_printf(bio_err, mr ? "+R5:%ld:%d:%.2f\n" : 2241 BIO_printf(bio_err, mr ? "+R5:%ld:%d:%.2f\n" :
2306 "%ld %d bit ECDSA signs in %.2fs \n", 2242 "%ld %d bit ECDSA signs in %.2fs \n",
@@ -2321,7 +2257,7 @@ speed_main(int argc, char **argv)
2321 ecdsa_c[j][1], 2257 ecdsa_c[j][1],
2322 test_curves_bits[j], 2258 test_curves_bits[j],
2323 ECDSA_SECONDS); 2259 ECDSA_SECONDS);
2324 Time_F(START); 2260 time_f(START);
2325 for (count = 0, run = 1; COND(ecdsa_c[j][1]); count++) { 2261 for (count = 0, run = 1; COND(ecdsa_c[j][1]); count++) {
2326 ret = ECDSA_verify(0, buf, 20, ecdsasig, ecdsasiglen, ecdsa[j]); 2262 ret = ECDSA_verify(0, buf, 20, ecdsasig, ecdsasiglen, ecdsa[j]);
2327 if (ret != 1) { 2263 if (ret != 1) {
@@ -2331,7 +2267,7 @@ speed_main(int argc, char **argv)
2331 break; 2267 break;
2332 } 2268 }
2333 } 2269 }
2334 d = Time_F(STOP); 2270 d = time_f(STOP);
2335 BIO_printf(bio_err, mr ? "+R6:%ld:%d:%.2f\n" 2271 BIO_printf(bio_err, mr ? "+R6:%ld:%d:%.2f\n"
2336 : "%ld %d bit ECDSA verify in %.2fs\n", 2272 : "%ld %d bit ECDSA verify in %.2fs\n",
2337 count, test_curves_bits[j], d); 2273 count, test_curves_bits[j], d);
@@ -2408,7 +2344,7 @@ speed_main(int argc, char **argv)
2408 ecdh_c[j][0], 2344 ecdh_c[j][0],
2409 test_curves_bits[j], 2345 test_curves_bits[j],
2410 ECDH_SECONDS); 2346 ECDH_SECONDS);
2411 Time_F(START); 2347 time_f(START);
2412 for (count = 0, run = 1; 2348 for (count = 0, run = 1;
2413 COND(ecdh_c[j][0]); count++) { 2349 COND(ecdh_c[j][0]); count++) {
2414 ECDH_compute_key(secret_a, 2350 ECDH_compute_key(secret_a,
@@ -2416,7 +2352,7 @@ speed_main(int argc, char **argv)
2416 EC_KEY_get0_public_key(ecdh_b[j]), 2352 EC_KEY_get0_public_key(ecdh_b[j]),
2417 ecdh_a[j], kdf); 2353 ecdh_a[j], kdf);
2418 } 2354 }
2419 d = Time_F(STOP); 2355 d = time_f(STOP);
2420 BIO_printf(bio_err, mr 2356 BIO_printf(bio_err, mr
2421 ? "+R7:%ld:%d:%.2f\n" 2357 ? "+R7:%ld:%d:%.2f\n"
2422 : "%ld %d-bit ECDH ops in %.2fs\n", 2358 : "%ld %d-bit ECDH ops in %.2fs\n",