From f57be82572e3ec16a2a3c02a7db41b0f9f969182 Mon Sep 17 00:00:00 2001 From: purplerain Date: Mon, 10 Jul 2023 00:10:46 +0000 Subject: [PATCH] sync --- distrib/miniroot/install.sub | 5 +- distrib/sets/lists/base/mi | 1 + distrib/sets/lists/comp/mi | 3 +- distrib/sets/lists/man/mi | 2 + gnu/usr.bin/binutils-2.17/bfd/elflink.c | 1 + gnu/usr.bin/perl/AUTHORS | 1 + gnu/usr.bin/perl/Configure | 48 +- gnu/usr.bin/perl/Cross/config.sh-arm-linux | 34 +- .../perl/Cross/config.sh-arm-linux-n770 | 34 +- gnu/usr.bin/perl/INSTALL | 38 +- gnu/usr.bin/perl/MANIFEST | 13 +- gnu/usr.bin/perl/META.json | 2 +- gnu/usr.bin/perl/META.yml | 2 +- gnu/usr.bin/perl/Makefile.SH | 16 +- gnu/usr.bin/perl/Makefile.bsd-wrapper1 | 1 + gnu/usr.bin/perl/Porting/config.sh | 36 +- gnu/usr.bin/perl/Porting/config_H | 18 +- gnu/usr.bin/perl/Porting/epigraphs.pod | 179 ++ gnu/usr.bin/perl/Porting/make-rmg-checklist | 11 + .../perl/Porting/perldelta_template.pod | 2 +- .../perl/Porting/release_managers_guide.pod | 96 +- gnu/usr.bin/perl/Porting/release_schedule.pod | 46 +- gnu/usr.bin/perl/Porting/todo.pod | 4 +- gnu/usr.bin/perl/README | 6 +- gnu/usr.bin/perl/README.haiku | 4 +- gnu/usr.bin/perl/README.macosx | 8 +- gnu/usr.bin/perl/README.os2 | 2 +- gnu/usr.bin/perl/README.vms | 4 +- gnu/usr.bin/perl/configure.com | 14 +- .../cpan/OpenBSD-Unveil/t/OpenBSD-Unveil.t | 49 +- gnu/usr.bin/perl/dist/Module-CoreList/Changes | 39 + .../perl/dist/Module-CoreList/Makefile.PL | 2 +- .../Module-CoreList/lib/Module/CoreList.pm | 976 +++++++++- .../lib/Module/CoreList/Utils.pm | 93 +- gnu/usr.bin/perl/embed.fnc | 36 +- gnu/usr.bin/perl/embed.h | 12 +- gnu/usr.bin/perl/ext/XS-APItest/t/xsub_h.t | 2 +- gnu/usr.bin/perl/gv.c | 2 +- gnu/usr.bin/perl/handy.h | 4 - gnu/usr.bin/perl/hints/catamount.sh | 4 +- gnu/usr.bin/perl/lib/B/Op_private.pm | 2 +- gnu/usr.bin/perl/makedef.pl | 9 +- gnu/usr.bin/perl/mg.c | 52 +- gnu/usr.bin/perl/op.c | 33 +- gnu/usr.bin/perl/patchlevel.h | 2 +- gnu/usr.bin/perl/perl.c | 4 +- gnu/usr.bin/perl/plan9/config_sh.sample | 32 +- gnu/usr.bin/perl/pod/perl.pod | 1 + gnu/usr.bin/perl/pod/perl5360delta.pod | 1587 +++++++++++++++++ gnu/usr.bin/perl/pod/perldelta.pod | 1549 +--------------- gnu/usr.bin/perl/pod/perlexperiment.pod | 4 +- gnu/usr.bin/perl/pod/perlhist.pod | 19 +- gnu/usr.bin/perl/pp_ctl.c | 17 +- gnu/usr.bin/perl/pp_hot.c | 5 +- gnu/usr.bin/perl/proto.h | 62 +- gnu/usr.bin/perl/sv.c | 10 - gnu/usr.bin/perl/t/io/defout.t | 16 +- gnu/usr.bin/perl/t/op/lexsub.t | 13 +- gnu/usr.bin/perl/t/op/method.t | 28 +- gnu/usr.bin/perl/t/op/taint.t | 14 +- gnu/usr.bin/perl/t/op/write.t | 56 +- gnu/usr.bin/perl/t/porting/exec-bit.t | 4 + gnu/usr.bin/perl/t/re/pat_re_eval.t | 17 +- gnu/usr.bin/perl/util.c | 50 +- gnu/usr.bin/perl/vms/descrip_mms.template | 2 +- gnu/usr.bin/perl/win32/GNUmakefile | 6 +- gnu/usr.bin/perl/win32/Makefile | 6 +- gnu/usr.bin/perl/win32/pod.mak | 4 + lib/libcrypto/Makefile | 15 +- lib/libcrypto/Symbols.namespace | 1512 +++++++++++++++- lib/libcrypto/arch/riscv64/Makefile.inc | 26 + lib/libcrypto/asn1/a_pkey.c | 5 +- lib/libcrypto/asn1/a_pubkey.c | 4 +- lib/libcrypto/asn1/a_strex.c | 4 +- lib/libcrypto/asn1/a_time_tm.c | 4 +- lib/libcrypto/asn1/ameth_lib.c | 22 +- lib/libcrypto/asn1/asn1_item.c | 6 +- lib/libcrypto/asn1/asn1_old.c | 3 +- lib/libcrypto/asn1/p5_pbe.c | 8 +- lib/libcrypto/asn1/p5_pbev2.c | 13 +- lib/libcrypto/asn1/p8_pkey.c | 10 +- lib/libcrypto/asn1/t_crl.c | 4 +- lib/libcrypto/asn1/t_req.c | 5 +- lib/libcrypto/asn1/t_spki.c | 3 +- lib/libcrypto/asn1/t_x509.c | 10 +- lib/libcrypto/asn1/t_x509a.c | 3 +- lib/libcrypto/asn1/x_algor.c | 13 +- lib/libcrypto/asn1/x_attrib.c | 8 +- lib/libcrypto/asn1/x_crl.c | 36 +- lib/libcrypto/asn1/x_exten.c | 9 +- lib/libcrypto/asn1/x_info.c | 4 +- lib/libcrypto/asn1/x_name.c | 14 +- lib/libcrypto/asn1/x_pkey.c | 4 +- lib/libcrypto/asn1/x_pubkey.c | 35 +- lib/libcrypto/asn1/x_req.c | 13 +- lib/libcrypto/asn1/x_sig.c | 8 +- lib/libcrypto/asn1/x_spki.c | 10 +- lib/libcrypto/asn1/x_val.c | 6 +- lib/libcrypto/asn1/x_x509.c | 19 +- lib/libcrypto/asn1/x_x509a.c | 14 +- lib/libcrypto/bio/b_dump.c | 4 +- lib/libcrypto/bio/bio_lib.c | 3 +- lib/libcrypto/bio/bss_bio.c | 3 +- lib/libcrypto/bio/bss_conn.c | 4 +- lib/libcrypto/bn/arch/riscv64/bn_arch.h | 52 +- lib/libcrypto/bn/bn_add.c | 6 +- lib/libcrypto/bn/bn_blind.c | 13 +- lib/libcrypto/bn/bn_const.c | 18 +- lib/libcrypto/bn/bn_convert.c | 16 +- lib/libcrypto/bn/bn_ctx.c | 7 +- lib/libcrypto/bn/bn_err.c | 3 +- lib/libcrypto/bn/bn_exp.c | 7 +- lib/libcrypto/bn/bn_kron.c | 3 +- lib/libcrypto/bn/bn_lib.c | 40 +- lib/libcrypto/bn/bn_mod.c | 13 +- lib/libcrypto/bn/bn_mod_sqrt.c | 3 +- lib/libcrypto/bn/bn_mont.c | 10 +- lib/libcrypto/bn/bn_mul.c | 3 +- lib/libcrypto/bn/bn_prime.c | 6 +- lib/libcrypto/bn/bn_print.c | 12 +- lib/libcrypto/bn/bn_rand.c | 6 +- lib/libcrypto/bn/bn_shift.c | 6 +- lib/libcrypto/bn/bn_sqr.c | 3 +- lib/libcrypto/bn/bn_word.c | 7 +- lib/libcrypto/buffer/buf_err.c | 3 +- lib/libcrypto/buffer/buffer.c | 6 +- lib/libcrypto/cast/c_cfb64.c | 111 +- lib/libcrypto/cast/c_ecb.c | 44 +- lib/libcrypto/cast/c_enc.c | 275 ++- lib/libcrypto/cast/c_ofb64.c | 87 +- lib/libcrypto/cast/c_skey.c | 167 +- lib/libcrypto/cast/cast.h | 33 +- lib/libcrypto/cast/cast_local.h | 14 +- lib/libcrypto/cast/cast_s.h | 1070 +++++------ lib/libcrypto/chacha/chacha-merged.c | 3 +- lib/libcrypto/cmac/cmac.c | 11 +- lib/libcrypto/cms/cms_asn1.c | 3 +- lib/libcrypto/cms/cms_att.c | 22 +- lib/libcrypto/cms/cms_enc.c | 3 +- lib/libcrypto/cms/cms_env.c | 17 +- lib/libcrypto/cms/cms_err.c | 3 +- lib/libcrypto/cms/cms_ess.c | 6 +- lib/libcrypto/cms/cms_io.c | 10 +- lib/libcrypto/cms/cms_kari.c | 11 +- lib/libcrypto/cms/cms_lib.c | 22 +- lib/libcrypto/cms/cms_local.h | 7 +- lib/libcrypto/cms/cms_pwri.c | 4 +- lib/libcrypto/cms/cms_sd.c | 20 +- lib/libcrypto/cms/cms_smime.c | 20 +- lib/libcrypto/comp/c_rle.c | 3 +- lib/libcrypto/comp/c_zlib.c | 4 +- lib/libcrypto/comp/comp_err.c | 3 +- lib/libcrypto/comp/comp_lib.c | 6 +- lib/libcrypto/conf/conf_api.c | 9 +- lib/libcrypto/cpt_err.c | 3 +- lib/libcrypto/cryptlib.c | 9 +- lib/libcrypto/crypto_init.c | 4 +- lib/libcrypto/crypto_lock.c | 4 +- lib/libcrypto/ct/ct_b64.c | 4 +- lib/libcrypto/ct/ct_log.c | 12 +- lib/libcrypto/ct/ct_oct.c | 8 +- lib/libcrypto/ct/ct_policy.c | 12 +- lib/libcrypto/ct/ct_prn.c | 5 +- lib/libcrypto/ct/ct_sct.c | 27 +- lib/libcrypto/curve25519/curve25519.c | 7 +- lib/libcrypto/cversion.c | 6 +- lib/libcrypto/des/cbc_cksm.c | 85 +- lib/libcrypto/des/cbc_enc.c | 14 +- lib/libcrypto/des/cfb64ede.c | 288 ++- lib/libcrypto/des/cfb64enc.c | 103 +- lib/libcrypto/des/cfb_enc.c | 192 +- lib/libcrypto/des/des.h | 165 +- lib/libcrypto/des/des_enc.c | 516 +++--- lib/libcrypto/des/des_local.h | 393 ++-- lib/libcrypto/des/ecb3_enc.c | 49 +- lib/libcrypto/des/ecb_enc.c | 80 +- lib/libcrypto/des/ede_cbcm_enc.c | 224 ++- lib/libcrypto/des/enc_read.c | 193 +- lib/libcrypto/des/enc_writ.c | 122 +- lib/libcrypto/des/fcrypt.c | 158 +- lib/libcrypto/des/fcrypt_b.c | 119 +- lib/libcrypto/des/ncbc_enc.c | 155 +- lib/libcrypto/des/ofb64ede.c | 88 +- lib/libcrypto/des/ofb64enc.c | 87 +- lib/libcrypto/des/ofb_enc.c | 132 +- lib/libcrypto/des/pcbc_enc.c | 117 +- lib/libcrypto/des/qud_cksm.c | 80 +- lib/libcrypto/des/rand_key.c | 4 +- lib/libcrypto/des/set_key.c | 515 +++--- lib/libcrypto/des/spr.h | 291 +-- lib/libcrypto/des/str2key.c | 188 +- lib/libcrypto/des/xcbc_enc.c | 165 +- lib/libcrypto/dh/dh_ameth.c | 45 +- lib/libcrypto/dh/dh_asn1.c | 9 +- lib/libcrypto/dh/dh_check.c | 4 +- lib/libcrypto/dh/dh_err.c | 3 +- lib/libcrypto/dh/dh_gen.c | 4 +- lib/libcrypto/dh/dh_key.c | 5 +- lib/libcrypto/dh/dh_lib.c | 30 +- lib/libcrypto/dsa/dsa_ameth.c | 61 +- lib/libcrypto/dsa/dsa_asn1.c | 19 +- lib/libcrypto/dsa/dsa_err.c | 3 +- lib/libcrypto/dsa/dsa_gen.c | 4 +- lib/libcrypto/dsa/dsa_key.c | 3 +- lib/libcrypto/dsa/dsa_lib.c | 29 +- lib/libcrypto/dsa/dsa_meth.c | 9 +- lib/libcrypto/dsa/dsa_ossl.c | 8 +- lib/libcrypto/dsa/dsa_prn.c | 6 +- lib/libcrypto/dso/dso_dlfcn.c | 4 +- lib/libcrypto/dso/dso_err.c | 3 +- lib/libcrypto/dso/dso_lib.c | 23 +- lib/libcrypto/dso/dso_null.c | 3 +- lib/libcrypto/dso/dso_openssl.c | 3 +- lib/libcrypto/ec/ec_ameth.c | 23 +- lib/libcrypto/ec/ec_asn1.c | 11 +- lib/libcrypto/ec/ec_check.c | 3 +- lib/libcrypto/ec/ec_curve.c | 6 +- lib/libcrypto/ec/ec_cvt.c | 3 +- lib/libcrypto/ec/ec_err.c | 3 +- lib/libcrypto/ec/ec_key.c | 28 +- lib/libcrypto/ec/ec_kmeth.c | 20 +- lib/libcrypto/ec/ec_lib.c | 48 +- lib/libcrypto/ec/ec_oct.c | 5 +- lib/libcrypto/ec/ec_print.c | 6 +- lib/libcrypto/ec/eck_prn.c | 8 +- lib/libcrypto/ec/ecp_mont.c | 3 +- lib/libcrypto/ec/ecp_smpl.c | 3 +- lib/libcrypto/ecdh/ecdh.c | 4 +- lib/libcrypto/ecdh/ech_err.c | 3 +- lib/libcrypto/ecdh/ech_lib.c | 9 +- lib/libcrypto/ecdsa/ecdsa.c | 18 +- lib/libcrypto/ecdsa/ecs_err.c | 3 +- lib/libcrypto/ecdsa/ecs_lib.c | 9 +- lib/libcrypto/err/err.c | 35 +- lib/libcrypto/err/err_all.c | 3 +- lib/libcrypto/err/err_prn.c | 5 +- lib/libcrypto/evp/bio_b64.c | 2 +- lib/libcrypto/evp/bio_enc.c | 2 +- lib/libcrypto/evp/bio_md.c | 2 +- lib/libcrypto/evp/c_all.c | 2 +- lib/libcrypto/evp/cipher_method_lib.c | 2 +- lib/libcrypto/evp/digest.c | 2 +- lib/libcrypto/evp/e_aes.c | 2 +- lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c | 2 +- lib/libcrypto/evp/e_bf.c | 2 +- lib/libcrypto/evp/e_camellia.c | 2 +- lib/libcrypto/evp/e_cast.c | 2 +- lib/libcrypto/evp/e_chacha.c | 2 +- lib/libcrypto/evp/e_chacha20poly1305.c | 2 +- lib/libcrypto/evp/e_des.c | 2 +- lib/libcrypto/evp/e_des3.c | 2 +- lib/libcrypto/evp/e_gost2814789.c | 2 +- lib/libcrypto/evp/e_idea.c | 2 +- lib/libcrypto/evp/e_null.c | 2 +- lib/libcrypto/evp/e_rc2.c | 2 +- lib/libcrypto/evp/e_rc4.c | 2 +- lib/libcrypto/evp/e_rc4_hmac_md5.c | 2 +- lib/libcrypto/evp/e_sm4.c | 2 +- lib/libcrypto/evp/e_xcbc_d.c | 2 +- lib/libcrypto/evp/encode.c | 2 +- lib/libcrypto/evp/evp_aead.c | 2 +- lib/libcrypto/evp/evp_enc.c | 2 +- lib/libcrypto/evp/evp_err.c | 2 +- lib/libcrypto/evp/evp_key.c | 2 +- lib/libcrypto/evp/evp_lib.c | 2 +- lib/libcrypto/evp/evp_pbe.c | 2 +- lib/libcrypto/evp/evp_pkey.c | 2 +- lib/libcrypto/evp/m_gost2814789.c | 2 +- lib/libcrypto/evp/m_gostr341194.c | 2 +- lib/libcrypto/evp/m_md4.c | 2 +- lib/libcrypto/evp/m_md5.c | 2 +- lib/libcrypto/evp/m_md5_sha1.c | 2 +- lib/libcrypto/evp/m_null.c | 2 +- lib/libcrypto/evp/m_ripemd.c | 2 +- lib/libcrypto/evp/m_sha1.c | 2 +- lib/libcrypto/evp/m_sha3.c | 2 +- lib/libcrypto/evp/m_sigver.c | 2 +- lib/libcrypto/evp/m_sm3.c | 2 +- lib/libcrypto/evp/m_streebog.c | 2 +- lib/libcrypto/evp/m_wp.c | 2 +- lib/libcrypto/evp/names.c | 2 +- lib/libcrypto/evp/p5_crpt.c | 2 +- lib/libcrypto/evp/p5_crpt2.c | 2 +- lib/libcrypto/evp/p_dec.c | 2 +- lib/libcrypto/evp/p_enc.c | 2 +- lib/libcrypto/evp/p_lib.c | 2 +- lib/libcrypto/evp/p_open.c | 2 +- lib/libcrypto/evp/p_seal.c | 2 +- lib/libcrypto/evp/p_sign.c | 2 +- lib/libcrypto/evp/p_verify.c | 2 +- lib/libcrypto/evp/pmeth_fn.c | 2 +- lib/libcrypto/evp/pmeth_gn.c | 2 +- lib/libcrypto/evp/pmeth_lib.c | 2 +- lib/libcrypto/ex_data.c | 12 +- lib/libcrypto/gost/gost2814789.c | 10 +- lib/libcrypto/gost/gost89_params.c | 4 +- lib/libcrypto/gost/gost_asn1.c | 4 + lib/libcrypto/gost/gost_err.c | 1 + lib/libcrypto/gost/gostr341001_key.c | 15 +- lib/libcrypto/gost/gostr341194.c | 7 +- lib/libcrypto/gost/streebog.c | 11 +- lib/libcrypto/hidden/openssl/asn1.h | 4 +- lib/libcrypto/hidden/openssl/asn1t.h | 2 +- lib/libcrypto/hidden/openssl/bio.h | 2 +- lib/libcrypto/hidden/openssl/bn.h | 163 ++ lib/libcrypto/hidden/openssl/buffer.h | 34 + lib/libcrypto/hidden/openssl/cast.h | 36 + lib/libcrypto/hidden/openssl/chacha.h | 2 +- lib/libcrypto/hidden/openssl/cmac.h | 38 + lib/libcrypto/hidden/openssl/cms.h | 146 ++ lib/libcrypto/hidden/openssl/comp.h | 37 + lib/libcrypto/hidden/openssl/conf_api.h | 36 + lib/libcrypto/hidden/openssl/crypto.h | 79 + lib/libcrypto/hidden/openssl/ct.h | 85 + lib/libcrypto/hidden/openssl/curve25519.h | 34 + lib/libcrypto/hidden/openssl/dh.h | 74 + lib/libcrypto/hidden/openssl/dsa.h | 94 + lib/libcrypto/hidden/openssl/dso.h | 54 + lib/libcrypto/hidden/openssl/ec.h | 146 ++ lib/libcrypto/hidden/openssl/ecdh.h | 39 + lib/libcrypto/hidden/openssl/ecdsa.h | 57 + lib/libcrypto/hidden/openssl/err.h | 66 + lib/libcrypto/hidden/openssl/gost.h | 71 + lib/libcrypto/hidden/openssl/hkdf.h | 32 + lib/libcrypto/hidden/openssl/idea.h | 37 + lib/libcrypto/hidden/openssl/lhash.h | 44 + lib/libcrypto/hidden/openssl/md4.h | 34 + lib/libcrypto/hidden/openssl/md5.h | 34 + lib/libcrypto/hidden/openssl/modes.h | 57 + lib/libcrypto/hidden/openssl/objects.h | 61 + lib/libcrypto/hidden/openssl/ocsp.h | 190 ++ lib/libcrypto/hidden/openssl/pem.h | 149 ++ lib/libcrypto/hidden/openssl/poly1305.h | 32 + lib/libcrypto/hidden/openssl/rand.h | 34 + lib/libcrypto/hidden/openssl/rc2.h | 36 + lib/libcrypto/hidden/openssl/rsa.h | 142 ++ lib/libcrypto/hidden/openssl/sha.h | 52 + lib/libcrypto/hidden/openssl/sm3.h | 32 + lib/libcrypto/hidden/openssl/sm4.h | 32 + lib/libcrypto/hidden/openssl/ts.h | 219 +++ lib/libcrypto/hidden/openssl/txt_db.h | 35 + lib/libcrypto/hkdf/hkdf.c | 5 +- lib/libcrypto/idea/i_cbc.c | 188 +- lib/libcrypto/idea/i_cfb64.c | 114 +- lib/libcrypto/idea/i_ecb.c | 55 +- lib/libcrypto/idea/i_ofb64.c | 90 +- lib/libcrypto/idea/i_skey.c | 192 +- lib/libcrypto/idea/idea.h | 29 +- lib/libcrypto/idea/idea_local.h | 127 +- lib/libcrypto/lhash/lh_stats.c | 11 +- lib/libcrypto/lhash/lhash.c | 11 +- lib/libcrypto/malloc-wrapper.c | 18 +- lib/libcrypto/man/ASN1_bn_print.3 | 119 -- lib/libcrypto/man/ASN1_buf_print.3 | 5 +- lib/libcrypto/man/BN_bn2bin.3 | 5 +- lib/libcrypto/man/BN_new.3 | 5 +- lib/libcrypto/man/EVP_MD_meth_new.3 | 292 +++ lib/libcrypto/man/Makefile | 4 +- lib/libcrypto/man/evp.3 | 5 +- lib/libcrypto/md4/md4.h | 23 +- lib/libcrypto/md4/md4_dgst.c | 259 ++- lib/libcrypto/md4/md4_local.h | 112 -- lib/libcrypto/md4/md4_one.c | 34 +- lib/libcrypto/md5/md5.h | 27 +- lib/libcrypto/md5/md5_dgst.c | 312 ++-- lib/libcrypto/md5/md5_local.h | 132 -- lib/libcrypto/md5/md5_one.c | 34 +- lib/libcrypto/mem_dbg.c | 13 +- lib/libcrypto/modes/cbc128.c | 106 +- lib/libcrypto/modes/ccm128.c | 431 +++-- lib/libcrypto/modes/cfb128.c | 273 +-- lib/libcrypto/modes/ctr128.c | 150 +- lib/libcrypto/modes/gcm128.c | 1274 ++++++------- lib/libcrypto/modes/modes.h | 108 +- lib/libcrypto/modes/modes_local.h | 56 +- lib/libcrypto/modes/ofb128.c | 85 +- lib/libcrypto/modes/xts128.c | 117 +- lib/libcrypto/objects/o_names.c | 10 +- lib/libcrypto/objects/obj_dat.c | 19 +- lib/libcrypto/objects/obj_err.c | 3 +- lib/libcrypto/objects/obj_lib.c | 4 +- lib/libcrypto/objects/obj_xref.c | 6 +- lib/libcrypto/ocsp/ocsp_asn.c | 66 +- lib/libcrypto/ocsp/ocsp_cl.c | 21 +- lib/libcrypto/ocsp/ocsp_err.c | 3 +- lib/libcrypto/ocsp/ocsp_ext.c | 46 +- lib/libcrypto/ocsp/ocsp_ht.c | 8 +- lib/libcrypto/ocsp/ocsp_lib.c | 8 +- lib/libcrypto/ocsp/ocsp_prn.c | 7 +- lib/libcrypto/ocsp/ocsp_srv.c | 11 +- lib/libcrypto/ocsp/ocsp_vfy.c | 5 +- lib/libcrypto/pem/pem_all.c | 60 +- lib/libcrypto/pem/pem_err.c | 3 +- lib/libcrypto/pem/pem_info.c | 5 +- lib/libcrypto/pem/pem_lib.c | 15 +- lib/libcrypto/pem/pem_oth.c | 3 +- lib/libcrypto/pem/pem_pk8.c | 20 +- lib/libcrypto/pem/pem_pkey.c | 10 +- lib/libcrypto/pem/pem_sign.c | 5 +- lib/libcrypto/pem/pem_x509.c | 6 +- lib/libcrypto/pem/pem_xaux.c | 6 +- lib/libcrypto/pem/pvkfmt.c | 10 +- lib/libcrypto/poly1305/poly1305.c | 5 +- lib/libcrypto/rand/rand_err.c | 3 +- lib/libcrypto/rand/rand_lib.c | 6 +- lib/libcrypto/rand/randfile.c | 2 +- lib/libcrypto/rc2/rc2.h | 39 +- lib/libcrypto/rc2/rc2_cbc.c | 302 ++-- lib/libcrypto/rc2/rc2_ecb.c | 45 +- lib/libcrypto/rc2/rc2_local.h | 155 +- lib/libcrypto/rc2/rc2_skey.c | 82 +- lib/libcrypto/rc2/rc2cfb64.c | 114 +- lib/libcrypto/rc2/rc2ofb64.c | 90 +- lib/libcrypto/ripemd/ripemd.h | 25 +- lib/libcrypto/ripemd/rmd_dgst.c | 532 +++--- lib/libcrypto/ripemd/rmd_local.h | 149 -- lib/libcrypto/ripemd/rmd_one.c | 34 +- lib/libcrypto/ripemd/rmdconst.h | 14 +- lib/libcrypto/rsa/rsa_ameth.c | 51 +- lib/libcrypto/rsa/rsa_asn1.c | 16 +- lib/libcrypto/rsa/rsa_chk.c | 3 +- lib/libcrypto/rsa/rsa_crpt.c | 12 +- lib/libcrypto/rsa/rsa_eay.c | 78 +- lib/libcrypto/rsa/rsa_err.c | 3 +- lib/libcrypto/rsa/rsa_gen.c | 4 +- lib/libcrypto/rsa/rsa_lib.c | 33 +- lib/libcrypto/rsa/rsa_meth.c | 33 +- lib/libcrypto/rsa/rsa_none.c | 4 +- lib/libcrypto/rsa/rsa_oaep.c | 7 +- lib/libcrypto/rsa/rsa_pk1.c | 6 +- lib/libcrypto/rsa/rsa_pmeth.c | 3 +- lib/libcrypto/rsa/rsa_prn.c | 4 +- lib/libcrypto/rsa/rsa_pss.c | 6 +- lib/libcrypto/rsa/rsa_saos.c | 4 +- lib/libcrypto/rsa/rsa_sign.c | 4 +- lib/libcrypto/sha/sha.h | 69 +- lib/libcrypto/sha/sha1.c | 228 +-- lib/libcrypto/sha/sha256.c | 281 +-- lib/libcrypto/sha/sha512.c | 11 +- lib/libcrypto/sm3/sm3.c | 75 +- lib/libcrypto/sm3/sm3_local.h | 85 - lib/libcrypto/sm4/sm4.c | 5 +- lib/libcrypto/ts/ts_asn1.c | 64 +- lib/libcrypto/ts/ts_conf.c | 20 +- lib/libcrypto/ts/ts_err.c | 3 +- lib/libcrypto/ts/ts_lib.c | 7 +- lib/libcrypto/ts/ts_req_print.c | 3 +- lib/libcrypto/ts/ts_req_utils.c | 26 +- lib/libcrypto/ts/ts_rsp_print.c | 5 +- lib/libcrypto/ts/ts_rsp_sign.c | 22 +- lib/libcrypto/ts/ts_rsp_utils.c | 45 +- lib/libcrypto/ts/ts_rsp_verify.c | 5 +- lib/libcrypto/ts/ts_verify_ctx.c | 12 +- lib/libcrypto/txt_db/txt_db.c | 8 +- lib/libradius/radius.c | 9 +- lib/libradius/radius.h | 12 +- lib/libradius/radius_attr.c | 9 +- lib/libradius/radius_eapmsk.c | 12 +- lib/libradius/radius_userpass.c | 8 +- lib/libssl/bio_ssl.c | 6 +- lib/libssl/d1_srtp.c | 6 +- lib/libssl/hidden/openssl/srtp.h | 33 + lib/libssl/hidden/openssl/ssl.h | 366 +++- lib/libssl/hidden/openssl/tls1.h | 32 + lib/libssl/s3_lib.c | 18 +- lib/libssl/ssl_algs.c | 4 +- lib/libssl/ssl_asn1.c | 4 +- lib/libssl/ssl_both.c | 3 +- lib/libssl/ssl_cert.c | 13 +- lib/libssl/ssl_ciph.c | 39 +- lib/libssl/ssl_clnt.c | 6 +- lib/libssl/ssl_err.c | 4 +- lib/libssl/ssl_init.c | 3 +- lib/libssl/ssl_lib.c | 197 +- lib/libssl/ssl_methods.c | 26 +- lib/libssl/ssl_rsa.c | 23 +- lib/libssl/ssl_sess.c | 54 +- lib/libssl/ssl_srvr.c | 6 +- lib/libssl/ssl_stat.c | 10 +- lib/libssl/ssl_txt.c | 4 +- lib/libssl/tls12_record_layer.c | 7 +- libexec/ld.so/.resolve.c.swp | 0 libexec/ld.so/Makefile | 4 +- libexec/ld.so/aarch64/ldasm.S | 2 +- libexec/ld.so/dlfcn.c | 2 +- libexec/ld.so/loader.c | 2 +- libexec/ld.so/resolve.c | 9 +- libexec/login_ldap/aldap.c | 8 +- libexec/login_ldap/aldap.h | 2 +- libexec/login_ldap/login_ldap.c | 2 +- libexec/login_token/tokendb.h | 4 +- libexec/snmpd/snmpd_metrics/mib.c | 20 +- libexec/snmpd/snmpd_metrics/pf.c | 12 +- libexec/spamd-setup/spamd-setup.c | 2 +- libexec/spamd/grey.c | 2 +- libexec/spamlogd/spamlogd.c | 2 +- libexec/tradcpp/eval.c | 2 +- libexec/tradcpp/macro.c | 2 +- libexec/tradcpp/main.c | 2 +- libexec/tradcpp/utils.c | 2 +- regress/gnu/usr.bin/perl/Makefile | 25 +- regress/lib/libcrypto/aead/aeadtest.c | 9 +- regress/lib/libcrypto/bn/bn_print.c | 16 +- regress/lib/libcrypto/ocsp/ocsp_test.c | 7 +- regress/lib/libcrypto/wycheproof/Makefile | 9 +- regress/sys/kern/unixsockets/unsendrecvthr.c | 6 +- regress/sys/net/pf_trans/Makefile | 33 + regress/sys/net/pf_trans/dev-limit.c | 148 ++ regress/sys/net/pf_trans/iocmd-limit.c | 202 +++ regress/sys/net/rtable/kern_compat.h | 8 +- regress/sys/net/rtable/util.c | 53 +- regress/sys/net/rtable/util.h | 2 +- sbin/bioctl/bioctl.8 | 5 +- share/man/man4/Makefile | 4 +- share/man/man4/ietp.4 | 47 + share/man/man4/iic.4 | 6 +- share/man/man4/man4.riscv64/Makefile | 5 +- share/man/man4/man4.riscv64/stfclock.4 | 8 +- share/man/man4/man4.riscv64/stfpcie.4 | 45 + share/man/man4/man4.riscv64/stfpciephy.4 | 43 + share/man/man4/man4.riscv64/stfpinctrl.4 | 8 +- share/man/man5/fstab.5 | 6 +- share/man/man9/refcnt_init.9 | 12 +- sys/arch/amd64/amd64/efi_machdep.c | 6 +- sys/arch/amd64/conf/GENERIC | 4 +- sys/arch/amd64/conf/files.amd64 | 3 +- sys/arch/arm64/dev/agintc.c | 161 +- sys/arch/arm64/dev/aplsmc.c | 5 +- sys/arch/arm64/dev/apm.c | 51 +- sys/arch/i386/conf/GENERIC | 6 +- sys/arch/i386/conf/files.i386 | 3 +- sys/arch/i386/eisa/eisa_machdep.c | 2 +- sys/arch/i386/i386/acpi_machdep.c | 6 +- sys/arch/i386/i386/acpi_wakecode.S | 2 +- sys/arch/i386/i386/amd64errata.c | 6 +- sys/arch/i386/i386/bus_dma.c | 2 +- sys/arch/i386/i386/conf.c | 2 +- sys/arch/i386/i386/cpu.c | 4 +- sys/dev/acpi/acpi.c | 222 +-- sys/dev/acpi/acpi_apm.c | 251 +++ sys/dev/acpi/acpithinkpad.c | 74 +- sys/dev/acpi/acpivar.h | 3 +- sys/dev/acpi/dwiic_acpi.c | 89 +- sys/dev/dt/dt_prov_static.c | 4 +- sys/dev/fdt/axppmic.c | 192 +- sys/dev/fdt/if_dwge.c | 2 +- sys/dev/fdt/if_dwqe_fdt.c | 3 +- sys/dev/fdt/qccpu.c | 2 +- sys/dev/fdt/rkclock.c | 143 +- sys/dev/fdt/rkclock_clocks.h | 31 + sys/dev/fdt/rkpciephy.c | 115 +- sys/dev/fdt/sncodec.c | 46 +- sys/dev/gpio/gpiodcf.c | 2 +- sys/dev/hid/hidkbd.c | 6 +- sys/dev/i2c/files.i2c | 7 +- sys/dev/i2c/ietp.c | 686 +++++++ sys/dev/i2c/ietp.h | 66 + sys/dev/ic/amireg.h | 2 +- sys/dev/ic/an.c | 30 +- sys/dev/ic/ar5008.c | 6 +- sys/dev/ic/ar5211.c | 2 +- sys/dev/ic/ar5212.c | 4 +- sys/dev/ic/ar5xxx.c | 2 +- sys/dev/ic/ar9003.c | 4 +- sys/dev/ic/ath.c | 8 +- sys/dev/ic/athnreg.h | 2 +- sys/dev/ic/athnvar.h | 2 +- sys/dev/ic/athvar.h | 6 +- sys/dev/ic/atw.c | 6 +- sys/dev/ic/atwreg.h | 18 +- sys/dev/ic/bcmgenetvar.h | 2 +- sys/dev/ic/bt463.c | 48 +- sys/dev/ic/bt485.c | 6 +- sys/dev/ic/bt485reg.h | 10 +- sys/dev/ic/bt8xx.h | 12 +- sys/dev/ic/bwfm.c | 4 +- sys/dev/ic/bwi.c | 18 +- sys/dev/ic/bwireg.h | 10 +- sys/dev/ic/bwivar.h | 18 +- sys/dev/ic/cacreg.h | 2 +- sys/dev/ic/cacvar.h | 2 +- sys/dev/ic/com.c | 2 +- sys/dev/ic/cy.c | 6 +- sys/dev/ic/cyreg.h | 2 +- sys/dev/ic/dc.c | 18 +- sys/dev/ic/dc21040reg.h | 2 +- sys/dev/ic/dcreg.h | 4 +- sys/dev/ic/dl10019.c | 2 +- sys/dev/ic/dp8390reg.h | 2 +- sys/dev/ic/dwhdmi.c | 2 +- sys/dev/ic/dwiic.c | 2 +- sys/dev/ic/elink3.c | 32 +- sys/dev/ic/elink3reg.h | 6 +- sys/dev/ic/fxp.c | 16 +- sys/dev/ic/fxpreg.h | 4 +- sys/dev/ic/fxpvar.h | 20 +- sys/dev/ic/gdtreg.h | 2 +- sys/dev/ic/gdtvar.h | 2 +- sys/dev/ic/gemreg.h | 2 +- sys/dev/ic/hme.c | 12 +- sys/dev/ic/i82365.c | 26 +- sys/dev/ic/i8237reg.h | 2 +- sys/dev/ic/i82596reg.h | 2 +- sys/dev/ic/i82596var.h | 2 +- sys/dev/ic/i82802reg.h | 2 +- sys/dev/ic/ibm561.c | 2 +- sys/dev/ic/if_wi.c | 16 +- sys/dev/ic/if_wi_hostap.c | 2 +- sys/dev/ic/if_wi_ieee.h | 2 +- sys/dev/ic/iosf.c | 2 +- sys/dev/ic/lemac.c | 16 +- sys/dev/ic/lemacreg.h | 2 +- sys/dev/ic/lm78.c | 6 +- sys/dev/ic/lm78var.h | 2 +- sys/dev/ic/lpt.c | 28 +- sys/dev/ic/lptvar.h | 22 +- sys/dev/ic/lsi64854.c | 6 +- sys/dev/ic/malo.c | 2 +- sys/dev/ic/max2820reg.h | 4 +- sys/dev/ic/mc146818reg.h | 10 +- sys/dev/ic/mc6845.h | 4 +- sys/dev/ic/mpi.c | 2 +- sys/dev/ic/mtd8xx.c | 2 +- sys/dev/ic/ncr53c9xreg.h | 2 +- sys/dev/ic/nvmereg.h | 4 +- sys/dev/ic/osiopvar.h | 4 +- sys/dev/ic/p9000.h | 2 +- sys/dev/ic/pcdisplay_subr.c | 18 +- sys/dev/ic/pckbcvar.h | 2 +- sys/dev/ic/pgt.c | 12 +- sys/dev/ic/pgtreg.h | 2 +- sys/dev/ic/pgtvar.h | 2 +- sys/dev/ic/ramdac.h | 2 +- sys/dev/ic/rt2661.c | 2 +- sys/dev/ic/rt2860.c | 4 +- sys/dev/ic/rtl80x9reg.h | 2 +- sys/dev/ic/rtl81x9reg.h | 10 +- sys/dev/ic/rtsx.c | 22 +- sys/dev/ic/rtsxreg.h | 8 +- sys/dev/ic/rtw.c | 10 +- sys/dev/ic/rtwreg.h | 16 +- sys/dev/ic/s3_617.h | 10 +- sys/dev/ic/sa2400reg.h | 2 +- sys/dev/ic/sili.c | 16 +- sys/dev/ic/siop_common.c | 2 +- sys/dev/ic/smc91cxx.c | 18 +- sys/dev/ic/smc93cx6var.h | 4 +- sys/dev/ic/sti.c | 2 +- sys/dev/ic/tcic2.c | 26 +- sys/dev/ic/tcic2reg.h | 34 +- sys/dev/ic/ti.c | 6 +- sys/dev/ic/tireg.h | 4 +- sys/dev/ic/ufshci.c | 4 +- sys/dev/ic/vga.c | 18 +- sys/dev/ic/vgavar.h | 12 +- sys/dev/ic/w83l518d.c | 2 +- sys/dev/ic/w83l518d_sdmmc.c | 4 +- sys/dev/ic/wdc.c | 6 +- sys/dev/ic/wdcreg.h | 2 +- sys/dev/ic/xl.c | 24 +- sys/dev/mii/miidevs | 6 +- sys/dev/mii/miidevs.h | 7 +- sys/dev/mii/miivar.h | 3 +- sys/dev/mii/ytphy.c | 243 ++- sys/dev/pci/if_ix.c | 9 +- sys/dev/pci/pcidevs | 8 +- sys/dev/pci/pcidevs.h | 8 +- sys/dev/pci/pcidevs_data.h | 18 +- sys/dev/pci/virtio_pci.c | 14 +- sys/dev/pv/virtio.c | 33 +- sys/dev/pv/virtiovar.h | 3 +- sys/dev/usb/makemap.awk | 6 +- sys/dev/usb/ukbdmap.c | 5 +- sys/dev/wscons/wskbd.c | 9 +- sys/dev/wscons/wsksymdef.h | 3 +- sys/kern/kern_sysctl.c | 20 +- sys/kern/kern_timeout.c | 7 +- sys/net/if.c | 56 +- sys/net/if_ethersubr.c | 8 +- sys/net/if_var.h | 4 +- sys/net/pf.c | 23 +- sys/netinet/if_ether.h | 7 +- sys/netinet/ip_output.c | 14 +- sys/netinet6/ip6_forward.c | 16 +- sys/netinet6/ip6_output.c | 23 +- sys/sys/device.h | 3 +- sys/sys/mbuf.h | 4 +- sys/sys/refcnt.h | 13 +- usr.bin/libtool/LT/Library.pm | 32 +- usr.bin/libtool/LT/Mode/Compile.pm | 10 +- usr.bin/libtool/LT/Mode/Install.pm | 15 +- usr.bin/libtool/LT/Mode/Link.pm | 99 +- usr.bin/libtool/LT/Mode/Link/Library.pm | 9 +- usr.bin/libtool/LT/Program.pm | 17 +- usr.bin/libtool/LT/UList.pm | 47 +- usr.bin/libtool/LT/Util.pm | 12 +- usr.bin/make/main.c | 4 +- usr.bin/make/make.1 | 14 +- usr.bin/make/make.c | 7 +- usr.bin/netstat/inet.c | 8 +- usr.bin/netstat/mbuf.c | 8 +- usr.bin/ssh/ssh-add.c | 6 +- usr.sbin/smtpd/lka_filter.c | 6 +- usr.sbin/smtpd/smtpd-filters.7 | 12 +- 704 files changed, 20524 insertions(+), 10572 deletions(-) create mode 100644 gnu/usr.bin/perl/pod/perl5360delta.pod create mode 100644 lib/libcrypto/arch/riscv64/Makefile.inc create mode 100644 lib/libcrypto/hidden/openssl/bn.h create mode 100644 lib/libcrypto/hidden/openssl/buffer.h create mode 100644 lib/libcrypto/hidden/openssl/cast.h create mode 100644 lib/libcrypto/hidden/openssl/cmac.h create mode 100644 lib/libcrypto/hidden/openssl/cms.h create mode 100644 lib/libcrypto/hidden/openssl/comp.h create mode 100644 lib/libcrypto/hidden/openssl/conf_api.h create mode 100644 lib/libcrypto/hidden/openssl/crypto.h create mode 100644 lib/libcrypto/hidden/openssl/ct.h create mode 100644 lib/libcrypto/hidden/openssl/curve25519.h create mode 100644 lib/libcrypto/hidden/openssl/dh.h create mode 100644 lib/libcrypto/hidden/openssl/dsa.h create mode 100644 lib/libcrypto/hidden/openssl/dso.h create mode 100644 lib/libcrypto/hidden/openssl/ec.h create mode 100644 lib/libcrypto/hidden/openssl/ecdh.h create mode 100644 lib/libcrypto/hidden/openssl/ecdsa.h create mode 100644 lib/libcrypto/hidden/openssl/err.h create mode 100644 lib/libcrypto/hidden/openssl/gost.h create mode 100644 lib/libcrypto/hidden/openssl/hkdf.h create mode 100644 lib/libcrypto/hidden/openssl/idea.h create mode 100644 lib/libcrypto/hidden/openssl/lhash.h create mode 100644 lib/libcrypto/hidden/openssl/md4.h create mode 100644 lib/libcrypto/hidden/openssl/md5.h create mode 100644 lib/libcrypto/hidden/openssl/modes.h create mode 100644 lib/libcrypto/hidden/openssl/objects.h create mode 100644 lib/libcrypto/hidden/openssl/ocsp.h create mode 100644 lib/libcrypto/hidden/openssl/pem.h create mode 100644 lib/libcrypto/hidden/openssl/poly1305.h create mode 100644 lib/libcrypto/hidden/openssl/rand.h create mode 100644 lib/libcrypto/hidden/openssl/rc2.h create mode 100644 lib/libcrypto/hidden/openssl/rsa.h create mode 100644 lib/libcrypto/hidden/openssl/sha.h create mode 100644 lib/libcrypto/hidden/openssl/sm3.h create mode 100644 lib/libcrypto/hidden/openssl/sm4.h create mode 100644 lib/libcrypto/hidden/openssl/ts.h create mode 100644 lib/libcrypto/hidden/openssl/txt_db.h delete mode 100644 lib/libcrypto/man/ASN1_bn_print.3 create mode 100644 lib/libcrypto/man/EVP_MD_meth_new.3 delete mode 100644 lib/libcrypto/md4/md4_local.h delete mode 100644 lib/libcrypto/md5/md5_local.h delete mode 100644 lib/libcrypto/ripemd/rmd_local.h delete mode 100644 lib/libcrypto/sm3/sm3_local.h create mode 100644 lib/libssl/hidden/openssl/srtp.h create mode 100644 lib/libssl/hidden/openssl/tls1.h create mode 100644 libexec/ld.so/.resolve.c.swp create mode 100644 regress/sys/net/pf_trans/Makefile create mode 100644 regress/sys/net/pf_trans/dev-limit.c create mode 100644 regress/sys/net/pf_trans/iocmd-limit.c create mode 100644 share/man/man4/ietp.4 create mode 100644 share/man/man4/man4.riscv64/stfpcie.4 create mode 100644 share/man/man4/man4.riscv64/stfpciephy.4 create mode 100644 sys/dev/acpi/acpi_apm.c create mode 100644 sys/dev/i2c/ietp.c create mode 100644 sys/dev/i2c/ietp.h diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 165b302fa..67fa8010c 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: install.sub,v 1.1250 2023/06/18 15:17:38 deraadt Exp $ +# $OpenBSD: install.sub,v 1.1251 2023/07/08 15:01:09 kn Exp $ # # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback # Copyright (c) 2015, Robert Peichaer @@ -307,6 +307,7 @@ scan_disknames() { get_softraid_chunks() { local _device=${1:-softraid0} + [[ -x /sbin/bioctl ]] || return bioctl $_device 2>/dev/null | sed -n 's/.*<\(.*\).>$/\1/p' } @@ -3084,6 +3085,8 @@ encrypt_root() { # The interactive bioctl(8) passphrase prompt requires a TTY. $AI && return + [[ -x /sbin/bioctl ]] || return + # Do not even try if softraid is in use already, # e.g. auto-assembled at boot or done in (S)hell. [[ -z $(get_softraid_volumes) ]] || return diff --git a/distrib/sets/lists/base/mi b/distrib/sets/lists/base/mi index 4a5652c6a..037fcd652 100644 --- a/distrib/sets/lists/base/mi +++ b/distrib/sets/lists/base/mi @@ -1660,6 +1660,7 @@ ./usr/libdata/perl5/pod/perl5340delta.pod ./usr/libdata/perl5/pod/perl5341delta.pod ./usr/libdata/perl5/pod/perl5360delta.pod +./usr/libdata/perl5/pod/perl5361delta.pod ./usr/libdata/perl5/pod/perl561delta.pod ./usr/libdata/perl5/pod/perl56delta.pod ./usr/libdata/perl5/pod/perl581delta.pod diff --git a/distrib/sets/lists/comp/mi b/distrib/sets/lists/comp/mi index dab958c51..6f5eb5b7e 100644 --- a/distrib/sets/lists/comp/mi +++ b/distrib/sets/lists/comp/mi @@ -176,6 +176,7 @@ ./usr/include/dev/i2c/i2c_bitbang.h ./usr/include/dev/i2c/i2c_io.h ./usr/include/dev/i2c/i2cvar.h +./usr/include/dev/i2c/ietp.h ./usr/include/dev/i2c/ihidev.h ./usr/include/dev/ic ./usr/include/dev/ic/aac_tables.h @@ -1766,7 +1767,6 @@ ./usr/share/man/man3/ASN1_TIME_set.3 ./usr/share/man/man3/ASN1_TYPE_get.3 ./usr/share/man/man3/ASN1_UNIVERSALSTRING_to_string.3 -./usr/share/man/man3/ASN1_bn_print.3 ./usr/share/man/man3/ASN1_buf_print.3 ./usr/share/man/man3/ASN1_generate_nconf.3 ./usr/share/man/man3/ASN1_get_object.3 @@ -1925,6 +1925,7 @@ ./usr/share/man/man3/EVP_DigestVerifyInit.3 ./usr/share/man/man3/EVP_EncodeInit.3 ./usr/share/man/man3/EVP_EncryptInit.3 +./usr/share/man/man3/EVP_MD_meth_new.3 ./usr/share/man/man3/EVP_OpenInit.3 ./usr/share/man/man3/EVP_PKCS82PKEY.3 ./usr/share/man/man3/EVP_PKEY_CTX_ctrl.3 diff --git a/distrib/sets/lists/man/mi b/distrib/sets/lists/man/mi index cfcd46f72..56d6d9b05 100644 --- a/distrib/sets/lists/man/mi +++ b/distrib/sets/lists/man/mi @@ -252,6 +252,7 @@ ./usr/share/man/man1/perl5340delta.1 ./usr/share/man/man1/perl5341delta.1 ./usr/share/man/man1/perl5360delta.1 +./usr/share/man/man1/perl5361delta.1 ./usr/share/man/man1/perl561delta.1 ./usr/share/man/man1/perl56delta.1 ./usr/share/man/man1/perl581delta.1 @@ -1544,6 +1545,7 @@ ./usr/share/man/man4/icmp.4 ./usr/share/man/man4/icmp6.4 ./usr/share/man/man4/icsphy.4 +./usr/share/man/man4/ietp.4 ./usr/share/man/man4/ifmedia.4 ./usr/share/man/man4/igc.4 ./usr/share/man/man4/iha.4 diff --git a/gnu/usr.bin/binutils-2.17/bfd/elflink.c b/gnu/usr.bin/binutils-2.17/bfd/elflink.c index d6fe66494..afb40ba27 100644 --- a/gnu/usr.bin/binutils-2.17/bfd/elflink.c +++ b/gnu/usr.bin/binutils-2.17/bfd/elflink.c @@ -5111,6 +5111,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, elf_tdata (output_bfd)->relro = info->relro; elf_tdata (output_bfd)->wxneeded = info->wxneeded; + elf_tdata (output_bfd)->nobtcfi = info->nobtcfi; elf_tdata (output_bfd)->executable = info->executable; if (info->execstack) elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X; diff --git a/gnu/usr.bin/perl/AUTHORS b/gnu/usr.bin/perl/AUTHORS index b9d2c66b2..8f25e9d83 100644 --- a/gnu/usr.bin/perl/AUTHORS +++ b/gnu/usr.bin/perl/AUTHORS @@ -434,6 +434,7 @@ Edward Moy Edward Peschko Elaine -HFB- Ashton Elizabeth Mattijsen +Elvin Aslanov Enrico Sorcinelli Eric Amick Eric Arnold diff --git a/gnu/usr.bin/perl/Configure b/gnu/usr.bin/perl/Configure index c2628837e..984b93808 100644 --- a/gnu/usr.bin/perl/Configure +++ b/gnu/usr.bin/perl/Configure @@ -4641,7 +4641,7 @@ esac # so we will take those off from locincpth. case "$gccversion" in 3.*) - echo "main(){}">try.c + echo "int main(){}">try.c for incdir in $locincpth; do warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \ grep '^c[cp]p*[01]: warning: changing search order '` @@ -5793,6 +5793,7 @@ case "$intsize" in #ifdef I_STDLIB #include #endif +#include int main() { printf("intsize=%d;\n", (int)sizeof(int)); @@ -6866,6 +6867,7 @@ case "$doublesize" in #ifdef I_STDLIB #include #endif +#include int main() { printf("%d\n", (int)sizeof(double)); @@ -7910,46 +7912,20 @@ esac : compute the return types of malloc and free echo " " -$cat >malloc.c < -#include -#ifdef I_MALLOC -#include -#endif -#ifdef I_STDLIB -#include -#endif -#ifdef TRY_MALLOC -void *malloc(); -#endif -#ifdef TRY_FREE -void free(); -#endif -END case "$malloctype" in '') - if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then - malloctype='void *' - else - malloctype='char *' - fi + malloctype='void *' ;; esac echo "Your system wants malloc to return '$malloctype', it would seem." >&4 case "$freetype" in '') - if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then - freetype='void' - else - freetype='int' - fi + freetype='void' ;; esac echo "Your system uses $freetype free(), it would seem." >&4 -$rm -f malloc.[co] + : determine where site specific architecture-dependent libraries go. : sitelib default is /usr/local/lib/perl5/site_perl/$version : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname @@ -12627,7 +12603,7 @@ case "$dlsrc" in dl_dlopen.xs) echo "Checking whether your dlsym() needs a leading underscore ..." >&4 $cat >dyna.c <<'EOM' -fred () { } +void fred (void) { } EOM $cat >fred.c<fred.c< #endif -extern int fred() ; +extern void fred(void) ; int main() { @@ -13680,6 +13656,7 @@ $cat >try.c < #endif +#include #define FILE_ptr(fp) $stdio_ptr #define FILE_cnt(fp) $stdio_cnt int main() { @@ -16187,6 +16164,7 @@ echo "Checking to see if your libm supports _LIB_VERSION..." >&4 $cat >try.c < #include +#include int main (int argc, char *argv[]) { printf ("%d\n", _LIB_VERSION); @@ -22084,13 +22062,15 @@ pager="$ans" : see if ar generates random libraries by itself echo " " echo "Checking how to generate random libraries on your machine..." >&4 -echo 'int bar1() { return bar2(); }' > bar1.c +echo 'extern int bar2(); int bar1() { return bar2(); }' > bar1.c echo 'int bar2() { return 2; }' > bar2.c $cat > foo.c < #endif +#include +extern int bar1(); int main() { printf("%d\n", bar1()); exit(0); } EOP $cc $ccflags -c bar1.c >/dev/null 2>&1 @@ -22316,7 +22296,7 @@ EOM for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do for tmo in 'struct timeval *' 'const struct timeval *'; do case "$val" in - '') try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));" + '') try="$extern_C int select _(($nfd, $xxx, $xxx, $xxx, $tmo));" if ./protochk "$try" $hdrs; then echo "Your system accepts $xxx." val="$xxx" diff --git a/gnu/usr.bin/perl/Cross/config.sh-arm-linux b/gnu/usr.bin/perl/Cross/config.sh-arm-linux index f2303707b..5edb8e8e9 100644 --- a/gnu/usr.bin/perl/Cross/config.sh-arm-linux +++ b/gnu/usr.bin/perl/Cross/config.sh-arm-linux @@ -35,8 +35,8 @@ api_subversion='0' api_version='36' api_versionstring='5.36.0' ar='ar' -archlib='/usr/lib/perl5/5.36.0/armv4l-linux' -archlibexp='/usr/lib/perl5/5.36.0/armv4l-linux' +archlib='/usr/lib/perl5/5.36.1/armv4l-linux' +archlibexp='/usr/lib/perl5/5.36.1/armv4l-linux' archname64='' archname='armv4l-linux' archobjs='' @@ -55,7 +55,7 @@ castflags='0' cat='cat' cc='cc' cccdlflags='-fpic' -ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.36.0/armv4l-linux/CORE' +ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.36.1/armv4l-linux/CORE' ccflags='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' ccflags_uselargefiles='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' ccname='arm-linux-gcc' @@ -831,7 +831,7 @@ inc_version_list=' ' inc_version_list_init='0' incpath='' inews='' -installarchlib='./install_me_here/usr/lib/perl5/5.36.0/armv4l-linux' +installarchlib='./install_me_here/usr/lib/perl5/5.36.1/armv4l-linux' installbin='./install_me_here/usr/bin' installhtml1dir='' installhtml3dir='' @@ -839,13 +839,13 @@ installman1dir='./install_me_here/usr/share/man/man1' installman3dir='./install_me_here/usr/share/man/man3' installprefix='./install_me_here/usr' installprefixexp='./install_me_here/usr' -installprivlib='./install_me_here/usr/lib/perl5/5.36.0' +installprivlib='./install_me_here/usr/lib/perl5/5.36.1' installscript='./install_me_here/usr/bin' -installsitearch='./install_me_here/usr/lib/perl5/site_perl/5.36.0/armv4l-linux' +installsitearch='./install_me_here/usr/lib/perl5/site_perl/5.36.1/armv4l-linux' installsitebin='./install_me_here/usr/bin' installsitehtml1dir='' installsitehtml3dir='' -installsitelib='./install_me_here/usr/lib/perl5/site_perl/5.36.0' +installsitelib='./install_me_here/usr/lib/perl5/site_perl/5.36.1' installsiteman1dir='./install_me_here/usr/share/man/man1' installsiteman3dir='./install_me_here/usr/share/man/man3' installsitescript='./install_me_here/usr/bin' @@ -980,8 +980,8 @@ pmake='' pr='' prefix='/usr' prefixexp='/usr' -privlib='/usr/lib/perl5/5.36.0' -privlibexp='/usr/lib/perl5/5.36.0' +privlib='/usr/lib/perl5/5.36.1' +privlibexp='/usr/lib/perl5/5.36.1' procselfexe='"/proc/self/exe"' prototype='define' ptrsize='4' @@ -1046,17 +1046,17 @@ sig_num='0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 sig_num_init='0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 6, 17, 29, 31, 0' sig_size='68' signal_t='void' -sitearch='/usr/lib/perl5/site_perl/5.36.0/armv4l-linux' -sitearchexp='/usr/lib/perl5/site_perl/5.36.0/armv4l-linux' +sitearch='/usr/lib/perl5/site_perl/5.36.1/armv4l-linux' +sitearchexp='/usr/lib/perl5/site_perl/5.36.1/armv4l-linux' sitebin='/usr/bin' sitebinexp='/usr/bin' sitehtml1dir='' sitehtml1direxp='' sitehtml3dir='' sitehtml3direxp='' -sitelib='/usr/lib/perl5/site_perl/5.36.0' +sitelib='/usr/lib/perl5/site_perl/5.36.1' sitelib_stem='/usr/lib/perl5/site_perl' -sitelibexp='/usr/lib/perl5/site_perl/5.36.0' +sitelibexp='/usr/lib/perl5/site_perl/5.36.1' siteman1dir='/usr/share/man/man1' siteman1direxp='/usr/share/man/man1' siteman3dir='/usr/share/man/man3' @@ -1097,7 +1097,7 @@ stdio_stream_array='' strerror_r_proto='0' strings='/usr/include/string.h' submit='' -subversion='0' +subversion='1' sysman='/usr/share/man/man1' tail='' tar='' @@ -1188,8 +1188,8 @@ vendorprefix='' vendorprefixexp='' vendorscript='' vendorscriptexp='' -version='5.36.0' -version_patchlevel_string='version 36 subversion 0' +version='5.36.1' +version_patchlevel_string='version 36 subversion 1' versiononly='undef' vi='' xlibpth='/usr/lib/386 /lib/386' @@ -1204,7 +1204,7 @@ config_args='' config_argc=0 PERL_REVISION=5 PERL_VERSION=36 -PERL_SUBVERSION=0 +PERL_SUBVERSION=1 PERL_API_REVISION=5 PERL_API_VERSION=36 PERL_API_SUBVERSION=0 diff --git a/gnu/usr.bin/perl/Cross/config.sh-arm-linux-n770 b/gnu/usr.bin/perl/Cross/config.sh-arm-linux-n770 index b1e697f17..9c8c159b9 100644 --- a/gnu/usr.bin/perl/Cross/config.sh-arm-linux-n770 +++ b/gnu/usr.bin/perl/Cross/config.sh-arm-linux-n770 @@ -35,8 +35,8 @@ api_subversion='0' api_version='36' api_versionstring='5.36.0' ar='ar' -archlib='/usr/lib/perl5/5.36.0/armv4l-linux' -archlibexp='/usr/lib/perl5/5.36.0/armv4l-linux' +archlib='/usr/lib/perl5/5.36.1/armv4l-linux' +archlibexp='/usr/lib/perl5/5.36.1/armv4l-linux' archname64='' archname='armv4l-linux' archobjs='' @@ -54,7 +54,7 @@ castflags='0' cat='cat' cc='arm-none-linux-gnueabi-gcc' cccdlflags='-fpic' -ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.36.0/armv4l-linux/CORE' +ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.36.1/armv4l-linux/CORE' ccflags='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' ccflags_uselargefiles='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' ccname='arm-linux-gcc' @@ -829,7 +829,7 @@ inc_version_list=' ' inc_version_list_init='0' incpath='' inews='' -installarchlib='./install_me_here/usr/lib/perl5/5.36.0/armv4l-linux' +installarchlib='./install_me_here/usr/lib/perl5/5.36.1/armv4l-linux' installbin='./install_me_here/usr/bin' installhtml1dir='' installhtml3dir='' @@ -837,13 +837,13 @@ installman1dir='./install_me_here/usr/share/man/man1' installman3dir='./install_me_here/usr/share/man/man3' installprefix='./install_me_here/usr' installprefixexp='./install_me_here/usr' -installprivlib='./install_me_here/usr/lib/perl5/5.36.0' +installprivlib='./install_me_here/usr/lib/perl5/5.36.1' installscript='./install_me_here/usr/bin' -installsitearch='./install_me_here/usr/lib/perl5/site_perl/5.36.0/armv4l-linux' +installsitearch='./install_me_here/usr/lib/perl5/site_perl/5.36.1/armv4l-linux' installsitebin='./install_me_here/usr/bin' installsitehtml1dir='' installsitehtml3dir='' -installsitelib='./install_me_here/usr/lib/perl5/site_perl/5.36.0' +installsitelib='./install_me_here/usr/lib/perl5/site_perl/5.36.1' installsiteman1dir='./install_me_here/usr/share/man/man1' installsiteman3dir='./install_me_here/usr/share/man/man3' installsitescript='./install_me_here/usr/bin' @@ -978,8 +978,8 @@ pmake='' pr='' prefix='/usr' prefixexp='/usr' -privlib='/usr/lib/perl5/5.36.0' -privlibexp='/usr/lib/perl5/5.36.0' +privlib='/usr/lib/perl5/5.36.1' +privlibexp='/usr/lib/perl5/5.36.1' procselfexe='"/proc/self/exe"' prototype='define' ptrsize='4' @@ -1044,17 +1044,17 @@ sig_num='0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 sig_num_init='0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 6, 17, 29, 31, 0' sig_size='68' signal_t='void' -sitearch='/usr/lib/perl5/site_perl/5.36.0/armv4l-linux' -sitearchexp='/usr/lib/perl5/site_perl/5.36.0/armv4l-linux' +sitearch='/usr/lib/perl5/site_perl/5.36.1/armv4l-linux' +sitearchexp='/usr/lib/perl5/site_perl/5.36.1/armv4l-linux' sitebin='/usr/bin' sitebinexp='/usr/bin' sitehtml1dir='' sitehtml1direxp='' sitehtml3dir='' sitehtml3direxp='' -sitelib='/usr/lib/perl5/site_perl/5.36.0' +sitelib='/usr/lib/perl5/site_perl/5.36.1' sitelib_stem='/usr/lib/perl5/site_perl' -sitelibexp='/usr/lib/perl5/site_perl/5.36.0' +sitelibexp='/usr/lib/perl5/site_perl/5.36.1' siteman1dir='/usr/share/man/man1' siteman1direxp='/usr/share/man/man1' siteman3dir='/usr/share/man/man3' @@ -1095,7 +1095,7 @@ stdio_stream_array='' strerror_r_proto='0' strings='/usr/include/string.h' submit='' -subversion='0' +subversion='1' sysman='/usr/share/man/man1' tail='' tar='' @@ -1186,8 +1186,8 @@ vendorprefix='' vendorprefixexp='' vendorscript='' vendorscriptexp='' -version='5.36.0' -version_patchlevel_string='version 36 subversion 0' +version='5.36.1' +version_patchlevel_string='version 36 subversion 1' versiononly='undef' vi='' xlibpth='/usr/lib/386 /lib/386' @@ -1202,7 +1202,7 @@ config_args='' config_argc=0 PERL_REVISION=5 PERL_VERSION=36 -PERL_SUBVERSION=0 +PERL_SUBVERSION=1 PERL_API_REVISION=5 PERL_API_VERSION=36 PERL_API_SUBVERSION=0 diff --git a/gnu/usr.bin/perl/INSTALL b/gnu/usr.bin/perl/INSTALL index 4e74bd4ce..8731b96f6 100644 --- a/gnu/usr.bin/perl/INSTALL +++ b/gnu/usr.bin/perl/INSTALL @@ -90,10 +90,10 @@ to F for more detailed information. =head3 Compatibility with earlier versions -B This version is not binary compatible with earlier versions -of Perl. If you have built extensions (i.e. modules that include C code) -using an earlier version of Perl, you will need to rebuild and reinstall -those extensions. +B This version is not binary compatible with versions of Perl +earlier than 5.36.0. If you have built extensions (i.e. modules that +include C code) using an earlier version of Perl, you will need to +rebuild and reinstall those extensions. Pure perl modules without XS or C code should continue to work fine without reinstallation. See the discussion below on @@ -683,7 +683,7 @@ The directories set up by Configure fall into three broad categories. =item Directories for the perl distribution -By default, Configure will use the following directories for 5.36.0. +By default, Configure will use the following directories for 5.36.1. $version is the full perl version number, including subversion, e.g. 5.12.3, and $archname is a string like sun4-sunos, determined by Configure. The full definitions of all Configure @@ -2506,8 +2506,8 @@ L =head1 Coexistence with earlier versions of perl 5 -Perl 5.36.0 is not binary compatible with earlier versions of Perl. -In other words, you will have to recompile your XS modules. +Perl 5.36.1 is not binary compatible with versions of Perl earlier than. +5.36.0. In other words, you will have to recompile your XS modules. In general, you can usually safely upgrade from one stable version of Perl (e.g. 5.30.0) to another similar minor version (e.g. 5.30.1) without @@ -2581,9 +2581,9 @@ won't interfere with another version. (The defaults guarantee this for libraries after 5.6.0, but not for executables. TODO?) One convenient way to do this is by using a separate prefix for each version, such as - sh Configure -Dprefix=/opt/perl5.36.0 + sh Configure -Dprefix=/opt/perl5.36.1 -and adding /opt/perl5.36.0/bin to the shell PATH variable. Such users +and adding /opt/perl5.36.1/bin to the shell PATH variable. Such users may also wish to add a symbolic link /usr/local/bin/perl so that scripts can still start with #!/usr/local/bin/perl. @@ -2598,11 +2598,11 @@ yet. =head2 Upgrading from 5.35.11 or earlier -B Perl modules having binary parts (meaning that a C compiler is used) will have to be recompiled to be -used with 5.36.0. If you find you do need to rebuild an extension with -5.36.0, you may safely do so without disturbing the older +used with 5.36.1. If you find you do need to rebuild an extension with +5.36.1, you may safely do so without disturbing the older installations. (See L<"Coexistence with earlier versions of perl 5"> above.) @@ -2635,15 +2635,15 @@ Firstly, the bare minimum to run this script print("$f\n"); } -in Linux with perl-5.36.0 is as follows (under $Config{prefix}): +in Linux with perl-5.36.1 is as follows (under $Config{prefix}): ./bin/perl - ./lib/perl5/5.36.0/strict.pm - ./lib/perl5/5.36.0/warnings.pm - ./lib/perl5/5.36.0/i686-linux/File/Glob.pm - ./lib/perl5/5.36.0/feature.pm - ./lib/perl5/5.36.0/XSLoader.pm - ./lib/perl5/5.36.0/i686-linux/auto/File/Glob/Glob.so + ./lib/perl5/5.36.1/strict.pm + ./lib/perl5/5.36.1/warnings.pm + ./lib/perl5/5.36.1/i686-linux/File/Glob.pm + ./lib/perl5/5.36.1/feature.pm + ./lib/perl5/5.36.1/XSLoader.pm + ./lib/perl5/5.36.1/i686-linux/auto/File/Glob/Glob.so Secondly, for perl-5.10.1, the Debian perl-base package contains 591 files, (of which 510 are for lib/unicore) totaling about 3.5MB in its diff --git a/gnu/usr.bin/perl/MANIFEST b/gnu/usr.bin/perl/MANIFEST index 1184e2cb7..5ab37d13b 100644 --- a/gnu/usr.bin/perl/MANIFEST +++ b/gnu/usr.bin/perl/MANIFEST @@ -5879,6 +5879,7 @@ pod/perl5320delta.pod Perl changes in version 5.32.0 pod/perl5321delta.pod Perl changes in version 5.32.1 pod/perl5340delta.pod Perl changes in version 5.34.0 pod/perl5341delta.pod Perl changes in version 5.34.1 +pod/perl5360delta.pod Perl changes in version 5.36.0 pod/perl561delta.pod Perl changes in version 5.6.1 pod/perl56delta.pod Perl changes in version 5.6 pod/perl581delta.pod Perl changes in version 5.8.1 @@ -5894,8 +5895,8 @@ pod/perl58delta.pod Perl changes in version 5.8.0 pod/perlapio.pod Perl internal IO abstraction interface pod/perlartistic.pod Perl Artistic License pod/perlbook.pod Perl book information -pod/perlboot.pod -pod/perlbot.pod +pod/perlboot.pod +pod/perlbot.pod pod/perlcall.pod Perl calling conventions from C pod/perlcheat.pod Perl cheat sheet pod/perlclib.pod Internal replacements for standard C library functions @@ -5959,7 +5960,7 @@ pod/perlrecharclass.pod Perl regular expression character classes pod/perlref.pod Perl references, the rest of the story pod/perlreftut.pod Perl references short introduction pod/perlreguts.pod Perl regular expression engine internals -pod/perlrepository.pod +pod/perlrepository.pod pod/perlrequick.pod Perl regular expressions quick start pod/perlreref.pod Perl regular expressions quick reference pod/perlretut.pod Perl regular expressions tutorial @@ -5972,9 +5973,9 @@ pod/perlsub.pod Perl subroutines pod/perlsyn.pod Perl syntax pod/perlthrtut.pod Perl threads tutorial pod/perltie.pod Perl objects hidden behind simple variables -pod/perltodo.pod -pod/perltooc.pod -pod/perltoot.pod +pod/perltodo.pod +pod/perltooc.pod +pod/perltoot.pod pod/perltrap.pod Perl traps for the unwary pod/perlunicode.pod Perl Unicode support pod/perlunicook.pod Perl Unicode cookbook diff --git a/gnu/usr.bin/perl/META.json b/gnu/usr.bin/perl/META.json index 6c89ee22b..ddc92c778 100644 --- a/gnu/usr.bin/perl/META.json +++ b/gnu/usr.bin/perl/META.json @@ -118,6 +118,6 @@ "url" : "https://github.com/Perl/perl5" } }, - "version" : "5.036000", + "version" : "5.036001", "x_serialization_backend" : "JSON::PP version 4.07" } diff --git a/gnu/usr.bin/perl/META.yml b/gnu/usr.bin/perl/META.yml index 2bfde7bff..e8c10bb20 100644 --- a/gnu/usr.bin/perl/META.yml +++ b/gnu/usr.bin/perl/META.yml @@ -105,5 +105,5 @@ resources: homepage: https://www.perl.org/ license: https://dev.perl.org/licenses/ repository: https://github.com/Perl/perl5 -version: '5.036000' +version: '5.036001' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff --git a/gnu/usr.bin/perl/Makefile.SH b/gnu/usr.bin/perl/Makefile.SH index 36920ffe5..d624776aa 100644 --- a/gnu/usr.bin/perl/Makefile.SH +++ b/gnu/usr.bin/perl/Makefile.SH @@ -329,7 +329,7 @@ STATIC_LDFLAGS = $static_ldflags LDLIBPTH = $ldlibpth # Sometimes running an executable is an adventure. -RUN = +RUN = # When cross-compiling we want to use a (mini)perl built for the host, not the target HOST_PERL = $hostperl @@ -614,7 +614,7 @@ esac $spitshell >>$Makefile <<'!NO!SUBS!' -perltoc_pod_prereqs = extra.pods pod/perl5360delta.pod pod/perlapi.pod pod/perlintern.pod pod/perlmodlib.pod +perltoc_pod_prereqs = extra.pods pod/perl5361delta.pod pod/perlapi.pod pod/perlintern.pod pod/perlmodlib.pod generated_pods = pod/perltoc.pod $(perltoc_pod_prereqs) generated_headers = uudmap.h bitcount.h mg_data.h @@ -650,7 +650,7 @@ lintflags = \ -erroff=E_STATIC_UNUSED \ -erroff=E_TRUE_LOGICAL_EXPR -.c$(OBJ_EXT): +.c$(OBJ_EXT): @echo `$(CCCMD)` $(PLDLFLAGS) $*.c @`$(CCCMD)` $(PLDLFLAGS) $*.c @@ -843,9 +843,9 @@ aix) LIBPERLEXPORT = perl.exp !NO!SUBS! - + ;; - *) + *) $spitshell >>$Makefile <<'!NO!SUBS!' PERLEXPORT = perl.exp @@ -1129,9 +1129,9 @@ pod/perlintern.pod: $(MINIPERL_EXE) autodoc.pl embed.fnc pod/perlmodlib.pod: $(MINIPERL_EXE) pod/perlmodlib.PL MANIFEST $(MINIPERL) pod/perlmodlib.PL -q -pod/perl5360delta.pod: pod/perldelta.pod - $(RMS) pod/perl5360delta.pod - $(LNS) perldelta.pod pod/perl5360delta.pod +pod/perl5361delta.pod: pod/perldelta.pod + $(RMS) pod/perl5361delta.pod + $(LNS) perldelta.pod pod/perl5361delta.pod extra.pods: $(MINIPERL_EXE) -@test ! -f extra.pods || rm -f `cat extra.pods` diff --git a/gnu/usr.bin/perl/Makefile.bsd-wrapper1 b/gnu/usr.bin/perl/Makefile.bsd-wrapper1 index 49da1b405..3636f3eb5 100644 --- a/gnu/usr.bin/perl/Makefile.bsd-wrapper1 +++ b/gnu/usr.bin/perl/Makefile.bsd-wrapper1 @@ -87,6 +87,7 @@ _quick3p= perl5340delta 1 pod/perl5340delta.pod \ perl5341delta 1 pod/perl5341delta.pod \ perl5360delta 1 pod/perl5360delta.pod \ + perl5361delta 1 pod/perl5361delta.pod \ perl561delta 1 pod/perl561delta.pod \ perl56delta 1 pod/perl56delta.pod \ perl581delta 1 pod/perl581delta.pod \ diff --git a/gnu/usr.bin/perl/Porting/config.sh b/gnu/usr.bin/perl/Porting/config.sh index 91086e62a..cc6491232 100644 --- a/gnu/usr.bin/perl/Porting/config.sh +++ b/gnu/usr.bin/perl/Porting/config.sh @@ -50,8 +50,8 @@ api_subversion='0' api_version='36' api_versionstring='5.36.0' ar='ar' -archlib='/opt/perl/lib/5.36.0/x86_64-linux-thread-multi-ld' -archlibexp='/opt/perl/lib/5.36.0/x86_64-linux-thread-multi-ld' +archlib='/opt/perl/lib/5.36.1/x86_64-linux-thread-multi-ld' +archlibexp='/opt/perl/lib/5.36.1/x86_64-linux-thread-multi-ld' archname64='' archname='x86_64-linux-thread-multi-ld' archobjs='' @@ -860,7 +860,7 @@ incpath='' incpth='/usr/lib64/gcc/x86_64-suse-linux/10/include /usr/local/include /usr/lib64/gcc/x86_64-suse-linux/10/include-fixed /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/include /usr/include' inews='' initialinstalllocation='/opt/perl/bin' -installarchlib='/opt/perl/lib/5.36.0/x86_64-linux-thread-multi-ld' +installarchlib='/opt/perl/lib/5.36.1/x86_64-linux-thread-multi-ld' installbin='/opt/perl/bin' installhtml1dir='' installhtml3dir='' @@ -868,13 +868,13 @@ installman1dir='/opt/perl/man/man1' installman3dir='/opt/perl/man/man3' installprefix='/opt/perl' installprefixexp='/opt/perl' -installprivlib='/opt/perl/lib/5.36.0' +installprivlib='/opt/perl/lib/5.36.1' installscript='/opt/perl/bin' -installsitearch='/opt/perl/lib/site_perl/5.36.0/x86_64-linux-thread-multi-ld' +installsitearch='/opt/perl/lib/site_perl/5.36.1/x86_64-linux-thread-multi-ld' installsitebin='/opt/perl/bin' installsitehtml1dir='' installsitehtml3dir='' -installsitelib='/opt/perl/lib/site_perl/5.36.0' +installsitelib='/opt/perl/lib/site_perl/5.36.1' installsiteman1dir='/opt/perl/man/man1' installsiteman3dir='/opt/perl/man/man3' installsitescript='/opt/perl/bin' @@ -1000,7 +1000,7 @@ perl_static_inline='static __inline__' perl_thread_local='' perladmin='yourname@yourhost.yourplace.com' perllibs='-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc' -perlpath='/opt/perl/bin/perl5.36.0' +perlpath='/opt/perl/bin/perl5.36.1' pg='pg' phostname='' pidtype='pid_t' @@ -1009,8 +1009,8 @@ pmake='' pr='' prefix='/opt/perl' prefixexp='/opt/perl' -privlib='/opt/perl/lib/5.36.0' -privlibexp='/opt/perl/lib/5.36.0' +privlib='/opt/perl/lib/5.36.1' +privlibexp='/opt/perl/lib/5.36.1' procselfexe='"/proc/self/exe"' ptrsize='8' quadkind='2' @@ -1075,17 +1075,17 @@ sig_num='0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 sig_num_init='0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 6, 17, 29, 0' sig_size='68' signal_t='void' -sitearch='/opt/perl/lib/site_perl/5.36.0/x86_64-linux-thread-multi-ld' -sitearchexp='/opt/perl/lib/site_perl/5.36.0/x86_64-linux-thread-multi-ld' +sitearch='/opt/perl/lib/site_perl/5.36.1/x86_64-linux-thread-multi-ld' +sitearchexp='/opt/perl/lib/site_perl/5.36.1/x86_64-linux-thread-multi-ld' sitebin='/opt/perl/bin' sitebinexp='/opt/perl/bin' sitehtml1dir='' sitehtml1direxp='' sitehtml3dir='' sitehtml3direxp='' -sitelib='/opt/perl/lib/site_perl/5.36.0' +sitelib='/opt/perl/lib/site_perl/5.36.1' sitelib_stem='/opt/perl/lib/site_perl' -sitelibexp='/opt/perl/lib/site_perl/5.36.0' +sitelibexp='/opt/perl/lib/site_perl/5.36.1' siteman1dir='/opt/perl/man/man1' siteman1direxp='/opt/perl/man/man1' siteman3dir='/opt/perl/man/man3' @@ -1113,7 +1113,7 @@ st_dev_sign='1' st_dev_size='4' st_ino_sign='1' st_ino_size='8' -startperl='#!/opt/perl/bin/perl5.36.0' +startperl='#!/opt/perl/bin/perl5.36.1' startsh='#!/bin/sh' static_ext=' ' stdchar='char' @@ -1125,7 +1125,7 @@ stdio_ptr='((fp)->_ptr)' stdio_stream_array='' strerror_r_proto='REENTRANT_PROTO_B_IBW' submit='' -subversion='0' +subversion='1' sysman='/usr/share/man/man1' sysroot='' tail='' @@ -1224,8 +1224,8 @@ vendorprefix='' vendorprefixexp='' vendorscript='' vendorscriptexp='' -version='5.36.0' -version_patchlevel_string='version 36 subversion 0' +version='5.36.1' +version_patchlevel_string='version 36 subversion 1' versiononly='define' vi='' xlibpth='/usr/lib/386 /lib/386' @@ -1236,7 +1236,7 @@ zcat='' zip='zip' PERL_REVISION=5 PERL_VERSION=36 -PERL_SUBVERSION=0 +PERL_SUBVERSION=1 PERL_API_REVISION=5 PERL_API_VERSION=36 PERL_API_SUBVERSION=0 diff --git a/gnu/usr.bin/perl/Porting/config_H b/gnu/usr.bin/perl/Porting/config_H index 80692093f..bf8709052 100644 --- a/gnu/usr.bin/perl/Porting/config_H +++ b/gnu/usr.bin/perl/Porting/config_H @@ -1239,8 +1239,8 @@ * This symbol contains the ~name expanded version of ARCHLIB, to be used * in programs that are not prepared to deal with ~ expansion at run-time. */ -#define ARCHLIB "/opt/perl/lib/5.36.0/x86_64-linux" /**/ -#define ARCHLIB_EXP "/opt/perl/lib/5.36.0/x86_64-linux" /**/ +#define ARCHLIB "/opt/perl/lib/5.36.1/x86_64-linux" /**/ +#define ARCHLIB_EXP "/opt/perl/lib/5.36.1/x86_64-linux" /**/ /* BIN: * This symbol holds the path of the bin directory where the package will @@ -1293,8 +1293,8 @@ * This symbol contains the ~name expanded version of PRIVLIB, to be used * in programs that are not prepared to deal with ~ expansion at run-time. */ -#define PRIVLIB "/opt/perl/lib/5.36.0" /**/ -#define PRIVLIB_EXP "/opt/perl/lib/5.36.0" /**/ +#define PRIVLIB "/opt/perl/lib/5.36.1" /**/ +#define PRIVLIB_EXP "/opt/perl/lib/5.36.1" /**/ /* SITEARCH: * This symbol contains the name of the private library for this package. @@ -1311,8 +1311,8 @@ * This symbol contains the ~name expanded version of SITEARCH, to be used * in programs that are not prepared to deal with ~ expansion at run-time. */ -#define SITEARCH "/opt/perl/lib/site_perl/5.36.0/x86_64-linux" /**/ -#define SITEARCH_EXP "/opt/perl/lib/site_perl/5.36.0/x86_64-linux" /**/ +#define SITEARCH "/opt/perl/lib/site_perl/5.36.1/x86_64-linux" /**/ +#define SITEARCH_EXP "/opt/perl/lib/site_perl/5.36.1/x86_64-linux" /**/ /* SITELIB: * This symbol contains the name of the private library for this package. @@ -1334,8 +1334,8 @@ * removed. The elements in inc_version_list (inc_version_list.U) can * be tacked onto this variable to generate a list of directories to search. */ -#define SITELIB "/opt/perl/lib/site_perl/5.36.0" /**/ -#define SITELIB_EXP "/opt/perl/lib/site_perl/5.36.0" /**/ +#define SITELIB "/opt/perl/lib/site_perl/5.36.1" /**/ +#define SITELIB_EXP "/opt/perl/lib/site_perl/5.36.1" /**/ #define SITELIB_STEM "/opt/perl/lib/site_perl" /**/ /* PERL_VENDORARCH: @@ -4109,7 +4109,7 @@ * script to make sure (one hopes) that it runs with perl and not * some shell. */ -#define STARTPERL "#!/opt/perl/bin/perl5.36.0" /**/ +#define STARTPERL "#!/opt/perl/bin/perl5.36.1" /**/ /* HAS_STDIO_STREAM_ARRAY: * This symbol, if defined, tells that there is an array diff --git a/gnu/usr.bin/perl/Porting/epigraphs.pod b/gnu/usr.bin/perl/Porting/epigraphs.pod index 018400bf7..a6f6359d0 100644 --- a/gnu/usr.bin/perl/Porting/epigraphs.pod +++ b/gnu/usr.bin/perl/Porting/epigraphs.pod @@ -17,6 +17,185 @@ Consult your favorite dictionary for details. =head1 EPIGRAPHS +=head2 v5.37.11 - Ben Aaronovitch, "Moon Over Soho" + +L + +My dad always said that a trumpet player likes to aim his weapon at the +audience, but a sax man likes to cut a good profile and that they always +have a favourite side. It being an article of faith with my dad that +you don't even pick up a reed instrument unless you're vain about the +shape your face makes when you're blowing down it. + +=head2 v5.37.10 - Lewis Carroll "The Walrus and the Carpenter" + +L + + The time has come,' the Walrus said, + To talk of many things: + Of shoes - and ships - and sealing-wax - + Of cabbages - and kings - + And why the sea is boiling hot - + And whether pigs have wings.' + +=head2 v5.37.9 - Virginia Woolf + +L + +Each has his past shut in him like the leaves of a book known to him by +heart and his friends can only read the title. + +=head2 v5.37.8 - Helmut Schmidt + +L + +Honesty doesn't require saying everything you think. Honesty only +requires that you don't say anything that you don't think. + +=head2 v5.37.7 - Terry Pratchett, "Hogfather" + +L + +TO THE HOGFATHER, ALL PORK PIES ARE AS ONE PORK PIE. +EXCEPT THE ONE LIKE A TURNIP. + +=head2 v5.37.6 - N. K. Jemisin - The City We Became + +L + +Queens sighs with the air of someone who is used to not being +understood. She takes out her phone and starts texting someone, +her bottom lip poked out a little. + +Brooklyn's expression turns grim. To Broca she says, "You said +becoming a city punches through other universes." +So she's not stupid. Bronca inclined her head to the woman, in +respect if not in approval. "Yes". + +"Okay, so." Brooklyn visibly braces herself. "So what +happens to those universes that our city punches through?" + + The City We Became - N.K. Jemisin + +=head2 v5.37.5 - Nori - The Lord of the Rings: The Rings of Power + +L + +If we didn't do everything we weren't supposed to, we'd hardly do +anything at all. + +=head2 v5.37.4 - C. F. Kettering + +L + +A problem well stated is a problem half solved. + +=head2 v5.37.3 - John Steinbeck, "East of Eden" + +L + +And now that you don't have to be perfect, you can be good. + +=head2 v5.37.2 - James Clear, "Atomic Habits" + +L + +If you can get one percent better each day for one year, +you'll end up thiry-seven times better by the time you are done + +=head2 v5.37.1 - Squirt, "Finding Nemo" + +L + +Good afternoon! We're gonna have a great jump today! +Okay, crank a hard cutback as you hit the wall. +There's a screaming bottom curve, so watch out. +Remember: Rip it! Roll it! And punch it! + +=head2 v5.37.0 - John Cage, "Lecture on Nothing" + +L + +I have nothing to say, and I am saying it. + +=head2 v5.36.1-RC3 - Karl Leimer & Walter Gieseking, trans. Frederick C. Rauser, "Rhythmics, Dynamics, Pedal and Other Problems of Piano Playing" + +L + +Generally, no clear opinions exist as to the usefulness of mental work +in order to acquire a good technique. We do not seem to know exactly +what it means or how to develop technique through "brain work." +Technique, when playing an instrument, means controlling the fingers. +Generally, it is used only in a limited sense regarding fluency, rapid +execution of difficult passages and steady aim. +In order to acquire a perfect technique through brain work, an exact +impression of the note picture upon the mind is the first problem which +we must solve. Thereafter we should busy ourselves with the study in +question, as to fingering, touch, note value, etc., to achieve +perfection along these lines in the broadest sense. This occurs +quickest and completely through intensive concentration of all +intellectual powers and is, therefore, strenuous brain work. + +=head2 v5.36.1-RC2 - Karl Leimer & Walter Gieseking, "The Shortest Way to Pianistic Perfection" + +L + +In order to attain a natural manner of playing the piano, that is to +say, with the least possible strain and exertion, it is of the utmost +importance to learn to exert the muscles consciously, and, what is of +still greater importance, to relax them consciously. My manner of +accomplishing this differs from that of many other pedagogues. I +contrive to raise a feeling of relaxation from within, as it were. This +is generally attempted by the aid of visible movements. All superfluous +movements are injurious. The aim should be the very least possible +strain of the muscles when playing the piano. + +=head2 v5.36.1-RC1 - Josef Lhevinne, "Basic Principles in Pianoforte Playing" + +L + +Avoid worry and distractions of any kind when you are practicing. Your +mind must be every minute on what you are doing, or the value of your +practice is lessened enormously. By intense concentration, love of your +work and the spirit in which you approach it, you can do more in a half +hour than in an hour spent purposelessly. Do not think you have been +practicing, if you have played a single note with your mind on anything +else. + +=head2 v5.36.0 - Alexandre Dumas, "The Three Musketeers" + +L + +“What!" cried he, in an accent of greater astonishment than before "your second +witness is Monsieur Aramis?" + +"Doubtless! Are you not aware that we are never seen one without the others, +and that we are called among the Musketeers and the Guards, at the court and in +the city, Athos, Porthos, and Aramis, or the Three Inseparables?” + +=head2 v5.36.0-RC3 - The Three Amigos + +L + + Lucky Day: I'll come back one day + Carmen: Why? + — The Three Amigos + +=head2 v5.36.0-RC1 - The Three Amigos + +L + + Jefe: I have put many beautiful piñatas in the storeroom, each of them filled + with little surprises. + El Guapo: Many piñatas? + Jefe: Oh yes, many! + El Guapo: Would you say I have a plethora of piñatas? + Jefe: A what? + El Guapo: A plethora. + Jefe: Oh yes, you have a plethora. + + — The Three Amigos + =head2 v5.35.11 - Marcel Allain and Pierre Souvestre, "Fantômas" L diff --git a/gnu/usr.bin/perl/Porting/make-rmg-checklist b/gnu/usr.bin/perl/Porting/make-rmg-checklist index 8b11ed02f..699412e7c 100644 --- a/gnu/usr.bin/perl/Porting/make-rmg-checklist +++ b/gnu/usr.bin/perl/Porting/make-rmg-checklist @@ -146,6 +146,13 @@ my ( @items, $current_element, @leading_attrs ); my $skip_headers = qr/^=encoding/xms; my $passthru_headers = qr/^= (?: over | item | back | cut )/xms; +# version used when generating diffs (acknowledgements, Module::CoreList etc) +# 5.36.0 -> 5.34.0 +# 5.36.1 -> 5.36.0 +my ($major, $minor, $point) = split(/\./, $version); +my $last_version = join('.', $major, ($point == 0 ? ($minor - 2, 0) : ($minor, $point-1))); + + foreach my $line (@pod_lines) { $line =~ $skip_headers and next; @@ -179,6 +186,10 @@ foreach my $line (@pod_lines) { or $line =~ /^[^=]/xms or die "Cannot recognize line: '$line'\n"; + $line =~ s/\Q5.X.Y\E/$version/g; + $line =~ s/\Q5.LAST\E/$last_version/g; + $line =~ s/\Q5.X\E-b/$major.$minor/g; + $current_element->{'content'} .= "\n" . $line; } diff --git a/gnu/usr.bin/perl/Porting/perldelta_template.pod b/gnu/usr.bin/perl/Porting/perldelta_template.pod index f0a104866..0c18644c2 100644 --- a/gnu/usr.bin/perl/Porting/perldelta_template.pod +++ b/gnu/usr.bin/perl/Porting/perldelta_template.pod @@ -403,7 +403,7 @@ died, add a short obituary here. XXX Generate this with: - perl Porting/acknowledgements.pl v5.36.0..HEAD + perl Porting/acknowledgements.pl v5.36.1..HEAD =head1 Reporting Bugs diff --git a/gnu/usr.bin/perl/Porting/release_managers_guide.pod b/gnu/usr.bin/perl/Porting/release_managers_guide.pod index ffdb17e17..37fde782f 100644 --- a/gnu/usr.bin/perl/Porting/release_managers_guide.pod +++ b/gnu/usr.bin/perl/Porting/release_managers_guide.pod @@ -16,13 +16,13 @@ document that starts with a checklist for your release. This script is run as: perl Porting/make-rmg-checklist \ - --version [5.x.y-RC#] > /tmp/rmg.pod + --version [5.X.Y-RC#] > /tmp/rmg.pod You can also pass the C<--html> flag to generate an HTML document instead of POD. perl Porting/make-rmg-checklist --html \ - --version [5.x.y-RC#] > /tmp/rmg.html + --version [5.X.Y-RC#] > /tmp/rmg.html =head1 SYNOPSIS @@ -67,13 +67,21 @@ of these release types. If a step does not apply to a given type of release, you will see a notation to that effect at the beginning of the step. +This guide assumes you are working on the Perl master repository (i.e. +L) and B on your own fork of the perl5 +repository. While it is possible to prepare a release on your own fork +this guide is not written with that in mind and as a result several +key steps are missing. If you do use your own fork then extra care +needs to be taken when setting/pushing the tag and doing the merge +(do B use a PR). + =head2 Release types =over 4 =item Release Candidate (RC) -A release candidate is an attempt to produce a tarball that is a close as +A release candidate is an attempt to produce a tarball that is as close as possible to the final release. Indeed, unless critical faults are found during the RC testing, the final release will be identical to the RC barring a few minor fixups (updating the release date in F, @@ -469,7 +477,7 @@ Commit your changes: $ git diff B - $ git commit -a -m 'Bump the perl version in various places for 5.x.y' + $ git commit -a -m 'Bump the perl version in various places for 5.X.Y' At this point you may want to compare the commit with a previous bump to see if they look similar. See commit f7cf42bb69 for an example of a @@ -525,7 +533,7 @@ to use the last known git commit by GitHub. Review the changes to the AUTHORS file, be sure you are not adding duplicate entries or removing any entries, then commit your changes. - $ git commit -a AUTHORS -m 'Update AUTHORS list for 5.x.y' + $ git commit -a AUTHORS -m 'Update AUTHORS list for 5.X.Y' =head3 Check copyright years @@ -596,7 +604,7 @@ need to freeze blead during the release. This is less important for BLEAD-FINAL, MAINT, and RC releases, since blead will already be frozen in those cases. Create the branch by running - git checkout -b release-5.xx.yy + git checkout -b release-5.X.Y =head3 build a clean perl @@ -616,7 +624,7 @@ For each Perl release since the previous release of the current branch, check for modules that have identical version numbers but different contents by running: - $ ./perl -Ilib Porting/cmpVERSION.pl --tag=v5.X.YY + $ ./perl -Ilib Porting/cmpVERSION.pl --tag=v5.X.Y (This is done automatically by F for the previous release of the current branch, but not for any releases from other branches.) @@ -731,7 +739,7 @@ Finally, commit the new version of Module::CoreList: (unless this is for MAINT; in which case commit it to blead first, then cherry-pick it back). - $ git commit -m 'Update Module::CoreList for 5.x.y' \ + $ git commit -m 'Update Module::CoreList for 5.X.Y' \ dist/Module-CoreList/Changes \ dist/Module-CoreList/lib/Module/CoreList.pm \ dist/Module-CoreList/lib/Module/CoreList/Utils.pm @@ -746,7 +754,7 @@ ensure all tests are passing. Finalize the perldelta. In particular, fill in the Acknowledgements section, which can be generated with something like: - $ perl Porting/acknowledgements.pl v5.15.0..HEAD + $ perl Porting/acknowledgements.pl v5.LAST..HEAD Fill in the "New/Updated Modules" sections now that Module::CoreList is updated: @@ -919,22 +927,22 @@ Be sure to commit any changes (if applicable): Build perl, then make sure it passes its own test suite, and installs: $ git clean -xdf - $ ./Configure -des -Dprefix=/tmp/perl-5.x.y-pretest + $ ./Configure -des -Dprefix=/tmp/perl-5.X.Y-pretest # or if it's an odd-numbered version: - $ ./Configure -des -Dusedevel -Dprefix=/tmp/perl-5.x.y-pretest + $ ./Configure -des -Dusedevel -Dprefix=/tmp/perl-5.X.Y-pretest $ make test install -Check that the output of C and -C are as expected, +Check that the output of C and +C are as expected, especially as regards version numbers, patch and/or RC levels, and @INC paths. Note that as they have been built from a git working directory, they will still identify themselves using git tags and commits. (Note that for an odd-numbered version, perl will install -itself as C). C will identify itself as: +itself as C). C will identify itself as: - This is perl 5, version X, subversion Y (v5.X.Y (v5.X.Z-NNN-gdeadbeef)) + This is perl 5, version X, subversion Y (v5.X.Y (v5.XX.Z-NNN-gdeadbeef)) where 5.X.Z is the latest tag, NNN the number of commits since this tag, and C<< deadbeef >> commit of that tag. @@ -943,7 +951,7 @@ Then delete the temporary installation. =head3 create the release tag -Create the tag identifying this release (e.g.): +Create the I tag identifying this release (e.g.): $ git tag v5.11.0 -m 'First release of the v5.11 series!' @@ -953,6 +961,16 @@ wrong before you publish your newly-created tag, you can delete and recreate it. Once you push your tag, we're stuck with it and you'll need to use a new version number for your release. +Verify that your tag is annotated: + + $ git show v5.X.Y + +The output must look similar to the following: + + tag v5.X.Y + Tagger: Jesse Vincent + Date: Fri Oct 2 16:29:56 2009 -0400 + =head3 build the tarball Before you run the following, you might want to install 7-Zip (the @@ -979,10 +997,6 @@ Create a tarball. Use the C<-s> option to specify a suitable suffix for the tarball and directory name: $ cd root/of/perl/tree - $ make distclean # make sure distclean works - $ git clean -xdf # make sure perl and git agree on files - # git clean should not output anything! - $ git status --ignored # and there's nothing lying around $ perl Porting/makerel -x -s RC1 # for a release candidate $ perl Porting/makerel -x # for the release itself @@ -1060,7 +1074,7 @@ which is why you should test from the tarball. $ ./perl -Ilib ./utils/perlivp # Or, perhaps: - $ ./perl5.x.y ./utils/perlivp5.x.y + $ ./perl5.X.Y ./utils/perlivp5.X.Y ... All tests successful. $ @@ -1094,7 +1108,7 @@ Bootstrap the CPAN client on the clean install: $ bin/cpan # Or, perhaps: - $ bin/cpan5.xx.x + $ bin/cpan5.X.Y =head4 Install the Inline module with CPAN and test it @@ -1182,7 +1196,13 @@ Do not proceed any further until you are sure that your tarballs are on CPAN. Check your authors directory metacpan.org to confirm that your uploads have been successful. - https://metacpan.org/author/YOUR_PAUSE_ID + https://metacpan.org/author/YOUR_PAUSE_ID/releases + +You can also check + + https://metacpan.org/release/YOUR_PAUSE_ID/perl-5.X.Y + +which may be faster. =for checklist skip RC BLEAD-POINT @@ -1232,9 +1252,9 @@ Merge the (local) release branch back into master now, and delete it. git checkout blead git pull - git merge release-5.xx.yy + git merge release-5.X.Y git push - git branch -d release-5.xx.yy + git branch -d release-5.X.Y Note: The merge will create a merge commit if other changes have been pushed to blead while you've been working on your release branch. Do NOT rebase your @@ -1248,7 +1268,7 @@ Now that you've shipped the new perl release to PAUSE and pushed your changes to the Perl master repository, it's time to publish the tag you created earlier too (e.g.): - $ git push origin tag v5.11.0 + $ git push origin tag v5.X.Y =head3 update epigraphs.pod @@ -1264,8 +1284,9 @@ why you chose that particular quote for your epigraph. =head3 update the link to the latest perl on perlweb -Submit a pull request to L to update the -link in F to point to your release. +Submit a pull request to L. For a dev +release, update the link in F. For a stable +release, update F. =for checklist skip RC @@ -1425,8 +1446,8 @@ the commit tagged as the current release. Assuming you're using git 1.7.x or newer: - $ git checkout -b maint-5.12 v5.12.0 - $ git push origin -u maint-5.12 + $ git checkout -b maint-5.X v5.X.0 + $ git push origin -u maint-5.X =for checklist skip BLEAD-POINT MAINT RC @@ -1555,7 +1576,7 @@ about blead's current version. Commit and push your changes. $ git add -u - $ git commit -m "Prepare Module::Corelist for 5.XX.Y" + $ git commit -m "Prepare Module::Corelist for 5.X.Y" $ git push origin =back @@ -1603,6 +1624,18 @@ Go over your notes from the release (you did take some, right?) and update F with any fixes or information that will make life easier for the next release manager. +=head3 For a BLEAD-POINT .0 release + +This is the time for the project to decide the fate and begin to +implement the required changes for experimental/deprecated features and +API elements for the next BLEAD-FINAL, a year away. + +Fortunately your job is not to do this yourself, but merely to remind +people that this needs to get done. Send email to +L. All of L, +L, F, L, and L need to +be considered. + =for checklist end =head1 SOURCE @@ -1612,4 +1645,3 @@ L, plus a whole bunch of other sources, including private correspondence. =cut - diff --git a/gnu/usr.bin/perl/Porting/release_schedule.pod b/gnu/usr.bin/perl/Porting/release_schedule.pod index a7ceb8f46..304f3fbed 100644 --- a/gnu/usr.bin/perl/Porting/release_schedule.pod +++ b/gnu/usr.bin/perl/Porting/release_schedule.pod @@ -11,15 +11,15 @@ release schedules for the next, current and previous stable versions of Perl. Dates with two or more question marks will only be releases if deemed necessary by the Steering Council. +=head2 Perl 5.36 + + 2022-05-27 5.36.0 ✓ Ricardo Signes + 2022-04-23 5.36.1 Steve Hay + =head2 Perl 5.34 - 2021-05-20 5.34.0 ✓ Sawyer X - 2022-03-13 5.34.1 ✓ Steve Hay - -=head2 Perl 5.32 - - 2020-06-20 5.32.0 ✓ Sawyer X - 2021-01-23 5.32.1 ✓ Steve Hay + 2021-05-20 5.34.0 ✓ Sawyer X + 2022-03-13 5.34.1 ✓ Steve Hay =head1 DEVELOPMENT RELEASE SCHEDULE @@ -35,23 +35,23 @@ When shipping a release, you should include the schedule for (at least) the next four releases. If a stable version of Perl is released, you should reset the version numbers to the next blead series. -=head2 Perl 5.35 +=head2 Perl 5.37 - 2021-05-20 5.35.0 ✓ Ricardo Signes - 2021-06-20 5.35.1 ✓ Max Maischein - 2021-07-20 5.35.2 ✓ Neil Bowers - 2021-08-20 5.35.3 ✓ Karen Etheridge - 2021-09-20 5.35.4 ✓ Matthew Horsfall - 2021-10-20 5.35.5 ✓ Leon Timmermans - 2021-11-20 5.35.6 ✓ Richard Leach - 2021-12-20 5.35.7 ✓ Neil Bowers - 2022-01-20 5.35.8 ✓ Nicolas R - 2022-02-20 5.35.9 ✓ Renee Contentious changes freeze - 2022-03-20 5.35.10 ✓ Sawyer X User-visible changes to - correctly functioning programs - freeze - 2022-04-20 5.35.11 ✓ Steve Hay Full code freeze - 2022-05-20 5.36.0 Ricardo New perl! + 2022-05-27 5.37.0 ✓ Ricardo Signes + 2022-06-20 5.37.1 ✓ Matthew Horsfall + 2022-07-20 5.37.2 ✓ Nicolas R + 2022-08-20 5.37.3 ✓ Neil Bowers + 2022-09-20 5.37.4 ✓ Karen Etheridge + 2022-10-20 5.37.5 ✓ Todd Rinaldo + 2022-11-20 5.37.6 ✓ Max Maischein + 2022-12-20 5.37.7 ✓ Richard Leach + 2023-01-20 5.37.8 ✓ Renée Bäcker + 2023-02-20 5.37.9 ✓ Karen Etheridge Contentious changes freeze + 2023-03-20 5.37.10 ✓ Yves Orton User-visible changes to + correctly functioning + programs freeze + 2023-04-20 5.37.11 ✓ Steve Hay Full code freeze + 2023-05-20 5.38.0 Ricardo Signes New perl! =head1 VICTIMS diff --git a/gnu/usr.bin/perl/Porting/todo.pod b/gnu/usr.bin/perl/Porting/todo.pod index a775b2012..adb6fe0c9 100644 --- a/gnu/usr.bin/perl/Porting/todo.pod +++ b/gnu/usr.bin/perl/Porting/todo.pod @@ -486,7 +486,7 @@ Natively 64-bit systems need neither -Duse64bitint nor -Duse64bitall. On these systems, it might be the default compilation mode, and there is currently no guarantee that passing no use64bitall option to the Configure process will build a 32bit perl. Implementing -Duse32bit* -options would be nice for perl 5.36.0. +options would be nice for perl 5.36.1. =head2 Profile Perl - am I hot or not? @@ -1183,7 +1183,7 @@ L =head1 Big projects Tasks that will get your name mentioned in the description of the "Highlights -of 5.36.0" +of 5.36.1" =head2 make ithreads more robust diff --git a/gnu/usr.bin/perl/README b/gnu/usr.bin/perl/README index 75628f153..7dd3a2db5 100644 --- a/gnu/usr.bin/perl/README +++ b/gnu/usr.bin/perl/README @@ -1,7 +1,5 @@ -Perl is Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, -2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 -by Larry Wall and others. +Perl is Copyright (C) 1993 - 2023 by Larry Wall and others. + All rights reserved. diff --git a/gnu/usr.bin/perl/README.haiku b/gnu/usr.bin/perl/README.haiku index cd142d032..b052a7296 100644 --- a/gnu/usr.bin/perl/README.haiku +++ b/gnu/usr.bin/perl/README.haiku @@ -22,9 +22,9 @@ The build procedure is completely standard: Make perl executable and create a symlink for libperl: chmod a+x /boot/common/bin/perl - cd /boot/common/lib; ln -s perl5/5.36.0/BePC-haiku/CORE/libperl.so . + cd /boot/common/lib; ln -s perl5/5.36.1/BePC-haiku/CORE/libperl.so . -Replace C<5.36.0> with your respective version of Perl. +Replace C<5.36.1> with your respective version of Perl. =head1 KNOWN PROBLEMS diff --git a/gnu/usr.bin/perl/README.macosx b/gnu/usr.bin/perl/README.macosx index 407b01d2b..06566f694 100644 --- a/gnu/usr.bin/perl/README.macosx +++ b/gnu/usr.bin/perl/README.macosx @@ -10,9 +10,9 @@ perlmacosx - Perl under Mac OS X This document briefly describes Perl under Mac OS X. - curl -O https://www.cpan.org/src/perl-5.36.0.tar.gz - tar -xzf perl-5.36.0.tar.gz - cd perl-5.36.0 + curl -O https://www.cpan.org/src/perl-5.36.1.tar.gz + tar -xzf perl-5.36.1.tar.gz + cd perl-5.36.1 ./Configure -des -Dprefix=/usr/local/ make make test @@ -20,7 +20,7 @@ This document briefly describes Perl under Mac OS X. =head1 DESCRIPTION -The latest Perl release (5.36.0 as of this writing) builds without changes +The latest Perl release (5.36.1 as of this writing) builds without changes under all versions of Mac OS X from 10.3 "Panther" onwards. In order to build your own version of Perl you will need 'make', diff --git a/gnu/usr.bin/perl/README.os2 b/gnu/usr.bin/perl/README.os2 index a3fe1dfc8..1f2b0201e 100644 --- a/gnu/usr.bin/perl/README.os2 +++ b/gnu/usr.bin/perl/README.os2 @@ -619,7 +619,7 @@ C in F, see L">. =item Additional Perl modules - unzip perl_ste.zip -d f:/perllib/lib/site_perl/5.36.0/ + unzip perl_ste.zip -d f:/perllib/lib/site_perl/5.36.1/ Same remark as above applies. Additionally, if this directory is not one of directories on @INC (and @INC is influenced by C), you diff --git a/gnu/usr.bin/perl/README.vms b/gnu/usr.bin/perl/README.vms index 0981579fa..700777827 100644 --- a/gnu/usr.bin/perl/README.vms +++ b/gnu/usr.bin/perl/README.vms @@ -137,11 +137,11 @@ You may need to set up a foreign symbol for the unpacking utility of choice. Once you have done so, use a command like the following to unpack the archive: - vmstar -xvf perl-5^.36^.0.tar + vmstar -xvf perl-5^.36^.1.tar Then set default to the top-level source directory like so: - set default [.perl-5^.36^.0] + set default [.perl-5^.36^.1] and proceed with configuration as described in the next section. diff --git a/gnu/usr.bin/perl/configure.com b/gnu/usr.bin/perl/configure.com index 1ea419785..e9001adae 100644 --- a/gnu/usr.bin/perl/configure.com +++ b/gnu/usr.bin/perl/configure.com @@ -1160,8 +1160,7 @@ $! base name early because not all questions are worth asking on all $! platforms. $! $! Please use F$ELEMENT(0,"-",archname) .EQS. "VMS_AXP" (or -$! "VMS_IA64") from here on to allow cross-platform configuration (e.g. -$! configure a IA64 build on an Alpha). +$! "VMS_IA64", "VMS_x86_64", etc.) from here on to query the current architecture. $! $ IF (F$GETSYI("HW_MODEL") .LT. 1024 .AND. F$GETSYI("HW_MODEL") .GT. 0) $ THEN @@ -1171,16 +1170,15 @@ $ exit 44 $ ELSE $ IF (F$GETSYI("ARCH_TYPE") .EQ. 2) $ THEN -$ archname = "VMS_AXP" -$ otherarch = "IA64" +$ archname = "VMS_AXP" ! oops, F$GETSYI("ARCH_NAME") gives us 'Alpha' not 'AXP' $ arch_type = "ARCH-TYPE=__AXP__" $ ELSE -$ archname = "VMS_IA64" -$ otherarch = "Alpha" -$ arch_type = "ARCH-TYPE=__IA64__" +$! This works for Itanium and x86_64 and hopefully whatever's next (AARCH64? RISC-V?) +$ archname = "VMS_" + F$GETSYI("ARCH_NAME") +$ arch_type = "ARCH-TYPE=__" + F$GETSYI("ARCH_NAME") + "__" $ ENDIF -$ alignbytes="8" $ ENDIF +$ alignbytes="8" $! $!: set the base revision $ baserev="5.0" diff --git a/gnu/usr.bin/perl/cpan/OpenBSD-Unveil/t/OpenBSD-Unveil.t b/gnu/usr.bin/perl/cpan/OpenBSD-Unveil/t/OpenBSD-Unveil.t index 6fd3c2fdb..a38a2f460 100644 --- a/gnu/usr.bin/perl/cpan/OpenBSD-Unveil/t/OpenBSD-Unveil.t +++ b/gnu/usr.bin/perl/cpan/OpenBSD-Unveil/t/OpenBSD-Unveil.t @@ -1,4 +1,4 @@ -# $OpenBSD: OpenBSD-Unveil.t,v 1.1 2019/07/09 20:41:54 afresh1 Exp $ # +# $OpenBSD: OpenBSD-Unveil.t,v 1.2 2023/07/07 02:07:35 afresh1 Exp $ # ## no critic 'version' ## no critic 'package' # Before 'make install' is performed this script should be runnable with @@ -82,47 +82,58 @@ sub xsunveil_ok ($$) ## no critic 'prototypes' xsunveil_ok "Basic Usage" => sub { - ok OpenBSD::Unveil::_unveil('/dev/random', 'r'), - "Unveiled /dev/random r"; + my $tmpfile = File::Temp->new("OpenBSD-Unveil-XXXXXXXXX", TMPDIR => 1); + $tmpfile->printflush("This is a test\n"); + + ok OpenBSD::Unveil::_unveil("$tmpfile", 'r'), + "Unveiled tempfile r"; ok OpenBSD::Unveil::_unveil('/dev/null', 'wc'), "Unvailed /dev/null wc"; - ok !-e '/dev/zero', "Can't see /dev/zero"; - ok !-w '/dev/random', "Can't write to /dev/random"; - ok !-r '/dev/null', "Can't read from /dev/null"; - - ok open(my $rfh, '<', '/dev/random'), "Opened /dev/random for reading"; - ok read( $rfh, my $data, 64), "Read from /dev/random"; - ok close($rfh), "Closed /dev/random"; - { ok open(my $wfh, '>', '/dev/null'), - "Opened /dev/null for writing"; - ok print($wfh $data), "Printed to /dev/null"; - ok close($wfh), "Closed /dev/null"; + "Opened /dev/null for writing"; + ok print($wfh "Test\n"), "Printed to /dev/null"; + ok close($wfh), "Closed /dev/null"; } ok OpenBSD::Unveil::_unveil('/dev/null', 'w'), "Unvailed /dev/null w"; ok OpenBSD::Unveil::_unveil(), - "locked unveil"; + "locked unveil"; + + ok !-e '/dev/zero', "Stat says we can't see /dev/zero"; + ok -w $tmpfile, "Stat says we can write to tempfile"; + ok !-r '/dev/null', "Stat says we can't read from /dev/null"; { ok sysopen(my $wfh, '/dev/null', O_WRONLY), "Sysopened /dev/null for writing"; - ok syswrite($wfh, $data), "Wrote to /dev/null"; + ok syswrite($wfh, "Test\n"), "Wrote to /dev/null"; ok close($wfh), "Closed /dev/null"; } + { + ok open(my $rfh, '<', $tmpfile), "Opened tempfile for reading"; + ok read( $rfh, my $data, 64), "Read from tempfile"; + ok close($rfh), "Closed tempfile"; + } + + { + ok !open(my $wfh, '>', $tmpfile), + "Unable to 'open' tempfile for writing"; + is $!, 'Permission denied', "Expected ERRNO from open"; + } + { ok !open(my $wfh, '>', '/dev/null'), - "Unable to 'open' without 'create'"; + "Unable to 'open' /dev/null without 'create'"; + is $!, 'Permission denied', "Expected ERRNO from open"; } }; xsunveil_ok "Invalid Path" => sub { - chdir "/tmp" or die "Unable to chdir to /tmp"; - my $dir = File::Temp->newdir('OpenBSD-Unveil-XXXXXXXXX'); + my $dir = File::Temp->newdir('OpenBSD-Unveil-XXXXXXXXX', TMPDIR => 1); ok !OpenBSD::Unveil::_unveil("$dir/nonexist/file", 'r'), "Unable to unveil with incorrect permissions"; is $!, 'No such file or directory', "Expected ERRNO from _unveil"; diff --git a/gnu/usr.bin/perl/dist/Module-CoreList/Changes b/gnu/usr.bin/perl/dist/Module-CoreList/Changes index c5ebcdade..080989410 100644 --- a/gnu/usr.bin/perl/dist/Module-CoreList/Changes +++ b/gnu/usr.bin/perl/dist/Module-CoreList/Changes @@ -1,3 +1,42 @@ +5.20230423 + - Updated for v5.36.1 + +5.20230420 + - Updated for v5.37.11 + +5.20230320 + - Updated for v5.37.10 + +5.20230220 + - Updated for v5.37.9 + +5.20230120 + - Updated for v5.37.8 + +5.20221220 + - Updated for v5.37.7 + +5.20221120 + - Updated for v5.37.6 + +5.20221024 + - Updated for v5.37.6 + +5.20221020 + - Updated for v5.37.5 + +5.20220920 + - Updated for v5.37.4 + +5.20220820 + - Updated for v5.37.3 + +5.20220720 + - Updated for v5.37.2 + +5.20220620 + - Updated for v5.37.1 + 5.20220520 - Updated for v5.35.12 diff --git a/gnu/usr.bin/perl/dist/Module-CoreList/Makefile.PL b/gnu/usr.bin/perl/dist/Module-CoreList/Makefile.PL index 03e716525..6f1a674f7 100644 --- a/gnu/usr.bin/perl/dist/Module-CoreList/Makefile.PL +++ b/gnu/usr.bin/perl/dist/Module-CoreList/Makefile.PL @@ -8,7 +8,7 @@ push @extra, 'INSTALLDIRS' => 'perl' if $] >= 5.008009 and $] < 5.012; push @extra, 'META_MERGE' => { resources => { - repository => 'git://github.com/Perl/perl5.git', + repository => 'https://github.com/Perl/perl5.git', bugtracker => 'https://github.com/Perl/perl5/issues', homepage => "http://dev.perl.org/", }, diff --git a/gnu/usr.bin/perl/dist/Module-CoreList/lib/Module/CoreList.pm b/gnu/usr.bin/perl/dist/Module-CoreList/lib/Module/CoreList.pm index 29f815c49..4d6d4466e 100644 --- a/gnu/usr.bin/perl/dist/Module-CoreList/lib/Module/CoreList.pm +++ b/gnu/usr.bin/perl/dist/Module-CoreList/lib/Module/CoreList.pm @@ -4,7 +4,7 @@ use strict; our ( %released, %version, %families, %upstream, %bug_tracker, %deprecated, %delta ); use version; -our $VERSION = '5.20220520'; +our $VERSION = '5.20230423'; sub PKG_PATTERN () { q#\A[a-zA-Z_][0-9a-zA-Z_]*(?:(::|')[0-9a-zA-Z_]+)*\z# } sub _looks_like_invocant ($) { local $@; !!eval { $_[0]->isa(__PACKAGE__) } } @@ -392,6 +392,19 @@ sub changes_between { 5.035010 => '2022-03-20', 5.035011 => '2022-04-20', 5.036000 => '2022-05-27', + 5.037000 => '2022-05-27', + 5.037001 => '2022-06-20', + 5.037002 => '2022-07-20', + 5.037003 => '2022-08-20', + 5.037004 => '2022-09-20', + 5.037005 => '2022-10-20', + 5.037006 => '2022-11-20', + 5.037007 => '2022-12-20', + 5.037008 => '2023-01-20', + 5.037009 => '2023-02-20', + 5.037010 => '2023-03-20', + 5.037011 => '2023-04-20', + 5.036001 => '2023-04-23', ); for my $version ( sort { $a <=> $b } keys %released ) { @@ -19430,6 +19443,852 @@ for my $version ( sort { $a <=> $b } keys %released ) { removed => { } }, + 5.037000 => { + delta_from => 5.036000, + changed => { + 'feature' => '1.73', + 'Module::CoreList' => '5.20220527', + 'Module::CoreList::Utils'=> '5.20220527', + }, + removed => { + } + }, + 5.037001 => { + delta_from => 5.037000, + changed => { + 'B' => '1.84', + 'B::Op_private' => '5.037001', + 'Carp' => '1.53', + 'Carp::Heavy' => '1.53', + 'Config' => '5.037001', + 'Cwd' => '3.85', + 'Data::Dumper' => '2.185', + 'ExtUtils::CBuilder' => '0.280237', + 'ExtUtils::CBuilder::Base'=> '0.280237', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280237', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280237', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280237', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280237', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280237', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280237', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280237', + 'ExtUtils::CBuilder::Platform::android'=> '0.280237', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280237', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280237', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280237', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280237', + 'ExtUtils::Miniperl' => '1.12', + 'File::Spec' => '3.85', + 'File::Spec::AmigaOS' => '3.85', + 'File::Spec::Cygwin' => '3.85', + 'File::Spec::Epoc' => '3.85', + 'File::Spec::Functions' => '3.85', + 'File::Spec::Mac' => '3.85', + 'File::Spec::OS2' => '3.85', + 'File::Spec::Unix' => '3.85', + 'File::Spec::VMS' => '3.85', + 'File::Spec::Win32' => '3.85', + 'FileHandle' => '2.04', + 'GDBM_File' => '1.24', + 'IO::Handle' => '1.49', + 'IO::Pipe' => '1.50', + 'IO::Socket::INET' => '1.50', + 'IO::Socket::UNIX' => '1.50', + 'Module::CoreList' => '5.20220620', + 'Module::CoreList::Utils'=> '5.20220620', + 'ODBM_File' => '1.18', + 'OS2::REXX' => '1.06', + 'Opcode' => '1.58', + 'POSIX' => '2.04', + 'SDBM_File' => '1.16', + 'Unicode::Normalize' => '1.32', + 'XS::APItest' => '1.23', + 'builtin' => '0.007', + 'encoding::warnings' => '0.14', + 'feature' => '1.74', + 'threads' => '2.28', + }, + removed => { + } + }, + 5.037002 => { + delta_from => 5.037001, + changed => { + 'B' => '1.85', + 'B::Concise' => '1.007', + 'B::Deparse' => '1.65', + 'B::Op_private' => '5.037002', + 'CPAN' => '2.34', + 'CPAN::Distribution' => '2.34', + 'Compress::Raw::Bzip2' => '2.201', + 'Compress::Raw::Zlib' => '2.202', + 'Compress::Zlib' => '2.201', + 'Config' => '5.037002', + 'Cwd' => '3.86', + 'DB_File' => '1.858', + 'Data::Dumper' => '2.186', + 'Encode' => '3.18', + 'Encode::MIME::Header' => '2.29', + 'File::Glob' => '1.38', + 'File::Spec' => '3.86', + 'File::Spec::AmigaOS' => '3.86', + 'File::Spec::Cygwin' => '3.86', + 'File::Spec::Epoc' => '3.86', + 'File::Spec::Functions' => '3.86', + 'File::Spec::Mac' => '3.86', + 'File::Spec::OS2' => '3.86', + 'File::Spec::Unix' => '3.86', + 'File::Spec::VMS' => '3.86', + 'File::Spec::Win32' => '3.86', + 'Filter::Util::Call' => '1.61', + 'Hash::Util' => '0.29', + 'I18N::LangTags::List' => '0.41', + 'IO::Compress::Adapter::Bzip2'=> '2.201', + 'IO::Compress::Adapter::Deflate'=> '2.201', + 'IO::Compress::Adapter::Identity'=> '2.201', + 'IO::Compress::Base' => '2.201', + 'IO::Compress::Base::Common'=> '2.201', + 'IO::Compress::Bzip2' => '2.201', + 'IO::Compress::Deflate' => '2.201', + 'IO::Compress::Gzip' => '2.201', + 'IO::Compress::Gzip::Constants'=> '2.201', + 'IO::Compress::RawDeflate'=> '2.201', + 'IO::Compress::Zip' => '2.201', + 'IO::Compress::Zip::Constants'=> '2.201', + 'IO::Compress::Zlib::Constants'=> '2.201', + 'IO::Compress::Zlib::Extra'=> '2.201', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.201', + 'IO::Uncompress::Adapter::Identity'=> '2.201', + 'IO::Uncompress::Adapter::Inflate'=> '2.201', + 'IO::Uncompress::AnyInflate'=> '2.201', + 'IO::Uncompress::AnyUncompress'=> '2.201', + 'IO::Uncompress::Base' => '2.201', + 'IO::Uncompress::Bunzip2'=> '2.201', + 'IO::Uncompress::Gunzip'=> '2.201', + 'IO::Uncompress::Inflate'=> '2.201', + 'IO::Uncompress::RawInflate'=> '2.201', + 'IO::Uncompress::Unzip' => '2.201', + 'JSON::PP' => '4.10', + 'JSON::PP::Boolean' => '4.10', + 'Math::BigFloat' => '1.999837', + 'Math::BigFloat::Trace' => '0.66', + 'Math::BigInt' => '1.999837', + 'Math::BigInt::Calc' => '1.999837', + 'Math::BigInt::FastCalc'=> '0.5013', + 'Math::BigInt::Lib' => '1.999837', + 'Math::BigInt::Trace' => '0.66', + 'Math::BigRat' => '0.2624', + 'Math::BigRat::Trace' => '0.66', + 'Module::CoreList' => '5.20220720', + 'Module::CoreList::Utils'=> '5.20220720', + 'Opcode' => '1.59', + 'PerlIO::via::QuotedPrint'=> '0.10', + 'Pod::Checker' => '1.75', + 'Pod::Usage' => '2.03', + 'Socket' => '2.035', + 'Storable' => '3.27', + 'Test2' => '1.302191', + 'Test2::API' => '1.302191', + 'Test2::API::Breakage' => '1.302191', + 'Test2::API::Context' => '1.302191', + 'Test2::API::Instance' => '1.302191', + 'Test2::API::InterceptResult'=> '1.302191', + 'Test2::API::InterceptResult::Event'=> '1.302191', + 'Test2::API::InterceptResult::Facet'=> '1.302191', + 'Test2::API::InterceptResult::Hub'=> '1.302191', + 'Test2::API::InterceptResult::Squasher'=> '1.302191', + 'Test2::API::Stack' => '1.302191', + 'Test2::Event' => '1.302191', + 'Test2::Event::Bail' => '1.302191', + 'Test2::Event::Diag' => '1.302191', + 'Test2::Event::Encoding'=> '1.302191', + 'Test2::Event::Exception'=> '1.302191', + 'Test2::Event::Fail' => '1.302191', + 'Test2::Event::Generic' => '1.302191', + 'Test2::Event::Note' => '1.302191', + 'Test2::Event::Ok' => '1.302191', + 'Test2::Event::Pass' => '1.302191', + 'Test2::Event::Plan' => '1.302191', + 'Test2::Event::Skip' => '1.302191', + 'Test2::Event::Subtest' => '1.302191', + 'Test2::Event::TAP::Version'=> '1.302191', + 'Test2::Event::V2' => '1.302191', + 'Test2::Event::Waiting' => '1.302191', + 'Test2::EventFacet' => '1.302191', + 'Test2::EventFacet::About'=> '1.302191', + 'Test2::EventFacet::Amnesty'=> '1.302191', + 'Test2::EventFacet::Assert'=> '1.302191', + 'Test2::EventFacet::Control'=> '1.302191', + 'Test2::EventFacet::Error'=> '1.302191', + 'Test2::EventFacet::Hub'=> '1.302191', + 'Test2::EventFacet::Info'=> '1.302191', + 'Test2::EventFacet::Info::Table'=> '1.302191', + 'Test2::EventFacet::Meta'=> '1.302191', + 'Test2::EventFacet::Parent'=> '1.302191', + 'Test2::EventFacet::Plan'=> '1.302191', + 'Test2::EventFacet::Render'=> '1.302191', + 'Test2::EventFacet::Trace'=> '1.302191', + 'Test2::Formatter' => '1.302191', + 'Test2::Formatter::TAP' => '1.302191', + 'Test2::Hub' => '1.302191', + 'Test2::Hub::Interceptor'=> '1.302191', + 'Test2::Hub::Interceptor::Terminator'=> '1.302191', + 'Test2::Hub::Subtest' => '1.302191', + 'Test2::IPC' => '1.302191', + 'Test2::IPC::Driver' => '1.302191', + 'Test2::IPC::Driver::Files'=> '1.302191', + 'Test2::Tools::Tiny' => '1.302191', + 'Test2::Util' => '1.302191', + 'Test2::Util::ExternalMeta'=> '1.302191', + 'Test2::Util::Facets2Legacy'=> '1.302191', + 'Test2::Util::HashBase' => '1.302191', + 'Test2::Util::Trace' => '1.302191', + 'Test::Builder' => '1.302191', + 'Test::Builder::Formatter'=> '1.302191', + 'Test::Builder::Module' => '1.302191', + 'Test::Builder::Tester' => '1.302191', + 'Test::Builder::Tester::Color'=> '1.302191', + 'Test::Builder::TodoDiag'=> '1.302191', + 'Test::More' => '1.302191', + 'Test::Simple' => '1.302191', + 'Test::Tester' => '1.302191', + 'Test::Tester::Capture' => '1.302191', + 'Test::Tester::CaptureRunner'=> '1.302191', + 'Test::Tester::Delegate'=> '1.302191', + 'Test::use::ok' => '1.302191', + 'Text::Balanced' => '2.06', + 'XS::APItest' => '1.24', + 'bigfloat' => '0.66', + 'bigint' => '0.66', + 'bignum' => '0.66', + 'bigrat' => '0.66', + 'builtin' => '0.008', + 'feature' => '1.75', + 'ok' => '1.302191', + 'threads::shared' => '1.65', + }, + removed => { + } + }, + 5.037003 => { + delta_from => 5.037002, + changed => { + 'B' => '1.86', + 'B::Deparse' => '1.68', + 'B::Op_private' => '5.037003', + 'Config' => '5.037003', + 'Digest::SHA' => '6.03', + 'DynaLoader' => '1.53', + 'Encode' => '3.19', + 'Encode::Alias' => '2.25', + 'ExtUtils::PL2Bat' => '0.005', + 'File::Find' => '1.41', + 'Filter::Util::Call' => '1.64', + 'HTTP::Tiny' => '0.082', + 'JSON::PP' => '4.11', + 'JSON::PP::Boolean' => '4.11', + 'List::Util' => '1.63', + 'List::Util::XS' => '1.63', + 'Memoize' => '1.10', + 'Memoize::AnyDBM_File' => '1.10', + 'Memoize::Expire' => '1.10', + 'Memoize::NDBM_File' => '1.10', + 'Memoize::SDBM_File' => '1.10', + 'Memoize::Storable' => '1.10', + 'Module::CoreList' => '5.20220820', + 'Module::CoreList::Utils'=> '5.20220820', + 'NDBM_File' => '1.16', + 'Opcode' => '1.60', + 'Scalar::Util' => '1.63', + 'Socket' => '2.036', + 'Sub::Util' => '1.63', + 'XS::APItest' => '1.25', + 'attributes' => '0.35', + 'threads' => '2.29', + }, + removed => { + 'Memoize::ExpireFile' => 1, + 'Memoize::ExpireTest' => 1, + } + }, + 5.037004 => { + delta_from => 5.037003, + changed => { + 'B::Deparse' => '1.69', + 'B::Op_private' => '5.037004', + 'Carp' => '1.54', + 'Carp::Heavy' => '1.54', + 'Class::Struct' => '0.67', + 'Config' => '5.037004', + 'Config::Perl::V' => '0.34', + 'Errno' => '1.37', + 'ExtUtils::ParseXS' => '3.46', + 'ExtUtils::ParseXS::Constants'=> '3.46', + 'ExtUtils::ParseXS::CountLines'=> '3.46', + 'ExtUtils::ParseXS::Eval'=> '3.46', + 'ExtUtils::ParseXS::Utilities'=> '3.46', + 'ExtUtils::Typemaps' => '3.46', + 'ExtUtils::Typemaps::Cmd'=> '3.46', + 'ExtUtils::Typemaps::InputMap'=> '3.46', + 'ExtUtils::Typemaps::OutputMap'=> '3.46', + 'ExtUtils::Typemaps::Type'=> '3.46', + 'File::Basename' => '2.86', + 'File::Copy' => '2.40', + 'File::Spec' => '3.87', + 'File::stat' => '1.13', + 'FileHandle' => '2.05', + 'Hash::Util' => '0.30', + 'I18N::Langinfo' => '0.22', + 'IO' => '1.51', + 'IO::Dir' => '1.51', + 'IO::File' => '1.51', + 'IO::Handle' => '1.51', + 'IO::Pipe' => '1.51', + 'IO::Poll' => '1.51', + 'IO::Seekable' => '1.51', + 'IO::Select' => '1.51', + 'IO::Socket' => '1.51', + 'IO::Socket::INET' => '1.51', + 'IO::Socket::UNIX' => '1.51', + 'Locale::Maketext' => '1.32', + 'Module::CoreList' => '5.20220920', + 'Module::CoreList::Utils'=> '5.20220920', + 'Net::protoent' => '1.02', + 'Net::servent' => '1.03', + 'Opcode' => '1.61', + 'POSIX' => '2.06', + 'Safe' => '2.44', + 'Sys::Hostname' => '1.25', + 'Time::HiRes' => '1.9771', + 'User::grent' => '1.04', + 'User::pwent' => '1.02', + 'XS::APItest' => '1.26', + 'XSLoader' => '0.32', + 'feature' => '1.76', + }, + removed => { + } + }, + 5.037005 => { + delta_from => 5.037004, + changed => { + 'B::Deparse' => '1.70', + 'B::Op_private' => '5.037005', + 'Config' => '5.037005', + 'JSON::PP' => '4.12', + 'JSON::PP::Boolean' => '4.12', + 'Math::Complex' => '1.5903', + 'Math::Trig' => '1.2301', + 'Memoize' => '1.14', + 'Memoize::AnyDBM_File' => '1.14', + 'Memoize::Expire' => '1.14', + 'Memoize::NDBM_File' => '1.14', + 'Memoize::SDBM_File' => '1.14', + 'Memoize::Storable' => '1.14', + 'Module::CoreList' => '5.20221020', + 'Module::CoreList::Utils'=> '5.20221020', + 'Net::Ping' => '2.75', + 'POSIX' => '2.07', + 'Unicode' => '15.0.0', + 'threads' => '2.31', + 'warnings' => '1.59', + }, + removed => { + } + }, + 5.037006 => { + delta_from => 5.037005, + changed => { + 'Attribute::Handlers' => '1.03', + 'B' => '1.87', + 'B::Deparse' => '1.71', + 'B::Op_private' => '5.037006', + 'Config' => '5.037006', + 'Data::Dumper' => '2.187', + 'Devel::PPPort' => '3.69', + 'ExtUtils::CBuilder' => '0.280238', + 'ExtUtils::CBuilder::Base'=> '0.280238', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280238', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280238', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280238', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280238', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280238', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280238', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280238', + 'ExtUtils::CBuilder::Platform::android'=> '0.280238', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280238', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280238', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280238', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280238', + 'ExtUtils::ParseXS' => '3.48', + 'ExtUtils::ParseXS::Constants'=> '3.48', + 'ExtUtils::ParseXS::CountLines'=> '3.48', + 'ExtUtils::ParseXS::Eval'=> '3.48', + 'ExtUtils::ParseXS::Utilities'=> '3.48', + 'ExtUtils::Typemaps' => '3.48', + 'ExtUtils::Typemaps::Cmd'=> '3.48', + 'ExtUtils::Typemaps::InputMap'=> '3.48', + 'ExtUtils::Typemaps::OutputMap'=> '3.48', + 'ExtUtils::Typemaps::Type'=> '3.48', + 'Getopt::Long' => '2.54', + 'Memoize' => '1.15', + 'Memoize::AnyDBM_File' => '1.15', + 'Memoize::Expire' => '1.15', + 'Memoize::NDBM_File' => '1.15', + 'Memoize::SDBM_File' => '1.15', + 'Memoize::Storable' => '1.15', + 'Module::CoreList' => '5.20221120', + 'Module::CoreList::Utils'=> '5.20221120', + 'Opcode' => '1.62', + 'POSIX' => '2.08', + 'Storable' => '3.28', + 'Time::HiRes' => '1.9772', + 'XS::APItest' => '1.27', + 'experimental' => '0.029', + 'feature' => '1.77', + 'overload' => '1.36', + 'threads' => '2.32', + 'utf8' => '1.25', + 'warnings' => '1.61', + }, + removed => { + } + }, + 5.037007 => { + delta_from => 5.037006, + changed => { + 'B::Deparse' => '1.72', + 'B::Op_private' => '5.037007', + 'Config' => '5.037007', + 'Cwd' => '3.88', + 'ExtUtils::Miniperl' => '1.13', + 'ExtUtils::ParseXS' => '3.49', + 'ExtUtils::ParseXS::Constants'=> '3.49', + 'ExtUtils::ParseXS::CountLines'=> '3.49', + 'ExtUtils::ParseXS::Eval'=> '3.49', + 'ExtUtils::ParseXS::Utilities'=> '3.49', + 'ExtUtils::Typemaps' => '3.49', + 'ExtUtils::Typemaps::Cmd'=> '3.49', + 'ExtUtils::Typemaps::InputMap'=> '3.49', + 'ExtUtils::Typemaps::OutputMap'=> '3.49', + 'ExtUtils::Typemaps::Type'=> '3.49', + 'File::Glob' => '1.39', + 'File::Spec' => '3.88', + 'File::Spec::AmigaOS' => '3.88', + 'File::Spec::Cygwin' => '3.88', + 'File::Spec::Epoc' => '3.88', + 'File::Spec::Functions' => '3.88', + 'File::Spec::Mac' => '3.88', + 'File::Spec::OS2' => '3.88', + 'File::Spec::Unix' => '3.88', + 'File::Spec::VMS' => '3.88', + 'File::Spec::Win32' => '3.88', + 'Module::CoreList' => '5.20221220', + 'Module::CoreList::Utils'=> '5.20221220', + 'Opcode' => '1.63', + 'POSIX' => '2.10', + 'Pod::Html' => '1.34', + 'Pod::Html::Util' => '1.34', + 'Pod::Man' => '5.00', + 'Pod::ParseLink' => '5.00', + 'Pod::Text' => '5.00', + 'Pod::Text::Color' => '5.00', + 'Pod::Text::Overstrike' => '5.00', + 'Pod::Text::Termcap' => '5.00', + 'XS::APItest' => '1.28', + 'experimental' => '0.030', + 'feature' => '1.78', + 'parent' => '0.239', + 'threads' => '2.33', + }, + removed => { + } + }, + 5.037008 => { + delta_from => 5.037007, + changed => { + 'B::Op_private' => '5.037008', + 'Config' => '5.037008', + 'Config::Perl::V' => '0.35', + 'ExtUtils::Command' => '7.66', + 'ExtUtils::Command::MM' => '7.66', + 'ExtUtils::Install' => '2.22', + 'ExtUtils::Installed' => '2.22', + 'ExtUtils::Liblist' => '7.66', + 'ExtUtils::Liblist::Kid'=> '7.66', + 'ExtUtils::MM' => '7.66', + 'ExtUtils::MM_AIX' => '7.66', + 'ExtUtils::MM_Any' => '7.66', + 'ExtUtils::MM_BeOS' => '7.66', + 'ExtUtils::MM_Cygwin' => '7.66', + 'ExtUtils::MM_DOS' => '7.66', + 'ExtUtils::MM_Darwin' => '7.66', + 'ExtUtils::MM_MacOS' => '7.66', + 'ExtUtils::MM_NW5' => '7.66', + 'ExtUtils::MM_OS2' => '7.66', + 'ExtUtils::MM_OS390' => '7.66', + 'ExtUtils::MM_QNX' => '7.66', + 'ExtUtils::MM_UWIN' => '7.66', + 'ExtUtils::MM_Unix' => '7.66', + 'ExtUtils::MM_VMS' => '7.66', + 'ExtUtils::MM_VOS' => '7.66', + 'ExtUtils::MM_Win32' => '7.66', + 'ExtUtils::MM_Win95' => '7.66', + 'ExtUtils::MY' => '7.66', + 'ExtUtils::MakeMaker' => '7.66', + 'ExtUtils::MakeMaker::Config'=> '7.66', + 'ExtUtils::MakeMaker::Locale'=> '7.66', + 'ExtUtils::MakeMaker::version'=> '7.66', + 'ExtUtils::MakeMaker::version::regex'=> '7.66', + 'ExtUtils::Mkbootstrap' => '7.66', + 'ExtUtils::Mksymlists' => '7.66', + 'ExtUtils::Packlist' => '2.22', + 'ExtUtils::testlib' => '7.66', + 'File::Find' => '1.42', + 'IO::Zlib' => '1.14', + 'JSON::PP' => '4.16', + 'JSON::PP::Boolean' => '4.16', + 'Math::Complex' => '1.6', + 'Math::Trig' => '1.6', + 'Module::CoreList' => '5.20230120', + 'Module::CoreList::Utils'=> '5.20230120', + 'POSIX' => '2.11', + 'Pod::Man' => '5.01', + 'Pod::ParseLink' => '5.01', + 'Pod::Text' => '5.01', + 'Pod::Text::Color' => '5.01', + 'Pod::Text::Overstrike' => '5.01', + 'Pod::Text::Termcap' => '5.01', + 'Storable' => '3.29', + 'XS::APItest' => '1.30', + 'feature' => '1.79', + 're' => '0.44', + 'threads' => '2.34', + }, + removed => { + } + }, + 5.037009 => { + delta_from => 5.037008, + changed => { + 'B' => '1.88', + 'B::Op_private' => '5.037009', + 'Compress::Raw::Bzip2' => '2.204', + 'Compress::Raw::Zlib' => '2.204', + 'Compress::Zlib' => '2.204', + 'Config' => '5.037009', + 'Devel::PPPort' => '3.70', + 'Devel::Peek' => '1.33', + 'Fatal' => '2.36', + 'File::Find' => '1.43', + 'IO::Compress::Adapter::Bzip2'=> '2.204', + 'IO::Compress::Adapter::Deflate'=> '2.204', + 'IO::Compress::Adapter::Identity'=> '2.204', + 'IO::Compress::Base' => '2.204', + 'IO::Compress::Base::Common'=> '2.204', + 'IO::Compress::Bzip2' => '2.204', + 'IO::Compress::Deflate' => '2.204', + 'IO::Compress::Gzip' => '2.204', + 'IO::Compress::Gzip::Constants'=> '2.204', + 'IO::Compress::RawDeflate'=> '2.204', + 'IO::Compress::Zip' => '2.204', + 'IO::Compress::Zip::Constants'=> '2.204', + 'IO::Compress::Zlib::Constants'=> '2.204', + 'IO::Compress::Zlib::Extra'=> '2.204', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.204', + 'IO::Uncompress::Adapter::Identity'=> '2.204', + 'IO::Uncompress::Adapter::Inflate'=> '2.204', + 'IO::Uncompress::AnyInflate'=> '2.204', + 'IO::Uncompress::AnyUncompress'=> '2.204', + 'IO::Uncompress::Base' => '2.204', + 'IO::Uncompress::Bunzip2'=> '2.204', + 'IO::Uncompress::Gunzip'=> '2.204', + 'IO::Uncompress::Inflate'=> '2.204', + 'IO::Uncompress::RawInflate'=> '2.204', + 'IO::Uncompress::Unzip' => '2.204', + 'Math::Complex' => '1.61', + 'Math::Trig' => '1.61', + 'Memoize' => '1.16', + 'Memoize::AnyDBM_File' => '1.16', + 'Memoize::Expire' => '1.16', + 'Memoize::NDBM_File' => '1.16', + 'Memoize::SDBM_File' => '1.16', + 'Memoize::Storable' => '1.16', + 'Module::CoreList' => '5.20230220', + 'Module::CoreList::Utils'=> '5.20230220', + 'Opcode' => '1.64', + 'Term::Cap' => '1.18', + 'Test2' => '1.302192', + 'Test2::API' => '1.302192', + 'Test2::API::Breakage' => '1.302192', + 'Test2::API::Context' => '1.302192', + 'Test2::API::Instance' => '1.302192', + 'Test2::API::InterceptResult'=> '1.302192', + 'Test2::API::InterceptResult::Event'=> '1.302192', + 'Test2::API::InterceptResult::Facet'=> '1.302192', + 'Test2::API::InterceptResult::Hub'=> '1.302192', + 'Test2::API::InterceptResult::Squasher'=> '1.302192', + 'Test2::API::Stack' => '1.302192', + 'Test2::Event' => '1.302192', + 'Test2::Event::Bail' => '1.302192', + 'Test2::Event::Diag' => '1.302192', + 'Test2::Event::Encoding'=> '1.302192', + 'Test2::Event::Exception'=> '1.302192', + 'Test2::Event::Fail' => '1.302192', + 'Test2::Event::Generic' => '1.302192', + 'Test2::Event::Note' => '1.302192', + 'Test2::Event::Ok' => '1.302192', + 'Test2::Event::Pass' => '1.302192', + 'Test2::Event::Plan' => '1.302192', + 'Test2::Event::Skip' => '1.302192', + 'Test2::Event::Subtest' => '1.302192', + 'Test2::Event::TAP::Version'=> '1.302192', + 'Test2::Event::V2' => '1.302192', + 'Test2::Event::Waiting' => '1.302192', + 'Test2::EventFacet' => '1.302192', + 'Test2::EventFacet::About'=> '1.302192', + 'Test2::EventFacet::Amnesty'=> '1.302192', + 'Test2::EventFacet::Assert'=> '1.302192', + 'Test2::EventFacet::Control'=> '1.302192', + 'Test2::EventFacet::Error'=> '1.302192', + 'Test2::EventFacet::Hub'=> '1.302192', + 'Test2::EventFacet::Info'=> '1.302192', + 'Test2::EventFacet::Info::Table'=> '1.302192', + 'Test2::EventFacet::Meta'=> '1.302192', + 'Test2::EventFacet::Parent'=> '1.302192', + 'Test2::EventFacet::Plan'=> '1.302192', + 'Test2::EventFacet::Render'=> '1.302192', + 'Test2::EventFacet::Trace'=> '1.302192', + 'Test2::Formatter' => '1.302192', + 'Test2::Formatter::TAP' => '1.302192', + 'Test2::Hub' => '1.302192', + 'Test2::Hub::Interceptor'=> '1.302192', + 'Test2::Hub::Interceptor::Terminator'=> '1.302192', + 'Test2::Hub::Subtest' => '1.302192', + 'Test2::IPC' => '1.302192', + 'Test2::IPC::Driver' => '1.302192', + 'Test2::IPC::Driver::Files'=> '1.302192', + 'Test2::Tools::Tiny' => '1.302192', + 'Test2::Util' => '1.302192', + 'Test2::Util::ExternalMeta'=> '1.302192', + 'Test2::Util::Facets2Legacy'=> '1.302192', + 'Test2::Util::HashBase' => '1.302192', + 'Test2::Util::Trace' => '1.302192', + 'Test::Builder' => '1.302192', + 'Test::Builder::Formatter'=> '1.302192', + 'Test::Builder::Module' => '1.302192', + 'Test::Builder::Tester' => '1.302192', + 'Test::Builder::Tester::Color'=> '1.302192', + 'Test::Builder::TodoDiag'=> '1.302192', + 'Test::More' => '1.302192', + 'Test::Simple' => '1.302192', + 'Test::Tester' => '1.302192', + 'Test::Tester::Capture' => '1.302192', + 'Test::Tester::CaptureRunner'=> '1.302192', + 'Test::Tester::Delegate'=> '1.302192', + 'Test::use::ok' => '1.302192', + 'Tie::File' => '1.07', + 'UNIVERSAL' => '1.15', + 'autodie' => '2.36', + 'autodie::Scope::Guard' => '2.36', + 'autodie::Scope::GuardStack'=> '2.36', + 'autodie::Util' => '2.36', + 'autodie::exception' => '2.36', + 'autodie::exception::system'=> '2.36', + 'autodie::hints' => '2.36', + 'autodie::skip' => '2.36', + 'experimental' => '0.031', + 'feature' => '1.80', + 'mro' => '1.28', + 'ok' => '1.302192', + 'parent' => '0.241', + 'stable' => '0.031', + 'warnings' => '1.62', + }, + removed => { + } + }, + 5.037010 => { + delta_from => 5.037009, + changed => { + 'B::Op_private' => '5.037010', + 'Benchmark' => '1.24', + 'Class::Struct' => '0.68', + 'Config' => '5.03701', + 'Config::Perl::V' => '0.36', + 'Cwd' => '3.89', + 'Data::Dumper' => '2.188', + 'Digest::SHA' => '6.04', + 'Env' => '1.06', + 'Math::Complex' => '1.62', + 'Math::Trig' => '1.62', + 'Module::CoreList' => '5.20230320', + 'Module::CoreList::Utils'=> '5.20230320', + 'Net::Cmd' => '3.15', + 'Net::Config' => '3.15', + 'Net::Domain' => '3.15', + 'Net::FTP' => '3.15', + 'Net::FTP::A' => '3.15', + 'Net::FTP::E' => '3.15', + 'Net::FTP::I' => '3.15', + 'Net::FTP::L' => '3.15', + 'Net::FTP::dataconn' => '3.15', + 'Net::NNTP' => '3.15', + 'Net::Netrc' => '3.15', + 'Net::POP3' => '3.15', + 'Net::SMTP' => '3.15', + 'Net::Time' => '3.15', + 'POSIX' => '2.12', + 'Storable' => '3.31', + 'Test2' => '1.302194', + 'Test2::API' => '1.302194', + 'Test2::API::Breakage' => '1.302194', + 'Test2::API::Context' => '1.302194', + 'Test2::API::Instance' => '1.302194', + 'Test2::API::InterceptResult'=> '1.302194', + 'Test2::API::InterceptResult::Event'=> '1.302194', + 'Test2::API::InterceptResult::Facet'=> '1.302194', + 'Test2::API::InterceptResult::Hub'=> '1.302194', + 'Test2::API::InterceptResult::Squasher'=> '1.302194', + 'Test2::API::Stack' => '1.302194', + 'Test2::Event' => '1.302194', + 'Test2::Event::Bail' => '1.302194', + 'Test2::Event::Diag' => '1.302194', + 'Test2::Event::Encoding'=> '1.302194', + 'Test2::Event::Exception'=> '1.302194', + 'Test2::Event::Fail' => '1.302194', + 'Test2::Event::Generic' => '1.302194', + 'Test2::Event::Note' => '1.302194', + 'Test2::Event::Ok' => '1.302194', + 'Test2::Event::Pass' => '1.302194', + 'Test2::Event::Plan' => '1.302194', + 'Test2::Event::Skip' => '1.302194', + 'Test2::Event::Subtest' => '1.302194', + 'Test2::Event::TAP::Version'=> '1.302194', + 'Test2::Event::V2' => '1.302194', + 'Test2::Event::Waiting' => '1.302194', + 'Test2::EventFacet' => '1.302194', + 'Test2::EventFacet::About'=> '1.302194', + 'Test2::EventFacet::Amnesty'=> '1.302194', + 'Test2::EventFacet::Assert'=> '1.302194', + 'Test2::EventFacet::Control'=> '1.302194', + 'Test2::EventFacet::Error'=> '1.302194', + 'Test2::EventFacet::Hub'=> '1.302194', + 'Test2::EventFacet::Info'=> '1.302194', + 'Test2::EventFacet::Info::Table'=> '1.302194', + 'Test2::EventFacet::Meta'=> '1.302194', + 'Test2::EventFacet::Parent'=> '1.302194', + 'Test2::EventFacet::Plan'=> '1.302194', + 'Test2::EventFacet::Render'=> '1.302194', + 'Test2::EventFacet::Trace'=> '1.302194', + 'Test2::Formatter' => '1.302194', + 'Test2::Formatter::TAP' => '1.302194', + 'Test2::Hub' => '1.302194', + 'Test2::Hub::Interceptor'=> '1.302194', + 'Test2::Hub::Interceptor::Terminator'=> '1.302194', + 'Test2::Hub::Subtest' => '1.302194', + 'Test2::IPC' => '1.302194', + 'Test2::IPC::Driver' => '1.302194', + 'Test2::IPC::Driver::Files'=> '1.302194', + 'Test2::Tools::Tiny' => '1.302194', + 'Test2::Util' => '1.302194', + 'Test2::Util::ExternalMeta'=> '1.302194', + 'Test2::Util::Facets2Legacy'=> '1.302194', + 'Test2::Util::HashBase' => '1.302194', + 'Test2::Util::Trace' => '1.302194', + 'Test::Builder' => '1.302194', + 'Test::Builder::Formatter'=> '1.302194', + 'Test::Builder::Module' => '1.302194', + 'Test::Builder::Tester' => '1.302194', + 'Test::Builder::Tester::Color'=> '1.302194', + 'Test::Builder::TodoDiag'=> '1.302194', + 'Test::More' => '1.302194', + 'Test::Simple' => '1.302194', + 'Test::Tester' => '1.302194', + 'Test::Tester::Capture' => '1.302194', + 'Test::Tester::CaptureRunner'=> '1.302194', + 'Test::Tester::Delegate'=> '1.302194', + 'Test::use::ok' => '1.302194', + 'Time::HiRes' => '1.9774', + 'XS::APItest' => '1.32', + 'feature' => '1.81', + 'ok' => '1.302194', + 'overload' => '1.37', + 'threads' => '2.35', + 'threads::shared' => '1.67', + 'warnings' => '1.63', + 'warnings::register' => '1.05', + }, + removed => { + } + }, + 5.037011 => { + delta_from => 5.037010, + changed => { + 'B::Deparse' => '1.73', + 'B::Op_private' => '5.037011', + 'Config' => '5.037011', + 'Devel::PPPort' => '3.71', + 'ExtUtils::Command' => '7.70', + 'ExtUtils::Command::MM' => '7.70', + 'ExtUtils::Liblist' => '7.70', + 'ExtUtils::Liblist::Kid'=> '7.70', + 'ExtUtils::MM' => '7.70', + 'ExtUtils::MM_AIX' => '7.70', + 'ExtUtils::MM_Any' => '7.70', + 'ExtUtils::MM_BeOS' => '7.70', + 'ExtUtils::MM_Cygwin' => '7.70', + 'ExtUtils::MM_DOS' => '7.70', + 'ExtUtils::MM_Darwin' => '7.70', + 'ExtUtils::MM_MacOS' => '7.70', + 'ExtUtils::MM_NW5' => '7.70', + 'ExtUtils::MM_OS2' => '7.70', + 'ExtUtils::MM_OS390' => '7.70', + 'ExtUtils::MM_QNX' => '7.70', + 'ExtUtils::MM_UWIN' => '7.70', + 'ExtUtils::MM_Unix' => '7.70', + 'ExtUtils::MM_VMS' => '7.70', + 'ExtUtils::MM_VOS' => '7.70', + 'ExtUtils::MM_Win32' => '7.70', + 'ExtUtils::MM_Win95' => '7.70', + 'ExtUtils::MY' => '7.70', + 'ExtUtils::MakeMaker' => '7.70', + 'ExtUtils::MakeMaker::Config'=> '7.70', + 'ExtUtils::MakeMaker::Locale'=> '7.70', + 'ExtUtils::MakeMaker::version'=> '7.70', + 'ExtUtils::MakeMaker::version::regex'=> '7.70', + 'ExtUtils::Mkbootstrap' => '7.70', + 'ExtUtils::Mksymlists' => '7.70', + 'ExtUtils::ParseXS' => '3.50', + 'ExtUtils::ParseXS::Constants'=> '3.50', + 'ExtUtils::ParseXS::CountLines'=> '3.50', + 'ExtUtils::ParseXS::Eval'=> '3.50', + 'ExtUtils::ParseXS::Utilities'=> '3.50', + 'ExtUtils::testlib' => '7.70', + 'File::Copy' => '2.41', + 'Locale::Maketext' => '1.33', + 'Module::CoreList' => '5.20230420', + 'Module::CoreList::Utils'=> '5.20230420', + 'Net::Ping' => '2.76', + 'feature' => '1.82', + 'threads' => '2.36', + 'threads::shared' => '1.68', + 'warnings' => '1.64', + }, + removed => { + } + }, + 5.036001 => { + delta_from => 5.036000, + changed => { + 'B::Op_private' => '5.036001', + 'Config' => '5.036001', + 'Module::CoreList' => '5.20230423', + 'Module::CoreList::Utils'=> '5.20230423', + }, + removed => { + } + }, ); sub is_core @@ -20733,6 +21592,97 @@ sub is_core removed => { } }, + 5.037000 => { + delta_from => 5.036000, + changed => { + }, + removed => { + } + }, + 5.037001 => { + delta_from => 5.037000, + changed => { + }, + removed => { + } + }, + 5.037002 => { + delta_from => 5.037001, + changed => { + }, + removed => { + } + }, + 5.037003 => { + delta_from => 5.037002, + changed => { + }, + removed => { + } + }, + 5.037004 => { + delta_from => 5.037003, + changed => { + }, + removed => { + } + }, + 5.037005 => { + delta_from => 5.037004, + changed => { + }, + removed => { + } + }, + 5.037006 => { + delta_from => 5.037005, + changed => { + }, + removed => { + } + }, + 5.037007 => { + delta_from => 5.037006, + changed => { + }, + removed => { + } + }, + 5.037008 => { + delta_from => 5.037007, + changed => { + }, + removed => { + } + }, + 5.037009 => { + delta_from => 5.037008, + changed => { + }, + removed => { + } + }, + 5.037010 => { + delta_from => 5.037009, + changed => { + }, + removed => { + } + }, + 5.037011 => { + delta_from => 5.037010, + changed => { + }, + removed => { + } + }, + 5.036001 => { + delta_from => 5.036, + changed => { + }, + removed => { + } + }, ); %deprecated = _undelta(\%deprecated); @@ -21356,14 +22306,14 @@ sub is_core 'Math::BigRat::Trace' => undef, 'Math::Complex' => undef, 'Math::Trig' => undef, - 'Memoize' => undef, - 'Memoize::AnyDBM_File' => undef, - 'Memoize::Expire' => undef, + 'Memoize' => 'https://rt.cpan.org/Dist/Display.html?Name=Memoize', + 'Memoize::AnyDBM_File' => 'https://rt.cpan.org/Dist/Display.html?Name=Memoize', + 'Memoize::Expire' => 'https://rt.cpan.org/Dist/Display.html?Name=Memoize', 'Memoize::ExpireFile' => undef, 'Memoize::ExpireTest' => undef, - 'Memoize::NDBM_File' => undef, - 'Memoize::SDBM_File' => undef, - 'Memoize::Storable' => undef, + 'Memoize::NDBM_File' => 'https://rt.cpan.org/Dist/Display.html?Name=Memoize', + 'Memoize::SDBM_File' => 'https://rt.cpan.org/Dist/Display.html?Name=Memoize', + 'Memoize::Storable' => 'https://rt.cpan.org/Dist/Display.html?Name=Memoize', 'Module::Load' => undef, 'Module::Load::Conditional'=> undef, 'Module::Loaded' => undef, @@ -21389,8 +22339,8 @@ sub is_core 'PerlIO::via::QuotedPrint'=> undef, 'Pod::Checker' => undef, 'Pod::Escapes' => undef, - 'Pod::Man' => 'https://rt.cpan.org/Dist/Display.html?Name=podlators', - 'Pod::ParseLink' => 'https://rt.cpan.org/Dist/Display.html?Name=podlators', + 'Pod::Man' => 'https://github.com/rra/podlators/issues', + 'Pod::ParseLink' => 'https://github.com/rra/podlators/issues', 'Pod::Perldoc' => undef, 'Pod::Perldoc::BaseTo' => undef, 'Pod::Perldoc::GetOptsOO'=> undef, @@ -21433,10 +22383,10 @@ sub is_core 'Pod::Simple::TranscodeSmart'=> 'https://github.com/perl-pod/pod-simple/issues', 'Pod::Simple::XHTML' => 'https://github.com/perl-pod/pod-simple/issues', 'Pod::Simple::XMLOutStream'=> 'https://github.com/perl-pod/pod-simple/issues', - 'Pod::Text' => 'https://rt.cpan.org/Dist/Display.html?Name=podlators', - 'Pod::Text::Color' => 'https://rt.cpan.org/Dist/Display.html?Name=podlators', - 'Pod::Text::Overstrike' => 'https://rt.cpan.org/Dist/Display.html?Name=podlators', - 'Pod::Text::Termcap' => 'https://rt.cpan.org/Dist/Display.html?Name=podlators', + 'Pod::Text' => 'https://github.com/rra/podlators/issues', + 'Pod::Text::Color' => 'https://github.com/rra/podlators/issues', + 'Pod::Text::Overstrike' => 'https://github.com/rra/podlators/issues', + 'Pod::Text::Termcap' => 'https://github.com/rra/podlators/issues', 'Pod::Usage' => 'https://github.com/Dual-Life/Pod-Usage/issues', 'Scalar::Util' => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Scalar-List-Utils', 'Socket' => undef, diff --git a/gnu/usr.bin/perl/dist/Module-CoreList/lib/Module/CoreList/Utils.pm b/gnu/usr.bin/perl/dist/Module-CoreList/lib/Module/CoreList/Utils.pm index dc1fd48ac..6af9101f9 100644 --- a/gnu/usr.bin/perl/dist/Module-CoreList/lib/Module/CoreList/Utils.pm +++ b/gnu/usr.bin/perl/dist/Module-CoreList/lib/Module/CoreList/Utils.pm @@ -4,7 +4,7 @@ use strict; use warnings; use Module::CoreList; -our $VERSION = '5.20220520'; +our $VERSION = '5.20230423'; our %utilities; sub utilities { @@ -1804,6 +1804,97 @@ my %delta = ( removed => { } }, + 5.037000 => { + delta_from => 5.036000, + changed => { + }, + removed => { + } + }, + 5.037001 => { + delta_from => 5.037, + changed => { + }, + removed => { + } + }, + 5.037002 => { + delta_from => 5.037001, + changed => { + }, + removed => { + } + }, + 5.037003 => { + delta_from => 5.037002, + changed => { + }, + removed => { + } + }, + 5.037004 => { + delta_from => 5.037003, + changed => { + }, + removed => { + } + }, + 5.037005 => { + delta_from => 5.037004, + changed => { + }, + removed => { + } + }, + 5.037006 => { + delta_from => 5.037005, + changed => { + }, + removed => { + } + }, + 5.037007 => { + delta_from => 5.037006, + changed => { + }, + removed => { + } + }, + 5.037008 => { + delta_from => 5.037007, + changed => { + }, + removed => { + } + }, + 5.037009 => { + delta_from => 5.037008, + changed => { + }, + removed => { + } + }, + 5.037010 => { + delta_from => 5.037009, + changed => { + }, + removed => { + } + }, + 5.037011 => { + delta_from => 5.03701, + changed => { + }, + removed => { + } + }, + 5.036001 => { + delta_from => 5.036000, + changed => { + }, + removed => { + } + }, ); %utilities = Module::CoreList::_undelta(\%delta); diff --git a/gnu/usr.bin/perl/embed.fnc b/gnu/usr.bin/perl/embed.fnc index 7da9faa0d..4d39cb6bd 100644 --- a/gnu/usr.bin/perl/embed.fnc +++ b/gnu/usr.bin/perl/embed.fnc @@ -3079,21 +3079,21 @@ i |HV* |opmethod_stash |NN SV* meth #endif #if defined(PERL_IN_PP_SORT_C) -I |I32 |sv_ncmp |NN SV *const a|NN SV *const b -I |I32 |sv_ncmp_desc |NN SV *const a|NN SV *const b -I |I32 |sv_i_ncmp |NN SV *const a|NN SV *const b -I |I32 |sv_i_ncmp_desc |NN SV *const a|NN SV *const b -I |I32 |amagic_ncmp |NN SV *const a|NN SV *const b -I |I32 |amagic_ncmp_desc |NN SV *const a|NN SV *const b -I |I32 |amagic_i_ncmp |NN SV *const a|NN SV *const b -I |I32 |amagic_i_ncmp_desc |NN SV *const a|NN SV *const b -I |I32 |amagic_cmp |NN SV *const str1|NN SV *const str2 -I |I32 |amagic_cmp_desc |NN SV *const str1|NN SV *const str2 -I |I32 |cmp_desc |NN SV *const str1|NN SV *const str2 +i |I32 |sv_ncmp |NN SV *const a|NN SV *const b +i |I32 |sv_ncmp_desc |NN SV *const a|NN SV *const b +i |I32 |sv_i_ncmp |NN SV *const a|NN SV *const b +i |I32 |sv_i_ncmp_desc |NN SV *const a|NN SV *const b +i |I32 |amagic_ncmp |NN SV *const a|NN SV *const b +i |I32 |amagic_ncmp_desc |NN SV *const a|NN SV *const b +i |I32 |amagic_i_ncmp |NN SV *const a|NN SV *const b +i |I32 |amagic_i_ncmp_desc |NN SV *const a|NN SV *const b +i |I32 |amagic_cmp |NN SV *const str1|NN SV *const str2 +i |I32 |amagic_cmp_desc |NN SV *const str1|NN SV *const str2 +i |I32 |cmp_desc |NN SV *const str1|NN SV *const str2 # ifdef USE_LOCALE_COLLATE -I |I32 |amagic_cmp_locale |NN SV *const str1|NN SV *const str2 -I |I32 |amagic_cmp_locale_desc|NN SV *const str1|NN SV *const str2 -I |I32 |cmp_locale_desc|NN SV *const str1|NN SV *const str2 +i |I32 |amagic_cmp_locale |NN SV *const str1|NN SV *const str2 +i |I32 |amagic_cmp_locale_desc|NN SV *const str1|NN SV *const str2 +i |I32 |cmp_locale_desc|NN SV *const str1|NN SV *const str2 # endif S |I32 |sortcv |NN SV *const a|NN SV *const b S |I32 |sortcv_xsub |NN SV *const a|NN SV *const b @@ -3346,9 +3346,11 @@ ST |void |mem_log_common |enum mem_log_type mlt|const UV n|const UV typesize \ #endif #if defined(PERL_MEM_LOG) -pT |Malloc_t |mem_log_alloc |const UV nconst|UV typesize|NN const char *type_name|Malloc_t newalloc|NN const char *filename|const int linenumber|NN const char *funcname -pT |Malloc_t |mem_log_realloc |const UV n|const UV typesize|NN const char *type_name|Malloc_t oldalloc|Malloc_t newalloc|NN const char *filename|const int linenumber|NN const char *funcname -pT |Malloc_t |mem_log_free |Malloc_t oldalloc|NN const char *filename|const int linenumber|NN const char *funcname +CpT |Malloc_t |mem_log_alloc |const UV nconst|UV typesize|NN const char *type_name|Malloc_t newalloc|NN const char *filename|const int linenumber|NN const char *funcname +CpT |Malloc_t |mem_log_realloc |const UV n|const UV typesize|NN const char *type_name|Malloc_t oldalloc|Malloc_t newalloc|NN const char *filename|const int linenumber|NN const char *funcname +CpT |Malloc_t |mem_log_free |Malloc_t oldalloc|NN const char *filename|const int linenumber|NN const char *funcname +CpT |void |mem_log_new_sv|NN const SV *sv|NN const char *filename|int linenumber|NN const char *funcname +CpT |void |mem_log_del_sv|NN const SV *sv|NN const char *filename|int linenumber|NN const char *funcname #endif #if defined(PERL_IN_UTF8_C) diff --git a/gnu/usr.bin/perl/embed.h b/gnu/usr.bin/perl/embed.h index c221a8e2d..c061ab85a 100644 --- a/gnu/usr.bin/perl/embed.h +++ b/gnu/usr.bin/perl/embed.h @@ -887,6 +887,13 @@ #if defined(PERL_IN_SV_C) #define more_sv() Perl_more_sv(aTHX) #endif +#if defined(PERL_MEM_LOG) +#define mem_log_alloc Perl_mem_log_alloc +#define mem_log_del_sv Perl_mem_log_del_sv +#define mem_log_free Perl_mem_log_free +#define mem_log_new_sv Perl_mem_log_new_sv +#define mem_log_realloc Perl_mem_log_realloc +#endif #if defined(PERL_USE_3ARG_SIGHANDLER) #define csighandler Perl_csighandler #endif @@ -2029,11 +2036,6 @@ #define mem_log_common S_mem_log_common # endif # endif -# if defined(PERL_MEM_LOG) -#define mem_log_alloc Perl_mem_log_alloc -#define mem_log_free Perl_mem_log_free -#define mem_log_realloc Perl_mem_log_realloc -# endif # if defined(PERL_USES_PL_PIDSTATUS) && defined(PERL_IN_UTIL_C) #define pidgone(a,b) S_pidgone(aTHX_ a,b) # endif diff --git a/gnu/usr.bin/perl/ext/XS-APItest/t/xsub_h.t b/gnu/usr.bin/perl/ext/XS-APItest/t/xsub_h.t index 51b3d7060..a7e2541e4 100644 --- a/gnu/usr.bin/perl/ext/XS-APItest/t/xsub_h.t +++ b/gnu/usr.bin/perl/ext/XS-APItest/t/xsub_h.t @@ -117,7 +117,7 @@ foreach $XS_VERSION (undef, @versions) { is_deeply([XS_APIVERSION_valid("Pie")], [], "XS_APIVERSION_BOOTCHECK passes"); is(eval {XS_APIVERSION_invalid("Pie"); 1}, undef, "XS_APIVERSION_BOOTCHECK croaks for an invalid version"); -like($@, qr/Perl API version v1.0.16 of Pie does not match \Q$^V\E/a, +like($@, qr/Perl API version v1.0.16 of Pie does not match v5\.\d+\.\d+/, "expected error"); my @xsreturn; diff --git a/gnu/usr.bin/perl/gv.c b/gnu/usr.bin/perl/gv.c index 82825d1da..8158fb478 100644 --- a/gnu/usr.bin/perl/gv.c +++ b/gnu/usr.bin/perl/gv.c @@ -982,7 +982,7 @@ S_gv_fetchmeth_internal(pTHX_ HV* stash, SV* meth, const char* name, STRLEN len, } } - if (topgv && GvREFCNT(topgv) == 1) { + if (topgv && GvREFCNT(topgv) == 1 && !(flags & GV_NOUNIVERSAL)) { /* cache the fact that the method is not defined */ GvCVGEN(topgv) = topgen_cmp; } diff --git a/gnu/usr.bin/perl/handy.h b/gnu/usr.bin/perl/handy.h index 32e4da5f7..e314d3370 100644 --- a/gnu/usr.bin/perl/handy.h +++ b/gnu/usr.bin/perl/handy.h @@ -2734,10 +2734,6 @@ enum mem_log_type { MLT_DEL_SV }; # endif -# if defined(PERL_IN_SV_C) /* those are only used in sv.c */ -void Perl_mem_log_new_sv(const SV *sv, const char *filename, const int linenumber, const char *funcname); -void Perl_mem_log_del_sv(const SV *sv, const char *filename, const int linenumber, const char *funcname); -# endif # endif #endif diff --git a/gnu/usr.bin/perl/hints/catamount.sh b/gnu/usr.bin/perl/hints/catamount.sh index 8c5fce6de..45c078414 100644 --- a/gnu/usr.bin/perl/hints/catamount.sh +++ b/gnu/usr.bin/perl/hints/catamount.sh @@ -31,11 +31,11 @@ # mkdir -p /opt/perl-catamount # mkdir -p /opt/perl-catamount/include # mkdir -p /opt/perl-catamount/lib -# mkdir -p /opt/perl-catamount/lib/perl5/5.36.0 +# mkdir -p /opt/perl-catamount/lib/perl5/5.36.1 # mkdir -p /opt/perl-catamount/bin # cp *.h /opt/perl-catamount/include # cp libperl.a /opt/perl-catamount/lib -# cp -pr lib/* /opt/perl-catamount/lib/perl5/5.36.0 +# cp -pr lib/* /opt/perl-catamount/lib/perl5/5.36.1 # cp miniperl perl run.sh cc.sh /opt/perl-catamount/lib # # With the headers and the libperl.a you can embed Perl to your Catamount diff --git a/gnu/usr.bin/perl/lib/B/Op_private.pm b/gnu/usr.bin/perl/lib/B/Op_private.pm index 73a5b8175..2a81755bb 100644 --- a/gnu/usr.bin/perl/lib/B/Op_private.pm +++ b/gnu/usr.bin/perl/lib/B/Op_private.pm @@ -118,7 +118,7 @@ package B::Op_private; our %bits; -our $VERSION = "5.036000"; +our $VERSION = "5.036001"; $bits{$_}{3} = 'OPpENTERSUB_AMPER' for qw(entersub rv2cv); $bits{$_}{6} = 'OPpENTERSUB_DB' for qw(entersub rv2cv); diff --git a/gnu/usr.bin/perl/makedef.pl b/gnu/usr.bin/perl/makedef.pl index 0d594043d..27076e332 100644 --- a/gnu/usr.bin/perl/makedef.pl +++ b/gnu/usr.bin/perl/makedef.pl @@ -489,7 +489,14 @@ unless ($define{'PERL_TRACK_MEMPOOL'}) { } unless ($define{'PERL_MEM_LOG'}) { - ++$skip{PL_mem_log}; + ++$skip{$_} foreach qw( + PL_mem_log + Perl_mem_log_alloc + Perl_mem_log_realloc + Perl_mem_log_free + Perl_mem_log_new_sv + Perl_mem_log_del_sv + ); } unless ($define{'MULTIPLICITY'}) { diff --git a/gnu/usr.bin/perl/mg.c b/gnu/usr.bin/perl/mg.c index 7a4727ced..a5be8248f 100644 --- a/gnu/usr.bin/perl/mg.c +++ b/gnu/usr.bin/perl/mg.c @@ -3082,25 +3082,55 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) IoLINES(GvIOp(PL_last_in_gv)) = SvIV(sv); break; case '^': - Safefree(IoTOP_NAME(GvIOp(PL_defoutgv))); - IoTOP_NAME(GvIOp(PL_defoutgv)) = savesvpv(sv); - IoTOP_GV(GvIOp(PL_defoutgv)) = gv_fetchsv(sv, GV_ADD, SVt_PVIO); + { + IO * const io = GvIO(PL_defoutgv); + if (!io) + break; + + Safefree(IoTOP_NAME(io)); + IoTOP_NAME(io) = savesvpv(sv); + IoTOP_GV(io) = gv_fetchsv(sv, GV_ADD, SVt_PVIO); + } break; case '~': - Safefree(IoFMT_NAME(GvIOp(PL_defoutgv))); - IoFMT_NAME(GvIOp(PL_defoutgv)) = savesvpv(sv); - IoFMT_GV(GvIOp(PL_defoutgv)) = gv_fetchsv(sv, GV_ADD, SVt_PVIO); + { + IO * const io = GvIO(PL_defoutgv); + if (!io) + break; + + Safefree(IoFMT_NAME(io)); + IoFMT_NAME(io) = savesvpv(sv); + IoFMT_GV(io) = gv_fetchsv(sv, GV_ADD, SVt_PVIO); + } break; case '=': - IoPAGE_LEN(GvIOp(PL_defoutgv)) = (SvIV(sv)); + { + IO * const io = GvIO(PL_defoutgv); + if (!io) + break; + + IoPAGE_LEN(io) = (SvIV(sv)); + } break; case '-': - IoLINES_LEFT(GvIOp(PL_defoutgv)) = (SvIV(sv)); - if (IoLINES_LEFT(GvIOp(PL_defoutgv)) < 0L) - IoLINES_LEFT(GvIOp(PL_defoutgv)) = 0L; + { + IO * const io = GvIO(PL_defoutgv); + if (!io) + break; + + IoLINES_LEFT(io) = (SvIV(sv)); + if (IoLINES_LEFT(io) < 0L) + IoLINES_LEFT(io) = 0L; + } break; case '%': - IoPAGE(GvIOp(PL_defoutgv)) = (SvIV(sv)); + { + IO * const io = GvIO(PL_defoutgv); + if (!io) + break; + + IoPAGE(io) = (SvIV(sv)); + } break; case '|': { diff --git a/gnu/usr.bin/perl/op.c b/gnu/usr.bin/perl/op.c index 7fa0cc633..748a268d4 100644 --- a/gnu/usr.bin/perl/op.c +++ b/gnu/usr.bin/perl/op.c @@ -14749,13 +14749,40 @@ subroutine. CV * Perl_find_lexical_cv(pTHX_ PADOFFSET off) { - PADNAME *name = PAD_COMPNAME(off); + const PADNAME *name = PAD_COMPNAME(off); CV *compcv = PL_compcv; while (PadnameOUTER(name)) { - assert(PARENT_PAD_INDEX(name)); compcv = CvOUTSIDE(compcv); - name = PadlistNAMESARRAY(CvPADLIST(compcv)) + if (LIKELY(PARENT_PAD_INDEX(name))) { + name = PadlistNAMESARRAY(CvPADLIST(compcv)) [off = PARENT_PAD_INDEX(name)]; + } + else { + /* In an eval() in an inner scope like a function, the + intermediate pad in the sub might not be populated with the + sub. So search harder. + + It is possible we won't find the name in this + particular scope, but that's fine, if we don't we'll + find it in some outer scope. Finding it here will let us + go back to following the PARENT_PAD_INDEX() chain. + */ + const PADNAMELIST * const names = PadlistNAMES(CvPADLIST(compcv)); + PADNAME * const * const name_p = PadnamelistARRAY(names); + int offset; + for (offset = PadnamelistMAXNAMED(names); offset > 0; offset--) { + const PADNAME * const thisname = name_p[offset]; + /* The pv is copied from the outer PADNAME to the + inner PADNAMEs so we don't need to compare the + string contents + */ + if (thisname && PadnameLEN(thisname) == PadnameLEN(name) + && PadnamePV(thisname) == PadnamePV(name)) { + name = thisname; + break; + } + } + } } assert(!PadnameIsOUR(name)); if (!PadnameIsSTATE(name) && PadnamePROTOCV(name)) { diff --git a/gnu/usr.bin/perl/patchlevel.h b/gnu/usr.bin/perl/patchlevel.h index b2b2bee9a..57880f126 100644 --- a/gnu/usr.bin/perl/patchlevel.h +++ b/gnu/usr.bin/perl/patchlevel.h @@ -39,7 +39,7 @@ Instead use one of the version comparison macros. See C>. #define PERL_REVISION 5 /* age */ #define PERL_VERSION 36 /* epoch */ -#define PERL_SUBVERSION 0 /* generation */ +#define PERL_SUBVERSION 1 /* generation */ /* The following numbers describe the earliest compatible version of Perl ("compatibility" here being defined as sufficient binary/API diff --git a/gnu/usr.bin/perl/perl.c b/gnu/usr.bin/perl/perl.c index 8ed84710e..f6d9bd926 100644 --- a/gnu/usr.bin/perl/perl.c +++ b/gnu/usr.bin/perl/perl.c @@ -3,7 +3,7 @@ * * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 * 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 - * 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 + * 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 * by Larry Wall and others * * You may distribute under the terms of either the GNU General Public @@ -3832,7 +3832,7 @@ S_minus_v(pTHX) #endif PerlIO_printf(PIO_stdout, - "\n\nCopyright 1987-2022, Larry Wall\n"); + "\n\nCopyright 1987-2023, Larry Wall\n"); #ifdef OS2 PerlIO_printf(PIO_stdout, "\n\nOS/2 port Copyright (c) 1990, 1991, Raymond Chen, Kai Uwe Rommel\n" diff --git a/gnu/usr.bin/perl/plan9/config_sh.sample b/gnu/usr.bin/perl/plan9/config_sh.sample index 02b46570c..624e7cbde 100644 --- a/gnu/usr.bin/perl/plan9/config_sh.sample +++ b/gnu/usr.bin/perl/plan9/config_sh.sample @@ -35,8 +35,8 @@ api_subversion='0' api_version='36' api_versionstring='5.36.0' ar='ar' -archlib='/sys/lib/perl5/5.36.0/386' -archlibexp='/sys/lib/perl5/5.36.0/386' +archlib='/sys/lib/perl5/5.36.1/386' +archlibexp='/sys/lib/perl5/5.36.1/386' archname64='' archname='386' archobjs='' @@ -825,17 +825,17 @@ inc_version_list=' ' inc_version_list_init='0' incpath='' inews='' -installarchlib='/sys/lib/perl/5.36.0/386' +installarchlib='/sys/lib/perl/5.36.1/386' installbin='/usr/bin' installman1dir='/sys/man/1pub' installman3dir='/sys/man/2pub' installprefix='/usr' installprefixexp='/usr' -installprivlib='/sys/lib/perl/5.36.0' +installprivlib='/sys/lib/perl/5.36.1' installscript='/usr/bin' -installsitearch='/sys/lib/perl/5.36.0/site_perl/386' +installsitearch='/sys/lib/perl/5.36.1/site_perl/386' installsitebin='/usr/bin' -installsitelib='/sys/lib/perl/5.36.0/site_perl' +installsitelib='/sys/lib/perl/5.36.1/site_perl' installstyle='lib/perl5' installusrbinperl='undef' installvendorarch='' @@ -961,8 +961,8 @@ pmake='' pr='' prefix='/usr' prefixexp='/usr' -privlib='/sys/lib/perl/5.36.0' -privlibexp='/sys/lib/perl/5.36.0' +privlib='/sys/lib/perl/5.36.1' +privlibexp='/sys/lib/perl/5.36.1' procselfexe='' prototype='define' ptrsize='4' @@ -1027,13 +1027,13 @@ sig_num='0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 sig_num_init='0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 0' sig_size='50' signal_t='void' -sitearch='/sys/lib/perl/5.36.0/site_perl/386' +sitearch='/sys/lib/perl/5.36.1/site_perl/386' sitearchexp='/sys/lib/perl/site_perl/386' sitebin='/usr/bin' sitebinexp='/usr/bin' -sitelib='/sys/lib/perl/5.36.0/site_perl' -sitelib_stem='/sys/lib/perl/5.36.0/site_perl' -sitelibexp='/sys/lib/perl/5.36.0/site_perl' +sitelib='/sys/lib/perl/5.36.1/site_perl' +sitelib_stem='/sys/lib/perl/5.36.1/site_perl' +sitelibexp='/sys/lib/perl/5.36.1/site_perl' siteprefix='/usr' siteprefixexp='/usr' sizesize='4' @@ -1068,7 +1068,7 @@ stdio_stream_array='' strerror_r_proto='0' strings='/sys/include/ape/string.h' submit='' -subversion='0' +subversion='1' sysman='/sys/man/1pub' tail='' tar='' @@ -1149,8 +1149,8 @@ vendorlib_stem='' vendorlibexp='' vendorprefix='' vendorprefixexp='' -version='5.36.0' -version_patchlevel_string='version 36 subversion 0' +version='5.36.1' +version_patchlevel_string='version 36 subversion 1' versiononly='undef' vi='' xlibpth='' @@ -1165,7 +1165,7 @@ config_args='' config_argc=0 PERL_REVISION=5 PERL_VERSION=36 -PERL_SUBVERSION=0 +PERL_SUBVERSION=1 PERL_API_REVISION=5 PERL_API_VERSION=36 PERL_API_SUBVERSION=0 diff --git a/gnu/usr.bin/perl/pod/perl.pod b/gnu/usr.bin/perl/pod/perl.pod index ba4e914b4..116b9fd25 100644 --- a/gnu/usr.bin/perl/pod/perl.pod +++ b/gnu/usr.bin/perl/pod/perl.pod @@ -179,6 +179,7 @@ aux h2ph h2xs perlbug pl2pm pod2html pod2man splain xsubpp perlhist Perl history records perldelta Perl changes since previous version + perl5360delta Perl changes in version 5.36.0 perl5341delta Perl changes in version 5.34.1 perl5340delta Perl changes in version 5.34.0 perl5321delta Perl changes in version 5.32.1 diff --git a/gnu/usr.bin/perl/pod/perl5360delta.pod b/gnu/usr.bin/perl/pod/perl5360delta.pod new file mode 100644 index 000000000..813d66db0 --- /dev/null +++ b/gnu/usr.bin/perl/pod/perl5360delta.pod @@ -0,0 +1,1587 @@ +=encoding utf8 + +=head1 NAME + +perl5360delta - what is new for perl v5.36.0 + +=head1 DESCRIPTION + +This document describes differences between the 5.34.0 release and the 5.36.0 +release. + +=head1 Core Enhancements + +=head2 C + +As always, C turns on the feature bundle for that version of Perl. + +The 5.36 bundle enables the C feature. Introduced in Perl version +5.20.0, and modified several times since, the subroutine signatures feature is +now no longer considered experimental. It is now considered a stable language +feature and no longer prints a warning. + + use v5.36; + + sub add ($x, $y) { + return $x + $y; + } + +Despite this, certain elements of signatured subroutines remain experimental; +see below. + +The 5.36 bundle enables the C feature. Introduced in Perl version 5.32.0, +this operator has remained unchanged since then. The operator is now considered +a stable language feature. For more detail see L. + +The 5.36 bundle also I the features C, and +C. These will forbid, respectively: the use of "indirect" +method calls (like C<$x = new Class;>); the use of a list expression as a hash +key to simulate sparse multidimensional arrays. The specifics of these changes +can be found in L, but the short version is: this is a bit like having +more C turned on, disabling features that cause more trouble than +they're worth. + +Furthermore, C will also enable warnings as if you'd written C. + +Finally, with this release, the experimental C feature, present in +every feature bundle since they were introduced in v5.10, has been removed from +the v5.36 bundle. If you want to use it (against our advice), you'll have to +enable it explicitly. + +=head2 -g command-line flag + +A new command-line flag, -g, is available. It is a simpler alias for -0777. + +For more information, see L. + +=head2 Unicode 14.0 is supported + +See L for details. + +=head2 regex sets are no longer considered experimental + +Prior to this release, the regex sets feature (officially named +"Extended Bracketed Character Classes") was considered experimental. +Introduced in Perl version 5.18.0, and modified several times since, +this is now considered a stable language feature and its use no longer +prints a warning. See L. + +=head2 Variable length lookbehind is mostly no longer considered experimental + +Prior to this release, any form of variable length lookbehind was +considered experimental. With this release the experimental status has +been reduced to cover only lookbehind that contains capturing parenthesis. +This is because it is not clear if + + "aaz"=~/(?=z)(?<=(a|aa))/ + +should match and leave $1 equaling "a" or "aa". Currently it will match +the longest possible alternative, "aa". While we are confident that the overall +construct will now match only when it should, we are not confident that we +will keep the current "longest match" behavior. + +=head2 SIGFPE no longer deferred + +Floating-point exceptions are now delivered immediately, in the same way +as other "fault"-like signals such as SIGSEGV. This means one has at +least a chance to catch such a signal with a C<$SIG{FPE}> handler, e.g. +so that C can report the line in perl that triggered it. + +=head2 Stable boolean tracking + +The "true" and "false" boolean values, often accessed by constructions like +C and C, as well as being returned from many core functions and +operators, now remember their boolean nature even through assignment into +variables. The new function C in L can check whether +a value has boolean nature. + +This is likely to be useful when interoperating with other languages or +data-type serialisation, among other places. + +=head2 iterating over multiple values at a time (experimental) + +You can now iterate over multiple values at a time by specifying a list of +lexicals within parentheses. For example, + + for my ($key, $value) (%hash) { ... } + for my ($left, $right, $gripping) (@moties) { ... } + +Prior to perl v5.36, attempting to specify a list after C was a syntax +error. + +This feature is currently experimental and will cause a warning of category +C. For more detail see L. +See also L in this document, which is a handy companion to +n-at-a-time foreach. + +=head2 builtin functions (experimental) + +A new core module L has been added, which provides documentation for +new always-present functions that are built into the interpreter. + + say "Reference type of arrays is ", builtin::reftype([]); + +It also provides a lexical import mechanism for providing short name versions +of these functions. + + use builtin 'reftype'; + say "Reference type of arrays is ", reftype([]); + +This builtin function mechanism and the functions it provides are all +currently B. We expect that C itself will cease to be +experimental in the near future, but that individual functions in it may become +stable on an ongoing basis. Other functions will be added to C over +time. + +For details, see L, but here's a summary of builtin functions in +v5.36: + +=over 4 + +=item builtin::trim + +This function treats its argument as a string, returning the result of removing +all white space at its beginning and ending. + +=item builtin::indexed + +This function returns a list twice as big as its argument list, where each item +is preceded by its index within that list. This is primarily useful for using +the new C syntax with multiple iterator variables to iterate over an +array or list, while also tracking the index of each item: + + use builtin 'indexed'; + + foreach my ($index, $val) (indexed @array) { + ... + } + +=item builtin::true, builtin::false, builtin::is_bool + +C and C return boolean true and false values. Perl is still perl, +and doesn't have strict typing of booleans, but these values will be known to +have been created as booleans. C will tell you whether a value was +known to have been created as a boolean. + +=item builtin::weaken, builtin::unweaken, builtin::is_weak + +These functions will, respectively: weaken a reference; strengthen a reference; +and return whether a reference is weak. (A weak reference is not counted for +garbage collection purposes. See L.) These can take the place of +some similar routines in L. + +=item builtin::blessed, builtin::refaddr, builtin::reftype + +These functions provide more data about references (or non-references, +actually!) and can take the place of similar routines found in L. + +=item builtin::ceil, builtin::floor + +C returns the smallest integer greater than or equal to its argument. +C returns the largest integer less than or equal to its argument. These +can take the place of similar routines found in L. + +=back + +=head2 C blocks (experimental) + +This release adds support for C blocks, which are blocks of code +prefixed by the C modifier. They provide a section of code which runs +at a later time, during scope exit. + +In brief, when a C block is reached at runtime, its body is set aside to +be run when the enclosing scope is exited. It is unlike a UNITCHECK (among +other reasons) in that if the block I the C block is exited +before the block is reached, it will not be run. + +C blocks can be used to take the place of "scope guard" objects where an +object is passed a code block to be run by its destructor. + +For more information, see L. + +=head2 try/catch can now have a C block (experimental) + +The experimental C/C syntax has been extended to support an +optional third block introduced by the C keyword. + + try { + attempt(); + print "Success\n"; + } + catch ($e) { + print "Failure\n"; + } + finally { + print "This happens regardless\n"; + } + +This provides code which runs at the end of the C/C construct, +even if aborted by an exception or control-flow keyword. They are similar +to C blocks. + +For more information, see L. + +=head2 non-ASCII delimiters for quote-like operators (experimental) + +Perl traditionally has allowed just four pairs of string/pattern +delimiters: S> S> S> and S >>>, all in the +ASCII range. Unicode has hundreds more possibilities, and using this +feature enables many of them. When enabled, you can say S> for +example, or S>. See L for details. + +=head2 @_ is now experimental within signatured subs + +Even though subroutine signatures are now stable, use of the legacy arguments +array (C<@_>) with a subroutine that has a signature I experimental, +with its own warning category. Silencing the C +warning category is not sufficient to dismiss this. The new warning is emitted +with the category name C. + +Any subroutine that has a signature and tries to make use of the defaults +argument array or an element thereof (C<@_> or C<$_[INDEX]>), either +explicitly or implicitly (such as C or C with no argument) will +provoke a warning at compile-time: + + use v5.36; + + sub f ($x, $y = 123) { + say "The first argument is $_[0]"; + } + +Z<> + + Use of @_ in array element with signatured subroutine is experimental + at file.pl line 4. + +The behaviour of code which attempts to do this is no longer specified, and +may be subject to change in a future version. + +=head1 Incompatible Changes + +=head2 A physically empty sort is now a compile-time error + + @a = sort @empty; # unaffected + @a = sort; # now a compile-time error + @a = sort (); # also a compile-time error + +A bare sort used to be a weird way to create an empty list; now it croaks +at compile time. This change is intended to free up some of the syntax space +for possible future enhancements to C. + +=head1 Deprecations + +=head2 C (where VERSION is below v5.11) after C is deprecated + +When in the scope of C or later, a C line where I is +lower than v5.11 will now issue a warning: + + Downgrading a use VERSION declaration to below v5.11 is deprecated + +For example: + + use v5.14; + say "The say statement is permitted"; + use v5.8; # This will print a warning + print "We must use print\n"; + +This is because the Perl team plans to change the behavior in this case. Since +Perl v5.12 (and parts of v5.11), strict is enabled I. In other words: + + no strict; + use v5.12; # will not enable strict, because "no strict" preceded it + $x = 1; # permitted, despite no "my" declaration + +In the future, this behavior will be eliminated and C will +I enable strict for versions v5.12 and later. + +Code which wishes to mix versions in this manner should use lexical scoping +with block syntax to ensure that the differently versioned regions remain +lexically isolated. + + { + use v5.14; + say "The say statement is permitted"; + } + + { + use v5.8; # No warning is emitted + print "We must use print\n"; + } + +Of course, this is probably not something you ever need to do! If the first +block compiles, it means you're using perl v5.14.0 or later. + +=head1 Performance Enhancements + +=over 4 + +=item * + +We now probe for compiler support for C11 thread local storage, and where +available use this for "implicit context" for XS extensions making API calls for +a threaded Perl build. This requires fewer function calls at the C level than +POSIX thread specific storage. We continue to use the the pthreads approach if +the C11 approach is not available. + +F run with the defaults will build an unthreaded Perl (which is +slightly faster), but most operating systems ship a threaded Perl. + +=item * + +Perl can now be configured to no longer allocate keys for large hashes +from the shared string table. + +The same internal datatype (C) is used for all of + +=over 4 + +=item * + +Symbol tables + +=item * + +Objects (by default) + +=item * + +Associative arrays + +=back + +The shared string table was originally added to improve performance for blessed +hashes used as objects, because every object instance has the same keys, so it +is an optimisation to share memory between them. It also makes sense for symbol +tables, where derived classes will have the same keys (typically method names), +and the OP trees built for method calls can also share memory. The shared +string table behaves roughly like a cache for hash keys. + +But for hashes actually used as associative arrays - mapping keys to values - +typically the keys are not re-used in other hashes. For example, "seen" hashes +are keyed by object IDs (or addresses), and logically these keys won't repeat +in other hashes. + +Storing these "used just once" keys in the shared string table increases CPU +and RAM use for no gain. For such keys the shared string table behaves as a +cache with a 0% hit rate. Storing all the keys there increases the total size +of the shared string table, as well as increasing the number of times it is +resized as it grows. B - in any environment that has "copy on write" +memory for child process (such as a pre-forking server), the memory pages used +for the shared string table rapidly need to be copied as the child process +manipulates hashes. Hence if most of the shared string table is such that keys +are used only in one place, there is no benefit from re-use within the perl +interpreter, but a high cost due to more pages for the OS to copy. + +The perl interpreter can now be Configured to disable shared hash keys +for "large" hashes (that are neither objects nor symbol tables). To do +so, add C<-Accflags='-DPERL_USE_UNSHARED_KEYS_IN_LARGE_HASHES'> to +your F options. "Large" is a heuristic -- currently the +heuristic is that sharing is disabled when adding a key to a hash +triggers allocation of more storage, and the hash has more than 42 keys. + +This B cause slightly increased memory usage for programs that create +(unblessed) data structures that contain multiple large hashes that share the +same keys. But generally our testing suggests that for the specific cases +described it is a win, and other code is unaffected. + +=item * + +In certain scenarios, creation of new scalars is now noticeably faster. + +For example, the following code is now executing ~30% faster: + + $str = "A" x 64; + for (0..1_000_000) { + @svs = split //, $str + } + +(You can read more about this one in L<[perl +#19414]|https://github.com/Perl/perl5/pull/19414>.) + +=back + +=head1 Modules and Pragmata + +=head2 Updated Modules and Pragmata + +=over 4 + +=item * + +L has been upgraded from version 2.38 to 2.40. + +=item * + +L has been upgraded from version 1.01 to 1.02. + +=item * + +L has been upgraded from version 0.33 to 0.34. + +=item * + +L has been upgraded from version 1.82 to 1.83. + +=item * + +L has been upgraded from version 1.004 to 1.006. + +=item * + +L has been upgraded from version 1.56 to 1.64. + +=item * + +L has been upgraded from version 0.51 to 0.65. + +=item * + +L has been upgraded from version 1.48 to 1.50. + +=item * + +L has been upgraded from version 2.101 to 2.103. + +=item * + +L has been upgraded from version 2.101 to 2.105. + +=item * + +L has been upgraded from version 2.28 to 2.33. + +=item * + +L has been upgraded from version 2.179 to 2.184. + +=item * + +L has been upgraded from version 1.855 to 1.857. + +=item * + +L has been upgraded from version 1.30 to 1.32. + +=item * + +L has been upgraded from version 3.62 to 3.68. + +=item * + +L has been upgraded from version 1.37 to 1.39. + +=item * + +L has been upgraded from version 1.19 to 1.20. + +=item * + +L has been upgraded from version 1.50 to 1.52. + +=item * + +L has been upgraded from version 3.08 to 3.17. + +=item * + +L has been upgraded from version 1.33 to 1.36. + +=item * + +L has been upgraded from version 0.024 to 0.028. + +=item * + +L has been upgraded from version 5.76 to 5.77. + +=item * + +L has been upgraded from version 7.62 to 7.64. + +=item * + +L has been upgraded from version 1.10 to 1.11. + +=item * + +L has been upgraded from version 3.43 to 3.45. + +=item * + +L has been upgraded from version 3.43 to 3.45. + +=item * + +L has been upgraded from version 1.14 to 1.15. + +=item * + +L has been upgraded from version 1.64 to 1.72. + +=item * + +L has been upgraded from version 1.1006 to 1.1007. + +=item * + +L has been upgraded from version 2.35 to 2.39. + +=item * + +L has been upgraded from version 1.00 to 1.04. + +=item * + +L has been upgraded from version 1.39 to 1.40. + +=item * + +L has been upgraded from version 1.33 to 1.37. + +=item * + +L has been upgraded from version 3.80 to 3.84. + +=item * + +L has been upgraded from version 1.09 to 1.12. + +=item * + +L has been upgraded from version 1.52 to 1.53. + +=item * + +L has been upgraded from version 1.19 to 1.23. + +=item * + +L has been upgraded from version 0.25 to 0.28. + +=item * + +L has been upgraded from version 1.21 to 1.26. + +=item * + +L has been upgraded from version 0.076 to 0.080. + +=item * + +L has been upgraded from version 0.19 to 0.21. + +=item * + +L has been upgraded from version 0.0609 to 0.0610. + +=item * + +L has been upgraded from version 1.46 to 1.50. + +=item * + +IO-Compress has been upgraded from version 2.102 to 2.106. + +=item * + +L has been upgraded from version 1.21 to 1.22. + +=item * + +L has been upgraded from version 4.06 to 4.07. + +=item * + +libnet has been upgraded from version 3.13 to 3.14. + +=item * + +L has been upgraded from version 1.29 to 1.31. + +=item * + +L has been upgraded from version 1.999818 to 1.999830. + +=item * + +L has been upgraded from version 0.5009 to 0.5012. + +=item * + +L has been upgraded from version 0.2614 to 0.2621. + +=item * + +L has been upgraded from version 5.20210520 to 5.20220520. + +=item * + +L has been upgraded from version 1.25_001 to 1.26. + +=item * + +L has been upgraded from version 0.68 to 0.69. + +=item * + +L has been upgraded from version 1.50 to 1.57. + +=item * + +L has been upgraded from version 1.12 to 1.13. + +=item * + +L has been upgraded from version 1.33 to 1.35. + +=item * + +L has been upgraded from version 5.20210411 to 5.20210520. + +=item * + +L has been upgraded from version 1.11 to 1.12. + +=item * + +L has been upgraded from version 1.13 to 1.14. + +=item * + +L has been upgraded from version 1.27 to 1.33. + +=item * + +L has been upgraded from version 3.42 to 3.43. + +=item * + +L has been upgraded from version 1.97 to 2.03. + +=item * + +L has been upgraded from version 0.41 to 0.43. + +=item * + +L has been upgraded from version 1.55 to 1.62. + +=item * + +L has been upgraded from version 1.09 to 1.10. + +=item * + +L has been upgraded from version 2.031 to 2.033. + +=item * + +L has been upgraded from version 2.04 to 2.05. + +=item * + +L has been upgraded from version 3.23 to 3.26. + +=item * + +L has been upgraded from version 1.23 to 1.24. + +=item * + +L has been upgraded from version 3.43 to 3.44. + +=item * + +L has been upgraded from version 1.302183 to 1.302190. + +=item * + +L has been upgraded from version 3.30 to 3.31. + +=item * + +L has been upgraded from version 2013.0523 to 2021.0814. + +=item * + +L has been upgraded from version 2013.0523 to 2021.0814. + +=item * + +L has been upgraded from version 2.26 to 2.27. + +=item * + +L has been upgraded from version 1.62 to 1.64. + +=item * + +L has been upgraded from version 4.2 to 4.3. + +=item * + +L has been upgraded from version 1.05 to 1.06. + +=item * + +L has been upgraded from version 1.05 to 1.06. + +=item * + +L has been upgraded from version 1.00 to 1.01. + +=item * + +L has been upgraded from version 1.9767 to 1.9770. + +=item * + +L has been upgraded from version 1.29 to 1.31. + +=item * + +L has been upgraded from version 1.28 to 1.31. + +=item * + +L has been upgraded from version 0.75 to 0.78. + +=item * + +L has been upgraded from version 1.13 to 1.14. + +=item * + +L has been upgraded from version 0.9928 to 0.9929. + +=item * + +L has been upgraded from version 1.12 to 1.13. + +=item * + +L has been upgraded from version 2.45 to 2.46. + +=item * + +L has been upgraded from version 1.51 to 1.58. + +=item * + +L has been upgraded from version 0.57 to 0.59. + +=item * + +L has been upgraded from version 1.16 to 1.22. + +=item * + +L has been upgraded from version 0.18 to 0.19. + +=item * + +L has been upgraded from version 0.30 to 0.31. + +=back + +=head1 Documentation + +=head2 New Documentation + +=head3 F + +This document provides the process for administering an election or vote +within the Perl Core Team. + +=head2 Changes to Existing Documentation + +We have attempted to update the documentation to reflect the changes +listed in this document. If you find any we have missed, open an issue +at L. + +Additionally, the following selected changes have been made: + +=head3 L + +=over 4 + +=item * + +This has been cleaned up some, and more than 80% of the (previously +many) undocumented functions have now either been documented or deemed +to have been inappropriately marked as API. + +As always, Patches Welcome! + +=back + +=head3 L + +=over 4 + +=item * + +notes the new location for functions moved from L to +L that are no longer intended to be used outside of core. + +=back + +=head3 L + +=over 4 + +=item * + +notes the C<:win32> IO pseudolayer is removed (this happened in 5.35.2). + +=back + +=head3 L + +=over 4 + +=item * + +The election process has been finetuned to allow the vote to be skipped if there +are no more candidates than open seats. + +=item * + +A special election is now allowed to be postponed for up to twelve weeks, for +example until a normal election. + +=back + +=head3 L + +=over 4 + +=item * + +now notes that an invocant only needs to be an object or class name +for method calls, not for subroutine references. + +=back + +=head3 L + +=over 4 + +=item * + +Updated to discourage the use of the /d regexp modifier. + +=back + +=head3 L + +=over 4 + +=item * + +B<-?> is now a synonym for B<-h> + +=item * + +B<-g> is now a synonym for B<-0777> + +=back + +=head1 Diagnostics + +The following additions or changes have been made to diagnostic output, +including warnings and fatal error messages. For the complete list of +diagnostic messages, see L. + +=head2 New Diagnostics + +=head3 New Errors + +=over 4 + +=item * + +L + +(F) An attempt was made to jump out of the scope of a defer block by using +a control-flow statement such as C, C or a loop control. This is +not permitted. + +=item * + +L (for scalar +assignment to C) + +Attempting to perform a scalar assignment to C, for example via +C, previously triggered a fatal runtime error with the +message "L." +It is more helpful to detect such attempted assignments prior to runtime, so +they are now compile time errors, resulting in the message "Can't modify undef +operator in scalar assignment". + +=item * + +L + +The parser failed an internal consistency check while trying to parse +a C loop. + +=back + +=head3 New Warnings + +=over 4 + +=item * + +L + +A call is being made to a function in the C namespace, which is +currently experimental. + +=item * + +L + +The C block modifier is experimental. If you want to use the feature, +disable the warning with C, but know that in +doing so you are taking the risk that your code may break in a future Perl +version. + +=item * + +L + +This warning is emitted on a C statement that +requests a version below v5.11 (when the effects of C would be +disabled), after a previous declaration of one having a larger number (which +would have enabled these effects) + +=item * + +L + +This warning is emitted if you use C to iterate multiple values at +a time. This syntax is currently experimental and its behaviour may +change in future releases of Perl. + +=item * + +L + +An expression that implicitly involves the C<@_> arguments array was found in +a subroutine that uses a signature. + +=item * + +L + +An expression involving the C<@_> arguments array was found in a subroutine that uses a signature. + +=item * + +L + +Attempts to put wide characters into the program name (C<$0>) now provoke this +warning. + +=back + +=head2 Changes to Existing Diagnostics + +=over 4 + +=item * + +L<'E' does not take a repeat count in %s|perldiag/"'/' does not take a repeat count in %s"> + +This warning used to not include the C. + +=item * + +L + +Localized subroutine redefinitions no longer trigger this warning. + +=item * + +Ltarg %d:%d"|perldiag/"panic: unexpected constant lvalue entersub entry via type/targ %d:%d"> now has a panic prefix + +This makes it consistent with other checks of internal consistency when +compiling a subroutine. + +=item * + +L is now in the new C category. + +When C is used in scalar context, it provokes a warning that doing this +is not useful. This warning used to be in the C category. A new category +for warnings about scalar context has now been added, called C. + +=item * + +Removed a number of diagnostics + +Many diagnostics that have been removed from the perl core across many years +have now I been removed from the documentation. + +=back + +=head1 Configuration and Compilation + +=over 4 + +=item * + +The Perl C source code now uses some C99 features, which we have verified are +supported by all compilers we target. This means that Perl's headers now +contain some code that is legal in C99 but not C89. + +This may cause problems for some XS modules that unconditionally add +C<-Werror=declaration-after-statement> to their C compiler flags if compiling +with gcc or clang. Earlier versions of Perl support long obsolete compilers +that are strict in rejecting certain C99 features, particularly mixed +declarations and code, and hence it makes sense for XS module authors to audit +that their code does not violate this. However, doing this is now only +possible on these earlier versions of Perl, hence these modules need to be +changed to only add this flag for C<<$] < 5.035005>>. + +=item * + +The makedepend step is now run in parallel by using make + +When using MAKEFLAGS=-j8, this significantly reduces the time required for: + + sh ./makedepend MAKE=make cflags + +=item * + +F now tests whether C<< #include >> is required +to use the POSIX 1003 thread-safe locale functions or some related +extensions. This prevents problems where a non-public F is +removed in a library update, or F isn't intended for public +use. (github L<#18936|https://github.com/Perl/perl5/pull/18936>) + +=back + +=head1 Testing + +Tests were added and changed to reflect the other additions and changes +in this release. + +=head1 Platform Support + +=head2 Windows + +=over 4 + +=item * + +Support for old MSVC++ (pre-VC12) has been removed + +These did not support C99 and hence can no longer be used to compile perl. + +=item * + +Support for compiling perl on Windows using Microsoft Visual Studio 2022 +(containing Visual C++ 14.3) has been added. + +=item * + +The :win32 IO layer has been removed. This experimental replacement for the +:unix layer never reached maturity in its nearly two decades of existence. + +=back + +=head2 VMS + +=over 4 + +=item C on VMS returns consistent results + +On VMS entries in the C<%ENV> hash are loaded from the OS environment on +first access, hence the first iteration of C<%ENV> requires the entire +environment to be scanned to find all possible keys. This initialisation had +always been done correctly for full iteration, but previously was not +happening for C<%ENV> in scalar context, meaning that C would +return 0 if called before any other C<%ENV> access, or would only return the +count of keys accessed if there had been no iteration. + +These bugs are now fixed - C<%ENV> and C in scalar context now +return the correct result - the count of all keys in the environment. + +=back + +=head2 Discontinued Platforms + +=over 4 + +=item AT&T UWIN + +UWIN is a UNIX compatibility layer for Windows. It was last released +in 2012 and has been superseded by Cygwin these days. + +=item DOS/DJGPP + +DJGPP is a port of the GNU toolchain to 32-bit x86 systems running +DOS. The last known attempt to build Perl on it was on 5.20, which +only got as far as building miniperl. + +=item NetWare + +Support code for Novell NetWare has been removed. NetWare was a +server operating system by Novell. The port was last updated in July +2002, and the platform itself in May 2009. + +Unrelated changes accidentally broke the build for the NetWare port in +September 2009, and in 12 years no-one has reported this. + +=back + +=head2 Platform-Specific Notes + +=over 4 + +=item z/OS + +This update enables us to build EBCDIC static/dynamic and 31-bit/64-bit +addressing mode Perl. The number of tests that pass is consistent with the +baseline before these updates. + +These changes also provide the base support to be able to provide ASCII +static/dynamic and 31-bit/64-bit addressing mode Perl. + +The z/OS (previously called OS/390) README was updated to describe ASCII and +EBCDIC builds. + +=back + +=head1 Internal Changes + +=over 4 + +=item * + +Since the removal of PERL_OBJECT in Perl 5.8, PERL_IMPLICIT_CONTEXT and +MULTIPLICITY have been synonymous and they were being used interchangeably. +To simplify the code, all instances of PERL_IMPLICIT_CONTEXT have been +replaced with MULTIPLICITY. + +PERL_IMPLICIT_CONTEXT will remain defined for compatibility with XS modules. + +=item * + +The API constant formerly named C, indicating list context, has now +been renamed to a more accurate C. A compatibilty macro C has +been added to allow existing code to work unaffected. New code should be +written using the new constant instead. This is supported by C +version 3.63. + +=item * + +Macros have been added to F to facilitate version comparisons: +C, C, C and +C. + +Inline functions have been added to F to determine the position of +the least significant 1 bit in a word: C and C. + +=item * + +C has been deleted. This has been marked as deprecated +since v5.14.0 (released in 2011), and is not used by any code on CPAN. + +=item * + +Added new boolean macros and functions. See L for +related information and L for documentation. + +=over 4 + +=item * + +sv_setbool + +=item * + +sv_setbool_mg + +=item * + +SvIsBOOL + +=back + +=item * + +Added 4 missing functions for dealing with RVs: + +=over 4 + +=item * + +sv_setrv_noinc + +=item * + +sv_setrv_noinc_mg + +=item * + +sv_setrv_inc + +=item * + +sv_setrv_inc_mg + +=back + +=item * + +C's two failure modes now provide distinct messages. + +=item * + +Memory for hash iterator state (C) is now allocated as part +of the hash body, instead of as part of the block of memory allocated for the +main hash array. + +=item * + +A new phase_name() interface provides access to the name for each interpreter +phase (i.e., PL_phase value). + +=item * + +The C behavior of C has changed for EBCDIC. + +=item * + +New equality-test functions C and C have been added, along +with C<..._flags>-suffixed variants. These expose a simple and consistent API +to perform numerical or string comparison which is aware of operator +overloading. + +=item * + +Reading the string form of an integer value no longer sets the flag C. +The string form is still cached internally, and still re-read directly by the +macros C I (inline, without calling a C function). XS code that +already calls the APIs to get values will not be affected by this change. XS +code that accesses flags directly instead of using API calls to express its +intent I break, but such code likely is already buggy if passed some +other values, such as floating point values or objects with string overloading. + +This small change permits code (such as JSON serializers) to reliably determine +between + +=over 4 + +=item * + +a value that was initially B as an integer, but then B as a string + + my $answer = 42; + print "The answer is $answer\n"; + +=item * + +that same value that was initially B as a string, but then B as an integer + + my $answer = "42"; + print "That doesn't look right\n" + unless $answer == 6 * 9; + +=back + +For the first case (originally written as an integer), we now have: + + use Devel::Peek; + my $answer = 42; + Dump ($answer); + my $void = "$answer"; + print STDERR "\n"; + Dump($answer) + + + SV = IV(0x562538925778) at 0x562538925788 + REFCNT = 1 + FLAGS = (IOK,pIOK) + IV = 42 + + SV = PVIV(0x5625389263c0) at 0x562538925788 + REFCNT = 1 + FLAGS = (IOK,pIOK,pPOK) + IV = 42 + PV = 0x562538919b50 "42"\0 + CUR = 2 + LEN = 10 + +For the second (originally written as a string), we now have: + + use Devel::Peek; + my $answer = "42"; + Dump ($answer); + my $void = $answer == 6 * 9; + print STDERR "\n"; + Dump($answer)' + + + SV = PV(0x5586ffe9bfb0) at 0x5586ffec0788 + REFCNT = 1 + FLAGS = (POK,IsCOW,pPOK) + PV = 0x5586ffee7fd0 "42"\0 + CUR = 2 + LEN = 10 + COW_REFCNT = 1 + + SV = PVIV(0x5586ffec13c0) at 0x5586ffec0788 + REFCNT = 1 + FLAGS = (IOK,POK,IsCOW,pIOK,pPOK) + IV = 42 + PV = 0x5586ffee7fd0 "42"\0 + CUR = 2 + LEN = 10 + COW_REFCNT = 1 + +(One can't rely on the presence or absence of the flag C to +determine the history of operations on a scalar.) + +Previously both cases would be indistinguishable, with all 4 flags set: + + SV = PVIV(0x55d4d62edaf0) at 0x55d4d62f0930 + REFCNT = 1 + FLAGS = (IOK,POK,pIOK,pPOK) + IV = 42 + PV = 0x55d4d62e1740 "42"\0 + CUR = 2 + LEN = 10 + +(and possibly C, but not always) + +This now means that if XS code I needs to determine which form a value +was first written as, it should implement logic roughly + + if (flags & SVf_IOK|SVf_NOK) && !(flags & SVf_POK) + serialize as number + else if (flags & SVf_POK) + serialize as string + else + the existing guesswork ... + +Note that this doesn't cover "dualvars" - scalars that report different +values when asked for their string form or number form (such as C<$!>). +Most serialization formats cannot represent such duplicity. + +I remains because as well as dualvars, values might +be C, references, overloaded references, typeglobs and other things that +Perl itself can represent but do not map one-to-one into external formats, so +need some amount of approximation or encapsulation. + +=item * + +C (and L’s C function) now escapes high-bit +octets in the PV as hex rather than octal. Since most folks understand hex +more readily than octal, this should make these dumps a bit more legible. +This does B affect any other diagnostic interfaces like C. + +=back + +=head1 Selected Bug Fixes + +=over 4 + +=item * + +utime() now correctly sets errno/C<$!> when called on a closed handle. + +=item * + +The flags on the OPTVAL parameter to setsockopt() were previously +checked before magic was called, possibly treating a numeric value as +a packed buffer or vice versa. It also ignored the UTF-8 flag, +potentially treating the internal representation of an upgraded SV as +the bytes to supply to the setsockopt() system call. (github L<#18660|https://github.com/Perl/perl5/issues/18660>) + +=item * + +Only set IOKp, not IOK on $) and $(. +This was issue L<#18955|https://github.com/Perl/perl5/issues/18955>: This will prevent serializers from serializing these +variables as numbers (which loses the additional groups). +This restores behaviour from 5.16 + +=item * + +Use of the C debugging facility would cause perl to croak since +v5.31.10; this problem has now been fixed. + +=item * + +C logic is now compatible with BSD make (fixes +L). + +=item * + +Calling C on a tied hash that is partway through iteration now frees the +iteration state immediately. + +Iterating a tied hash causes perl to store a copy of the current hash key to +track the iteration state, with this stored copy passed as the second parameter +to C. This internal state is freed immediately when tie hash iteration +completes, or if the hash is destroyed, but due to an implementation oversight, +it was not freed if the hash was untied. In that case, the internal copy of the +key would persist until the earliest of + +=over 4 + +=item 1 + +C was called again on the same hash + +=item 2 + +The (now untied) hash was iterated (ie passed to any of C, C or +C) + +=item 3 + +The hash was destroyed. + +=back + +This inconsistency is now fixed - the internal state is now freed immediately by +C. + +As the precise timing of this behaviour can be observed with pure Perl code +(the timing of C on objects returned from C and C) +it's just possible that some code is sensitive to it. + +=item * + +The C function added for bootstrapping miniperl +in perl 5.30.0 is now only available in miniperl. [github #19122] + +=item * + +Setting a breakpoint on a BEGIN or equivalently a C statement +could cause a memory write to a freed C op. +[L] + +=item * + +When bareword filehandles are disabled, the parser was interpreting +any bareword as a filehandle, even when immediatey followed by parens. + +=back + +=head1 Errata From Previous Releases + +=over 4 + +=item * + +L mistakenly identified a CVE whose correct identification is +CVE-2015-1592. + +=back + +=head1 Obituaries + +Raun "Spider" Boardman (SPIDB on CPAN), author of at least 66 commits to the +Perl 5 core distribution between 1996 and 2002, passed away May 24, 2021 from +complications of COVID. He will be missed. + +David H. Adler (DHA) passed away on November 16, 2021. In 1997, David +co-founded NY.pm, the first Perl user group, and in 1998 co-founded Perl +Mongers to help establish other user groups across the globe. He was a +frequent attendee at Perl conferences in both North America and Europe and well +known for his role in organizing I celebrations at those +conferences. He also contributed to the work of the Perl Foundation, including +administering the White Camel awards for community service. He will be missed. + +=head1 Acknowledgements + +Perl 5.36.0 represents approximately a year of development since Perl +5.34.0 and contains approximately 250,000 lines of changes across 2,000 +files from 82 authors. + +Excluding auto-generated files, documentation and release tools, there were +approximately 190,000 lines of changes to 1,300 .pm, .t, .c and .h files. + +Perl continues to flourish into its fourth decade thanks to a vibrant +community of users and developers. The following people are known to have +contributed the improvements that became Perl 5.36.0: + +Alyssa Ross, Andrew Fresh, Aristotle Pagaltzis, Asher Mancinelli, Atsushi +Sugawara, Ben Cornett, Bernd, Biswapriyo Nath, Brad Barden, Bram, Branislav +Zahradník, brian d foy, Chad Granum, Chris 'BinGOs' Williams, Christian +Walde (Mithaldu), Christopher Yeleighton, Craig A. Berry, cuishuang, Curtis +Poe, Dagfinn Ilmari Mannsåker, Dan Book, Daniel Laügt, Dan Jacobson, Dan +Kogai, Dave Cross, Dave Lambley, David Cantrell, David Golden, David +Marshall, David Mitchell, E. Choroba, Eugen Konkov, Felipe Gasper, François +Perrad, Graham Knop, H.Merijn Brand, Hugo van der Sanden, Ilya Sashcheka, +Ivan Panchenko, Jakub Wilk, James E Keenan, James Raspass, Karen Etheridge, +Karl Williamson, Leam Hall, Leon Timmermans, Magnus Woldrich, Matthew +Horsfall, Max Maischein, Michael G Schwern, Michiel Beijen, Mike Fulton, +Neil Bowers, Nicholas Clark, Nicolas R, Niyas Sait, Olaf Alders, Paul Evans, +Paul Marquess, Petar-Kaleychev, Pete Houston, Renee Baecker, Ricardo Signes, +Richard Leach, Robert Rothenberg, Sawyer X, Scott Baker, Sergey Poznyakoff, +Sergey Zhmylove, Sisyphus, Slaven Rezic, Steve Hay, Sven Kirmess, TAKAI +Kousuke, Thibault Duponchelle, Todd Rinaldo, Tomasz Konojacki, Tomoyuki +Sadahiro, Tony Cook, Unicode Consortium, Yves Orton, Михаил +Козачков. + +The list above is almost certainly incomplete as it is automatically +generated from version control history. In particular, it does not include +the names of the (very much appreciated) contributors who reported issues to +the Perl bug tracker. + +Many of the changes included in this version originated in the CPAN modules +included in Perl's core. We're grateful to the entire CPAN community for +helping Perl to flourish. + +For a more complete list of all of Perl's historical contributors, please +see the AUTHORS file in the Perl source distribution. + +=head1 Reporting Bugs + +If you find what you think is a bug, you might check the perl bug database +at L. There may also be information at +L, the Perl Home Page. + +If you believe you have an unreported bug, please open an issue at +L. Be sure to trim your bug down to a +tiny but sufficient test case. + +If the bug you are reporting has security implications which make it +inappropriate to send to a public issue tracker, then see +L +for details of how to report the issue. + +=head1 Give Thanks + +If you wish to thank the Perl 5 Porters for the work we had done in Perl 5, +you can do so by running the C program: + + perlthanks + +This will send an email to the Perl 5 Porters list with your show of thanks. + +=head1 SEE ALSO + +The F file for an explanation of how to view exhaustive details on +what changed. + +The F file for how to build Perl. + +The F file for general stuff. + +The F and F files for copyright information. + +=cut diff --git a/gnu/usr.bin/perl/pod/perldelta.pod b/gnu/usr.bin/perl/pod/perldelta.pod index 615d725f8..f3f18f5bd 100644 --- a/gnu/usr.bin/perl/pod/perldelta.pod +++ b/gnu/usr.bin/perl/pod/perldelta.pod @@ -2,408 +2,21 @@ =head1 NAME -perldelta - what is new for perl v5.36.0 +perldelta - what is new for perl v5.36.1 =head1 DESCRIPTION -This document describes differences between the 5.34.0 release and the 5.36.0 +This document describes differences between the 5.36.0 release and the 5.36.1 release. -=head1 Core Enhancements - -=head2 C - -As always, C turns on the feature bundle for that version of Perl. - -The 5.36 bundle enables the C feature. Introduced in Perl version -5.20.0, and modified several times since, the subroutine signatures feature is -now no longer considered experimental. It is now considered a stable language -feature and no longer prints a warning. - - use v5.36; - - sub add ($x, $y) { - return $x + $y; - } - -Despite this, certain elements of signatured subroutines remain experimental; -see below. - -The 5.36 bundle enables the C feature. Introduced in Perl version 5.32.0, -this operator has remained unchanged since then. The operator is now considered -a stable language feature. For more detail see L. - -The 5.36 bundle also I the features C, and -C. These will forbid, respectively: the use of "indirect" -method calls (like C<$x = new Class;>); the use of a list expression as a hash -key to simulate sparse multidimensional arrays. The specifics of these changes -can be found in L, but the short version is: this is a bit like having -more C turned on, disabling features that cause more trouble than -they're worth. - -Furthermore, C will also enable warnings as if you'd written C. - -Finally, with this release, the experimental C feature, present in -every feature bundle since they were introduced in v5.10, has been removed from -the v5.36 bundle. If you want to use it (against our advice), you'll have to -enable it explicitly. - -=head2 -g command-line flag - -A new command-line flag, -g, is available. It is a simpler alias for -0777. - -For more information, see L. - -=head2 Unicode 14.0 is supported - -See L for details. - -=head2 regex sets are no longer considered experimental - -Prior to this release, the regex sets feature (officially named -"Extended Bracketed Character Classes") was considered experimental. -Introduced in Perl version 5.18.0, and modified several times since, -this is now considered a stable language feature and its use no longer -prints a warning. See L. - -=head2 Variable length lookbehind is mostly no longer considered experimental - -Prior to this release, any form of variable length lookbehind was -considered experimental. With this release the experimental status has -been reduced to cover only lookbehind that contains capturing parenthesis. -This is because it is not clear if - - "aaz"=~/(?=z)(?<=(a|aa))/ - -should match and leave $1 equaling "a" or "aa". Currently it will match -the longest possible alternative, "aa". While we are confident that the overall -construct will now match only when it should, we are not confident that we -will keep the current "longest match" behavior. - -=head2 SIGFPE no longer deferred - -Floating-point exceptions are now delivered immediately, in the same way -as other "fault"-like signals such as SIGSEGV. This means one has at -least a chance to catch such a signal with a C<$SIG{FPE}> handler, e.g. -so that C can report the line in perl that triggered it. - -=head2 Stable boolean tracking - -The "true" and "false" boolean values, often accessed by constructions like -C and C, as well as being returned from many core functions and -operators, now remember their boolean nature even through assignment into -variables. The new function C in L can check whether -a value has boolean nature. - -This is likely to be useful when interoperating with other languages or -data-type serialisation, among other places. - -=head2 iterating over multiple values at a time (experimental) - -You can now iterate over multiple values at a time by specifying a list of -lexicals within parentheses. For example, - - for my ($key, $value) (%hash) { ... } - for my ($left, $right, $gripping) (@moties) { ... } - -Prior to perl v5.36, attempting to specify a list after C was a syntax -error. - -This feature is currently experimental and will cause a warning of category -C. For more detail see L. -See also L in this document, which is a handy companion to -n-at-a-time foreach. - -=head2 builtin functions (experimental) - -A new core module L has been added, which provides documentation for -new always-present functions that are built into the interpreter. - - say "Reference type of arrays is ", builtin::reftype([]); - -It also provides a lexical import mechanism for providing short name versions -of these functions. - - use builtin 'reftype'; - say "Reference type of arrays is ", reftype([]); - -This builtin function mechanism and the functions it provides are all -currently B. We expect that C itself will cease to be -experimental in the near future, but that individual functions in it may become -stable on an ongoing basis. Other functions will be added to C over -time. - -For details, see L, but here's a summary of builtin functions in -v5.36: - -=over 4 - -=item builtin::trim - -This function treats its argument as a string, returning the result of removing -all white space at its beginning and ending. - -=item builtin::indexed - -This function returns a list twice as big as its argument list, where each item -is preceded by its index within that list. This is primarily useful for using -the new C syntax with multiple iterator variables to iterate over an -array or list, while also tracking the index of each item: - - use builtin 'indexed'; - - foreach my ($index, $val) (indexed @array) { - ... - } - -=item builtin::true, builtin::false, builtin::is_bool - -C and C return boolean true and false values. Perl is still perl, -and doesn't have strict typing of booleans, but these values will be known to -have been created as booleans. C will tell you whether a value was -known to have been created as a boolean. - -=item builtin::weaken, builtin::unweaken, builtin::is_weak - -These functions will, respectively: weaken a reference; strengthen a reference; -and return whether a reference is weak. (A weak reference is not counted for -garbage collection purposes. See L.) These can take the place of -some similar routines in L. - -=item builtin::blessed, builtin::refaddr, builtin::reftype - -These functions provide more data about references (or non-references, -actually!) and can take the place of similar routines found in L. - -=item builtin::ceil, builtin::floor - -C returns the smallest integer greater than or equal to its argument. -C returns the largest integer less than or equal to its argument. These -can take the place of similar routines found in L. - -=back - -=head2 C blocks (experimental) - -This release adds support for C blocks, which are blocks of code -prefixed by the C modifier. They provide a section of code which runs -at a later time, during scope exit. - -In brief, when a C block is reached at runtime, its body is set aside to -be run when the enclosing scope is exited. It is unlike a UNITCHECK (among -other reasons) in that if the block I the C block is exited -before the block is reached, it will not be run. - -C blocks can be used to take the place of "scope guard" objects where an -object is passed a code block to be run by its destructor. - -For more information, see L. - -=head2 try/catch can now have a C block (experimental) - -The experimental C/C syntax has been extended to support an -optional third block introduced by the C keyword. - - try { - attempt(); - print "Success\n"; - } - catch ($e) { - print "Failure\n"; - } - finally { - print "This happens regardless\n"; - } - -This provides code which runs at the end of the C/C construct, -even if aborted by an exception or control-flow keyword. They are similar -to C blocks. - -For more information, see L. - -=head2 non-ASCII delimiters for quote-like operators (experimental) - -Perl traditionally has allowed just four pairs of string/pattern -delimiters: S> S> S> and S >>>, all in the -ASCII range. Unicode has hundreds more possibilities, and using this -feature enables many of them. When enabled, you can say S> for -example, or S>. See L for details. - -=head2 @_ is now experimental within signatured subs - -Even though subroutine signatures are now stable, use of the legacy arguments -array (C<@_>) with a subroutine that has a signature I experimental, -with its own warning category. Silencing the C -warning category is not sufficient to dismiss this. The new warning is emitted -with the category name C. - -Any subroutine that has a signature and tries to make use of the defaults -argument array or an element thereof (C<@_> or C<$_[INDEX]>), either -explicitly or implicitly (such as C or C with no argument) will -provoke a warning at compile-time: - - use v5.36; - - sub f ($x, $y = 123) { - say "The first argument is $_[0]"; - } - -Z<> - - Use of @_ in array element with signatured subroutine is experimental - at file.pl line 4. - -The behaviour of code which attempts to do this is no longer specified, and -may be subject to change in a future version. +If you are upgrading from an earlier release such as 5.35.0, first read +L, which describes differences between 5.35.0 and 5.36.0. =head1 Incompatible Changes -=head2 A physically empty sort is now a compile-time error - - @a = sort @empty; # unaffected - @a = sort; # now a compile-time error - @a = sort (); # also a compile-time error - -A bare sort used to be a weird way to create an empty list; now it croaks -at compile time. This change is intended to free up some of the syntax space -for possible future enhancements to C. - -=head1 Deprecations - -=head2 C (where VERSION is below v5.11) after C is deprecated - -When in the scope of C or later, a C line where I is -lower than v5.11 will now issue a warning: - - Downgrading a use VERSION declaration to below v5.11 is deprecated - -For example: - - use v5.14; - say "The say statement is permitted"; - use v5.8; # This will print a warning - print "We must use print\n"; - -This is because the Perl team plans to change the behavior in this case. Since -Perl v5.12 (and parts of v5.11), strict is enabled I. In other words: - - no strict; - use v5.12; # will not enable strict, because "no strict" preceded it - $x = 1; # permitted, despite no "my" declaration - -In the future, this behavior will be eliminated and C will -I enable strict for versions v5.12 and later. - -Code which wishes to mix versions in this manner should use lexical scoping -with block syntax to ensure that the differently versioned regions remain -lexically isolated. - - { - use v5.14; - say "The say statement is permitted"; - } - - { - use v5.8; # No warning is emitted - print "We must use print\n"; - } - -Of course, this is probably not something you ever need to do! If the first -block compiles, it means you're using perl v5.14.0 or later. - -=head1 Performance Enhancements - -=over 4 - -=item * - -We now probe for compiler support for C11 thread local storage, and where -available use this for "implicit context" for XS extensions making API calls for -a threaded Perl build. This requires fewer function calls at the C level than -POSIX thread specific storage. We continue to use the the pthreads approach if -the C11 approach is not available. - -F run with the defaults will build an unthreaded Perl (which is -slightly faster), but most operating systems ship a threaded Perl. - -=item * - -Perl can now be configured to no longer allocate keys for large hashes -from the shared string table. - -The same internal datatype (C) is used for all of - -=over 4 - -=item * - -Symbol tables - -=item * - -Objects (by default) - -=item * - -Associative arrays - -=back - -The shared string table was originally added to improve performance for blessed -hashes used as objects, because every object instance has the same keys, so it -is an optimisation to share memory between them. It also makes sense for symbol -tables, where derived classes will have the same keys (typically method names), -and the OP trees built for method calls can also share memory. The shared -string table behaves roughly like a cache for hash keys. - -But for hashes actually used as associative arrays - mapping keys to values - -typically the keys are not re-used in other hashes. For example, "seen" hashes -are keyed by object IDs (or addresses), and logically these keys won't repeat -in other hashes. - -Storing these "used just once" keys in the shared string table increases CPU -and RAM use for no gain. For such keys the shared string table behaves as a -cache with a 0% hit rate. Storing all the keys there increases the total size -of the shared string table, as well as increasing the number of times it is -resized as it grows. B - in any environment that has "copy on write" -memory for child process (such as a pre-forking server), the memory pages used -for the shared string table rapidly need to be copied as the child process -manipulates hashes. Hence if most of the shared string table is such that keys -are used only in one place, there is no benefit from re-use within the perl -interpreter, but a high cost due to more pages for the OS to copy. - -The perl interpreter can now be Configured to disable shared hash keys -for "large" hashes (that are neither objects nor symbol tables). To do -so, add C<-Accflags='-DPERL_USE_UNSHARED_KEYS_IN_LARGE_HASHES'> to -your F options. "Large" is a heuristic -- currently the -heuristic is that sharing is disabled when adding a key to a hash -triggers allocation of more storage, and the hash has more than 42 keys. - -This B cause slightly increased memory usage for programs that create -(unblessed) data structures that contain multiple large hashes that share the -same keys. But generally our testing suggests that for the specific cases -described it is a win, and other code is unaffected. - -=item * - -In certain scenarios, creation of new scalars is now noticeably faster. - -For example, the following code is now executing ~30% faster: - - $str = "A" x 64; - for (0..1_000_000) { - @svs = split //, $str - } - -(You can read more about this one in L<[perl -#19414]|https://github.com/Perl/perl5/pull/19414>.) - -=back +There are no changes intentionally incompatible with 5.36.0. If any exist, +they are bugs, and we request that you submit a report. See +L below. =head1 Modules and Pragmata @@ -413,623 +26,7 @@ For example, the following code is now executing ~30% faster: =item * -L has been upgraded from version 2.38 to 2.40. - -=item * - -L has been upgraded from version 1.01 to 1.02. - -=item * - -L has been upgraded from version 0.33 to 0.34. - -=item * - -L has been upgraded from version 1.82 to 1.83. - -=item * - -L has been upgraded from version 1.004 to 1.006. - -=item * - -L has been upgraded from version 1.56 to 1.64. - -=item * - -L has been upgraded from version 0.51 to 0.65. - -=item * - -L has been upgraded from version 1.48 to 1.50. - -=item * - -L has been upgraded from version 2.101 to 2.103. - -=item * - -L has been upgraded from version 2.101 to 2.105. - -=item * - -L has been upgraded from version 2.28 to 2.33. - -=item * - -L has been upgraded from version 2.179 to 2.184. - -=item * - -L has been upgraded from version 1.855 to 1.857. - -=item * - -L has been upgraded from version 1.30 to 1.32. - -=item * - -L has been upgraded from version 3.62 to 3.68. - -=item * - -L has been upgraded from version 1.37 to 1.39. - -=item * - -L has been upgraded from version 1.19 to 1.20. - -=item * - -L has been upgraded from version 1.50 to 1.52. - -=item * - -L has been upgraded from version 3.08 to 3.17. - -=item * - -L has been upgraded from version 1.33 to 1.36. - -=item * - -L has been upgraded from version 0.024 to 0.028. - -=item * - -L has been upgraded from version 5.76 to 5.77. - -=item * - -L has been upgraded from version 7.62 to 7.64. - -=item * - -L has been upgraded from version 1.10 to 1.11. - -=item * - -L has been upgraded from version 3.43 to 3.45. - -=item * - -L has been upgraded from version 3.43 to 3.45. - -=item * - -L has been upgraded from version 1.14 to 1.15. - -=item * - -L has been upgraded from version 1.64 to 1.72. - -=item * - -L has been upgraded from version 1.1006 to 1.1007. - -=item * - -L has been upgraded from version 2.35 to 2.39. - -=item * - -L has been upgraded from version 1.00 to 1.04. - -=item * - -L has been upgraded from version 1.39 to 1.40. - -=item * - -L has been upgraded from version 1.33 to 1.37. - -=item * - -L has been upgraded from version 3.80 to 3.84. - -=item * - -L has been upgraded from version 1.09 to 1.12. - -=item * - -L has been upgraded from version 1.52 to 1.53. - -=item * - -L has been upgraded from version 1.19 to 1.23. - -=item * - -L has been upgraded from version 0.25 to 0.28. - -=item * - -L has been upgraded from version 1.21 to 1.26. - -=item * - -L has been upgraded from version 0.076 to 0.080. - -=item * - -L has been upgraded from version 0.19 to 0.21. - -=item * - -L has been upgraded from version 0.0609 to 0.0610. - -=item * - -L has been upgraded from version 1.46 to 1.50. - -=item * - -IO-Compress has been upgraded from version 2.102 to 2.106. - -=item * - -L has been upgraded from version 1.21 to 1.22. - -=item * - -L has been upgraded from version 4.06 to 4.07. - -=item * - -libnet has been upgraded from version 3.13 to 3.14. - -=item * - -L has been upgraded from version 1.29 to 1.31. - -=item * - -L has been upgraded from version 1.999818 to 1.999830. - -=item * - -L has been upgraded from version 0.5009 to 0.5012. - -=item * - -L has been upgraded from version 0.2614 to 0.2621. - -=item * - -L has been upgraded from version 5.20210520 to 5.20220520. - -=item * - -L has been upgraded from version 1.25_001 to 1.26. - -=item * - -L has been upgraded from version 0.68 to 0.69. - -=item * - -L has been upgraded from version 1.50 to 1.57. - -=item * - -L has been upgraded from version 1.12 to 1.13. - -=item * - -L has been upgraded from version 1.33 to 1.35. - -=item * - -L has been upgraded from version 5.20210411 to 5.20210520. - -=item * - -L has been upgraded from version 1.11 to 1.12. - -=item * - -L has been upgraded from version 1.13 to 1.14. - -=item * - -L has been upgraded from version 1.27 to 1.33. - -=item * - -L has been upgraded from version 3.42 to 3.43. - -=item * - -L has been upgraded from version 1.97 to 2.03. - -=item * - -L has been upgraded from version 0.41 to 0.43. - -=item * - -L has been upgraded from version 1.55 to 1.62. - -=item * - -L has been upgraded from version 1.09 to 1.10. - -=item * - -L has been upgraded from version 2.031 to 2.033. - -=item * - -L has been upgraded from version 2.04 to 2.05. - -=item * - -L has been upgraded from version 3.23 to 3.26. - -=item * - -L has been upgraded from version 1.23 to 1.24. - -=item * - -L has been upgraded from version 3.43 to 3.44. - -=item * - -L has been upgraded from version 1.302183 to 1.302190. - -=item * - -L has been upgraded from version 3.30 to 3.31. - -=item * - -L has been upgraded from version 2013.0523 to 2021.0814. - -=item * - -L has been upgraded from version 2013.0523 to 2021.0814. - -=item * - -L has been upgraded from version 2.26 to 2.27. - -=item * - -L has been upgraded from version 1.62 to 1.64. - -=item * - -L has been upgraded from version 4.2 to 4.3. - -=item * - -L has been upgraded from version 1.05 to 1.06. - -=item * - -L has been upgraded from version 1.05 to 1.06. - -=item * - -L has been upgraded from version 1.00 to 1.01. - -=item * - -L has been upgraded from version 1.9767 to 1.9770. - -=item * - -L has been upgraded from version 1.29 to 1.31. - -=item * - -L has been upgraded from version 1.28 to 1.31. - -=item * - -L has been upgraded from version 0.75 to 0.78. - -=item * - -L has been upgraded from version 1.13 to 1.14. - -=item * - -L has been upgraded from version 0.9928 to 0.9929. - -=item * - -L has been upgraded from version 1.12 to 1.13. - -=item * - -L has been upgraded from version 2.45 to 2.46. - -=item * - -L has been upgraded from version 1.51 to 1.58. - -=item * - -L has been upgraded from version 0.57 to 0.59. - -=item * - -L has been upgraded from version 1.16 to 1.22. - -=item * - -L has been upgraded from version 0.18 to 0.19. - -=item * - -L has been upgraded from version 0.30 to 0.31. - -=back - -=head1 Documentation - -=head2 New Documentation - -=head3 F - -This document provides the process for administering an election or vote -within the Perl Core Team. - -=head2 Changes to Existing Documentation - -We have attempted to update the documentation to reflect the changes -listed in this document. If you find any we have missed, open an issue -at L. - -Additionally, the following selected changes have been made: - -=head3 L - -=over 4 - -=item * - -This has been cleaned up some, and more than 80% of the (previously -many) undocumented functions have now either been documented or deemed -to have been inappropriately marked as API. - -As always, Patches Welcome! - -=back - -=head3 L - -=over 4 - -=item * - -notes the new location for functions moved from L to -L that are no longer intended to be used outside of core. - -=back - -=head3 L - -=over 4 - -=item * - -notes the C<:win32> IO pseudolayer is removed (this happened in 5.35.2). - -=back - -=head3 L - -=over 4 - -=item * - -The election process has been finetuned to allow the vote to be skipped if there -are no more candidates than open seats. - -=item * - -A special election is now allowed to be postponed for up to twelve weeks, for -example until a normal election. - -=back - -=head3 L - -=over 4 - -=item * - -now notes that an invocant only needs to be an object or class name -for method calls, not for subroutine references. - -=back - -=head3 L - -=over 4 - -=item * - -Updated to discourage the use of the /d regexp modifier. - -=back - -=head3 L - -=over 4 - -=item * - -B<-?> is now a synonym for B<-h> - -=item * - -B<-g> is now a synonym for B<-0777> - -=back - -=head1 Diagnostics - -The following additions or changes have been made to diagnostic output, -including warnings and fatal error messages. For the complete list of -diagnostic messages, see L. - -=head2 New Diagnostics - -=head3 New Errors - -=over 4 - -=item * - -L - -(F) An attempt was made to jump out of the scope of a defer block by using -a control-flow statement such as C, C or a loop control. This is -not permitted. - -=item * - -L (for scalar -assignment to C) - -Attempting to perform a scalar assignment to C, for example via -C, previously triggered a fatal runtime error with the -message "L." -It is more helpful to detect such attempted assignments prior to runtime, so -they are now compile time errors, resulting in the message "Can't modify undef -operator in scalar assignment". - -=item * - -L - -The parser failed an internal consistency check while trying to parse -a C loop. - -=back - -=head3 New Warnings - -=over 4 - -=item * - -L - -A call is being made to a function in the C namespace, which is -currently experimental. - -=item * - -L - -The C block modifier is experimental. If you want to use the feature, -disable the warning with C, but know that in -doing so you are taking the risk that your code may break in a future Perl -version. - -=item * - -L - -This warning is emitted on a C statement that -requests a version below v5.11 (when the effects of C would be -disabled), after a previous declaration of one having a larger number (which -would have enabled these effects) - -=item * - -L - -This warning is emitted if you use C to iterate multiple values at -a time. This syntax is currently experimental and its behaviour may -change in future releases of Perl. - -=item * - -L - -An expression that implicitly involves the C<@_> arguments array was found in -a subroutine that uses a signature. - -=item * - -L - -An expression involving the C<@_> arguments array was found in a subroutine that uses a signature. - -=item * - -L - -Attempts to put wide characters into the program name (C<$0>) now provoke this -warning. - -=back - -=head2 Changes to Existing Diagnostics - -=over 4 - -=item * - -L<'E' does not take a repeat count in %s|perldiag/"'/' does not take a repeat count in %s"> - -This warning used to not include the C. - -=item * - -L - -Localized subroutine redefinitions no longer trigger this warning. - -=item * - -Ltarg %d:%d"|perldiag/"panic: unexpected constant lvalue entersub entry via type/targ %d:%d"> now has a panic prefix - -This makes it consistent with other checks of internal consistency when -compiling a subroutine. - -=item * - -L is now in the new C category. - -When C is used in scalar context, it provokes a warning that doing this -is not useful. This warning used to be in the C category. A new category -for warnings about scalar context has now been added, called C. - -=item * - -Removed a number of diagnostics - -Many diagnostics that have been removed from the perl core across many years -have now I been removed from the documentation. +L has been upgraded from version 5.20220520 to 5.20230423. =back @@ -1039,359 +36,21 @@ have now I been removed from the documentation. =item * -The Perl C source code now uses some C99 features, which we have verified are -supported by all compilers we target. This means that Perl's headers now -contain some code that is legal in C99 but not C89. - -This may cause problems for some XS modules that unconditionally add -C<-Werror=declaration-after-statement> to their C compiler flags if compiling -with gcc or clang. Earlier versions of Perl support long obsolete compilers -that are strict in rejecting certain C99 features, particularly mixed -declarations and code, and hence it makes sense for XS module authors to audit -that their code does not violate this. However, doing this is now only -possible on these earlier versions of Perl, hence these modules need to be -changed to only add this flag for C<<$] < 5.035005>>. - -=item * - -The makedepend step is now run in parallel by using make - -When using MAKEFLAGS=-j8, this significantly reduces the time required for: - - sh ./makedepend MAKE=make cflags - -=item * - -F now tests whether C<< #include >> is required -to use the POSIX 1003 thread-safe locale functions or some related -extensions. This prevents problems where a non-public F is -removed in a library update, or F isn't intended for public -use. (github L<#18936|https://github.com/Perl/perl5/pull/18936>) +C probed for the return type of malloc() and free() by testing +whether declarations for those functions produced a function type mismatch with +the implementation. On Solaris, with a C++ compiler, this check always failed, +since Solaris instead imports malloc() and free() from C with C +for C++ builds. Since the return types of malloc() and free() are well defined +by the C standard, skip probing for them. C command-line arguments +and hints can still override these type in the unlikely case that is needed. +[L] =back =head1 Testing -Tests were added and changed to reflect the other additions and changes -in this release. - -=head1 Platform Support - -=head2 Windows - -=over 4 - -=item * - -Support for old MSVC++ (pre-VC12) has been removed - -These did not support C99 and hence can no longer be used to compile perl. - -=item * - -Support for compiling perl on Windows using Microsoft Visual Studio 2022 -(containing Visual C++ 14.3) has been added. - -=item * - -The :win32 IO layer has been removed. This experimental replacement for the -:unix layer never reached maturity in its nearly two decades of existence. - -=back - -=head2 VMS - -=over 4 - -=item C on VMS returns consistent results - -On VMS entries in the C<%ENV> hash are loaded from the OS environment on -first access, hence the first iteration of C<%ENV> requires the entire -environment to be scanned to find all possible keys. This initialisation had -always been done correctly for full iteration, but previously was not -happening for C<%ENV> in scalar context, meaning that C would -return 0 if called before any other C<%ENV> access, or would only return the -count of keys accessed if there had been no iteration. - -These bugs are now fixed - C<%ENV> and C in scalar context now -return the correct result - the count of all keys in the environment. - -=back - -=head2 Discontinued Platforms - -=over 4 - -=item AT&T UWIN - -UWIN is a UNIX compatibility layer for Windows. It was last released -in 2012 and has been superseded by Cygwin these days. - -=item DOS/DJGPP - -DJGPP is a port of the GNU toolchain to 32-bit x86 systems running -DOS. The last known attempt to build Perl on it was on 5.20, which -only got as far as building miniperl. - -=item NetWare - -Support code for Novell NetWare has been removed. NetWare was a -server operating system by Novell. The port was last updated in July -2002, and the platform itself in May 2009. - -Unrelated changes accidentally broke the build for the NetWare port in -September 2009, and in 12 years no-one has reported this. - -=back - -=head2 Platform-Specific Notes - -=over 4 - -=item z/OS - -This update enables us to build EBCDIC static/dynamic and 31-bit/64-bit -addressing mode Perl. The number of tests that pass is consistent with the -baseline before these updates. - -These changes also provide the base support to be able to provide ASCII -static/dynamic and 31-bit/64-bit addressing mode Perl. - -The z/OS (previously called OS/390) README was updated to describe ASCII and -EBCDIC builds. - -=back - -=head1 Internal Changes - -=over 4 - -=item * - -Since the removal of PERL_OBJECT in Perl 5.8, PERL_IMPLICIT_CONTEXT and -MULTIPLICITY have been synonymous and they were being used interchangeably. -To simplify the code, all instances of PERL_IMPLICIT_CONTEXT have been -replaced with MULTIPLICITY. - -PERL_IMPLICIT_CONTEXT will remain defined for compatibility with XS modules. - -=item * - -The API constant formerly named C, indicating list context, has now -been renamed to a more accurate C. A compatibilty macro C has -been added to allow existing code to work unaffected. New code should be -written using the new constant instead. This is supported by C -version 3.63. - -=item * - -Macros have been added to F to facilitate version comparisons: -C, C, C and -C. - -Inline functions have been added to F to determine the position of -the least significant 1 bit in a word: C and C. - -=item * - -C has been deleted. This has been marked as deprecated -since v5.14.0 (released in 2011), and is not used by any code on CPAN. - -=item * - -Added new boolean macros and functions. See L for -related information and L for documentation. - -=over 4 - -=item * - -sv_setbool - -=item * - -sv_setbool_mg - -=item * - -SvIsBOOL - -=back - -=item * - -Added 4 missing functions for dealing with RVs: - -=over 4 - -=item * - -sv_setrv_noinc - -=item * - -sv_setrv_noinc_mg - -=item * - -sv_setrv_inc - -=item * - -sv_setrv_inc_mg - -=back - -=item * - -C's two failure modes now provide distinct messages. - -=item * - -Memory for hash iterator state (C) is now allocated as part -of the hash body, instead of as part of the block of memory allocated for the -main hash array. - -=item * - -A new phase_name() interface provides access to the name for each interpreter -phase (i.e., PL_phase value). - -=item * - -The C behavior of C has changed for EBCDIC. - -=item * - -New equality-test functions C and C have been added, along -with C<..._flags>-suffixed variants. These expose a simple and consistent API -to perform numerical or string comparison which is aware of operator -overloading. - -=item * - -Reading the string form of an integer value no longer sets the flag C. -The string form is still cached internally, and still re-read directly by the -macros C I (inline, without calling a C function). XS code that -already calls the APIs to get values will not be affected by this change. XS -code that accesses flags directly instead of using API calls to express its -intent I break, but such code likely is already buggy if passed some -other values, such as floating point values or objects with string overloading. - -This small change permits code (such as JSON serializers) to reliably determine -between - -=over 4 - -=item * - -a value that was initially B as an integer, but then B as a string - - my $answer = 42; - print "The answer is $answer\n"; - -=item * - -that same value that was initially B as a string, but then B as an integer - - my $answer = "42"; - print "That doesn't look right\n" - unless $answer == 6 * 9; - -=back - -For the first case (originally written as an integer), we now have: - - use Devel::Peek; - my $answer = 42; - Dump ($answer); - my $void = "$answer"; - print STDERR "\n"; - Dump($answer) - - - SV = IV(0x562538925778) at 0x562538925788 - REFCNT = 1 - FLAGS = (IOK,pIOK) - IV = 42 - - SV = PVIV(0x5625389263c0) at 0x562538925788 - REFCNT = 1 - FLAGS = (IOK,pIOK,pPOK) - IV = 42 - PV = 0x562538919b50 "42"\0 - CUR = 2 - LEN = 10 - -For the second (originally written as a string), we now have: - - use Devel::Peek; - my $answer = "42"; - Dump ($answer); - my $void = $answer == 6 * 9; - print STDERR "\n"; - Dump($answer)' - - - SV = PV(0x5586ffe9bfb0) at 0x5586ffec0788 - REFCNT = 1 - FLAGS = (POK,IsCOW,pPOK) - PV = 0x5586ffee7fd0 "42"\0 - CUR = 2 - LEN = 10 - COW_REFCNT = 1 - - SV = PVIV(0x5586ffec13c0) at 0x5586ffec0788 - REFCNT = 1 - FLAGS = (IOK,POK,IsCOW,pIOK,pPOK) - IV = 42 - PV = 0x5586ffee7fd0 "42"\0 - CUR = 2 - LEN = 10 - COW_REFCNT = 1 - -(One can't rely on the presence or absence of the flag C to -determine the history of operations on a scalar.) - -Previously both cases would be indistinguishable, with all 4 flags set: - - SV = PVIV(0x55d4d62edaf0) at 0x55d4d62f0930 - REFCNT = 1 - FLAGS = (IOK,POK,pIOK,pPOK) - IV = 42 - PV = 0x55d4d62e1740 "42"\0 - CUR = 2 - LEN = 10 - -(and possibly C, but not always) - -This now means that if XS code I needs to determine which form a value -was first written as, it should implement logic roughly - - if (flags & SVf_IOK|SVf_NOK) && !(flags & SVf_POK) - serialize as number - else if (flags & SVf_POK) - serialize as string - else - the existing guesswork ... - -Note that this doesn't cover "dualvars" - scalars that report different -values when asked for their string form or number form (such as C<$!>). -Most serialization formats cannot represent such duplicity. - -I remains because as well as dualvars, values might -be C, references, overloaded references, typeglobs and other things that -Perl itself can represent but do not map one-to-one into external formats, so -need some amount of approximation or encapsulation. - -=item * - -C (and L’s C function) now escapes high-bit -octets in the PV as hex rather than octal. Since most folks understand hex -more readily than octal, this should make these dumps a bit more legible. -This does B affect any other diagnostic interfaces like C. - -=back +Tests were added and changed to reflect the other additions and changes in this +release. =head1 Selected Bug Fixes @@ -1399,159 +58,63 @@ This does B affect any other diagnostic interfaces like C. =item * -utime() now correctly sets errno/C<$!> when called on a closed handle. +An eval() as the last statement in a regex code block could trigger an +interpreter panic; e.g. + + /(?{ ...; eval {....}; })/ + +[L] =item * -The flags on the OPTVAL parameter to setsockopt() were previously -checked before magic was called, possibly treating a numeric value as -a packed buffer or vice versa. It also ignored the UTF-8 flag, -potentially treating the internal representation of an upgraded SV as -the bytes to supply to the setsockopt() system call. (github L<#18660|https://github.com/Perl/perl5/issues/18660>) +An C referring to a lexical sub defined in grandparent scope no +longer produces an assertion failures. +[L] =item * -Only set IOKp, not IOK on $) and $(. -This was issue L<#18955|https://github.com/Perl/perl5/issues/18955>: This will prevent serializers from serializing these -variables as numbers (which loses the additional groups). -This restores behaviour from 5.16 - -=item * - -Use of the C debugging facility would cause perl to croak since -v5.31.10; this problem has now been fixed. - -=item * - -C logic is now compatible with BSD make (fixes -L). - -=item * - -Calling C on a tied hash that is partway through iteration now frees the -iteration state immediately. - -Iterating a tied hash causes perl to store a copy of the current hash key to -track the iteration state, with this stored copy passed as the second parameter -to C. This internal state is freed immediately when tie hash iteration -completes, or if the hash is destroyed, but due to an implementation oversight, -it was not freed if the hash was untied. In that case, the internal copy of the -key would persist until the earliest of - -=over 4 - -=item 1 - -C was called again on the same hash - -=item 2 - -The (now untied) hash was iterated (ie passed to any of C, C or -C) - -=item 3 - -The hash was destroyed. +Writing to a magic variables associated with the selected output handle, C<$^>, +C<$~>, C<$=>, C<$-> and C<$%>, no longer crashes perl if the IO object has been +cleared from the selected output handle. +[L] =back -This inconsistency is now fixed - the internal state is now freed immediately by -C. - -As the precise timing of this behaviour can be observed with pure Perl code -(the timing of C on objects returned from C and C) -it's just possible that some code is sensitive to it. - -=item * - -The C function added for bootstrapping miniperl -in perl 5.30.0 is now only available in miniperl. [github #19122] - -=item * - -Setting a breakpoint on a BEGIN or equivalently a C statement -could cause a memory write to a freed C op. -[L] - -=item * - -When bareword filehandles are disabled, the parser was interpreting -any bareword as a filehandle, even when immediatey followed by parens. - -=back - -=head1 Errata From Previous Releases - -=over 4 - -=item * - -L mistakenly identified a CVE whose correct identification is -CVE-2015-1592. - -=back - -=head1 Obituaries - -Raun "Spider" Boardman (SPIDB on CPAN), author of at least 66 commits to the -Perl 5 core distribution between 1996 and 2002, passed away May 24, 2021 from -complications of COVID. He will be missed. - -David H. Adler (DHA) passed away on November 16, 2021. In 1997, David -co-founded NY.pm, the first Perl user group, and in 1998 co-founded Perl -Mongers to help establish other user groups across the globe. He was a -frequent attendee at Perl conferences in both North America and Europe and well -known for his role in organizing I celebrations at those -conferences. He also contributed to the work of the Perl Foundation, including -administering the White Camel awards for community service. He will be missed. - =head1 Acknowledgements -Perl 5.36.0 represents approximately a year of development since Perl -5.34.0 and contains approximately 250,000 lines of changes across 2,000 -files from 82 authors. +Perl 5.36.1 represents approximately 11 months of development since Perl 5.36.0 +and contains approximately 5,500 lines of changes across 62 files from 24 +authors. Excluding auto-generated files, documentation and release tools, there were -approximately 190,000 lines of changes to 1,300 .pm, .t, .c and .h files. +approximately 1,600 lines of changes to 23 .pm, .t, .c and .h files. -Perl continues to flourish into its fourth decade thanks to a vibrant -community of users and developers. The following people are known to have -contributed the improvements that became Perl 5.36.0: +Perl continues to flourish into its fourth decade thanks to a vibrant community +of users and developers. The following people are known to have contributed +the improvements that became Perl 5.36.1: -Alyssa Ross, Andrew Fresh, Aristotle Pagaltzis, Asher Mancinelli, Atsushi -Sugawara, Ben Cornett, Bernd, Biswapriyo Nath, Brad Barden, Bram, Branislav -Zahradník, brian d foy, Chad Granum, Chris 'BinGOs' Williams, Christian -Walde (Mithaldu), Christopher Yeleighton, Craig A. Berry, cuishuang, Curtis -Poe, Dagfinn Ilmari Mannsåker, Dan Book, Daniel Laügt, Dan Jacobson, Dan -Kogai, Dave Cross, Dave Lambley, David Cantrell, David Golden, David -Marshall, David Mitchell, E. Choroba, Eugen Konkov, Felipe Gasper, François -Perrad, Graham Knop, H.Merijn Brand, Hugo van der Sanden, Ilya Sashcheka, -Ivan Panchenko, Jakub Wilk, James E Keenan, James Raspass, Karen Etheridge, -Karl Williamson, Leam Hall, Leon Timmermans, Magnus Woldrich, Matthew -Horsfall, Max Maischein, Michael G Schwern, Michiel Beijen, Mike Fulton, -Neil Bowers, Nicholas Clark, Nicolas R, Niyas Sait, Olaf Alders, Paul Evans, -Paul Marquess, Petar-Kaleychev, Pete Houston, Renee Baecker, Ricardo Signes, -Richard Leach, Robert Rothenberg, Sawyer X, Scott Baker, Sergey Poznyakoff, -Sergey Zhmylove, Sisyphus, Slaven Rezic, Steve Hay, Sven Kirmess, TAKAI -Kousuke, Thibault Duponchelle, Todd Rinaldo, Tomasz Konojacki, Tomoyuki -Sadahiro, Tony Cook, Unicode Consortium, Yves Orton, Михаил -Козачков. +Andreas König, Bram, Chris 'BinGOs' Williams, Craig A. Berry, Dagfinn Ilmari +Mannsåker, David Mitchell, Elvin Aslanov, Florian Weimer, Graham Knop, Hugo +van der Sanden, Karen Etheridge, Karl Williamson, Leon Timmermans, Matthew +Horsfall, Max Maischein, Neil Bowers, Nicolas R, Renee Baecker, Ricardo Signes, +Richard Leach, Steve Hay, Todd Rinaldo, Tony Cook, Yves Orton. -The list above is almost certainly incomplete as it is automatically -generated from version control history. In particular, it does not include -the names of the (very much appreciated) contributors who reported issues to -the Perl bug tracker. +The list above is almost certainly incomplete as it is automatically generated +from version control history. In particular, it does not include the names of +the (very much appreciated) contributors who reported issues to the Perl bug +tracker. Many of the changes included in this version originated in the CPAN modules -included in Perl's core. We're grateful to the entire CPAN community for +included in Perl's core. We're grateful to the entire CPAN community for helping Perl to flourish. -For a more complete list of all of Perl's historical contributors, please +For a more complete list of all of Perl's historical contributors, please see +the F file in the Perl source distribution. =head1 Reporting Bugs -If you find what you think is a bug, you might check the perl bug database -at L. There may also be information at +If you find what you think is a bug, you might check the perl bug database at +L. There may also be information at L, the Perl Home Page. If you believe you have an unreported bug, please open an issue at @@ -1560,13 +123,13 @@ tiny but sufficient test case. If the bug you are reporting has security implications which make it inappropriate to send to a public issue tracker, then see -L -for details of how to report the issue. +L for details of how to +report the issue. =head1 Give Thanks -If you wish to thank the Perl 5 Porters for the work we had done in Perl 5, -you can do so by running the C program: +If you wish to thank the Perl 5 Porters for the work we had done in Perl 5, you +can do so by running the C program: perlthanks diff --git a/gnu/usr.bin/perl/pod/perlexperiment.pod b/gnu/usr.bin/perl/pod/perlexperiment.pod index 1daf70199..bd0100d16 100644 --- a/gnu/usr.bin/perl/pod/perlexperiment.pod +++ b/gnu/usr.bin/perl/pod/perlexperiment.pod @@ -184,7 +184,7 @@ L<[perl #19764]|https://github.com/Perl/perl5/issues/19764>. Introduced in Perl 5.36.0 -Using this feature triggers warnings in the category C. +Using this feature triggers warnings in the category C. This feature adds a new kind of block, a C block, which will not be executed until the containing block is being exited. @@ -197,7 +197,7 @@ L<[perl #17949]|https://github.com/Perl/perl5/issues/17949>. Introduced in Perl 5.36.0 Using this feature triggers warnings in the category -C. +C. This feature allows for many non-ASCII pairs of mirroring delimiters, for example: diff --git a/gnu/usr.bin/perl/pod/perlhist.pod b/gnu/usr.bin/perl/pod/perlhist.pod index 7c4785b3a..7f274cd55 100644 --- a/gnu/usr.bin/perl/pod/perlhist.pod +++ b/gnu/usr.bin/perl/pod/perlhist.pod @@ -35,7 +35,7 @@ Little, Dave Rolsky, Max Maischein, Abigail, Jesse Luehrs, Tony Cook, Dominic Hargreaves, Aaron Crane, Aristotle Pagaltzis, Matthew Horsfall, Peter Martini, Sawyer X, Chad 'Exodist' Granum, Renee Bäcker, Eric Herman, John SJ Anderson, Karen Etheridge, Zak B. Elep, Tom Hukins, Richard Leach, -and Neil Bowers. +Neil Bowers and Yves Orton. =head2 PUMPKIN? @@ -734,6 +734,23 @@ the strings?). Ricardo 5.36.0-RC2 2022-May-20 Ricardo 5.36.0-RC3 2022-May-22 Ricardo 5.36.0 2022-May-27 + Steve 5.36.1-RC1 2023-Apr-10 + Steve 5.36.1-RC2 2023-Apr-11 + Steve 5.36.1-RC3 2023-Apr-16 + Steve 5.36.1 2023-Apr-23 + + Ricardo 5.37.0 2022-May-27 The 5.37 development track + Matthew H 5.37.1 2022-Jun-20 + Nicolas R 5.37.2 2022-Jul-20 + Neil B 5.37.3 2022-Aug-20 + Ether 5.37.4 2022-Sep-20 + Todd R 5.37.5 2022-Oct-20 + Max M 5.37.6 2022-Nov-20 + Richard L 5.37.7 2022-Dec-20 + Renee 5.37.8 2023-Jan-20 + Ether 5.37.9 2023-Feb-20 + Yves 5.37.10 2023-Mar-20 + Steve 5.37.11 2023-Apr-20 =head2 SELECTED RELEASE SIZES diff --git a/gnu/usr.bin/perl/pp_ctl.c b/gnu/usr.bin/perl/pp_ctl.c index 86f5f2c34..9de77afbf 100644 --- a/gnu/usr.bin/perl/pp_ctl.c +++ b/gnu/usr.bin/perl/pp_ctl.c @@ -653,15 +653,15 @@ PP(pp_formline) break; } else { + if (size == fieldsize) + break; if (strchr(PL_chopset, *s)) { /* provisional split point */ /* for a non-space split char, we include * the split char; hence the '+1' */ chophere = s + 1; - itemsize = size; + itemsize = size + 1; } - if (size == fieldsize) - break; if (!isCNTRL(*s)) gotsome = TRUE; } @@ -3347,11 +3347,16 @@ S_docatch(pTHX_ Perl_ppaddr_t firstpp) case 0: PL_op = firstpp(aTHX); redo_body: - CALLRUNOPS(aTHX); + if (PL_op) { + CALLRUNOPS(aTHX); + } break; case 3: - /* die caught by an inner eval - continue inner loop */ - if (PL_restartop && PL_restartjmpenv == PL_top_env) { + if (PL_restartjmpenv == PL_top_env) { + /* die caught by an inner eval - continue inner loop */ + + if (!PL_restartop) + break; PL_restartjmpenv = NULL; PL_op = PL_restartop; PL_restartop = 0; diff --git a/gnu/usr.bin/perl/pp_hot.c b/gnu/usr.bin/perl/pp_hot.c index d3a0aa177..3fe972819 100644 --- a/gnu/usr.bin/perl/pp_hot.c +++ b/gnu/usr.bin/perl/pp_hot.c @@ -861,7 +861,7 @@ PP(pp_multiconcat) /* Note that we iterate the loop nargs+1 times: to append nargs * arguments and nargs+1 constant strings. For example, "-$a-$b-" */ - svpv_p = svpv_base - 1; + svpv_p = svpv_base; for (;;) { SSize_t len = (const_lens++)->ssize; @@ -873,7 +873,7 @@ PP(pp_multiconcat) const_pv += len; } - if (++svpv_p == svpv_end) + if (svpv_p == svpv_end) break; /* append next arg */ @@ -901,6 +901,7 @@ PP(pp_multiconcat) targ_pv += len; } + ++svpv_p; } } diff --git a/gnu/usr.bin/perl/proto.h b/gnu/usr.bin/perl/proto.h index 873347ca9..91a4443fe 100644 --- a/gnu/usr.bin/perl/proto.h +++ b/gnu/usr.bin/perl/proto.h @@ -5709,54 +5709,40 @@ STATIC SSize_t S_unpack_rec(pTHX_ struct tempsym* symptr, const char *s, const c #endif #if defined(PERL_IN_PP_SORT_C) #ifndef PERL_NO_INLINE_FUNCTIONS -PERL_STATIC_FORCE_INLINE I32 S_amagic_cmp(pTHX_ SV *const str1, SV *const str2) - __attribute__always_inline__; +PERL_STATIC_INLINE I32 S_amagic_cmp(pTHX_ SV *const str1, SV *const str2); #define PERL_ARGS_ASSERT_AMAGIC_CMP \ assert(str1); assert(str2) #endif - #ifndef PERL_NO_INLINE_FUNCTIONS -PERL_STATIC_FORCE_INLINE I32 S_amagic_cmp_desc(pTHX_ SV *const str1, SV *const str2) - __attribute__always_inline__; +PERL_STATIC_INLINE I32 S_amagic_cmp_desc(pTHX_ SV *const str1, SV *const str2); #define PERL_ARGS_ASSERT_AMAGIC_CMP_DESC \ assert(str1); assert(str2) #endif - #ifndef PERL_NO_INLINE_FUNCTIONS -PERL_STATIC_FORCE_INLINE I32 S_amagic_i_ncmp(pTHX_ SV *const a, SV *const b) - __attribute__always_inline__; +PERL_STATIC_INLINE I32 S_amagic_i_ncmp(pTHX_ SV *const a, SV *const b); #define PERL_ARGS_ASSERT_AMAGIC_I_NCMP \ assert(a); assert(b) #endif - #ifndef PERL_NO_INLINE_FUNCTIONS -PERL_STATIC_FORCE_INLINE I32 S_amagic_i_ncmp_desc(pTHX_ SV *const a, SV *const b) - __attribute__always_inline__; +PERL_STATIC_INLINE I32 S_amagic_i_ncmp_desc(pTHX_ SV *const a, SV *const b); #define PERL_ARGS_ASSERT_AMAGIC_I_NCMP_DESC \ assert(a); assert(b) #endif - #ifndef PERL_NO_INLINE_FUNCTIONS -PERL_STATIC_FORCE_INLINE I32 S_amagic_ncmp(pTHX_ SV *const a, SV *const b) - __attribute__always_inline__; +PERL_STATIC_INLINE I32 S_amagic_ncmp(pTHX_ SV *const a, SV *const b); #define PERL_ARGS_ASSERT_AMAGIC_NCMP \ assert(a); assert(b) #endif - #ifndef PERL_NO_INLINE_FUNCTIONS -PERL_STATIC_FORCE_INLINE I32 S_amagic_ncmp_desc(pTHX_ SV *const a, SV *const b) - __attribute__always_inline__; +PERL_STATIC_INLINE I32 S_amagic_ncmp_desc(pTHX_ SV *const a, SV *const b); #define PERL_ARGS_ASSERT_AMAGIC_NCMP_DESC \ assert(a); assert(b) #endif - #ifndef PERL_NO_INLINE_FUNCTIONS -PERL_STATIC_FORCE_INLINE I32 S_cmp_desc(pTHX_ SV *const str1, SV *const str2) - __attribute__always_inline__; +PERL_STATIC_INLINE I32 S_cmp_desc(pTHX_ SV *const str1, SV *const str2); #define PERL_ARGS_ASSERT_CMP_DESC \ assert(str1); assert(str2) #endif - STATIC I32 S_sortcv(pTHX_ SV *const a, SV *const b); #define PERL_ARGS_ASSERT_SORTCV \ assert(a); assert(b) @@ -5774,55 +5760,41 @@ PERL_STATIC_FORCE_INLINE void S_sortsv_flags_impl(pTHX_ SV** array, size_t num_e #endif #ifndef PERL_NO_INLINE_FUNCTIONS -PERL_STATIC_FORCE_INLINE I32 S_sv_i_ncmp(pTHX_ SV *const a, SV *const b) - __attribute__always_inline__; +PERL_STATIC_INLINE I32 S_sv_i_ncmp(pTHX_ SV *const a, SV *const b); #define PERL_ARGS_ASSERT_SV_I_NCMP \ assert(a); assert(b) #endif - #ifndef PERL_NO_INLINE_FUNCTIONS -PERL_STATIC_FORCE_INLINE I32 S_sv_i_ncmp_desc(pTHX_ SV *const a, SV *const b) - __attribute__always_inline__; +PERL_STATIC_INLINE I32 S_sv_i_ncmp_desc(pTHX_ SV *const a, SV *const b); #define PERL_ARGS_ASSERT_SV_I_NCMP_DESC \ assert(a); assert(b) #endif - #ifndef PERL_NO_INLINE_FUNCTIONS -PERL_STATIC_FORCE_INLINE I32 S_sv_ncmp(pTHX_ SV *const a, SV *const b) - __attribute__always_inline__; +PERL_STATIC_INLINE I32 S_sv_ncmp(pTHX_ SV *const a, SV *const b); #define PERL_ARGS_ASSERT_SV_NCMP \ assert(a); assert(b) #endif - #ifndef PERL_NO_INLINE_FUNCTIONS -PERL_STATIC_FORCE_INLINE I32 S_sv_ncmp_desc(pTHX_ SV *const a, SV *const b) - __attribute__always_inline__; +PERL_STATIC_INLINE I32 S_sv_ncmp_desc(pTHX_ SV *const a, SV *const b); #define PERL_ARGS_ASSERT_SV_NCMP_DESC \ assert(a); assert(b) #endif - # if defined(USE_LOCALE_COLLATE) #ifndef PERL_NO_INLINE_FUNCTIONS -PERL_STATIC_FORCE_INLINE I32 S_amagic_cmp_locale(pTHX_ SV *const str1, SV *const str2) - __attribute__always_inline__; +PERL_STATIC_INLINE I32 S_amagic_cmp_locale(pTHX_ SV *const str1, SV *const str2); #define PERL_ARGS_ASSERT_AMAGIC_CMP_LOCALE \ assert(str1); assert(str2) #endif - #ifndef PERL_NO_INLINE_FUNCTIONS -PERL_STATIC_FORCE_INLINE I32 S_amagic_cmp_locale_desc(pTHX_ SV *const str1, SV *const str2) - __attribute__always_inline__; +PERL_STATIC_INLINE I32 S_amagic_cmp_locale_desc(pTHX_ SV *const str1, SV *const str2); #define PERL_ARGS_ASSERT_AMAGIC_CMP_LOCALE_DESC \ assert(str1); assert(str2) #endif - #ifndef PERL_NO_INLINE_FUNCTIONS -PERL_STATIC_FORCE_INLINE I32 S_cmp_locale_desc(pTHX_ SV *const str1, SV *const str2) - __attribute__always_inline__; +PERL_STATIC_INLINE I32 S_cmp_locale_desc(pTHX_ SV *const str1, SV *const str2); #define PERL_ARGS_ASSERT_CMP_LOCALE_DESC \ assert(str1); assert(str2) #endif - # endif #endif #if defined(PERL_IN_PP_SYS_C) @@ -6772,9 +6744,15 @@ STATIC void S_mem_log_common(enum mem_log_type mlt, const UV n, const UV typesiz PERL_CALLCONV Malloc_t Perl_mem_log_alloc(const UV nconst, UV typesize, const char *type_name, Malloc_t newalloc, const char *filename, const int linenumber, const char *funcname); #define PERL_ARGS_ASSERT_MEM_LOG_ALLOC \ assert(type_name); assert(filename); assert(funcname) +PERL_CALLCONV void Perl_mem_log_del_sv(const SV *sv, const char *filename, int linenumber, const char *funcname); +#define PERL_ARGS_ASSERT_MEM_LOG_DEL_SV \ + assert(sv); assert(filename); assert(funcname) PERL_CALLCONV Malloc_t Perl_mem_log_free(Malloc_t oldalloc, const char *filename, const int linenumber, const char *funcname); #define PERL_ARGS_ASSERT_MEM_LOG_FREE \ assert(filename); assert(funcname) +PERL_CALLCONV void Perl_mem_log_new_sv(const SV *sv, const char *filename, int linenumber, const char *funcname); +#define PERL_ARGS_ASSERT_MEM_LOG_NEW_SV \ + assert(sv); assert(filename); assert(funcname) PERL_CALLCONV Malloc_t Perl_mem_log_realloc(const UV n, const UV typesize, const char *type_name, Malloc_t oldalloc, Malloc_t newalloc, const char *filename, const int linenumber, const char *funcname); #define PERL_ARGS_ASSERT_MEM_LOG_REALLOC \ assert(type_name); assert(filename); assert(funcname) diff --git a/gnu/usr.bin/perl/sv.c b/gnu/usr.bin/perl/sv.c index 16bba941c..669678a35 100644 --- a/gnu/usr.bin/perl/sv.c +++ b/gnu/usr.bin/perl/sv.c @@ -5764,16 +5764,6 @@ Perl_sv_magic(pTHX_ SV *const sv, SV *const obj, const int how, } } - /* Force pos to be stored as characters, not bytes. */ - if (SvMAGICAL(sv) && DO_UTF8(sv) - && (mg = mg_find(sv, PERL_MAGIC_regex_global)) - && mg->mg_len != -1 - && mg->mg_flags & MGf_BYTES) { - mg->mg_len = (SSize_t)sv_pos_b2u_flags(sv, (STRLEN)mg->mg_len, - SV_CONST_RETURN); - mg->mg_flags &= ~MGf_BYTES; - } - /* Rest of work is done else where */ mg = sv_magicext(sv,obj,how,vtable,name,namlen); diff --git a/gnu/usr.bin/perl/t/io/defout.t b/gnu/usr.bin/perl/t/io/defout.t index aa4066616..2c8af5c80 100644 --- a/gnu/usr.bin/perl/t/io/defout.t +++ b/gnu/usr.bin/perl/t/io/defout.t @@ -14,7 +14,7 @@ BEGIN { $|=0; # test.pl makes it 1, and that conflicts with the below. -plan tests => 16; +plan tests => 22; my $stdout = *STDOUT; @@ -48,6 +48,20 @@ $- = 1; pass '$- = 1'; $% = 1; pass '$% = 1'; $| = 1; pass '$| = 1'; +# test a NULLed GV +my $t = tempfile; +open FOO, ">", $t or die; +select(FOO); +my $io = *FOO{IO}; +*FOO = 0; +$^ = 1; pass 'empty GV: $^ = 1'; +$~ = 1; pass 'empty GV: $~ = 1'; +$= = 1; pass 'empty GV: $= = 1'; +$- = 1; pass 'empty GV: $- = 1'; +$% = 1; pass 'empty GV: $% = 1'; +$| = 1; pass 'empty GV: $| = 1'; +close $io; + # Switch to STDERR for this test, so we do not lose our test output my $stderr = *STDERR; select($stderr); diff --git a/gnu/usr.bin/perl/t/op/lexsub.t b/gnu/usr.bin/perl/t/op/lexsub.t index f085cd97e..639fd2986 100644 --- a/gnu/usr.bin/perl/t/op/lexsub.t +++ b/gnu/usr.bin/perl/t/op/lexsub.t @@ -7,7 +7,7 @@ BEGIN { *bar::is = *is; *bar::like = *like; } -plan 150; +plan 151; # -------------------- our -------------------- # @@ -960,3 +960,14 @@ like runperl( is join("-", qw(aa bb), do { my sub lleexx; 123 }, qw(cc dd)), "aa-bb-123-cc-dd", 'do { my sub...} in a list [perl #132442]'; + +{ + # this would crash because find_lexical_cv() couldn't handle an + # intermediate scope which didn't include the sub + no warnings 'experimental::builtin'; + use builtin 'ceil'; + sub nested { + ok(eval 'ceil(1.5)', "no assertion failure calling a lexical sub from nested eval"); + } + nested(); +} diff --git a/gnu/usr.bin/perl/t/op/method.t b/gnu/usr.bin/perl/t/op/method.t index d0fc32180..ff404a91a 100644 --- a/gnu/usr.bin/perl/t/op/method.t +++ b/gnu/usr.bin/perl/t/op/method.t @@ -13,7 +13,7 @@ BEGIN { use strict; no warnings 'once'; -plan(tests => 162); +plan(tests => 163); { # RT #126042 &{1==1} * &{1==1} would crash @@ -715,6 +715,32 @@ SKIP: { like ($@, qr/Modification of a read-only value attempted/, 'RT #123619'); } +{ + fresh_perl_is(<<'PROG', <<'EXPECT', {}, "don't negative cache NOUNIVERSAL lookups"); +use v5.36; + +my $foo; + +BEGIN { + $foo = bless {}, 'Foo'; + $foo->isa('Foo') and say "->isa works!"; + } + +# bump PL_sub_generation +local *Foo::DESTROY = sub {}; +undef &Foo::DESTROY; +local *Foo::DESTROY = sub {}; + +$foo isa 'Foo' and say " and isa works!"; +$foo->isa('Foo') and say "->isa works!"; + +PROG +->isa works! + and isa works! +->isa works! +EXPECT +} + # RT#130496: assertion failure when looking for a method of undefined name # on an unblessed reference fresh_perl_is('eval { {}->$x }; print $@;', diff --git a/gnu/usr.bin/perl/t/op/taint.t b/gnu/usr.bin/perl/t/op/taint.t index 00460f0ab..1d2449d8e 100644 --- a/gnu/usr.bin/perl/t/op/taint.t +++ b/gnu/usr.bin/perl/t/op/taint.t @@ -25,7 +25,7 @@ if ($NoTaintSupport) { exit 0; } -plan tests => 1054; +plan tests => 1058; $| = 1; @@ -2956,6 +2956,18 @@ is_tainted("$ovtaint", "overload preserves taint"); taint_sig3($TAINT); } +{ + # GH 19478: panic on s///gre with tainted utf8 strings + my $u = "\x{10469}"; + my $r1 = ("foo$TAINT" =~ s/./"$u"/gre); + is($r1, "$u$u$u", 'tainted string with utf8 s/.//gre'); + my $r2 = ("foo$TAINT" =~ s/.*/"${u}"/gre); + is($r2, "$u$u", 'tainted string with utf8 s/.*//gre'); + my $r3 = ("foo$TAINT" =~ s/.+/"${u}"/gre); + is($r3, $u, 'tainted string with utf8 s/.+//gre'); + my $r4 = ("$u$TAINT" =~ s/./""/gre); + is($r4, '', 'tainted utf8 string with s///gre'); +} # This may bomb out with the alarm signal so keep it last SKIP: { diff --git a/gnu/usr.bin/perl/t/op/write.t b/gnu/usr.bin/perl/t/op/write.t index 46660506f..0e596ebea 100644 --- a/gnu/usr.bin/perl/t/op/write.t +++ b/gnu/usr.bin/perl/t/op/write.t @@ -33,6 +33,18 @@ sub cat_utf8 { $data; } +# write a format to a plain file, then read it back in and compare + +sub is_format { + my ($glob, $want, $desc) = @_; + local $::Level = $::Level + 1; + my $file = 'Op_write.tmp'; + open $glob, '>', $file or die "Can't create '$file': $!"; + write $glob; + close $glob or die "Could not close '$file': $!"; + is(cat($file), $want, $desc); +} + # write a format to a utf8 file, then read it back in and compare sub is_format_utf8 { @@ -100,7 +112,8 @@ for my $tref ( @NumTests ){ my $bas_tests = 21; # number of tests in section 3 -my $bug_tests = 66 + 3 * 3 * 5 * 2 * 3 + 2 + 66 + 6 + 2 + 3 + 96 + 11 + 14; +my $bug_tests = 66 + 3 * 3 * 5 * 2 * 3 + 2 + 66 + 6 + 2 + 3 + 96 + 11 + 14 + + 12; # number of tests in section 4 my $hmb_tests = 37; @@ -1360,6 +1373,47 @@ $v28f like_format_utf8(\*OUT28f, $qr_hash_m); +my $v29a; +format OUT29a = +[^<<<]~~ +$v29a +. + +$v29a = "-ABCD"; +is_format(\*OUT29a, "[- ]\n[ABCD]\n"); + +$v29a = "A-BCD"; +is_format(\*OUT29a, "[A- ]\n[BCD ]\n"); + +$v29a = "AB-CD"; +is_format(\*OUT29a, "[AB- ]\n[CD ]\n"); + +$v29a = "ABC-D"; +is_format(\*OUT29a, "[ABC-]\n[D ]\n"); + +$v29a = "ABCD-"; +is_format(\*OUT29a, "[ABCD]\n[- ]\n"); + +$v29a = "ABCDE-"; +is_format(\*OUT29a, "[ABCD]\n[E- ]\n"); + +$v29a = "-ABCD"; +is_format_utf8(\*OUT29a, "[- ]\n[ABCD]\n"); + +$v29a = "A-BCD"; +is_format_utf8(\*OUT29a, "[A- ]\n[BCD ]\n"); + +$v29a = "AB-CD"; +is_format_utf8(\*OUT29a, "[AB- ]\n[CD ]\n"); + +$v29a = "ABC-D"; +is_format_utf8(\*OUT29a, "[ABC-]\n[D ]\n"); + +$v29a = "ABCD-"; +is_format_utf8(\*OUT29a, "[ABCD]\n[- ]\n"); + +$v29a = "ABCDE-"; +is_format_utf8(\*OUT29a, "[ABCD]\n[E- ]\n"); { diff --git a/gnu/usr.bin/perl/t/porting/exec-bit.t b/gnu/usr.bin/perl/t/porting/exec-bit.t index 3e80f8447..be347e12b 100644 --- a/gnu/usr.bin/perl/t/porting/exec-bit.t +++ b/gnu/usr.bin/perl/t/porting/exec-bit.t @@ -30,6 +30,10 @@ if ( $^O eq "vos" ) { skip_all( "VOS combines the read and execute permission bits." ); } +if ( $^O eq "secbsd" ) { + skip_all( "SecBSD CVS src tree execute permission bits do not match Perl distribution." ); +} + if ( $Config{usecrosscompile} ) { skip_all( "Not all files are available during cross-compilation" ); } diff --git a/gnu/usr.bin/perl/t/re/pat_re_eval.t b/gnu/usr.bin/perl/t/re/pat_re_eval.t index 70b807b9e..b626f8eae 100755 --- a/gnu/usr.bin/perl/t/re/pat_re_eval.t +++ b/gnu/usr.bin/perl/t/re/pat_re_eval.t @@ -24,7 +24,7 @@ BEGIN { our @global; -plan tests => 506; # Update this when adding/deleting tests. +plan tests => 508; # Update this when adding/deleting tests. run_tests() unless caller; @@ -1332,6 +1332,21 @@ sub run_tests { pass("SvTEMP 2"); } + # GH #19680 "panic: restartop in perl_run" + # The eval block embedded within the (?{}) - but with no more code + # following it - causes the next op after the OP_LEAVETRY to be NULL + # (not even an OP_LEAVE). This confused the exception-catching and + # rethrowing code: it was incorrectly rethrowing the exception rather + # than just stopping at that point. + + ok("test" =~ m{^ (?{eval {die "boo!"}}) test $}x, "GH #19680"); + + # GH #19390 Segmentation fault with use re 'eval' + # Similar to GH #19680 above, but exiting the eval via a syntax error + # rather than throwing an exception + + ok("" =~ m{^ (?{eval q{$x=}})}x, "GH #19390"); + } # End of sub run_tests 1; diff --git a/gnu/usr.bin/perl/util.c b/gnu/usr.bin/perl/util.c index 0c6a353d1..46903e366 100644 --- a/gnu/usr.bin/perl/util.c +++ b/gnu/usr.bin/perl/util.c @@ -405,7 +405,7 @@ Perl_safesysfree(Malloc_t where) if (munmap(where_intrn, size)) { perror("munmap failed"); abort(); - } + } # endif } #else @@ -1803,9 +1803,9 @@ Perl_write_to_stderr(pTHX_ SV* msv) PERL_ARGS_ASSERT_WRITE_TO_STDERR; - if (PL_stderrgv && SvREFCNT(PL_stderrgv) + if (PL_stderrgv && SvREFCNT(PL_stderrgv) && (io = GvIO(PL_stderrgv)) - && (mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar))) + && (mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar))) Perl_magic_methcall(aTHX_ MUTABLE_SV(io), mg, SV_CONST(PRINT), G_SCALAR | G_DISCARD | G_WRITING_TO_STDERR, 1, msv); else { @@ -2268,7 +2268,7 @@ This is like C>, but C are an encapsulated argument list. void Perl_warner_nocontext(U32 err, const char *pat, ...) { - dTHX; + dTHX; va_list args; PERL_ARGS_ASSERT_WARNER_NOCONTEXT; va_start(args, pat); @@ -2380,7 +2380,7 @@ S_ckwarn_common(pTHX_ U32 w) } else if (!unpackWARN3(w)) { assert(!unpackWARN4(w)); } - + /* Right, dealt with all the special cases, which are implemented as non- pointers, so there is a pointer to a real warnings mask. */ do { @@ -2648,7 +2648,7 @@ Perl_unlnk(pTHX_ const char *f) /* unlink all versions of a file */ #if defined(OEMVS) #if (__CHARSET_LIB == 1) - static int chgfdccsid(int fd, unsigned short ccsid) + static int chgfdccsid(int fd, unsigned short ccsid) { attrib_t attr; memset(&attr, 0, sizeof(attr)); @@ -2930,7 +2930,7 @@ Perl_my_popen(pTHX_ const char *cmd, const char *mode) filedescriptors directly, need to manually switch to the default, binary, low-level mode; see PerlIOBuf_open(). */ PerlLIO_setmode((*mode == 'r'), O_BINARY); -#endif +#endif PL_forkprocess = 0; #ifdef PERL_USES_PL_PIDSTATUS hv_clear(PL_pidstatus); /* we have no children */ @@ -5233,7 +5233,7 @@ Perl_debug_hash_seed(pTHX_ bool via_debug_h) # endif static void -S_mem_log_common(enum mem_log_type mlt, const UV n, +S_mem_log_common(enum mem_log_type mlt, const UV n, const UV typesize, const char *type_name, const SV *sv, Malloc_t oldalloc, Malloc_t newalloc, const char *filename, const int linenumber, @@ -5259,7 +5259,7 @@ S_mem_log_common(enum mem_log_type mlt, const UV n, # define MEM_LOG_TIME_FMT "%10d.%06d: " # define MEM_LOG_TIME_ARG (int)tv.tv_sec, (int)tv.tv_usec struct timeval tv; - gettimeofday(&tv, 0); + PerlProc_gettimeofday(&tv, 0); # else # define MEM_LOG_TIME_FMT "%10d: " # define MEM_LOG_TIME_ARG (int)when @@ -5342,7 +5342,7 @@ S_mem_log_common(enum mem_log_type mlt, const UV n, Malloc_t Perl_mem_log_alloc(const UV n, const UV typesize, const char *type_name, - Malloc_t newalloc, + Malloc_t newalloc, const char *filename, const int linenumber, const char *funcname) { @@ -5356,45 +5356,49 @@ Perl_mem_log_alloc(const UV n, const UV typesize, const char *type_name, Malloc_t Perl_mem_log_realloc(const UV n, const UV typesize, const char *type_name, - Malloc_t oldalloc, Malloc_t newalloc, - const char *filename, const int linenumber, + Malloc_t oldalloc, Malloc_t newalloc, + const char *filename, const int linenumber, const char *funcname) { PERL_ARGS_ASSERT_MEM_LOG_REALLOC; mem_log_common_if(MLT_REALLOC, n, typesize, type_name, - NULL, oldalloc, newalloc, + NULL, oldalloc, newalloc, filename, linenumber, funcname); return newalloc; } Malloc_t -Perl_mem_log_free(Malloc_t oldalloc, - const char *filename, const int linenumber, +Perl_mem_log_free(Malloc_t oldalloc, + const char *filename, const int linenumber, const char *funcname) { PERL_ARGS_ASSERT_MEM_LOG_FREE; - mem_log_common_if(MLT_FREE, 0, 0, "", NULL, oldalloc, NULL, + mem_log_common_if(MLT_FREE, 0, 0, "", NULL, oldalloc, NULL, filename, linenumber, funcname); return oldalloc; } void -Perl_mem_log_new_sv(const SV *sv, +Perl_mem_log_new_sv(const SV *sv, const char *filename, const int linenumber, const char *funcname) { + PERL_ARGS_ASSERT_MEM_LOG_NEW_SV; + mem_log_common_if(MLT_NEW_SV, 0, 0, "", sv, NULL, NULL, filename, linenumber, funcname); } void Perl_mem_log_del_sv(const SV *sv, - const char *filename, const int linenumber, + const char *filename, const int linenumber, const char *funcname) { - mem_log_common_if(MLT_DEL_SV, 0, 0, "", sv, NULL, NULL, + PERL_ARGS_ASSERT_MEM_LOG_DEL_SV; + + mem_log_common_if(MLT_DEL_SV, 0, 0, "", sv, NULL, NULL, filename, linenumber, funcname); } @@ -5668,7 +5672,7 @@ Perl_my_clearenv(pTHX) (void)safesysfree(buf); bsiz = l + 1; /* + 1 for the \0. */ buf = (char*)safesysmalloc(bsiz); - } + } memcpy(buf, *environ, l); buf[l] = '\0'; (void)unsetenv(buf); @@ -6046,7 +6050,7 @@ Perl_get_db_sub(pTHX_ SV **svp, CV *cv) !( (SvTYPE(*svp) == SVt_PVGV) && (GvCV((const GV *)*svp) == cv) /* Use GV from the stack as a fallback. */ - && S_gv_has_usable_name(aTHX_ gv = (GV *)*svp) + && S_gv_has_usable_name(aTHX_ gv = (GV *)*svp) ) ) ) { @@ -6099,7 +6103,7 @@ Perl_my_dirfd(DIR * dir) { Perl_croak_nocontext(PL_no_func, "dirfd"); NOT_REACHED; /* NOTREACHED */ return 0; -#endif +#endif } #if !defined(HAS_MKOSTEMP) || !defined(HAS_MKSTEMP) @@ -6194,7 +6198,7 @@ Perl_get_re_arg(pTHX_ SV *sv) { if (SvTYPE(sv) == SVt_REGEXP) return (REGEXP*) sv; } - + return NULL; } diff --git a/gnu/usr.bin/perl/vms/descrip_mms.template b/gnu/usr.bin/perl/vms/descrip_mms.template index f1c7db8ed..6c2b5c279 100644 --- a/gnu/usr.bin/perl/vms/descrip_mms.template +++ b/gnu/usr.bin/perl/vms/descrip_mms.template @@ -313,7 +313,7 @@ utils : $(utils1) $(utils2) $(utils3) $(utils4) $(utils5) extra.pods : miniperl @ @extra_pods.com -PERLDELTA_CURRENT = [.pod]perl5360delta.pod +PERLDELTA_CURRENT = [.pod]perl5361delta.pod $(PERLDELTA_CURRENT) : [.pod]perldelta.pod Copy/NoConfirm/Log $(MMS$SOURCE) $(PERLDELTA_CURRENT) diff --git a/gnu/usr.bin/perl/win32/GNUmakefile b/gnu/usr.bin/perl/win32/GNUmakefile index 94c3da9c2..6f1d49150 100644 --- a/gnu/usr.bin/perl/win32/GNUmakefile +++ b/gnu/usr.bin/perl/win32/GNUmakefile @@ -63,7 +63,7 @@ INST_TOP := $(INST_DRV)\perl # versioned installation can be obtained by setting INST_TOP above to a # path that includes an arbitrary version string. # -#INST_VER := \5.36.0 +#INST_VER := \5.36.1 # # Comment this out if you DON'T want your perl installation to have @@ -1624,7 +1624,7 @@ utils: $(HAVEMINIPERL) ..\utils\Makefile copy ..\README.tw ..\pod\perltw.pod copy ..\README.vos ..\pod\perlvos.pod copy ..\README.win32 ..\pod\perlwin32.pod - copy ..\pod\perldelta.pod ..\pod\perl5360delta.pod + copy ..\pod\perldelta.pod ..\pod\perl5361delta.pod $(MINIPERL) -I..\lib $(PL2BAT) $(UTILS) $(MINIPERL) -I..\lib ..\autodoc.pl .. $(MINIPERL) -I..\lib ..\pod\perlmodlib.PL -q .. @@ -1724,7 +1724,7 @@ distclean: realclean -if exist $(LIBDIR)\Win32API rmdir /s /q $(LIBDIR)\Win32API -if exist $(LIBDIR)\XS rmdir /s /q $(LIBDIR)\XS -cd $(PODDIR) && del /f *.html *.bat roffitall \ - perl5360delta.pod perlaix.pod perlamiga.pod perlandroid.pod \ + perl5361delta.pod perlaix.pod perlamiga.pod perlandroid.pod \ perlapi.pod perlbs2000.pod perlcn.pod perlcygwin.pod \ perlfreebsd.pod perlhaiku.pod perlhpux.pod perlhurd.pod \ perlintern.pod perlirix.pod perljp.pod perlko.pod perllinux.pod \ diff --git a/gnu/usr.bin/perl/win32/Makefile b/gnu/usr.bin/perl/win32/Makefile index a2e257f23..62b5be428 100644 --- a/gnu/usr.bin/perl/win32/Makefile +++ b/gnu/usr.bin/perl/win32/Makefile @@ -37,7 +37,7 @@ INST_TOP = $(INST_DRV)\perl # versioned installation can be obtained by setting INST_TOP above to a # path that includes an arbitrary version string. # -#INST_VER = \5.36.0 +#INST_VER = \5.36.1 # # Comment this out if you DON'T want your perl installation to have @@ -1156,7 +1156,7 @@ utils: $(PERLEXE) ..\utils\Makefile copy ..\README.tw ..\pod\perltw.pod copy ..\README.vos ..\pod\perlvos.pod copy ..\README.win32 ..\pod\perlwin32.pod - copy ..\pod\perldelta.pod ..\pod\perl5360delta.pod + copy ..\pod\perldelta.pod ..\pod\perl5361delta.pod cd ..\win32 $(PERLEXE) $(PL2BAT) $(UTILS) $(MINIPERL) -I..\lib ..\autodoc.pl .. @@ -1257,7 +1257,7 @@ distclean: realclean -if exist $(LIBDIR)\Win32API rmdir /s /q $(LIBDIR)\Win32API -if exist $(LIBDIR)\XS rmdir /s /q $(LIBDIR)\XS -cd $(PODDIR) && del /f *.html *.bat roffitall \ - perl5360delta.pod perlaix.pod perlamiga.pod perlandroid.pod \ + perl5361delta.pod perlaix.pod perlamiga.pod perlandroid.pod \ perlapi.pod perlbs2000.pod perlcn.pod perlcygwin.pod \ perlfreebsd.pod perlhaiku.pod perlhpux.pod perlhurd.pod \ perlintern.pod perlirix.pod perljp.pod perlko.pod perllinux.pod \ diff --git a/gnu/usr.bin/perl/win32/pod.mak b/gnu/usr.bin/perl/win32/pod.mak index 6323b621f..74d96859c 100644 --- a/gnu/usr.bin/perl/win32/pod.mak +++ b/gnu/usr.bin/perl/win32/pod.mak @@ -67,6 +67,7 @@ POD = perl.pod \ perl5340delta.pod \ perl5341delta.pod \ perl5360delta.pod \ + perl5361delta.pod \ perl561delta.pod \ perl56delta.pod \ perl581delta.pod \ @@ -232,6 +233,7 @@ MAN = perl.man \ perl5340delta.man \ perl5341delta.man \ perl5360delta.man \ + perl5361delta.man \ perl561delta.man \ perl56delta.man \ perl581delta.man \ @@ -397,6 +399,7 @@ HTML = perl.html \ perl5340delta.html \ perl5341delta.html \ perl5360delta.html \ + perl5361delta.html \ perl561delta.html \ perl56delta.html \ perl581delta.html \ @@ -562,6 +565,7 @@ TEX = perl.tex \ perl5340delta.tex \ perl5341delta.tex \ perl5360delta.tex \ + perl5361delta.tex \ perl561delta.tex \ perl56delta.tex \ perl581delta.tex \ diff --git a/lib/libcrypto/Makefile b/lib/libcrypto/Makefile index f40ef656b..44e590086 100644 --- a/lib/libcrypto/Makefile +++ b/lib/libcrypto/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.136 2023/07/06 14:37:39 tb Exp $ +# $OpenBSD: Makefile,v 1.137 2023/07/07 06:10:14 jsing Exp $ LIB= crypto LIBREBUILD=y @@ -879,11 +879,16 @@ obj_dat.h: obj_mac.h ${SSL_OBJECTS}/obj_dat.pl .include "${.CURDIR}/arch/${MACHINE_CPU}/Makefile.inc" .else CFLAGS+=-DOPENSSL_NO_ASM -SRCS+= aes_core.c aes_cbc.c +SRCS+= aes_core.c +SRCS+= aes_cbc.c SRCS+= bf_enc.c -SRCS+= camellia.c cmll_cbc.c cmll_misc.c -SRCS+= des_enc.c fcrypt_b.c -SRCS+= rc4_enc.c rc4_skey.c +SRCS+= camellia.c +SRCS+= cmll_cbc.c +SRCS+= cmll_misc.c +SRCS+= des_enc.c +SRCS+= fcrypt_b.c +SRCS+= rc4_enc.c +SRCS+= rc4_skey.c SRCS+= wp_block.c .endif diff --git a/lib/libcrypto/Symbols.namespace b/lib/libcrypto/Symbols.namespace index d6c1610db..60d6195fa 100644 --- a/lib/libcrypto/Symbols.namespace +++ b/lib/libcrypto/Symbols.namespace @@ -950,7 +950,6 @@ _libre_ASN1_UTCTIME_check _libre_ASN1_UTCTIME_set _libre_ASN1_UTCTIME_adj _libre_ASN1_UTCTIME_set_string -_libre_ASN1_UTCTIME_cmp_time_t _libre_ASN1_GENERALIZEDTIME_check _libre_ASN1_GENERALIZEDTIME_set _libre_ASN1_GENERALIZEDTIME_adj @@ -1064,7 +1063,6 @@ _libre_ASN1_put_object _libre_ASN1_put_eoc _libre_ASN1_object_size _libre_ASN1_item_dup -_libre_ASN1_dup _libre_ASN1_d2i_fp _libre_ASN1_item_d2i_fp _libre_ASN1_i2d_fp @@ -1128,16 +1126,6 @@ _libre_SMIME_text _libre_ERR_load_ASN1_strings _libre_ASN1_time_parse _libre_ASN1_time_tm_cmp -_libre_ASN1_item_ex_new -_libre_ASN1_item_ex_free -_libre_ASN1_template_new -_libre_ASN1_primitive_new -_libre_ASN1_template_free -_libre_ASN1_template_d2i -_libre_ASN1_item_ex_d2i -_libre_ASN1_item_ex_i2d -_libre_ASN1_template_i2d -_libre_ASN1_primitive_free _libre_BIO_set_flags _libre_BIO_test_flags _libre_BIO_clear_flags @@ -1263,3 +1251,1503 @@ _libre_BIO_vprintf _libre_BIO_snprintf _libre_BIO_vsnprintf _libre_ERR_load_BIO_strings +_libre_ASN1_item_ex_new +_libre_ASN1_item_ex_free +_libre_ASN1_template_new +_libre_ASN1_primitive_new +_libre_ASN1_template_free +_libre_ASN1_template_d2i +_libre_ASN1_item_ex_d2i +_libre_ASN1_item_ex_i2d +_libre_ASN1_template_i2d +_libre_ASN1_primitive_free +_libre_EC_GFp_simple_method +_libre_EC_GFp_mont_method +_libre_EC_GROUP_new +_libre_EC_GROUP_free +_libre_EC_GROUP_copy +_libre_EC_GROUP_dup +_libre_EC_GROUP_method_of +_libre_EC_METHOD_get_field_type +_libre_EC_GROUP_set_generator +_libre_EC_GROUP_get0_generator +_libre_EC_GROUP_get_order +_libre_EC_GROUP_order_bits +_libre_EC_GROUP_get_cofactor +_libre_EC_GROUP_set_curve_name +_libre_EC_GROUP_get_curve_name +_libre_EC_GROUP_set_asn1_flag +_libre_EC_GROUP_get_asn1_flag +_libre_EC_GROUP_set_point_conversion_form +_libre_EC_GROUP_get_point_conversion_form +_libre_EC_GROUP_get0_seed +_libre_EC_GROUP_get_seed_len +_libre_EC_GROUP_set_seed +_libre_EC_GROUP_set_curve +_libre_EC_GROUP_get_curve +_libre_EC_GROUP_get_degree +_libre_EC_GROUP_check +_libre_EC_GROUP_check_discriminant +_libre_EC_GROUP_cmp +_libre_EC_GROUP_new_curve_GFp +_libre_EC_GROUP_new_by_curve_name +_libre_EC_get_builtin_curves +_libre_EC_curve_nid2nist +_libre_EC_curve_nist2nid +_libre_EC_POINT_new +_libre_EC_POINT_free +_libre_EC_POINT_copy +_libre_EC_POINT_dup +_libre_EC_POINT_method_of +_libre_EC_POINT_set_to_infinity +_libre_EC_POINT_set_affine_coordinates +_libre_EC_POINT_get_affine_coordinates +_libre_EC_POINT_set_compressed_coordinates +_libre_EC_POINT_point2oct +_libre_EC_POINT_oct2point +_libre_EC_POINT_point2bn +_libre_EC_POINT_bn2point +_libre_EC_POINT_point2hex +_libre_EC_POINT_hex2point +_libre_EC_POINT_add +_libre_EC_POINT_dbl +_libre_EC_POINT_invert +_libre_EC_POINT_is_at_infinity +_libre_EC_POINT_is_on_curve +_libre_EC_POINT_cmp +_libre_EC_POINT_make_affine +_libre_EC_POINTs_make_affine +_libre_EC_POINTs_mul +_libre_EC_POINT_mul +_libre_EC_GROUP_precompute_mult +_libre_EC_GROUP_have_precompute_mult +_libre_EC_GROUP_get_basis_type +_libre_d2i_ECPKParameters +_libre_i2d_ECPKParameters +_libre_ECPKParameters_print +_libre_ECPKParameters_print_fp +_libre_EC_KEY_new +_libre_EC_KEY_get_flags +_libre_EC_KEY_set_flags +_libre_EC_KEY_clear_flags +_libre_EC_KEY_new_by_curve_name +_libre_EC_KEY_free +_libre_EC_KEY_copy +_libre_EC_KEY_dup +_libre_EC_KEY_up_ref +_libre_EC_KEY_get0_group +_libre_EC_KEY_set_group +_libre_EC_KEY_get0_private_key +_libre_EC_KEY_set_private_key +_libre_EC_KEY_get0_public_key +_libre_EC_KEY_set_public_key +_libre_EC_KEY_get_enc_flags +_libre_EC_KEY_set_enc_flags +_libre_EC_KEY_get_conv_form +_libre_EC_KEY_set_conv_form +_libre_EC_KEY_set_asn1_flag +_libre_EC_KEY_precompute_mult +_libre_EC_KEY_generate_key +_libre_EC_KEY_check_key +_libre_EC_KEY_set_public_key_affine_coordinates +_libre_d2i_ECPrivateKey +_libre_i2d_ECPrivateKey +_libre_d2i_ECParameters +_libre_i2d_ECParameters +_libre_o2i_ECPublicKey +_libre_i2o_ECPublicKey +_libre_ECParameters_print +_libre_EC_KEY_print +_libre_ECParameters_print_fp +_libre_EC_KEY_print_fp +_libre_EC_KEY_set_ex_data +_libre_EC_KEY_get_ex_data +_libre_EC_KEY_OpenSSL +_libre_EC_KEY_get_default_method +_libre_EC_KEY_set_default_method +_libre_EC_KEY_get_method +_libre_EC_KEY_set_method +_libre_EC_KEY_new_method +_libre_EC_KEY_METHOD_new +_libre_EC_KEY_METHOD_free +_libre_EC_KEY_METHOD_set_init +_libre_EC_KEY_METHOD_set_keygen +_libre_EC_KEY_METHOD_set_compute_key +_libre_EC_KEY_METHOD_get_init +_libre_EC_KEY_METHOD_get_keygen +_libre_EC_KEY_METHOD_get_compute_key +_libre_ECParameters_dup +_libre_ERR_load_EC_strings +_libre_ERR_put_error +_libre_ERR_set_error_data +_libre_ERR_get_error +_libre_ERR_get_error_line +_libre_ERR_get_error_line_data +_libre_ERR_peek_error +_libre_ERR_peek_error_line +_libre_ERR_peek_error_line_data +_libre_ERR_peek_last_error +_libre_ERR_peek_last_error_line +_libre_ERR_peek_last_error_line_data +_libre_ERR_clear_error +_libre_ERR_error_string +_libre_ERR_error_string_n +_libre_ERR_lib_error_string +_libre_ERR_func_error_string +_libre_ERR_reason_error_string +_libre_ERR_print_errors_cb +_libre_ERR_print_errors_fp +_libre_ERR_print_errors +_libre_ERR_asprintf_error_data +_libre_ERR_load_strings +_libre_ERR_unload_strings +_libre_ERR_load_ERR_strings +_libre_ERR_load_crypto_strings +_libre_ERR_free_strings +_libre_ERR_remove_thread_state +_libre_ERR_remove_state +_libre_ERR_get_state +_libre_ERR_get_string_table +_libre_ERR_get_err_state_table +_libre_ERR_release_err_state_table +_libre_ERR_get_next_error_library +_libre_ERR_set_mark +_libre_ERR_pop_to_mark +_libre_ERR_get_implementation +_libre_ERR_set_implementation +_libre_RAND_set_rand_method +_libre_RAND_get_rand_method +_libre_RAND_set_rand_engine +_libre_RAND_SSLeay +_libre_ERR_load_RAND_strings +_libre_ECDSA_SIG_new +_libre_ECDSA_SIG_free +_libre_i2d_ECDSA_SIG +_libre_d2i_ECDSA_SIG +_libre_ECDSA_SIG_get0 +_libre_ECDSA_SIG_get0_r +_libre_ECDSA_SIG_get0_s +_libre_ECDSA_SIG_set0 +_libre_ECDSA_do_sign +_libre_ECDSA_do_sign_ex +_libre_ECDSA_do_verify +_libre_ECDSA_OpenSSL +_libre_ECDSA_set_default_method +_libre_ECDSA_get_default_method +_libre_ECDSA_set_method +_libre_ECDSA_size +_libre_ECDSA_sign_setup +_libre_ECDSA_sign +_libre_ECDSA_sign_ex +_libre_ECDSA_verify +_libre_ECDSA_get_ex_new_index +_libre_ECDSA_set_ex_data +_libre_ECDSA_get_ex_data +_libre_EC_KEY_METHOD_set_sign +_libre_EC_KEY_METHOD_set_verify +_libre_EC_KEY_METHOD_get_sign +_libre_EC_KEY_METHOD_get_verify +_libre_ERR_load_ECDSA_strings +_libre_HKDF +_libre_HKDF_extract +_libre_HKDF_expand +_libre_TS_REQ_new +_libre_TS_REQ_free +_libre_i2d_TS_REQ +_libre_d2i_TS_REQ +_libre_TS_REQ_dup +_libre_d2i_TS_REQ_fp +_libre_i2d_TS_REQ_fp +_libre_d2i_TS_REQ_bio +_libre_i2d_TS_REQ_bio +_libre_TS_MSG_IMPRINT_new +_libre_TS_MSG_IMPRINT_free +_libre_i2d_TS_MSG_IMPRINT +_libre_d2i_TS_MSG_IMPRINT +_libre_TS_MSG_IMPRINT_dup +_libre_d2i_TS_MSG_IMPRINT_fp +_libre_i2d_TS_MSG_IMPRINT_fp +_libre_d2i_TS_MSG_IMPRINT_bio +_libre_i2d_TS_MSG_IMPRINT_bio +_libre_TS_RESP_new +_libre_TS_RESP_free +_libre_i2d_TS_RESP +_libre_d2i_TS_RESP +_libre_PKCS7_to_TS_TST_INFO +_libre_TS_RESP_dup +_libre_d2i_TS_RESP_fp +_libre_i2d_TS_RESP_fp +_libre_d2i_TS_RESP_bio +_libre_i2d_TS_RESP_bio +_libre_TS_STATUS_INFO_new +_libre_TS_STATUS_INFO_free +_libre_i2d_TS_STATUS_INFO +_libre_d2i_TS_STATUS_INFO +_libre_TS_STATUS_INFO_dup +_libre_TS_TST_INFO_new +_libre_TS_TST_INFO_free +_libre_i2d_TS_TST_INFO +_libre_d2i_TS_TST_INFO +_libre_TS_TST_INFO_dup +_libre_d2i_TS_TST_INFO_fp +_libre_i2d_TS_TST_INFO_fp +_libre_d2i_TS_TST_INFO_bio +_libre_i2d_TS_TST_INFO_bio +_libre_TS_ACCURACY_new +_libre_TS_ACCURACY_free +_libre_i2d_TS_ACCURACY +_libre_d2i_TS_ACCURACY +_libre_TS_ACCURACY_dup +_libre_ESS_ISSUER_SERIAL_new +_libre_ESS_ISSUER_SERIAL_free +_libre_i2d_ESS_ISSUER_SERIAL +_libre_d2i_ESS_ISSUER_SERIAL +_libre_ESS_ISSUER_SERIAL_dup +_libre_ESS_CERT_ID_new +_libre_ESS_CERT_ID_free +_libre_i2d_ESS_CERT_ID +_libre_d2i_ESS_CERT_ID +_libre_ESS_CERT_ID_dup +_libre_ESS_SIGNING_CERT_new +_libre_ESS_SIGNING_CERT_free +_libre_i2d_ESS_SIGNING_CERT +_libre_d2i_ESS_SIGNING_CERT +_libre_ESS_SIGNING_CERT_dup +_libre_TS_REQ_set_version +_libre_TS_REQ_get_version +_libre_TS_REQ_set_msg_imprint +_libre_TS_REQ_get_msg_imprint +_libre_TS_MSG_IMPRINT_set_algo +_libre_TS_MSG_IMPRINT_get_algo +_libre_TS_MSG_IMPRINT_set_msg +_libre_TS_MSG_IMPRINT_get_msg +_libre_TS_REQ_set_policy_id +_libre_TS_REQ_get_policy_id +_libre_TS_REQ_set_nonce +_libre_TS_REQ_get_nonce +_libre_TS_REQ_set_cert_req +_libre_TS_REQ_get_cert_req +_libre_TS_REQ_get_exts +_libre_TS_REQ_ext_free +_libre_TS_REQ_get_ext_count +_libre_TS_REQ_get_ext_by_NID +_libre_TS_REQ_get_ext_by_OBJ +_libre_TS_REQ_get_ext_by_critical +_libre_TS_REQ_get_ext +_libre_TS_REQ_delete_ext +_libre_TS_REQ_add_ext +_libre_TS_REQ_get_ext_d2i +_libre_TS_REQ_print_bio +_libre_TS_RESP_set_status_info +_libre_TS_RESP_get_status_info +_libre_TS_STATUS_INFO_get0_failure_info +_libre_TS_STATUS_INFO_get0_text +_libre_TS_STATUS_INFO_get0_status +_libre_TS_STATUS_INFO_set_status +_libre_TS_RESP_set_tst_info +_libre_TS_RESP_get_token +_libre_TS_RESP_get_tst_info +_libre_TS_TST_INFO_set_version +_libre_TS_TST_INFO_get_version +_libre_TS_TST_INFO_set_policy_id +_libre_TS_TST_INFO_get_policy_id +_libre_TS_TST_INFO_set_msg_imprint +_libre_TS_TST_INFO_get_msg_imprint +_libre_TS_TST_INFO_set_serial +_libre_TS_TST_INFO_get_serial +_libre_TS_TST_INFO_set_time +_libre_TS_TST_INFO_get_time +_libre_TS_TST_INFO_set_accuracy +_libre_TS_TST_INFO_get_accuracy +_libre_TS_ACCURACY_set_seconds +_libre_TS_ACCURACY_get_seconds +_libre_TS_ACCURACY_set_millis +_libre_TS_ACCURACY_get_millis +_libre_TS_ACCURACY_set_micros +_libre_TS_ACCURACY_get_micros +_libre_TS_TST_INFO_set_ordering +_libre_TS_TST_INFO_get_ordering +_libre_TS_TST_INFO_set_nonce +_libre_TS_TST_INFO_get_nonce +_libre_TS_TST_INFO_set_tsa +_libre_TS_TST_INFO_get_tsa +_libre_TS_TST_INFO_get_exts +_libre_TS_TST_INFO_ext_free +_libre_TS_TST_INFO_get_ext_count +_libre_TS_TST_INFO_get_ext_by_NID +_libre_TS_TST_INFO_get_ext_by_OBJ +_libre_TS_TST_INFO_get_ext_by_critical +_libre_TS_TST_INFO_get_ext +_libre_TS_TST_INFO_delete_ext +_libre_TS_TST_INFO_add_ext +_libre_TS_TST_INFO_get_ext_d2i +_libre_TS_RESP_CTX_new +_libre_TS_RESP_CTX_free +_libre_TS_RESP_CTX_set_signer_cert +_libre_TS_RESP_CTX_set_signer_key +_libre_TS_RESP_CTX_set_def_policy +_libre_TS_RESP_CTX_set_certs +_libre_TS_RESP_CTX_add_policy +_libre_TS_RESP_CTX_add_md +_libre_TS_RESP_CTX_set_accuracy +_libre_TS_RESP_CTX_set_clock_precision_digits +_libre_TS_RESP_CTX_add_flags +_libre_TS_RESP_CTX_set_serial_cb +_libre_TS_RESP_CTX_set_time_cb +_libre_TS_RESP_CTX_set_extension_cb +_libre_TS_RESP_CTX_set_status_info +_libre_TS_RESP_CTX_set_status_info_cond +_libre_TS_RESP_CTX_add_failure_info +_libre_TS_RESP_CTX_get_request +_libre_TS_RESP_CTX_get_tst_info +_libre_TS_RESP_create_response +_libre_TS_RESP_verify_signature +_libre_TS_RESP_verify_response +_libre_TS_RESP_verify_token +_libre_TS_VERIFY_CTX_new +_libre_TS_VERIFY_CTX_free +_libre_TS_VERIFY_CTX_cleanup +_libre_TS_VERIFY_CTX_add_flags +_libre_TS_VERIFY_CTX_set_flags +_libre_TS_VERIFY_CTX_set_data +_libre_TS_VERIFY_CTX_set_store +_libre_TS_VERIFY_CTX_set_certs +_libre_TS_VERIFY_CTX_set_imprint +_libre_TS_REQ_to_TS_VERIFY_CTX +_libre_TS_RESP_print_bio +_libre_TS_STATUS_INFO_print_bio +_libre_TS_TST_INFO_print_bio +_libre_TS_ASN1_INTEGER_print_bio +_libre_TS_OBJ_print_bio +_libre_TS_ext_print_bio +_libre_TS_X509_ALGOR_print_bio +_libre_TS_MSG_IMPRINT_print_bio +_libre_TS_CONF_load_cert +_libre_TS_CONF_load_certs +_libre_TS_CONF_load_key +_libre_TS_CONF_get_tsa_section +_libre_TS_CONF_set_serial +_libre_TS_CONF_set_crypto_device +_libre_TS_CONF_set_default_engine +_libre_TS_CONF_set_signer_cert +_libre_TS_CONF_set_certs +_libre_TS_CONF_set_signer_key +_libre_TS_CONF_set_def_policy +_libre_TS_CONF_set_policies +_libre_TS_CONF_set_digests +_libre_TS_CONF_set_accuracy +_libre_TS_CONF_set_clock_precision_digits +_libre_TS_CONF_set_ordering +_libre_TS_CONF_set_tsa_name +_libre_TS_CONF_set_ess_cert_id_chain +_libre_ERR_load_TS_strings +_libre_SM4_set_key +_libre_SM4_decrypt +_libre_SM4_encrypt +_libre_CRYPTO_poly1305_init +_libre_CRYPTO_poly1305_update +_libre_CRYPTO_poly1305_finish +_libre_ECDH_OpenSSL +_libre_ECDH_set_default_method +_libre_ECDH_get_default_method +_libre_ECDH_set_method +_libre_ECDH_size +_libre_ECDH_compute_key +_libre_ECDH_get_ex_new_index +_libre_ECDH_set_ex_data +_libre_ECDH_get_ex_data +_libre_ERR_load_ECDH_strings +_libre_PEM_get_EVP_CIPHER_INFO +_libre_PEM_do_header +_libre_PEM_read_bio +_libre_PEM_write_bio +_libre_PEM_bytes_read_bio +_libre_PEM_ASN1_read_bio +_libre_PEM_ASN1_write_bio +_libre_PEM_X509_INFO_read_bio +_libre_PEM_X509_INFO_write_bio +_libre_PEM_read +_libre_PEM_write +_libre_PEM_ASN1_read +_libre_PEM_ASN1_write +_libre_PEM_X509_INFO_read +_libre_PEM_SignInit +_libre_PEM_SignUpdate +_libre_PEM_SignFinal +_libre_PEM_def_callback +_libre_PEM_proc_type +_libre_PEM_dek_info +_libre_PEM_read_X509 +_libre_PEM_read_bio_X509 +_libre_PEM_write_X509 +_libre_PEM_write_bio_X509 +_libre_PEM_read_X509_AUX +_libre_PEM_read_bio_X509_AUX +_libre_PEM_write_X509_AUX +_libre_PEM_write_bio_X509_AUX +_libre_PEM_read_X509_REQ +_libre_PEM_read_bio_X509_REQ +_libre_PEM_write_X509_REQ +_libre_PEM_write_bio_X509_REQ +_libre_PEM_write_X509_REQ_NEW +_libre_PEM_write_bio_X509_REQ_NEW +_libre_PEM_read_X509_CRL +_libre_PEM_read_bio_X509_CRL +_libre_PEM_write_X509_CRL +_libre_PEM_write_bio_X509_CRL +_libre_PEM_read_PKCS7 +_libre_PEM_read_bio_PKCS7 +_libre_PEM_write_PKCS7 +_libre_PEM_write_bio_PKCS7 +_libre_PEM_read_PKCS8 +_libre_PEM_read_bio_PKCS8 +_libre_PEM_write_PKCS8 +_libre_PEM_write_bio_PKCS8 +_libre_PEM_read_PKCS8_PRIV_KEY_INFO +_libre_PEM_read_bio_PKCS8_PRIV_KEY_INFO +_libre_PEM_write_PKCS8_PRIV_KEY_INFO +_libre_PEM_write_bio_PKCS8_PRIV_KEY_INFO +_libre_PEM_read_RSAPrivateKey +_libre_PEM_read_bio_RSAPrivateKey +_libre_PEM_write_RSAPrivateKey +_libre_PEM_write_bio_RSAPrivateKey +_libre_PEM_read_RSAPublicKey +_libre_PEM_read_bio_RSAPublicKey +_libre_PEM_write_RSAPublicKey +_libre_PEM_write_bio_RSAPublicKey +_libre_PEM_read_RSA_PUBKEY +_libre_PEM_read_bio_RSA_PUBKEY +_libre_PEM_write_RSA_PUBKEY +_libre_PEM_write_bio_RSA_PUBKEY +_libre_PEM_read_DSAPrivateKey +_libre_PEM_read_bio_DSAPrivateKey +_libre_PEM_write_DSAPrivateKey +_libre_PEM_write_bio_DSAPrivateKey +_libre_PEM_read_DSA_PUBKEY +_libre_PEM_read_bio_DSA_PUBKEY +_libre_PEM_write_DSA_PUBKEY +_libre_PEM_write_bio_DSA_PUBKEY +_libre_PEM_read_DSAparams +_libre_PEM_read_bio_DSAparams +_libre_PEM_write_DSAparams +_libre_PEM_write_bio_DSAparams +_libre_PEM_read_ECPKParameters +_libre_PEM_read_bio_ECPKParameters +_libre_PEM_write_ECPKParameters +_libre_PEM_write_bio_ECPKParameters +_libre_PEM_read_ECPrivateKey +_libre_PEM_read_bio_ECPrivateKey +_libre_PEM_write_ECPrivateKey +_libre_PEM_write_bio_ECPrivateKey +_libre_PEM_read_EC_PUBKEY +_libre_PEM_read_bio_EC_PUBKEY +_libre_PEM_write_EC_PUBKEY +_libre_PEM_write_bio_EC_PUBKEY +_libre_PEM_read_DHparams +_libre_PEM_read_bio_DHparams +_libre_PEM_write_DHparams +_libre_PEM_write_bio_DHparams +_libre_PEM_read_PrivateKey +_libre_PEM_read_bio_PrivateKey +_libre_PEM_write_PrivateKey +_libre_PEM_write_bio_PrivateKey +_libre_PEM_read_PUBKEY +_libre_PEM_read_bio_PUBKEY +_libre_PEM_write_PUBKEY +_libre_PEM_write_bio_PUBKEY +_libre_PEM_write_bio_PrivateKey_traditional +_libre_PEM_write_bio_PKCS8PrivateKey_nid +_libre_PEM_write_bio_PKCS8PrivateKey +_libre_i2d_PKCS8PrivateKey_bio +_libre_i2d_PKCS8PrivateKey_nid_bio +_libre_d2i_PKCS8PrivateKey_bio +_libre_i2d_PKCS8PrivateKey_fp +_libre_i2d_PKCS8PrivateKey_nid_fp +_libre_PEM_write_PKCS8PrivateKey_nid +_libre_d2i_PKCS8PrivateKey_fp +_libre_PEM_write_PKCS8PrivateKey +_libre_PEM_read_bio_Parameters +_libre_PEM_write_bio_Parameters +_libre_b2i_PrivateKey +_libre_b2i_PublicKey +_libre_b2i_PrivateKey_bio +_libre_b2i_PublicKey_bio +_libre_i2b_PrivateKey_bio +_libre_i2b_PublicKey_bio +_libre_b2i_PVK_bio +_libre_i2b_PVK_bio +_libre_ERR_load_PEM_strings +_libre_lh_new +_libre_lh_free +_libre_lh_insert +_libre_lh_delete +_libre_lh_retrieve +_libre_lh_doall +_libre_lh_doall_arg +_libre_lh_strhash +_libre_lh_num_items +_libre_lh_stats +_libre_lh_node_stats +_libre_lh_node_usage_stats +_libre_lh_stats_bio +_libre_lh_node_stats_bio +_libre_lh_node_usage_stats_bio +_libre_SM3_Init +_libre_SM3_Update +_libre_SM3_Final +_libre_DSO_new +_libre_DSO_new_method +_libre_DSO_free +_libre_DSO_flags +_libre_DSO_up_ref +_libre_DSO_ctrl +_libre_DSO_set_name_converter +_libre_DSO_get_filename +_libre_DSO_set_filename +_libre_DSO_convert_filename +_libre_DSO_merge +_libre_DSO_get_loaded_filename +_libre_DSO_set_default_method +_libre_DSO_get_default_method +_libre_DSO_get_method +_libre_DSO_set_method +_libre_DSO_load +_libre_DSO_bind_var +_libre_DSO_bind_func +_libre_DSO_METHOD_openssl +_libre_DSO_METHOD_null +_libre_DSO_METHOD_dlfcn +_libre_DSO_pathbyaddr +_libre_DSO_global_lookup +_libre_ERR_load_DSO_strings +_libre_CT_POLICY_EVAL_CTX_new +_libre_CT_POLICY_EVAL_CTX_free +_libre_CT_POLICY_EVAL_CTX_get0_cert +_libre_CT_POLICY_EVAL_CTX_set1_cert +_libre_CT_POLICY_EVAL_CTX_get0_issuer +_libre_CT_POLICY_EVAL_CTX_set1_issuer +_libre_CT_POLICY_EVAL_CTX_get0_log_store +_libre_CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE +_libre_CT_POLICY_EVAL_CTX_get_time +_libre_CT_POLICY_EVAL_CTX_set_time +_libre_SCT_new +_libre_SCT_new_from_base64 +_libre_SCT_free +_libre_SCT_LIST_free +_libre_SCT_get_version +_libre_SCT_set_version +_libre_SCT_get_log_entry_type +_libre_SCT_set_log_entry_type +_libre_SCT_get0_log_id +_libre_SCT_set0_log_id +_libre_SCT_set1_log_id +_libre_SCT_get_timestamp +_libre_SCT_set_timestamp +_libre_SCT_get_signature_nid +_libre_SCT_set_signature_nid +_libre_SCT_get0_extensions +_libre_SCT_set0_extensions +_libre_SCT_set1_extensions +_libre_SCT_get0_signature +_libre_SCT_set0_signature +_libre_SCT_set1_signature +_libre_SCT_get_source +_libre_SCT_set_source +_libre_SCT_validation_status_string +_libre_SCT_print +_libre_SCT_LIST_print +_libre_SCT_get_validation_status +_libre_SCT_validate +_libre_SCT_LIST_validate +_libre_i2o_SCT_LIST +_libre_o2i_SCT_LIST +_libre_i2d_SCT_LIST +_libre_d2i_SCT_LIST +_libre_i2o_SCT +_libre_o2i_SCT +_libre_CTLOG_new +_libre_CTLOG_new_from_base64 +_libre_CTLOG_free +_libre_CTLOG_get0_name +_libre_CTLOG_get0_log_id +_libre_CTLOG_get0_public_key +_libre_CTLOG_STORE_new +_libre_CTLOG_STORE_free +_libre_CTLOG_STORE_get0_log_by_id +_libre_CTLOG_STORE_load_file +_libre_CTLOG_STORE_load_default_file +_libre__CONF_new_section +_libre__CONF_get_section +_libre__CONF_get_section_values +_libre__CONF_add_string +_libre__CONF_get_string +_libre__CONF_new_data +_libre__CONF_free_data +_libre_COMP_CTX_new +_libre_COMP_CTX_free +_libre_COMP_compress_block +_libre_COMP_expand_block +_libre_COMP_rle +_libre_COMP_zlib +_libre_COMP_zlib_cleanup +_libre_ERR_load_COMP_strings +_libre_CMS_ContentInfo_new +_libre_CMS_ContentInfo_free +_libre_d2i_CMS_ContentInfo +_libre_i2d_CMS_ContentInfo +_libre_CMS_ReceiptRequest_new +_libre_CMS_ReceiptRequest_free +_libre_d2i_CMS_ReceiptRequest +_libre_i2d_CMS_ReceiptRequest +_libre_CMS_ContentInfo_print_ctx +_libre_CMS_get0_type +_libre_CMS_dataInit +_libre_CMS_dataFinal +_libre_CMS_is_detached +_libre_CMS_set_detached +_libre_CMS_stream +_libre_d2i_CMS_bio +_libre_i2d_CMS_bio +_libre_BIO_new_CMS +_libre_i2d_CMS_bio_stream +_libre_PEM_write_bio_CMS_stream +_libre_SMIME_read_CMS +_libre_SMIME_write_CMS +_libre_CMS_final +_libre_CMS_sign +_libre_CMS_sign_receipt +_libre_CMS_data +_libre_CMS_data_create +_libre_CMS_digest_verify +_libre_CMS_digest_create +_libre_CMS_EncryptedData_decrypt +_libre_CMS_EncryptedData_encrypt +_libre_CMS_EncryptedData_set1_key +_libre_CMS_verify +_libre_CMS_verify_receipt +_libre_CMS_get0_signers +_libre_CMS_encrypt +_libre_CMS_decrypt +_libre_CMS_decrypt_set1_pkey +_libre_CMS_decrypt_set1_key +_libre_CMS_decrypt_set1_password +_libre_CMS_get0_RecipientInfos +_libre_CMS_RecipientInfo_type +_libre_CMS_RecipientInfo_get0_pkey_ctx +_libre_CMS_EnvelopedData_create +_libre_CMS_add1_recipient_cert +_libre_CMS_RecipientInfo_set0_pkey +_libre_CMS_RecipientInfo_ktri_cert_cmp +_libre_CMS_RecipientInfo_ktri_get0_algs +_libre_CMS_RecipientInfo_ktri_get0_signer_id +_libre_CMS_add0_recipient_key +_libre_CMS_RecipientInfo_kekri_get0_id +_libre_CMS_RecipientInfo_set0_key +_libre_CMS_RecipientInfo_kekri_id_cmp +_libre_CMS_RecipientInfo_set0_password +_libre_CMS_add0_recipient_password +_libre_CMS_RecipientInfo_decrypt +_libre_CMS_RecipientInfo_encrypt +_libre_CMS_uncompress +_libre_CMS_compress +_libre_CMS_set1_eContentType +_libre_CMS_get0_eContentType +_libre_CMS_add0_CertificateChoices +_libre_CMS_add0_cert +_libre_CMS_add1_cert +_libre_CMS_get1_certs +_libre_CMS_add0_RevocationInfoChoice +_libre_CMS_add0_crl +_libre_CMS_add1_crl +_libre_CMS_get1_crls +_libre_CMS_SignedData_init +_libre_CMS_add1_signer +_libre_CMS_SignerInfo_get0_pkey_ctx +_libre_CMS_SignerInfo_get0_md_ctx +_libre_CMS_get0_SignerInfos +_libre_CMS_SignerInfo_set1_signer_cert +_libre_CMS_SignerInfo_get0_signer_id +_libre_CMS_SignerInfo_cert_cmp +_libre_CMS_set1_signers_certs +_libre_CMS_SignerInfo_get0_algs +_libre_CMS_SignerInfo_get0_signature +_libre_CMS_SignerInfo_sign +_libre_CMS_SignerInfo_verify +_libre_CMS_SignerInfo_verify_content +_libre_CMS_add_smimecap +_libre_CMS_add_simple_smimecap +_libre_CMS_add_standard_smimecap +_libre_CMS_signed_get_attr_count +_libre_CMS_signed_get_attr_by_NID +_libre_CMS_signed_get_attr_by_OBJ +_libre_CMS_signed_get_attr +_libre_CMS_signed_delete_attr +_libre_CMS_signed_add1_attr +_libre_CMS_signed_add1_attr_by_OBJ +_libre_CMS_signed_add1_attr_by_NID +_libre_CMS_signed_add1_attr_by_txt +_libre_CMS_signed_get0_data_by_OBJ +_libre_CMS_unsigned_get_attr_count +_libre_CMS_unsigned_get_attr_by_NID +_libre_CMS_unsigned_get_attr_by_OBJ +_libre_CMS_unsigned_get_attr +_libre_CMS_unsigned_delete_attr +_libre_CMS_unsigned_add1_attr +_libre_CMS_unsigned_add1_attr_by_OBJ +_libre_CMS_unsigned_add1_attr_by_NID +_libre_CMS_unsigned_add1_attr_by_txt +_libre_CMS_unsigned_get0_data_by_OBJ +_libre_CMS_RecipientInfo_kari_get0_alg +_libre_CMS_RecipientInfo_kari_get0_reks +_libre_CMS_RecipientInfo_kari_get0_orig_id +_libre_CMS_RecipientInfo_kari_orig_id_cmp +_libre_CMS_RecipientEncryptedKey_get0_id +_libre_CMS_RecipientEncryptedKey_cert_cmp +_libre_CMS_RecipientInfo_kari_set0_pkey +_libre_CMS_RecipientInfo_kari_get0_ctx +_libre_CMS_RecipientInfo_kari_decrypt +_libre_CMS_SharedInfo_encode +_libre_ERR_load_CMS_strings +_libre_BUF_MEM_new +_libre_BUF_MEM_free +_libre_BUF_MEM_grow +_libre_BUF_MEM_grow_clean +_libre_ERR_load_BUF_strings +_libre_OpenSSL_version +_libre_OpenSSL_version_num +_libre_SSLeay_version +_libre_SSLeay +_libre_CRYPTO_get_ex_data_implementation +_libre_CRYPTO_set_ex_data_implementation +_libre_CRYPTO_ex_data_new_class +_libre_CRYPTO_get_ex_new_index +_libre_CRYPTO_new_ex_data +_libre_CRYPTO_dup_ex_data +_libre_CRYPTO_free_ex_data +_libre_CRYPTO_set_ex_data +_libre_CRYPTO_get_ex_data +_libre_CRYPTO_cleanup_all_ex_data +_libre_CRYPTO_lock +_libre_CRYPTO_add_lock +_libre_CRYPTO_THREADID_current +_libre_CRYPTO_THREADID_cmp +_libre_CRYPTO_THREADID_cpy +_libre_CRYPTO_THREADID_hash +_libre_CRYPTO_set_mem_functions +_libre_CRYPTO_set_locked_mem_functions +_libre_CRYPTO_set_mem_ex_functions +_libre_CRYPTO_set_locked_mem_ex_functions +_libre_CRYPTO_set_mem_debug_functions +_libre_CRYPTO_get_mem_functions +_libre_CRYPTO_get_locked_mem_functions +_libre_CRYPTO_get_mem_ex_functions +_libre_CRYPTO_get_locked_mem_ex_functions +_libre_CRYPTO_get_mem_debug_functions +_libre_CRYPTO_realloc_clean +_libre_CRYPTO_remalloc +_libre_CRYPTO_set_mem_debug_options +_libre_CRYPTO_get_mem_debug_options +_libre_CRYPTO_push_info_ +_libre_CRYPTO_pop_info +_libre_CRYPTO_remove_all_info +_libre_CRYPTO_dbg_malloc +_libre_CRYPTO_dbg_realloc +_libre_CRYPTO_dbg_free +_libre_CRYPTO_dbg_set_options +_libre_CRYPTO_dbg_get_options +_libre_CRYPTO_mem_leaks_fp +_libre_CRYPTO_mem_leaks +_libre_CRYPTO_mem_leaks_cb +_libre_OpenSSLDie +_libre_OPENSSL_cpu_caps +_libre_OPENSSL_init_crypto +_libre_OPENSSL_cleanup +_libre_ERR_load_CRYPTO_strings +_libre_CAST_set_key +_libre_CAST_ecb_encrypt +_libre_CAST_encrypt +_libre_CAST_decrypt +_libre_CAST_cbc_encrypt +_libre_CAST_cfb64_encrypt +_libre_CAST_ofb64_encrypt +_libre_idea_options +_libre_idea_ecb_encrypt +_libre_idea_set_encrypt_key +_libre_idea_set_decrypt_key +_libre_idea_cbc_encrypt +_libre_idea_cfb64_encrypt +_libre_idea_ofb64_encrypt +_libre_idea_encrypt +_libre_OCSP_RESPID_new +_libre_OCSP_RESPID_free +_libre_d2i_OCSP_RESPID +_libre_i2d_OCSP_RESPID +_libre_OCSP_CERTID_dup +_libre_OCSP_sendreq_bio +_libre_OCSP_sendreq_new +_libre_OCSP_sendreq_nbio +_libre_OCSP_REQ_CTX_free +_libre_OCSP_REQ_CTX_set1_req +_libre_OCSP_REQ_CTX_add1_header +_libre_OCSP_cert_to_id +_libre_OCSP_cert_id_new +_libre_OCSP_request_add0_id +_libre_OCSP_request_add1_nonce +_libre_OCSP_basic_add1_nonce +_libre_OCSP_check_nonce +_libre_OCSP_copy_nonce +_libre_OCSP_request_set1_name +_libre_OCSP_request_add1_cert +_libre_OCSP_request_sign +_libre_OCSP_response_status +_libre_OCSP_response_get1_basic +_libre_OCSP_resp_get0_signature +_libre_OCSP_resp_get0_tbs_sigalg +_libre_OCSP_resp_get0_respdata +_libre_OCSP_resp_get0_signer +_libre_OCSP_resp_count +_libre_OCSP_resp_get0 +_libre_OCSP_resp_get0_produced_at +_libre_OCSP_resp_get0_certs +_libre_OCSP_resp_get0_id +_libre_OCSP_resp_find +_libre_OCSP_single_get0_status +_libre_OCSP_resp_find_status +_libre_OCSP_check_validity +_libre_OCSP_request_verify +_libre_OCSP_parse_url +_libre_OCSP_id_issuer_cmp +_libre_OCSP_id_cmp +_libre_OCSP_request_onereq_count +_libre_OCSP_request_onereq_get0 +_libre_OCSP_onereq_get0_id +_libre_OCSP_id_get0_info +_libre_OCSP_request_is_signed +_libre_OCSP_response_create +_libre_OCSP_basic_add1_status +_libre_OCSP_basic_add1_cert +_libre_OCSP_basic_sign +_libre_OCSP_crlID_new +_libre_OCSP_accept_responses_new +_libre_OCSP_archive_cutoff_new +_libre_OCSP_url_svcloc_new +_libre_OCSP_REQUEST_get_ext_count +_libre_OCSP_REQUEST_get_ext_by_NID +_libre_OCSP_REQUEST_get_ext_by_OBJ +_libre_OCSP_REQUEST_get_ext_by_critical +_libre_OCSP_REQUEST_get_ext +_libre_OCSP_REQUEST_delete_ext +_libre_OCSP_REQUEST_get1_ext_d2i +_libre_OCSP_REQUEST_add1_ext_i2d +_libre_OCSP_REQUEST_add_ext +_libre_OCSP_ONEREQ_get_ext_count +_libre_OCSP_ONEREQ_get_ext_by_NID +_libre_OCSP_ONEREQ_get_ext_by_OBJ +_libre_OCSP_ONEREQ_get_ext_by_critical +_libre_OCSP_ONEREQ_get_ext +_libre_OCSP_ONEREQ_delete_ext +_libre_OCSP_ONEREQ_get1_ext_d2i +_libre_OCSP_ONEREQ_add1_ext_i2d +_libre_OCSP_ONEREQ_add_ext +_libre_OCSP_BASICRESP_get_ext_count +_libre_OCSP_BASICRESP_get_ext_by_NID +_libre_OCSP_BASICRESP_get_ext_by_OBJ +_libre_OCSP_BASICRESP_get_ext_by_critical +_libre_OCSP_BASICRESP_get_ext +_libre_OCSP_BASICRESP_delete_ext +_libre_OCSP_BASICRESP_get1_ext_d2i +_libre_OCSP_BASICRESP_add1_ext_i2d +_libre_OCSP_BASICRESP_add_ext +_libre_OCSP_SINGLERESP_get_ext_count +_libre_OCSP_SINGLERESP_get_ext_by_NID +_libre_OCSP_SINGLERESP_get_ext_by_OBJ +_libre_OCSP_SINGLERESP_get_ext_by_critical +_libre_OCSP_SINGLERESP_get_ext +_libre_OCSP_SINGLERESP_delete_ext +_libre_OCSP_SINGLERESP_get1_ext_d2i +_libre_OCSP_SINGLERESP_add1_ext_i2d +_libre_OCSP_SINGLERESP_add_ext +_libre_OCSP_SINGLERESP_get0_id +_libre_OCSP_SINGLERESP_new +_libre_OCSP_SINGLERESP_free +_libre_d2i_OCSP_SINGLERESP +_libre_i2d_OCSP_SINGLERESP +_libre_OCSP_CERTSTATUS_new +_libre_OCSP_CERTSTATUS_free +_libre_d2i_OCSP_CERTSTATUS +_libre_i2d_OCSP_CERTSTATUS +_libre_OCSP_REVOKEDINFO_new +_libre_OCSP_REVOKEDINFO_free +_libre_d2i_OCSP_REVOKEDINFO +_libre_i2d_OCSP_REVOKEDINFO +_libre_OCSP_BASICRESP_new +_libre_OCSP_BASICRESP_free +_libre_d2i_OCSP_BASICRESP +_libre_i2d_OCSP_BASICRESP +_libre_OCSP_RESPDATA_new +_libre_OCSP_RESPDATA_free +_libre_d2i_OCSP_RESPDATA +_libre_i2d_OCSP_RESPDATA +_libre_OCSP_RESPID_new +_libre_OCSP_RESPID_free +_libre_d2i_OCSP_RESPID +_libre_i2d_OCSP_RESPID +_libre_OCSP_RESPONSE_new +_libre_OCSP_RESPONSE_free +_libre_d2i_OCSP_RESPONSE +_libre_i2d_OCSP_RESPONSE +_libre_d2i_OCSP_RESPONSE_bio +_libre_i2d_OCSP_RESPONSE_bio +_libre_OCSP_RESPBYTES_new +_libre_OCSP_RESPBYTES_free +_libre_d2i_OCSP_RESPBYTES +_libre_i2d_OCSP_RESPBYTES +_libre_OCSP_ONEREQ_new +_libre_OCSP_ONEREQ_free +_libre_d2i_OCSP_ONEREQ +_libre_i2d_OCSP_ONEREQ +_libre_OCSP_CERTID_new +_libre_OCSP_CERTID_free +_libre_d2i_OCSP_CERTID +_libre_i2d_OCSP_CERTID +_libre_OCSP_REQUEST_new +_libre_OCSP_REQUEST_free +_libre_d2i_OCSP_REQUEST +_libre_i2d_OCSP_REQUEST +_libre_d2i_OCSP_REQUEST_bio +_libre_i2d_OCSP_REQUEST_bio +_libre_OCSP_SIGNATURE_new +_libre_OCSP_SIGNATURE_free +_libre_d2i_OCSP_SIGNATURE +_libre_i2d_OCSP_SIGNATURE +_libre_OCSP_REQINFO_new +_libre_OCSP_REQINFO_free +_libre_d2i_OCSP_REQINFO +_libre_i2d_OCSP_REQINFO +_libre_OCSP_CRLID_new +_libre_OCSP_CRLID_free +_libre_d2i_OCSP_CRLID +_libre_i2d_OCSP_CRLID +_libre_OCSP_SERVICELOC_new +_libre_OCSP_SERVICELOC_free +_libre_d2i_OCSP_SERVICELOC +_libre_i2d_OCSP_SERVICELOC +_libre_OCSP_response_status_str +_libre_OCSP_cert_status_str +_libre_OCSP_crl_reason_str +_libre_OCSP_REQUEST_print +_libre_OCSP_RESPONSE_print +_libre_OCSP_basic_verify +_libre_ERR_load_OCSP_strings +_libre_MD5_Init +_libre_MD5_Update +_libre_MD5_Final +_libre_MD5 +_libre_MD5_Transform +_libre_MD4_Init +_libre_MD4_Update +_libre_MD4_Final +_libre_MD4 +_libre_MD4_Transform +_libre_TXT_DB_read +_libre_TXT_DB_write +_libre_TXT_DB_create_index +_libre_TXT_DB_free +_libre_TXT_DB_get_by_index +_libre_TXT_DB_insert +_libre_BN_set_flags +_libre_BN_get_flags +_libre_BN_with_flags +_libre_BN_GENCB_new +_libre_BN_GENCB_free +_libre_BN_GENCB_call +_libre_BN_GENCB_set_old +_libre_BN_GENCB_set +_libre_BN_GENCB_get_arg +_libre_BN_abs_is_word +_libre_BN_is_zero +_libre_BN_is_one +_libre_BN_is_word +_libre_BN_is_odd +_libre_BN_zero +_libre_BN_one +_libre_BN_value_one +_libre_BN_options +_libre_BN_CTX_new +_libre_BN_CTX_free +_libre_BN_CTX_start +_libre_BN_CTX_get +_libre_BN_CTX_end +_libre_BN_rand +_libre_BN_pseudo_rand +_libre_BN_rand_range +_libre_BN_pseudo_rand_range +_libre_BN_num_bits +_libre_BN_num_bits_word +_libre_BN_new +_libre_BN_clear_free +_libre_BN_copy +_libre_BN_swap +_libre_BN_bin2bn +_libre_BN_bn2bin +_libre_BN_bn2binpad +_libre_BN_lebin2bn +_libre_BN_bn2lebinpad +_libre_BN_mpi2bn +_libre_BN_bn2mpi +_libre_BN_sub +_libre_BN_usub +_libre_BN_uadd +_libre_BN_add +_libre_BN_mul +_libre_BN_sqr +_libre_BN_set_negative +_libre_BN_is_negative +_libre_BN_nnmod +_libre_BN_mod_add +_libre_BN_mod_add_quick +_libre_BN_mod_sub +_libre_BN_mod_sub_quick +_libre_BN_mod_mul +_libre_BN_mod_sqr +_libre_BN_mod_lshift1 +_libre_BN_mod_lshift1_quick +_libre_BN_mod_lshift +_libre_BN_mod_lshift_quick +_libre_BN_mod_word +_libre_BN_div_word +_libre_BN_mul_word +_libre_BN_add_word +_libre_BN_sub_word +_libre_BN_set_word +_libre_BN_get_word +_libre_BN_cmp +_libre_BN_free +_libre_BN_is_bit_set +_libre_BN_lshift +_libre_BN_lshift1 +_libre_BN_exp +_libre_BN_mod_exp_mont_consttime +_libre_BN_mod_exp_mont_word +_libre_BN_mod_exp2_mont +_libre_BN_mod_exp_simple +_libre_BN_mask_bits +_libre_BN_print_fp +_libre_BN_print +_libre_BN_rshift +_libre_BN_rshift1 +_libre_BN_clear +_libre_BN_dup +_libre_BN_ucmp +_libre_BN_set_bit +_libre_BN_clear_bit +_libre_BN_bn2hex +_libre_BN_bn2dec +_libre_BN_hex2bn +_libre_BN_dec2bn +_libre_BN_asc2bn +_libre_BN_kronecker +_libre_BN_mod_sqrt +_libre_BN_consttime_swap +_libre_BN_security_bits +_libre_BN_generate_prime_ex +_libre_BN_is_prime_ex +_libre_BN_is_prime_fasttest_ex +_libre_BN_MONT_CTX_new +_libre_BN_mod_mul_montgomery +_libre_BN_to_montgomery +_libre_BN_from_montgomery +_libre_BN_MONT_CTX_free +_libre_BN_MONT_CTX_set +_libre_BN_MONT_CTX_copy +_libre_BN_MONT_CTX_set_locked +_libre_BN_BLINDING_new +_libre_BN_BLINDING_free +_libre_BN_BLINDING_update +_libre_BN_BLINDING_convert +_libre_BN_BLINDING_invert +_libre_BN_BLINDING_convert_ex +_libre_BN_BLINDING_invert_ex +_libre_BN_BLINDING_thread_id +_libre_BN_BLINDING_get_flags +_libre_BN_BLINDING_set_flags +_libre_BN_BLINDING_create_param +_libre_get_rfc2409_prime_768 +_libre_get_rfc2409_prime_1024 +_libre_BN_get_rfc2409_prime_768 +_libre_BN_get_rfc2409_prime_1024 +_libre_get_rfc3526_prime_1536 +_libre_get_rfc3526_prime_2048 +_libre_get_rfc3526_prime_3072 +_libre_get_rfc3526_prime_4096 +_libre_get_rfc3526_prime_6144 +_libre_get_rfc3526_prime_8192 +_libre_BN_get_rfc3526_prime_1536 +_libre_BN_get_rfc3526_prime_2048 +_libre_BN_get_rfc3526_prime_3072 +_libre_BN_get_rfc3526_prime_4096 +_libre_BN_get_rfc3526_prime_6144 +_libre_BN_get_rfc3526_prime_8192 +_libre_ERR_load_BN_strings +_libre_SHA1_Init +_libre_SHA1_Update +_libre_SHA1_Final +_libre_SHA1 +_libre_SHA1_Transform +_libre_SHA224_Init +_libre_SHA224_Update +_libre_SHA224_Final +_libre_SHA224 +_libre_SHA256_Init +_libre_SHA256_Update +_libre_SHA256_Final +_libre_SHA256 +_libre_SHA256_Transform +_libre_SHA384_Init +_libre_SHA384_Update +_libre_SHA384_Final +_libre_SHA384 +_libre_SHA512_Init +_libre_SHA512_Update +_libre_SHA512_Final +_libre_SHA512 +_libre_SHA512_Transform +_libre_RSA_new +_libre_RSA_new_method +_libre_RSA_bits +_libre_RSA_size +_libre_RSA_generate_key +_libre_RSA_generate_key_ex +_libre_RSA_check_key +_libre_RSA_public_encrypt +_libre_RSA_private_encrypt +_libre_RSA_public_decrypt +_libre_RSA_private_decrypt +_libre_RSA_free +_libre_RSA_up_ref +_libre_RSA_flags +_libre_RSA_set_default_method +_libre_RSA_get_default_method +_libre_RSA_get_method +_libre_RSA_set_method +_libre_RSA_PKCS1_OpenSSL +_libre_RSA_PKCS1_SSLeay +_libre_RSA_pkey_ctx_ctrl +_libre_d2i_RSAPublicKey +_libre_i2d_RSAPublicKey +_libre_d2i_RSAPrivateKey +_libre_i2d_RSAPrivateKey +_libre_RSA_PSS_PARAMS_new +_libre_RSA_PSS_PARAMS_free +_libre_d2i_RSA_PSS_PARAMS +_libre_i2d_RSA_PSS_PARAMS +_libre_RSA_OAEP_PARAMS_new +_libre_RSA_OAEP_PARAMS_free +_libre_d2i_RSA_OAEP_PARAMS +_libre_i2d_RSA_OAEP_PARAMS +_libre_RSA_print_fp +_libre_RSA_print +_libre_RSA_sign +_libre_RSA_verify +_libre_RSA_sign_ASN1_OCTET_STRING +_libre_RSA_verify_ASN1_OCTET_STRING +_libre_RSA_blinding_on +_libre_RSA_blinding_off +_libre_RSA_setup_blinding +_libre_RSA_padding_add_PKCS1_type_1 +_libre_RSA_padding_check_PKCS1_type_1 +_libre_RSA_padding_add_PKCS1_type_2 +_libre_RSA_padding_check_PKCS1_type_2 +_libre_PKCS1_MGF1 +_libre_RSA_padding_add_PKCS1_OAEP +_libre_RSA_padding_check_PKCS1_OAEP +_libre_RSA_padding_add_PKCS1_OAEP_mgf1 +_libre_RSA_padding_check_PKCS1_OAEP_mgf1 +_libre_RSA_padding_add_none +_libre_RSA_padding_check_none +_libre_RSA_verify_PKCS1_PSS +_libre_RSA_padding_add_PKCS1_PSS +_libre_RSA_verify_PKCS1_PSS_mgf1 +_libre_RSA_padding_add_PKCS1_PSS_mgf1 +_libre_RSA_get_ex_new_index +_libre_RSA_set_ex_data +_libre_RSA_get_ex_data +_libre_RSA_security_bits +_libre_RSA_get0_key +_libre_RSA_set0_key +_libre_RSA_get0_crt_params +_libre_RSA_set0_crt_params +_libre_RSA_get0_factors +_libre_RSA_set0_factors +_libre_RSA_get0_n +_libre_RSA_get0_e +_libre_RSA_get0_d +_libre_RSA_get0_p +_libre_RSA_get0_q +_libre_RSA_get0_dmp1 +_libre_RSA_get0_dmq1 +_libre_RSA_get0_iqmp +_libre_RSA_get0_pss_params +_libre_RSA_clear_flags +_libre_RSA_test_flags +_libre_RSA_set_flags +_libre_RSAPublicKey_dup +_libre_RSAPrivateKey_dup +_libre_RSA_meth_new +_libre_RSA_meth_free +_libre_RSA_meth_dup +_libre_RSA_meth_set1_name +_libre_RSA_meth_set_priv_enc +_libre_RSA_meth_set_priv_dec +_libre_RSA_meth_get_finish +_libre_RSA_meth_set_finish +_libre_RSA_meth_set_pub_enc +_libre_RSA_meth_set_pub_dec +_libre_RSA_meth_set_mod_exp +_libre_RSA_meth_set_bn_mod_exp +_libre_RSA_meth_set_init +_libre_RSA_meth_set_keygen +_libre_RSA_meth_set_flags +_libre_RSA_meth_set0_app_data +_libre_RSA_meth_get0_name +_libre_RSA_meth_get_pub_enc +_libre_RSA_meth_get_pub_dec +_libre_RSA_meth_get_priv_enc +_libre_RSA_meth_get_priv_dec +_libre_RSA_meth_get_mod_exp +_libre_RSA_meth_get_bn_mod_exp +_libre_RSA_meth_get_init +_libre_RSA_meth_get_keygen +_libre_RSA_meth_get_flags +_libre_RSA_meth_get0_app_data +_libre_RSA_meth_get_sign +_libre_RSA_meth_set_sign +_libre_RSA_meth_get_verify +_libre_RSA_meth_set_verify +_libre_ERR_load_RSA_strings +_libre_OBJ_NAME_init +_libre_OBJ_NAME_new_index +_libre_OBJ_NAME_get +_libre_OBJ_NAME_add +_libre_OBJ_NAME_remove +_libre_OBJ_NAME_cleanup +_libre_OBJ_NAME_do_all +_libre_OBJ_NAME_do_all_sorted +_libre_OBJ_dup +_libre_OBJ_nid2obj +_libre_OBJ_nid2ln +_libre_OBJ_nid2sn +_libre_OBJ_obj2nid +_libre_OBJ_txt2obj +_libre_OBJ_obj2txt +_libre_OBJ_txt2nid +_libre_OBJ_ln2nid +_libre_OBJ_sn2nid +_libre_OBJ_cmp +_libre_OBJ_bsearch_ +_libre_OBJ_new_nid +_libre_OBJ_add_object +_libre_OBJ_create +_libre_OBJ_cleanup +_libre_OBJ_create_objects +_libre_OBJ_length +_libre_OBJ_get0_data +_libre_OBJ_find_sigid_algs +_libre_OBJ_find_sigid_by_algs +_libre_OBJ_add_sigid +_libre_OBJ_sigid_free +_libre_ERR_load_OBJ_strings +_libre_CMAC_CTX_new +_libre_CMAC_CTX_cleanup +_libre_CMAC_CTX_free +_libre_CMAC_CTX_get0_cipher_ctx +_libre_CMAC_CTX_copy +_libre_CMAC_Init +_libre_CMAC_Update +_libre_CMAC_Final +_libre_CMAC_resume +_libre_d2i_DSAparams_bio +_libre_i2d_DSAparams_bio +_libre_d2i_DSAparams_fp +_libre_i2d_DSAparams_fp +_libre_DSAparams_dup +_libre_DSA_SIG_new +_libre_DSA_SIG_free +_libre_i2d_DSA_SIG +_libre_d2i_DSA_SIG +_libre_DSA_SIG_get0 +_libre_DSA_SIG_set0 +_libre_DSA_do_sign +_libre_DSA_do_verify +_libre_DSA_OpenSSL +_libre_DSA_set_default_method +_libre_DSA_get_default_method +_libre_DSA_set_method +_libre_DSA_new +_libre_DSA_new_method +_libre_DSA_free +_libre_DSA_up_ref +_libre_DSA_size +_libre_DSA_bits +_libre_DSA_sign_setup +_libre_DSA_sign +_libre_DSA_verify +_libre_DSA_get_ex_new_index +_libre_DSA_set_ex_data +_libre_DSA_get_ex_data +_libre_DSA_security_bits +_libre_d2i_DSAPublicKey +_libre_i2d_DSAPublicKey +_libre_d2i_DSAPrivateKey +_libre_i2d_DSAPrivateKey +_libre_d2i_DSAparams +_libre_i2d_DSAparams +_libre_DSA_generate_parameters +_libre_DSA_generate_parameters_ex +_libre_DSA_generate_key +_libre_DSAparams_print +_libre_DSA_print +_libre_DSAparams_print_fp +_libre_DSA_print_fp +_libre_DSA_dup_DH +_libre_DSA_get0_pqg +_libre_DSA_set0_pqg +_libre_DSA_get0_key +_libre_DSA_set0_key +_libre_DSA_get0_p +_libre_DSA_get0_q +_libre_DSA_get0_g +_libre_DSA_get0_pub_key +_libre_DSA_get0_priv_key +_libre_DSA_clear_flags +_libre_DSA_test_flags +_libre_DSA_set_flags +_libre_DSA_get0_engine +_libre_DSA_meth_new +_libre_DSA_meth_free +_libre_DSA_meth_dup +_libre_DSA_meth_get0_name +_libre_DSA_meth_set1_name +_libre_DSA_meth_set_sign +_libre_DSA_meth_set_finish +_libre_ERR_load_DSA_strings +_libre_Gost2814789_set_sbox +_libre_Gost2814789_set_key +_libre_Gost2814789_ecb_encrypt +_libre_Gost2814789_cfb64_encrypt +_libre_Gost2814789_cnt_encrypt +_libre_GOST_CIPHER_PARAMS_new +_libre_GOST_CIPHER_PARAMS_free +_libre_d2i_GOST_CIPHER_PARAMS +_libre_i2d_GOST_CIPHER_PARAMS +_libre_GOST2814789IMIT_Init +_libre_GOST2814789IMIT_Update +_libre_GOST2814789IMIT_Final +_libre_GOST2814789IMIT_Transform +_libre_GOST2814789IMIT +_libre_GOSTR341194_Init +_libre_GOSTR341194_Update +_libre_GOSTR341194_Final +_libre_GOSTR341194_Transform +_libre_GOSTR341194 +_libre_STREEBOG256_Init +_libre_STREEBOG256_Update +_libre_STREEBOG256_Final +_libre_STREEBOG256 +_libre_STREEBOG512_Init +_libre_STREEBOG512_Update +_libre_STREEBOG512_Final +_libre_STREEBOG512_Transform +_libre_STREEBOG512 +_libre_GOST_KEY_new +_libre_GOST_KEY_free +_libre_GOST_KEY_check_key +_libre_GOST_KEY_set_public_key_affine_coordinates +_libre_GOST_KEY_get0_group +_libre_GOST_KEY_set_group +_libre_GOST_KEY_get_digest +_libre_GOST_KEY_set_digest +_libre_GOST_KEY_get0_private_key +_libre_GOST_KEY_set_private_key +_libre_GOST_KEY_get0_public_key +_libre_GOST_KEY_set_public_key +_libre_GOST_KEY_get_size +_libre_ERR_load_GOST_strings +_libre_CRYPTO_cbc128_encrypt +_libre_CRYPTO_cbc128_decrypt +_libre_CRYPTO_ctr128_encrypt +_libre_CRYPTO_ctr128_encrypt_ctr32 +_libre_CRYPTO_ofb128_encrypt +_libre_CRYPTO_cfb128_encrypt +_libre_CRYPTO_cfb128_8_encrypt +_libre_CRYPTO_cfb128_1_encrypt +_libre_CRYPTO_gcm128_new +_libre_CRYPTO_gcm128_init +_libre_CRYPTO_gcm128_setiv +_libre_CRYPTO_gcm128_aad +_libre_CRYPTO_gcm128_encrypt +_libre_CRYPTO_gcm128_decrypt +_libre_CRYPTO_gcm128_encrypt_ctr32 +_libre_CRYPTO_gcm128_decrypt_ctr32 +_libre_CRYPTO_gcm128_finish +_libre_CRYPTO_gcm128_tag +_libre_CRYPTO_gcm128_release +_libre_CRYPTO_ccm128_init +_libre_CRYPTO_ccm128_setiv +_libre_CRYPTO_ccm128_aad +_libre_CRYPTO_ccm128_encrypt +_libre_CRYPTO_ccm128_decrypt +_libre_CRYPTO_ccm128_encrypt_ccm64 +_libre_CRYPTO_ccm128_decrypt_ccm64 +_libre_CRYPTO_ccm128_tag +_libre_CRYPTO_xts128_encrypt +_libre_X25519_keypair +_libre_X25519 +_libre_ED25519_keypair +_libre_ED25519_sign +_libre_ED25519_verify +_libre_d2i_DHparams_bio +_libre_i2d_DHparams_bio +_libre_d2i_DHparams_fp +_libre_i2d_DHparams_fp +_libre_DHparams_dup +_libre_DH_OpenSSL +_libre_DH_set_default_method +_libre_DH_get_default_method +_libre_DH_set_method +_libre_DH_new_method +_libre_DH_new +_libre_DH_free +_libre_DH_up_ref +_libre_DH_size +_libre_DH_bits +_libre_DH_get_ex_new_index +_libre_DH_set_ex_data +_libre_DH_get_ex_data +_libre_DH_security_bits +_libre_DH_get0_engine +_libre_DH_get0_pqg +_libre_DH_set0_pqg +_libre_DH_get0_key +_libre_DH_set0_key +_libre_DH_get0_p +_libre_DH_get0_q +_libre_DH_get0_g +_libre_DH_get0_priv_key +_libre_DH_get0_pub_key +_libre_DH_clear_flags +_libre_DH_test_flags +_libre_DH_set_flags +_libre_DH_get_length +_libre_DH_set_length +_libre_DH_generate_parameters +_libre_DH_generate_parameters_ex +_libre_DH_check +_libre_DH_check_pub_key +_libre_DH_generate_key +_libre_DH_compute_key +_libre_d2i_DHparams +_libre_i2d_DHparams +_libre_DHparams_print_fp +_libre_DHparams_print +_libre_ERR_load_DH_strings diff --git a/lib/libcrypto/arch/riscv64/Makefile.inc b/lib/libcrypto/arch/riscv64/Makefile.inc new file mode 100644 index 000000000..28e2a46b8 --- /dev/null +++ b/lib/libcrypto/arch/riscv64/Makefile.inc @@ -0,0 +1,26 @@ +# $OpenBSD: Makefile.inc,v 1.1 2023/07/07 15:51:03 jsing Exp $ + +# riscv64 libcrypto build rules + +# aes +SRCS+= aes_core.c +SRCS+= aes_cbc.c + +# bf +SRCS+= bf_enc.c + +# camellia +SRCS+= camellia.c +SRCS+= cmll_cbc.c +SRCS+= cmll_misc.c + +# des +SRCS+= des_enc.c +SRCS+= fcrypt_b.c + +# rc4 +SRCS+= rc4_enc.c +SRCS+= rc4_skey.c + +# whrlpool +SRCS+= wp_block.c diff --git a/lib/libcrypto/asn1/a_pkey.c b/lib/libcrypto/asn1/a_pkey.c index 595b22605..6e715d4f9 100644 --- a/lib/libcrypto/asn1/a_pkey.c +++ b/lib/libcrypto/asn1/a_pkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: a_pkey.c,v 1.5 2023/07/05 21:23:36 beck Exp $ */ +/* $OpenBSD: a_pkey.c,v 1.6 2023/07/07 19:37:52 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -123,7 +123,6 @@ d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp, long length) EVP_PKEY_free(ret); return (NULL); } -LCRYPTO_ALIAS(d2i_PrivateKey); int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp) @@ -140,7 +139,6 @@ i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp) ASN1error(ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE); return (-1); } -LCRYPTO_ALIAS(i2d_PrivateKey); /* This works like d2i_PrivateKey() except it automatically works out the type */ @@ -186,4 +184,3 @@ d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, long length) sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free); return d2i_PrivateKey(keytype, a, pp, length); } -LCRYPTO_ALIAS(d2i_AutoPrivateKey); diff --git a/lib/libcrypto/asn1/a_pubkey.c b/lib/libcrypto/asn1/a_pubkey.c index 09a739fde..5e022d34e 100644 --- a/lib/libcrypto/asn1/a_pubkey.c +++ b/lib/libcrypto/asn1/a_pubkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: a_pubkey.c,v 1.5 2023/07/05 21:23:36 beck Exp $ */ +/* $OpenBSD: a_pubkey.c,v 1.6 2023/07/07 19:37:52 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -136,7 +136,6 @@ d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, long length) EVP_PKEY_free(ret); return (NULL); } -LCRYPTO_ALIAS(d2i_PublicKey); int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp) @@ -159,4 +158,3 @@ i2d_PublicKey(EVP_PKEY *a, unsigned char **pp) return (-1); } } -LCRYPTO_ALIAS(i2d_PublicKey); diff --git a/lib/libcrypto/asn1/a_strex.c b/lib/libcrypto/asn1/a_strex.c index c40a13d01..17213cbd3 100644 --- a/lib/libcrypto/asn1/a_strex.c +++ b/lib/libcrypto/asn1/a_strex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: a_strex.c,v 1.33 2023/07/05 21:23:36 beck Exp $ */ +/* $OpenBSD: a_strex.c,v 1.34 2023/07/07 19:37:52 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -570,7 +570,6 @@ X509_NAME_print_ex(BIO *out, const X509_NAME *nm, int indent, return X509_NAME_print(out, nm, indent); return do_name_ex(send_bio_chars, out, nm, indent, flags); } -LCRYPTO_ALIAS(X509_NAME_print_ex); int X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm, int indent, @@ -588,7 +587,6 @@ X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm, int indent, } return do_name_ex(send_fp_chars, fp, nm, indent, flags); } -LCRYPTO_ALIAS(X509_NAME_print_ex_fp); int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long flags) diff --git a/lib/libcrypto/asn1/a_time_tm.c b/lib/libcrypto/asn1/a_time_tm.c index c269d770b..9cdac73ff 100644 --- a/lib/libcrypto/asn1/a_time_tm.c +++ b/lib/libcrypto/asn1/a_time_tm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: a_time_tm.c,v 1.28 2023/07/05 21:23:36 beck Exp $ */ +/* $OpenBSD: a_time_tm.c,v 1.29 2023/07/07 19:37:52 beck Exp $ */ /* * Copyright (c) 2015 Bob Beck * @@ -77,7 +77,6 @@ ASN1_time_tm_clamp_notafter(struct tm *tm) #endif return 1; } -LCRYPTO_ALIAS(ASN1_time_tm_clamp_notafter); /* Convert time to GeneralizedTime, X.690, 11.7. */ ASN1_TIME * @@ -567,7 +566,6 @@ ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t) return ASN1_TIME_cmp_time_t_internal(s, t, V_ASN1_UTCTIME); return -2; } -LCRYPTO_ALIAS(ASN1_UTCTIME_cmp_time_t); /* * ASN1_GENERALIZEDTIME wrappers diff --git a/lib/libcrypto/asn1/ameth_lib.c b/lib/libcrypto/asn1/ameth_lib.c index 5a1dfd7ce..153ad21a8 100644 --- a/lib/libcrypto/asn1/ameth_lib.c +++ b/lib/libcrypto/asn1/ameth_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ameth_lib.c,v 1.31 2023/07/05 21:23:36 beck Exp $ */ +/* $OpenBSD: ameth_lib.c,v 1.32 2023/07/07 19:37:52 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -120,7 +120,6 @@ EVP_PKEY_asn1_get_count(void) return num; } -LCRYPTO_ALIAS(EVP_PKEY_asn1_get_count); const EVP_PKEY_ASN1_METHOD * EVP_PKEY_asn1_get0(int idx) @@ -136,7 +135,6 @@ EVP_PKEY_asn1_get0(int idx) return sk_EVP_PKEY_ASN1_METHOD_value(asn1_app_methods, idx); } -LCRYPTO_ALIAS(EVP_PKEY_asn1_get0); static const EVP_PKEY_ASN1_METHOD * pkey_asn1_find(int pkey_id) @@ -185,7 +183,6 @@ EVP_PKEY_asn1_find(ENGINE **pe, int type) } return mp; } -LCRYPTO_ALIAS(EVP_PKEY_asn1_find); const EVP_PKEY_ASN1_METHOD * EVP_PKEY_asn1_find_str(ENGINE **pe, const char *str, int len) @@ -222,7 +219,6 @@ EVP_PKEY_asn1_find_str(ENGINE **pe, const char *str, int len) } return NULL; } -LCRYPTO_ALIAS(EVP_PKEY_asn1_find_str); int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth) @@ -238,7 +234,6 @@ EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth) return 1; } -LCRYPTO_ALIAS(EVP_PKEY_asn1_add0); int EVP_PKEY_asn1_add_alias(int to, int from) @@ -256,7 +251,6 @@ EVP_PKEY_asn1_add_alias(int to, int from) } return 1; } -LCRYPTO_ALIAS(EVP_PKEY_asn1_add_alias); int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *ppkey_base_id, int *ppkey_flags, @@ -277,14 +271,12 @@ EVP_PKEY_asn1_get0_info(int *ppkey_id, int *ppkey_base_id, int *ppkey_flags, *ppem_str = ameth->pem_str; return 1; } -LCRYPTO_ALIAS(EVP_PKEY_asn1_get0_info); const EVP_PKEY_ASN1_METHOD* EVP_PKEY_get0_asn1(const EVP_PKEY *pkey) { return pkey->ameth; } -LCRYPTO_ALIAS(EVP_PKEY_get0_asn1); EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id, int flags, const char *pem_str, const char *info) @@ -314,7 +306,6 @@ EVP_PKEY_asn1_new(int id, int flags, const char *pem_str, const char *info) EVP_PKEY_asn1_free(ameth); return NULL; } -LCRYPTO_ALIAS(EVP_PKEY_asn1_new); void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, const EVP_PKEY_ASN1_METHOD *src) @@ -335,7 +326,6 @@ EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, const EVP_PKEY_ASN1_METHOD *src) dst->pem_str = preserve.pem_str; dst->info = preserve.info; } -LCRYPTO_ALIAS(EVP_PKEY_asn1_copy); void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth) @@ -346,7 +336,6 @@ EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth) free(ameth); } } -LCRYPTO_ALIAS(EVP_PKEY_asn1_free); void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth, @@ -365,7 +354,6 @@ EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth, ameth->pkey_size = pkey_size; ameth->pkey_bits = pkey_bits; } -LCRYPTO_ALIAS(EVP_PKEY_asn1_set_public); void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth, @@ -378,7 +366,6 @@ EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth, ameth->priv_encode = priv_encode; ameth->priv_print = priv_print; } -LCRYPTO_ALIAS(EVP_PKEY_asn1_set_private); void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, @@ -397,7 +384,6 @@ EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, ameth->param_cmp = param_cmp; ameth->param_print = param_print; } -LCRYPTO_ALIAS(EVP_PKEY_asn1_set_param); void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, @@ -405,7 +391,6 @@ EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, { ameth->pkey_free = pkey_free; } -LCRYPTO_ALIAS(EVP_PKEY_asn1_set_free); void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, @@ -413,7 +398,6 @@ EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, { ameth->pkey_ctrl = pkey_ctrl; } -LCRYPTO_ALIAS(EVP_PKEY_asn1_set_ctrl); void EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth, @@ -421,7 +405,6 @@ EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth, { ameth->pkey_security_bits = pkey_security_bits; } -LCRYPTO_ALIAS(EVP_PKEY_asn1_set_security_bits); void EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth, @@ -429,7 +412,6 @@ EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth, { ameth->pkey_check = pkey_check; } -LCRYPTO_ALIAS(EVP_PKEY_asn1_set_check); void EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth, @@ -437,7 +419,6 @@ EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth, { ameth->pkey_public_check = pkey_public_check; } -LCRYPTO_ALIAS(EVP_PKEY_asn1_set_public_check); void EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth, @@ -445,4 +426,3 @@ EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth, { ameth->pkey_param_check = pkey_param_check; } -LCRYPTO_ALIAS(EVP_PKEY_asn1_set_param_check); diff --git a/lib/libcrypto/asn1/asn1_item.c b/lib/libcrypto/asn1/asn1_item.c index ba2f01507..4458ceb86 100644 --- a/lib/libcrypto/asn1/asn1_item.c +++ b/lib/libcrypto/asn1/asn1_item.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1_item.c,v 1.15 2023/07/05 21:23:36 beck Exp $ */ +/* $OpenBSD: asn1_item.c,v 1.16 2023/07/07 19:37:52 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -138,7 +138,6 @@ ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *asn, free(str); return (1); } -LCRYPTO_ALIAS(ASN1_item_digest); /* * ASN1_ITEM version of ASN1_dup(): follows the same model except there's no @@ -230,7 +229,6 @@ ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, } return ASN1_item_sign_ctx(it, algor1, algor2, signature, asn, &ctx); } -LCRYPTO_ALIAS(ASN1_item_sign); int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, @@ -340,7 +338,6 @@ ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, return ret; } -LCRYPTO_ALIAS(ASN1_item_sign_ctx); int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, @@ -426,7 +423,6 @@ ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, return ret; } -LCRYPTO_ALIAS(ASN1_item_verify); #define HEADER_SIZE 8 #define ASN1_CHUNK_INITIAL_SIZE (16 * 1024) diff --git a/lib/libcrypto/asn1/asn1_old.c b/lib/libcrypto/asn1/asn1_old.c index a1d4aa257..a9aeeb823 100644 --- a/lib/libcrypto/asn1/asn1_old.c +++ b/lib/libcrypto/asn1/asn1_old.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1_old.c,v 1.4 2023/07/05 21:23:36 beck Exp $ */ +/* $OpenBSD: asn1_old.c,v 1.5 2023/07/07 19:37:52 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -91,7 +91,6 @@ ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x) free(b); return (ret); } -LCRYPTO_ALIAS(ASN1_dup); void * ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x) diff --git a/lib/libcrypto/asn1/p5_pbe.c b/lib/libcrypto/asn1/p5_pbe.c index a7fc9aa19..204e81828 100644 --- a/lib/libcrypto/asn1/p5_pbe.c +++ b/lib/libcrypto/asn1/p5_pbe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p5_pbe.c,v 1.24 2023/07/05 21:23:36 beck Exp $ */ +/* $OpenBSD: p5_pbe.c,v 1.25 2023/07/07 19:37:52 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -95,28 +95,24 @@ d2i_PBEPARAM(PBEPARAM **a, const unsigned char **in, long len) return (PBEPARAM *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &PBEPARAM_it); } -LCRYPTO_ALIAS(d2i_PBEPARAM); int i2d_PBEPARAM(PBEPARAM *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &PBEPARAM_it); } -LCRYPTO_ALIAS(i2d_PBEPARAM); PBEPARAM * PBEPARAM_new(void) { return (PBEPARAM *)ASN1_item_new(&PBEPARAM_it); } -LCRYPTO_ALIAS(PBEPARAM_new); void PBEPARAM_free(PBEPARAM *a) { ASN1_item_free((ASN1_VALUE *)a, &PBEPARAM_it); } -LCRYPTO_ALIAS(PBEPARAM_free); /* Set an algorithm identifier for a PKCS#5 PBE algorithm */ @@ -169,7 +165,6 @@ PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter, ASN1_STRING_free(pbe_str); return 0; } -LCRYPTO_ALIAS(PKCS5_pbe_set0_algor); /* Return an algorithm identifier for a PKCS#5 PBE algorithm */ @@ -189,4 +184,3 @@ PKCS5_pbe_set(int alg, int iter, const unsigned char *salt, int saltlen) X509_ALGOR_free(ret); return NULL; } -LCRYPTO_ALIAS(PKCS5_pbe_set); diff --git a/lib/libcrypto/asn1/p5_pbev2.c b/lib/libcrypto/asn1/p5_pbev2.c index 0fab422da..8b6d1929b 100644 --- a/lib/libcrypto/asn1/p5_pbev2.c +++ b/lib/libcrypto/asn1/p5_pbev2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p5_pbev2.c,v 1.29 2023/07/05 21:23:36 beck Exp $ */ +/* $OpenBSD: p5_pbev2.c,v 1.30 2023/07/07 19:37:52 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999-2004. */ @@ -97,28 +97,24 @@ d2i_PBE2PARAM(PBE2PARAM **a, const unsigned char **in, long len) return (PBE2PARAM *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &PBE2PARAM_it); } -LCRYPTO_ALIAS(d2i_PBE2PARAM); int i2d_PBE2PARAM(PBE2PARAM *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &PBE2PARAM_it); } -LCRYPTO_ALIAS(i2d_PBE2PARAM); PBE2PARAM * PBE2PARAM_new(void) { return (PBE2PARAM *)ASN1_item_new(&PBE2PARAM_it); } -LCRYPTO_ALIAS(PBE2PARAM_new); void PBE2PARAM_free(PBE2PARAM *a) { ASN1_item_free((ASN1_VALUE *)a, &PBE2PARAM_it); } -LCRYPTO_ALIAS(PBE2PARAM_free); static const ASN1_TEMPLATE PBKDF2PARAM_seq_tt[] = { { @@ -161,28 +157,24 @@ d2i_PBKDF2PARAM(PBKDF2PARAM **a, const unsigned char **in, long len) return (PBKDF2PARAM *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &PBKDF2PARAM_it); } -LCRYPTO_ALIAS(d2i_PBKDF2PARAM); int i2d_PBKDF2PARAM(PBKDF2PARAM *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &PBKDF2PARAM_it); } -LCRYPTO_ALIAS(i2d_PBKDF2PARAM); PBKDF2PARAM * PBKDF2PARAM_new(void) { return (PBKDF2PARAM *)ASN1_item_new(&PBKDF2PARAM_it); } -LCRYPTO_ALIAS(PBKDF2PARAM_new); void PBKDF2PARAM_free(PBKDF2PARAM *a) { ASN1_item_free((ASN1_VALUE *)a, &PBKDF2PARAM_it); } -LCRYPTO_ALIAS(PBKDF2PARAM_free); /* Return an algorithm identifier for a PKCS#5 v2.0 PBE algorithm: * yes I know this is horrible! @@ -293,7 +285,6 @@ PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter, unsigned char *salt, return NULL; } -LCRYPTO_ALIAS(PKCS5_pbe2_set_iv); X509_ALGOR * PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, unsigned char *salt, @@ -301,7 +292,6 @@ PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, unsigned char *salt, { return PKCS5_pbe2_set_iv(cipher, iter, salt, saltlen, NULL, -1); } -LCRYPTO_ALIAS(PKCS5_pbe2_set); X509_ALGOR * PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen, int prf_nid, @@ -382,4 +372,3 @@ PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen, int prf_nid, X509_ALGOR_free(keyfunc); return NULL; } -LCRYPTO_ALIAS(PKCS5_pbkdf2_set); diff --git a/lib/libcrypto/asn1/p8_pkey.c b/lib/libcrypto/asn1/p8_pkey.c index a757c95d6..9e0cfc41d 100644 --- a/lib/libcrypto/asn1/p8_pkey.c +++ b/lib/libcrypto/asn1/p8_pkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p8_pkey.c,v 1.22 2023/07/05 21:23:36 beck Exp $ */ +/* $OpenBSD: p8_pkey.c,v 1.23 2023/07/07 19:37:52 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -121,28 +121,24 @@ d2i_PKCS8_PRIV_KEY_INFO(PKCS8_PRIV_KEY_INFO **a, const unsigned char **in, long return (PKCS8_PRIV_KEY_INFO *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &PKCS8_PRIV_KEY_INFO_it); } -LCRYPTO_ALIAS(d2i_PKCS8_PRIV_KEY_INFO); int i2d_PKCS8_PRIV_KEY_INFO(PKCS8_PRIV_KEY_INFO *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &PKCS8_PRIV_KEY_INFO_it); } -LCRYPTO_ALIAS(i2d_PKCS8_PRIV_KEY_INFO); PKCS8_PRIV_KEY_INFO * PKCS8_PRIV_KEY_INFO_new(void) { return (PKCS8_PRIV_KEY_INFO *)ASN1_item_new(&PKCS8_PRIV_KEY_INFO_it); } -LCRYPTO_ALIAS(PKCS8_PRIV_KEY_INFO_new); void PKCS8_PRIV_KEY_INFO_free(PKCS8_PRIV_KEY_INFO *a) { ASN1_item_free((ASN1_VALUE *)a, &PKCS8_PRIV_KEY_INFO_it); } -LCRYPTO_ALIAS(PKCS8_PRIV_KEY_INFO_free); int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj, int version, @@ -158,7 +154,6 @@ PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj, int version, ASN1_STRING_set0(priv->pkey, penc, penclen); return 1; } -LCRYPTO_ALIAS(PKCS8_pkey_set0); int PKCS8_pkey_get0(const ASN1_OBJECT **ppkalg, const unsigned char **pk, @@ -174,14 +169,12 @@ PKCS8_pkey_get0(const ASN1_OBJECT **ppkalg, const unsigned char **pk, *pa = p8->pkeyalg; return 1; } -LCRYPTO_ALIAS(PKCS8_pkey_get0); const STACK_OF(X509_ATTRIBUTE) * PKCS8_pkey_get0_attrs(const PKCS8_PRIV_KEY_INFO *p8) { return p8->attributes; } -LCRYPTO_ALIAS(PKCS8_pkey_get0_attrs); int PKCS8_pkey_add1_attr_by_NID(PKCS8_PRIV_KEY_INFO *p8, int nid, int type, @@ -192,4 +185,3 @@ PKCS8_pkey_add1_attr_by_NID(PKCS8_PRIV_KEY_INFO *p8, int nid, int type, return 1; return 0; } -LCRYPTO_ALIAS(PKCS8_pkey_add1_attr_by_NID); diff --git a/lib/libcrypto/asn1/t_crl.c b/lib/libcrypto/asn1/t_crl.c index 1bbff98a5..d662d99ec 100644 --- a/lib/libcrypto/asn1/t_crl.c +++ b/lib/libcrypto/asn1/t_crl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: t_crl.c,v 1.22 2023/07/05 21:23:36 beck Exp $ */ +/* $OpenBSD: t_crl.c,v 1.23 2023/07/07 19:37:52 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -83,7 +83,6 @@ X509_CRL_print_fp(FILE *fp, X509_CRL *x) BIO_free(b); return (ret); } -LCRYPTO_ALIAS(X509_CRL_print_fp); int X509_CRL_print(BIO *out, X509_CRL *x) @@ -144,4 +143,3 @@ X509_CRL_print(BIO *out, X509_CRL *x) err: return 0; } -LCRYPTO_ALIAS(X509_CRL_print); diff --git a/lib/libcrypto/asn1/t_req.c b/lib/libcrypto/asn1/t_req.c index 0fb46c286..2fd984243 100644 --- a/lib/libcrypto/asn1/t_req.c +++ b/lib/libcrypto/asn1/t_req.c @@ -1,4 +1,4 @@ -/* $OpenBSD: t_req.c,v 1.25 2023/07/05 21:23:36 beck Exp $ */ +/* $OpenBSD: t_req.c,v 1.26 2023/07/07 19:37:52 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -91,7 +91,6 @@ X509_REQ_print_fp(FILE *fp, X509_REQ *x) BIO_free(b); return (ret); } -LCRYPTO_ALIAS(X509_REQ_print_fp); int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, @@ -255,11 +254,9 @@ X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, X509error(ERR_R_BUF_LIB); return (0); } -LCRYPTO_ALIAS(X509_REQ_print_ex); int X509_REQ_print(BIO *bp, X509_REQ *x) { return X509_REQ_print_ex(bp, x, XN_FLAG_COMPAT, X509_FLAG_COMPAT); } -LCRYPTO_ALIAS(X509_REQ_print); diff --git a/lib/libcrypto/asn1/t_spki.c b/lib/libcrypto/asn1/t_spki.c index 7e33bc77a..73996b66f 100644 --- a/lib/libcrypto/asn1/t_spki.c +++ b/lib/libcrypto/asn1/t_spki.c @@ -1,4 +1,4 @@ -/* $OpenBSD: t_spki.c,v 1.15 2023/07/05 21:23:36 beck Exp $ */ +/* $OpenBSD: t_spki.c,v 1.16 2023/07/07 19:37:52 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -113,4 +113,3 @@ NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki) BIO_write(out, "\n", 1); return 1; } -LCRYPTO_ALIAS(NETSCAPE_SPKI_print); diff --git a/lib/libcrypto/asn1/t_x509.c b/lib/libcrypto/asn1/t_x509.c index 7db4ff7db..cd98997f6 100644 --- a/lib/libcrypto/asn1/t_x509.c +++ b/lib/libcrypto/asn1/t_x509.c @@ -1,4 +1,4 @@ -/* $OpenBSD: t_x509.c,v 1.42 2023/07/05 21:23:36 beck Exp $ */ +/* $OpenBSD: t_x509.c,v 1.43 2023/07/07 19:37:52 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -85,7 +85,6 @@ X509_print_fp(FILE *fp, X509 *x) { return X509_print_ex_fp(fp, x, XN_FLAG_COMPAT, X509_FLAG_COMPAT); } -LCRYPTO_ALIAS(X509_print_fp); int X509_print_ex_fp(FILE *fp, X509 *x, unsigned long nmflag, unsigned long cflag) @@ -102,14 +101,12 @@ X509_print_ex_fp(FILE *fp, X509 *x, unsigned long nmflag, unsigned long cflag) BIO_free(b); return (ret); } -LCRYPTO_ALIAS(X509_print_ex_fp); int X509_print(BIO *bp, X509 *x) { return X509_print_ex(bp, x, XN_FLAG_COMPAT, X509_FLAG_COMPAT); } -LCRYPTO_ALIAS(X509_print); int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) @@ -253,7 +250,6 @@ X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) free(m); return (ret); } -LCRYPTO_ALIAS(X509_print_ex); int X509_ocspid_print(BIO *bp, X509 *x) @@ -305,7 +301,6 @@ X509_ocspid_print(BIO *bp, X509 *x) free(der); return (0); } -LCRYPTO_ALIAS(X509_ocspid_print); int X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent) @@ -331,7 +326,6 @@ X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent) return 1; } -LCRYPTO_ALIAS(X509_signature_dump); int X509_signature_print(BIO *bp, const X509_ALGOR *sigalg, const ASN1_STRING *sig) @@ -358,7 +352,6 @@ X509_signature_print(BIO *bp, const X509_ALGOR *sigalg, const ASN1_STRING *sig) return 0; return 1; } -LCRYPTO_ALIAS(X509_signature_print); int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm) @@ -520,4 +513,3 @@ X509_NAME_print(BIO *bp, const X509_NAME *name, int obase) free(b); return (ret); } -LCRYPTO_ALIAS(X509_NAME_print); diff --git a/lib/libcrypto/asn1/t_x509a.c b/lib/libcrypto/asn1/t_x509a.c index bbab9962d..7dbf844cc 100644 --- a/lib/libcrypto/asn1/t_x509a.c +++ b/lib/libcrypto/asn1/t_x509a.c @@ -1,4 +1,4 @@ -/* $OpenBSD: t_x509a.c,v 1.12 2023/07/05 21:23:36 beck Exp $ */ +/* $OpenBSD: t_x509a.c,v 1.13 2023/07/07 19:37:52 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -117,4 +117,3 @@ X509_CERT_AUX_print(BIO *out, X509_CERT_AUX *aux, int indent) } return 1; } -LCRYPTO_ALIAS(X509_CERT_AUX_print); diff --git a/lib/libcrypto/asn1/x_algor.c b/lib/libcrypto/asn1/x_algor.c index 8d9f9c475..0f1cd9cb6 100644 --- a/lib/libcrypto/asn1/x_algor.c +++ b/lib/libcrypto/asn1/x_algor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_algor.c,v 1.24 2023/07/05 21:23:37 beck Exp $ */ +/* $OpenBSD: x_algor.c,v 1.25 2023/07/07 19:37:52 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -109,28 +109,24 @@ d2i_X509_ALGOR(X509_ALGOR **a, const unsigned char **in, long len) return (X509_ALGOR *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_ALGOR_it); } -LCRYPTO_ALIAS(d2i_X509_ALGOR); int i2d_X509_ALGOR(X509_ALGOR *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_ALGOR_it); } -LCRYPTO_ALIAS(i2d_X509_ALGOR); X509_ALGOR * X509_ALGOR_new(void) { return (X509_ALGOR *)ASN1_item_new(&X509_ALGOR_it); } -LCRYPTO_ALIAS(X509_ALGOR_new); void X509_ALGOR_free(X509_ALGOR *a) { ASN1_item_free((ASN1_VALUE *)a, &X509_ALGOR_it); } -LCRYPTO_ALIAS(X509_ALGOR_free); X509_ALGORS * d2i_X509_ALGORS(X509_ALGORS **a, const unsigned char **in, long len) @@ -138,21 +134,18 @@ d2i_X509_ALGORS(X509_ALGORS **a, const unsigned char **in, long len) return (X509_ALGORS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_ALGORS_it); } -LCRYPTO_ALIAS(d2i_X509_ALGORS); int i2d_X509_ALGORS(X509_ALGORS *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_ALGORS_it); } -LCRYPTO_ALIAS(i2d_X509_ALGORS); X509_ALGOR * X509_ALGOR_dup(X509_ALGOR *x) { return ASN1_item_dup(&X509_ALGOR_it, x); } -LCRYPTO_ALIAS(X509_ALGOR_dup); int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval) @@ -181,7 +174,6 @@ X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval) ASN1_TYPE_set(alg->parameter, ptype, pval); return 1; } -LCRYPTO_ALIAS(X509_ALGOR_set0); void X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype, const void **ppval, @@ -199,7 +191,6 @@ X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype, const void **ppval, *ppval = algor->parameter->value.ptr; } } -LCRYPTO_ALIAS(X509_ALGOR_get0); /* Set up an X509_ALGOR DigestAlgorithmIdentifier from an EVP_MD */ @@ -213,7 +204,6 @@ X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md) X509_ALGOR_set0(alg, OBJ_nid2obj(EVP_MD_type(md)), param_type, NULL); } -LCRYPTO_ALIAS(X509_ALGOR_set_md); /* Returns 0 if they are equal, != 0 otherwise. */ int @@ -228,4 +218,3 @@ X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b) } return(rv); } -LCRYPTO_ALIAS(X509_ALGOR_cmp); diff --git a/lib/libcrypto/asn1/x_attrib.c b/lib/libcrypto/asn1/x_attrib.c index 1ed9f67f2..eb72d046c 100644 --- a/lib/libcrypto/asn1/x_attrib.c +++ b/lib/libcrypto/asn1/x_attrib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_attrib.c,v 1.19 2023/07/05 21:23:37 beck Exp $ */ +/* $OpenBSD: x_attrib.c,v 1.20 2023/07/07 19:37:52 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -111,35 +111,30 @@ d2i_X509_ATTRIBUTE(X509_ATTRIBUTE **a, const unsigned char **in, long len) return (X509_ATTRIBUTE *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_ATTRIBUTE_it); } -LCRYPTO_ALIAS(d2i_X509_ATTRIBUTE); int i2d_X509_ATTRIBUTE(X509_ATTRIBUTE *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_ATTRIBUTE_it); } -LCRYPTO_ALIAS(i2d_X509_ATTRIBUTE); X509_ATTRIBUTE * X509_ATTRIBUTE_new(void) { return (X509_ATTRIBUTE *)ASN1_item_new(&X509_ATTRIBUTE_it); } -LCRYPTO_ALIAS(X509_ATTRIBUTE_new); void X509_ATTRIBUTE_free(X509_ATTRIBUTE *a) { ASN1_item_free((ASN1_VALUE *)a, &X509_ATTRIBUTE_it); } -LCRYPTO_ALIAS(X509_ATTRIBUTE_free); X509_ATTRIBUTE * X509_ATTRIBUTE_dup(X509_ATTRIBUTE *x) { return ASN1_item_dup(&X509_ATTRIBUTE_it, x); } -LCRYPTO_ALIAS(X509_ATTRIBUTE_dup); X509_ATTRIBUTE * X509_ATTRIBUTE_create(int nid, int atrtype, void *value) @@ -168,4 +163,3 @@ X509_ATTRIBUTE_create(int nid, int atrtype, void *value) ASN1_TYPE_free(val); return (NULL); } -LCRYPTO_ALIAS(X509_ATTRIBUTE_create); diff --git a/lib/libcrypto/asn1/x_crl.c b/lib/libcrypto/asn1/x_crl.c index 74e07da3b..b33ae6e03 100644 --- a/lib/libcrypto/asn1/x_crl.c +++ b/lib/libcrypto/asn1/x_crl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_crl.c,v 1.40 2023/07/05 21:23:37 beck Exp $ */ +/* $OpenBSD: x_crl.c,v 1.41 2023/07/07 19:37:52 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -442,35 +442,30 @@ d2i_X509_REVOKED(X509_REVOKED **a, const unsigned char **in, long len) return (X509_REVOKED *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_REVOKED_it); } -LCRYPTO_ALIAS(d2i_X509_REVOKED); int i2d_X509_REVOKED(X509_REVOKED *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_REVOKED_it); } -LCRYPTO_ALIAS(i2d_X509_REVOKED); X509_REVOKED * X509_REVOKED_new(void) { return (X509_REVOKED *)ASN1_item_new(&X509_REVOKED_it); } -LCRYPTO_ALIAS(X509_REVOKED_new); void X509_REVOKED_free(X509_REVOKED *a) { ASN1_item_free((ASN1_VALUE *)a, &X509_REVOKED_it); } -LCRYPTO_ALIAS(X509_REVOKED_free); X509_REVOKED * X509_REVOKED_dup(X509_REVOKED *a) { return ASN1_item_dup(&X509_REVOKED_it, a); } -LCRYPTO_ALIAS(X509_REVOKED_dup); X509_CRL_INFO * d2i_X509_CRL_INFO(X509_CRL_INFO **a, const unsigned char **in, long len) @@ -478,28 +473,24 @@ d2i_X509_CRL_INFO(X509_CRL_INFO **a, const unsigned char **in, long len) return (X509_CRL_INFO *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_CRL_INFO_it); } -LCRYPTO_ALIAS(d2i_X509_CRL_INFO); int i2d_X509_CRL_INFO(X509_CRL_INFO *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_CRL_INFO_it); } -LCRYPTO_ALIAS(i2d_X509_CRL_INFO); X509_CRL_INFO * X509_CRL_INFO_new(void) { return (X509_CRL_INFO *)ASN1_item_new(&X509_CRL_INFO_it); } -LCRYPTO_ALIAS(X509_CRL_INFO_new); void X509_CRL_INFO_free(X509_CRL_INFO *a) { ASN1_item_free((ASN1_VALUE *)a, &X509_CRL_INFO_it); } -LCRYPTO_ALIAS(X509_CRL_INFO_free); X509_CRL * d2i_X509_CRL(X509_CRL **a, const unsigned char **in, long len) @@ -507,35 +498,30 @@ d2i_X509_CRL(X509_CRL **a, const unsigned char **in, long len) return (X509_CRL *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_CRL_it); } -LCRYPTO_ALIAS(d2i_X509_CRL); int i2d_X509_CRL(X509_CRL *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_CRL_it); } -LCRYPTO_ALIAS(i2d_X509_CRL); X509_CRL * X509_CRL_new(void) { return (X509_CRL *)ASN1_item_new(&X509_CRL_it); } -LCRYPTO_ALIAS(X509_CRL_new); void X509_CRL_free(X509_CRL *a) { ASN1_item_free((ASN1_VALUE *)a, &X509_CRL_it); } -LCRYPTO_ALIAS(X509_CRL_free); X509_CRL * X509_CRL_dup(X509_CRL *x) { return ASN1_item_dup(&X509_CRL_it, x); } -LCRYPTO_ALIAS(X509_CRL_dup); static int X509_REVOKED_cmp(const X509_REVOKED * const *a, const X509_REVOKED * const *b) @@ -558,7 +544,6 @@ X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev) inf->enc.modified = 1; return 1; } -LCRYPTO_ALIAS(X509_CRL_add0_revoked); int X509_CRL_verify(X509_CRL *crl, EVP_PKEY *r) @@ -567,7 +552,6 @@ X509_CRL_verify(X509_CRL *crl, EVP_PKEY *r) return crl->meth->crl_verify(crl, r); return 0; } -LCRYPTO_ALIAS(X509_CRL_verify); int X509_CRL_get0_by_serial(X509_CRL *crl, X509_REVOKED **ret, @@ -577,7 +561,6 @@ X509_CRL_get0_by_serial(X509_CRL *crl, X509_REVOKED **ret, return crl->meth->crl_lookup(crl, ret, serial, NULL); return 0; } -LCRYPTO_ALIAS(X509_CRL_get0_by_serial); int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x) @@ -587,7 +570,6 @@ X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x) X509_get_serialNumber(x), X509_get_issuer_name(x)); return 0; } -LCRYPTO_ALIAS(X509_CRL_get0_by_cert); static int def_crl_verify(X509_CRL *crl, EVP_PKEY *r) @@ -666,7 +648,6 @@ X509_CRL_set_default_method(const X509_CRL_METHOD *meth) else default_crl_method = meth; } -LCRYPTO_ALIAS(X509_CRL_set_default_method); X509_CRL_METHOD * X509_CRL_METHOD_new(int (*crl_init)(X509_CRL *crl), @@ -688,7 +669,6 @@ X509_CRL_METHOD_new(int (*crl_init)(X509_CRL *crl), return m; } -LCRYPTO_ALIAS(X509_CRL_METHOD_new); void X509_CRL_METHOD_free(X509_CRL_METHOD *m) @@ -699,84 +679,72 @@ X509_CRL_METHOD_free(X509_CRL_METHOD *m) return; free(m); } -LCRYPTO_ALIAS(X509_CRL_METHOD_free); void X509_CRL_set_meth_data(X509_CRL *crl, void *dat) { crl->meth_data = dat; } -LCRYPTO_ALIAS(X509_CRL_set_meth_data); void * X509_CRL_get_meth_data(X509_CRL *crl) { return crl->meth_data; } -LCRYPTO_ALIAS(X509_CRL_get_meth_data); int X509_CRL_get_signature_nid(const X509_CRL *crl) { return OBJ_obj2nid(crl->sig_alg->algorithm); } -LCRYPTO_ALIAS(X509_CRL_get_signature_nid); const STACK_OF(X509_EXTENSION) * X509_CRL_get0_extensions(const X509_CRL *crl) { return crl->crl->extensions; } -LCRYPTO_ALIAS(X509_CRL_get0_extensions); long X509_CRL_get_version(const X509_CRL *crl) { return ASN1_INTEGER_get(crl->crl->version); } -LCRYPTO_ALIAS(X509_CRL_get_version); const ASN1_TIME * X509_CRL_get0_lastUpdate(const X509_CRL *crl) { return crl->crl->lastUpdate; } -LCRYPTO_ALIAS(X509_CRL_get0_lastUpdate); ASN1_TIME * X509_CRL_get_lastUpdate(X509_CRL *crl) { return crl->crl->lastUpdate; } -LCRYPTO_ALIAS(X509_CRL_get_lastUpdate); const ASN1_TIME * X509_CRL_get0_nextUpdate(const X509_CRL *crl) { return crl->crl->nextUpdate; } -LCRYPTO_ALIAS(X509_CRL_get0_nextUpdate); ASN1_TIME * X509_CRL_get_nextUpdate(X509_CRL *crl) { return crl->crl->nextUpdate; } -LCRYPTO_ALIAS(X509_CRL_get_nextUpdate); X509_NAME * X509_CRL_get_issuer(const X509_CRL *crl) { return crl->crl->issuer; } -LCRYPTO_ALIAS(X509_CRL_get_issuer); STACK_OF(X509_REVOKED) * X509_CRL_get_REVOKED(X509_CRL *crl) { return crl->crl->revoked; } -LCRYPTO_ALIAS(X509_CRL_get_REVOKED); void X509_CRL_get0_signature(const X509_CRL *crl, const ASN1_BIT_STRING **psig, @@ -787,11 +755,9 @@ X509_CRL_get0_signature(const X509_CRL *crl, const ASN1_BIT_STRING **psig, if (palg != NULL) *palg = crl->sig_alg; } -LCRYPTO_ALIAS(X509_CRL_get0_signature); const X509_ALGOR * X509_CRL_get0_tbs_sigalg(const X509_CRL *crl) { return crl->crl->sig_alg; } -LCRYPTO_ALIAS(X509_CRL_get0_tbs_sigalg); diff --git a/lib/libcrypto/asn1/x_exten.c b/lib/libcrypto/asn1/x_exten.c index 4bf81a9da..6ff33d586 100644 --- a/lib/libcrypto/asn1/x_exten.c +++ b/lib/libcrypto/asn1/x_exten.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_exten.c,v 1.19 2023/07/05 21:23:37 beck Exp $ */ +/* $OpenBSD: x_exten.c,v 1.20 2023/07/07 19:37:52 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -116,28 +116,24 @@ d2i_X509_EXTENSION(X509_EXTENSION **a, const unsigned char **in, long len) return (X509_EXTENSION *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_EXTENSION_it); } -LCRYPTO_ALIAS(d2i_X509_EXTENSION); int i2d_X509_EXTENSION(X509_EXTENSION *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_EXTENSION_it); } -LCRYPTO_ALIAS(i2d_X509_EXTENSION); X509_EXTENSION * X509_EXTENSION_new(void) { return (X509_EXTENSION *)ASN1_item_new(&X509_EXTENSION_it); } -LCRYPTO_ALIAS(X509_EXTENSION_new); void X509_EXTENSION_free(X509_EXTENSION *a) { ASN1_item_free((ASN1_VALUE *)a, &X509_EXTENSION_it); } -LCRYPTO_ALIAS(X509_EXTENSION_free); X509_EXTENSIONS * d2i_X509_EXTENSIONS(X509_EXTENSIONS **a, const unsigned char **in, long len) @@ -145,18 +141,15 @@ d2i_X509_EXTENSIONS(X509_EXTENSIONS **a, const unsigned char **in, long len) return (X509_EXTENSIONS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_EXTENSIONS_it); } -LCRYPTO_ALIAS(d2i_X509_EXTENSIONS); int i2d_X509_EXTENSIONS(X509_EXTENSIONS *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_EXTENSIONS_it); } -LCRYPTO_ALIAS(i2d_X509_EXTENSIONS); X509_EXTENSION * X509_EXTENSION_dup(X509_EXTENSION *x) { return ASN1_item_dup(&X509_EXTENSION_it, x); } -LCRYPTO_ALIAS(X509_EXTENSION_dup); diff --git a/lib/libcrypto/asn1/x_info.c b/lib/libcrypto/asn1/x_info.c index c3fa1288c..3d2d5bad6 100644 --- a/lib/libcrypto/asn1/x_info.c +++ b/lib/libcrypto/asn1/x_info.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_info.c,v 1.19 2023/07/05 21:23:37 beck Exp $ */ +/* $OpenBSD: x_info.c,v 1.20 2023/07/07 19:37:52 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -75,7 +75,6 @@ X509_INFO_new(void) return ret; } -LCRYPTO_ALIAS(X509_INFO_new); void X509_INFO_free(X509_INFO *x) @@ -93,4 +92,3 @@ X509_INFO_free(X509_INFO *x) free(x); } -LCRYPTO_ALIAS(X509_INFO_free); diff --git a/lib/libcrypto/asn1/x_name.c b/lib/libcrypto/asn1/x_name.c index fa511d399..eb544596a 100644 --- a/lib/libcrypto/asn1/x_name.c +++ b/lib/libcrypto/asn1/x_name.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_name.c,v 1.39 2023/07/05 21:23:37 beck Exp $ */ +/* $OpenBSD: x_name.c,v 1.40 2023/07/07 19:37:52 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -117,35 +117,30 @@ d2i_X509_NAME_ENTRY(X509_NAME_ENTRY **a, const unsigned char **in, long len) return (X509_NAME_ENTRY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_NAME_ENTRY_it); } -LCRYPTO_ALIAS(d2i_X509_NAME_ENTRY); int i2d_X509_NAME_ENTRY(X509_NAME_ENTRY *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_NAME_ENTRY_it); } -LCRYPTO_ALIAS(i2d_X509_NAME_ENTRY); X509_NAME_ENTRY * X509_NAME_ENTRY_new(void) { return (X509_NAME_ENTRY *)ASN1_item_new(&X509_NAME_ENTRY_it); } -LCRYPTO_ALIAS(X509_NAME_ENTRY_new); void X509_NAME_ENTRY_free(X509_NAME_ENTRY *a) { ASN1_item_free((ASN1_VALUE *)a, &X509_NAME_ENTRY_it); } -LCRYPTO_ALIAS(X509_NAME_ENTRY_free); X509_NAME_ENTRY * X509_NAME_ENTRY_dup(X509_NAME_ENTRY *x) { return ASN1_item_dup(&X509_NAME_ENTRY_it, x); } -LCRYPTO_ALIAS(X509_NAME_ENTRY_dup); /* For the "Name" type we need a SEQUENCE OF { SET OF X509_NAME_ENTRY } * so declare two template wrappers for this @@ -219,35 +214,30 @@ d2i_X509_NAME(X509_NAME **a, const unsigned char **in, long len) return (X509_NAME *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_NAME_it); } -LCRYPTO_ALIAS(d2i_X509_NAME); int i2d_X509_NAME(X509_NAME *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_NAME_it); } -LCRYPTO_ALIAS(i2d_X509_NAME); X509_NAME * X509_NAME_new(void) { return (X509_NAME *)ASN1_item_new(&X509_NAME_it); } -LCRYPTO_ALIAS(X509_NAME_new); void X509_NAME_free(X509_NAME *a) { ASN1_item_free((ASN1_VALUE *)a, &X509_NAME_it); } -LCRYPTO_ALIAS(X509_NAME_free); X509_NAME * X509_NAME_dup(X509_NAME *x) { return ASN1_item_dup(&X509_NAME_it, x); } -LCRYPTO_ALIAS(X509_NAME_dup); static int x509_name_ex_new(ASN1_VALUE **val, const ASN1_ITEM *it) @@ -645,7 +635,6 @@ X509_NAME_set(X509_NAME **xn, X509_NAME *name) *xn = name; return 1; } -LCRYPTO_ALIAS(X509_NAME_set); int X509_NAME_get0_der(X509_NAME *nm, const unsigned char **pder, size_t *pderlen) @@ -659,4 +648,3 @@ X509_NAME_get0_der(X509_NAME *nm, const unsigned char **pder, size_t *pderlen) *pderlen = nm->bytes->length; return 1; } -LCRYPTO_ALIAS(X509_NAME_get0_der); diff --git a/lib/libcrypto/asn1/x_pkey.c b/lib/libcrypto/asn1/x_pkey.c index a71d1fdd7..c4964fcd6 100644 --- a/lib/libcrypto/asn1/x_pkey.c +++ b/lib/libcrypto/asn1/x_pkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_pkey.c,v 1.22 2023/07/05 21:23:37 beck Exp $ */ +/* $OpenBSD: x_pkey.c,v 1.23 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -98,7 +98,6 @@ X509_PKEY_new(void) } return NULL; } -LCRYPTO_ALIAS(X509_PKEY_new); void X509_PKEY_free(X509_PKEY *x) @@ -120,4 +119,3 @@ X509_PKEY_free(X509_PKEY *x) free(x->key_data); free(x); } -LCRYPTO_ALIAS(X509_PKEY_free); diff --git a/lib/libcrypto/asn1/x_pubkey.c b/lib/libcrypto/asn1/x_pubkey.c index 29211b319..0534edcad 100644 --- a/lib/libcrypto/asn1/x_pubkey.c +++ b/lib/libcrypto/asn1/x_pubkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_pubkey.c,v 1.34 2023/07/05 21:23:37 beck Exp $ */ +/* $OpenBSD: x_pubkey.c,v 1.35 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -118,28 +118,24 @@ d2i_X509_PUBKEY(X509_PUBKEY **a, const unsigned char **in, long len) return (X509_PUBKEY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_PUBKEY_it); } -LCRYPTO_ALIAS(d2i_X509_PUBKEY); int i2d_X509_PUBKEY(X509_PUBKEY *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_PUBKEY_it); } -LCRYPTO_ALIAS(i2d_X509_PUBKEY); X509_PUBKEY * X509_PUBKEY_new(void) { return (X509_PUBKEY *)ASN1_item_new(&X509_PUBKEY_it); } -LCRYPTO_ALIAS(X509_PUBKEY_new); void X509_PUBKEY_free(X509_PUBKEY *a) { ASN1_item_free((ASN1_VALUE *)a, &X509_PUBKEY_it); } -LCRYPTO_ALIAS(X509_PUBKEY_free); int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) @@ -178,7 +174,6 @@ X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) X509_PUBKEY_free(pk); return 0; } -LCRYPTO_ALIAS(X509_PUBKEY_set); EVP_PKEY * X509_PUBKEY_get0(X509_PUBKEY *key) @@ -231,7 +226,6 @@ X509_PUBKEY_get0(X509_PUBKEY *key) EVP_PKEY_free(ret); return (NULL); } -LCRYPTO_ALIAS(X509_PUBKEY_get0); EVP_PKEY * X509_PUBKEY_get(X509_PUBKEY *key) @@ -245,7 +239,6 @@ X509_PUBKEY_get(X509_PUBKEY *key) return pkey; } -LCRYPTO_ALIAS(X509_PUBKEY_get); /* * Decode an X509_PUBKEY into the specified key type. @@ -410,14 +403,12 @@ d2i_PUBKEY(EVP_PKEY **pkey, const unsigned char **in, long len) return (EVP_PKEY *)ASN1_item_d2i((ASN1_VALUE **)pkey, in, len, &EVP_PKEY_PUBKEY_it); } -LCRYPTO_ALIAS(d2i_PUBKEY); int i2d_PUBKEY(EVP_PKEY *pkey, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)pkey, out, &EVP_PKEY_PUBKEY_it); } -LCRYPTO_ALIAS(i2d_PUBKEY); EVP_PKEY * d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **pkey) @@ -425,14 +416,12 @@ d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **pkey) return (EVP_PKEY *)ASN1_item_d2i_bio(&EVP_PKEY_PUBKEY_it, bp, (ASN1_VALUE **)pkey); } -LCRYPTO_ALIAS(d2i_PUBKEY_bio); int i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey) { return ASN1_item_i2d_bio(&EVP_PKEY_PUBKEY_it, bp, (ASN1_VALUE *)pkey); } -LCRYPTO_ALIAS(i2d_PUBKEY_bio); EVP_PKEY * d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **pkey) @@ -440,14 +429,12 @@ d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **pkey) return (EVP_PKEY *)ASN1_item_d2i_fp(&EVP_PKEY_PUBKEY_it, fp, (ASN1_VALUE **)pkey); } -LCRYPTO_ALIAS(d2i_PUBKEY_fp); int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey) { return ASN1_item_i2d_fp(&EVP_PKEY_PUBKEY_it, fp, (ASN1_VALUE *)pkey); } -LCRYPTO_ALIAS(i2d_PUBKEY_fp); /* * The following are equivalents but which return RSA and DSA keys. @@ -510,42 +497,36 @@ d2i_RSA_PUBKEY(RSA **rsa, const unsigned char **in, long len) return (RSA *)ASN1_item_d2i((ASN1_VALUE **)rsa, in, len, &RSA_PUBKEY_it); } -LCRYPTO_ALIAS(d2i_RSA_PUBKEY); int i2d_RSA_PUBKEY(RSA *rsa, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)rsa, out, &RSA_PUBKEY_it); } -LCRYPTO_ALIAS(i2d_RSA_PUBKEY); RSA * d2i_RSA_PUBKEY_bio(BIO *bp, RSA **rsa) { return (RSA *)ASN1_item_d2i_bio(&RSA_PUBKEY_it, bp, (ASN1_VALUE **)rsa); } -LCRYPTO_ALIAS(d2i_RSA_PUBKEY_bio); int i2d_RSA_PUBKEY_bio(BIO *bp, RSA *rsa) { return ASN1_item_i2d_bio(&RSA_PUBKEY_it, bp, (ASN1_VALUE *)rsa); } -LCRYPTO_ALIAS(i2d_RSA_PUBKEY_bio); RSA * d2i_RSA_PUBKEY_fp(FILE *fp, RSA **rsa) { return (RSA *)ASN1_item_d2i_fp(&RSA_PUBKEY_it, fp, (ASN1_VALUE **)rsa); } -LCRYPTO_ALIAS(d2i_RSA_PUBKEY_fp); int i2d_RSA_PUBKEY_fp(FILE *fp, RSA *rsa) { return ASN1_item_i2d_fp(&RSA_PUBKEY_it, fp, (ASN1_VALUE *)rsa); } -LCRYPTO_ALIAS(i2d_RSA_PUBKEY_fp); #endif #ifndef OPENSSL_NO_DSA @@ -606,42 +587,36 @@ d2i_DSA_PUBKEY(DSA **dsa, const unsigned char **in, long len) return (DSA *)ASN1_item_d2i((ASN1_VALUE **)dsa, in, len, &DSA_PUBKEY_it); } -LCRYPTO_ALIAS(d2i_DSA_PUBKEY); int i2d_DSA_PUBKEY(DSA *dsa, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)dsa, out, &DSA_PUBKEY_it); } -LCRYPTO_ALIAS(i2d_DSA_PUBKEY); DSA * d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa) { return (DSA *)ASN1_item_d2i_bio(&DSA_PUBKEY_it, bp, (ASN1_VALUE **)dsa); } -LCRYPTO_ALIAS(d2i_DSA_PUBKEY_bio); int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa) { return ASN1_item_i2d_bio(&DSA_PUBKEY_it, bp, (ASN1_VALUE *)dsa); } -LCRYPTO_ALIAS(i2d_DSA_PUBKEY_bio); DSA * d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa) { return (DSA *)ASN1_item_d2i_fp(&DSA_PUBKEY_it, fp, (ASN1_VALUE **)dsa); } -LCRYPTO_ALIAS(d2i_DSA_PUBKEY_fp); int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa) { return ASN1_item_i2d_fp(&DSA_PUBKEY_it, fp, (ASN1_VALUE *)dsa); } -LCRYPTO_ALIAS(i2d_DSA_PUBKEY_fp); #endif @@ -703,42 +678,36 @@ d2i_EC_PUBKEY(EC_KEY **ec, const unsigned char **in, long len) return (EC_KEY *)ASN1_item_d2i((ASN1_VALUE **)ec, in, len, &EC_PUBKEY_it); } -LCRYPTO_ALIAS(d2i_EC_PUBKEY); int i2d_EC_PUBKEY(EC_KEY *ec, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)ec, out, &EC_PUBKEY_it); } -LCRYPTO_ALIAS(i2d_EC_PUBKEY); EC_KEY * d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **ec) { return (EC_KEY *)ASN1_item_d2i_bio(&EC_PUBKEY_it, bp, (ASN1_VALUE **)ec); } -LCRYPTO_ALIAS(d2i_EC_PUBKEY_bio); int i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *ec) { return ASN1_item_i2d_bio(&EC_PUBKEY_it, bp, (ASN1_VALUE *)ec); } -LCRYPTO_ALIAS(i2d_EC_PUBKEY_bio); EC_KEY * d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **ec) { return (EC_KEY *)ASN1_item_d2i_fp(&EC_PUBKEY_it, fp, (ASN1_VALUE **)ec); } -LCRYPTO_ALIAS(d2i_EC_PUBKEY_fp); int i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *ec) { return ASN1_item_i2d_fp(&EC_PUBKEY_it, fp, (ASN1_VALUE *)ec); } -LCRYPTO_ALIAS(i2d_EC_PUBKEY_fp); #endif int @@ -755,7 +724,6 @@ X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj, int ptype, return asn1_abs_set_unused_bits(pub->public_key, 0); } -LCRYPTO_ALIAS(X509_PUBKEY_set0_param); int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg, const unsigned char **pk, @@ -771,4 +739,3 @@ X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg, const unsigned char **pk, *pa = pub->algor; return 1; } -LCRYPTO_ALIAS(X509_PUBKEY_get0_param); diff --git a/lib/libcrypto/asn1/x_req.c b/lib/libcrypto/asn1/x_req.c index 9323f6507..9a6f0c7b0 100644 --- a/lib/libcrypto/asn1/x_req.c +++ b/lib/libcrypto/asn1/x_req.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_req.c,v 1.20 2023/07/05 21:23:37 beck Exp $ */ +/* $OpenBSD: x_req.c,v 1.21 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -143,28 +143,24 @@ d2i_X509_REQ_INFO(X509_REQ_INFO **a, const unsigned char **in, long len) return (X509_REQ_INFO *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_REQ_INFO_it); } -LCRYPTO_ALIAS(d2i_X509_REQ_INFO); int i2d_X509_REQ_INFO(X509_REQ_INFO *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_REQ_INFO_it); } -LCRYPTO_ALIAS(i2d_X509_REQ_INFO); X509_REQ_INFO * X509_REQ_INFO_new(void) { return (X509_REQ_INFO *)ASN1_item_new(&X509_REQ_INFO_it); } -LCRYPTO_ALIAS(X509_REQ_INFO_new); void X509_REQ_INFO_free(X509_REQ_INFO *a) { ASN1_item_free((ASN1_VALUE *)a, &X509_REQ_INFO_it); } -LCRYPTO_ALIAS(X509_REQ_INFO_free); static const ASN1_AUX X509_REQ_aux = { .app_data = NULL, @@ -207,42 +203,36 @@ d2i_X509_REQ(X509_REQ **a, const unsigned char **in, long len) return (X509_REQ *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_REQ_it); } -LCRYPTO_ALIAS(d2i_X509_REQ); int i2d_X509_REQ(X509_REQ *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_REQ_it); } -LCRYPTO_ALIAS(i2d_X509_REQ); X509_REQ * X509_REQ_new(void) { return (X509_REQ *)ASN1_item_new(&X509_REQ_it); } -LCRYPTO_ALIAS(X509_REQ_new); void X509_REQ_free(X509_REQ *a) { ASN1_item_free((ASN1_VALUE *)a, &X509_REQ_it); } -LCRYPTO_ALIAS(X509_REQ_free); X509_REQ * X509_REQ_dup(X509_REQ *x) { return ASN1_item_dup(&X509_REQ_it, x); } -LCRYPTO_ALIAS(X509_REQ_dup); int X509_REQ_get_signature_nid(const X509_REQ *req) { return OBJ_obj2nid(req->sig_alg->algorithm); } -LCRYPTO_ALIAS(X509_REQ_get_signature_nid); void X509_REQ_get0_signature(const X509_REQ *req, const ASN1_BIT_STRING **psig, @@ -253,4 +243,3 @@ X509_REQ_get0_signature(const X509_REQ *req, const ASN1_BIT_STRING **psig, if (palg != NULL) *palg = req->sig_alg; } -LCRYPTO_ALIAS(X509_REQ_get0_signature); diff --git a/lib/libcrypto/asn1/x_sig.c b/lib/libcrypto/asn1/x_sig.c index 9e1ed75d0..c55de7141 100644 --- a/lib/libcrypto/asn1/x_sig.c +++ b/lib/libcrypto/asn1/x_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_sig.c,v 1.15 2023/07/05 21:23:37 beck Exp $ */ +/* $OpenBSD: x_sig.c,v 1.16 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -92,28 +92,24 @@ d2i_X509_SIG(X509_SIG **a, const unsigned char **in, long len) return (X509_SIG *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_SIG_it); } -LCRYPTO_ALIAS(d2i_X509_SIG); int i2d_X509_SIG(X509_SIG *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_SIG_it); } -LCRYPTO_ALIAS(i2d_X509_SIG); X509_SIG * X509_SIG_new(void) { return (X509_SIG *)ASN1_item_new(&X509_SIG_it); } -LCRYPTO_ALIAS(X509_SIG_new); void X509_SIG_free(X509_SIG *a) { ASN1_item_free((ASN1_VALUE *)a, &X509_SIG_it); } -LCRYPTO_ALIAS(X509_SIG_free); void X509_SIG_get0(const X509_SIG *sig, const X509_ALGOR **palg, @@ -124,7 +120,6 @@ X509_SIG_get0(const X509_SIG *sig, const X509_ALGOR **palg, if (pdigest != NULL) *pdigest = sig->digest; } -LCRYPTO_ALIAS(X509_SIG_get0); void X509_SIG_getm(X509_SIG *sig, X509_ALGOR **palg, ASN1_OCTET_STRING **pdigest) @@ -134,4 +129,3 @@ X509_SIG_getm(X509_SIG *sig, X509_ALGOR **palg, ASN1_OCTET_STRING **pdigest) if (pdigest != NULL) *pdigest = sig->digest; } -LCRYPTO_ALIAS(X509_SIG_getm); diff --git a/lib/libcrypto/asn1/x_spki.c b/lib/libcrypto/asn1/x_spki.c index 534fc7ac5..ef6053339 100644 --- a/lib/libcrypto/asn1/x_spki.c +++ b/lib/libcrypto/asn1/x_spki.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_spki.c,v 1.12 2023/07/05 21:23:37 beck Exp $ */ +/* $OpenBSD: x_spki.c,v 1.13 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -94,28 +94,24 @@ d2i_NETSCAPE_SPKAC(NETSCAPE_SPKAC **a, const unsigned char **in, long len) return (NETSCAPE_SPKAC *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &NETSCAPE_SPKAC_it); } -LCRYPTO_ALIAS(d2i_NETSCAPE_SPKAC); int i2d_NETSCAPE_SPKAC(NETSCAPE_SPKAC *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &NETSCAPE_SPKAC_it); } -LCRYPTO_ALIAS(i2d_NETSCAPE_SPKAC); NETSCAPE_SPKAC * NETSCAPE_SPKAC_new(void) { return (NETSCAPE_SPKAC *)ASN1_item_new(&NETSCAPE_SPKAC_it); } -LCRYPTO_ALIAS(NETSCAPE_SPKAC_new); void NETSCAPE_SPKAC_free(NETSCAPE_SPKAC *a) { ASN1_item_free((ASN1_VALUE *)a, &NETSCAPE_SPKAC_it); } -LCRYPTO_ALIAS(NETSCAPE_SPKAC_free); static const ASN1_TEMPLATE NETSCAPE_SPKI_seq_tt[] = { { @@ -158,25 +154,21 @@ d2i_NETSCAPE_SPKI(NETSCAPE_SPKI **a, const unsigned char **in, long len) return (NETSCAPE_SPKI *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &NETSCAPE_SPKI_it); } -LCRYPTO_ALIAS(d2i_NETSCAPE_SPKI); int i2d_NETSCAPE_SPKI(NETSCAPE_SPKI *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &NETSCAPE_SPKI_it); } -LCRYPTO_ALIAS(i2d_NETSCAPE_SPKI); NETSCAPE_SPKI * NETSCAPE_SPKI_new(void) { return (NETSCAPE_SPKI *)ASN1_item_new(&NETSCAPE_SPKI_it); } -LCRYPTO_ALIAS(NETSCAPE_SPKI_new); void NETSCAPE_SPKI_free(NETSCAPE_SPKI *a) { ASN1_item_free((ASN1_VALUE *)a, &NETSCAPE_SPKI_it); } -LCRYPTO_ALIAS(NETSCAPE_SPKI_free); diff --git a/lib/libcrypto/asn1/x_val.c b/lib/libcrypto/asn1/x_val.c index 83c4823e2..a9c9c481e 100644 --- a/lib/libcrypto/asn1/x_val.c +++ b/lib/libcrypto/asn1/x_val.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_val.c,v 1.12 2023/07/05 21:23:37 beck Exp $ */ +/* $OpenBSD: x_val.c,v 1.13 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -90,25 +90,21 @@ d2i_X509_VAL(X509_VAL **a, const unsigned char **in, long len) return (X509_VAL *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_VAL_it); } -LCRYPTO_ALIAS(d2i_X509_VAL); int i2d_X509_VAL(X509_VAL *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_VAL_it); } -LCRYPTO_ALIAS(i2d_X509_VAL); X509_VAL * X509_VAL_new(void) { return (X509_VAL *)ASN1_item_new(&X509_VAL_it); } -LCRYPTO_ALIAS(X509_VAL_new); void X509_VAL_free(X509_VAL *a) { ASN1_item_free((ASN1_VALUE *)a, &X509_VAL_it); } -LCRYPTO_ALIAS(X509_VAL_free); diff --git a/lib/libcrypto/asn1/x_x509.c b/lib/libcrypto/asn1/x_x509.c index 5aa714754..08e4dba9e 100644 --- a/lib/libcrypto/asn1/x_x509.c +++ b/lib/libcrypto/asn1/x_x509.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_x509.c,v 1.36 2023/07/05 21:23:37 beck Exp $ */ +/* $OpenBSD: x_x509.c,v 1.37 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -149,28 +149,24 @@ d2i_X509_CINF(X509_CINF **a, const unsigned char **in, long len) return (X509_CINF *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_CINF_it); } -LCRYPTO_ALIAS(d2i_X509_CINF); int i2d_X509_CINF(X509_CINF *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_CINF_it); } -LCRYPTO_ALIAS(i2d_X509_CINF); X509_CINF * X509_CINF_new(void) { return (X509_CINF *)ASN1_item_new(&X509_CINF_it); } -LCRYPTO_ALIAS(X509_CINF_new); void X509_CINF_free(X509_CINF *a) { ASN1_item_free((ASN1_VALUE *)a, &X509_CINF_it); } -LCRYPTO_ALIAS(X509_CINF_free); /* X509 top level structure needs a bit of customisation */ static int @@ -263,35 +259,30 @@ d2i_X509(X509 **a, const unsigned char **in, long len) return (X509 *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_it); } -LCRYPTO_ALIAS(d2i_X509); int i2d_X509(X509 *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_it); } -LCRYPTO_ALIAS(i2d_X509); X509 * X509_new(void) { return (X509 *)ASN1_item_new(&X509_it); } -LCRYPTO_ALIAS(X509_new); void X509_free(X509 *a) { ASN1_item_free((ASN1_VALUE *)a, &X509_it); } -LCRYPTO_ALIAS(X509_free); X509 * X509_dup(X509 *x) { return ASN1_item_dup(&X509_it, x); } -LCRYPTO_ALIAS(X509_dup); int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, @@ -300,21 +291,18 @@ X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509, argl, argp, new_func, dup_func, free_func); } -LCRYPTO_ALIAS(X509_get_ex_new_index); int X509_set_ex_data(X509 *r, int idx, void *arg) { return (CRYPTO_set_ex_data(&r->ex_data, idx, arg)); } -LCRYPTO_ALIAS(X509_set_ex_data); void * X509_get_ex_data(X509 *r, int idx) { return (CRYPTO_get_ex_data(&r->ex_data, idx)); } -LCRYPTO_ALIAS(X509_get_ex_data); /* X509_AUX ASN1 routines. X509_AUX is the name given to * a certificate with extra info tagged on the end. Since these @@ -352,7 +340,6 @@ d2i_X509_AUX(X509 **a, const unsigned char **pp, long length) X509_free(ret); return NULL; } -LCRYPTO_ALIAS(d2i_X509_AUX); int i2d_X509_AUX(X509 *a, unsigned char **pp) @@ -364,7 +351,6 @@ i2d_X509_AUX(X509 *a, unsigned char **pp) length += i2d_X509_CERT_AUX(a->aux, pp); return length; } -LCRYPTO_ALIAS(i2d_X509_AUX); int i2d_re_X509_tbs(X509 *x, unsigned char **pp) @@ -372,7 +358,6 @@ i2d_re_X509_tbs(X509 *x, unsigned char **pp) x->cert_info->enc.modified = 1; return i2d_X509_CINF(x->cert_info, pp); } -LCRYPTO_ALIAS(i2d_re_X509_tbs); void X509_get0_signature(const ASN1_BIT_STRING **psig, const X509_ALGOR **palg, @@ -383,11 +368,9 @@ X509_get0_signature(const ASN1_BIT_STRING **psig, const X509_ALGOR **palg, if (palg != NULL) *palg = x->sig_alg; } -LCRYPTO_ALIAS(X509_get0_signature); int X509_get_signature_nid(const X509 *x) { return OBJ_obj2nid(x->sig_alg->algorithm); } -LCRYPTO_ALIAS(X509_get_signature_nid); diff --git a/lib/libcrypto/asn1/x_x509a.c b/lib/libcrypto/asn1/x_x509a.c index 36c7599bc..2b6fe7fce 100644 --- a/lib/libcrypto/asn1/x_x509a.c +++ b/lib/libcrypto/asn1/x_x509a.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_x509a.c,v 1.20 2023/07/05 21:23:37 beck Exp $ */ +/* $OpenBSD: x_x509a.c,v 1.21 2023/07/07 19:37:53 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -126,28 +126,24 @@ d2i_X509_CERT_AUX(X509_CERT_AUX **a, const unsigned char **in, long len) return (X509_CERT_AUX *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_CERT_AUX_it); } -LCRYPTO_ALIAS(d2i_X509_CERT_AUX); int i2d_X509_CERT_AUX(X509_CERT_AUX *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_CERT_AUX_it); } -LCRYPTO_ALIAS(i2d_X509_CERT_AUX); X509_CERT_AUX * X509_CERT_AUX_new(void) { return (X509_CERT_AUX *)ASN1_item_new(&X509_CERT_AUX_it); } -LCRYPTO_ALIAS(X509_CERT_AUX_new); void X509_CERT_AUX_free(X509_CERT_AUX *a) { ASN1_item_free((ASN1_VALUE *)a, &X509_CERT_AUX_it); } -LCRYPTO_ALIAS(X509_CERT_AUX_free); static X509_CERT_AUX * aux_get(X509 *x) @@ -176,7 +172,6 @@ X509_alias_set1(X509 *x, const unsigned char *name, int len) return 0; return ASN1_STRING_set(aux->alias, name, len); } -LCRYPTO_ALIAS(X509_alias_set1); int X509_keyid_set1(X509 *x, const unsigned char *id, int len) @@ -195,7 +190,6 @@ X509_keyid_set1(X509 *x, const unsigned char *id, int len) return 0; return ASN1_STRING_set(aux->keyid, id, len); } -LCRYPTO_ALIAS(X509_keyid_set1); unsigned char * X509_alias_get0(X509 *x, int *len) @@ -206,7 +200,6 @@ X509_alias_get0(X509 *x, int *len) *len = x->aux->alias->length; return x->aux->alias->data; } -LCRYPTO_ALIAS(X509_alias_get0); unsigned char * X509_keyid_get0(X509 *x, int *len) @@ -217,7 +210,6 @@ X509_keyid_get0(X509 *x, int *len) *len = x->aux->keyid->length; return x->aux->keyid->data; } -LCRYPTO_ALIAS(X509_keyid_get0); int X509_add1_trust_object(X509 *x, const ASN1_OBJECT *obj) @@ -240,7 +232,6 @@ X509_add1_trust_object(X509 *x, const ASN1_OBJECT *obj) ASN1_OBJECT_free(objtmp); return 0; } -LCRYPTO_ALIAS(X509_add1_trust_object); int X509_add1_reject_object(X509 *x, const ASN1_OBJECT *obj) @@ -263,7 +254,6 @@ X509_add1_reject_object(X509 *x, const ASN1_OBJECT *obj) ASN1_OBJECT_free(objtmp); return 0; } -LCRYPTO_ALIAS(X509_add1_reject_object); void X509_trust_clear(X509 *x) @@ -273,7 +263,6 @@ X509_trust_clear(X509 *x) x->aux->trust = NULL; } } -LCRYPTO_ALIAS(X509_trust_clear); void X509_reject_clear(X509 *x) @@ -283,4 +272,3 @@ X509_reject_clear(X509 *x) x->aux->reject = NULL; } } -LCRYPTO_ALIAS(X509_reject_clear); diff --git a/lib/libcrypto/bio/b_dump.c b/lib/libcrypto/bio/b_dump.c index 70bb9882f..6a87ebd3a 100644 --- a/lib/libcrypto/bio/b_dump.c +++ b/lib/libcrypto/bio/b_dump.c @@ -1,4 +1,4 @@ -/* $OpenBSD: b_dump.c,v 1.24 2023/07/05 21:23:37 beck Exp $ */ +/* $OpenBSD: b_dump.c,v 1.25 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -75,7 +75,6 @@ BIO_dump_cb(int (*cb)(const void *data, size_t len, void *u), { return BIO_dump_indent_cb(cb, u, s, len, 0); } -LCRYPTO_ALIAS(BIO_dump_cb); int BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), @@ -149,7 +148,6 @@ BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), #endif return (ret); } -LCRYPTO_ALIAS(BIO_dump_indent_cb); static int write_fp(const void *data, size_t len, void *fp) diff --git a/lib/libcrypto/bio/bio_lib.c b/lib/libcrypto/bio/bio_lib.c index 31127cb44..3dd5e17ed 100644 --- a/lib/libcrypto/bio/bio_lib.c +++ b/lib/libcrypto/bio/bio_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bio_lib.c,v 1.45 2023/07/05 21:23:37 beck Exp $ */ +/* $OpenBSD: bio_lib.c,v 1.46 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -873,7 +873,6 @@ BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_BIO, argl, argp, new_func, dup_func, free_func); } -LCRYPTO_ALIAS(BIO_get_ex_new_index); int BIO_set_ex_data(BIO *bio, int idx, void *data) diff --git a/lib/libcrypto/bio/bss_bio.c b/lib/libcrypto/bio/bss_bio.c index 887747a6f..b56d50317 100644 --- a/lib/libcrypto/bio/bss_bio.c +++ b/lib/libcrypto/bio/bss_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bss_bio.c,v 1.26 2023/07/05 21:23:37 beck Exp $ */ +/* $OpenBSD: bss_bio.c,v 1.27 2023/07/07 19:37:53 beck Exp $ */ /* ==================================================================== * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. * @@ -796,7 +796,6 @@ BIO_new_bio_pair(BIO **bio1_p, size_t writebuf1, BIO **bio2_p, size_t writebuf2) *bio2_p = bio2; return ret; } -LCRYPTO_ALIAS(BIO_new_bio_pair); size_t BIO_ctrl_get_write_guarantee(BIO *bio) diff --git a/lib/libcrypto/bio/bss_conn.c b/lib/libcrypto/bio/bss_conn.c index 295fb19ff..60bb777fa 100644 --- a/lib/libcrypto/bio/bss_conn.c +++ b/lib/libcrypto/bio/bss_conn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bss_conn.c,v 1.38 2023/07/05 21:23:37 beck Exp $ */ +/* $OpenBSD: bss_conn.c,v 1.39 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -309,7 +309,6 @@ BIO_CONNECT_new(void) memset((char *)&ret->them, 0, sizeof(ret->them)); return (ret); } -LCRYPTO_ALIAS(BIO_CONNECT_new); void BIO_CONNECT_free(BIO_CONNECT *a) @@ -321,7 +320,6 @@ BIO_CONNECT_free(BIO_CONNECT *a) free(a->param_port); free(a); } -LCRYPTO_ALIAS(BIO_CONNECT_free); const BIO_METHOD * BIO_s_connect(void) diff --git a/lib/libcrypto/bn/arch/riscv64/bn_arch.h b/lib/libcrypto/bn/arch/riscv64/bn_arch.h index 354774cde..e67de835c 100644 --- a/lib/libcrypto/bn/arch/riscv64/bn_arch.h +++ b/lib/libcrypto/bn/arch/riscv64/bn_arch.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_arch.h,v 1.4 2023/02/16 10:41:03 jsing Exp $ */ +/* $OpenBSD: bn_arch.h,v 1.7 2023/07/09 10:37:32 jsing Exp $ */ /* * Copyright (c) 2023 Joel Sing * @@ -15,15 +15,34 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include + #ifndef HEADER_BN_ARCH_H #define HEADER_BN_ARCH_H #ifndef OPENSSL_NO_ASM -#if 0 /* Needs testing and enabling. */ #if defined(__GNUC__) -#define HAVE_BN_MULW +#define HAVE_BN_ADDW + +static inline void +bn_addw(BN_ULONG a, BN_ULONG b, BN_ULONG *out_r1, BN_ULONG *out_r0) +{ + BN_ULONG carry, r0; + + __asm__ ( + "add %[r0], %[a], %[b] \n" + "sltu %[carry], %[r0], %[a] \n" + : [carry]"=r"(carry), [r0]"=&r"(r0) + : [a]"r"(a), [b]"r"(b)); + + *out_r1 = carry; + *out_r0 = r0; +} + +#define HAVE_BN_MULW + static inline void bn_mulw(BN_ULONG a, BN_ULONG b, BN_ULONG *out_r1, BN_ULONG *out_r0) { @@ -34,15 +53,34 @@ bn_mulw(BN_ULONG a, BN_ULONG b, BN_ULONG *out_r1, BN_ULONG *out_r0) * of these instructions is important, as they can potentially be fused * into a single operation. */ - __asm__ ("mulh %0, %2, %3; mul %1, %2, %3" - : "=&r"(r1), "=r"(r0) - : "r"(a), "r"(b)); + __asm__ ( + "mulhu %[r1], %[a], %[b] \n" + "mul %[r0], %[a], %[b] \n" + : [r1]"=&r"(r1), [r0]"=r"(r0) + : [a]"r"(a), [b]"r"(b)); *out_r1 = r1; *out_r0 = r0; } + +#define HAVE_BN_SUBW + +static inline void +bn_subw(BN_ULONG a, BN_ULONG b, BN_ULONG *out_borrow, BN_ULONG *out_r0) +{ + BN_ULONG borrow, r0; + + __asm__ ( + "sub %[r0], %[a], %[b] \n" + "sltu %[borrow], %[a], %[r0] \n" + : [borrow]"=r"(borrow), [r0]"=&r"(r0) + : [a]"r"(a), [b]"r"(b)); + + *out_borrow = borrow; + *out_r0 = r0; +} + #endif /* __GNUC__ */ -#endif #endif #endif diff --git a/lib/libcrypto/bn/bn_add.c b/lib/libcrypto/bn/bn_add.c index 36f160ab5..86768a312 100644 --- a/lib/libcrypto/bn/bn_add.c +++ b/lib/libcrypto/bn/bn_add.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_add.c,v 1.25 2023/06/12 16:17:24 jsing Exp $ */ +/* $OpenBSD: bn_add.c,v 1.26 2023/07/08 12:21:58 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -248,6 +248,7 @@ BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) return 1; } +LCRYPTO_ALIAS(BN_uadd); int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) @@ -277,6 +278,7 @@ BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) return 1; } +LCRYPTO_ALIAS(BN_usub); int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) @@ -306,6 +308,7 @@ BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) return ret; } +LCRYPTO_ALIAS(BN_add); int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) @@ -335,3 +338,4 @@ BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) return ret; } +LCRYPTO_ALIAS(BN_sub); diff --git a/lib/libcrypto/bn/bn_blind.c b/lib/libcrypto/bn/bn_blind.c index 77ba691b6..07cd359e7 100644 --- a/lib/libcrypto/bn/bn_blind.c +++ b/lib/libcrypto/bn/bn_blind.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_blind.c,v 1.22 2023/04/25 19:57:59 tb Exp $ */ +/* $OpenBSD: bn_blind.c,v 1.23 2023/07/08 12:21:58 beck Exp $ */ /* ==================================================================== * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. * @@ -169,6 +169,7 @@ err: BN_BLINDING_free(ret); return (NULL); } +LCRYPTO_ALIAS(BN_BLINDING_new); void BN_BLINDING_free(BN_BLINDING *r) @@ -182,6 +183,7 @@ BN_BLINDING_free(BN_BLINDING *r) BN_free(r->mod); free(r); } +LCRYPTO_ALIAS(BN_BLINDING_free); int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx) @@ -215,12 +217,14 @@ err: b->counter = 0; return (ret); } +LCRYPTO_ALIAS(BN_BLINDING_update); int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx) { return BN_BLINDING_convert_ex(n, NULL, b, ctx); } +LCRYPTO_ALIAS(BN_BLINDING_convert); int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx) @@ -249,12 +253,14 @@ BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx) return ret; } +LCRYPTO_ALIAS(BN_BLINDING_convert_ex); int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx) { return BN_BLINDING_invert_ex(n, NULL, b, ctx); } +LCRYPTO_ALIAS(BN_BLINDING_invert); int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx) @@ -274,24 +280,28 @@ BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx) return (ret); } +LCRYPTO_ALIAS(BN_BLINDING_invert_ex); CRYPTO_THREADID * BN_BLINDING_thread_id(BN_BLINDING *b) { return &b->tid; } +LCRYPTO_ALIAS(BN_BLINDING_thread_id); unsigned long BN_BLINDING_get_flags(const BN_BLINDING *b) { return b->flags; } +LCRYPTO_ALIAS(BN_BLINDING_get_flags); void BN_BLINDING_set_flags(BN_BLINDING *b, unsigned long flags) { b->flags = flags; } +LCRYPTO_ALIAS(BN_BLINDING_set_flags); BN_BLINDING * BN_BLINDING_create_param(BN_BLINDING *b, const BIGNUM *e, BIGNUM *m, @@ -363,3 +373,4 @@ err: return ret; } +LCRYPTO_ALIAS(BN_BLINDING_create_param); diff --git a/lib/libcrypto/bn/bn_const.c b/lib/libcrypto/bn/bn_const.c index 0ceff9160..e0009b0be 100644 --- a/lib/libcrypto/bn/bn_const.c +++ b/lib/libcrypto/bn/bn_const.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_const.c,v 1.5 2018/02/20 17:02:30 jsing Exp $ */ +/* $OpenBSD: bn_const.c,v 1.6 2023/07/08 12:21:58 beck Exp $ */ /* Insert boilerplate */ #include @@ -26,12 +26,14 @@ get_rfc2409_prime_768(BIGNUM *bn) }; return BN_bin2bn(RFC2409_PRIME_768, sizeof(RFC2409_PRIME_768), bn); } +LCRYPTO_ALIAS(get_rfc2409_prime_768); BIGNUM * BN_get_rfc2409_prime_768(BIGNUM *bn) { return get_rfc2409_prime_768(bn); } +LCRYPTO_ALIAS(BN_get_rfc2409_prime_768); /* "Second Oakley Default Group" from RFC2409, section 6.2. * @@ -59,12 +61,14 @@ get_rfc2409_prime_1024(BIGNUM *bn) }; return BN_bin2bn(RFC2409_PRIME_1024, sizeof(RFC2409_PRIME_1024), bn); } +LCRYPTO_ALIAS(get_rfc2409_prime_1024); BIGNUM * BN_get_rfc2409_prime_1024(BIGNUM *bn) { return get_rfc2409_prime_1024(bn); } +LCRYPTO_ALIAS(BN_get_rfc2409_prime_1024); /* "1536-bit MODP Group" from RFC3526, Section 2. * @@ -97,12 +101,14 @@ get_rfc3526_prime_1536(BIGNUM *bn) }; return BN_bin2bn(RFC3526_PRIME_1536, sizeof(RFC3526_PRIME_1536), bn); } +LCRYPTO_ALIAS(get_rfc3526_prime_1536); BIGNUM * BN_get_rfc3526_prime_1536(BIGNUM *bn) { return get_rfc3526_prime_1536(bn); } +LCRYPTO_ALIAS(BN_get_rfc3526_prime_1536); /* "2048-bit MODP Group" from RFC3526, Section 3. * @@ -140,12 +146,14 @@ get_rfc3526_prime_2048(BIGNUM *bn) }; return BN_bin2bn(RFC3526_PRIME_2048, sizeof(RFC3526_PRIME_2048), bn); } +LCRYPTO_ALIAS(get_rfc3526_prime_2048); BIGNUM * BN_get_rfc3526_prime_2048(BIGNUM *bn) { return get_rfc3526_prime_2048(bn); } +LCRYPTO_ALIAS(BN_get_rfc3526_prime_2048); /* "3072-bit MODP Group" from RFC3526, Section 4. * @@ -193,12 +201,14 @@ get_rfc3526_prime_3072(BIGNUM *bn) }; return BN_bin2bn(RFC3526_PRIME_3072, sizeof(RFC3526_PRIME_3072), bn); } +LCRYPTO_ALIAS(get_rfc3526_prime_3072); BIGNUM * BN_get_rfc3526_prime_3072(BIGNUM *bn) { return get_rfc3526_prime_3072(bn); } +LCRYPTO_ALIAS(BN_get_rfc3526_prime_3072); /* "4096-bit MODP Group" from RFC3526, Section 5. * @@ -257,12 +267,14 @@ get_rfc3526_prime_4096(BIGNUM *bn) }; return BN_bin2bn(RFC3526_PRIME_4096, sizeof(RFC3526_PRIME_4096), bn); } +LCRYPTO_ALIAS(get_rfc3526_prime_4096); BIGNUM * BN_get_rfc3526_prime_4096(BIGNUM *bn) { return get_rfc3526_prime_4096(bn); } +LCRYPTO_ALIAS(BN_get_rfc3526_prime_4096); /* "6144-bit MODP Group" from RFC3526, Section 6. * @@ -342,12 +354,14 @@ get_rfc3526_prime_6144(BIGNUM *bn) }; return BN_bin2bn(RFC3526_PRIME_6144, sizeof(RFC3526_PRIME_6144), bn); } +LCRYPTO_ALIAS(get_rfc3526_prime_6144); BIGNUM * BN_get_rfc3526_prime_6144(BIGNUM *bn) { return get_rfc3526_prime_6144(bn); } +LCRYPTO_ALIAS(BN_get_rfc3526_prime_6144); /* "8192-bit MODP Group" from RFC3526, Section 7. * @@ -449,9 +463,11 @@ get_rfc3526_prime_8192(BIGNUM *bn) }; return BN_bin2bn(RFC3526_PRIME_8192, sizeof(RFC3526_PRIME_8192), bn); } +LCRYPTO_ALIAS(get_rfc3526_prime_8192); BIGNUM * BN_get_rfc3526_prime_8192(BIGNUM *bn) { return get_rfc3526_prime_8192(bn); } +LCRYPTO_ALIAS(BN_get_rfc3526_prime_8192); diff --git a/lib/libcrypto/bn/bn_convert.c b/lib/libcrypto/bn/bn_convert.c index 4736099cd..cb0a23e01 100644 --- a/lib/libcrypto/bn/bn_convert.c +++ b/lib/libcrypto/bn/bn_convert.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_convert.c,v 1.12 2023/06/23 10:48:40 tb Exp $ */ +/* $OpenBSD: bn_convert.c,v 1.13 2023/07/08 12:21:58 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -142,6 +142,7 @@ BN_bn2bin(const BIGNUM *a, unsigned char *to) { return bn2binpad(a, to, -1, big); } +LCRYPTO_ALIAS(BN_bn2bin); int BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen) @@ -150,6 +151,7 @@ BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen) return -1; return bn2binpad(a, to, tolen, big); } +LCRYPTO_ALIAS(BN_bn2binpad); BIGNUM * BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) @@ -192,6 +194,7 @@ BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) bn_correct_top(ret); return (ret); } +LCRYPTO_ALIAS(BN_bin2bn); int BN_bn2lebinpad(const BIGNUM *a, unsigned char *to, int tolen) @@ -201,6 +204,7 @@ BN_bn2lebinpad(const BIGNUM *a, unsigned char *to, int tolen) return bn2binpad(a, to, tolen, little); } +LCRYPTO_ALIAS(BN_bn2lebinpad); BIGNUM * BN_lebin2bn(const unsigned char *s, int len, BIGNUM *ret) @@ -254,6 +258,7 @@ BN_lebin2bn(const unsigned char *s, int len, BIGNUM *ret) return ret; } +LCRYPTO_ALIAS(BN_lebin2bn); int BN_asc2bn(BIGNUM **bnp, const char *s) @@ -306,6 +311,7 @@ BN_asc2bn(BIGNUM **bnp, const char *s) return 1; } +LCRYPTO_ALIAS(BN_asc2bn); char * BN_bn2dec(const BIGNUM *bn) @@ -384,6 +390,7 @@ BN_bn2dec(const BIGNUM *bn) return s; } +LCRYPTO_ALIAS(BN_bn2dec); static int bn_dec2bn_cbs(BIGNUM **bnp, CBS *cbs) @@ -488,6 +495,7 @@ BN_dec2bn(BIGNUM **bnp, const char *s) return bn_dec2bn_cbs(bnp, &cbs); } +LCRYPTO_ALIAS(BN_dec2bn); char * BN_bn2hex(const BIGNUM *bn) @@ -533,6 +541,7 @@ BN_bn2hex(const BIGNUM *bn) return s; } +LCRYPTO_ALIAS(BN_bn2hex); static int bn_hex2bn_cbs(BIGNUM **bnp, CBS *cbs) @@ -641,6 +650,7 @@ BN_hex2bn(BIGNUM **bnp, const char *s) return bn_hex2bn_cbs(bnp, &cbs); } +LCRYPTO_ALIAS(BN_hex2bn); int BN_bn2mpi(const BIGNUM *a, unsigned char *d) @@ -670,6 +680,7 @@ BN_bn2mpi(const BIGNUM *a, unsigned char *d) d[4] |= 0x80; return (num + 4 + ext); } +LCRYPTO_ALIAS(BN_bn2mpi); BIGNUM * BN_mpi2bn(const unsigned char *d, int n, BIGNUM *ain) @@ -713,6 +724,7 @@ BN_mpi2bn(const unsigned char *d, int n, BIGNUM *ain) } return (a); } +LCRYPTO_ALIAS(BN_mpi2bn); #ifndef OPENSSL_NO_BIO int @@ -728,6 +740,7 @@ BN_print_fp(FILE *fp, const BIGNUM *a) BIO_free(b); return (ret); } +LCRYPTO_ALIAS(BN_print_fp); int BN_print(BIO *bp, const BIGNUM *a) @@ -755,4 +768,5 @@ BN_print(BIO *bp, const BIGNUM *a) end: return (ret); } +LCRYPTO_ALIAS(BN_print); #endif diff --git a/lib/libcrypto/bn/bn_ctx.c b/lib/libcrypto/bn/bn_ctx.c index 357eda178..129b9c978 100644 --- a/lib/libcrypto/bn/bn_ctx.c +++ b/lib/libcrypto/bn/bn_ctx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_ctx.c,v 1.21 2023/04/25 16:41:29 tb Exp $ */ +/* $OpenBSD: bn_ctx.c,v 1.22 2023/07/08 12:21:58 beck Exp $ */ /* * Copyright (c) 2023 Joel Sing * @@ -70,6 +70,7 @@ BN_CTX_new(void) { return calloc(1, sizeof(struct bignum_ctx)); } +LCRYPTO_ALIAS(BN_CTX_new); void BN_CTX_free(BN_CTX *bctx) @@ -89,6 +90,7 @@ BN_CTX_free(BN_CTX *bctx) freezero(bctx, sizeof(*bctx)); } +LCRYPTO_ALIAS(BN_CTX_free); void BN_CTX_start(BN_CTX *bctx) @@ -101,6 +103,7 @@ BN_CTX_start(BN_CTX *bctx) return; } } +LCRYPTO_ALIAS(BN_CTX_start); BIGNUM * BN_CTX_get(BN_CTX *bctx) @@ -139,6 +142,7 @@ BN_CTX_get(BN_CTX *bctx) return bn; } +LCRYPTO_ALIAS(BN_CTX_get); void BN_CTX_end(BN_CTX *bctx) @@ -154,3 +158,4 @@ BN_CTX_end(BN_CTX *bctx) bctx->group--; } +LCRYPTO_ALIAS(BN_CTX_end); diff --git a/lib/libcrypto/bn/bn_err.c b/lib/libcrypto/bn/bn_err.c index b861ea937..6fd6030a0 100644 --- a/lib/libcrypto/bn/bn_err.c +++ b/lib/libcrypto/bn/bn_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_err.c,v 1.16 2023/06/13 09:12:22 tb Exp $ */ +/* $OpenBSD: bn_err.c,v 1.17 2023/07/08 12:21:58 beck Exp $ */ /* ==================================================================== * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. * @@ -105,3 +105,4 @@ ERR_load_BN_strings(void) } #endif } +LCRYPTO_ALIAS(ERR_load_BN_strings); diff --git a/lib/libcrypto/bn/bn_exp.c b/lib/libcrypto/bn/bn_exp.c index 9e5d1fd26..a50fa5953 100644 --- a/lib/libcrypto/bn/bn_exp.c +++ b/lib/libcrypto/bn/bn_exp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_exp.c,v 1.46 2023/05/09 05:38:11 tb Exp $ */ +/* $OpenBSD: bn_exp.c,v 1.47 2023/07/08 12:21:58 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -173,6 +173,7 @@ BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) return ret; } +LCRYPTO_ALIAS(BN_exp); /* The old fallback, simple version :-) */ int @@ -291,6 +292,7 @@ err: BN_CTX_end(ctx); return (ret); } +LCRYPTO_ALIAS(BN_mod_exp_simple); /* BN_mod_exp_mont_consttime() stores the precomputed powers in a specific layout * so that accessing any of these table values shows the same access pattern as far @@ -632,6 +634,7 @@ err: BN_CTX_end(ctx); return (ret); } +LCRYPTO_ALIAS(BN_mod_exp_mont_consttime); static int BN_mod_exp_mont_internal(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, @@ -947,6 +950,7 @@ err: BN_CTX_end(ctx); return (ret); } +LCRYPTO_ALIAS(BN_mod_exp_mont_word); int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, @@ -1331,3 +1335,4 @@ err: BN_CTX_end(ctx); return (ret); } +LCRYPTO_ALIAS(BN_mod_exp2_mont); diff --git a/lib/libcrypto/bn/bn_kron.c b/lib/libcrypto/bn/bn_kron.c index f48823aca..a170d688e 100644 --- a/lib/libcrypto/bn/bn_kron.c +++ b/lib/libcrypto/bn/bn_kron.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_kron.c,v 1.14 2023/03/27 10:21:23 tb Exp $ */ +/* $OpenBSD: bn_kron.c,v 1.15 2023/07/08 12:21:58 beck Exp $ */ /* ==================================================================== * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. * @@ -192,3 +192,4 @@ BN_kronecker(const BIGNUM *A, const BIGNUM *B, BN_CTX *ctx) return ret; } +LCRYPTO_ALIAS(BN_kronecker); diff --git a/lib/libcrypto/bn/bn_lib.c b/lib/libcrypto/bn/bn_lib.c index bac0290ef..74359dab3 100644 --- a/lib/libcrypto/bn/bn_lib.c +++ b/lib/libcrypto/bn/bn_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_lib.c,v 1.88 2023/06/21 07:48:41 jsing Exp $ */ +/* $OpenBSD: bn_lib.c,v 1.89 2023/07/08 12:21:58 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -81,6 +81,7 @@ BN_new(void) return bn; } +LCRYPTO_ALIAS(BN_new); void BN_init(BIGNUM *a) @@ -96,6 +97,7 @@ BN_clear(BIGNUM *a) a->top = 0; a->neg = 0; } +LCRYPTO_ALIAS(BN_clear); void BN_free(BIGNUM *bn) @@ -113,24 +115,28 @@ BN_free(BIGNUM *bn) freezero(bn, sizeof(*bn)); } +LCRYPTO_ALIAS(BN_free); void BN_clear_free(BIGNUM *bn) { BN_free(bn); } +LCRYPTO_ALIAS(BN_clear_free); void BN_set_flags(BIGNUM *b, int n) { b->flags |= n; } +LCRYPTO_ALIAS(BN_set_flags); int BN_get_flags(const BIGNUM *b, int n) { return b->flags & n; } +LCRYPTO_ALIAS(BN_get_flags); void BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags) @@ -143,6 +149,7 @@ BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags) *dest = *b; dest->flags = dest_flags; } +LCRYPTO_ALIAS(BN_with_flags); static const BN_ULONG bn_value_one_data = 1; static const BIGNUM bn_value_one = { @@ -158,18 +165,21 @@ BN_value_one(void) { return &bn_value_one; } +LCRYPTO_ALIAS(BN_value_one); int BN_num_bits_word(BN_ULONG w) { return BN_BITS2 - bn_clzw(w); } +LCRYPTO_ALIAS(BN_num_bits_word); int BN_num_bits(const BIGNUM *bn) { return bn_bitsize(bn); } +LCRYPTO_ALIAS(BN_num_bits); void bn_correct_top(BIGNUM *a) @@ -253,6 +263,7 @@ BN_dup(const BIGNUM *a) } return t; } +LCRYPTO_ALIAS(BN_dup); static inline void bn_copy_words(BN_ULONG *ap, const BN_ULONG *bp, int n) @@ -284,6 +295,7 @@ BN_copy(BIGNUM *a, const BIGNUM *b) return (a); } +LCRYPTO_ALIAS(BN_copy); int bn_copy(BIGNUM *dst, const BIGNUM *src) @@ -322,6 +334,7 @@ BN_swap(BIGNUM *a, BIGNUM *b) b->flags = (flags_old_b & BN_FLG_MALLOCED) | (flags_old_a & BN_FLG_STATIC_DATA); } +LCRYPTO_ALIAS(BN_swap); BN_ULONG BN_get_word(const BIGNUM *a) @@ -333,6 +346,7 @@ BN_get_word(const BIGNUM *a) /* a->top == 0 */ return 0; } +LCRYPTO_ALIAS(BN_get_word); int BN_set_word(BIGNUM *a, BN_ULONG w) @@ -344,6 +358,7 @@ BN_set_word(BIGNUM *a, BN_ULONG w) a->top = (w ? 1 : 0); return (1); } +LCRYPTO_ALIAS(BN_set_word); int BN_ucmp(const BIGNUM *a, const BIGNUM *b) @@ -362,6 +377,7 @@ BN_ucmp(const BIGNUM *a, const BIGNUM *b) return 0; } +LCRYPTO_ALIAS(BN_ucmp); int BN_cmp(const BIGNUM *a, const BIGNUM *b) @@ -382,6 +398,7 @@ BN_cmp(const BIGNUM *a, const BIGNUM *b) return BN_ucmp(a, b); } +LCRYPTO_ALIAS(BN_cmp); int BN_set_bit(BIGNUM *a, int n) @@ -404,6 +421,7 @@ BN_set_bit(BIGNUM *a, int n) a->d[i] |= (((BN_ULONG)1) << j); return (1); } +LCRYPTO_ALIAS(BN_set_bit); int BN_clear_bit(BIGNUM *a, int n) @@ -422,6 +440,7 @@ BN_clear_bit(BIGNUM *a, int n) bn_correct_top(a); return (1); } +LCRYPTO_ALIAS(BN_clear_bit); int BN_is_bit_set(const BIGNUM *a, int n) @@ -436,6 +455,7 @@ BN_is_bit_set(const BIGNUM *a, int n) return 0; return (int)(((a->d[i]) >> j) & ((BN_ULONG)1)); } +LCRYPTO_ALIAS(BN_is_bit_set); int BN_mask_bits(BIGNUM *a, int n) @@ -458,12 +478,14 @@ BN_mask_bits(BIGNUM *a, int n) bn_correct_top(a); return (1); } +LCRYPTO_ALIAS(BN_mask_bits); void BN_set_negative(BIGNUM *bn, int neg) { bn->neg = ~BN_is_zero(bn) & bn_ct_ne_zero(neg); } +LCRYPTO_ALIAS(BN_set_negative); /* * Constant-time conditional swap of a and b. @@ -517,6 +539,7 @@ BN_consttime_swap(BN_ULONG condition, BIGNUM *a, BIGNUM *b, int nwords) } #undef BN_CONSTTIME_SWAP } +LCRYPTO_ALIAS(BN_consttime_swap); /* * Constant-time conditional swap of a and b. @@ -575,18 +598,21 @@ BN_zero(BIGNUM *a) a->neg = 0; a->top = 0; } +LCRYPTO_ALIAS(BN_zero); int BN_one(BIGNUM *a) { return BN_set_word(a, 1); } +LCRYPTO_ALIAS(BN_one); int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w) { return (a->top == 1 && a->d[0] == w) || (w == 0 && a->top == 0); } +LCRYPTO_ALIAS(BN_abs_is_word); int BN_is_zero(const BIGNUM *bn) @@ -599,30 +625,35 @@ BN_is_zero(const BIGNUM *bn) return bits == 0; } +LCRYPTO_ALIAS(BN_is_zero); int BN_is_one(const BIGNUM *a) { return BN_abs_is_word(a, 1) && !a->neg; } +LCRYPTO_ALIAS(BN_is_one); int BN_is_word(const BIGNUM *a, const BN_ULONG w) { return BN_abs_is_word(a, w) && (w == 0 || !a->neg); } +LCRYPTO_ALIAS(BN_is_word); int BN_is_odd(const BIGNUM *a) { return a->top > 0 && (a->d[0] & 1); } +LCRYPTO_ALIAS(BN_is_odd); int BN_is_negative(const BIGNUM *a) { return a->neg != 0; } +LCRYPTO_ALIAS(BN_is_negative); char * BN_options(void) @@ -642,6 +673,7 @@ BN_options(void) } return (data); } +LCRYPTO_ALIAS(BN_options); /* * Bits of security, see SP800-57, section 5.6.11, table 2. @@ -673,6 +705,7 @@ BN_security_bits(int L, int N) return bits >= secbits ? secbits : bits; } +LCRYPTO_ALIAS(BN_security_bits); BN_GENCB * BN_GENCB_new(void) @@ -684,6 +717,7 @@ BN_GENCB_new(void) return cb; } +LCRYPTO_ALIAS(BN_GENCB_new); void BN_GENCB_free(BN_GENCB *cb) @@ -692,6 +726,7 @@ BN_GENCB_free(BN_GENCB *cb) return; free(cb); } +LCRYPTO_ALIAS(BN_GENCB_free); /* Populate a BN_GENCB structure with an "old"-style callback */ void @@ -701,6 +736,7 @@ BN_GENCB_set_old(BN_GENCB *gencb, void (*cb)(int, int, void *), void *cb_arg) gencb->cb.cb_1 = cb; gencb->arg = cb_arg; } +LCRYPTO_ALIAS(BN_GENCB_set_old); /* Populate a BN_GENCB structure with a "new"-style callback */ void @@ -710,9 +746,11 @@ BN_GENCB_set(BN_GENCB *gencb, int (*cb)(int, int, BN_GENCB *), void *cb_arg) gencb->cb.cb_2 = cb; gencb->arg = cb_arg; } +LCRYPTO_ALIAS(BN_GENCB_set); void * BN_GENCB_get_arg(BN_GENCB *cb) { return cb->arg; } +LCRYPTO_ALIAS(BN_GENCB_get_arg); diff --git a/lib/libcrypto/bn/bn_mod.c b/lib/libcrypto/bn/bn_mod.c index 79766d003..365f6fcf0 100644 --- a/lib/libcrypto/bn/bn_mod.c +++ b/lib/libcrypto/bn/bn_mod.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_mod.c,v 1.21 2023/06/13 09:28:13 tb Exp $ */ +/* $OpenBSD: bn_mod.c,v 1.22 2023/07/08 12:21:58 beck Exp $ */ /* Includes code written by Lenka Fibikova * for the OpenSSL project. */ /* ==================================================================== @@ -146,6 +146,7 @@ BN_nnmod(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx) return BN_usub(r, m, r); return 1; } +LCRYPTO_ALIAS(BN_nnmod); int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, @@ -159,6 +160,7 @@ BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, return 0; return BN_nnmod(r, r, m, ctx); } +LCRYPTO_ALIAS(BN_mod_add); /* * BN_mod_add() variant that may only be used if both a and b are non-negative @@ -177,6 +179,7 @@ BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m) return BN_usub(r, r, m); return 1; } +LCRYPTO_ALIAS(BN_mod_add_quick); int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, @@ -190,6 +193,7 @@ BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, return 0; return BN_nnmod(r, r, m, ctx); } +LCRYPTO_ALIAS(BN_mod_sub); /* * BN_mod_sub() variant that may only be used if both a and b are non-negative @@ -208,6 +212,7 @@ BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m) return 0; return BN_usub(r, m, r); } +LCRYPTO_ALIAS(BN_mod_sub_quick); int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, @@ -246,12 +251,14 @@ BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, return ret; } +LCRYPTO_ALIAS(BN_mod_mul); int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx) { return BN_mod_mul(r, a, a, m, ctx); } +LCRYPTO_ALIAS(BN_mod_sqr); int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx) @@ -264,6 +271,7 @@ BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx) return 0; return BN_nnmod(r, r, m, ctx); } +LCRYPTO_ALIAS(BN_mod_lshift1); /* * BN_mod_lshift1() variant that may be used if a is non-negative @@ -282,6 +290,7 @@ BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m) return BN_usub(r, r, m); return 1; } +LCRYPTO_ALIAS(BN_mod_lshift1_quick); int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, BN_CTX *ctx) @@ -316,6 +325,7 @@ BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, BN_CTX *ctx) return ret; } +LCRYPTO_ALIAS(BN_mod_lshift); /* * BN_mod_lshift() variant that may be used if a is non-negative @@ -356,3 +366,4 @@ BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m) return 1; } +LCRYPTO_ALIAS(BN_mod_lshift_quick); diff --git a/lib/libcrypto/bn/bn_mod_sqrt.c b/lib/libcrypto/bn/bn_mod_sqrt.c index acca540e2..bdd5b2cdb 100644 --- a/lib/libcrypto/bn/bn_mod_sqrt.c +++ b/lib/libcrypto/bn/bn_mod_sqrt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_mod_sqrt.c,v 1.1 2023/04/11 10:08:44 tb Exp $ */ +/* $OpenBSD: bn_mod_sqrt.c,v 1.2 2023/07/08 12:21:58 beck Exp $ */ /* * Copyright (c) 2022 Theo Buehler @@ -724,3 +724,4 @@ BN_mod_sqrt(BIGNUM *in, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) return NULL; } +LCRYPTO_ALIAS(BN_mod_sqrt); diff --git a/lib/libcrypto/bn/bn_mont.c b/lib/libcrypto/bn/bn_mont.c index b44246e07..12fea44c5 100644 --- a/lib/libcrypto/bn/bn_mont.c +++ b/lib/libcrypto/bn/bn_mont.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_mont.c,v 1.60 2023/06/17 14:43:50 jsing Exp $ */ +/* $OpenBSD: bn_mont.c,v 1.61 2023/07/08 12:21:58 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -137,6 +137,7 @@ BN_MONT_CTX_new(void) return mctx; } +LCRYPTO_ALIAS(BN_MONT_CTX_new); void BN_MONT_CTX_free(BN_MONT_CTX *mctx) @@ -150,6 +151,7 @@ BN_MONT_CTX_free(BN_MONT_CTX *mctx) if (mctx->flags & BN_FLG_MALLOCED) free(mctx); } +LCRYPTO_ALIAS(BN_MONT_CTX_free); BN_MONT_CTX * BN_MONT_CTX_copy(BN_MONT_CTX *dst, BN_MONT_CTX *src) @@ -168,6 +170,7 @@ BN_MONT_CTX_copy(BN_MONT_CTX *dst, BN_MONT_CTX *src) return dst; } +LCRYPTO_ALIAS(BN_MONT_CTX_copy); int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) @@ -257,6 +260,7 @@ BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) return ret; } +LCRYPTO_ALIAS(BN_MONT_CTX_set); BN_MONT_CTX * BN_MONT_CTX_set_locked(BN_MONT_CTX **pmctx, int lock, const BIGNUM *mod, @@ -293,6 +297,7 @@ BN_MONT_CTX_set_locked(BN_MONT_CTX **pmctx, int lock, const BIGNUM *mod, done: return mctx; } +LCRYPTO_ALIAS(BN_MONT_CTX_set_locked); static int bn_montgomery_reduce(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mctx); @@ -497,6 +502,7 @@ BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, /* Compute r = aR * bR * R^-1 mod N = abR mod N */ return bn_mod_mul_montgomery(r, a, b, mctx, ctx); } +LCRYPTO_ALIAS(BN_mod_mul_montgomery); int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mctx, BN_CTX *ctx) @@ -504,6 +510,7 @@ BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mctx, BN_CTX *ctx) /* Compute r = a * R * R * R^-1 mod N = aR mod N */ return bn_mod_mul_montgomery(r, a, &mctx->RR, mctx, ctx); } +LCRYPTO_ALIAS(BN_to_montgomery); /* * bn_montgomery_reduce() performs Montgomery reduction, reducing the input @@ -597,3 +604,4 @@ BN_from_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mctx, BN_CTX *ctx) return ret; } +LCRYPTO_ALIAS(BN_from_montgomery); diff --git a/lib/libcrypto/bn/bn_mul.c b/lib/libcrypto/bn/bn_mul.c index 65088cc5c..bdeb9b0fe 100644 --- a/lib/libcrypto/bn/bn_mul.c +++ b/lib/libcrypto/bn/bn_mul.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_mul.c,v 1.38 2023/06/12 16:17:24 jsing Exp $ */ +/* $OpenBSD: bn_mul.c,v 1.39 2023/07/08 12:21:58 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -367,3 +367,4 @@ BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) return ret; } +LCRYPTO_ALIAS(BN_mul); diff --git a/lib/libcrypto/bn/bn_prime.c b/lib/libcrypto/bn/bn_prime.c index b8f0eb69c..a09bac4ae 100644 --- a/lib/libcrypto/bn/bn_prime.c +++ b/lib/libcrypto/bn/bn_prime.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_prime.c,v 1.32 2023/05/10 12:21:55 tb Exp $ */ +/* $OpenBSD: bn_prime.c,v 1.33 2023/07/08 12:21:58 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -150,6 +150,7 @@ BN_GENCB_call(BN_GENCB *cb, int a, int b) /* Unrecognised callback type */ return 0; } +LCRYPTO_ALIAS(BN_GENCB_call); int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add, @@ -230,12 +231,14 @@ BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add, return found; } +LCRYPTO_ALIAS(BN_generate_prime_ex); int BN_is_prime_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, BN_GENCB *cb) { return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb); } +LCRYPTO_ALIAS(BN_is_prime_ex); int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, @@ -255,6 +258,7 @@ BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, return is_prime; } +LCRYPTO_ALIAS(BN_is_prime_fasttest_ex); static int probable_prime(BIGNUM *rnd, int bits) diff --git a/lib/libcrypto/bn/bn_print.c b/lib/libcrypto/bn/bn_print.c index 466aeb3d6..84b820396 100644 --- a/lib/libcrypto/bn/bn_print.c +++ b/lib/libcrypto/bn/bn_print.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_print.c,v 1.40 2023/07/06 14:37:39 tb Exp $ */ +/* $OpenBSD: bn_print.c,v 1.42 2023/07/07 07:04:24 tb Exp $ */ /* * Copyright (c) 2023 Theo Buehler @@ -41,7 +41,7 @@ bn_print_zero(BIO *bio, const BIGNUM *bn) static int bn_print_word(BIO *bio, const BIGNUM *bn) { - BN_ULONG word; + unsigned long long word; const char *neg = ""; if (BN_is_zero(bn) || BN_num_bytes(bn) > BN_BYTES) @@ -51,7 +51,7 @@ bn_print_word(BIO *bio, const BIGNUM *bn) neg = "-"; word = BN_get_word(bn); - if (BIO_printf(bio, " %s%lu (%s0x%lx)\n", neg, word, neg, word) <= 0) + if (BIO_printf(bio, " %s%llu (%s0x%llx)\n", neg, word, neg, word) <= 0) return 0; return 1; @@ -102,6 +102,12 @@ bn_print_bignum(BIO *bio, const BIGNUM *bn, int indent) if (BIO_printf(bio, "\n%*s", indent, "") <= 0) goto err; } + /* First nibble has the high bit set. Insert leading 0 octet. */ + if (octets == 1 && hi >= '8') { + if (BIO_printf(bio, "00:") <= 0) + goto err; + octets++; + } if (CBS_len(&cbs) == 0) sep = ""; if (BIO_printf(bio, "%c%c%s", tolower(hi), tolower(lo), sep) <= 0) diff --git a/lib/libcrypto/bn/bn_rand.c b/lib/libcrypto/bn/bn_rand.c index a03d70053..f68913473 100644 --- a/lib/libcrypto/bn/bn_rand.c +++ b/lib/libcrypto/bn/bn_rand.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_rand.c,v 1.27 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: bn_rand.c,v 1.28 2023/07/08 12:21:58 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -198,12 +198,14 @@ BN_rand(BIGNUM *rnd, int bits, int top, int bottom) { return bnrand(0, rnd, bits, top, bottom); } +LCRYPTO_ALIAS(BN_rand); int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom) { return bnrand(1, rnd, bits, top, bottom); } +LCRYPTO_ALIAS(BN_pseudo_rand); #if 1 int @@ -279,6 +281,7 @@ BN_rand_range(BIGNUM *r, const BIGNUM *range) { return bn_rand_range(0, r, range); } +LCRYPTO_ALIAS(BN_rand_range); int bn_rand_interval(BIGNUM *rnd, const BIGNUM *lower_inc, const BIGNUM *upper_exc) @@ -312,3 +315,4 @@ BN_pseudo_rand_range(BIGNUM *r, const BIGNUM *range) { return bn_rand_range(1, r, range); } +LCRYPTO_ALIAS(BN_pseudo_rand_range); diff --git a/lib/libcrypto/bn/bn_shift.c b/lib/libcrypto/bn/bn_shift.c index eee343670..12edc7c0a 100644 --- a/lib/libcrypto/bn/bn_shift.c +++ b/lib/libcrypto/bn/bn_shift.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_shift.c,v 1.21 2023/02/13 04:25:37 jsing Exp $ */ +/* $OpenBSD: bn_shift.c,v 1.22 2023/07/08 12:21:58 beck Exp $ */ /* * Copyright (c) 2022, 2023 Joel Sing * @@ -151,21 +151,25 @@ BN_lshift1(BIGNUM *r, const BIGNUM *a) { return bn_lshift(r, a, 1); } +LCRYPTO_ALIAS(BN_lshift1); int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) { return bn_lshift(r, a, n); } +LCRYPTO_ALIAS(BN_lshift); int BN_rshift1(BIGNUM *r, const BIGNUM *a) { return bn_rshift(r, a, 1); } +LCRYPTO_ALIAS(BN_rshift1); int BN_rshift(BIGNUM *r, const BIGNUM *a, int n) { return bn_rshift(r, a, n); } +LCRYPTO_ALIAS(BN_rshift); diff --git a/lib/libcrypto/bn/bn_sqr.c b/lib/libcrypto/bn/bn_sqr.c index 2879d34c0..0dbccbf85 100644 --- a/lib/libcrypto/bn/bn_sqr.c +++ b/lib/libcrypto/bn/bn_sqr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_sqr.c,v 1.35 2023/07/02 13:11:23 jsing Exp $ */ +/* $OpenBSD: bn_sqr.c,v 1.36 2023/07/08 12:21:58 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -302,3 +302,4 @@ BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) return ret; } +LCRYPTO_ALIAS(BN_sqr); diff --git a/lib/libcrypto/bn/bn_word.c b/lib/libcrypto/bn/bn_word.c index 68d5c2a4b..a82b911e6 100644 --- a/lib/libcrypto/bn/bn_word.c +++ b/lib/libcrypto/bn/bn_word.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_word.c,v 1.20 2023/03/11 14:14:54 jsing Exp $ */ +/* $OpenBSD: bn_word.c,v 1.21 2023/07/08 12:21:58 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -100,6 +100,7 @@ BN_mod_word(const BIGNUM *a, BN_ULONG w) } return ((BN_ULONG)ret); } +LCRYPTO_ALIAS(BN_mod_word); BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w) @@ -137,6 +138,7 @@ BN_div_word(BIGNUM *a, BN_ULONG w) return (ret); } +LCRYPTO_ALIAS(BN_div_word); int BN_add_word(BIGNUM *a, BN_ULONG w) @@ -171,6 +173,7 @@ BN_add_word(BIGNUM *a, BN_ULONG w) } return (1); } +LCRYPTO_ALIAS(BN_add_word); int BN_sub_word(BIGNUM *a, BN_ULONG w) @@ -217,6 +220,7 @@ BN_sub_word(BIGNUM *a, BN_ULONG w) a->top--; return (1); } +LCRYPTO_ALIAS(BN_sub_word); int BN_mul_word(BIGNUM *a, BN_ULONG w) @@ -238,3 +242,4 @@ BN_mul_word(BIGNUM *a, BN_ULONG w) } return (1); } +LCRYPTO_ALIAS(BN_mul_word); diff --git a/lib/libcrypto/buffer/buf_err.c b/lib/libcrypto/buffer/buf_err.c index 4dc1dca79..3b045cf58 100644 --- a/lib/libcrypto/buffer/buf_err.c +++ b/lib/libcrypto/buffer/buf_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buf_err.c,v 1.12 2022/07/12 14:42:48 kn Exp $ */ +/* $OpenBSD: buf_err.c,v 1.13 2023/07/08 08:26:26 beck Exp $ */ /* ==================================================================== * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. * @@ -86,3 +86,4 @@ ERR_load_BUF_strings(void) } #endif } +LCRYPTO_ALIAS(ERR_load_BUF_strings); diff --git a/lib/libcrypto/buffer/buffer.c b/lib/libcrypto/buffer/buffer.c index f4e84c447..51ce90ff8 100644 --- a/lib/libcrypto/buffer/buffer.c +++ b/lib/libcrypto/buffer/buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buffer.c,v 1.27 2017/05/02 03:59:44 deraadt Exp $ */ +/* $OpenBSD: buffer.c,v 1.28 2023/07/08 08:26:26 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -82,6 +82,7 @@ BUF_MEM_new(void) return (ret); } +LCRYPTO_ALIAS(BUF_MEM_new); void BUF_MEM_free(BUF_MEM *a) @@ -92,12 +93,14 @@ BUF_MEM_free(BUF_MEM *a) freezero(a->data, a->max); free(a); } +LCRYPTO_ALIAS(BUF_MEM_free); int BUF_MEM_grow(BUF_MEM *str, size_t len) { return BUF_MEM_grow_clean(str, len); } +LCRYPTO_ALIAS(BUF_MEM_grow); int BUF_MEM_grow_clean(BUF_MEM *str, size_t len) @@ -128,6 +131,7 @@ BUF_MEM_grow_clean(BUF_MEM *str, size_t len) return (len); } +LCRYPTO_ALIAS(BUF_MEM_grow_clean); void BUF_reverse(unsigned char *out, const unsigned char *in, size_t size) diff --git a/lib/libcrypto/cast/c_cfb64.c b/lib/libcrypto/cast/c_cfb64.c index 9586f932a..2acf7632e 100644 --- a/lib/libcrypto/cast/c_cfb64.c +++ b/lib/libcrypto/cast/c_cfb64.c @@ -1,25 +1,25 @@ -/* $OpenBSD: c_cfb64.c,v 1.6 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: c_cfb64.c,v 1.8 2023/07/08 10:43:59 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -64,58 +64,61 @@ * 64bit block we have used is contained in *num; */ -void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, const CAST_KEY *schedule, unsigned char *ivec, - int *num, int enc) - { - CAST_LONG v0,v1,t; +void +CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, const CAST_KEY *schedule, unsigned char *ivec, + int *num, int enc) +{ + CAST_LONG v0, v1, t; int n= *num; - long l=length; + long l = length; CAST_LONG ti[2]; - unsigned char *iv,c,cc; + unsigned char *iv, c, cc; - iv=ivec; - if (enc) - { - while (l--) - { - if (n == 0) - { - n2l(iv,v0); ti[0]=v0; - n2l(iv,v1); ti[1]=v1; - CAST_encrypt((CAST_LONG *)ti,schedule); - iv=ivec; - t=ti[0]; l2n(t,iv); - t=ti[1]; l2n(t,iv); - iv=ivec; - } + iv = ivec; + if (enc) { + while (l--) { + if (n == 0) { + n2l(iv, v0); + ti[0] = v0; + n2l(iv, v1); + ti[1] = v1; + CAST_encrypt((CAST_LONG *)ti, schedule); + iv = ivec; + t = ti[0]; + l2n(t, iv); + t = ti[1]; + l2n(t, iv); + iv = ivec; + } c= *(in++)^iv[n]; - *(out++)=c; - iv[n]=c; - n=(n+1)&0x07; - } + *(out++) = c; + iv[n] = c; + n = (n + 1)&0x07; } - else - { - while (l--) - { - if (n == 0) - { - n2l(iv,v0); ti[0]=v0; - n2l(iv,v1); ti[1]=v1; - CAST_encrypt((CAST_LONG *)ti,schedule); - iv=ivec; - t=ti[0]; l2n(t,iv); - t=ti[1]; l2n(t,iv); - iv=ivec; - } + } else { + while (l--) { + if (n == 0) { + n2l(iv, v0); + ti[0] = v0; + n2l(iv, v1); + ti[1] = v1; + CAST_encrypt((CAST_LONG *)ti, schedule); + iv = ivec; + t = ti[0]; + l2n(t, iv); + t = ti[1]; + l2n(t, iv); + iv = ivec; + } cc= *(in++); - c=iv[n]; - iv[n]=cc; - *(out++)=c^cc; - n=(n+1)&0x07; - } + c = iv[n]; + iv[n] = cc; + *(out++) = c^cc; + n = (n + 1)&0x07; } - v0=v1=ti[0]=ti[1]=t=c=cc=0; - *num=n; } + v0 = v1 = ti[0] = ti[1] = t=c = cc = 0; + *num = n; +} +LCRYPTO_ALIAS(CAST_cfb64_encrypt); diff --git a/lib/libcrypto/cast/c_ecb.c b/lib/libcrypto/cast/c_ecb.c index e4ad05c29..89338a18e 100644 --- a/lib/libcrypto/cast/c_ecb.c +++ b/lib/libcrypto/cast/c_ecb.c @@ -1,25 +1,25 @@ -/* $OpenBSD: c_ecb.c,v 1.8 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: c_ecb.c,v 1.10 2023/07/08 10:43:59 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -60,18 +60,24 @@ #include "cast_local.h" #include -void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out, - const CAST_KEY *ks, int enc) - { - CAST_LONG l,d[2]; +void +CAST_ecb_encrypt(const unsigned char *in, unsigned char *out, + const CAST_KEY *ks, int enc) +{ + CAST_LONG l, d[2]; - n2l(in,l); d[0]=l; - n2l(in,l); d[1]=l; + n2l(in, l); + d[0] = l; + n2l(in, l); + d[1] = l; if (enc) - CAST_encrypt(d,ks); + CAST_encrypt(d, ks); else - CAST_decrypt(d,ks); - l=d[0]; l2n(l,out); - l=d[1]; l2n(l,out); - l=d[0]=d[1]=0; - } + CAST_decrypt(d, ks); + l = d[0]; + l2n(l, out); + l = d[1]; + l2n(l, out); + l = d[0] = d[1] = 0; +} +LCRYPTO_ALIAS(CAST_ecb_encrypt); diff --git a/lib/libcrypto/cast/c_enc.c b/lib/libcrypto/cast/c_enc.c index cc28991bd..34fe69f0a 100644 --- a/lib/libcrypto/cast/c_enc.c +++ b/lib/libcrypto/cast/c_enc.c @@ -1,25 +1,25 @@ -/* $OpenBSD: c_enc.c,v 1.8 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: c_enc.c,v 1.10 2023/07/08 10:43:59 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -60,151 +60,148 @@ #include "cast_local.h" #ifndef OPENBSD_CAST_ASM -void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key) - { - CAST_LONG l,r,t; +void +CAST_encrypt(CAST_LONG *data, const CAST_KEY *key) +{ + CAST_LONG l, r, t; const CAST_LONG *k; - k= &(key->data[0]); - l=data[0]; - r=data[1]; + k = &(key->data[0]); + l = data[0]; + r = data[1]; - E_CAST( 0,k,l,r,+,^,-); - E_CAST( 1,k,r,l,^,-,+); - E_CAST( 2,k,l,r,-,+,^); - E_CAST( 3,k,r,l,+,^,-); - E_CAST( 4,k,l,r,^,-,+); - E_CAST( 5,k,r,l,-,+,^); - E_CAST( 6,k,l,r,+,^,-); - E_CAST( 7,k,r,l,^,-,+); - E_CAST( 8,k,l,r,-,+,^); - E_CAST( 9,k,r,l,+,^,-); - E_CAST(10,k,l,r,^,-,+); - E_CAST(11,k,r,l,-,+,^); - if(!key->short_key) - { - E_CAST(12,k,l,r,+,^,-); - E_CAST(13,k,r,l,^,-,+); - E_CAST(14,k,l,r,-,+,^); - E_CAST(15,k,r,l,+,^,-); - } - - data[1]=l&0xffffffffL; - data[0]=r&0xffffffffL; + E_CAST( 0, k,l, r,+,^, -); + E_CAST( 1, k,r, l,^, -,+); + E_CAST( 2, k,l, r, -,+,^); + E_CAST( 3, k,r, l,+,^, -); + E_CAST( 4, k,l, r,^, -,+); + E_CAST( 5, k,r, l, -,+,^); + E_CAST( 6, k,l, r,+,^, -); + E_CAST( 7, k,r, l,^, -,+); + E_CAST( 8, k,l, r, -,+,^); + E_CAST( 9, k,r, l,+,^, -); + E_CAST(10, k,l, r,^, -,+); + E_CAST(11, k,r, l, -,+,^); + if (!key->short_key) { + E_CAST(12, k,l, r,+,^, -); + E_CAST(13, k,r, l,^, -,+); + E_CAST(14, k,l, r, -,+,^); + E_CAST(15, k,r, l,+,^, -); } -void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key) - { - CAST_LONG l,r,t; + data[1] = l&0xffffffffL; + data[0] = r&0xffffffffL; +} +LCRYPTO_ALIAS(CAST_encrypt); + +void +CAST_decrypt(CAST_LONG *data, const CAST_KEY *key) +{ + CAST_LONG l, r, t; const CAST_LONG *k; - k= &(key->data[0]); - l=data[0]; - r=data[1]; + k = &(key->data[0]); + l = data[0]; + r = data[1]; - if(!key->short_key) - { - E_CAST(15,k,l,r,+,^,-); - E_CAST(14,k,r,l,-,+,^); - E_CAST(13,k,l,r,^,-,+); - E_CAST(12,k,r,l,+,^,-); - } - E_CAST(11,k,l,r,-,+,^); - E_CAST(10,k,r,l,^,-,+); - E_CAST( 9,k,l,r,+,^,-); - E_CAST( 8,k,r,l,-,+,^); - E_CAST( 7,k,l,r,^,-,+); - E_CAST( 6,k,r,l,+,^,-); - E_CAST( 5,k,l,r,-,+,^); - E_CAST( 4,k,r,l,^,-,+); - E_CAST( 3,k,l,r,+,^,-); - E_CAST( 2,k,r,l,-,+,^); - E_CAST( 1,k,l,r,^,-,+); - E_CAST( 0,k,r,l,+,^,-); - - data[1]=l&0xffffffffL; - data[0]=r&0xffffffffL; + if (!key->short_key) { + E_CAST(15, k,l, r,+,^, -); + E_CAST(14, k,r, l, -,+,^); + E_CAST(13, k,l, r,^, -,+); + E_CAST(12, k,r, l,+,^, -); } + E_CAST(11, k,l, r, -,+,^); + E_CAST(10, k,r, l,^, -,+); + E_CAST( 9, k,l, r,+,^, -); + E_CAST( 8, k,r, l, -,+,^); + E_CAST( 7, k,l, r,^, -,+); + E_CAST( 6, k,r, l,+,^, -); + E_CAST( 5, k,l, r, -,+,^); + E_CAST( 4, k,r, l,^, -,+); + E_CAST( 3, k,l, r,+,^, -); + E_CAST( 2, k,r, l, -,+,^); + E_CAST( 1, k,l, r,^, -,+); + E_CAST( 0, k,r, l,+,^, -); + + data[1] = l&0xffffffffL; + data[0] = r&0xffffffffL; +} +LCRYPTO_ALIAS(CAST_decrypt); #endif -void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, - const CAST_KEY *ks, unsigned char *iv, int enc) - { - CAST_LONG tin0,tin1; - CAST_LONG tout0,tout1,xor0,xor1; - long l=length; +void +CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, + const CAST_KEY *ks, unsigned char *iv, int enc) +{ + CAST_LONG tin0, tin1; + CAST_LONG tout0, tout1, xor0, xor1; + long l = length; CAST_LONG tin[2]; - if (enc) - { - n2l(iv,tout0); - n2l(iv,tout1); - iv-=8; - for (l-=8; l>=0; l-=8) - { - n2l(in,tin0); - n2l(in,tin1); - tin0^=tout0; - tin1^=tout1; - tin[0]=tin0; - tin[1]=tin1; - CAST_encrypt(tin,ks); - tout0=tin[0]; - tout1=tin[1]; - l2n(tout0,out); - l2n(tout1,out); - } - if (l != -8) - { - n2ln(in,tin0,tin1,l+8); - tin0^=tout0; - tin1^=tout1; - tin[0]=tin0; - tin[1]=tin1; - CAST_encrypt(tin,ks); - tout0=tin[0]; - tout1=tin[1]; - l2n(tout0,out); - l2n(tout1,out); - } - l2n(tout0,iv); - l2n(tout1,iv); + if (enc) { + n2l(iv, tout0); + n2l(iv, tout1); + iv -= 8; + for (l -= 8; l >= 0; l -= 8) { + n2l(in, tin0); + n2l(in, tin1); + tin0 ^= tout0; + tin1 ^= tout1; + tin[0] = tin0; + tin[1] = tin1; + CAST_encrypt(tin, ks); + tout0 = tin[0]; + tout1 = tin[1]; + l2n(tout0, out); + l2n(tout1, out); } - else - { - n2l(iv,xor0); - n2l(iv,xor1); - iv-=8; - for (l-=8; l>=0; l-=8) - { - n2l(in,tin0); - n2l(in,tin1); - tin[0]=tin0; - tin[1]=tin1; - CAST_decrypt(tin,ks); - tout0=tin[0]^xor0; - tout1=tin[1]^xor1; - l2n(tout0,out); - l2n(tout1,out); - xor0=tin0; - xor1=tin1; - } - if (l != -8) - { - n2l(in,tin0); - n2l(in,tin1); - tin[0]=tin0; - tin[1]=tin1; - CAST_decrypt(tin,ks); - tout0=tin[0]^xor0; - tout1=tin[1]^xor1; - l2nn(tout0,tout1,out,l+8); - xor0=tin0; - xor1=tin1; - } - l2n(xor0,iv); - l2n(xor1,iv); + if (l != -8) { + n2ln(in, tin0, tin1, l + 8); + tin0 ^= tout0; + tin1 ^= tout1; + tin[0] = tin0; + tin[1] = tin1; + CAST_encrypt(tin, ks); + tout0 = tin[0]; + tout1 = tin[1]; + l2n(tout0, out); + l2n(tout1, out); } - tin0=tin1=tout0=tout1=xor0=xor1=0; - tin[0]=tin[1]=0; + l2n(tout0, iv); + l2n(tout1, iv); + } else { + n2l(iv, xor0); + n2l(iv, xor1); + iv -= 8; + for (l -= 8; l >= 0; l -= 8) { + n2l(in, tin0); + n2l(in, tin1); + tin[0] = tin0; + tin[1] = tin1; + CAST_decrypt(tin, ks); + tout0 = tin[0]^xor0; + tout1 = tin[1]^xor1; + l2n(tout0, out); + l2n(tout1, out); + xor0 = tin0; + xor1 = tin1; + } + if (l != -8) { + n2l(in, tin0); + n2l(in, tin1); + tin[0] = tin0; + tin[1] = tin1; + CAST_decrypt(tin, ks); + tout0 = tin[0]^xor0; + tout1 = tin[1]^xor1; + l2nn(tout0, tout1, out, l + 8); + xor0 = tin0; + xor1 = tin1; + } + l2n(xor0, iv); + l2n(xor1, iv); } + tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0; + tin[0] = tin[1] = 0; +} +LCRYPTO_ALIAS(CAST_cbc_encrypt); diff --git a/lib/libcrypto/cast/c_ofb64.c b/lib/libcrypto/cast/c_ofb64.c index d5859150a..48ebab906 100644 --- a/lib/libcrypto/cast/c_ofb64.c +++ b/lib/libcrypto/cast/c_ofb64.c @@ -1,25 +1,25 @@ -/* $OpenBSD: c_ofb64.c,v 1.6 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: c_ofb64.c,v 1.8 2023/07/08 10:43:59 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -63,48 +63,49 @@ * used. The extra state information to record how much of the * 64bit block we have used is contained in *num; */ -void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, const CAST_KEY *schedule, unsigned char *ivec, - int *num) - { - CAST_LONG v0,v1,t; +void +CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, const CAST_KEY *schedule, unsigned char *ivec, + int *num) +{ + CAST_LONG v0, v1, t; int n= *num; - long l=length; + long l = length; unsigned char d[8]; char *dp; CAST_LONG ti[2]; unsigned char *iv; - int save=0; + int save = 0; - iv=ivec; - n2l(iv,v0); - n2l(iv,v1); - ti[0]=v0; - ti[1]=v1; - dp=(char *)d; - l2n(v0,dp); - l2n(v1,dp); - while (l--) - { - if (n == 0) - { - CAST_encrypt((CAST_LONG *)ti,schedule); - dp=(char *)d; - t=ti[0]; l2n(t,dp); - t=ti[1]; l2n(t,dp); + iv = ivec; + n2l(iv, v0); + n2l(iv, v1); + ti[0] = v0; + ti[1] = v1; + dp = (char *)d; + l2n(v0, dp); + l2n(v1, dp); + while (l--) { + if (n == 0) { + CAST_encrypt((CAST_LONG *)ti, schedule); + dp = (char *)d; + t = ti[0]; + l2n(t, dp); + t = ti[1]; + l2n(t, dp); save++; - } + } *(out++)= *(in++)^d[n]; - n=(n+1)&0x07; - } - if (save) - { - v0=ti[0]; - v1=ti[1]; - iv=ivec; - l2n(v0,iv); - l2n(v1,iv); - } - t=v0=v1=ti[0]=ti[1]=0; - *num=n; + n = (n + 1)&0x07; } + if (save) { + v0 = ti[0]; + v1 = ti[1]; + iv = ivec; + l2n(v0, iv); + l2n(v1, iv); + } + t = v0 = v1 = ti[0] = ti[1] = 0; + *num = n; +} +LCRYPTO_ALIAS(CAST_ofb64_encrypt); diff --git a/lib/libcrypto/cast/c_skey.c b/lib/libcrypto/cast/c_skey.c index 5f86effc3..ecce7bad7 100644 --- a/lib/libcrypto/cast/c_skey.c +++ b/lib/libcrypto/cast/c_skey.c @@ -1,25 +1,25 @@ -/* $OpenBSD: c_skey.c,v 1.12 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: c_skey.c,v 1.14 2023/07/08 10:43:59 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -72,95 +72,98 @@ #define S5 CAST_S_table5 #define S6 CAST_S_table6 #define S7 CAST_S_table7 -void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data) - { +void +CAST_set_key(CAST_KEY *key, int len, const unsigned char *data) +{ CAST_LONG x[16]; CAST_LONG z[16]; CAST_LONG k[32]; - CAST_LONG X[4],Z[4]; - CAST_LONG l,*K; + CAST_LONG X[4], Z[4]; + CAST_LONG l, *K; int i; - for (i=0; i<16; i++) x[i]=0; - if (len > 16) len=16; - for (i=0; ishort_key=1; + for (i = 0; + i < 16; + i++) x[i] = 0; + if (len > 16) + len = 16; + for (i = 0; i < len; i++) + x[i] = data[i]; + if (len <= 10) + key->short_key = 1; else - key->short_key=0; + key->short_key = 0; - K= &k[0]; - X[0]=((x[ 0]<<24)|(x[ 1]<<16)|(x[ 2]<<8)|x[ 3])&0xffffffffL; - X[1]=((x[ 4]<<24)|(x[ 5]<<16)|(x[ 6]<<8)|x[ 7])&0xffffffffL; - X[2]=((x[ 8]<<24)|(x[ 9]<<16)|(x[10]<<8)|x[11])&0xffffffffL; - X[3]=((x[12]<<24)|(x[13]<<16)|(x[14]<<8)|x[15])&0xffffffffL; + K = &k[0]; + X[0] = ((x[ 0]<<24)|(x[ 1]<<16)|(x[ 2]<<8)|x[ 3])&0xffffffffL; + X[1] = ((x[ 4]<<24)|(x[ 5]<<16)|(x[ 6]<<8)|x[ 7])&0xffffffffL; + X[2] = ((x[ 8]<<24)|(x[ 9]<<16)|(x[10]<<8)|x[11])&0xffffffffL; + X[3] = ((x[12]<<24)|(x[13]<<16)|(x[14]<<8)|x[15])&0xffffffffL; - for (;;) - { - l=X[0]^S4[x[13]]^S5[x[15]]^S6[x[12]]^S7[x[14]]^S6[x[ 8]]; - CAST_exp(l,Z,z, 0); - l=X[2]^S4[z[ 0]]^S5[z[ 2]]^S6[z[ 1]]^S7[z[ 3]]^S7[x[10]]; - CAST_exp(l,Z,z, 4); - l=X[3]^S4[z[ 7]]^S5[z[ 6]]^S6[z[ 5]]^S7[z[ 4]]^S4[x[ 9]]; - CAST_exp(l,Z,z, 8); - l=X[1]^S4[z[10]]^S5[z[ 9]]^S6[z[11]]^S7[z[ 8]]^S5[x[11]]; - CAST_exp(l,Z,z,12); + for (;;) { + l = X[0]^S4[x[13]]^S5[x[15]]^S6[x[12]]^S7[x[14]]^S6[x[ 8]]; + CAST_exp(l, Z, z, 0); + l = X[2]^S4[z[ 0]]^S5[z[ 2]]^S6[z[ 1]]^S7[z[ 3]]^S7[x[10]]; + CAST_exp(l, Z, z, 4); + l = X[3]^S4[z[ 7]]^S5[z[ 6]]^S6[z[ 5]]^S7[z[ 4]]^S4[x[ 9]]; + CAST_exp(l, Z, z, 8); + l = X[1]^S4[z[10]]^S5[z[ 9]]^S6[z[11]]^S7[z[ 8]]^S5[x[11]]; + CAST_exp(l, Z,z, 12); - K[ 0]= S4[z[ 8]]^S5[z[ 9]]^S6[z[ 7]]^S7[z[ 6]]^S4[z[ 2]]; - K[ 1]= S4[z[10]]^S5[z[11]]^S6[z[ 5]]^S7[z[ 4]]^S5[z[ 6]]; - K[ 2]= S4[z[12]]^S5[z[13]]^S6[z[ 3]]^S7[z[ 2]]^S6[z[ 9]]; - K[ 3]= S4[z[14]]^S5[z[15]]^S6[z[ 1]]^S7[z[ 0]]^S7[z[12]]; + K[0] = S4[z[ 8]]^S5[z[ 9]]^S6[z[ 7]]^S7[z[ 6]]^S4[z[ 2]]; + K[1] = S4[z[10]]^S5[z[11]]^S6[z[ 5]]^S7[z[ 4]]^S5[z[ 6]]; + K[2] = S4[z[12]]^S5[z[13]]^S6[z[ 3]]^S7[z[ 2]]^S6[z[ 9]]; + K[3] = S4[z[14]]^S5[z[15]]^S6[z[ 1]]^S7[z[ 0]]^S7[z[12]]; - l=Z[2]^S4[z[ 5]]^S5[z[ 7]]^S6[z[ 4]]^S7[z[ 6]]^S6[z[ 0]]; - CAST_exp(l,X,x, 0); - l=Z[0]^S4[x[ 0]]^S5[x[ 2]]^S6[x[ 1]]^S7[x[ 3]]^S7[z[ 2]]; - CAST_exp(l,X,x, 4); - l=Z[1]^S4[x[ 7]]^S5[x[ 6]]^S6[x[ 5]]^S7[x[ 4]]^S4[z[ 1]]; - CAST_exp(l,X,x, 8); - l=Z[3]^S4[x[10]]^S5[x[ 9]]^S6[x[11]]^S7[x[ 8]]^S5[z[ 3]]; - CAST_exp(l,X,x,12); + l = Z[2]^S4[z[ 5]]^S5[z[ 7]]^S6[z[ 4]]^S7[z[ 6]]^S6[z[ 0]]; + CAST_exp(l, X, x, 0); + l = Z[0]^S4[x[ 0]]^S5[x[ 2]]^S6[x[ 1]]^S7[x[ 3]]^S7[z[ 2]]; + CAST_exp(l, X, x, 4); + l = Z[1]^S4[x[ 7]]^S5[x[ 6]]^S6[x[ 5]]^S7[x[ 4]]^S4[z[ 1]]; + CAST_exp(l, X, x, 8); + l = Z[3]^S4[x[10]]^S5[x[ 9]]^S6[x[11]]^S7[x[ 8]]^S5[z[ 3]]; + CAST_exp(l, X,x, 12); - K[ 4]= S4[x[ 3]]^S5[x[ 2]]^S6[x[12]]^S7[x[13]]^S4[x[ 8]]; - K[ 5]= S4[x[ 1]]^S5[x[ 0]]^S6[x[14]]^S7[x[15]]^S5[x[13]]; - K[ 6]= S4[x[ 7]]^S5[x[ 6]]^S6[x[ 8]]^S7[x[ 9]]^S6[x[ 3]]; - K[ 7]= S4[x[ 5]]^S5[x[ 4]]^S6[x[10]]^S7[x[11]]^S7[x[ 7]]; + K[4] = S4[x[ 3]]^S5[x[ 2]]^S6[x[12]]^S7[x[13]]^S4[x[ 8]]; + K[5] = S4[x[ 1]]^S5[x[ 0]]^S6[x[14]]^S7[x[15]]^S5[x[13]]; + K[6] = S4[x[ 7]]^S5[x[ 6]]^S6[x[ 8]]^S7[x[ 9]]^S6[x[ 3]]; + K[7] = S4[x[ 5]]^S5[x[ 4]]^S6[x[10]]^S7[x[11]]^S7[x[ 7]]; - l=X[0]^S4[x[13]]^S5[x[15]]^S6[x[12]]^S7[x[14]]^S6[x[ 8]]; - CAST_exp(l,Z,z, 0); - l=X[2]^S4[z[ 0]]^S5[z[ 2]]^S6[z[ 1]]^S7[z[ 3]]^S7[x[10]]; - CAST_exp(l,Z,z, 4); - l=X[3]^S4[z[ 7]]^S5[z[ 6]]^S6[z[ 5]]^S7[z[ 4]]^S4[x[ 9]]; - CAST_exp(l,Z,z, 8); - l=X[1]^S4[z[10]]^S5[z[ 9]]^S6[z[11]]^S7[z[ 8]]^S5[x[11]]; - CAST_exp(l,Z,z,12); + l = X[0]^S4[x[13]]^S5[x[15]]^S6[x[12]]^S7[x[14]]^S6[x[ 8]]; + CAST_exp(l, Z, z, 0); + l = X[2]^S4[z[ 0]]^S5[z[ 2]]^S6[z[ 1]]^S7[z[ 3]]^S7[x[10]]; + CAST_exp(l, Z, z, 4); + l = X[3]^S4[z[ 7]]^S5[z[ 6]]^S6[z[ 5]]^S7[z[ 4]]^S4[x[ 9]]; + CAST_exp(l, Z, z, 8); + l = X[1]^S4[z[10]]^S5[z[ 9]]^S6[z[11]]^S7[z[ 8]]^S5[x[11]]; + CAST_exp(l, Z,z, 12); - K[ 8]= S4[z[ 3]]^S5[z[ 2]]^S6[z[12]]^S7[z[13]]^S4[z[ 9]]; - K[ 9]= S4[z[ 1]]^S5[z[ 0]]^S6[z[14]]^S7[z[15]]^S5[z[12]]; - K[10]= S4[z[ 7]]^S5[z[ 6]]^S6[z[ 8]]^S7[z[ 9]]^S6[z[ 2]]; - K[11]= S4[z[ 5]]^S5[z[ 4]]^S6[z[10]]^S7[z[11]]^S7[z[ 6]]; + K[8] = S4[z[ 3]]^S5[z[ 2]]^S6[z[12]]^S7[z[13]]^S4[z[ 9]]; + K[9] = S4[z[ 1]]^S5[z[ 0]]^S6[z[14]]^S7[z[15]]^S5[z[12]]; + K[10] = S4[z[ 7]]^S5[z[ 6]]^S6[z[ 8]]^S7[z[ 9]]^S6[z[ 2]]; + K[11] = S4[z[ 5]]^S5[z[ 4]]^S6[z[10]]^S7[z[11]]^S7[z[ 6]]; - l=Z[2]^S4[z[ 5]]^S5[z[ 7]]^S6[z[ 4]]^S7[z[ 6]]^S6[z[ 0]]; - CAST_exp(l,X,x, 0); - l=Z[0]^S4[x[ 0]]^S5[x[ 2]]^S6[x[ 1]]^S7[x[ 3]]^S7[z[ 2]]; - CAST_exp(l,X,x, 4); - l=Z[1]^S4[x[ 7]]^S5[x[ 6]]^S6[x[ 5]]^S7[x[ 4]]^S4[z[ 1]]; - CAST_exp(l,X,x, 8); - l=Z[3]^S4[x[10]]^S5[x[ 9]]^S6[x[11]]^S7[x[ 8]]^S5[z[ 3]]; - CAST_exp(l,X,x,12); + l = Z[2]^S4[z[ 5]]^S5[z[ 7]]^S6[z[ 4]]^S7[z[ 6]]^S6[z[ 0]]; + CAST_exp(l, X, x, 0); + l = Z[0]^S4[x[ 0]]^S5[x[ 2]]^S6[x[ 1]]^S7[x[ 3]]^S7[z[ 2]]; + CAST_exp(l, X, x, 4); + l = Z[1]^S4[x[ 7]]^S5[x[ 6]]^S6[x[ 5]]^S7[x[ 4]]^S4[z[ 1]]; + CAST_exp(l, X, x, 8); + l = Z[3]^S4[x[10]]^S5[x[ 9]]^S6[x[11]]^S7[x[ 8]]^S5[z[ 3]]; + CAST_exp(l, X,x, 12); - K[12]= S4[x[ 8]]^S5[x[ 9]]^S6[x[ 7]]^S7[x[ 6]]^S4[x[ 3]]; - K[13]= S4[x[10]]^S5[x[11]]^S6[x[ 5]]^S7[x[ 4]]^S5[x[ 7]]; - K[14]= S4[x[12]]^S5[x[13]]^S6[x[ 3]]^S7[x[ 2]]^S6[x[ 8]]; - K[15]= S4[x[14]]^S5[x[15]]^S6[x[ 1]]^S7[x[ 0]]^S7[x[13]]; - if (K != k) break; - K+=16; - } - - for (i=0; i<16; i++) - { - key->data[i*2]=k[i]; - key->data[i*2+1]=((k[i+16])+16)&0x1f; - } + K[12] = S4[x[ 8]]^S5[x[ 9]]^S6[x[ 7]]^S7[x[ 6]]^S4[x[ 3]]; + K[13] = S4[x[10]]^S5[x[11]]^S6[x[ 5]]^S7[x[ 4]]^S5[x[ 7]]; + K[14] = S4[x[12]]^S5[x[13]]^S6[x[ 3]]^S7[x[ 2]]^S6[x[ 8]]; + K[15] = S4[x[14]]^S5[x[15]]^S6[x[ 1]]^S7[x[ 0]]^S7[x[13]]; + if (K != k) + break; + K += 16; } + for (i = 0; i < 16; i++) { + key->data[i*2] = k[i]; + key->data[i*2 + 1] = ((k[i + 16]) + 16)&0x1f; + } +} +LCRYPTO_ALIAS(CAST_set_key); diff --git a/lib/libcrypto/cast/cast.h b/lib/libcrypto/cast/cast.h index 1043c7f24..093669606 100644 --- a/lib/libcrypto/cast/cast.h +++ b/lib/libcrypto/cast/cast.h @@ -1,25 +1,25 @@ -/* $OpenBSD: cast.h,v 1.12 2014/07/10 22:45:56 jsing Exp $ */ +/* $OpenBSD: cast.h,v 1.13 2023/07/08 07:25:43 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -77,25 +77,24 @@ extern "C" { #define CAST_BLOCK 8 #define CAST_KEY_LENGTH 16 -typedef struct cast_key_st - { +typedef struct cast_key_st { CAST_LONG data[32]; int short_key; /* Use reduced rounds for short key */ - } CAST_KEY; +} CAST_KEY; void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out, const CAST_KEY *key, - int enc); + int enc); void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key); void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key); void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, - const CAST_KEY *ks, unsigned char *iv, int enc); + const CAST_KEY *ks, unsigned char *iv, int enc); void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, const CAST_KEY *schedule, unsigned char *ivec, - int *num, int enc); -void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, const CAST_KEY *schedule, unsigned char *ivec, - int *num); + long length, const CAST_KEY *schedule, unsigned char *ivec, + int *num, int enc); +void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, const CAST_KEY *schedule, unsigned char *ivec, + int *num); #ifdef __cplusplus } diff --git a/lib/libcrypto/cast/cast_local.h b/lib/libcrypto/cast/cast_local.h index 2ee72a9e5..5fb991110 100644 --- a/lib/libcrypto/cast/cast_local.h +++ b/lib/libcrypto/cast/cast_local.h @@ -1,25 +1,25 @@ -/* $OpenBSD: cast_local.h,v 1.1 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: cast_local.h,v 1.2 2023/07/08 07:25:43 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence diff --git a/lib/libcrypto/cast/cast_s.h b/lib/libcrypto/cast/cast_s.h index 472128bb4..dc339504d 100644 --- a/lib/libcrypto/cast/cast_s.h +++ b/lib/libcrypto/cast/cast_s.h @@ -1,25 +1,25 @@ -/* $OpenBSD: cast_s.h,v 1.6 2016/12/21 15:49:29 jsing Exp $ */ +/* $OpenBSD: cast_s.h,v 1.7 2023/07/08 07:25:43 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -58,533 +58,533 @@ __BEGIN_HIDDEN_DECLS -const CAST_LONG CAST_S_table0[256]={ - 0x30fb40d4,0x9fa0ff0b,0x6beccd2f,0x3f258c7a, - 0x1e213f2f,0x9c004dd3,0x6003e540,0xcf9fc949, - 0xbfd4af27,0x88bbbdb5,0xe2034090,0x98d09675, - 0x6e63a0e0,0x15c361d2,0xc2e7661d,0x22d4ff8e, - 0x28683b6f,0xc07fd059,0xff2379c8,0x775f50e2, - 0x43c340d3,0xdf2f8656,0x887ca41a,0xa2d2bd2d, - 0xa1c9e0d6,0x346c4819,0x61b76d87,0x22540f2f, - 0x2abe32e1,0xaa54166b,0x22568e3a,0xa2d341d0, - 0x66db40c8,0xa784392f,0x004dff2f,0x2db9d2de, - 0x97943fac,0x4a97c1d8,0x527644b7,0xb5f437a7, - 0xb82cbaef,0xd751d159,0x6ff7f0ed,0x5a097a1f, - 0x827b68d0,0x90ecf52e,0x22b0c054,0xbc8e5935, - 0x4b6d2f7f,0x50bb64a2,0xd2664910,0xbee5812d, - 0xb7332290,0xe93b159f,0xb48ee411,0x4bff345d, - 0xfd45c240,0xad31973f,0xc4f6d02e,0x55fc8165, - 0xd5b1caad,0xa1ac2dae,0xa2d4b76d,0xc19b0c50, - 0x882240f2,0x0c6e4f38,0xa4e4bfd7,0x4f5ba272, - 0x564c1d2f,0xc59c5319,0xb949e354,0xb04669fe, - 0xb1b6ab8a,0xc71358dd,0x6385c545,0x110f935d, - 0x57538ad5,0x6a390493,0xe63d37e0,0x2a54f6b3, - 0x3a787d5f,0x6276a0b5,0x19a6fcdf,0x7a42206a, - 0x29f9d4d5,0xf61b1891,0xbb72275e,0xaa508167, - 0x38901091,0xc6b505eb,0x84c7cb8c,0x2ad75a0f, - 0x874a1427,0xa2d1936b,0x2ad286af,0xaa56d291, - 0xd7894360,0x425c750d,0x93b39e26,0x187184c9, - 0x6c00b32d,0x73e2bb14,0xa0bebc3c,0x54623779, - 0x64459eab,0x3f328b82,0x7718cf82,0x59a2cea6, - 0x04ee002e,0x89fe78e6,0x3fab0950,0x325ff6c2, - 0x81383f05,0x6963c5c8,0x76cb5ad6,0xd49974c9, - 0xca180dcf,0x380782d5,0xc7fa5cf6,0x8ac31511, - 0x35e79e13,0x47da91d0,0xf40f9086,0xa7e2419e, - 0x31366241,0x051ef495,0xaa573b04,0x4a805d8d, - 0x548300d0,0x00322a3c,0xbf64cddf,0xba57a68e, - 0x75c6372b,0x50afd341,0xa7c13275,0x915a0bf5, - 0x6b54bfab,0x2b0b1426,0xab4cc9d7,0x449ccd82, - 0xf7fbf265,0xab85c5f3,0x1b55db94,0xaad4e324, - 0xcfa4bd3f,0x2deaa3e2,0x9e204d02,0xc8bd25ac, - 0xeadf55b3,0xd5bd9e98,0xe31231b2,0x2ad5ad6c, - 0x954329de,0xadbe4528,0xd8710f69,0xaa51c90f, - 0xaa786bf6,0x22513f1e,0xaa51a79b,0x2ad344cc, - 0x7b5a41f0,0xd37cfbad,0x1b069505,0x41ece491, - 0xb4c332e6,0x032268d4,0xc9600acc,0xce387e6d, - 0xbf6bb16c,0x6a70fb78,0x0d03d9c9,0xd4df39de, - 0xe01063da,0x4736f464,0x5ad328d8,0xb347cc96, - 0x75bb0fc3,0x98511bfb,0x4ffbcc35,0xb58bcf6a, - 0xe11f0abc,0xbfc5fe4a,0xa70aec10,0xac39570a, - 0x3f04442f,0x6188b153,0xe0397a2e,0x5727cb79, - 0x9ceb418f,0x1cacd68d,0x2ad37c96,0x0175cb9d, - 0xc69dff09,0xc75b65f0,0xd9db40d8,0xec0e7779, - 0x4744ead4,0xb11c3274,0xdd24cb9e,0x7e1c54bd, - 0xf01144f9,0xd2240eb1,0x9675b3fd,0xa3ac3755, - 0xd47c27af,0x51c85f4d,0x56907596,0xa5bb15e6, - 0x580304f0,0xca042cf1,0x011a37ea,0x8dbfaadb, - 0x35ba3e4a,0x3526ffa0,0xc37b4d09,0xbc306ed9, - 0x98a52666,0x5648f725,0xff5e569d,0x0ced63d0, - 0x7c63b2cf,0x700b45e1,0xd5ea50f1,0x85a92872, - 0xaf1fbda7,0xd4234870,0xa7870bf3,0x2d3b4d79, - 0x42e04198,0x0cd0ede7,0x26470db8,0xf881814c, - 0x474d6ad7,0x7c0c5e5c,0xd1231959,0x381b7298, - 0xf5d2f4db,0xab838653,0x6e2f1e23,0x83719c9e, - 0xbd91e046,0x9a56456e,0xdc39200c,0x20c8c571, - 0x962bda1c,0xe1e696ff,0xb141ab08,0x7cca89b9, - 0x1a69e783,0x02cc4843,0xa2f7c579,0x429ef47d, - 0x427b169c,0x5ac9f049,0xdd8f0f00,0x5c8165bf, - }; -const CAST_LONG CAST_S_table1[256]={ - 0x1f201094,0xef0ba75b,0x69e3cf7e,0x393f4380, - 0xfe61cf7a,0xeec5207a,0x55889c94,0x72fc0651, - 0xada7ef79,0x4e1d7235,0xd55a63ce,0xde0436ba, - 0x99c430ef,0x5f0c0794,0x18dcdb7d,0xa1d6eff3, - 0xa0b52f7b,0x59e83605,0xee15b094,0xe9ffd909, - 0xdc440086,0xef944459,0xba83ccb3,0xe0c3cdfb, - 0xd1da4181,0x3b092ab1,0xf997f1c1,0xa5e6cf7b, - 0x01420ddb,0xe4e7ef5b,0x25a1ff41,0xe180f806, - 0x1fc41080,0x179bee7a,0xd37ac6a9,0xfe5830a4, - 0x98de8b7f,0x77e83f4e,0x79929269,0x24fa9f7b, - 0xe113c85b,0xacc40083,0xd7503525,0xf7ea615f, - 0x62143154,0x0d554b63,0x5d681121,0xc866c359, - 0x3d63cf73,0xcee234c0,0xd4d87e87,0x5c672b21, - 0x071f6181,0x39f7627f,0x361e3084,0xe4eb573b, - 0x602f64a4,0xd63acd9c,0x1bbc4635,0x9e81032d, - 0x2701f50c,0x99847ab4,0xa0e3df79,0xba6cf38c, - 0x10843094,0x2537a95e,0xf46f6ffe,0xa1ff3b1f, - 0x208cfb6a,0x8f458c74,0xd9e0a227,0x4ec73a34, - 0xfc884f69,0x3e4de8df,0xef0e0088,0x3559648d, - 0x8a45388c,0x1d804366,0x721d9bfd,0xa58684bb, - 0xe8256333,0x844e8212,0x128d8098,0xfed33fb4, - 0xce280ae1,0x27e19ba5,0xd5a6c252,0xe49754bd, - 0xc5d655dd,0xeb667064,0x77840b4d,0xa1b6a801, - 0x84db26a9,0xe0b56714,0x21f043b7,0xe5d05860, - 0x54f03084,0x066ff472,0xa31aa153,0xdadc4755, - 0xb5625dbf,0x68561be6,0x83ca6b94,0x2d6ed23b, - 0xeccf01db,0xa6d3d0ba,0xb6803d5c,0xaf77a709, - 0x33b4a34c,0x397bc8d6,0x5ee22b95,0x5f0e5304, - 0x81ed6f61,0x20e74364,0xb45e1378,0xde18639b, - 0x881ca122,0xb96726d1,0x8049a7e8,0x22b7da7b, - 0x5e552d25,0x5272d237,0x79d2951c,0xc60d894c, - 0x488cb402,0x1ba4fe5b,0xa4b09f6b,0x1ca815cf, - 0xa20c3005,0x8871df63,0xb9de2fcb,0x0cc6c9e9, - 0x0beeff53,0xe3214517,0xb4542835,0x9f63293c, - 0xee41e729,0x6e1d2d7c,0x50045286,0x1e6685f3, - 0xf33401c6,0x30a22c95,0x31a70850,0x60930f13, - 0x73f98417,0xa1269859,0xec645c44,0x52c877a9, - 0xcdff33a6,0xa02b1741,0x7cbad9a2,0x2180036f, - 0x50d99c08,0xcb3f4861,0xc26bd765,0x64a3f6ab, - 0x80342676,0x25a75e7b,0xe4e6d1fc,0x20c710e6, - 0xcdf0b680,0x17844d3b,0x31eef84d,0x7e0824e4, - 0x2ccb49eb,0x846a3bae,0x8ff77888,0xee5d60f6, - 0x7af75673,0x2fdd5cdb,0xa11631c1,0x30f66f43, - 0xb3faec54,0x157fd7fa,0xef8579cc,0xd152de58, - 0xdb2ffd5e,0x8f32ce19,0x306af97a,0x02f03ef8, - 0x99319ad5,0xc242fa0f,0xa7e3ebb0,0xc68e4906, - 0xb8da230c,0x80823028,0xdcdef3c8,0xd35fb171, - 0x088a1bc8,0xbec0c560,0x61a3c9e8,0xbca8f54d, - 0xc72feffa,0x22822e99,0x82c570b4,0xd8d94e89, - 0x8b1c34bc,0x301e16e6,0x273be979,0xb0ffeaa6, - 0x61d9b8c6,0x00b24869,0xb7ffce3f,0x08dc283b, - 0x43daf65a,0xf7e19798,0x7619b72f,0x8f1c9ba4, - 0xdc8637a0,0x16a7d3b1,0x9fc393b7,0xa7136eeb, - 0xc6bcc63e,0x1a513742,0xef6828bc,0x520365d6, - 0x2d6a77ab,0x3527ed4b,0x821fd216,0x095c6e2e, - 0xdb92f2fb,0x5eea29cb,0x145892f5,0x91584f7f, - 0x5483697b,0x2667a8cc,0x85196048,0x8c4bacea, - 0x833860d4,0x0d23e0f9,0x6c387e8a,0x0ae6d249, - 0xb284600c,0xd835731d,0xdcb1c647,0xac4c56ea, - 0x3ebd81b3,0x230eabb0,0x6438bc87,0xf0b5b1fa, - 0x8f5ea2b3,0xfc184642,0x0a036b7a,0x4fb089bd, - 0x649da589,0xa345415e,0x5c038323,0x3e5d3bb9, - 0x43d79572,0x7e6dd07c,0x06dfdf1e,0x6c6cc4ef, - 0x7160a539,0x73bfbe70,0x83877605,0x4523ecf1, - }; -const CAST_LONG CAST_S_table2[256]={ - 0x8defc240,0x25fa5d9f,0xeb903dbf,0xe810c907, - 0x47607fff,0x369fe44b,0x8c1fc644,0xaececa90, - 0xbeb1f9bf,0xeefbcaea,0xe8cf1950,0x51df07ae, - 0x920e8806,0xf0ad0548,0xe13c8d83,0x927010d5, - 0x11107d9f,0x07647db9,0xb2e3e4d4,0x3d4f285e, - 0xb9afa820,0xfade82e0,0xa067268b,0x8272792e, - 0x553fb2c0,0x489ae22b,0xd4ef9794,0x125e3fbc, - 0x21fffcee,0x825b1bfd,0x9255c5ed,0x1257a240, - 0x4e1a8302,0xbae07fff,0x528246e7,0x8e57140e, - 0x3373f7bf,0x8c9f8188,0xa6fc4ee8,0xc982b5a5, - 0xa8c01db7,0x579fc264,0x67094f31,0xf2bd3f5f, - 0x40fff7c1,0x1fb78dfc,0x8e6bd2c1,0x437be59b, - 0x99b03dbf,0xb5dbc64b,0x638dc0e6,0x55819d99, - 0xa197c81c,0x4a012d6e,0xc5884a28,0xccc36f71, - 0xb843c213,0x6c0743f1,0x8309893c,0x0feddd5f, - 0x2f7fe850,0xd7c07f7e,0x02507fbf,0x5afb9a04, - 0xa747d2d0,0x1651192e,0xaf70bf3e,0x58c31380, - 0x5f98302e,0x727cc3c4,0x0a0fb402,0x0f7fef82, - 0x8c96fdad,0x5d2c2aae,0x8ee99a49,0x50da88b8, - 0x8427f4a0,0x1eac5790,0x796fb449,0x8252dc15, - 0xefbd7d9b,0xa672597d,0xada840d8,0x45f54504, - 0xfa5d7403,0xe83ec305,0x4f91751a,0x925669c2, - 0x23efe941,0xa903f12e,0x60270df2,0x0276e4b6, - 0x94fd6574,0x927985b2,0x8276dbcb,0x02778176, - 0xf8af918d,0x4e48f79e,0x8f616ddf,0xe29d840e, - 0x842f7d83,0x340ce5c8,0x96bbb682,0x93b4b148, - 0xef303cab,0x984faf28,0x779faf9b,0x92dc560d, - 0x224d1e20,0x8437aa88,0x7d29dc96,0x2756d3dc, - 0x8b907cee,0xb51fd240,0xe7c07ce3,0xe566b4a1, - 0xc3e9615e,0x3cf8209d,0x6094d1e3,0xcd9ca341, - 0x5c76460e,0x00ea983b,0xd4d67881,0xfd47572c, - 0xf76cedd9,0xbda8229c,0x127dadaa,0x438a074e, - 0x1f97c090,0x081bdb8a,0x93a07ebe,0xb938ca15, - 0x97b03cff,0x3dc2c0f8,0x8d1ab2ec,0x64380e51, - 0x68cc7bfb,0xd90f2788,0x12490181,0x5de5ffd4, - 0xdd7ef86a,0x76a2e214,0xb9a40368,0x925d958f, - 0x4b39fffa,0xba39aee9,0xa4ffd30b,0xfaf7933b, - 0x6d498623,0x193cbcfa,0x27627545,0x825cf47a, - 0x61bd8ba0,0xd11e42d1,0xcead04f4,0x127ea392, - 0x10428db7,0x8272a972,0x9270c4a8,0x127de50b, - 0x285ba1c8,0x3c62f44f,0x35c0eaa5,0xe805d231, - 0x428929fb,0xb4fcdf82,0x4fb66a53,0x0e7dc15b, - 0x1f081fab,0x108618ae,0xfcfd086d,0xf9ff2889, - 0x694bcc11,0x236a5cae,0x12deca4d,0x2c3f8cc5, - 0xd2d02dfe,0xf8ef5896,0xe4cf52da,0x95155b67, - 0x494a488c,0xb9b6a80c,0x5c8f82bc,0x89d36b45, - 0x3a609437,0xec00c9a9,0x44715253,0x0a874b49, - 0xd773bc40,0x7c34671c,0x02717ef6,0x4feb5536, - 0xa2d02fff,0xd2bf60c4,0xd43f03c0,0x50b4ef6d, - 0x07478cd1,0x006e1888,0xa2e53f55,0xb9e6d4bc, - 0xa2048016,0x97573833,0xd7207d67,0xde0f8f3d, - 0x72f87b33,0xabcc4f33,0x7688c55d,0x7b00a6b0, - 0x947b0001,0x570075d2,0xf9bb88f8,0x8942019e, - 0x4264a5ff,0x856302e0,0x72dbd92b,0xee971b69, - 0x6ea22fde,0x5f08ae2b,0xaf7a616d,0xe5c98767, - 0xcf1febd2,0x61efc8c2,0xf1ac2571,0xcc8239c2, - 0x67214cb8,0xb1e583d1,0xb7dc3e62,0x7f10bdce, - 0xf90a5c38,0x0ff0443d,0x606e6dc6,0x60543a49, - 0x5727c148,0x2be98a1d,0x8ab41738,0x20e1be24, - 0xaf96da0f,0x68458425,0x99833be5,0x600d457d, - 0x282f9350,0x8334b362,0xd91d1120,0x2b6d8da0, - 0x642b1e31,0x9c305a00,0x52bce688,0x1b03588a, - 0xf7baefd5,0x4142ed9c,0xa4315c11,0x83323ec5, - 0xdfef4636,0xa133c501,0xe9d3531c,0xee353783, - }; -const CAST_LONG CAST_S_table3[256]={ - 0x9db30420,0x1fb6e9de,0xa7be7bef,0xd273a298, - 0x4a4f7bdb,0x64ad8c57,0x85510443,0xfa020ed1, - 0x7e287aff,0xe60fb663,0x095f35a1,0x79ebf120, - 0xfd059d43,0x6497b7b1,0xf3641f63,0x241e4adf, - 0x28147f5f,0x4fa2b8cd,0xc9430040,0x0cc32220, - 0xfdd30b30,0xc0a5374f,0x1d2d00d9,0x24147b15, - 0xee4d111a,0x0fca5167,0x71ff904c,0x2d195ffe, - 0x1a05645f,0x0c13fefe,0x081b08ca,0x05170121, - 0x80530100,0xe83e5efe,0xac9af4f8,0x7fe72701, - 0xd2b8ee5f,0x06df4261,0xbb9e9b8a,0x7293ea25, - 0xce84ffdf,0xf5718801,0x3dd64b04,0xa26f263b, - 0x7ed48400,0x547eebe6,0x446d4ca0,0x6cf3d6f5, - 0x2649abdf,0xaea0c7f5,0x36338cc1,0x503f7e93, - 0xd3772061,0x11b638e1,0x72500e03,0xf80eb2bb, - 0xabe0502e,0xec8d77de,0x57971e81,0xe14f6746, - 0xc9335400,0x6920318f,0x081dbb99,0xffc304a5, - 0x4d351805,0x7f3d5ce3,0xa6c866c6,0x5d5bcca9, - 0xdaec6fea,0x9f926f91,0x9f46222f,0x3991467d, - 0xa5bf6d8e,0x1143c44f,0x43958302,0xd0214eeb, - 0x022083b8,0x3fb6180c,0x18f8931e,0x281658e6, - 0x26486e3e,0x8bd78a70,0x7477e4c1,0xb506e07c, - 0xf32d0a25,0x79098b02,0xe4eabb81,0x28123b23, - 0x69dead38,0x1574ca16,0xdf871b62,0x211c40b7, - 0xa51a9ef9,0x0014377b,0x041e8ac8,0x09114003, - 0xbd59e4d2,0xe3d156d5,0x4fe876d5,0x2f91a340, - 0x557be8de,0x00eae4a7,0x0ce5c2ec,0x4db4bba6, - 0xe756bdff,0xdd3369ac,0xec17b035,0x06572327, - 0x99afc8b0,0x56c8c391,0x6b65811c,0x5e146119, - 0x6e85cb75,0xbe07c002,0xc2325577,0x893ff4ec, - 0x5bbfc92d,0xd0ec3b25,0xb7801ab7,0x8d6d3b24, - 0x20c763ef,0xc366a5fc,0x9c382880,0x0ace3205, - 0xaac9548a,0xeca1d7c7,0x041afa32,0x1d16625a, - 0x6701902c,0x9b757a54,0x31d477f7,0x9126b031, - 0x36cc6fdb,0xc70b8b46,0xd9e66a48,0x56e55a79, - 0x026a4ceb,0x52437eff,0x2f8f76b4,0x0df980a5, - 0x8674cde3,0xedda04eb,0x17a9be04,0x2c18f4df, - 0xb7747f9d,0xab2af7b4,0xefc34d20,0x2e096b7c, - 0x1741a254,0xe5b6a035,0x213d42f6,0x2c1c7c26, - 0x61c2f50f,0x6552daf9,0xd2c231f8,0x25130f69, - 0xd8167fa2,0x0418f2c8,0x001a96a6,0x0d1526ab, - 0x63315c21,0x5e0a72ec,0x49bafefd,0x187908d9, - 0x8d0dbd86,0x311170a7,0x3e9b640c,0xcc3e10d7, - 0xd5cad3b6,0x0caec388,0xf73001e1,0x6c728aff, - 0x71eae2a1,0x1f9af36e,0xcfcbd12f,0xc1de8417, - 0xac07be6b,0xcb44a1d8,0x8b9b0f56,0x013988c3, - 0xb1c52fca,0xb4be31cd,0xd8782806,0x12a3a4e2, - 0x6f7de532,0x58fd7eb6,0xd01ee900,0x24adffc2, - 0xf4990fc5,0x9711aac5,0x001d7b95,0x82e5e7d2, - 0x109873f6,0x00613096,0xc32d9521,0xada121ff, - 0x29908415,0x7fbb977f,0xaf9eb3db,0x29c9ed2a, - 0x5ce2a465,0xa730f32c,0xd0aa3fe8,0x8a5cc091, - 0xd49e2ce7,0x0ce454a9,0xd60acd86,0x015f1919, - 0x77079103,0xdea03af6,0x78a8565e,0xdee356df, - 0x21f05cbe,0x8b75e387,0xb3c50651,0xb8a5c3ef, - 0xd8eeb6d2,0xe523be77,0xc2154529,0x2f69efdf, - 0xafe67afb,0xf470c4b2,0xf3e0eb5b,0xd6cc9876, - 0x39e4460c,0x1fda8538,0x1987832f,0xca007367, - 0xa99144f8,0x296b299e,0x492fc295,0x9266beab, - 0xb5676e69,0x9bd3ddda,0xdf7e052f,0xdb25701c, - 0x1b5e51ee,0xf65324e6,0x6afce36c,0x0316cc04, - 0x8644213e,0xb7dc59d0,0x7965291f,0xccd6fd43, - 0x41823979,0x932bcdf6,0xb657c34d,0x4edfd282, - 0x7ae5290c,0x3cb9536b,0x851e20fe,0x9833557e, - 0x13ecf0b0,0xd3ffb372,0x3f85c5c1,0x0aef7ed2, - }; -const CAST_LONG CAST_S_table4[256]={ - 0x7ec90c04,0x2c6e74b9,0x9b0e66df,0xa6337911, - 0xb86a7fff,0x1dd358f5,0x44dd9d44,0x1731167f, - 0x08fbf1fa,0xe7f511cc,0xd2051b00,0x735aba00, - 0x2ab722d8,0x386381cb,0xacf6243a,0x69befd7a, - 0xe6a2e77f,0xf0c720cd,0xc4494816,0xccf5c180, - 0x38851640,0x15b0a848,0xe68b18cb,0x4caadeff, - 0x5f480a01,0x0412b2aa,0x259814fc,0x41d0efe2, - 0x4e40b48d,0x248eb6fb,0x8dba1cfe,0x41a99b02, - 0x1a550a04,0xba8f65cb,0x7251f4e7,0x95a51725, - 0xc106ecd7,0x97a5980a,0xc539b9aa,0x4d79fe6a, - 0xf2f3f763,0x68af8040,0xed0c9e56,0x11b4958b, - 0xe1eb5a88,0x8709e6b0,0xd7e07156,0x4e29fea7, - 0x6366e52d,0x02d1c000,0xc4ac8e05,0x9377f571, - 0x0c05372a,0x578535f2,0x2261be02,0xd642a0c9, - 0xdf13a280,0x74b55bd2,0x682199c0,0xd421e5ec, - 0x53fb3ce8,0xc8adedb3,0x28a87fc9,0x3d959981, - 0x5c1ff900,0xfe38d399,0x0c4eff0b,0x062407ea, - 0xaa2f4fb1,0x4fb96976,0x90c79505,0xb0a8a774, - 0xef55a1ff,0xe59ca2c2,0xa6b62d27,0xe66a4263, - 0xdf65001f,0x0ec50966,0xdfdd55bc,0x29de0655, - 0x911e739a,0x17af8975,0x32c7911c,0x89f89468, - 0x0d01e980,0x524755f4,0x03b63cc9,0x0cc844b2, - 0xbcf3f0aa,0x87ac36e9,0xe53a7426,0x01b3d82b, - 0x1a9e7449,0x64ee2d7e,0xcddbb1da,0x01c94910, - 0xb868bf80,0x0d26f3fd,0x9342ede7,0x04a5c284, - 0x636737b6,0x50f5b616,0xf24766e3,0x8eca36c1, - 0x136e05db,0xfef18391,0xfb887a37,0xd6e7f7d4, - 0xc7fb7dc9,0x3063fcdf,0xb6f589de,0xec2941da, - 0x26e46695,0xb7566419,0xf654efc5,0xd08d58b7, - 0x48925401,0xc1bacb7f,0xe5ff550f,0xb6083049, - 0x5bb5d0e8,0x87d72e5a,0xab6a6ee1,0x223a66ce, - 0xc62bf3cd,0x9e0885f9,0x68cb3e47,0x086c010f, - 0xa21de820,0xd18b69de,0xf3f65777,0xfa02c3f6, - 0x407edac3,0xcbb3d550,0x1793084d,0xb0d70eba, - 0x0ab378d5,0xd951fb0c,0xded7da56,0x4124bbe4, - 0x94ca0b56,0x0f5755d1,0xe0e1e56e,0x6184b5be, - 0x580a249f,0x94f74bc0,0xe327888e,0x9f7b5561, - 0xc3dc0280,0x05687715,0x646c6bd7,0x44904db3, - 0x66b4f0a3,0xc0f1648a,0x697ed5af,0x49e92ff6, - 0x309e374f,0x2cb6356a,0x85808573,0x4991f840, - 0x76f0ae02,0x083be84d,0x28421c9a,0x44489406, - 0x736e4cb8,0xc1092910,0x8bc95fc6,0x7d869cf4, - 0x134f616f,0x2e77118d,0xb31b2be1,0xaa90b472, - 0x3ca5d717,0x7d161bba,0x9cad9010,0xaf462ba2, - 0x9fe459d2,0x45d34559,0xd9f2da13,0xdbc65487, - 0xf3e4f94e,0x176d486f,0x097c13ea,0x631da5c7, - 0x445f7382,0x175683f4,0xcdc66a97,0x70be0288, - 0xb3cdcf72,0x6e5dd2f3,0x20936079,0x459b80a5, - 0xbe60e2db,0xa9c23101,0xeba5315c,0x224e42f2, - 0x1c5c1572,0xf6721b2c,0x1ad2fff3,0x8c25404e, - 0x324ed72f,0x4067b7fd,0x0523138e,0x5ca3bc78, - 0xdc0fd66e,0x75922283,0x784d6b17,0x58ebb16e, - 0x44094f85,0x3f481d87,0xfcfeae7b,0x77b5ff76, - 0x8c2302bf,0xaaf47556,0x5f46b02a,0x2b092801, - 0x3d38f5f7,0x0ca81f36,0x52af4a8a,0x66d5e7c0, - 0xdf3b0874,0x95055110,0x1b5ad7a8,0xf61ed5ad, - 0x6cf6e479,0x20758184,0xd0cefa65,0x88f7be58, - 0x4a046826,0x0ff6f8f3,0xa09c7f70,0x5346aba0, - 0x5ce96c28,0xe176eda3,0x6bac307f,0x376829d2, - 0x85360fa9,0x17e3fe2a,0x24b79767,0xf5a96b20, - 0xd6cd2595,0x68ff1ebf,0x7555442c,0xf19f06be, - 0xf9e0659a,0xeeb9491d,0x34010718,0xbb30cab8, - 0xe822fe15,0x88570983,0x750e6249,0xda627e55, - 0x5e76ffa8,0xb1534546,0x6d47de08,0xefe9e7d4, - }; -const CAST_LONG CAST_S_table5[256]={ - 0xf6fa8f9d,0x2cac6ce1,0x4ca34867,0xe2337f7c, - 0x95db08e7,0x016843b4,0xeced5cbc,0x325553ac, - 0xbf9f0960,0xdfa1e2ed,0x83f0579d,0x63ed86b9, - 0x1ab6a6b8,0xde5ebe39,0xf38ff732,0x8989b138, - 0x33f14961,0xc01937bd,0xf506c6da,0xe4625e7e, - 0xa308ea99,0x4e23e33c,0x79cbd7cc,0x48a14367, - 0xa3149619,0xfec94bd5,0xa114174a,0xeaa01866, - 0xa084db2d,0x09a8486f,0xa888614a,0x2900af98, - 0x01665991,0xe1992863,0xc8f30c60,0x2e78ef3c, - 0xd0d51932,0xcf0fec14,0xf7ca07d2,0xd0a82072, - 0xfd41197e,0x9305a6b0,0xe86be3da,0x74bed3cd, - 0x372da53c,0x4c7f4448,0xdab5d440,0x6dba0ec3, - 0x083919a7,0x9fbaeed9,0x49dbcfb0,0x4e670c53, - 0x5c3d9c01,0x64bdb941,0x2c0e636a,0xba7dd9cd, - 0xea6f7388,0xe70bc762,0x35f29adb,0x5c4cdd8d, - 0xf0d48d8c,0xb88153e2,0x08a19866,0x1ae2eac8, - 0x284caf89,0xaa928223,0x9334be53,0x3b3a21bf, - 0x16434be3,0x9aea3906,0xefe8c36e,0xf890cdd9, - 0x80226dae,0xc340a4a3,0xdf7e9c09,0xa694a807, - 0x5b7c5ecc,0x221db3a6,0x9a69a02f,0x68818a54, - 0xceb2296f,0x53c0843a,0xfe893655,0x25bfe68a, - 0xb4628abc,0xcf222ebf,0x25ac6f48,0xa9a99387, - 0x53bddb65,0xe76ffbe7,0xe967fd78,0x0ba93563, - 0x8e342bc1,0xe8a11be9,0x4980740d,0xc8087dfc, - 0x8de4bf99,0xa11101a0,0x7fd37975,0xda5a26c0, - 0xe81f994f,0x9528cd89,0xfd339fed,0xb87834bf, - 0x5f04456d,0x22258698,0xc9c4c83b,0x2dc156be, - 0x4f628daa,0x57f55ec5,0xe2220abe,0xd2916ebf, - 0x4ec75b95,0x24f2c3c0,0x42d15d99,0xcd0d7fa0, - 0x7b6e27ff,0xa8dc8af0,0x7345c106,0xf41e232f, - 0x35162386,0xe6ea8926,0x3333b094,0x157ec6f2, - 0x372b74af,0x692573e4,0xe9a9d848,0xf3160289, - 0x3a62ef1d,0xa787e238,0xf3a5f676,0x74364853, - 0x20951063,0x4576698d,0xb6fad407,0x592af950, - 0x36f73523,0x4cfb6e87,0x7da4cec0,0x6c152daa, - 0xcb0396a8,0xc50dfe5d,0xfcd707ab,0x0921c42f, - 0x89dff0bb,0x5fe2be78,0x448f4f33,0x754613c9, - 0x2b05d08d,0x48b9d585,0xdc049441,0xc8098f9b, - 0x7dede786,0xc39a3373,0x42410005,0x6a091751, - 0x0ef3c8a6,0x890072d6,0x28207682,0xa9a9f7be, - 0xbf32679d,0xd45b5b75,0xb353fd00,0xcbb0e358, - 0x830f220a,0x1f8fb214,0xd372cf08,0xcc3c4a13, - 0x8cf63166,0x061c87be,0x88c98f88,0x6062e397, - 0x47cf8e7a,0xb6c85283,0x3cc2acfb,0x3fc06976, - 0x4e8f0252,0x64d8314d,0xda3870e3,0x1e665459, - 0xc10908f0,0x513021a5,0x6c5b68b7,0x822f8aa0, - 0x3007cd3e,0x74719eef,0xdc872681,0x073340d4, - 0x7e432fd9,0x0c5ec241,0x8809286c,0xf592d891, - 0x08a930f6,0x957ef305,0xb7fbffbd,0xc266e96f, - 0x6fe4ac98,0xb173ecc0,0xbc60b42a,0x953498da, - 0xfba1ae12,0x2d4bd736,0x0f25faab,0xa4f3fceb, - 0xe2969123,0x257f0c3d,0x9348af49,0x361400bc, - 0xe8816f4a,0x3814f200,0xa3f94043,0x9c7a54c2, - 0xbc704f57,0xda41e7f9,0xc25ad33a,0x54f4a084, - 0xb17f5505,0x59357cbe,0xedbd15c8,0x7f97c5ab, - 0xba5ac7b5,0xb6f6deaf,0x3a479c3a,0x5302da25, - 0x653d7e6a,0x54268d49,0x51a477ea,0x5017d55b, - 0xd7d25d88,0x44136c76,0x0404a8c8,0xb8e5a121, - 0xb81a928a,0x60ed5869,0x97c55b96,0xeaec991b, - 0x29935913,0x01fdb7f1,0x088e8dfa,0x9ab6f6f5, - 0x3b4cbf9f,0x4a5de3ab,0xe6051d35,0xa0e1d855, - 0xd36b4cf1,0xf544edeb,0xb0e93524,0xbebb8fbd, - 0xa2d762cf,0x49c92f54,0x38b5f331,0x7128a454, - 0x48392905,0xa65b1db8,0x851c97bd,0xd675cf2f, - }; -const CAST_LONG CAST_S_table6[256]={ - 0x85e04019,0x332bf567,0x662dbfff,0xcfc65693, - 0x2a8d7f6f,0xab9bc912,0xde6008a1,0x2028da1f, - 0x0227bce7,0x4d642916,0x18fac300,0x50f18b82, - 0x2cb2cb11,0xb232e75c,0x4b3695f2,0xb28707de, - 0xa05fbcf6,0xcd4181e9,0xe150210c,0xe24ef1bd, - 0xb168c381,0xfde4e789,0x5c79b0d8,0x1e8bfd43, - 0x4d495001,0x38be4341,0x913cee1d,0x92a79c3f, - 0x089766be,0xbaeeadf4,0x1286becf,0xb6eacb19, - 0x2660c200,0x7565bde4,0x64241f7a,0x8248dca9, - 0xc3b3ad66,0x28136086,0x0bd8dfa8,0x356d1cf2, - 0x107789be,0xb3b2e9ce,0x0502aa8f,0x0bc0351e, - 0x166bf52a,0xeb12ff82,0xe3486911,0xd34d7516, - 0x4e7b3aff,0x5f43671b,0x9cf6e037,0x4981ac83, - 0x334266ce,0x8c9341b7,0xd0d854c0,0xcb3a6c88, - 0x47bc2829,0x4725ba37,0xa66ad22b,0x7ad61f1e, - 0x0c5cbafa,0x4437f107,0xb6e79962,0x42d2d816, - 0x0a961288,0xe1a5c06e,0x13749e67,0x72fc081a, - 0xb1d139f7,0xf9583745,0xcf19df58,0xbec3f756, - 0xc06eba30,0x07211b24,0x45c28829,0xc95e317f, - 0xbc8ec511,0x38bc46e9,0xc6e6fa14,0xbae8584a, - 0xad4ebc46,0x468f508b,0x7829435f,0xf124183b, - 0x821dba9f,0xaff60ff4,0xea2c4e6d,0x16e39264, - 0x92544a8b,0x009b4fc3,0xaba68ced,0x9ac96f78, - 0x06a5b79a,0xb2856e6e,0x1aec3ca9,0xbe838688, - 0x0e0804e9,0x55f1be56,0xe7e5363b,0xb3a1f25d, - 0xf7debb85,0x61fe033c,0x16746233,0x3c034c28, - 0xda6d0c74,0x79aac56c,0x3ce4e1ad,0x51f0c802, - 0x98f8f35a,0x1626a49f,0xeed82b29,0x1d382fe3, - 0x0c4fb99a,0xbb325778,0x3ec6d97b,0x6e77a6a9, - 0xcb658b5c,0xd45230c7,0x2bd1408b,0x60c03eb7, - 0xb9068d78,0xa33754f4,0xf430c87d,0xc8a71302, - 0xb96d8c32,0xebd4e7be,0xbe8b9d2d,0x7979fb06, - 0xe7225308,0x8b75cf77,0x11ef8da4,0xe083c858, - 0x8d6b786f,0x5a6317a6,0xfa5cf7a0,0x5dda0033, - 0xf28ebfb0,0xf5b9c310,0xa0eac280,0x08b9767a, - 0xa3d9d2b0,0x79d34217,0x021a718d,0x9ac6336a, - 0x2711fd60,0x438050e3,0x069908a8,0x3d7fedc4, - 0x826d2bef,0x4eeb8476,0x488dcf25,0x36c9d566, - 0x28e74e41,0xc2610aca,0x3d49a9cf,0xbae3b9df, - 0xb65f8de6,0x92aeaf64,0x3ac7d5e6,0x9ea80509, - 0xf22b017d,0xa4173f70,0xdd1e16c3,0x15e0d7f9, - 0x50b1b887,0x2b9f4fd5,0x625aba82,0x6a017962, - 0x2ec01b9c,0x15488aa9,0xd716e740,0x40055a2c, - 0x93d29a22,0xe32dbf9a,0x058745b9,0x3453dc1e, - 0xd699296e,0x496cff6f,0x1c9f4986,0xdfe2ed07, - 0xb87242d1,0x19de7eae,0x053e561a,0x15ad6f8c, - 0x66626c1c,0x7154c24c,0xea082b2a,0x93eb2939, - 0x17dcb0f0,0x58d4f2ae,0x9ea294fb,0x52cf564c, - 0x9883fe66,0x2ec40581,0x763953c3,0x01d6692e, - 0xd3a0c108,0xa1e7160e,0xe4f2dfa6,0x693ed285, - 0x74904698,0x4c2b0edd,0x4f757656,0x5d393378, - 0xa132234f,0x3d321c5d,0xc3f5e194,0x4b269301, - 0xc79f022f,0x3c997e7e,0x5e4f9504,0x3ffafbbd, - 0x76f7ad0e,0x296693f4,0x3d1fce6f,0xc61e45be, - 0xd3b5ab34,0xf72bf9b7,0x1b0434c0,0x4e72b567, - 0x5592a33d,0xb5229301,0xcfd2a87f,0x60aeb767, - 0x1814386b,0x30bcc33d,0x38a0c07d,0xfd1606f2, - 0xc363519b,0x589dd390,0x5479f8e6,0x1cb8d647, - 0x97fd61a9,0xea7759f4,0x2d57539d,0x569a58cf, - 0xe84e63ad,0x462e1b78,0x6580f87e,0xf3817914, - 0x91da55f4,0x40a230f3,0xd1988f35,0xb6e318d2, - 0x3ffa50bc,0x3d40f021,0xc3c0bdae,0x4958c24c, - 0x518f36b2,0x84b1d370,0x0fedce83,0x878ddada, - 0xf2a279c7,0x94e01be8,0x90716f4b,0x954b8aa3, - }; -const CAST_LONG CAST_S_table7[256]={ - 0xe216300d,0xbbddfffc,0xa7ebdabd,0x35648095, - 0x7789f8b7,0xe6c1121b,0x0e241600,0x052ce8b5, - 0x11a9cfb0,0xe5952f11,0xece7990a,0x9386d174, - 0x2a42931c,0x76e38111,0xb12def3a,0x37ddddfc, - 0xde9adeb1,0x0a0cc32c,0xbe197029,0x84a00940, - 0xbb243a0f,0xb4d137cf,0xb44e79f0,0x049eedfd, - 0x0b15a15d,0x480d3168,0x8bbbde5a,0x669ded42, - 0xc7ece831,0x3f8f95e7,0x72df191b,0x7580330d, - 0x94074251,0x5c7dcdfa,0xabbe6d63,0xaa402164, - 0xb301d40a,0x02e7d1ca,0x53571dae,0x7a3182a2, - 0x12a8ddec,0xfdaa335d,0x176f43e8,0x71fb46d4, - 0x38129022,0xce949ad4,0xb84769ad,0x965bd862, - 0x82f3d055,0x66fb9767,0x15b80b4e,0x1d5b47a0, - 0x4cfde06f,0xc28ec4b8,0x57e8726e,0x647a78fc, - 0x99865d44,0x608bd593,0x6c200e03,0x39dc5ff6, - 0x5d0b00a3,0xae63aff2,0x7e8bd632,0x70108c0c, - 0xbbd35049,0x2998df04,0x980cf42a,0x9b6df491, - 0x9e7edd53,0x06918548,0x58cb7e07,0x3b74ef2e, - 0x522fffb1,0xd24708cc,0x1c7e27cd,0xa4eb215b, - 0x3cf1d2e2,0x19b47a38,0x424f7618,0x35856039, - 0x9d17dee7,0x27eb35e6,0xc9aff67b,0x36baf5b8, - 0x09c467cd,0xc18910b1,0xe11dbf7b,0x06cd1af8, - 0x7170c608,0x2d5e3354,0xd4de495a,0x64c6d006, - 0xbcc0c62c,0x3dd00db3,0x708f8f34,0x77d51b42, - 0x264f620f,0x24b8d2bf,0x15c1b79e,0x46a52564, - 0xf8d7e54e,0x3e378160,0x7895cda5,0x859c15a5, - 0xe6459788,0xc37bc75f,0xdb07ba0c,0x0676a3ab, - 0x7f229b1e,0x31842e7b,0x24259fd7,0xf8bef472, - 0x835ffcb8,0x6df4c1f2,0x96f5b195,0xfd0af0fc, - 0xb0fe134c,0xe2506d3d,0x4f9b12ea,0xf215f225, - 0xa223736f,0x9fb4c428,0x25d04979,0x34c713f8, - 0xc4618187,0xea7a6e98,0x7cd16efc,0x1436876c, - 0xf1544107,0xbedeee14,0x56e9af27,0xa04aa441, - 0x3cf7c899,0x92ecbae6,0xdd67016d,0x151682eb, - 0xa842eedf,0xfdba60b4,0xf1907b75,0x20e3030f, - 0x24d8c29e,0xe139673b,0xefa63fb8,0x71873054, - 0xb6f2cf3b,0x9f326442,0xcb15a4cc,0xb01a4504, - 0xf1e47d8d,0x844a1be5,0xbae7dfdc,0x42cbda70, - 0xcd7dae0a,0x57e85b7a,0xd53f5af6,0x20cf4d8c, - 0xcea4d428,0x79d130a4,0x3486ebfb,0x33d3cddc, - 0x77853b53,0x37effcb5,0xc5068778,0xe580b3e6, - 0x4e68b8f4,0xc5c8b37e,0x0d809ea2,0x398feb7c, - 0x132a4f94,0x43b7950e,0x2fee7d1c,0x223613bd, - 0xdd06caa2,0x37df932b,0xc4248289,0xacf3ebc3, - 0x5715f6b7,0xef3478dd,0xf267616f,0xc148cbe4, - 0x9052815e,0x5e410fab,0xb48a2465,0x2eda7fa4, - 0xe87b40e4,0xe98ea084,0x5889e9e1,0xefd390fc, - 0xdd07d35b,0xdb485694,0x38d7e5b2,0x57720101, - 0x730edebc,0x5b643113,0x94917e4f,0x503c2fba, - 0x646f1282,0x7523d24a,0xe0779695,0xf9c17a8f, - 0x7a5b2121,0xd187b896,0x29263a4d,0xba510cdf, - 0x81f47c9f,0xad1163ed,0xea7b5965,0x1a00726e, - 0x11403092,0x00da6d77,0x4a0cdd61,0xad1f4603, - 0x605bdfb0,0x9eedc364,0x22ebe6a8,0xcee7d28a, - 0xa0e736a0,0x5564a6b9,0x10853209,0xc7eb8f37, - 0x2de705ca,0x8951570f,0xdf09822b,0xbd691a6c, - 0xaa12e4f2,0x87451c0f,0xe0f6a27a,0x3ada4819, - 0x4cf1764f,0x0d771c2b,0x67cdb156,0x350d8384, - 0x5938fa0f,0x42399ef3,0x36997b07,0x0e84093d, - 0x4aa93e61,0x8360d87b,0x1fa98b0c,0x1149382c, - 0xe97625a5,0x0614d1b7,0x0e25244b,0x0c768347, - 0x589e8d82,0x0d2059d1,0xa466bb1e,0xf8da0a82, - 0x04f19130,0xba6e4ec0,0x99265164,0x1ee7230d, - 0x50b2ad80,0xeaee6801,0x8db2a283,0xea8bf59e, - }; +const CAST_LONG CAST_S_table0[256] = { + 0x30fb40d4, 0x9fa0ff0b, 0x6beccd2f, 0x3f258c7a, + 0x1e213f2f, 0x9c004dd3, 0x6003e540, 0xcf9fc949, + 0xbfd4af27, 0x88bbbdb5, 0xe2034090, 0x98d09675, + 0x6e63a0e0, 0x15c361d2, 0xc2e7661d, 0x22d4ff8e, + 0x28683b6f, 0xc07fd059, 0xff2379c8, 0x775f50e2, + 0x43c340d3, 0xdf2f8656, 0x887ca41a, 0xa2d2bd2d, + 0xa1c9e0d6, 0x346c4819, 0x61b76d87, 0x22540f2f, + 0x2abe32e1, 0xaa54166b, 0x22568e3a, 0xa2d341d0, + 0x66db40c8, 0xa784392f, 0x004dff2f, 0x2db9d2de, + 0x97943fac, 0x4a97c1d8, 0x527644b7, 0xb5f437a7, + 0xb82cbaef, 0xd751d159, 0x6ff7f0ed, 0x5a097a1f, + 0x827b68d0, 0x90ecf52e, 0x22b0c054, 0xbc8e5935, + 0x4b6d2f7f, 0x50bb64a2, 0xd2664910, 0xbee5812d, + 0xb7332290, 0xe93b159f, 0xb48ee411, 0x4bff345d, + 0xfd45c240, 0xad31973f, 0xc4f6d02e, 0x55fc8165, + 0xd5b1caad, 0xa1ac2dae, 0xa2d4b76d, 0xc19b0c50, + 0x882240f2, 0x0c6e4f38, 0xa4e4bfd7, 0x4f5ba272, + 0x564c1d2f, 0xc59c5319, 0xb949e354, 0xb04669fe, + 0xb1b6ab8a, 0xc71358dd, 0x6385c545, 0x110f935d, + 0x57538ad5, 0x6a390493, 0xe63d37e0, 0x2a54f6b3, + 0x3a787d5f, 0x6276a0b5, 0x19a6fcdf, 0x7a42206a, + 0x29f9d4d5, 0xf61b1891, 0xbb72275e, 0xaa508167, + 0x38901091, 0xc6b505eb, 0x84c7cb8c, 0x2ad75a0f, + 0x874a1427, 0xa2d1936b, 0x2ad286af, 0xaa56d291, + 0xd7894360, 0x425c750d, 0x93b39e26, 0x187184c9, + 0x6c00b32d, 0x73e2bb14, 0xa0bebc3c, 0x54623779, + 0x64459eab, 0x3f328b82, 0x7718cf82, 0x59a2cea6, + 0x04ee002e, 0x89fe78e6, 0x3fab0950, 0x325ff6c2, + 0x81383f05, 0x6963c5c8, 0x76cb5ad6, 0xd49974c9, + 0xca180dcf, 0x380782d5, 0xc7fa5cf6, 0x8ac31511, + 0x35e79e13, 0x47da91d0, 0xf40f9086, 0xa7e2419e, + 0x31366241, 0x051ef495, 0xaa573b04, 0x4a805d8d, + 0x548300d0, 0x00322a3c, 0xbf64cddf, 0xba57a68e, + 0x75c6372b, 0x50afd341, 0xa7c13275, 0x915a0bf5, + 0x6b54bfab, 0x2b0b1426, 0xab4cc9d7, 0x449ccd82, + 0xf7fbf265, 0xab85c5f3, 0x1b55db94, 0xaad4e324, + 0xcfa4bd3f, 0x2deaa3e2, 0x9e204d02, 0xc8bd25ac, + 0xeadf55b3, 0xd5bd9e98, 0xe31231b2, 0x2ad5ad6c, + 0x954329de, 0xadbe4528, 0xd8710f69, 0xaa51c90f, + 0xaa786bf6, 0x22513f1e, 0xaa51a79b, 0x2ad344cc, + 0x7b5a41f0, 0xd37cfbad, 0x1b069505, 0x41ece491, + 0xb4c332e6, 0x032268d4, 0xc9600acc, 0xce387e6d, + 0xbf6bb16c, 0x6a70fb78, 0x0d03d9c9, 0xd4df39de, + 0xe01063da, 0x4736f464, 0x5ad328d8, 0xb347cc96, + 0x75bb0fc3, 0x98511bfb, 0x4ffbcc35, 0xb58bcf6a, + 0xe11f0abc, 0xbfc5fe4a, 0xa70aec10, 0xac39570a, + 0x3f04442f, 0x6188b153, 0xe0397a2e, 0x5727cb79, + 0x9ceb418f, 0x1cacd68d, 0x2ad37c96, 0x0175cb9d, + 0xc69dff09, 0xc75b65f0, 0xd9db40d8, 0xec0e7779, + 0x4744ead4, 0xb11c3274, 0xdd24cb9e, 0x7e1c54bd, + 0xf01144f9, 0xd2240eb1, 0x9675b3fd, 0xa3ac3755, + 0xd47c27af, 0x51c85f4d, 0x56907596, 0xa5bb15e6, + 0x580304f0, 0xca042cf1, 0x011a37ea, 0x8dbfaadb, + 0x35ba3e4a, 0x3526ffa0, 0xc37b4d09, 0xbc306ed9, + 0x98a52666, 0x5648f725, 0xff5e569d, 0x0ced63d0, + 0x7c63b2cf, 0x700b45e1, 0xd5ea50f1, 0x85a92872, + 0xaf1fbda7, 0xd4234870, 0xa7870bf3, 0x2d3b4d79, + 0x42e04198, 0x0cd0ede7, 0x26470db8, 0xf881814c, + 0x474d6ad7, 0x7c0c5e5c, 0xd1231959, 0x381b7298, + 0xf5d2f4db, 0xab838653, 0x6e2f1e23, 0x83719c9e, + 0xbd91e046, 0x9a56456e, 0xdc39200c, 0x20c8c571, + 0x962bda1c, 0xe1e696ff, 0xb141ab08, 0x7cca89b9, + 0x1a69e783, 0x02cc4843, 0xa2f7c579, 0x429ef47d, + 0x427b169c, 0x5ac9f049, 0xdd8f0f00, 0x5c8165bf, +}; +const CAST_LONG CAST_S_table1[256] = { + 0x1f201094, 0xef0ba75b, 0x69e3cf7e, 0x393f4380, + 0xfe61cf7a, 0xeec5207a, 0x55889c94, 0x72fc0651, + 0xada7ef79, 0x4e1d7235, 0xd55a63ce, 0xde0436ba, + 0x99c430ef, 0x5f0c0794, 0x18dcdb7d, 0xa1d6eff3, + 0xa0b52f7b, 0x59e83605, 0xee15b094, 0xe9ffd909, + 0xdc440086, 0xef944459, 0xba83ccb3, 0xe0c3cdfb, + 0xd1da4181, 0x3b092ab1, 0xf997f1c1, 0xa5e6cf7b, + 0x01420ddb, 0xe4e7ef5b, 0x25a1ff41, 0xe180f806, + 0x1fc41080, 0x179bee7a, 0xd37ac6a9, 0xfe5830a4, + 0x98de8b7f, 0x77e83f4e, 0x79929269, 0x24fa9f7b, + 0xe113c85b, 0xacc40083, 0xd7503525, 0xf7ea615f, + 0x62143154, 0x0d554b63, 0x5d681121, 0xc866c359, + 0x3d63cf73, 0xcee234c0, 0xd4d87e87, 0x5c672b21, + 0x071f6181, 0x39f7627f, 0x361e3084, 0xe4eb573b, + 0x602f64a4, 0xd63acd9c, 0x1bbc4635, 0x9e81032d, + 0x2701f50c, 0x99847ab4, 0xa0e3df79, 0xba6cf38c, + 0x10843094, 0x2537a95e, 0xf46f6ffe, 0xa1ff3b1f, + 0x208cfb6a, 0x8f458c74, 0xd9e0a227, 0x4ec73a34, + 0xfc884f69, 0x3e4de8df, 0xef0e0088, 0x3559648d, + 0x8a45388c, 0x1d804366, 0x721d9bfd, 0xa58684bb, + 0xe8256333, 0x844e8212, 0x128d8098, 0xfed33fb4, + 0xce280ae1, 0x27e19ba5, 0xd5a6c252, 0xe49754bd, + 0xc5d655dd, 0xeb667064, 0x77840b4d, 0xa1b6a801, + 0x84db26a9, 0xe0b56714, 0x21f043b7, 0xe5d05860, + 0x54f03084, 0x066ff472, 0xa31aa153, 0xdadc4755, + 0xb5625dbf, 0x68561be6, 0x83ca6b94, 0x2d6ed23b, + 0xeccf01db, 0xa6d3d0ba, 0xb6803d5c, 0xaf77a709, + 0x33b4a34c, 0x397bc8d6, 0x5ee22b95, 0x5f0e5304, + 0x81ed6f61, 0x20e74364, 0xb45e1378, 0xde18639b, + 0x881ca122, 0xb96726d1, 0x8049a7e8, 0x22b7da7b, + 0x5e552d25, 0x5272d237, 0x79d2951c, 0xc60d894c, + 0x488cb402, 0x1ba4fe5b, 0xa4b09f6b, 0x1ca815cf, + 0xa20c3005, 0x8871df63, 0xb9de2fcb, 0x0cc6c9e9, + 0x0beeff53, 0xe3214517, 0xb4542835, 0x9f63293c, + 0xee41e729, 0x6e1d2d7c, 0x50045286, 0x1e6685f3, + 0xf33401c6, 0x30a22c95, 0x31a70850, 0x60930f13, + 0x73f98417, 0xa1269859, 0xec645c44, 0x52c877a9, + 0xcdff33a6, 0xa02b1741, 0x7cbad9a2, 0x2180036f, + 0x50d99c08, 0xcb3f4861, 0xc26bd765, 0x64a3f6ab, + 0x80342676, 0x25a75e7b, 0xe4e6d1fc, 0x20c710e6, + 0xcdf0b680, 0x17844d3b, 0x31eef84d, 0x7e0824e4, + 0x2ccb49eb, 0x846a3bae, 0x8ff77888, 0xee5d60f6, + 0x7af75673, 0x2fdd5cdb, 0xa11631c1, 0x30f66f43, + 0xb3faec54, 0x157fd7fa, 0xef8579cc, 0xd152de58, + 0xdb2ffd5e, 0x8f32ce19, 0x306af97a, 0x02f03ef8, + 0x99319ad5, 0xc242fa0f, 0xa7e3ebb0, 0xc68e4906, + 0xb8da230c, 0x80823028, 0xdcdef3c8, 0xd35fb171, + 0x088a1bc8, 0xbec0c560, 0x61a3c9e8, 0xbca8f54d, + 0xc72feffa, 0x22822e99, 0x82c570b4, 0xd8d94e89, + 0x8b1c34bc, 0x301e16e6, 0x273be979, 0xb0ffeaa6, + 0x61d9b8c6, 0x00b24869, 0xb7ffce3f, 0x08dc283b, + 0x43daf65a, 0xf7e19798, 0x7619b72f, 0x8f1c9ba4, + 0xdc8637a0, 0x16a7d3b1, 0x9fc393b7, 0xa7136eeb, + 0xc6bcc63e, 0x1a513742, 0xef6828bc, 0x520365d6, + 0x2d6a77ab, 0x3527ed4b, 0x821fd216, 0x095c6e2e, + 0xdb92f2fb, 0x5eea29cb, 0x145892f5, 0x91584f7f, + 0x5483697b, 0x2667a8cc, 0x85196048, 0x8c4bacea, + 0x833860d4, 0x0d23e0f9, 0x6c387e8a, 0x0ae6d249, + 0xb284600c, 0xd835731d, 0xdcb1c647, 0xac4c56ea, + 0x3ebd81b3, 0x230eabb0, 0x6438bc87, 0xf0b5b1fa, + 0x8f5ea2b3, 0xfc184642, 0x0a036b7a, 0x4fb089bd, + 0x649da589, 0xa345415e, 0x5c038323, 0x3e5d3bb9, + 0x43d79572, 0x7e6dd07c, 0x06dfdf1e, 0x6c6cc4ef, + 0x7160a539, 0x73bfbe70, 0x83877605, 0x4523ecf1, +}; +const CAST_LONG CAST_S_table2[256] = { + 0x8defc240, 0x25fa5d9f, 0xeb903dbf, 0xe810c907, + 0x47607fff, 0x369fe44b, 0x8c1fc644, 0xaececa90, + 0xbeb1f9bf, 0xeefbcaea, 0xe8cf1950, 0x51df07ae, + 0x920e8806, 0xf0ad0548, 0xe13c8d83, 0x927010d5, + 0x11107d9f, 0x07647db9, 0xb2e3e4d4, 0x3d4f285e, + 0xb9afa820, 0xfade82e0, 0xa067268b, 0x8272792e, + 0x553fb2c0, 0x489ae22b, 0xd4ef9794, 0x125e3fbc, + 0x21fffcee, 0x825b1bfd, 0x9255c5ed, 0x1257a240, + 0x4e1a8302, 0xbae07fff, 0x528246e7, 0x8e57140e, + 0x3373f7bf, 0x8c9f8188, 0xa6fc4ee8, 0xc982b5a5, + 0xa8c01db7, 0x579fc264, 0x67094f31, 0xf2bd3f5f, + 0x40fff7c1, 0x1fb78dfc, 0x8e6bd2c1, 0x437be59b, + 0x99b03dbf, 0xb5dbc64b, 0x638dc0e6, 0x55819d99, + 0xa197c81c, 0x4a012d6e, 0xc5884a28, 0xccc36f71, + 0xb843c213, 0x6c0743f1, 0x8309893c, 0x0feddd5f, + 0x2f7fe850, 0xd7c07f7e, 0x02507fbf, 0x5afb9a04, + 0xa747d2d0, 0x1651192e, 0xaf70bf3e, 0x58c31380, + 0x5f98302e, 0x727cc3c4, 0x0a0fb402, 0x0f7fef82, + 0x8c96fdad, 0x5d2c2aae, 0x8ee99a49, 0x50da88b8, + 0x8427f4a0, 0x1eac5790, 0x796fb449, 0x8252dc15, + 0xefbd7d9b, 0xa672597d, 0xada840d8, 0x45f54504, + 0xfa5d7403, 0xe83ec305, 0x4f91751a, 0x925669c2, + 0x23efe941, 0xa903f12e, 0x60270df2, 0x0276e4b6, + 0x94fd6574, 0x927985b2, 0x8276dbcb, 0x02778176, + 0xf8af918d, 0x4e48f79e, 0x8f616ddf, 0xe29d840e, + 0x842f7d83, 0x340ce5c8, 0x96bbb682, 0x93b4b148, + 0xef303cab, 0x984faf28, 0x779faf9b, 0x92dc560d, + 0x224d1e20, 0x8437aa88, 0x7d29dc96, 0x2756d3dc, + 0x8b907cee, 0xb51fd240, 0xe7c07ce3, 0xe566b4a1, + 0xc3e9615e, 0x3cf8209d, 0x6094d1e3, 0xcd9ca341, + 0x5c76460e, 0x00ea983b, 0xd4d67881, 0xfd47572c, + 0xf76cedd9, 0xbda8229c, 0x127dadaa, 0x438a074e, + 0x1f97c090, 0x081bdb8a, 0x93a07ebe, 0xb938ca15, + 0x97b03cff, 0x3dc2c0f8, 0x8d1ab2ec, 0x64380e51, + 0x68cc7bfb, 0xd90f2788, 0x12490181, 0x5de5ffd4, + 0xdd7ef86a, 0x76a2e214, 0xb9a40368, 0x925d958f, + 0x4b39fffa, 0xba39aee9, 0xa4ffd30b, 0xfaf7933b, + 0x6d498623, 0x193cbcfa, 0x27627545, 0x825cf47a, + 0x61bd8ba0, 0xd11e42d1, 0xcead04f4, 0x127ea392, + 0x10428db7, 0x8272a972, 0x9270c4a8, 0x127de50b, + 0x285ba1c8, 0x3c62f44f, 0x35c0eaa5, 0xe805d231, + 0x428929fb, 0xb4fcdf82, 0x4fb66a53, 0x0e7dc15b, + 0x1f081fab, 0x108618ae, 0xfcfd086d, 0xf9ff2889, + 0x694bcc11, 0x236a5cae, 0x12deca4d, 0x2c3f8cc5, + 0xd2d02dfe, 0xf8ef5896, 0xe4cf52da, 0x95155b67, + 0x494a488c, 0xb9b6a80c, 0x5c8f82bc, 0x89d36b45, + 0x3a609437, 0xec00c9a9, 0x44715253, 0x0a874b49, + 0xd773bc40, 0x7c34671c, 0x02717ef6, 0x4feb5536, + 0xa2d02fff, 0xd2bf60c4, 0xd43f03c0, 0x50b4ef6d, + 0x07478cd1, 0x006e1888, 0xa2e53f55, 0xb9e6d4bc, + 0xa2048016, 0x97573833, 0xd7207d67, 0xde0f8f3d, + 0x72f87b33, 0xabcc4f33, 0x7688c55d, 0x7b00a6b0, + 0x947b0001, 0x570075d2, 0xf9bb88f8, 0x8942019e, + 0x4264a5ff, 0x856302e0, 0x72dbd92b, 0xee971b69, + 0x6ea22fde, 0x5f08ae2b, 0xaf7a616d, 0xe5c98767, + 0xcf1febd2, 0x61efc8c2, 0xf1ac2571, 0xcc8239c2, + 0x67214cb8, 0xb1e583d1, 0xb7dc3e62, 0x7f10bdce, + 0xf90a5c38, 0x0ff0443d, 0x606e6dc6, 0x60543a49, + 0x5727c148, 0x2be98a1d, 0x8ab41738, 0x20e1be24, + 0xaf96da0f, 0x68458425, 0x99833be5, 0x600d457d, + 0x282f9350, 0x8334b362, 0xd91d1120, 0x2b6d8da0, + 0x642b1e31, 0x9c305a00, 0x52bce688, 0x1b03588a, + 0xf7baefd5, 0x4142ed9c, 0xa4315c11, 0x83323ec5, + 0xdfef4636, 0xa133c501, 0xe9d3531c, 0xee353783, +}; +const CAST_LONG CAST_S_table3[256] = { + 0x9db30420, 0x1fb6e9de, 0xa7be7bef, 0xd273a298, + 0x4a4f7bdb, 0x64ad8c57, 0x85510443, 0xfa020ed1, + 0x7e287aff, 0xe60fb663, 0x095f35a1, 0x79ebf120, + 0xfd059d43, 0x6497b7b1, 0xf3641f63, 0x241e4adf, + 0x28147f5f, 0x4fa2b8cd, 0xc9430040, 0x0cc32220, + 0xfdd30b30, 0xc0a5374f, 0x1d2d00d9, 0x24147b15, + 0xee4d111a, 0x0fca5167, 0x71ff904c, 0x2d195ffe, + 0x1a05645f, 0x0c13fefe, 0x081b08ca, 0x05170121, + 0x80530100, 0xe83e5efe, 0xac9af4f8, 0x7fe72701, + 0xd2b8ee5f, 0x06df4261, 0xbb9e9b8a, 0x7293ea25, + 0xce84ffdf, 0xf5718801, 0x3dd64b04, 0xa26f263b, + 0x7ed48400, 0x547eebe6, 0x446d4ca0, 0x6cf3d6f5, + 0x2649abdf, 0xaea0c7f5, 0x36338cc1, 0x503f7e93, + 0xd3772061, 0x11b638e1, 0x72500e03, 0xf80eb2bb, + 0xabe0502e, 0xec8d77de, 0x57971e81, 0xe14f6746, + 0xc9335400, 0x6920318f, 0x081dbb99, 0xffc304a5, + 0x4d351805, 0x7f3d5ce3, 0xa6c866c6, 0x5d5bcca9, + 0xdaec6fea, 0x9f926f91, 0x9f46222f, 0x3991467d, + 0xa5bf6d8e, 0x1143c44f, 0x43958302, 0xd0214eeb, + 0x022083b8, 0x3fb6180c, 0x18f8931e, 0x281658e6, + 0x26486e3e, 0x8bd78a70, 0x7477e4c1, 0xb506e07c, + 0xf32d0a25, 0x79098b02, 0xe4eabb81, 0x28123b23, + 0x69dead38, 0x1574ca16, 0xdf871b62, 0x211c40b7, + 0xa51a9ef9, 0x0014377b, 0x041e8ac8, 0x09114003, + 0xbd59e4d2, 0xe3d156d5, 0x4fe876d5, 0x2f91a340, + 0x557be8de, 0x00eae4a7, 0x0ce5c2ec, 0x4db4bba6, + 0xe756bdff, 0xdd3369ac, 0xec17b035, 0x06572327, + 0x99afc8b0, 0x56c8c391, 0x6b65811c, 0x5e146119, + 0x6e85cb75, 0xbe07c002, 0xc2325577, 0x893ff4ec, + 0x5bbfc92d, 0xd0ec3b25, 0xb7801ab7, 0x8d6d3b24, + 0x20c763ef, 0xc366a5fc, 0x9c382880, 0x0ace3205, + 0xaac9548a, 0xeca1d7c7, 0x041afa32, 0x1d16625a, + 0x6701902c, 0x9b757a54, 0x31d477f7, 0x9126b031, + 0x36cc6fdb, 0xc70b8b46, 0xd9e66a48, 0x56e55a79, + 0x026a4ceb, 0x52437eff, 0x2f8f76b4, 0x0df980a5, + 0x8674cde3, 0xedda04eb, 0x17a9be04, 0x2c18f4df, + 0xb7747f9d, 0xab2af7b4, 0xefc34d20, 0x2e096b7c, + 0x1741a254, 0xe5b6a035, 0x213d42f6, 0x2c1c7c26, + 0x61c2f50f, 0x6552daf9, 0xd2c231f8, 0x25130f69, + 0xd8167fa2, 0x0418f2c8, 0x001a96a6, 0x0d1526ab, + 0x63315c21, 0x5e0a72ec, 0x49bafefd, 0x187908d9, + 0x8d0dbd86, 0x311170a7, 0x3e9b640c, 0xcc3e10d7, + 0xd5cad3b6, 0x0caec388, 0xf73001e1, 0x6c728aff, + 0x71eae2a1, 0x1f9af36e, 0xcfcbd12f, 0xc1de8417, + 0xac07be6b, 0xcb44a1d8, 0x8b9b0f56, 0x013988c3, + 0xb1c52fca, 0xb4be31cd, 0xd8782806, 0x12a3a4e2, + 0x6f7de532, 0x58fd7eb6, 0xd01ee900, 0x24adffc2, + 0xf4990fc5, 0x9711aac5, 0x001d7b95, 0x82e5e7d2, + 0x109873f6, 0x00613096, 0xc32d9521, 0xada121ff, + 0x29908415, 0x7fbb977f, 0xaf9eb3db, 0x29c9ed2a, + 0x5ce2a465, 0xa730f32c, 0xd0aa3fe8, 0x8a5cc091, + 0xd49e2ce7, 0x0ce454a9, 0xd60acd86, 0x015f1919, + 0x77079103, 0xdea03af6, 0x78a8565e, 0xdee356df, + 0x21f05cbe, 0x8b75e387, 0xb3c50651, 0xb8a5c3ef, + 0xd8eeb6d2, 0xe523be77, 0xc2154529, 0x2f69efdf, + 0xafe67afb, 0xf470c4b2, 0xf3e0eb5b, 0xd6cc9876, + 0x39e4460c, 0x1fda8538, 0x1987832f, 0xca007367, + 0xa99144f8, 0x296b299e, 0x492fc295, 0x9266beab, + 0xb5676e69, 0x9bd3ddda, 0xdf7e052f, 0xdb25701c, + 0x1b5e51ee, 0xf65324e6, 0x6afce36c, 0x0316cc04, + 0x8644213e, 0xb7dc59d0, 0x7965291f, 0xccd6fd43, + 0x41823979, 0x932bcdf6, 0xb657c34d, 0x4edfd282, + 0x7ae5290c, 0x3cb9536b, 0x851e20fe, 0x9833557e, + 0x13ecf0b0, 0xd3ffb372, 0x3f85c5c1, 0x0aef7ed2, +}; +const CAST_LONG CAST_S_table4[256] = { + 0x7ec90c04, 0x2c6e74b9, 0x9b0e66df, 0xa6337911, + 0xb86a7fff, 0x1dd358f5, 0x44dd9d44, 0x1731167f, + 0x08fbf1fa, 0xe7f511cc, 0xd2051b00, 0x735aba00, + 0x2ab722d8, 0x386381cb, 0xacf6243a, 0x69befd7a, + 0xe6a2e77f, 0xf0c720cd, 0xc4494816, 0xccf5c180, + 0x38851640, 0x15b0a848, 0xe68b18cb, 0x4caadeff, + 0x5f480a01, 0x0412b2aa, 0x259814fc, 0x41d0efe2, + 0x4e40b48d, 0x248eb6fb, 0x8dba1cfe, 0x41a99b02, + 0x1a550a04, 0xba8f65cb, 0x7251f4e7, 0x95a51725, + 0xc106ecd7, 0x97a5980a, 0xc539b9aa, 0x4d79fe6a, + 0xf2f3f763, 0x68af8040, 0xed0c9e56, 0x11b4958b, + 0xe1eb5a88, 0x8709e6b0, 0xd7e07156, 0x4e29fea7, + 0x6366e52d, 0x02d1c000, 0xc4ac8e05, 0x9377f571, + 0x0c05372a, 0x578535f2, 0x2261be02, 0xd642a0c9, + 0xdf13a280, 0x74b55bd2, 0x682199c0, 0xd421e5ec, + 0x53fb3ce8, 0xc8adedb3, 0x28a87fc9, 0x3d959981, + 0x5c1ff900, 0xfe38d399, 0x0c4eff0b, 0x062407ea, + 0xaa2f4fb1, 0x4fb96976, 0x90c79505, 0xb0a8a774, + 0xef55a1ff, 0xe59ca2c2, 0xa6b62d27, 0xe66a4263, + 0xdf65001f, 0x0ec50966, 0xdfdd55bc, 0x29de0655, + 0x911e739a, 0x17af8975, 0x32c7911c, 0x89f89468, + 0x0d01e980, 0x524755f4, 0x03b63cc9, 0x0cc844b2, + 0xbcf3f0aa, 0x87ac36e9, 0xe53a7426, 0x01b3d82b, + 0x1a9e7449, 0x64ee2d7e, 0xcddbb1da, 0x01c94910, + 0xb868bf80, 0x0d26f3fd, 0x9342ede7, 0x04a5c284, + 0x636737b6, 0x50f5b616, 0xf24766e3, 0x8eca36c1, + 0x136e05db, 0xfef18391, 0xfb887a37, 0xd6e7f7d4, + 0xc7fb7dc9, 0x3063fcdf, 0xb6f589de, 0xec2941da, + 0x26e46695, 0xb7566419, 0xf654efc5, 0xd08d58b7, + 0x48925401, 0xc1bacb7f, 0xe5ff550f, 0xb6083049, + 0x5bb5d0e8, 0x87d72e5a, 0xab6a6ee1, 0x223a66ce, + 0xc62bf3cd, 0x9e0885f9, 0x68cb3e47, 0x086c010f, + 0xa21de820, 0xd18b69de, 0xf3f65777, 0xfa02c3f6, + 0x407edac3, 0xcbb3d550, 0x1793084d, 0xb0d70eba, + 0x0ab378d5, 0xd951fb0c, 0xded7da56, 0x4124bbe4, + 0x94ca0b56, 0x0f5755d1, 0xe0e1e56e, 0x6184b5be, + 0x580a249f, 0x94f74bc0, 0xe327888e, 0x9f7b5561, + 0xc3dc0280, 0x05687715, 0x646c6bd7, 0x44904db3, + 0x66b4f0a3, 0xc0f1648a, 0x697ed5af, 0x49e92ff6, + 0x309e374f, 0x2cb6356a, 0x85808573, 0x4991f840, + 0x76f0ae02, 0x083be84d, 0x28421c9a, 0x44489406, + 0x736e4cb8, 0xc1092910, 0x8bc95fc6, 0x7d869cf4, + 0x134f616f, 0x2e77118d, 0xb31b2be1, 0xaa90b472, + 0x3ca5d717, 0x7d161bba, 0x9cad9010, 0xaf462ba2, + 0x9fe459d2, 0x45d34559, 0xd9f2da13, 0xdbc65487, + 0xf3e4f94e, 0x176d486f, 0x097c13ea, 0x631da5c7, + 0x445f7382, 0x175683f4, 0xcdc66a97, 0x70be0288, + 0xb3cdcf72, 0x6e5dd2f3, 0x20936079, 0x459b80a5, + 0xbe60e2db, 0xa9c23101, 0xeba5315c, 0x224e42f2, + 0x1c5c1572, 0xf6721b2c, 0x1ad2fff3, 0x8c25404e, + 0x324ed72f, 0x4067b7fd, 0x0523138e, 0x5ca3bc78, + 0xdc0fd66e, 0x75922283, 0x784d6b17, 0x58ebb16e, + 0x44094f85, 0x3f481d87, 0xfcfeae7b, 0x77b5ff76, + 0x8c2302bf, 0xaaf47556, 0x5f46b02a, 0x2b092801, + 0x3d38f5f7, 0x0ca81f36, 0x52af4a8a, 0x66d5e7c0, + 0xdf3b0874, 0x95055110, 0x1b5ad7a8, 0xf61ed5ad, + 0x6cf6e479, 0x20758184, 0xd0cefa65, 0x88f7be58, + 0x4a046826, 0x0ff6f8f3, 0xa09c7f70, 0x5346aba0, + 0x5ce96c28, 0xe176eda3, 0x6bac307f, 0x376829d2, + 0x85360fa9, 0x17e3fe2a, 0x24b79767, 0xf5a96b20, + 0xd6cd2595, 0x68ff1ebf, 0x7555442c, 0xf19f06be, + 0xf9e0659a, 0xeeb9491d, 0x34010718, 0xbb30cab8, + 0xe822fe15, 0x88570983, 0x750e6249, 0xda627e55, + 0x5e76ffa8, 0xb1534546, 0x6d47de08, 0xefe9e7d4, +}; +const CAST_LONG CAST_S_table5[256] = { + 0xf6fa8f9d, 0x2cac6ce1, 0x4ca34867, 0xe2337f7c, + 0x95db08e7, 0x016843b4, 0xeced5cbc, 0x325553ac, + 0xbf9f0960, 0xdfa1e2ed, 0x83f0579d, 0x63ed86b9, + 0x1ab6a6b8, 0xde5ebe39, 0xf38ff732, 0x8989b138, + 0x33f14961, 0xc01937bd, 0xf506c6da, 0xe4625e7e, + 0xa308ea99, 0x4e23e33c, 0x79cbd7cc, 0x48a14367, + 0xa3149619, 0xfec94bd5, 0xa114174a, 0xeaa01866, + 0xa084db2d, 0x09a8486f, 0xa888614a, 0x2900af98, + 0x01665991, 0xe1992863, 0xc8f30c60, 0x2e78ef3c, + 0xd0d51932, 0xcf0fec14, 0xf7ca07d2, 0xd0a82072, + 0xfd41197e, 0x9305a6b0, 0xe86be3da, 0x74bed3cd, + 0x372da53c, 0x4c7f4448, 0xdab5d440, 0x6dba0ec3, + 0x083919a7, 0x9fbaeed9, 0x49dbcfb0, 0x4e670c53, + 0x5c3d9c01, 0x64bdb941, 0x2c0e636a, 0xba7dd9cd, + 0xea6f7388, 0xe70bc762, 0x35f29adb, 0x5c4cdd8d, + 0xf0d48d8c, 0xb88153e2, 0x08a19866, 0x1ae2eac8, + 0x284caf89, 0xaa928223, 0x9334be53, 0x3b3a21bf, + 0x16434be3, 0x9aea3906, 0xefe8c36e, 0xf890cdd9, + 0x80226dae, 0xc340a4a3, 0xdf7e9c09, 0xa694a807, + 0x5b7c5ecc, 0x221db3a6, 0x9a69a02f, 0x68818a54, + 0xceb2296f, 0x53c0843a, 0xfe893655, 0x25bfe68a, + 0xb4628abc, 0xcf222ebf, 0x25ac6f48, 0xa9a99387, + 0x53bddb65, 0xe76ffbe7, 0xe967fd78, 0x0ba93563, + 0x8e342bc1, 0xe8a11be9, 0x4980740d, 0xc8087dfc, + 0x8de4bf99, 0xa11101a0, 0x7fd37975, 0xda5a26c0, + 0xe81f994f, 0x9528cd89, 0xfd339fed, 0xb87834bf, + 0x5f04456d, 0x22258698, 0xc9c4c83b, 0x2dc156be, + 0x4f628daa, 0x57f55ec5, 0xe2220abe, 0xd2916ebf, + 0x4ec75b95, 0x24f2c3c0, 0x42d15d99, 0xcd0d7fa0, + 0x7b6e27ff, 0xa8dc8af0, 0x7345c106, 0xf41e232f, + 0x35162386, 0xe6ea8926, 0x3333b094, 0x157ec6f2, + 0x372b74af, 0x692573e4, 0xe9a9d848, 0xf3160289, + 0x3a62ef1d, 0xa787e238, 0xf3a5f676, 0x74364853, + 0x20951063, 0x4576698d, 0xb6fad407, 0x592af950, + 0x36f73523, 0x4cfb6e87, 0x7da4cec0, 0x6c152daa, + 0xcb0396a8, 0xc50dfe5d, 0xfcd707ab, 0x0921c42f, + 0x89dff0bb, 0x5fe2be78, 0x448f4f33, 0x754613c9, + 0x2b05d08d, 0x48b9d585, 0xdc049441, 0xc8098f9b, + 0x7dede786, 0xc39a3373, 0x42410005, 0x6a091751, + 0x0ef3c8a6, 0x890072d6, 0x28207682, 0xa9a9f7be, + 0xbf32679d, 0xd45b5b75, 0xb353fd00, 0xcbb0e358, + 0x830f220a, 0x1f8fb214, 0xd372cf08, 0xcc3c4a13, + 0x8cf63166, 0x061c87be, 0x88c98f88, 0x6062e397, + 0x47cf8e7a, 0xb6c85283, 0x3cc2acfb, 0x3fc06976, + 0x4e8f0252, 0x64d8314d, 0xda3870e3, 0x1e665459, + 0xc10908f0, 0x513021a5, 0x6c5b68b7, 0x822f8aa0, + 0x3007cd3e, 0x74719eef, 0xdc872681, 0x073340d4, + 0x7e432fd9, 0x0c5ec241, 0x8809286c, 0xf592d891, + 0x08a930f6, 0x957ef305, 0xb7fbffbd, 0xc266e96f, + 0x6fe4ac98, 0xb173ecc0, 0xbc60b42a, 0x953498da, + 0xfba1ae12, 0x2d4bd736, 0x0f25faab, 0xa4f3fceb, + 0xe2969123, 0x257f0c3d, 0x9348af49, 0x361400bc, + 0xe8816f4a, 0x3814f200, 0xa3f94043, 0x9c7a54c2, + 0xbc704f57, 0xda41e7f9, 0xc25ad33a, 0x54f4a084, + 0xb17f5505, 0x59357cbe, 0xedbd15c8, 0x7f97c5ab, + 0xba5ac7b5, 0xb6f6deaf, 0x3a479c3a, 0x5302da25, + 0x653d7e6a, 0x54268d49, 0x51a477ea, 0x5017d55b, + 0xd7d25d88, 0x44136c76, 0x0404a8c8, 0xb8e5a121, + 0xb81a928a, 0x60ed5869, 0x97c55b96, 0xeaec991b, + 0x29935913, 0x01fdb7f1, 0x088e8dfa, 0x9ab6f6f5, + 0x3b4cbf9f, 0x4a5de3ab, 0xe6051d35, 0xa0e1d855, + 0xd36b4cf1, 0xf544edeb, 0xb0e93524, 0xbebb8fbd, + 0xa2d762cf, 0x49c92f54, 0x38b5f331, 0x7128a454, + 0x48392905, 0xa65b1db8, 0x851c97bd, 0xd675cf2f, +}; +const CAST_LONG CAST_S_table6[256] = { + 0x85e04019, 0x332bf567, 0x662dbfff, 0xcfc65693, + 0x2a8d7f6f, 0xab9bc912, 0xde6008a1, 0x2028da1f, + 0x0227bce7, 0x4d642916, 0x18fac300, 0x50f18b82, + 0x2cb2cb11, 0xb232e75c, 0x4b3695f2, 0xb28707de, + 0xa05fbcf6, 0xcd4181e9, 0xe150210c, 0xe24ef1bd, + 0xb168c381, 0xfde4e789, 0x5c79b0d8, 0x1e8bfd43, + 0x4d495001, 0x38be4341, 0x913cee1d, 0x92a79c3f, + 0x089766be, 0xbaeeadf4, 0x1286becf, 0xb6eacb19, + 0x2660c200, 0x7565bde4, 0x64241f7a, 0x8248dca9, + 0xc3b3ad66, 0x28136086, 0x0bd8dfa8, 0x356d1cf2, + 0x107789be, 0xb3b2e9ce, 0x0502aa8f, 0x0bc0351e, + 0x166bf52a, 0xeb12ff82, 0xe3486911, 0xd34d7516, + 0x4e7b3aff, 0x5f43671b, 0x9cf6e037, 0x4981ac83, + 0x334266ce, 0x8c9341b7, 0xd0d854c0, 0xcb3a6c88, + 0x47bc2829, 0x4725ba37, 0xa66ad22b, 0x7ad61f1e, + 0x0c5cbafa, 0x4437f107, 0xb6e79962, 0x42d2d816, + 0x0a961288, 0xe1a5c06e, 0x13749e67, 0x72fc081a, + 0xb1d139f7, 0xf9583745, 0xcf19df58, 0xbec3f756, + 0xc06eba30, 0x07211b24, 0x45c28829, 0xc95e317f, + 0xbc8ec511, 0x38bc46e9, 0xc6e6fa14, 0xbae8584a, + 0xad4ebc46, 0x468f508b, 0x7829435f, 0xf124183b, + 0x821dba9f, 0xaff60ff4, 0xea2c4e6d, 0x16e39264, + 0x92544a8b, 0x009b4fc3, 0xaba68ced, 0x9ac96f78, + 0x06a5b79a, 0xb2856e6e, 0x1aec3ca9, 0xbe838688, + 0x0e0804e9, 0x55f1be56, 0xe7e5363b, 0xb3a1f25d, + 0xf7debb85, 0x61fe033c, 0x16746233, 0x3c034c28, + 0xda6d0c74, 0x79aac56c, 0x3ce4e1ad, 0x51f0c802, + 0x98f8f35a, 0x1626a49f, 0xeed82b29, 0x1d382fe3, + 0x0c4fb99a, 0xbb325778, 0x3ec6d97b, 0x6e77a6a9, + 0xcb658b5c, 0xd45230c7, 0x2bd1408b, 0x60c03eb7, + 0xb9068d78, 0xa33754f4, 0xf430c87d, 0xc8a71302, + 0xb96d8c32, 0xebd4e7be, 0xbe8b9d2d, 0x7979fb06, + 0xe7225308, 0x8b75cf77, 0x11ef8da4, 0xe083c858, + 0x8d6b786f, 0x5a6317a6, 0xfa5cf7a0, 0x5dda0033, + 0xf28ebfb0, 0xf5b9c310, 0xa0eac280, 0x08b9767a, + 0xa3d9d2b0, 0x79d34217, 0x021a718d, 0x9ac6336a, + 0x2711fd60, 0x438050e3, 0x069908a8, 0x3d7fedc4, + 0x826d2bef, 0x4eeb8476, 0x488dcf25, 0x36c9d566, + 0x28e74e41, 0xc2610aca, 0x3d49a9cf, 0xbae3b9df, + 0xb65f8de6, 0x92aeaf64, 0x3ac7d5e6, 0x9ea80509, + 0xf22b017d, 0xa4173f70, 0xdd1e16c3, 0x15e0d7f9, + 0x50b1b887, 0x2b9f4fd5, 0x625aba82, 0x6a017962, + 0x2ec01b9c, 0x15488aa9, 0xd716e740, 0x40055a2c, + 0x93d29a22, 0xe32dbf9a, 0x058745b9, 0x3453dc1e, + 0xd699296e, 0x496cff6f, 0x1c9f4986, 0xdfe2ed07, + 0xb87242d1, 0x19de7eae, 0x053e561a, 0x15ad6f8c, + 0x66626c1c, 0x7154c24c, 0xea082b2a, 0x93eb2939, + 0x17dcb0f0, 0x58d4f2ae, 0x9ea294fb, 0x52cf564c, + 0x9883fe66, 0x2ec40581, 0x763953c3, 0x01d6692e, + 0xd3a0c108, 0xa1e7160e, 0xe4f2dfa6, 0x693ed285, + 0x74904698, 0x4c2b0edd, 0x4f757656, 0x5d393378, + 0xa132234f, 0x3d321c5d, 0xc3f5e194, 0x4b269301, + 0xc79f022f, 0x3c997e7e, 0x5e4f9504, 0x3ffafbbd, + 0x76f7ad0e, 0x296693f4, 0x3d1fce6f, 0xc61e45be, + 0xd3b5ab34, 0xf72bf9b7, 0x1b0434c0, 0x4e72b567, + 0x5592a33d, 0xb5229301, 0xcfd2a87f, 0x60aeb767, + 0x1814386b, 0x30bcc33d, 0x38a0c07d, 0xfd1606f2, + 0xc363519b, 0x589dd390, 0x5479f8e6, 0x1cb8d647, + 0x97fd61a9, 0xea7759f4, 0x2d57539d, 0x569a58cf, + 0xe84e63ad, 0x462e1b78, 0x6580f87e, 0xf3817914, + 0x91da55f4, 0x40a230f3, 0xd1988f35, 0xb6e318d2, + 0x3ffa50bc, 0x3d40f021, 0xc3c0bdae, 0x4958c24c, + 0x518f36b2, 0x84b1d370, 0x0fedce83, 0x878ddada, + 0xf2a279c7, 0x94e01be8, 0x90716f4b, 0x954b8aa3, +}; +const CAST_LONG CAST_S_table7[256] = { + 0xe216300d, 0xbbddfffc, 0xa7ebdabd, 0x35648095, + 0x7789f8b7, 0xe6c1121b, 0x0e241600, 0x052ce8b5, + 0x11a9cfb0, 0xe5952f11, 0xece7990a, 0x9386d174, + 0x2a42931c, 0x76e38111, 0xb12def3a, 0x37ddddfc, + 0xde9adeb1, 0x0a0cc32c, 0xbe197029, 0x84a00940, + 0xbb243a0f, 0xb4d137cf, 0xb44e79f0, 0x049eedfd, + 0x0b15a15d, 0x480d3168, 0x8bbbde5a, 0x669ded42, + 0xc7ece831, 0x3f8f95e7, 0x72df191b, 0x7580330d, + 0x94074251, 0x5c7dcdfa, 0xabbe6d63, 0xaa402164, + 0xb301d40a, 0x02e7d1ca, 0x53571dae, 0x7a3182a2, + 0x12a8ddec, 0xfdaa335d, 0x176f43e8, 0x71fb46d4, + 0x38129022, 0xce949ad4, 0xb84769ad, 0x965bd862, + 0x82f3d055, 0x66fb9767, 0x15b80b4e, 0x1d5b47a0, + 0x4cfde06f, 0xc28ec4b8, 0x57e8726e, 0x647a78fc, + 0x99865d44, 0x608bd593, 0x6c200e03, 0x39dc5ff6, + 0x5d0b00a3, 0xae63aff2, 0x7e8bd632, 0x70108c0c, + 0xbbd35049, 0x2998df04, 0x980cf42a, 0x9b6df491, + 0x9e7edd53, 0x06918548, 0x58cb7e07, 0x3b74ef2e, + 0x522fffb1, 0xd24708cc, 0x1c7e27cd, 0xa4eb215b, + 0x3cf1d2e2, 0x19b47a38, 0x424f7618, 0x35856039, + 0x9d17dee7, 0x27eb35e6, 0xc9aff67b, 0x36baf5b8, + 0x09c467cd, 0xc18910b1, 0xe11dbf7b, 0x06cd1af8, + 0x7170c608, 0x2d5e3354, 0xd4de495a, 0x64c6d006, + 0xbcc0c62c, 0x3dd00db3, 0x708f8f34, 0x77d51b42, + 0x264f620f, 0x24b8d2bf, 0x15c1b79e, 0x46a52564, + 0xf8d7e54e, 0x3e378160, 0x7895cda5, 0x859c15a5, + 0xe6459788, 0xc37bc75f, 0xdb07ba0c, 0x0676a3ab, + 0x7f229b1e, 0x31842e7b, 0x24259fd7, 0xf8bef472, + 0x835ffcb8, 0x6df4c1f2, 0x96f5b195, 0xfd0af0fc, + 0xb0fe134c, 0xe2506d3d, 0x4f9b12ea, 0xf215f225, + 0xa223736f, 0x9fb4c428, 0x25d04979, 0x34c713f8, + 0xc4618187, 0xea7a6e98, 0x7cd16efc, 0x1436876c, + 0xf1544107, 0xbedeee14, 0x56e9af27, 0xa04aa441, + 0x3cf7c899, 0x92ecbae6, 0xdd67016d, 0x151682eb, + 0xa842eedf, 0xfdba60b4, 0xf1907b75, 0x20e3030f, + 0x24d8c29e, 0xe139673b, 0xefa63fb8, 0x71873054, + 0xb6f2cf3b, 0x9f326442, 0xcb15a4cc, 0xb01a4504, + 0xf1e47d8d, 0x844a1be5, 0xbae7dfdc, 0x42cbda70, + 0xcd7dae0a, 0x57e85b7a, 0xd53f5af6, 0x20cf4d8c, + 0xcea4d428, 0x79d130a4, 0x3486ebfb, 0x33d3cddc, + 0x77853b53, 0x37effcb5, 0xc5068778, 0xe580b3e6, + 0x4e68b8f4, 0xc5c8b37e, 0x0d809ea2, 0x398feb7c, + 0x132a4f94, 0x43b7950e, 0x2fee7d1c, 0x223613bd, + 0xdd06caa2, 0x37df932b, 0xc4248289, 0xacf3ebc3, + 0x5715f6b7, 0xef3478dd, 0xf267616f, 0xc148cbe4, + 0x9052815e, 0x5e410fab, 0xb48a2465, 0x2eda7fa4, + 0xe87b40e4, 0xe98ea084, 0x5889e9e1, 0xefd390fc, + 0xdd07d35b, 0xdb485694, 0x38d7e5b2, 0x57720101, + 0x730edebc, 0x5b643113, 0x94917e4f, 0x503c2fba, + 0x646f1282, 0x7523d24a, 0xe0779695, 0xf9c17a8f, + 0x7a5b2121, 0xd187b896, 0x29263a4d, 0xba510cdf, + 0x81f47c9f, 0xad1163ed, 0xea7b5965, 0x1a00726e, + 0x11403092, 0x00da6d77, 0x4a0cdd61, 0xad1f4603, + 0x605bdfb0, 0x9eedc364, 0x22ebe6a8, 0xcee7d28a, + 0xa0e736a0, 0x5564a6b9, 0x10853209, 0xc7eb8f37, + 0x2de705ca, 0x8951570f, 0xdf09822b, 0xbd691a6c, + 0xaa12e4f2, 0x87451c0f, 0xe0f6a27a, 0x3ada4819, + 0x4cf1764f, 0x0d771c2b, 0x67cdb156, 0x350d8384, + 0x5938fa0f, 0x42399ef3, 0x36997b07, 0x0e84093d, + 0x4aa93e61, 0x8360d87b, 0x1fa98b0c, 0x1149382c, + 0xe97625a5, 0x0614d1b7, 0x0e25244b, 0x0c768347, + 0x589e8d82, 0x0d2059d1, 0xa466bb1e, 0xf8da0a82, + 0x04f19130, 0xba6e4ec0, 0x99265164, 0x1ee7230d, + 0x50b2ad80, 0xeaee6801, 0x8db2a283, 0xea8bf59e, +}; __END_HIDDEN_DECLS diff --git a/lib/libcrypto/chacha/chacha-merged.c b/lib/libcrypto/chacha/chacha-merged.c index d24912daa..b405af84e 100644 --- a/lib/libcrypto/chacha/chacha-merged.c +++ b/lib/libcrypto/chacha/chacha-merged.c @@ -1,4 +1,4 @@ -/* $OpenBSD: chacha-merged.c,v 1.10 2021/10/22 17:43:00 tb Exp $ */ +/* $OpenBSD: chacha-merged.c,v 1.11 2023/07/07 19:37:53 beck Exp $ */ /* chacha-merged.c version 20080118 D. J. Bernstein @@ -320,3 +320,4 @@ CRYPTO_hchacha_20(unsigned char subkey[32], const unsigned char key[32], U32TO8_LITTLE(subkey + 24, x[14]); U32TO8_LITTLE(subkey + 28, x[15]); } +LCRYPTO_ALIAS(CRYPTO_hchacha_20); diff --git a/lib/libcrypto/cmac/cmac.c b/lib/libcrypto/cmac/cmac.c index 7135f5306..9c05a98e1 100644 --- a/lib/libcrypto/cmac/cmac.c +++ b/lib/libcrypto/cmac/cmac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmac.c,v 1.13 2022/12/26 07:18:51 jmc Exp $ */ +/* $OpenBSD: cmac.c,v 1.14 2023/07/08 14:27:14 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. */ @@ -104,6 +104,7 @@ CMAC_CTX_new(void) ctx->nlast_block = -1; return ctx; } +LCRYPTO_ALIAS(CMAC_CTX_new); void CMAC_CTX_cleanup(CMAC_CTX *ctx) @@ -115,12 +116,14 @@ CMAC_CTX_cleanup(CMAC_CTX *ctx) explicit_bzero(ctx->last_block, EVP_MAX_BLOCK_LENGTH); ctx->nlast_block = -1; } +LCRYPTO_ALIAS(CMAC_CTX_cleanup); EVP_CIPHER_CTX * CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx) { return &ctx->cctx; } +LCRYPTO_ALIAS(CMAC_CTX_get0_cipher_ctx); void CMAC_CTX_free(CMAC_CTX *ctx) @@ -131,6 +134,7 @@ CMAC_CTX_free(CMAC_CTX *ctx) CMAC_CTX_cleanup(ctx); free(ctx); } +LCRYPTO_ALIAS(CMAC_CTX_free); int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in) @@ -149,6 +153,7 @@ CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in) out->nlast_block = in->nlast_block; return 1; } +LCRYPTO_ALIAS(CMAC_CTX_copy); int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, @@ -195,6 +200,7 @@ CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, } return 1; } +LCRYPTO_ALIAS(CMAC_Init); int CMAC_Update(CMAC_CTX *ctx, const void *in, size_t dlen) @@ -237,6 +243,7 @@ CMAC_Update(CMAC_CTX *ctx, const void *in, size_t dlen) ctx->nlast_block = dlen; return 1; } +LCRYPTO_ALIAS(CMAC_Update); int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen) @@ -267,6 +274,7 @@ CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen) } return 1; } +LCRYPTO_ALIAS(CMAC_Final); int CMAC_resume(CMAC_CTX *ctx) @@ -281,3 +289,4 @@ CMAC_resume(CMAC_CTX *ctx) */ return EVP_EncryptInit_ex(&ctx->cctx, NULL, NULL, NULL, ctx->tbl); } +LCRYPTO_ALIAS(CMAC_resume); diff --git a/lib/libcrypto/cms/cms_asn1.c b/lib/libcrypto/cms/cms_asn1.c index 7948a3c39..531b8c587 100644 --- a/lib/libcrypto/cms/cms_asn1.c +++ b/lib/libcrypto/cms/cms_asn1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cms_asn1.c,v 1.22 2023/05/23 06:55:31 tb Exp $ */ +/* $OpenBSD: cms_asn1.c,v 1.23 2023/07/08 08:26:26 beck Exp $ */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. @@ -1619,3 +1619,4 @@ CMS_SharedInfo_encode(unsigned char **pder, X509_ALGOR *kekalg, return ASN1_item_i2d(intsi.a, pder, &CMS_SharedInfo_it); } +LCRYPTO_ALIAS(CMS_SharedInfo_encode); diff --git a/lib/libcrypto/cms/cms_att.c b/lib/libcrypto/cms/cms_att.c index 0fb077f7d..62362ad3f 100644 --- a/lib/libcrypto/cms/cms_att.c +++ b/lib/libcrypto/cms/cms_att.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cms_att.c,v 1.10 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: cms_att.c,v 1.11 2023/07/08 08:26:26 beck Exp $ */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. @@ -66,12 +66,14 @@ CMS_signed_get_attr_count(const CMS_SignerInfo *si) { return X509at_get_attr_count(si->signedAttrs); } +LCRYPTO_ALIAS(CMS_signed_get_attr_count); int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid, int lastpos) { return X509at_get_attr_by_NID(si->signedAttrs, nid, lastpos); } +LCRYPTO_ALIAS(CMS_signed_get_attr_by_NID); int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj, @@ -79,18 +81,21 @@ CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj, { return X509at_get_attr_by_OBJ(si->signedAttrs, obj, lastpos); } +LCRYPTO_ALIAS(CMS_signed_get_attr_by_OBJ); X509_ATTRIBUTE * CMS_signed_get_attr(const CMS_SignerInfo *si, int loc) { return X509at_get_attr(si->signedAttrs, loc); } +LCRYPTO_ALIAS(CMS_signed_get_attr); X509_ATTRIBUTE * CMS_signed_delete_attr(CMS_SignerInfo *si, int loc) { return X509at_delete_attr(si->signedAttrs, loc); } +LCRYPTO_ALIAS(CMS_signed_delete_attr); int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr) @@ -99,6 +104,7 @@ CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr) return 1; return 0; } +LCRYPTO_ALIAS(CMS_signed_add1_attr); int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *obj, int type, @@ -108,6 +114,7 @@ CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *obj, int type return 1; return 0; } +LCRYPTO_ALIAS(CMS_signed_add1_attr_by_OBJ); int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si, int nid, int type, @@ -117,6 +124,7 @@ CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si, int nid, int type, return 1; return 0; } +LCRYPTO_ALIAS(CMS_signed_add1_attr_by_NID); int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si, const char *attrname, int type, @@ -126,6 +134,7 @@ CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si, const char *attrname, int type, return 1; return 0; } +LCRYPTO_ALIAS(CMS_signed_add1_attr_by_txt); void * CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *oid, @@ -133,18 +142,21 @@ CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *oid, { return X509at_get0_data_by_OBJ(si->signedAttrs, oid, lastpos, type); } +LCRYPTO_ALIAS(CMS_signed_get0_data_by_OBJ); int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si) { return X509at_get_attr_count(si->unsignedAttrs); } +LCRYPTO_ALIAS(CMS_unsigned_get_attr_count); int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid, int lastpos) { return X509at_get_attr_by_NID(si->unsignedAttrs, nid, lastpos); } +LCRYPTO_ALIAS(CMS_unsigned_get_attr_by_NID); int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj, @@ -152,18 +164,21 @@ CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj, { return X509at_get_attr_by_OBJ(si->unsignedAttrs, obj, lastpos); } +LCRYPTO_ALIAS(CMS_unsigned_get_attr_by_OBJ); X509_ATTRIBUTE * CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc) { return X509at_get_attr(si->unsignedAttrs, loc); } +LCRYPTO_ALIAS(CMS_unsigned_get_attr); X509_ATTRIBUTE * CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc) { return X509at_delete_attr(si->unsignedAttrs, loc); } +LCRYPTO_ALIAS(CMS_unsigned_delete_attr); int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr) @@ -172,6 +187,7 @@ CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr) return 1; return 0; } +LCRYPTO_ALIAS(CMS_unsigned_add1_attr); int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *obj, @@ -181,6 +197,7 @@ CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *obj, return 1; return 0; } +LCRYPTO_ALIAS(CMS_unsigned_add1_attr_by_OBJ); int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si, int nid, int type, @@ -190,6 +207,7 @@ CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si, int nid, int type, return 1; return 0; } +LCRYPTO_ALIAS(CMS_unsigned_add1_attr_by_NID); int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si, const char *attrname, @@ -200,6 +218,7 @@ CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si, const char *attrname, return 1; return 0; } +LCRYPTO_ALIAS(CMS_unsigned_add1_attr_by_txt); void * CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid, int lastpos, @@ -207,5 +226,6 @@ CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid, int lastpos, { return X509at_get0_data_by_OBJ(si->unsignedAttrs, oid, lastpos, type); } +LCRYPTO_ALIAS(CMS_unsigned_get0_data_by_OBJ); /* Specific attribute cases */ diff --git a/lib/libcrypto/cms/cms_enc.c b/lib/libcrypto/cms/cms_enc.c index 06dffcbed..547f9ff74 100644 --- a/lib/libcrypto/cms/cms_enc.c +++ b/lib/libcrypto/cms/cms_enc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cms_enc.c,v 1.22 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: cms_enc.c,v 1.23 2023/07/08 08:26:26 beck Exp $ */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. @@ -249,6 +249,7 @@ CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph, return cms_EncryptedContent_init(ec, ciph, key, keylen); } +LCRYPTO_ALIAS(CMS_EncryptedData_set1_key); BIO * cms_EncryptedData_init_bio(CMS_ContentInfo *cms) diff --git a/lib/libcrypto/cms/cms_env.c b/lib/libcrypto/cms/cms_env.c index 1d534e3da..7bb8f613a 100644 --- a/lib/libcrypto/cms/cms_env.c +++ b/lib/libcrypto/cms/cms_env.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cms_env.c,v 1.25 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: cms_env.c,v 1.26 2023/07/08 08:26:26 beck Exp $ */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. @@ -139,12 +139,14 @@ CMS_get0_RecipientInfos(CMS_ContentInfo *cms) return env->recipientInfos; } +LCRYPTO_ALIAS(CMS_get0_RecipientInfos); int CMS_RecipientInfo_type(CMS_RecipientInfo *ri) { return ri->type; } +LCRYPTO_ALIAS(CMS_RecipientInfo_type); EVP_PKEY_CTX * CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri) @@ -156,6 +158,7 @@ CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri) return NULL; } +LCRYPTO_ALIAS(CMS_RecipientInfo_get0_pkey_ctx); CMS_ContentInfo * CMS_EnvelopedData_create(const EVP_CIPHER *cipher) @@ -180,6 +183,7 @@ CMS_EnvelopedData_create(const EVP_CIPHER *cipher) CMSerror(ERR_R_MALLOC_FAILURE); return NULL; } +LCRYPTO_ALIAS(CMS_EnvelopedData_create); /* Key Transport Recipient Info (KTRI) routines */ @@ -288,6 +292,7 @@ CMS_add1_recipient_cert(CMS_ContentInfo *cms, X509 *recip, unsigned int flags) ASN1_item_free((ASN1_VALUE *)ri, &CMS_RecipientInfo_it); return NULL; } +LCRYPTO_ALIAS(CMS_add1_recipient_cert); int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri, EVP_PKEY **pk, @@ -311,6 +316,7 @@ CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri, EVP_PKEY **pk, return 1; } +LCRYPTO_ALIAS(CMS_RecipientInfo_ktri_get0_algs); int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri, @@ -326,6 +332,7 @@ CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri, return cms_SignerIdentifier_get0_signer_id(ktri->rid, keyid, issuer, sno); } +LCRYPTO_ALIAS(CMS_RecipientInfo_ktri_get0_signer_id); int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert) @@ -337,6 +344,7 @@ CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert) return cms_SignerIdentifier_cert_cmp(ri->d.ktri->rid, cert); } +LCRYPTO_ALIAS(CMS_RecipientInfo_ktri_cert_cmp); int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey) @@ -350,6 +358,7 @@ CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey) return 1; } +LCRYPTO_ALIAS(CMS_RecipientInfo_set0_pkey); /* Encrypt content key in key transport recipient info */ @@ -522,6 +531,7 @@ CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri, const unsigned char *id, return ASN1_OCTET_STRING_cmp(&tmp_os, kekri->kekid->keyIdentifier); } +LCRYPTO_ALIAS(CMS_RecipientInfo_kekri_id_cmp); /* For now hard code AES key wrap info */ @@ -639,6 +649,7 @@ CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid, unsigned char *key, ASN1_item_free((ASN1_VALUE *)ri, &CMS_RecipientInfo_it); return NULL; } +LCRYPTO_ALIAS(CMS_add0_recipient_key); int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri, X509_ALGOR **palg, @@ -673,6 +684,7 @@ CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri, X509_ALGOR **palg, return 1; } +LCRYPTO_ALIAS(CMS_RecipientInfo_kekri_get0_id); int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri, unsigned char *key, @@ -690,6 +702,7 @@ CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri, unsigned char *key, kekri->keylen = keylen; return 1; } +LCRYPTO_ALIAS(CMS_RecipientInfo_set0_key); /* Encrypt content key in KEK recipient info */ @@ -825,6 +838,7 @@ CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri) return 0; } } +LCRYPTO_ALIAS(CMS_RecipientInfo_decrypt); int CMS_RecipientInfo_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri) @@ -847,6 +861,7 @@ CMS_RecipientInfo_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri) return 0; } } +LCRYPTO_ALIAS(CMS_RecipientInfo_encrypt); /* Check structures and fixup version numbers (if necessary) */ diff --git a/lib/libcrypto/cms/cms_err.c b/lib/libcrypto/cms/cms_err.c index 07869ff98..5758a26db 100644 --- a/lib/libcrypto/cms/cms_err.c +++ b/lib/libcrypto/cms/cms_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cms_err.c,v 1.13 2022/07/12 14:42:48 kn Exp $ */ +/* $OpenBSD: cms_err.c,v 1.14 2023/07/08 08:26:26 beck Exp $ */ /* * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. * @@ -161,3 +161,4 @@ ERR_load_CMS_strings(void) #endif return 1; } +LCRYPTO_ALIAS(ERR_load_CMS_strings); diff --git a/lib/libcrypto/cms/cms_ess.c b/lib/libcrypto/cms/cms_ess.c index 88ea6e96f..b9a4cd8af 100644 --- a/lib/libcrypto/cms/cms_ess.c +++ b/lib/libcrypto/cms/cms_ess.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cms_ess.c,v 1.22 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: cms_ess.c,v 1.23 2023/07/08 08:26:26 beck Exp $ */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. @@ -70,24 +70,28 @@ d2i_CMS_ReceiptRequest(CMS_ReceiptRequest **a, const unsigned char **in, long le return (CMS_ReceiptRequest *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &CMS_ReceiptRequest_it); } +LCRYPTO_ALIAS(d2i_CMS_ReceiptRequest); int i2d_CMS_ReceiptRequest(CMS_ReceiptRequest *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &CMS_ReceiptRequest_it); } +LCRYPTO_ALIAS(i2d_CMS_ReceiptRequest); CMS_ReceiptRequest * CMS_ReceiptRequest_new(void) { return (CMS_ReceiptRequest *)ASN1_item_new(&CMS_ReceiptRequest_it); } +LCRYPTO_ALIAS(CMS_ReceiptRequest_new); void CMS_ReceiptRequest_free(CMS_ReceiptRequest *a) { ASN1_item_free((ASN1_VALUE *)a, &CMS_ReceiptRequest_it); } +LCRYPTO_ALIAS(CMS_ReceiptRequest_free); /* ESS services: for now just Signed Receipt related */ diff --git a/lib/libcrypto/cms/cms_io.c b/lib/libcrypto/cms/cms_io.c index 38e76e0c2..ceb4ce8ec 100644 --- a/lib/libcrypto/cms/cms_io.c +++ b/lib/libcrypto/cms/cms_io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cms_io.c,v 1.19 2023/04/26 14:23:18 tb Exp $ */ +/* $OpenBSD: cms_io.c,v 1.20 2023/07/08 08:26:26 beck Exp $ */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. @@ -82,18 +82,21 @@ CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms) return 1; } +LCRYPTO_ALIAS(CMS_stream); CMS_ContentInfo * d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms) { return ASN1_item_d2i_bio(&CMS_ContentInfo_it, bp, cms); } +LCRYPTO_ALIAS(d2i_CMS_bio); int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms) { return ASN1_item_i2d_bio(&CMS_ContentInfo_it, bp, cms); } +LCRYPTO_ALIAS(i2d_CMS_bio); CMS_ContentInfo * @@ -129,6 +132,7 @@ BIO_new_CMS(BIO *out, CMS_ContentInfo *cms) { return BIO_new_NDEF(out, (ASN1_VALUE *)cms, &CMS_ContentInfo_it); } +LCRYPTO_ALIAS(BIO_new_CMS); /* CMS wrappers round generalised stream and MIME routines */ @@ -138,6 +142,7 @@ i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags) return i2d_ASN1_bio_stream(out, (ASN1_VALUE *)cms, in, flags, &CMS_ContentInfo_it); } +LCRYPTO_ALIAS(i2d_CMS_bio_stream); int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags) @@ -145,6 +150,7 @@ PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags) return PEM_write_bio_ASN1_stream(out, (ASN1_VALUE *)cms, in, flags, "CMS", &CMS_ContentInfo_it); } +LCRYPTO_ALIAS(PEM_write_bio_CMS_stream); int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags) @@ -159,6 +165,7 @@ SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags) return SMIME_write_ASN1(bio, (ASN1_VALUE *)cms, data, flags, ctype_nid, econt_nid, mdalgs, &CMS_ContentInfo_it); } +LCRYPTO_ALIAS(SMIME_write_CMS); CMS_ContentInfo * SMIME_read_CMS(BIO *bio, BIO **bcont) @@ -166,3 +173,4 @@ SMIME_read_CMS(BIO *bio, BIO **bcont) return (CMS_ContentInfo *)SMIME_read_ASN1(bio, bcont, &CMS_ContentInfo_it); } +LCRYPTO_ALIAS(SMIME_read_CMS); diff --git a/lib/libcrypto/cms/cms_kari.c b/lib/libcrypto/cms/cms_kari.c index 029400779..8ed54e757 100644 --- a/lib/libcrypto/cms/cms_kari.c +++ b/lib/libcrypto/cms/cms_kari.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cms_kari.c,v 1.14 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: cms_kari.c,v 1.15 2023/07/08 08:26:26 beck Exp $ */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. @@ -81,6 +81,7 @@ CMS_RecipientInfo_kari_get0_alg(CMS_RecipientInfo *ri, X509_ALGOR **palg, return 1; } +LCRYPTO_ALIAS(CMS_RecipientInfo_kari_get0_alg); /* Retrieve recipient encrypted keys from a kari */ @@ -93,6 +94,7 @@ CMS_RecipientInfo_kari_get0_reks(CMS_RecipientInfo *ri) } return ri->d.kari->recipientEncryptedKeys; } +LCRYPTO_ALIAS(CMS_RecipientInfo_kari_get0_reks); int CMS_RecipientInfo_kari_get0_orig_id(CMS_RecipientInfo *ri, X509_ALGOR **pubalg, @@ -134,6 +136,7 @@ CMS_RecipientInfo_kari_get0_orig_id(CMS_RecipientInfo *ri, X509_ALGOR **pubalg, return 1; } +LCRYPTO_ALIAS(CMS_RecipientInfo_kari_get0_orig_id); int CMS_RecipientInfo_kari_orig_id_cmp(CMS_RecipientInfo *ri, X509 *cert) @@ -152,6 +155,7 @@ CMS_RecipientInfo_kari_orig_id_cmp(CMS_RecipientInfo *ri, X509 *cert) return -1; } +LCRYPTO_ALIAS(CMS_RecipientInfo_kari_orig_id_cmp); int CMS_RecipientEncryptedKey_get0_id(CMS_RecipientEncryptedKey *rek, @@ -187,6 +191,7 @@ CMS_RecipientEncryptedKey_get0_id(CMS_RecipientEncryptedKey *rek, return 1; } +LCRYPTO_ALIAS(CMS_RecipientEncryptedKey_get0_id); int CMS_RecipientEncryptedKey_cert_cmp(CMS_RecipientEncryptedKey *rek, X509 *cert) @@ -200,6 +205,7 @@ CMS_RecipientEncryptedKey_cert_cmp(CMS_RecipientEncryptedKey *rek, X509 *cert) else return -1; } +LCRYPTO_ALIAS(CMS_RecipientEncryptedKey_cert_cmp); int CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk) @@ -221,6 +227,7 @@ CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk) EVP_PKEY_CTX_free(pctx); return 0; } +LCRYPTO_ALIAS(CMS_RecipientInfo_kari_set0_pkey); EVP_CIPHER_CTX * CMS_RecipientInfo_kari_get0_ctx(CMS_RecipientInfo *ri) @@ -229,6 +236,7 @@ CMS_RecipientInfo_kari_get0_ctx(CMS_RecipientInfo *ri) return ri->d.kari->ctx; return NULL; } +LCRYPTO_ALIAS(CMS_RecipientInfo_kari_get0_ctx); /* * Derive KEK and decrypt/encrypt with it to produce either the original CEK @@ -309,6 +317,7 @@ CMS_RecipientInfo_kari_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri, return rv; } +LCRYPTO_ALIAS(CMS_RecipientInfo_kari_decrypt); /* Create ephemeral key and initialise context based on it */ static int diff --git a/lib/libcrypto/cms/cms_lib.c b/lib/libcrypto/cms/cms_lib.c index f8d950de0..fa62e61e9 100644 --- a/lib/libcrypto/cms/cms_lib.c +++ b/lib/libcrypto/cms/cms_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cms_lib.c,v 1.17 2023/06/11 05:35:43 tb Exp $ */ +/* $OpenBSD: cms_lib.c,v 1.18 2023/07/08 08:26:26 beck Exp $ */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. @@ -69,24 +69,28 @@ d2i_CMS_ContentInfo(CMS_ContentInfo **a, const unsigned char **in, long len) return (CMS_ContentInfo *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &CMS_ContentInfo_it); } +LCRYPTO_ALIAS(d2i_CMS_ContentInfo); int i2d_CMS_ContentInfo(CMS_ContentInfo *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &CMS_ContentInfo_it); } +LCRYPTO_ALIAS(i2d_CMS_ContentInfo); CMS_ContentInfo * CMS_ContentInfo_new(void) { return (CMS_ContentInfo *)ASN1_item_new(&CMS_ContentInfo_it); } +LCRYPTO_ALIAS(CMS_ContentInfo_new); void CMS_ContentInfo_free(CMS_ContentInfo *a) { ASN1_item_free((ASN1_VALUE *)a, &CMS_ContentInfo_it); } +LCRYPTO_ALIAS(CMS_ContentInfo_free); int CMS_ContentInfo_print_ctx(BIO *out, CMS_ContentInfo *x, int indent, const ASN1_PCTX *pctx) @@ -94,12 +98,14 @@ CMS_ContentInfo_print_ctx(BIO *out, CMS_ContentInfo *x, int indent, const ASN1_P return ASN1_item_print(out, (ASN1_VALUE *)x, indent, &CMS_ContentInfo_it, pctx); } +LCRYPTO_ALIAS(CMS_ContentInfo_print_ctx); const ASN1_OBJECT * CMS_get0_type(const CMS_ContentInfo *cms) { return cms->contentType; } +LCRYPTO_ALIAS(CMS_get0_type); CMS_ContentInfo * cms_Data_create(void) @@ -182,6 +188,7 @@ CMS_dataInit(CMS_ContentInfo *cms, BIO *icont) return NULL; } +LCRYPTO_ALIAS(CMS_dataInit); int CMS_dataFinal(CMS_ContentInfo *cms, BIO *cmsbio) @@ -228,6 +235,7 @@ CMS_dataFinal(CMS_ContentInfo *cms, BIO *cmsbio) return 0; } } +LCRYPTO_ALIAS(CMS_dataFinal); /* * Return an OCTET STRING pointer to content. This allows it to be accessed @@ -311,6 +319,7 @@ CMS_get0_eContentType(CMS_ContentInfo *cms) return NULL; } +LCRYPTO_ALIAS(CMS_get0_eContentType); int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid) @@ -330,6 +339,7 @@ CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid) return 1; } +LCRYPTO_ALIAS(CMS_set1_eContentType); int CMS_is_detached(CMS_ContentInfo *cms) @@ -344,6 +354,7 @@ CMS_is_detached(CMS_ContentInfo *cms) return 1; } +LCRYPTO_ALIAS(CMS_is_detached); int CMS_set_detached(CMS_ContentInfo *cms, int detached) @@ -371,6 +382,7 @@ CMS_set_detached(CMS_ContentInfo *cms, int detached) return 0; } +LCRYPTO_ALIAS(CMS_set_detached); /* Create a digest BIO from an X509_ALGOR structure */ @@ -471,6 +483,7 @@ CMS_add0_CertificateChoices(CMS_ContentInfo *cms) return cch; } +LCRYPTO_ALIAS(CMS_add0_CertificateChoices); int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert) @@ -499,6 +512,7 @@ CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert) return 1; } +LCRYPTO_ALIAS(CMS_add0_cert); int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert) @@ -511,6 +525,7 @@ CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert) return r; } +LCRYPTO_ALIAS(CMS_add1_cert); static STACK_OF(CMS_RevocationInfoChoice) ** cms_get0_revocation_choices(CMS_ContentInfo *cms) @@ -553,6 +568,7 @@ CMS_add0_RevocationInfoChoice(CMS_ContentInfo *cms) return rch; } +LCRYPTO_ALIAS(CMS_add0_RevocationInfoChoice); int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl) @@ -567,6 +583,7 @@ CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl) return 1; } +LCRYPTO_ALIAS(CMS_add0_crl); int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl) @@ -579,6 +596,7 @@ CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl) return r; } +LCRYPTO_ALIAS(CMS_add1_crl); STACK_OF(X509) * CMS_get1_certs(CMS_ContentInfo *cms) @@ -608,6 +626,7 @@ CMS_get1_certs(CMS_ContentInfo *cms) } return certs; } +LCRYPTO_ALIAS(CMS_get1_certs); STACK_OF(X509_CRL) * CMS_get1_crls(CMS_ContentInfo *cms) @@ -637,6 +656,7 @@ CMS_get1_crls(CMS_ContentInfo *cms) } return crls; } +LCRYPTO_ALIAS(CMS_get1_crls); static const ASN1_OCTET_STRING * cms_X509_get0_subject_key_id(X509 *x) diff --git a/lib/libcrypto/cms/cms_local.h b/lib/libcrypto/cms/cms_local.h index 7a82c890e..7d8032fb4 100644 --- a/lib/libcrypto/cms/cms_local.h +++ b/lib/libcrypto/cms/cms_local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cms_local.h,v 1.3 2023/06/06 16:10:56 tb Exp $ */ +/* $OpenBSD: cms_local.h,v 1.4 2023/07/07 16:04:57 tb Exp $ */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. @@ -388,11 +388,6 @@ struct CMS_Receipt_st { ASN1_OCTET_STRING *originatorSignatureValue; }; -CMS_ContentInfo *CMS_ContentInfo_new(void); -void CMS_ContentInfo_free(CMS_ContentInfo *a); -CMS_ContentInfo *d2i_CMS_ContentInfo(CMS_ContentInfo **a, const unsigned char **in, long len); -int i2d_CMS_ContentInfo(CMS_ContentInfo *a, unsigned char **out); -extern const ASN1_ITEM CMS_ContentInfo_it; extern const ASN1_ITEM CMS_SignerInfo_it; extern const ASN1_ITEM CMS_IssuerAndSerialNumber_it; extern const ASN1_ITEM CMS_Attributes_Sign_it; diff --git a/lib/libcrypto/cms/cms_pwri.c b/lib/libcrypto/cms/cms_pwri.c index 3348b60fd..9ea7cfdcb 100644 --- a/lib/libcrypto/cms/cms_pwri.c +++ b/lib/libcrypto/cms/cms_pwri.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cms_pwri.c,v 1.28 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: cms_pwri.c,v 1.29 2023/07/08 08:26:26 beck Exp $ */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. @@ -84,6 +84,7 @@ CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri, unsigned char *pass, return 1; } +LCRYPTO_ALIAS(CMS_RecipientInfo_set0_password); CMS_RecipientInfo * CMS_add0_recipient_password(CMS_ContentInfo *cms, int iter, int wrap_nid, @@ -213,6 +214,7 @@ CMS_add0_recipient_password(CMS_ContentInfo *cms, int iter, int wrap_nid, return NULL; } +LCRYPTO_ALIAS(CMS_add0_recipient_password); /* * This is an implementation of the key wrapping mechanism in RFC3211, at diff --git a/lib/libcrypto/cms/cms_sd.c b/lib/libcrypto/cms/cms_sd.c index 8df78fe3e..89ba5bf01 100644 --- a/lib/libcrypto/cms/cms_sd.c +++ b/lib/libcrypto/cms/cms_sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cms_sd.c,v 1.25 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: cms_sd.c,v 1.26 2023/07/08 08:26:26 beck Exp $ */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. @@ -107,6 +107,7 @@ CMS_SignedData_init(CMS_ContentInfo *cms) else return 0; } +LCRYPTO_ALIAS(CMS_SignedData_init); /* Check structures and fixup version numbers (if necessary) */ @@ -424,6 +425,7 @@ CMS_add1_signer(CMS_ContentInfo *cms, X509 *signer, EVP_PKEY *pk, return NULL; } +LCRYPTO_ALIAS(CMS_add1_signer); static int cms_add1_signingTime(CMS_SignerInfo *si, ASN1_TIME *t) @@ -459,12 +461,14 @@ CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si) { return si->pctx; } +LCRYPTO_ALIAS(CMS_SignerInfo_get0_pkey_ctx); EVP_MD_CTX * CMS_SignerInfo_get0_md_ctx(CMS_SignerInfo *si) { return si->mctx; } +LCRYPTO_ALIAS(CMS_SignerInfo_get0_md_ctx); STACK_OF(CMS_SignerInfo) * CMS_get0_SignerInfos(CMS_ContentInfo *cms) @@ -477,6 +481,7 @@ CMS_get0_SignerInfos(CMS_ContentInfo *cms) return sd->signerInfos; } +LCRYPTO_ALIAS(CMS_get0_SignerInfos); STACK_OF(X509) * CMS_get0_signers(CMS_ContentInfo *cms) @@ -504,6 +509,7 @@ CMS_get0_signers(CMS_ContentInfo *cms) return signers; } +LCRYPTO_ALIAS(CMS_get0_signers); void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer) @@ -516,6 +522,7 @@ CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer) X509_free(si->signer); si->signer = signer; } +LCRYPTO_ALIAS(CMS_SignerInfo_set1_signer_cert); int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si, ASN1_OCTET_STRING **keyid, @@ -523,12 +530,14 @@ CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si, ASN1_OCTET_STRING **keyid, { return cms_SignerIdentifier_get0_signer_id(si->sid, keyid, issuer, sno); } +LCRYPTO_ALIAS(CMS_SignerInfo_get0_signer_id); int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert) { return cms_SignerIdentifier_cert_cmp(si->sid, cert); } +LCRYPTO_ALIAS(CMS_SignerInfo_cert_cmp); int CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *scerts, @@ -577,6 +586,7 @@ CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *scerts, } return ret; } +LCRYPTO_ALIAS(CMS_set1_signers_certs); void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk, X509 **signer, @@ -591,12 +601,14 @@ X509_ALGOR **pdig, X509_ALGOR **psig) if (psig) *psig = si->signatureAlgorithm; } +LCRYPTO_ALIAS(CMS_SignerInfo_get0_algs); ASN1_OCTET_STRING * CMS_SignerInfo_get0_signature(CMS_SignerInfo *si) { return si->signature; } +LCRYPTO_ALIAS(CMS_SignerInfo_get0_signature); static int cms_SignerInfo_content_sign(CMS_ContentInfo *cms, CMS_SignerInfo *si, BIO *chain) @@ -773,6 +785,7 @@ CMS_SignerInfo_sign(CMS_SignerInfo *si) return 0; } +LCRYPTO_ALIAS(CMS_SignerInfo_sign); int CMS_SignerInfo_verify(CMS_SignerInfo *si) @@ -822,6 +835,7 @@ CMS_SignerInfo_verify(CMS_SignerInfo *si) return r; } +LCRYPTO_ALIAS(CMS_SignerInfo_verify); /* Create a chain of digest BIOs from a CMS ContentInfo */ @@ -931,6 +945,7 @@ CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain) return r; } +LCRYPTO_ALIAS(CMS_SignerInfo_verify_content); int CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs) @@ -947,6 +962,7 @@ CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs) return r; } +LCRYPTO_ALIAS(CMS_add_smimecap); int CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs, int algnid, int keysize) @@ -979,6 +995,7 @@ CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs, int algnid, int keysize) return 1; } +LCRYPTO_ALIAS(CMS_add_simple_smimecap); /* Check to see if a cipher exists and if so add S/MIME capabilities */ @@ -1015,3 +1032,4 @@ CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) **smcap) return 1; } +LCRYPTO_ALIAS(CMS_add_standard_smimecap); diff --git a/lib/libcrypto/cms/cms_smime.c b/lib/libcrypto/cms/cms_smime.c index e9001d0f0..b2930017f 100644 --- a/lib/libcrypto/cms/cms_smime.c +++ b/lib/libcrypto/cms/cms_smime.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cms_smime.c,v 1.26 2023/06/11 05:35:43 tb Exp $ */ +/* $OpenBSD: cms_smime.c,v 1.27 2023/07/08 08:26:26 beck Exp $ */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. @@ -170,6 +170,7 @@ CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags) return r; } +LCRYPTO_ALIAS(CMS_data); CMS_ContentInfo * CMS_data_create(BIO *in, unsigned int flags) @@ -187,6 +188,7 @@ CMS_data_create(BIO *in, unsigned int flags) return NULL; } +LCRYPTO_ALIAS(CMS_data_create); int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out, unsigned int flags) @@ -212,6 +214,7 @@ CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out, unsigned int flags return r; } +LCRYPTO_ALIAS(CMS_digest_verify); CMS_ContentInfo * CMS_digest_create(BIO *in, const EVP_MD *md, unsigned int flags) @@ -234,6 +237,7 @@ CMS_digest_create(BIO *in, const EVP_MD *md, unsigned int flags) return NULL; } +LCRYPTO_ALIAS(CMS_digest_create); int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms, const unsigned char *key, @@ -260,6 +264,7 @@ CMS_EncryptedData_decrypt(CMS_ContentInfo *cms, const unsigned char *key, return r; } +LCRYPTO_ALIAS(CMS_EncryptedData_decrypt); CMS_ContentInfo * CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher, @@ -288,6 +293,7 @@ CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher, return NULL; } +LCRYPTO_ALIAS(CMS_EncryptedData_encrypt); static int cms_signerinfo_verify_cert(CMS_SignerInfo *si, X509_STORE *store, @@ -485,6 +491,7 @@ CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs, X509_STORE *store, return ret; } +LCRYPTO_ALIAS(CMS_verify); int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms, @@ -499,6 +506,7 @@ CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms, return cms_Receipt_verify(rcms, ocms); } +LCRYPTO_ALIAS(CMS_verify_receipt); CMS_ContentInfo * CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, BIO *data, @@ -542,6 +550,7 @@ CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, BIO *data, return NULL; } +LCRYPTO_ALIAS(CMS_sign); CMS_ContentInfo * CMS_sign_receipt(CMS_SignerInfo *si, X509 *signcert, EVP_PKEY *pkey, @@ -609,6 +618,7 @@ CMS_sign_receipt(CMS_SignerInfo *si, X509 *signcert, EVP_PKEY *pkey, return NULL; } +LCRYPTO_ALIAS(CMS_sign_receipt); CMS_ContentInfo * CMS_encrypt(STACK_OF(X509) *certs, BIO *data, const EVP_CIPHER *cipher, @@ -645,6 +655,7 @@ CMS_encrypt(STACK_OF(X509) *certs, BIO *data, const EVP_CIPHER *cipher, return NULL; } +LCRYPTO_ALIAS(CMS_encrypt); static int cms_kari_set1_pkey(CMS_ContentInfo *cms, CMS_RecipientInfo *ri, EVP_PKEY *pk, @@ -743,6 +754,7 @@ CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert) return 0; } +LCRYPTO_ALIAS(CMS_decrypt_set1_pkey); int CMS_decrypt_set1_key(CMS_ContentInfo *cms, unsigned char *key, size_t keylen, @@ -780,6 +792,7 @@ CMS_decrypt_set1_key(CMS_ContentInfo *cms, unsigned char *key, size_t keylen, return 0; } +LCRYPTO_ALIAS(CMS_decrypt_set1_key); int CMS_decrypt_set1_password(CMS_ContentInfo *cms, unsigned char *pass, @@ -805,6 +818,7 @@ CMS_decrypt_set1_password(CMS_ContentInfo *cms, unsigned char *pass, return 0; } +LCRYPTO_ALIAS(CMS_decrypt_set1_password); int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert, BIO *dcont, @@ -839,6 +853,7 @@ CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert, BIO *dcont, return r; } +LCRYPTO_ALIAS(CMS_decrypt); int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, unsigned int flags) @@ -867,6 +882,7 @@ CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, unsigned int flags) return ret; } +LCRYPTO_ALIAS(CMS_final); int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out, unsigned int flags) @@ -874,6 +890,7 @@ CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out, unsigned int flags) CMSerror(CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM); return 0; } +LCRYPTO_ALIAS(CMS_uncompress); CMS_ContentInfo * CMS_compress(BIO *in, int comp_nid, unsigned int flags) @@ -881,3 +898,4 @@ CMS_compress(BIO *in, int comp_nid, unsigned int flags) CMSerror(CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM); return NULL; } +LCRYPTO_ALIAS(CMS_compress); diff --git a/lib/libcrypto/comp/c_rle.c b/lib/libcrypto/comp/c_rle.c index c2c279dc0..7907dd83c 100644 --- a/lib/libcrypto/comp/c_rle.c +++ b/lib/libcrypto/comp/c_rle.c @@ -1,4 +1,4 @@ -/* $OpenBSD: c_rle.c,v 1.11 2022/12/24 07:12:09 tb Exp $ */ +/* $OpenBSD: c_rle.c,v 1.12 2023/07/08 08:26:26 beck Exp $ */ /* * --------------------------------------------------------------------------- * Patches to this file were contributed by @@ -138,6 +138,7 @@ COMP_rle(void) { return (&rle_method); } +LCRYPTO_ALIAS(COMP_rle); static int rle_compress_block(COMP_CTX *ctx, unsigned char *out, unsigned int olen, diff --git a/lib/libcrypto/comp/c_zlib.c b/lib/libcrypto/comp/c_zlib.c index ec98b26f5..087e2f4c6 100644 --- a/lib/libcrypto/comp/c_zlib.c +++ b/lib/libcrypto/comp/c_zlib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: c_zlib.c,v 1.27 2023/06/11 05:35:43 tb Exp $ */ +/* $OpenBSD: c_zlib.c,v 1.28 2023/07/08 08:26:26 beck Exp $ */ /* * --------------------------------------------------------------------------- * Major patches to this file were contributed by @@ -137,8 +137,10 @@ COMP_zlib(void) { return &zlib_method_nozlib; } +LCRYPTO_ALIAS(COMP_zlib); void COMP_zlib_cleanup(void) { } +LCRYPTO_ALIAS(COMP_zlib_cleanup); diff --git a/lib/libcrypto/comp/comp_err.c b/lib/libcrypto/comp/comp_err.c index 5ec5039f8..49c476c02 100644 --- a/lib/libcrypto/comp/comp_err.c +++ b/lib/libcrypto/comp/comp_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: comp_err.c,v 1.13 2022/12/23 23:23:02 schwarze Exp $ */ +/* $OpenBSD: comp_err.c,v 1.14 2023/07/08 08:26:26 beck Exp $ */ /* ==================================================================== * This file was written by Dr. Stephen Henson . * Copyright (c) 1999, 2005, 2008 The OpenSSL Project. All rights reserved. @@ -92,3 +92,4 @@ ERR_load_COMP_strings(void) } #endif } +LCRYPTO_ALIAS(ERR_load_COMP_strings); diff --git a/lib/libcrypto/comp/comp_lib.c b/lib/libcrypto/comp/comp_lib.c index 5cb2335bf..f26edc000 100644 --- a/lib/libcrypto/comp/comp_lib.c +++ b/lib/libcrypto/comp/comp_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: comp_lib.c,v 1.11 2022/12/24 07:12:09 tb Exp $ */ +/* $OpenBSD: comp_lib.c,v 1.12 2023/07/08 08:26:26 beck Exp $ */ /* * --------------------------------------------------------------------------- * Patches to this file were contributed by @@ -136,6 +136,7 @@ COMP_CTX_new(COMP_METHOD *meth) } return (ret); } +LCRYPTO_ALIAS(COMP_CTX_new); void COMP_CTX_free(COMP_CTX *ctx) @@ -148,6 +149,7 @@ COMP_CTX_free(COMP_CTX *ctx) free(ctx); } +LCRYPTO_ALIAS(COMP_CTX_free); int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, @@ -165,6 +167,7 @@ COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, } return (ret); } +LCRYPTO_ALIAS(COMP_compress_block); int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, @@ -182,3 +185,4 @@ COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, } return (ret); } +LCRYPTO_ALIAS(COMP_expand_block); diff --git a/lib/libcrypto/conf/conf_api.c b/lib/libcrypto/conf/conf_api.c index f296e6a96..6fe071e12 100644 --- a/lib/libcrypto/conf/conf_api.c +++ b/lib/libcrypto/conf/conf_api.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf_api.c,v 1.15 2015/04/11 16:03:21 deraadt Exp $ */ +/* $OpenBSD: conf_api.c,v 1.16 2023/07/08 08:26:26 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -89,6 +89,7 @@ _CONF_get_section(const CONF *conf, const char *section) v = lh_CONF_VALUE_retrieve(conf->data, &vv); return (v); } +LCRYPTO_ALIAS(_CONF_get_section); /* Up until OpenSSL 0.9.5a, this was CONF_get_section */ STACK_OF(CONF_VALUE) * @@ -102,6 +103,7 @@ _CONF_get_section_values(const CONF *conf, const char *section) else return (NULL); } +LCRYPTO_ALIAS(_CONF_get_section_values); int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value) @@ -125,6 +127,7 @@ _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value) } return 1; } +LCRYPTO_ALIAS(_CONF_add_string); char * _CONF_get_string(const CONF *conf, const char *section, const char *name) @@ -151,6 +154,7 @@ _CONF_get_string(const CONF *conf, const char *section, const char *name) } else return (NULL); } +LCRYPTO_ALIAS(_CONF_get_string); static unsigned long conf_value_hash(const CONF_VALUE *v) @@ -193,6 +197,7 @@ _CONF_new_data(CONF *conf) } return 1; } +LCRYPTO_ALIAS(_CONF_new_data); void _CONF_free_data(CONF *conf) @@ -213,6 +218,7 @@ _CONF_free_data(CONF *conf) lh_CONF_VALUE_doall(conf->data, LHASH_DOALL_FN(value_free_stack)); lh_CONF_VALUE_free(conf->data); } +LCRYPTO_ALIAS(_CONF_free_data); static void value_free_hash_doall_arg(CONF_VALUE *a, LHASH_OF(CONF_VALUE) *conf) @@ -277,3 +283,4 @@ err: } return (v); } +LCRYPTO_ALIAS(_CONF_new_section); diff --git a/lib/libcrypto/cpt_err.c b/lib/libcrypto/cpt_err.c index 718c72608..ff4e5c4bc 100644 --- a/lib/libcrypto/cpt_err.c +++ b/lib/libcrypto/cpt_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpt_err.c,v 1.14 2022/07/12 14:42:48 kn Exp $ */ +/* $OpenBSD: cpt_err.c,v 1.15 2023/07/08 08:28:23 beck Exp $ */ /* ==================================================================== * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * @@ -97,3 +97,4 @@ ERR_load_CRYPTO_strings(void) } #endif } +LCRYPTO_ALIAS(ERR_load_CRYPTO_strings); diff --git a/lib/libcrypto/cryptlib.c b/lib/libcrypto/cryptlib.c index 38d31e7ac..18f40e544 100644 --- a/lib/libcrypto/cryptlib.c +++ b/lib/libcrypto/cryptlib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cryptlib.c,v 1.45 2019/01/26 11:30:32 deraadt Exp $ */ +/* $OpenBSD: cryptlib.c,v 1.46 2023/07/08 08:28:23 beck Exp $ */ /* ==================================================================== * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. * @@ -281,24 +281,28 @@ CRYPTO_THREADID_current(CRYPTO_THREADID *id) memset(id, 0, sizeof(*id)); id->val = (unsigned long)pthread_self(); } +LCRYPTO_ALIAS(CRYPTO_THREADID_current); int CRYPTO_THREADID_cmp(const CRYPTO_THREADID *a, const CRYPTO_THREADID *b) { return memcmp(a, b, sizeof(*a)); } +LCRYPTO_ALIAS(CRYPTO_THREADID_cmp); void CRYPTO_THREADID_cpy(CRYPTO_THREADID *dest, const CRYPTO_THREADID *src) { memcpy(dest, src, sizeof(*src)); } +LCRYPTO_ALIAS(CRYPTO_THREADID_cpy); unsigned long CRYPTO_THREADID_hash(const CRYPTO_THREADID *id) { return id->val; } +LCRYPTO_ALIAS(CRYPTO_THREADID_hash); #if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \ defined(__INTEL__) || \ @@ -311,6 +315,7 @@ OPENSSL_cpu_caps(void) { return OPENSSL_ia32cap_P; } +LCRYPTO_ALIAS(OPENSSL_cpu_caps); #if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM) #define OPENSSL_CPUID_SETUP @@ -333,6 +338,7 @@ OPENSSL_cpu_caps(void) { return 0; } +LCRYPTO_ALIAS(OPENSSL_cpu_caps); #endif #if !defined(OPENSSL_CPUID_SETUP) && !defined(OPENSSL_CPUID_OBJ) @@ -361,6 +367,7 @@ OpenSSLDie(const char *file, int line, const char *assertion) getuid(), getprogname(), file, line, assertion); _exit(1); } +LCRYPTO_ALIAS(OpenSSLDie); int CRYPTO_memcmp(const void *in_a, const void *in_b, size_t len) diff --git a/lib/libcrypto/crypto_init.c b/lib/libcrypto/crypto_init.c index 361bef41a..a2c1c786c 100644 --- a/lib/libcrypto/crypto_init.c +++ b/lib/libcrypto/crypto_init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto_init.c,v 1.10 2023/07/02 19:52:01 tb Exp $ */ +/* $OpenBSD: crypto_init.c,v 1.11 2023/07/08 08:28:23 beck Exp $ */ /* * Copyright (c) 2018 Bob Beck * @@ -75,6 +75,7 @@ OPENSSL_init_crypto(uint64_t opts, const void *settings) return 1; } +LCRYPTO_ALIAS(OPENSSL_init_crypto); void OPENSSL_cleanup(void) @@ -98,3 +99,4 @@ OPENSSL_cleanup(void) crypto_init_cleaned_up = 1; } +LCRYPTO_ALIAS(OPENSSL_cleanup); diff --git a/lib/libcrypto/crypto_lock.c b/lib/libcrypto/crypto_lock.c index 6d9dbab22..59c3933c7 100644 --- a/lib/libcrypto/crypto_lock.c +++ b/lib/libcrypto/crypto_lock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto_lock.c,v 1.5 2023/06/04 17:28:35 tb Exp $ */ +/* $OpenBSD: crypto_lock.c,v 1.6 2023/07/08 08:28:23 beck Exp $ */ /* * Copyright (c) 2018 Brent Cook * @@ -78,6 +78,7 @@ CRYPTO_lock(int mode, int type, const char *file, int line) else if (mode & CRYPTO_UNLOCK) (void) pthread_mutex_unlock(&locks[type]); } +LCRYPTO_ALIAS(CRYPTO_lock); int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, @@ -92,3 +93,4 @@ CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, return (ret); } +LCRYPTO_ALIAS(CRYPTO_add_lock); diff --git a/lib/libcrypto/ct/ct_b64.c b/lib/libcrypto/ct/ct_b64.c index bfc69a7da..101cd1e2b 100644 --- a/lib/libcrypto/ct/ct_b64.c +++ b/lib/libcrypto/ct/ct_b64.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ct_b64.c,v 1.6 2021/12/20 17:19:19 jsing Exp $ */ +/* $OpenBSD: ct_b64.c,v 1.7 2023/07/08 07:22:58 beck Exp $ */ /* * Written by Rob Stradling (rob@comodo.com) and Stephen Henson * (steve@openssl.org) for the OpenSSL project 2014. @@ -180,6 +180,7 @@ SCT_new_from_base64(unsigned char version, const char *logid_base64, SCT_free(sct); return NULL; } +LCRYPTO_ALIAS(SCT_new_from_base64); /* * Allocate, build and returns a new |ct_log| from input |pkey_base64| @@ -222,3 +223,4 @@ CTLOG_new_from_base64(CTLOG **ct_log, const char *pkey_base64, const char *name) return 1; } +LCRYPTO_ALIAS(CTLOG_new_from_base64); diff --git a/lib/libcrypto/ct/ct_log.c b/lib/libcrypto/ct/ct_log.c index f6e3aa25d..eb503a381 100644 --- a/lib/libcrypto/ct/ct_log.c +++ b/lib/libcrypto/ct/ct_log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ct_log.c,v 1.5 2021/12/18 16:34:52 tb Exp $ */ +/* $OpenBSD: ct_log.c,v 1.6 2023/07/08 07:22:58 beck Exp $ */ /* Author: Adam Eijdenberg . */ /* ==================================================================== * Copyright (c) 1998-2016 The OpenSSL Project. All rights reserved. @@ -162,6 +162,7 @@ CTLOG_STORE_new(void) free(ret); return NULL; } +LCRYPTO_ALIAS(CTLOG_STORE_new); void CTLOG_STORE_free(CTLOG_STORE *store) @@ -171,6 +172,7 @@ CTLOG_STORE_free(CTLOG_STORE *store) free(store); } } +LCRYPTO_ALIAS(CTLOG_STORE_free); static int ctlog_new_from_conf(CTLOG **ct_log, const CONF *conf, const char *section) @@ -198,6 +200,7 @@ CTLOG_STORE_load_default_file(CTLOG_STORE *store) { return CTLOG_STORE_load_file(store, CTLOG_FILE); } +LCRYPTO_ALIAS(CTLOG_STORE_load_default_file); /* * Called by CONF_parse_list, which stops if this returns <= 0, @@ -283,6 +286,7 @@ CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file) ctlog_store_load_ctx_free(load_ctx); return ret; } +LCRYPTO_ALIAS(CTLOG_STORE_load_file); /* * Initialize a new CTLOG object. @@ -314,6 +318,7 @@ CTLOG_new(EVP_PKEY *public_key, const char *name) CTLOG_free(ret); return NULL; } +LCRYPTO_ALIAS(CTLOG_new); /* Frees CT log and associated structures */ void @@ -325,12 +330,14 @@ CTLOG_free(CTLOG *log) free(log); } } +LCRYPTO_ALIAS(CTLOG_free); const char * CTLOG_get0_name(const CTLOG *log) { return log->name; } +LCRYPTO_ALIAS(CTLOG_get0_name); void CTLOG_get0_log_id(const CTLOG *log, const uint8_t **log_id, size_t *log_id_len) @@ -338,12 +345,14 @@ CTLOG_get0_log_id(const CTLOG *log, const uint8_t **log_id, size_t *log_id_len) *log_id = log->log_id; *log_id_len = CT_V1_HASHLEN; } +LCRYPTO_ALIAS(CTLOG_get0_log_id); EVP_PKEY * CTLOG_get0_public_key(const CTLOG *log) { return log->public_key; } +LCRYPTO_ALIAS(CTLOG_get0_public_key); /* * Given a log ID, finds the matching log. @@ -363,3 +372,4 @@ CTLOG_STORE_get0_log_by_id(const CTLOG_STORE *store, const uint8_t *log_id, return NULL; } +LCRYPTO_ALIAS(CTLOG_STORE_get0_log_by_id); diff --git a/lib/libcrypto/ct/ct_oct.c b/lib/libcrypto/ct/ct_oct.c index 94e67c6bc..1f5e5c75d 100644 --- a/lib/libcrypto/ct/ct_oct.c +++ b/lib/libcrypto/ct/ct_oct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ct_oct.c,v 1.8 2021/12/20 17:23:07 jsing Exp $ */ +/* $OpenBSD: ct_oct.c,v 1.9 2023/07/08 07:22:58 beck Exp $ */ /* * Written by Rob Stradling (rob@comodo.com) and Stephen Henson * (steve@openssl.org) for the OpenSSL project 2014. @@ -208,6 +208,7 @@ o2i_SCT(SCT **psct, const unsigned char **in, size_t len) return sct; } +LCRYPTO_ALIAS(o2i_SCT); int i2o_SCT_signature(const SCT *sct, unsigned char **out) @@ -314,6 +315,7 @@ i2o_SCT(const SCT *sct, unsigned char **out) free(pstart); return -1; } +LCRYPTO_ALIAS(i2o_SCT); STACK_OF(SCT) * o2i_SCT_LIST(STACK_OF(SCT) **out_scts, const unsigned char **pp, size_t len) @@ -366,6 +368,7 @@ o2i_SCT_LIST(STACK_OF(SCT) **out_scts, const unsigned char **pp, size_t len) return NULL; } +LCRYPTO_ALIAS(o2i_SCT_LIST); int i2o_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp) @@ -422,6 +425,7 @@ i2o_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp) } return -1; } +LCRYPTO_ALIAS(i2o_SCT_LIST); STACK_OF(SCT) * d2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp, long len) @@ -441,6 +445,7 @@ d2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp, long len) ASN1_OCTET_STRING_free(oct); return sk; } +LCRYPTO_ALIAS(d2i_SCT_LIST); int i2d_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **out) @@ -456,3 +461,4 @@ i2d_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **out) free(oct.data); return len; } +LCRYPTO_ALIAS(i2d_SCT_LIST); diff --git a/lib/libcrypto/ct/ct_policy.c b/lib/libcrypto/ct/ct_policy.c index 2cb3e6933..eb2b31201 100644 --- a/lib/libcrypto/ct/ct_policy.c +++ b/lib/libcrypto/ct/ct_policy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ct_policy.c,v 1.5 2021/12/18 16:34:52 tb Exp $ */ +/* $OpenBSD: ct_policy.c,v 1.6 2023/07/08 07:22:58 beck Exp $ */ /* * Implementations of Certificate Transparency SCT policies. * Written by Rob Percival (robpercival@google.com) for the OpenSSL project. @@ -86,6 +86,7 @@ CT_POLICY_EVAL_CTX_new(void) return ctx; } +LCRYPTO_ALIAS(CT_POLICY_EVAL_CTX_new); void CT_POLICY_EVAL_CTX_free(CT_POLICY_EVAL_CTX *ctx) @@ -96,6 +97,7 @@ CT_POLICY_EVAL_CTX_free(CT_POLICY_EVAL_CTX *ctx) X509_free(ctx->issuer); free(ctx); } +LCRYPTO_ALIAS(CT_POLICY_EVAL_CTX_free); int CT_POLICY_EVAL_CTX_set1_cert(CT_POLICY_EVAL_CTX *ctx, X509 *cert) @@ -105,6 +107,7 @@ CT_POLICY_EVAL_CTX_set1_cert(CT_POLICY_EVAL_CTX *ctx, X509 *cert) ctx->cert = cert; return 1; } +LCRYPTO_ALIAS(CT_POLICY_EVAL_CTX_set1_cert); int CT_POLICY_EVAL_CTX_set1_issuer(CT_POLICY_EVAL_CTX *ctx, X509 *issuer) @@ -114,6 +117,7 @@ CT_POLICY_EVAL_CTX_set1_issuer(CT_POLICY_EVAL_CTX *ctx, X509 *issuer) ctx->issuer = issuer; return 1; } +LCRYPTO_ALIAS(CT_POLICY_EVAL_CTX_set1_issuer); void CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE(CT_POLICY_EVAL_CTX *ctx, @@ -121,33 +125,39 @@ CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE(CT_POLICY_EVAL_CTX *ctx, { ctx->log_store = log_store; } +LCRYPTO_ALIAS(CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE); void CT_POLICY_EVAL_CTX_set_time(CT_POLICY_EVAL_CTX *ctx, uint64_t time_in_ms) { ctx->epoch_time_in_ms = time_in_ms; } +LCRYPTO_ALIAS(CT_POLICY_EVAL_CTX_set_time); X509 * CT_POLICY_EVAL_CTX_get0_cert(const CT_POLICY_EVAL_CTX *ctx) { return ctx->cert; } +LCRYPTO_ALIAS(CT_POLICY_EVAL_CTX_get0_cert); X509 * CT_POLICY_EVAL_CTX_get0_issuer(const CT_POLICY_EVAL_CTX *ctx) { return ctx->issuer; } +LCRYPTO_ALIAS(CT_POLICY_EVAL_CTX_get0_issuer); const CTLOG_STORE * CT_POLICY_EVAL_CTX_get0_log_store(const CT_POLICY_EVAL_CTX *ctx) { return ctx->log_store; } +LCRYPTO_ALIAS(CT_POLICY_EVAL_CTX_get0_log_store); uint64_t CT_POLICY_EVAL_CTX_get_time(const CT_POLICY_EVAL_CTX *ctx) { return ctx->epoch_time_in_ms; } +LCRYPTO_ALIAS(CT_POLICY_EVAL_CTX_get_time); diff --git a/lib/libcrypto/ct/ct_prn.c b/lib/libcrypto/ct/ct_prn.c index ea4f3b247..e6931eeb0 100644 --- a/lib/libcrypto/ct/ct_prn.c +++ b/lib/libcrypto/ct/ct_prn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ct_prn.c,v 1.6 2021/12/18 16:34:52 tb Exp $ */ +/* $OpenBSD: ct_prn.c,v 1.7 2023/07/08 07:22:58 beck Exp $ */ /* * Written by Rob Stradling (rob@comodo.com) and Stephen Henson * (steve@openssl.org) for the OpenSSL project 2014. @@ -146,6 +146,7 @@ SCT_validation_status_string(const SCT *sct) } return "unknown status"; } +LCRYPTO_ALIAS(SCT_validation_status_string); void SCT_print(const SCT *sct, BIO *out, int indent, const CTLOG_STORE *log_store) @@ -190,6 +191,7 @@ SCT_print(const SCT *sct, BIO *out, int indent, const CTLOG_STORE *log_store) BIO_printf(out, "\n%*s ", indent + 4, ""); BIO_hex_string(out, indent + 16, 16, sct->sig, sct->sig_len); } +LCRYPTO_ALIAS(SCT_print); void SCT_LIST_print(const STACK_OF(SCT) *sct_list, BIO *out, int indent, @@ -206,3 +208,4 @@ SCT_LIST_print(const STACK_OF(SCT) *sct_list, BIO *out, int indent, BIO_printf(out, "%s", separator); } } +LCRYPTO_ALIAS(SCT_LIST_print); diff --git a/lib/libcrypto/ct/ct_sct.c b/lib/libcrypto/ct/ct_sct.c index a05b0f92a..16ee8d557 100644 --- a/lib/libcrypto/ct/ct_sct.c +++ b/lib/libcrypto/ct/ct_sct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ct_sct.c,v 1.8 2022/01/22 00:29:59 inoguchi Exp $ */ +/* $OpenBSD: ct_sct.c,v 1.9 2023/07/08 07:22:58 beck Exp $ */ /* * Written by Rob Stradling (rob@comodo.com), Stephen Henson (steve@openssl.org) * and Adam Eijdenberg (adam.eijdenberg@gmail.com) for the OpenSSL project 2016. @@ -85,6 +85,7 @@ SCT_new(void) sct->version = SCT_VERSION_NOT_SET; return sct; } +LCRYPTO_ALIAS(SCT_new); void SCT_free(SCT *sct) @@ -98,12 +99,14 @@ SCT_free(SCT *sct) free(sct->sct); free(sct); } +LCRYPTO_ALIAS(SCT_free); void SCT_LIST_free(STACK_OF(SCT) *scts) { sk_SCT_pop_free(scts, SCT_free); } +LCRYPTO_ALIAS(SCT_LIST_free); int SCT_set_version(SCT *sct, sct_version_t version) @@ -116,6 +119,7 @@ SCT_set_version(SCT *sct, sct_version_t version) sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; return 1; } +LCRYPTO_ALIAS(SCT_set_version); int SCT_set_log_entry_type(SCT *sct, ct_log_entry_type_t entry_type) @@ -133,6 +137,7 @@ SCT_set_log_entry_type(SCT *sct, ct_log_entry_type_t entry_type) CTerror(CT_R_UNSUPPORTED_ENTRY_TYPE); return 0; } +LCRYPTO_ALIAS(SCT_set_log_entry_type); int SCT_set0_log_id(SCT *sct, unsigned char *log_id, size_t log_id_len) @@ -148,6 +153,7 @@ SCT_set0_log_id(SCT *sct, unsigned char *log_id, size_t log_id_len) sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; return 1; } +LCRYPTO_ALIAS(SCT_set0_log_id); int SCT_set1_log_id(SCT *sct, const unsigned char *log_id, size_t log_id_len) @@ -173,6 +179,7 @@ SCT_set1_log_id(SCT *sct, const unsigned char *log_id, size_t log_id_len) } return 1; } +LCRYPTO_ALIAS(SCT_set1_log_id); void @@ -181,6 +188,7 @@ SCT_set_timestamp(SCT *sct, uint64_t timestamp) sct->timestamp = timestamp; sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; } +LCRYPTO_ALIAS(SCT_set_timestamp); int SCT_set_signature_nid(SCT *sct, int nid) @@ -201,6 +209,7 @@ SCT_set_signature_nid(SCT *sct, int nid) return 0; } } +LCRYPTO_ALIAS(SCT_set_signature_nid); void SCT_set0_extensions(SCT *sct, unsigned char *ext, size_t ext_len) @@ -210,6 +219,7 @@ SCT_set0_extensions(SCT *sct, unsigned char *ext, size_t ext_len) sct->ext_len = ext_len; sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; } +LCRYPTO_ALIAS(SCT_set0_extensions); int SCT_set1_extensions(SCT *sct, const unsigned char *ext, size_t ext_len) @@ -230,6 +240,7 @@ SCT_set1_extensions(SCT *sct, const unsigned char *ext, size_t ext_len) } return 1; } +LCRYPTO_ALIAS(SCT_set1_extensions); void SCT_set0_signature(SCT *sct, unsigned char *sig, size_t sig_len) @@ -239,6 +250,7 @@ SCT_set0_signature(SCT *sct, unsigned char *sig, size_t sig_len) sct->sig_len = sig_len; sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; } +LCRYPTO_ALIAS(SCT_set0_signature); int SCT_set1_signature(SCT *sct, const unsigned char *sig, size_t sig_len) @@ -259,18 +271,21 @@ SCT_set1_signature(SCT *sct, const unsigned char *sig, size_t sig_len) } return 1; } +LCRYPTO_ALIAS(SCT_set1_signature); sct_version_t SCT_get_version(const SCT *sct) { return sct->version; } +LCRYPTO_ALIAS(SCT_get_version); ct_log_entry_type_t SCT_get_log_entry_type(const SCT *sct) { return sct->entry_type; } +LCRYPTO_ALIAS(SCT_get_log_entry_type); size_t SCT_get0_log_id(const SCT *sct, unsigned char **log_id) @@ -278,12 +293,14 @@ SCT_get0_log_id(const SCT *sct, unsigned char **log_id) *log_id = sct->log_id; return sct->log_id_len; } +LCRYPTO_ALIAS(SCT_get0_log_id); uint64_t SCT_get_timestamp(const SCT *sct) { return sct->timestamp; } +LCRYPTO_ALIAS(SCT_get_timestamp); int SCT_get_signature_nid(const SCT *sct) @@ -303,6 +320,7 @@ SCT_get_signature_nid(const SCT *sct) } return NID_undef; } +LCRYPTO_ALIAS(SCT_get_signature_nid); size_t SCT_get0_extensions(const SCT *sct, unsigned char **ext) @@ -310,6 +328,7 @@ SCT_get0_extensions(const SCT *sct, unsigned char **ext) *ext = sct->ext; return sct->ext_len; } +LCRYPTO_ALIAS(SCT_get0_extensions); size_t SCT_get0_signature(const SCT *sct, unsigned char **sig) @@ -317,6 +336,7 @@ SCT_get0_signature(const SCT *sct, unsigned char **sig) *sig = sct->sig; return sct->sig_len; } +LCRYPTO_ALIAS(SCT_get0_signature); int SCT_is_complete(const SCT *sct) @@ -343,6 +363,7 @@ SCT_get_source(const SCT *sct) { return sct->source; } +LCRYPTO_ALIAS(SCT_get_source); int SCT_set_source(SCT *sct, sct_source_t source) @@ -361,12 +382,14 @@ SCT_set_source(SCT *sct, sct_source_t source) /* if we aren't sure, leave the log entry type alone */ return 1; } +LCRYPTO_ALIAS(SCT_set_source); sct_validation_status_t SCT_get_validation_status(const SCT *sct) { return sct->validation_status; } +LCRYPTO_ALIAS(SCT_get_validation_status); int SCT_validate(SCT *sct, const CT_POLICY_EVAL_CTX *ctx) @@ -455,6 +478,7 @@ SCT_validate(SCT *sct, const CT_POLICY_EVAL_CTX *ctx) return is_sct_valid; } +LCRYPTO_ALIAS(SCT_validate); int SCT_LIST_validate(const STACK_OF(SCT) *scts, CT_POLICY_EVAL_CTX *ctx) @@ -478,3 +502,4 @@ SCT_LIST_validate(const STACK_OF(SCT) *scts, CT_POLICY_EVAL_CTX *ctx) return are_scts_valid; } +LCRYPTO_ALIAS(SCT_LIST_validate); diff --git a/lib/libcrypto/curve25519/curve25519.c b/lib/libcrypto/curve25519/curve25519.c index 4f85a81f4..4e644c428 100644 --- a/lib/libcrypto/curve25519/curve25519.c +++ b/lib/libcrypto/curve25519/curve25519.c @@ -1,4 +1,4 @@ -/* $OpenBSD: curve25519.c,v 1.15 2023/04/02 15:36:53 tb Exp $ */ +/* $OpenBSD: curve25519.c,v 1.16 2023/07/08 15:12:49 beck Exp $ */ /* * Copyright (c) 2015, Google Inc. * @@ -4636,6 +4636,7 @@ void ED25519_keypair(uint8_t out_public_key[ED25519_PUBLIC_KEY_LENGTH], ED25519_public_from_private(out_public_key, out_private_key); } +LCRYPTO_ALIAS(ED25519_keypair); int ED25519_sign(uint8_t *out_sig, const uint8_t *message, size_t message_len, const uint8_t public_key[ED25519_PUBLIC_KEY_LENGTH], @@ -4671,6 +4672,7 @@ int ED25519_sign(uint8_t *out_sig, const uint8_t *message, size_t message_len, return 1; } +LCRYPTO_ALIAS(ED25519_sign); /* * Little endian representation of the order of edwards25519, @@ -4735,6 +4737,7 @@ int ED25519_verify(const uint8_t *message, size_t message_len, return timingsafe_memcmp(rcheck, rcopy, sizeof(rcheck)) == 0; } +LCRYPTO_ALIAS(ED25519_verify); /* Replace (f,g) with (g,f) if b == 1; * replace (f,g) with (f,g) if b == 0. @@ -4926,6 +4929,7 @@ X25519_keypair(uint8_t out_public_key[X25519_KEY_LENGTH], X25519_public_from_private(out_public_key, out_private_key); } +LCRYPTO_ALIAS(X25519_keypair); int X25519(uint8_t out_shared_key[X25519_KEY_LENGTH], @@ -4939,3 +4943,4 @@ X25519(uint8_t out_shared_key[X25519_KEY_LENGTH], /* The all-zero output results when the input is a point of small order. */ return timingsafe_memcmp(kZeros, out_shared_key, 32) != 0; } +LCRYPTO_ALIAS(X25519); diff --git a/lib/libcrypto/cversion.c b/lib/libcrypto/cversion.c index 2d4460d10..acb7b7054 100644 --- a/lib/libcrypto/cversion.c +++ b/lib/libcrypto/cversion.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cversion.c,v 1.17 2018/02/17 06:56:12 jsing Exp $ */ +/* $OpenBSD: cversion.c,v 1.18 2023/07/08 08:28:23 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -78,12 +78,14 @@ SSLeay_version(int t) } return("not available"); } +LCRYPTO_ALIAS(SSLeay_version); unsigned long SSLeay(void) { return (SSLEAY_VERSION_NUMBER); } +LCRYPTO_ALIAS(SSLeay); const char * OpenSSL_version(int t) @@ -104,9 +106,11 @@ OpenSSL_version(int t) } return("not available"); } +LCRYPTO_ALIAS(OpenSSL_version); unsigned long OpenSSL_version_num(void) { return SSLeay(); } +LCRYPTO_ALIAS(OpenSSL_version_num); diff --git a/lib/libcrypto/des/cbc_cksm.c b/lib/libcrypto/des/cbc_cksm.c index 2c1c4aa83..afa3f03d9 100644 --- a/lib/libcrypto/des/cbc_cksm.c +++ b/lib/libcrypto/des/cbc_cksm.c @@ -1,25 +1,25 @@ -/* $OpenBSD: cbc_cksm.c,v 1.8 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: cbc_cksm.c,v 1.10 2023/07/08 07:34:34 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -58,49 +58,48 @@ #include "des_local.h" -DES_LONG DES_cbc_cksum(const unsigned char *in, DES_cblock *output, - long length, DES_key_schedule *schedule, - const_DES_cblock *ivec) - { - DES_LONG tout0,tout1,tin0,tin1; - long l=length; +DES_LONG +DES_cbc_cksum(const unsigned char *in, DES_cblock *output, + long length, DES_key_schedule *schedule, + const_DES_cblock *ivec) +{ + DES_LONG tout0, tout1, tin0, tin1; + long l = length; DES_LONG tin[2]; unsigned char *out = &(*output)[0]; const unsigned char *iv = &(*ivec)[0]; - c2l(iv,tout0); - c2l(iv,tout1); - for (; l>0; l-=8) - { - if (l >= 8) - { - c2l(in,tin0); - c2l(in,tin1); - } - else - c2ln(in,tin0,tin1,l); - - tin0^=tout0; tin[0]=tin0; - tin1^=tout1; tin[1]=tin1; - DES_encrypt1((DES_LONG *)tin,schedule,DES_ENCRYPT); + c2l(iv, tout0); + c2l(iv, tout1); + for (; l > 0; l -= 8) { + if (l >= 8) { + c2l(in, tin0); + c2l(in, tin1); + } else + c2ln(in, tin0, tin1, l); + + tin0 ^= tout0; + tin[0] = tin0; + tin1 ^= tout1; + tin[1] = tin1; + DES_encrypt1((DES_LONG *)tin, schedule, DES_ENCRYPT); /* fix 15/10/91 eay - thanks to keithr@sco.COM */ - tout0=tin[0]; - tout1=tin[1]; - } - if (out != NULL) - { - l2c(tout0,out); - l2c(tout1,out); - } - tout0=tin0=tin1=tin[0]=tin[1]=0; + tout0 = tin[0]; + tout1 = tin[1]; + } + if (out != NULL) { + l2c(tout0, out); + l2c(tout1, out); + } + tout0 = tin0 = tin1 = tin[0] = tin[1] = 0; /* Transform the data in tout1 so that it will match the return value that the MIT Kerberos mit_des_cbc_cksum API returns. */ - tout1 = ((tout1 >> 24L) & 0x000000FF) - | ((tout1 >> 8L) & 0x0000FF00) - | ((tout1 << 8L) & 0x00FF0000) - | ((tout1 << 24L) & 0xFF000000); - return(tout1); - } + tout1 = ((tout1 >> 24L) & 0x000000FF) | + ((tout1 >> 8L) & 0x0000FF00) | + ((tout1 << 8L) & 0x00FF0000) | + ((tout1 << 24L) & 0xFF000000); + return (tout1); +} diff --git a/lib/libcrypto/des/cbc_enc.c b/lib/libcrypto/des/cbc_enc.c index 5db52809c..6c1ec7117 100644 --- a/lib/libcrypto/des/cbc_enc.c +++ b/lib/libcrypto/des/cbc_enc.c @@ -1,25 +1,25 @@ -/* $OpenBSD: cbc_enc.c,v 1.3 2014/06/12 15:49:28 deraadt Exp $ */ +/* $OpenBSD: cbc_enc.c,v 1.4 2023/07/08 07:11:07 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence diff --git a/lib/libcrypto/des/cfb64ede.c b/lib/libcrypto/des/cfb64ede.c index f2b2fe2db..e91dbbfc4 100644 --- a/lib/libcrypto/des/cfb64ede.c +++ b/lib/libcrypto/des/cfb64ede.c @@ -1,25 +1,25 @@ -/* $OpenBSD: cfb64ede.c,v 1.10 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: cfb64ede.c,v 1.12 2023/07/08 07:34:34 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -63,182 +63,178 @@ * 64bit block we have used is contained in *num; */ -void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3, - DES_cblock *ivec, int *num, int enc) - { - DES_LONG v0,v1; - long l=length; - int n= *num; +void +DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3, + DES_cblock *ivec, int *num, int enc) +{ + DES_LONG v0, v1; + long l = length; + int n = *num; DES_LONG ti[2]; - unsigned char *iv,c,cc; + unsigned char *iv, c, cc; - iv=&(*ivec)[0]; - if (enc) - { - while (l--) - { - if (n == 0) - { - c2l(iv,v0); - c2l(iv,v1); + iv = &(*ivec)[0]; + if (enc) { + while (l--) { + if (n == 0) { + c2l(iv, v0); + c2l(iv, v1); - ti[0]=v0; - ti[1]=v1; - DES_encrypt3(ti,ks1,ks2,ks3); - v0=ti[0]; - v1=ti[1]; + ti[0] = v0; + ti[1] = v1; + DES_encrypt3(ti, ks1, ks2, ks3); + v0 = ti[0]; + v1 = ti[1]; iv = &(*ivec)[0]; - l2c(v0,iv); - l2c(v1,iv); + l2c(v0, iv); + l2c(v1, iv); iv = &(*ivec)[0]; - } - c= *(in++)^iv[n]; - *(out++)=c; - iv[n]=c; - n=(n+1)&0x07; } + c = *(in++) ^ iv[n]; + *(out++) = c; + iv[n] = c; + n = (n + 1) & 0x07; } - else - { - while (l--) - { - if (n == 0) - { - c2l(iv,v0); - c2l(iv,v1); + } else { + while (l--) { + if (n == 0) { + c2l(iv, v0); + c2l(iv, v1); - ti[0]=v0; - ti[1]=v1; - DES_encrypt3(ti,ks1,ks2,ks3); - v0=ti[0]; - v1=ti[1]; + ti[0] = v0; + ti[1] = v1; + DES_encrypt3(ti, ks1, ks2, ks3); + v0 = ti[0]; + v1 = ti[1]; iv = &(*ivec)[0]; - l2c(v0,iv); - l2c(v1,iv); + l2c(v0, iv); + l2c(v1, iv); iv = &(*ivec)[0]; - } - cc= *(in++); - c=iv[n]; - iv[n]=cc; - *(out++)=c^cc; - n=(n+1)&0x07; } + cc = *(in++); + c = iv[n]; + iv[n] = cc; + *(out++) = c ^ cc; + n = (n + 1) & 0x07; } - v0=v1=ti[0]=ti[1]=c=cc=0; - *num=n; } + v0 = v1 = ti[0] = ti[1] = c = cc = 0; + *num = n; +} /* This is compatible with the single key CFB-r for DES, even thought that's * not what EVP needs. */ -void DES_ede3_cfb_encrypt(const unsigned char *in,unsigned char *out, - int numbits,long length,DES_key_schedule *ks1, - DES_key_schedule *ks2,DES_key_schedule *ks3, - DES_cblock *ivec,int enc) - { - DES_LONG d0,d1,v0,v1; - unsigned long l=length,n=((unsigned int)numbits+7)/8; - int num=numbits,i; +void +DES_ede3_cfb_encrypt(const unsigned char *in, unsigned char *out, + int numbits, long length, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3, + DES_cblock *ivec, int enc) +{ + DES_LONG d0, d1, v0, v1; + unsigned long l = length, n = ((unsigned int)numbits + 7)/8; + int num = numbits, i; DES_LONG ti[2]; unsigned char *iv; unsigned char ovec[16]; - if (num > 64) return; + if (num > 64) + return; iv = &(*ivec)[0]; - c2l(iv,v0); - c2l(iv,v1); - if (enc) - { - while (l >= n) - { - l-=n; - ti[0]=v0; - ti[1]=v1; - DES_encrypt3(ti,ks1,ks2,ks3); - c2ln(in,d0,d1,n); - in+=n; - d0^=ti[0]; - d1^=ti[1]; - l2cn(d0,d1,out,n); - out+=n; + c2l(iv, v0); + c2l(iv, v1); + if (enc) { + while (l >= n) { + l -= n; + ti[0] = v0; + ti[1] = v1; + DES_encrypt3(ti, ks1, ks2, ks3); + c2ln(in, d0, d1, n); + in += n; + d0 ^= ti[0]; + d1 ^= ti[1]; + l2cn(d0, d1, out, n); + out += n; /* 30-08-94 - eay - changed because l>>32 and * l<<32 are bad under gcc :-( */ - if (num == 32) - { v0=v1; v1=d0; } - else if (num == 64) - { v0=d0; v1=d1; } - else - { - iv=&ovec[0]; - l2c(v0,iv); - l2c(v1,iv); - l2c(d0,iv); - l2c(d1,iv); + if (num == 32) { + v0 = v1; + v1 = d0; + } else if (num == 64) { + v0 = d0; + v1 = d1; + } else { + iv = &ovec[0]; + l2c(v0, iv); + l2c(v1, iv); + l2c(d0, iv); + l2c(d1, iv); /* shift ovec left most of the bits... */ - memmove(ovec,ovec+num/8,8+(num%8 ? 1 : 0)); + memmove(ovec, ovec + num/8, + 8 + (num % 8 ? 1 : 0)); /* now the remaining bits */ - if(num%8 != 0) - for(i=0 ; i < 8 ; ++i) - { - ovec[i]<<=num%8; - ovec[i]|=ovec[i+1]>>(8-num%8); - } - iv=&ovec[0]; - c2l(iv,v0); - c2l(iv,v1); + if (num % 8 != 0) { + for (i = 0; i < 8; ++i) { + ovec[i] <<= num % 8; + ovec[i] |= ovec[i + 1] >> + (8 - num % 8); + } } + iv = &ovec[0]; + c2l(iv, v0); + c2l(iv, v1); } } - else - { - while (l >= n) - { - l-=n; - ti[0]=v0; - ti[1]=v1; - DES_encrypt3(ti,ks1,ks2,ks3); - c2ln(in,d0,d1,n); - in+=n; + } else { + while (l >= n) { + l -= n; + ti[0] = v0; + ti[1] = v1; + DES_encrypt3(ti, ks1, ks2, ks3); + c2ln(in, d0, d1, n); + in += n; /* 30-08-94 - eay - changed because l>>32 and * l<<32 are bad under gcc :-( */ - if (num == 32) - { v0=v1; v1=d0; } - else if (num == 64) - { v0=d0; v1=d1; } - else - { - iv=&ovec[0]; - l2c(v0,iv); - l2c(v1,iv); - l2c(d0,iv); - l2c(d1,iv); + if (num == 32) { + v0 = v1; + v1 = d0; + } else if (num == 64) { + v0 = d0; + v1 = d1; + } else { + iv = &ovec[0]; + l2c(v0, iv); + l2c(v1, iv); + l2c(d0, iv); + l2c(d1, iv); /* shift ovec left most of the bits... */ - memmove(ovec,ovec+num/8,8+(num%8 ? 1 : 0)); + memmove(ovec, ovec + num/8, + 8 + (num % 8 ? 1 : 0)); /* now the remaining bits */ - if(num%8 != 0) - for(i=0 ; i < 8 ; ++i) - { - ovec[i]<<=num%8; - ovec[i]|=ovec[i+1]>>(8-num%8); - } - iv=&ovec[0]; - c2l(iv,v0); - c2l(iv,v1); + if (num % 8 != 0) { + for (i = 0; i < 8; ++i) { + ovec[i] <<= num % 8; + ovec[i] |= ovec[i + 1] >> + (8 - num % 8); + } } - d0^=ti[0]; - d1^=ti[1]; - l2cn(d0,d1,out,n); - out+=n; + iv = &ovec[0]; + c2l(iv, v0); + c2l(iv, v1); } + d0 ^= ti[0]; + d1 ^= ti[1]; + l2cn(d0, d1, out, n); + out += n; } - iv = &(*ivec)[0]; - l2c(v0,iv); - l2c(v1,iv); - v0=v1=d0=d1=ti[0]=ti[1]=0; } - + iv = &(*ivec)[0]; + l2c(v0, iv); + l2c(v1, iv); + v0 = v1 = d0 = d1 = ti[0] = ti[1] = 0; +} diff --git a/lib/libcrypto/des/cfb64enc.c b/lib/libcrypto/des/cfb64enc.c index 4e9284599..d7434b9db 100644 --- a/lib/libcrypto/des/cfb64enc.c +++ b/lib/libcrypto/des/cfb64enc.c @@ -1,25 +1,25 @@ -/* $OpenBSD: cfb64enc.c,v 1.7 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: cfb64enc.c,v 1.8 2023/07/08 07:11:07 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -63,59 +63,60 @@ * 64bit block we have used is contained in *num; */ -void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int *num, int enc) - { - DES_LONG v0,v1; - long l=length; - int n= *num; +void +DES_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int *num, int enc) +{ + DES_LONG v0, v1; + long l = length; + int n = *num; DES_LONG ti[2]; - unsigned char *iv,c,cc; + unsigned char *iv, c, cc; iv = &(*ivec)[0]; - if (enc) - { - while (l--) - { - if (n == 0) - { - c2l(iv,v0); ti[0]=v0; - c2l(iv,v1); ti[1]=v1; - DES_encrypt1(ti,schedule,DES_ENCRYPT); + if (enc) { + while (l--) { + if (n == 0) { + c2l(iv, v0); + ti[0] = v0; + c2l(iv, v1); + ti[1] = v1; + DES_encrypt1(ti, schedule, DES_ENCRYPT); iv = &(*ivec)[0]; - v0=ti[0]; l2c(v0,iv); - v0=ti[1]; l2c(v0,iv); + v0 = ti[0]; + l2c(v0, iv); + v0 = ti[1]; + l2c(v0, iv); iv = &(*ivec)[0]; - } - c= *(in++)^iv[n]; - *(out++)=c; - iv[n]=c; - n=(n+1)&0x07; } + c = *(in++) ^ iv[n]; + *(out++) = c; + iv[n] = c; + n = (n + 1) & 0x07; } - else - { - while (l--) - { - if (n == 0) - { - c2l(iv,v0); ti[0]=v0; - c2l(iv,v1); ti[1]=v1; - DES_encrypt1(ti,schedule,DES_ENCRYPT); + } else { + while (l--) { + if (n == 0) { + c2l(iv, v0); + ti[0] = v0; + c2l(iv, v1); + ti[1] = v1; + DES_encrypt1(ti, schedule, DES_ENCRYPT); iv = &(*ivec)[0]; - v0=ti[0]; l2c(v0,iv); - v0=ti[1]; l2c(v0,iv); + v0 = ti[0]; + l2c(v0, iv); + v0 = ti[1]; + l2c(v0, iv); iv = &(*ivec)[0]; - } - cc= *(in++); - c=iv[n]; - iv[n]=cc; - *(out++)=c^cc; - n=(n+1)&0x07; } + cc = *(in++); + c = iv[n]; + iv[n] = cc; + *(out++) = c ^ cc; + n = (n + 1) & 0x07; } - v0=v1=ti[0]=ti[1]=c=cc=0; - *num=n; } - + v0 = v1 = ti[0] = ti[1] = c = cc = 0; + *num = n; +} diff --git a/lib/libcrypto/des/cfb_enc.c b/lib/libcrypto/des/cfb_enc.c index 9ba31f4e1..dac86751d 100644 --- a/lib/libcrypto/des/cfb_enc.c +++ b/lib/libcrypto/des/cfb_enc.c @@ -1,25 +1,25 @@ -/* $OpenBSD: cfb_enc.c,v 1.15 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: cfb_enc.c,v 1.16 2023/07/08 07:11:07 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -67,123 +67,123 @@ */ /* Until Aug 1 2003 this function did not correctly implement CFB-r, so it * will not be compatible with any encryption prior to that date. Ben. */ -void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, - long length, DES_key_schedule *schedule, DES_cblock *ivec, - int enc) - { - DES_LONG d0,d1,v0,v1; - unsigned long l=length; - int num=numbits/8,n=(numbits+7)/8,i,rem=numbits%8; +void +DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, + long length, DES_key_schedule *schedule, DES_cblock *ivec, + int enc) +{ + DES_LONG d0, d1, v0, v1; + unsigned long l = length; + int num = numbits/8, n = (numbits + 7)/8, i, rem = numbits % 8; DES_LONG ti[2]; unsigned char *iv; #if BYTE_ORDER != LITTLE_ENDIAN unsigned char ovec[16]; #else - unsigned int sh[4]; - unsigned char *ovec=(unsigned char *)sh; + unsigned int sh[4]; + unsigned char *ovec = (unsigned char *)sh; #endif - if (numbits<=0 || numbits > 64) return; + if (numbits <= 0 || numbits > 64) + return; iv = &(*ivec)[0]; - c2l(iv,v0); - c2l(iv,v1); - if (enc) - { - while (l >= (unsigned long)n) - { - l-=n; - ti[0]=v0; - ti[1]=v1; - DES_encrypt1((DES_LONG *)ti,schedule,DES_ENCRYPT); - c2ln(in,d0,d1,n); - in+=n; - d0^=ti[0]; - d1^=ti[1]; - l2cn(d0,d1,out,n); - out+=n; + c2l(iv, v0); + c2l(iv, v1); + if (enc) { + while (l >= (unsigned long)n) { + l -= n; + ti[0] = v0; + ti[1] = v1; + DES_encrypt1((DES_LONG *)ti, schedule, DES_ENCRYPT); + c2ln(in, d0, d1, n); + in += n; + d0 ^= ti[0]; + d1 ^= ti[1]; + l2cn(d0, d1, out, n); + out += n; /* 30-08-94 - eay - changed because l>>32 and * l<<32 are bad under gcc :-( */ - if (numbits == 32) - { v0=v1; v1=d0; } - else if (numbits == 64) - { v0=d0; v1=d1; } - else - { + if (numbits == 32) { + v0 = v1; + v1 = d0; + } else if (numbits == 64) { + v0 = d0; + v1 = d1; + } else { #if BYTE_ORDER != LITTLE_ENDIAN - iv=&ovec[0]; - l2c(v0,iv); - l2c(v1,iv); - l2c(d0,iv); - l2c(d1,iv); + iv = &ovec[0]; + l2c(v0, iv); + l2c(v1, iv); + l2c(d0, iv); + l2c(d1, iv); #else - sh[0]=v0, sh[1]=v1, sh[2]=d0, sh[3]=d1; + sh[0] = v0, sh[1] = v1, sh[2] = d0, sh[3] = d1; #endif - if (rem==0) - memmove(ovec,ovec+num,8); + if (rem == 0) + memmove(ovec, ovec + num, 8); else - for(i=0 ; i < 8 ; ++i) - ovec[i]=ovec[i+num]<>(8-rem); + for (i = 0; i < 8; ++i) + ovec[i] = ovec[i + num] << rem | + ovec[i + num + 1] >> (8 - + rem); #if BYTE_ORDER == LITTLE_ENDIAN - v0=sh[0], v1=sh[1]; + v0 = sh[0], v1 = sh[1]; #else - iv=&ovec[0]; - c2l(iv,v0); - c2l(iv,v1); + iv = &ovec[0]; + c2l(iv, v0); + c2l(iv, v1); #endif - } } } - else - { - while (l >= (unsigned long)n) - { - l-=n; - ti[0]=v0; - ti[1]=v1; - DES_encrypt1((DES_LONG *)ti,schedule,DES_ENCRYPT); - c2ln(in,d0,d1,n); - in+=n; + } else { + while (l >= (unsigned long)n) { + l -= n; + ti[0] = v0; + ti[1] = v1; + DES_encrypt1((DES_LONG *)ti, schedule, DES_ENCRYPT); + c2ln(in, d0, d1, n); + in += n; /* 30-08-94 - eay - changed because l>>32 and * l<<32 are bad under gcc :-( */ - if (numbits == 32) - { v0=v1; v1=d0; } - else if (numbits == 64) - { v0=d0; v1=d1; } - else - { + if (numbits == 32) { + v0 = v1; + v1 = d0; + } else if (numbits == 64) { + v0 = d0; + v1 = d1; + } else { #if BYTE_ORDER != LITTLE_ENDIAN - iv=&ovec[0]; - l2c(v0,iv); - l2c(v1,iv); - l2c(d0,iv); - l2c(d1,iv); + iv = &ovec[0]; + l2c(v0, iv); + l2c(v1, iv); + l2c(d0, iv); + l2c(d1, iv); #else - sh[0]=v0, sh[1]=v1, sh[2]=d0, sh[3]=d1; + sh[0] = v0, sh[1] = v1, sh[2] = d0, sh[3] = d1; #endif - if (rem==0) - memmove(ovec,ovec+num,8); + if (rem == 0) + memmove(ovec, ovec + num, 8); else - for(i=0 ; i < 8 ; ++i) - ovec[i]=ovec[i+num]<>(8-rem); + for (i = 0; i < 8; ++i) + ovec[i] = ovec[i + num] << rem | + ovec[i + num + 1] >> (8 - + rem); #if BYTE_ORDER == LITTLE_ENDIAN - v0=sh[0], v1=sh[1]; + v0 = sh[0], v1 = sh[1]; #else - iv=&ovec[0]; - c2l(iv,v0); - c2l(iv,v1); + iv = &ovec[0]; + c2l(iv, v0); + c2l(iv, v1); #endif - } - d0^=ti[0]; - d1^=ti[1]; - l2cn(d0,d1,out,n); - out+=n; } + d0 ^= ti[0]; + d1 ^= ti[1]; + l2cn(d0, d1, out, n); + out += n; } - iv = &(*ivec)[0]; - l2c(v0,iv); - l2c(v1,iv); - v0=v1=d0=d1=ti[0]=ti[1]=0; } - + iv = &(*ivec)[0]; + l2c(v0, iv); + l2c(v1, iv); + v0 = v1 = d0 = d1 = ti[0] = ti[1] = 0; +} diff --git a/lib/libcrypto/des/des.h b/lib/libcrypto/des/des.h index e1331d3fa..ef2ecb4d0 100644 --- a/lib/libcrypto/des/des.h +++ b/lib/libcrypto/des/des.h @@ -1,25 +1,25 @@ -/* $OpenBSD: des.h,v 1.19 2015/02/07 13:19:15 doug Exp $ */ +/* $OpenBSD: des.h,v 1.20 2023/07/08 07:11:07 beck Exp $ */ /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -65,7 +65,6 @@ #error DES is disabled. #endif - #ifdef __cplusplus extern "C" { #endif @@ -75,16 +74,14 @@ typedef /* const */ unsigned char const_DES_cblock[8]; /* With "const", gcc 2.8.1 on Solaris thinks that DES_cblock * * and const_DES_cblock * are incompatible pointer types. */ -typedef struct DES_ks - { - union - { - DES_cblock cblock; +typedef struct DES_ks { + union { + DES_cblock cblock; /* make sure things are correct size on machines with * 8 byte longs */ - DES_LONG deslong[2]; + DES_LONG deslong[2]; } ks[16]; - } DES_key_schedule; +} DES_key_schedule; #define DES_KEY_SZ (sizeof(DES_cblock)) #define DES_SCHEDULE_SZ (sizeof(DES_key_schedule)) @@ -112,26 +109,26 @@ extern int DES_rw_mode; /* defaults to DES_PCBC_MODE */ const char *DES_options(void); void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, - DES_key_schedule *ks1,DES_key_schedule *ks2, - DES_key_schedule *ks3, int enc); -DES_LONG DES_cbc_cksum(const unsigned char *input,DES_cblock *output, - long length,DES_key_schedule *schedule, - const_DES_cblock *ivec); + DES_key_schedule *ks1, DES_key_schedule *ks2, + DES_key_schedule *ks3, int enc); +DES_LONG DES_cbc_cksum(const unsigned char *input, DES_cblock *output, + long length, DES_key_schedule *schedule, + const_DES_cblock *ivec); /* DES_cbc_encrypt does not update the IV! Use DES_ncbc_encrypt instead. */ -void DES_cbc_encrypt(const unsigned char *input,unsigned char *output, - long length,DES_key_schedule *schedule,DES_cblock *ivec, - int enc); -void DES_ncbc_encrypt(const unsigned char *input,unsigned char *output, - long length,DES_key_schedule *schedule,DES_cblock *ivec, - int enc); -void DES_xcbc_encrypt(const unsigned char *input,unsigned char *output, - long length,DES_key_schedule *schedule,DES_cblock *ivec, - const_DES_cblock *inw,const_DES_cblock *outw,int enc); -void DES_cfb_encrypt(const unsigned char *in,unsigned char *out,int numbits, - long length,DES_key_schedule *schedule,DES_cblock *ivec, - int enc); -void DES_ecb_encrypt(const_DES_cblock *input,DES_cblock *output, - DES_key_schedule *ks,int enc); +void DES_cbc_encrypt(const unsigned char *input, unsigned char *output, + long length, DES_key_schedule *schedule, DES_cblock *ivec, + int enc); +void DES_ncbc_encrypt(const unsigned char *input, unsigned char *output, + long length, DES_key_schedule *schedule, DES_cblock *ivec, + int enc); +void DES_xcbc_encrypt(const unsigned char *input, unsigned char *output, + long length, DES_key_schedule *schedule, DES_cblock *ivec, + const_DES_cblock *inw, const_DES_cblock *outw, int enc); +void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, + long length, DES_key_schedule *schedule, DES_cblock *ivec, + int enc); +void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, + DES_key_schedule *ks, int enc); /* This is the DES encryption function that gets called by just about every other DES routine in the library. You should not use this @@ -142,7 +139,7 @@ void DES_ecb_encrypt(const_DES_cblock *input,DES_cblock *output, Data is a pointer to 2 unsigned long's and ks is the DES_key_schedule to use. enc, is non zero specifies encryption, zero if decryption. */ -void DES_encrypt1(DES_LONG *data,DES_key_schedule *ks, int enc); +void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc); /* This functions is the same as DES_encrypt1() except that the DES initial permutation (IP) and final permutation (FP) have been left @@ -150,47 +147,47 @@ void DES_encrypt1(DES_LONG *data,DES_key_schedule *ks, int enc); It is used by the routines in the library that implement triple DES. IP() DES_encrypt2() DES_encrypt2() DES_encrypt2() FP() is the same as DES_encrypt1() DES_encrypt1() DES_encrypt1() except faster :-). */ -void DES_encrypt2(DES_LONG *data,DES_key_schedule *ks, int enc); +void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc); void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3); + DES_key_schedule *ks2, DES_key_schedule *ks3); void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3); -void DES_ede3_cbc_encrypt(const unsigned char *input,unsigned char *output, - long length, - DES_key_schedule *ks1,DES_key_schedule *ks2, - DES_key_schedule *ks3,DES_cblock *ivec,int enc); -void DES_ede3_cbcm_encrypt(const unsigned char *in,unsigned char *out, - long length, - DES_key_schedule *ks1,DES_key_schedule *ks2, - DES_key_schedule *ks3, - DES_cblock *ivec1,DES_cblock *ivec2, - int enc); -void DES_ede3_cfb64_encrypt(const unsigned char *in,unsigned char *out, - long length,DES_key_schedule *ks1, - DES_key_schedule *ks2,DES_key_schedule *ks3, - DES_cblock *ivec,int *num,int enc); -void DES_ede3_cfb_encrypt(const unsigned char *in,unsigned char *out, - int numbits,long length,DES_key_schedule *ks1, - DES_key_schedule *ks2,DES_key_schedule *ks3, - DES_cblock *ivec,int enc); -void DES_ede3_ofb64_encrypt(const unsigned char *in,unsigned char *out, - long length,DES_key_schedule *ks1, - DES_key_schedule *ks2,DES_key_schedule *ks3, - DES_cblock *ivec,int *num); -int DES_enc_read(int fd,void *buf,int len,DES_key_schedule *sched, - DES_cblock *iv); -int DES_enc_write(int fd,const void *buf,int len,DES_key_schedule *sched, - DES_cblock *iv); -char *DES_fcrypt(const char *buf,const char *salt, char *ret); -char *DES_crypt(const char *buf,const char *salt); -void DES_ofb_encrypt(const unsigned char *in,unsigned char *out,int numbits, - long length,DES_key_schedule *schedule,DES_cblock *ivec); -void DES_pcbc_encrypt(const unsigned char *input,unsigned char *output, - long length,DES_key_schedule *schedule,DES_cblock *ivec, - int enc); -DES_LONG DES_quad_cksum(const unsigned char *input,DES_cblock output[], - long length,int out_count,DES_cblock *seed); + DES_key_schedule *ks2, DES_key_schedule *ks3); +void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, + long length, + DES_key_schedule *ks1, DES_key_schedule *ks2, + DES_key_schedule *ks3, DES_cblock *ivec, int enc); +void DES_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out, + long length, + DES_key_schedule *ks1, DES_key_schedule *ks2, + DES_key_schedule *ks3, + DES_cblock *ivec1, DES_cblock *ivec2, + int enc); +void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3, + DES_cblock *ivec, int *num, int enc); +void DES_ede3_cfb_encrypt(const unsigned char *in, unsigned char *out, + int numbits, long length, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3, + DES_cblock *ivec, int enc); +void DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3, + DES_cblock *ivec, int *num); +int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched, + DES_cblock *iv); +int DES_enc_write(int fd, const void *buf, int len, DES_key_schedule *sched, + DES_cblock *iv); +char *DES_fcrypt(const char *buf, const char *salt, char *ret); +char *DES_crypt(const char *buf, const char *salt); +void DES_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits, + long length, DES_key_schedule *schedule, DES_cblock *ivec); +void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output, + long length, DES_key_schedule *schedule, DES_cblock *ivec, + int enc); +DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[], + long length, int out_count, DES_cblock *seed); int DES_random_key(DES_cblock *ret); void DES_set_odd_parity(DES_cblock *key); int DES_check_key_parity(const_DES_cblock *key); @@ -198,17 +195,17 @@ int DES_is_weak_key(const_DES_cblock *key); /* DES_set_key (= set_key = DES_key_sched = key_sched) calls * DES_set_key_checked if global variable DES_check_key is set, * DES_set_key_unchecked otherwise. */ -int DES_set_key(const_DES_cblock *key,DES_key_schedule *schedule); -int DES_key_sched(const_DES_cblock *key,DES_key_schedule *schedule); -int DES_set_key_checked(const_DES_cblock *key,DES_key_schedule *schedule); -void DES_set_key_unchecked(const_DES_cblock *key,DES_key_schedule *schedule); -void DES_string_to_key(const char *str,DES_cblock *key); -void DES_string_to_2keys(const char *str,DES_cblock *key1,DES_cblock *key2); -void DES_cfb64_encrypt(const unsigned char *in,unsigned char *out,long length, - DES_key_schedule *schedule,DES_cblock *ivec,int *num, - int enc); -void DES_ofb64_encrypt(const unsigned char *in,unsigned char *out,long length, - DES_key_schedule *schedule,DES_cblock *ivec,int *num); +int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule); +int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule); +int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule); +void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule); +void DES_string_to_key(const char *str, DES_cblock *key); +void DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2); +void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, + DES_key_schedule *schedule, DES_cblock *ivec, int *num, + int enc); +void DES_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, + DES_key_schedule *schedule, DES_cblock *ivec, int *num); #define DES_fixup_key_parity DES_set_odd_parity diff --git a/lib/libcrypto/des/des_enc.c b/lib/libcrypto/des/des_enc.c index 8d6232bbd..7319639c8 100644 --- a/lib/libcrypto/des/des_enc.c +++ b/lib/libcrypto/des/des_enc.c @@ -1,25 +1,25 @@ -/* $OpenBSD: des_enc.c,v 1.13 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: des_enc.c,v 1.15 2023/07/08 07:34:34 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -61,21 +61,22 @@ #ifndef OPENBSD_DES_ASM -void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc) - { - DES_LONG l,r,t,u; +void +DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc) +{ + DES_LONG l, r, t, u; #ifdef DES_PTR - const unsigned char *des_SP=(const unsigned char *)DES_SPtrans; + const unsigned char *des_SP = (const unsigned char *)DES_SPtrans; #endif #ifndef DES_UNROLL int i; #endif DES_LONG *s; - r=data[0]; - l=data[1]; + r = data[0]; + l = data[1]; - IP(r,l); + IP(r, l); /* Things have been modified so that the initial rotate is * done outside the loop. This required the * DES_SPtrans values in sp.h to be rotated 1 bit to the right. @@ -84,90 +85,86 @@ void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc) * for pointing this out. */ /* clear the top bits on machines with 8byte longs */ /* shift left by 2 */ - r=ROTATE(r,29)&0xffffffffL; - l=ROTATE(l,29)&0xffffffffL; + r = ROTATE(r, 29) & 0xffffffffL; + l = ROTATE(l, 29) & 0xffffffffL; - s=ks->ks->deslong; + s = ks->ks->deslong; /* I don't know if it is worth the effort of loop unrolling the * inner loop */ - if (enc) - { + if (enc) { #ifdef DES_UNROLL - D_ENCRYPT(l,r, 0); /* 1 */ - D_ENCRYPT(r,l, 2); /* 2 */ - D_ENCRYPT(l,r, 4); /* 3 */ - D_ENCRYPT(r,l, 6); /* 4 */ - D_ENCRYPT(l,r, 8); /* 5 */ - D_ENCRYPT(r,l,10); /* 6 */ - D_ENCRYPT(l,r,12); /* 7 */ - D_ENCRYPT(r,l,14); /* 8 */ - D_ENCRYPT(l,r,16); /* 9 */ - D_ENCRYPT(r,l,18); /* 10 */ - D_ENCRYPT(l,r,20); /* 11 */ - D_ENCRYPT(r,l,22); /* 12 */ - D_ENCRYPT(l,r,24); /* 13 */ - D_ENCRYPT(r,l,26); /* 14 */ - D_ENCRYPT(l,r,28); /* 15 */ - D_ENCRYPT(r,l,30); /* 16 */ + D_ENCRYPT(l, r, 0); /* 1 */ + D_ENCRYPT(r, l, 2); /* 2 */ + D_ENCRYPT(l, r, 4); /* 3 */ + D_ENCRYPT(r, l, 6); /* 4 */ + D_ENCRYPT(l, r, 8); /* 5 */ + D_ENCRYPT(r, l, 10); /* 6 */ + D_ENCRYPT(l, r, 12); /* 7 */ + D_ENCRYPT(r, l, 14); /* 8 */ + D_ENCRYPT(l, r, 16); /* 9 */ + D_ENCRYPT(r, l, 18); /* 10 */ + D_ENCRYPT(l, r, 20); /* 11 */ + D_ENCRYPT(r, l, 22); /* 12 */ + D_ENCRYPT(l, r, 24); /* 13 */ + D_ENCRYPT(r, l, 26); /* 14 */ + D_ENCRYPT(l, r, 28); /* 15 */ + D_ENCRYPT(r, l, 30); /* 16 */ #else - for (i=0; i<32; i+=4) - { - D_ENCRYPT(l,r,i+0); /* 1 */ - D_ENCRYPT(r,l,i+2); /* 2 */ - } -#endif + for (i = 0; i < 32; i += 4) { + D_ENCRYPT(l, r, i + 0); /* 1 */ + D_ENCRYPT(r, l, i + 2); /* 2 */ } - else - { +#endif + } else { #ifdef DES_UNROLL - D_ENCRYPT(l,r,30); /* 16 */ - D_ENCRYPT(r,l,28); /* 15 */ - D_ENCRYPT(l,r,26); /* 14 */ - D_ENCRYPT(r,l,24); /* 13 */ - D_ENCRYPT(l,r,22); /* 12 */ - D_ENCRYPT(r,l,20); /* 11 */ - D_ENCRYPT(l,r,18); /* 10 */ - D_ENCRYPT(r,l,16); /* 9 */ - D_ENCRYPT(l,r,14); /* 8 */ - D_ENCRYPT(r,l,12); /* 7 */ - D_ENCRYPT(l,r,10); /* 6 */ - D_ENCRYPT(r,l, 8); /* 5 */ - D_ENCRYPT(l,r, 6); /* 4 */ - D_ENCRYPT(r,l, 4); /* 3 */ - D_ENCRYPT(l,r, 2); /* 2 */ - D_ENCRYPT(r,l, 0); /* 1 */ + D_ENCRYPT(l, r, 30); /* 16 */ + D_ENCRYPT(r, l, 28); /* 15 */ + D_ENCRYPT(l, r, 26); /* 14 */ + D_ENCRYPT(r, l, 24); /* 13 */ + D_ENCRYPT(l, r, 22); /* 12 */ + D_ENCRYPT(r, l, 20); /* 11 */ + D_ENCRYPT(l, r, 18); /* 10 */ + D_ENCRYPT(r, l, 16); /* 9 */ + D_ENCRYPT(l, r, 14); /* 8 */ + D_ENCRYPT(r, l, 12); /* 7 */ + D_ENCRYPT(l, r, 10); /* 6 */ + D_ENCRYPT(r, l, 8); /* 5 */ + D_ENCRYPT(l, r, 6); /* 4 */ + D_ENCRYPT(r, l, 4); /* 3 */ + D_ENCRYPT(l, r, 2); /* 2 */ + D_ENCRYPT(r, l, 0); /* 1 */ #else - for (i=30; i>0; i-=4) - { - D_ENCRYPT(l,r,i-0); /* 16 */ - D_ENCRYPT(r,l,i-2); /* 15 */ - } -#endif + for (i = 30; i > 0; i -= 4) { + D_ENCRYPT(l, r, i - 0); /* 16 */ + D_ENCRYPT(r, l, i - 2); /* 15 */ } - - /* rotate and clear the top bits on machines with 8byte longs */ - l=ROTATE(l,3)&0xffffffffL; - r=ROTATE(r,3)&0xffffffffL; - - FP(r,l); - data[0]=l; - data[1]=r; - l=r=t=u=0; +#endif } -void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc) - { - DES_LONG l,r,t,u; + /* rotate and clear the top bits on machines with 8byte longs */ + l = ROTATE(l, 3) & 0xffffffffL; + r = ROTATE(r, 3) & 0xffffffffL; + + FP(r, l); + data[0] = l; + data[1] = r; + l = r = t = u = 0; +} + +void +DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc) +{ + DES_LONG l, r, t, u; #ifdef DES_PTR - const unsigned char *des_SP=(const unsigned char *)DES_SPtrans; + const unsigned char *des_SP = (const unsigned char *)DES_SPtrans; #endif #ifndef DES_UNROLL int i; #endif DES_LONG *s; - r=data[0]; - l=data[1]; + r = data[0]; + l = data[1]; /* Things have been modified so that the initial rotate is * done outside the loop. This required the @@ -176,229 +173,220 @@ void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc) * Thanks to Richard Outerbridge <71755.204@CompuServe.COM> * for pointing this out. */ /* clear the top bits on machines with 8byte longs */ - r=ROTATE(r,29)&0xffffffffL; - l=ROTATE(l,29)&0xffffffffL; + r = ROTATE(r, 29) & 0xffffffffL; + l = ROTATE(l, 29) & 0xffffffffL; - s=ks->ks->deslong; + s = ks->ks->deslong; /* I don't know if it is worth the effort of loop unrolling the * inner loop */ - if (enc) - { + if (enc) { #ifdef DES_UNROLL - D_ENCRYPT(l,r, 0); /* 1 */ - D_ENCRYPT(r,l, 2); /* 2 */ - D_ENCRYPT(l,r, 4); /* 3 */ - D_ENCRYPT(r,l, 6); /* 4 */ - D_ENCRYPT(l,r, 8); /* 5 */ - D_ENCRYPT(r,l,10); /* 6 */ - D_ENCRYPT(l,r,12); /* 7 */ - D_ENCRYPT(r,l,14); /* 8 */ - D_ENCRYPT(l,r,16); /* 9 */ - D_ENCRYPT(r,l,18); /* 10 */ - D_ENCRYPT(l,r,20); /* 11 */ - D_ENCRYPT(r,l,22); /* 12 */ - D_ENCRYPT(l,r,24); /* 13 */ - D_ENCRYPT(r,l,26); /* 14 */ - D_ENCRYPT(l,r,28); /* 15 */ - D_ENCRYPT(r,l,30); /* 16 */ + D_ENCRYPT(l, r, 0); /* 1 */ + D_ENCRYPT(r, l, 2); /* 2 */ + D_ENCRYPT(l, r, 4); /* 3 */ + D_ENCRYPT(r, l, 6); /* 4 */ + D_ENCRYPT(l, r, 8); /* 5 */ + D_ENCRYPT(r, l, 10); /* 6 */ + D_ENCRYPT(l, r, 12); /* 7 */ + D_ENCRYPT(r, l, 14); /* 8 */ + D_ENCRYPT(l, r, 16); /* 9 */ + D_ENCRYPT(r, l, 18); /* 10 */ + D_ENCRYPT(l, r, 20); /* 11 */ + D_ENCRYPT(r, l, 22); /* 12 */ + D_ENCRYPT(l, r, 24); /* 13 */ + D_ENCRYPT(r, l, 26); /* 14 */ + D_ENCRYPT(l, r, 28); /* 15 */ + D_ENCRYPT(r, l, 30); /* 16 */ #else - for (i=0; i<32; i+=4) - { - D_ENCRYPT(l,r,i+0); /* 1 */ - D_ENCRYPT(r,l,i+2); /* 2 */ - } -#endif + for (i = 0; i < 32; i += 4) { + D_ENCRYPT(l, r, i + 0); /* 1 */ + D_ENCRYPT(r, l, i + 2); /* 2 */ } - else - { +#endif + } else { #ifdef DES_UNROLL - D_ENCRYPT(l,r,30); /* 16 */ - D_ENCRYPT(r,l,28); /* 15 */ - D_ENCRYPT(l,r,26); /* 14 */ - D_ENCRYPT(r,l,24); /* 13 */ - D_ENCRYPT(l,r,22); /* 12 */ - D_ENCRYPT(r,l,20); /* 11 */ - D_ENCRYPT(l,r,18); /* 10 */ - D_ENCRYPT(r,l,16); /* 9 */ - D_ENCRYPT(l,r,14); /* 8 */ - D_ENCRYPT(r,l,12); /* 7 */ - D_ENCRYPT(l,r,10); /* 6 */ - D_ENCRYPT(r,l, 8); /* 5 */ - D_ENCRYPT(l,r, 6); /* 4 */ - D_ENCRYPT(r,l, 4); /* 3 */ - D_ENCRYPT(l,r, 2); /* 2 */ - D_ENCRYPT(r,l, 0); /* 1 */ + D_ENCRYPT(l, r, 30); /* 16 */ + D_ENCRYPT(r, l, 28); /* 15 */ + D_ENCRYPT(l, r, 26); /* 14 */ + D_ENCRYPT(r, l, 24); /* 13 */ + D_ENCRYPT(l, r, 22); /* 12 */ + D_ENCRYPT(r, l, 20); /* 11 */ + D_ENCRYPT(l, r, 18); /* 10 */ + D_ENCRYPT(r, l, 16); /* 9 */ + D_ENCRYPT(l, r, 14); /* 8 */ + D_ENCRYPT(r, l, 12); /* 7 */ + D_ENCRYPT(l, r, 10); /* 6 */ + D_ENCRYPT(r, l, 8); /* 5 */ + D_ENCRYPT(l, r, 6); /* 4 */ + D_ENCRYPT(r, l, 4); /* 3 */ + D_ENCRYPT(l, r, 2); /* 2 */ + D_ENCRYPT(r, l, 0); /* 1 */ #else - for (i=30; i>0; i-=4) - { - D_ENCRYPT(l,r,i-0); /* 16 */ - D_ENCRYPT(r,l,i-2); /* 15 */ - } -#endif + for (i = 30; i > 0; i -= 4) { + D_ENCRYPT(l, r, i - 0); /* 16 */ + D_ENCRYPT(r, l, i - 2); /* 15 */ } - /* rotate and clear the top bits on machines with 8byte longs */ - data[0]=ROTATE(l,3)&0xffffffffL; - data[1]=ROTATE(r,3)&0xffffffffL; - l=r=t=u=0; +#endif } + /* rotate and clear the top bits on machines with 8byte longs */ + data[0] = ROTATE(l, 3) & 0xffffffffL; + data[1] = ROTATE(r, 3) & 0xffffffffL; + l = r = t = u = 0; +} #endif /* OPENBSD_DES_ASM */ -void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3) - { - DES_LONG l,r; +void +DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3) +{ + DES_LONG l, r; - l=data[0]; - r=data[1]; - IP(l,r); - data[0]=l; - data[1]=r; - DES_encrypt2((DES_LONG *)data,ks1,DES_ENCRYPT); - DES_encrypt2((DES_LONG *)data,ks2,DES_DECRYPT); - DES_encrypt2((DES_LONG *)data,ks3,DES_ENCRYPT); - l=data[0]; - r=data[1]; - FP(r,l); - data[0]=l; - data[1]=r; - } + l = data[0]; + r = data[1]; + IP(l, r); + data[0] = l; + data[1] = r; + DES_encrypt2((DES_LONG *)data, ks1, DES_ENCRYPT); + DES_encrypt2((DES_LONG *)data, ks2, DES_DECRYPT); + DES_encrypt2((DES_LONG *)data, ks3, DES_ENCRYPT); + l = data[0]; + r = data[1]; + FP(r, l); + data[0] = l; + data[1] = r; +} -void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3) - { - DES_LONG l,r; +void +DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3) +{ + DES_LONG l, r; - l=data[0]; - r=data[1]; - IP(l,r); - data[0]=l; - data[1]=r; - DES_encrypt2((DES_LONG *)data,ks3,DES_DECRYPT); - DES_encrypt2((DES_LONG *)data,ks2,DES_ENCRYPT); - DES_encrypt2((DES_LONG *)data,ks1,DES_DECRYPT); - l=data[0]; - r=data[1]; - FP(r,l); - data[0]=l; - data[1]=r; - } + l = data[0]; + r = data[1]; + IP(l, r); + data[0] = l; + data[1] = r; + DES_encrypt2((DES_LONG *)data, ks3, DES_DECRYPT); + DES_encrypt2((DES_LONG *)data, ks2, DES_ENCRYPT); + DES_encrypt2((DES_LONG *)data, ks1, DES_DECRYPT); + l = data[0]; + r = data[1]; + FP(r, l); + data[0] = l; + data[1] = r; +} #ifndef DES_DEFAULT_OPTIONS #undef CBC_ENC_C__DONT_UPDATE_IV #include "ncbc_enc.c" /* DES_ncbc_encrypt */ -void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, - long length, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3, - DES_cblock *ivec, int enc) - { - DES_LONG tin0,tin1; - DES_LONG tout0,tout1,xor0,xor1; +void +DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, + long length, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3, + DES_cblock *ivec, int enc) +{ + DES_LONG tin0, tin1; + DES_LONG tout0, tout1, xor0, xor1; const unsigned char *in; unsigned char *out; - long l=length; + long l = length; DES_LONG tin[2]; unsigned char *iv; - in=input; - out=output; + in = input; + out = output; iv = &(*ivec)[0]; - if (enc) - { - c2l(iv,tout0); - c2l(iv,tout1); - for (l-=8; l>=0; l-=8) - { - c2l(in,tin0); - c2l(in,tin1); - tin0^=tout0; - tin1^=tout1; + if (enc) { + c2l(iv, tout0); + c2l(iv, tout1); + for (l -= 8; l >= 0; l -= 8) { + c2l(in, tin0); + c2l(in, tin1); + tin0 ^= tout0; + tin1 ^= tout1; - tin[0]=tin0; - tin[1]=tin1; - DES_encrypt3((DES_LONG *)tin,ks1,ks2,ks3); - tout0=tin[0]; - tout1=tin[1]; + tin[0] = tin0; + tin[1] = tin1; + DES_encrypt3((DES_LONG *)tin, ks1, ks2, ks3); + tout0 = tin[0]; + tout1 = tin[1]; - l2c(tout0,out); - l2c(tout1,out); - } - if (l != -8) - { - c2ln(in,tin0,tin1,l+8); - tin0^=tout0; - tin1^=tout1; - - tin[0]=tin0; - tin[1]=tin1; - DES_encrypt3((DES_LONG *)tin,ks1,ks2,ks3); - tout0=tin[0]; - tout1=tin[1]; - - l2c(tout0,out); - l2c(tout1,out); - } - iv = &(*ivec)[0]; - l2c(tout0,iv); - l2c(tout1,iv); + l2c(tout0, out); + l2c(tout1, out); } - else - { - DES_LONG t0,t1; + if (l != -8) { + c2ln(in, tin0, tin1, l + 8); + tin0 ^= tout0; + tin1 ^= tout1; - c2l(iv,xor0); - c2l(iv,xor1); - for (l-=8; l>=0; l-=8) - { - c2l(in,tin0); - c2l(in,tin1); + tin[0] = tin0; + tin[1] = tin1; + DES_encrypt3((DES_LONG *)tin, ks1, ks2, ks3); + tout0 = tin[0]; + tout1 = tin[1]; - t0=tin0; - t1=tin1; + l2c(tout0, out); + l2c(tout1, out); + } + iv = &(*ivec)[0]; + l2c(tout0, iv); + l2c(tout1, iv); + } else { + DES_LONG t0, t1; - tin[0]=tin0; - tin[1]=tin1; - DES_decrypt3((DES_LONG *)tin,ks1,ks2,ks3); - tout0=tin[0]; - tout1=tin[1]; + c2l(iv, xor0); + c2l(iv, xor1); + for (l -= 8; l >= 0; l -= 8) { + c2l(in, tin0); + c2l(in, tin1); - tout0^=xor0; - tout1^=xor1; - l2c(tout0,out); - l2c(tout1,out); - xor0=t0; - xor1=t1; - } - if (l != -8) - { - c2l(in,tin0); - c2l(in,tin1); - - t0=tin0; - t1=tin1; + t0 = tin0; + t1 = tin1; - tin[0]=tin0; - tin[1]=tin1; - DES_decrypt3((DES_LONG *)tin,ks1,ks2,ks3); - tout0=tin[0]; - tout1=tin[1]; - - tout0^=xor0; - tout1^=xor1; - l2cn(tout0,tout1,out,l+8); - xor0=t0; - xor1=t1; - } + tin[0] = tin0; + tin[1] = tin1; + DES_decrypt3((DES_LONG *)tin, ks1, ks2, ks3); + tout0 = tin[0]; + tout1 = tin[1]; + + tout0 ^= xor0; + tout1 ^= xor1; + l2c(tout0, out); + l2c(tout1, out); + xor0 = t0; + xor1 = t1; + } + if (l != -8) { + c2l(in, tin0); + c2l(in, tin1); + + t0 = tin0; + t1 = tin1; + + tin[0] = tin0; + tin[1] = tin1; + DES_decrypt3((DES_LONG *)tin, ks1, ks2, ks3); + tout0 = tin[0]; + tout1 = tin[1]; + + tout0 ^= xor0; + tout1 ^= xor1; + l2cn(tout0, tout1, out, l + 8); + xor0 = t0; + xor1 = t1; + } iv = &(*ivec)[0]; - l2c(xor0,iv); - l2c(xor1,iv); - } - tin0=tin1=tout0=tout1=xor0=xor1=0; - tin[0]=tin[1]=0; + l2c(xor0, iv); + l2c(xor1, iv); } + tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0; + tin[0] = tin[1] = 0; +} #endif /* DES_DEFAULT_OPTIONS */ diff --git a/lib/libcrypto/des/des_local.h b/lib/libcrypto/des/des_local.h index a058ac2c3..f081adedb 100644 --- a/lib/libcrypto/des/des_local.h +++ b/lib/libcrypto/des/des_local.h @@ -1,25 +1,25 @@ -/* $OpenBSD: des_local.h,v 1.1 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: des_local.h,v 1.2 2023/07/08 07:11:07 beck Exp $ */ /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -79,64 +79,65 @@ __BEGIN_HIDDEN_DECLS #define MAXWRITE (1024*16) #define BSIZE (MAXWRITE+4) -#define c2l(c,l) (l =((DES_LONG)(*((c)++))) , \ - l|=((DES_LONG)(*((c)++)))<< 8L, \ - l|=((DES_LONG)(*((c)++)))<<16L, \ +#define c2l(c,l) (l =((DES_LONG)(*((c)++))) , \ + l|=((DES_LONG)(*((c)++)))<< 8L, \ + l|=((DES_LONG)(*((c)++)))<<16L, \ l|=((DES_LONG)(*((c)++)))<<24L) /* NOTE - c is not incremented as per c2l */ -#define c2ln(c,l1,l2,n) { \ - c+=n; \ - l1=l2=0; \ - switch (n) { \ - case 8: l2 =((DES_LONG)(*(--(c))))<<24L; \ - case 7: l2|=((DES_LONG)(*(--(c))))<<16L; \ - case 6: l2|=((DES_LONG)(*(--(c))))<< 8L; \ - case 5: l2|=((DES_LONG)(*(--(c)))); \ - case 4: l1 =((DES_LONG)(*(--(c))))<<24L; \ - case 3: l1|=((DES_LONG)(*(--(c))))<<16L; \ - case 2: l1|=((DES_LONG)(*(--(c))))<< 8L; \ - case 1: l1|=((DES_LONG)(*(--(c)))); \ - } \ +#define c2ln(c,l1,l2,n) { \ + c+=n; \ + l1=l2=0; \ + switch (n) { \ + case 8: l2 =((DES_LONG)(*(--(c))))<<24L; \ + case 7: l2|=((DES_LONG)(*(--(c))))<<16L; \ + case 6: l2|=((DES_LONG)(*(--(c))))<< 8L; \ + case 5: l2|=((DES_LONG)(*(--(c)))); \ + case 4: l1 =((DES_LONG)(*(--(c))))<<24L; \ + case 3: l1|=((DES_LONG)(*(--(c))))<<16L; \ + case 2: l1|=((DES_LONG)(*(--(c))))<< 8L; \ + case 1: l1|=((DES_LONG)(*(--(c)))); \ + } \ } -#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ +#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ *((c)++)=(unsigned char)(((l)>>24L)&0xff)) /* replacements for htonl and ntohl since I have no idea what to do * when faced with machines with 8 byte longs. */ #define HDRSIZE 4 -#define n2l(c,l) (l =((DES_LONG)(*((c)++)))<<24L, \ - l|=((DES_LONG)(*((c)++)))<<16L, \ - l|=((DES_LONG)(*((c)++)))<< 8L, \ +#define n2l(c,l) (l =((DES_LONG)(*((c)++)))<<24L, \ + l|=((DES_LONG)(*((c)++)))<<16L, \ + l|=((DES_LONG)(*((c)++)))<< 8L, \ l|=((DES_LONG)(*((c)++)))) -#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ +#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ *((c)++)=(unsigned char)(((l) )&0xff)) /* NOTE - c is not incremented as per l2c */ -#define l2cn(l1,l2,c,n) { \ - c+=n; \ - switch (n) { \ - case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ - case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ - case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ - case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ - case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ - case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ - case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ - case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ - } \ +#define l2cn(l1,l2,c,n) { \ + c+=n; \ + switch (n) { \ + case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff);\ + case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff);\ + case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff);\ + case 5: *(--(c))=(unsigned char)(((l2) )&0xff);\ + case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff);\ + case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff);\ + case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff);\ + case 1: *(--(c))=(unsigned char)(((l1) )&0xff);\ + } \ } -static inline uint32_t ROTATE(uint32_t a, uint32_t n) +static inline uint32_t +ROTATE(uint32_t a, uint32_t n) { - return (a>>n)+(a<<(32-n)); + return (a >> n) + (a << (32 - n)); } /* Don't worry about the LOAD_DATA() stuff, that is used by @@ -147,15 +148,15 @@ static inline uint32_t ROTATE(uint32_t a, uint32_t n) #define LOAD_DATA_tmp(R,S,u,t,E0,E1) \ { DES_LONG tmp; LOAD_DATA(R,S,u,t,E0,E1,tmp); } -#define LOAD_DATA(R,S,u,t,E0,E1,tmp) \ - t=R^(R>>16L); \ - u=t&E0; t&=E1; \ - tmp=(u<<16); u^=R^s[S ]; u^=tmp; \ +#define LOAD_DATA(R,S,u,t,E0,E1,tmp) \ + t=R^(R>>16L); \ + u=t&E0; t&=E1; \ + tmp=(u<<16); u^=R^s[S ]; u^=tmp; \ tmp=(t<<16); t^=R^s[S+1]; t^=tmp #else #define LOAD_DATA_tmp(a,b,c,d,e,f) LOAD_DATA(a,b,c,d,e,f,g) -#define LOAD_DATA(R,S,u,t,E0,E1,tmp) \ - u=R^s[S ]; \ +#define LOAD_DATA(R,S,u,t,E0,E1,tmp) \ + u=R^s[S ]; \ t=R^s[S+1] #endif @@ -173,73 +174,73 @@ static inline uint32_t ROTATE(uint32_t a, uint32_t n) #if defined(DES_RISC1) || defined(DES_RISC2) #ifdef DES_RISC1 -#define D_ENCRYPT(LL,R,S) { \ - unsigned int u1,u2,u3; \ - LOAD_DATA(R,S,u,t,E0,E1,u1); \ - u2=(int)u>>8L; \ - u1=(int)u&0xfc; \ - u2&=0xfc; \ - t=ROTATE(t,4); \ - u>>=16L; \ - LL^= *(const DES_LONG *)(des_SP +u1); \ - LL^= *(const DES_LONG *)(des_SP+0x200+u2); \ - u3=(int)(u>>8L); \ - u1=(int)u&0xfc; \ - u3&=0xfc; \ - LL^= *(const DES_LONG *)(des_SP+0x400+u1); \ - LL^= *(const DES_LONG *)(des_SP+0x600+u3); \ - u2=(int)t>>8L; \ - u1=(int)t&0xfc; \ - u2&=0xfc; \ - t>>=16L; \ - LL^= *(const DES_LONG *)(des_SP+0x100+u1); \ - LL^= *(const DES_LONG *)(des_SP+0x300+u2); \ - u3=(int)t>>8L; \ - u1=(int)t&0xfc; \ - u3&=0xfc; \ - LL^= *(const DES_LONG *)(des_SP+0x500+u1); \ +#define D_ENCRYPT(LL,R,S) { \ + unsigned int u1,u2,u3; \ + LOAD_DATA(R,S,u,t,E0,E1,u1); \ + u2=(int)u>>8L; \ + u1=(int)u&0xfc; \ + u2&=0xfc; \ + t=ROTATE(t,4); \ + u>>=16L; \ + LL^= *(const DES_LONG *)(des_SP +u1); \ + LL^= *(const DES_LONG *)(des_SP+0x200+u2); \ + u3=(int)(u>>8L); \ + u1=(int)u&0xfc; \ + u3&=0xfc; \ + LL^= *(const DES_LONG *)(des_SP+0x400+u1); \ + LL^= *(const DES_LONG *)(des_SP+0x600+u3); \ + u2=(int)t>>8L; \ + u1=(int)t&0xfc; \ + u2&=0xfc; \ + t>>=16L; \ + LL^= *(const DES_LONG *)(des_SP+0x100+u1); \ + LL^= *(const DES_LONG *)(des_SP+0x300+u2); \ + u3=(int)t>>8L; \ + u1=(int)t&0xfc; \ + u3&=0xfc; \ + LL^= *(const DES_LONG *)(des_SP+0x500+u1); \ LL^= *(const DES_LONG *)(des_SP+0x700+u3); } #endif #ifdef DES_RISC2 -#define D_ENCRYPT(LL,R,S) { \ - unsigned int u1,u2,s1,s2; \ - LOAD_DATA(R,S,u,t,E0,E1,u1); \ - u2=(int)u>>8L; \ - u1=(int)u&0xfc; \ - u2&=0xfc; \ - t=ROTATE(t,4); \ - LL^= *(const DES_LONG *)(des_SP +u1); \ - LL^= *(const DES_LONG *)(des_SP+0x200+u2); \ - s1=(int)(u>>16L); \ - s2=(int)(u>>24L); \ - s1&=0xfc; \ - s2&=0xfc; \ - LL^= *(const DES_LONG *)(des_SP+0x400+s1); \ - LL^= *(const DES_LONG *)(des_SP+0x600+s2); \ - u2=(int)t>>8L; \ - u1=(int)t&0xfc; \ - u2&=0xfc; \ - LL^= *(const DES_LONG *)(des_SP+0x100+u1); \ - LL^= *(const DES_LONG *)(des_SP+0x300+u2); \ - s1=(int)(t>>16L); \ - s2=(int)(t>>24L); \ - s1&=0xfc; \ - s2&=0xfc; \ - LL^= *(const DES_LONG *)(des_SP+0x500+s1); \ +#define D_ENCRYPT(LL,R,S) { \ + unsigned int u1,u2,s1,s2; \ + LOAD_DATA(R,S,u,t,E0,E1,u1); \ + u2=(int)u>>8L; \ + u1=(int)u&0xfc; \ + u2&=0xfc; \ + t=ROTATE(t,4); \ + LL^= *(const DES_LONG *)(des_SP +u1); \ + LL^= *(const DES_LONG *)(des_SP+0x200+u2); \ + s1=(int)(u>>16L); \ + s2=(int)(u>>24L); \ + s1&=0xfc; \ + s2&=0xfc; \ + LL^= *(const DES_LONG *)(des_SP+0x400+s1); \ + LL^= *(const DES_LONG *)(des_SP+0x600+s2); \ + u2=(int)t>>8L; \ + u1=(int)t&0xfc; \ + u2&=0xfc; \ + LL^= *(const DES_LONG *)(des_SP+0x100+u1); \ + LL^= *(const DES_LONG *)(des_SP+0x300+u2); \ + s1=(int)(t>>16L); \ + s2=(int)(t>>24L); \ + s1&=0xfc; \ + s2&=0xfc; \ + LL^= *(const DES_LONG *)(des_SP+0x500+s1); \ LL^= *(const DES_LONG *)(des_SP+0x700+s2); } #endif #else -#define D_ENCRYPT(LL,R,S) { \ - LOAD_DATA_tmp(R,S,u,t,E0,E1); \ - t=ROTATE(t,4); \ - LL^= \ - *(const DES_LONG *)(des_SP +((u )&0xfc))^ \ - *(const DES_LONG *)(des_SP+0x200+((u>> 8L)&0xfc))^ \ - *(const DES_LONG *)(des_SP+0x400+((u>>16L)&0xfc))^ \ - *(const DES_LONG *)(des_SP+0x600+((u>>24L)&0xfc))^ \ - *(const DES_LONG *)(des_SP+0x100+((t )&0xfc))^ \ - *(const DES_LONG *)(des_SP+0x300+((t>> 8L)&0xfc))^ \ - *(const DES_LONG *)(des_SP+0x500+((t>>16L)&0xfc))^ \ +#define D_ENCRYPT(LL,R,S) { \ + LOAD_DATA_tmp(R,S,u,t,E0,E1); \ + t=ROTATE(t,4); \ + LL^= \ + *(const DES_LONG *)(des_SP +((u )&0xfc))^ \ + *(const DES_LONG *)(des_SP+0x200+((u>> 8L)&0xfc))^ \ + *(const DES_LONG *)(des_SP+0x400+((u>>16L)&0xfc))^ \ + *(const DES_LONG *)(des_SP+0x600+((u>>24L)&0xfc))^ \ + *(const DES_LONG *)(des_SP+0x100+((t )&0xfc))^ \ + *(const DES_LONG *)(des_SP+0x300+((t>> 8L)&0xfc))^ \ + *(const DES_LONG *)(des_SP+0x500+((t>>16L)&0xfc))^ \ *(const DES_LONG *)(des_SP+0x700+((t>>24L)&0xfc)); } #endif @@ -247,77 +248,77 @@ static inline uint32_t ROTATE(uint32_t a, uint32_t n) #if defined(DES_RISC1) || defined(DES_RISC2) #ifdef DES_RISC1 -#define D_ENCRYPT(LL,R,S) {\ - unsigned int u1,u2,u3; \ - LOAD_DATA(R,S,u,t,E0,E1,u1); \ - u>>=2L; \ - t=ROTATE(t,6); \ - u2=(int)u>>8L; \ - u1=(int)u&0x3f; \ - u2&=0x3f; \ - u>>=16L; \ - LL^=DES_SPtrans[0][u1]; \ - LL^=DES_SPtrans[2][u2]; \ - u3=(int)u>>8L; \ - u1=(int)u&0x3f; \ - u3&=0x3f; \ - LL^=DES_SPtrans[4][u1]; \ - LL^=DES_SPtrans[6][u3]; \ - u2=(int)t>>8L; \ - u1=(int)t&0x3f; \ - u2&=0x3f; \ - t>>=16L; \ - LL^=DES_SPtrans[1][u1]; \ - LL^=DES_SPtrans[3][u2]; \ - u3=(int)t>>8L; \ - u1=(int)t&0x3f; \ - u3&=0x3f; \ - LL^=DES_SPtrans[5][u1]; \ +#define D_ENCRYPT(LL,R,S) { \ + unsigned int u1,u2,u3; \ + LOAD_DATA(R,S,u,t,E0,E1,u1); \ + u>>=2L; \ + t=ROTATE(t,6); \ + u2=(int)u>>8L; \ + u1=(int)u&0x3f; \ + u2&=0x3f; \ + u>>=16L; \ + LL^=DES_SPtrans[0][u1]; \ + LL^=DES_SPtrans[2][u2]; \ + u3=(int)u>>8L; \ + u1=(int)u&0x3f; \ + u3&=0x3f; \ + LL^=DES_SPtrans[4][u1]; \ + LL^=DES_SPtrans[6][u3]; \ + u2=(int)t>>8L; \ + u1=(int)t&0x3f; \ + u2&=0x3f; \ + t>>=16L; \ + LL^=DES_SPtrans[1][u1]; \ + LL^=DES_SPtrans[3][u2]; \ + u3=(int)t>>8L; \ + u1=(int)t&0x3f; \ + u3&=0x3f; \ + LL^=DES_SPtrans[5][u1]; \ LL^=DES_SPtrans[7][u3]; } #endif #ifdef DES_RISC2 -#define D_ENCRYPT(LL,R,S) {\ - unsigned int u1,u2,s1,s2; \ - LOAD_DATA(R,S,u,t,E0,E1,u1); \ - u>>=2L; \ - t=ROTATE(t,6); \ - u2=(int)u>>8L; \ - u1=(int)u&0x3f; \ - u2&=0x3f; \ - LL^=DES_SPtrans[0][u1]; \ - LL^=DES_SPtrans[2][u2]; \ - s1=(int)u>>16L; \ - s2=(int)u>>24L; \ - s1&=0x3f; \ - s2&=0x3f; \ - LL^=DES_SPtrans[4][s1]; \ - LL^=DES_SPtrans[6][s2]; \ - u2=(int)t>>8L; \ - u1=(int)t&0x3f; \ - u2&=0x3f; \ - LL^=DES_SPtrans[1][u1]; \ - LL^=DES_SPtrans[3][u2]; \ - s1=(int)t>>16; \ - s2=(int)t>>24L; \ - s1&=0x3f; \ - s2&=0x3f; \ - LL^=DES_SPtrans[5][s1]; \ +#define D_ENCRYPT(LL,R,S) { \ + unsigned int u1,u2,s1,s2; \ + LOAD_DATA(R,S,u,t,E0,E1,u1); \ + u>>=2L; \ + t=ROTATE(t,6); \ + u2=(int)u>>8L; \ + u1=(int)u&0x3f; \ + u2&=0x3f; \ + LL^=DES_SPtrans[0][u1]; \ + LL^=DES_SPtrans[2][u2]; \ + s1=(int)u>>16L; \ + s2=(int)u>>24L; \ + s1&=0x3f; \ + s2&=0x3f; \ + LL^=DES_SPtrans[4][s1]; \ + LL^=DES_SPtrans[6][s2]; \ + u2=(int)t>>8L; \ + u1=(int)t&0x3f; \ + u2&=0x3f; \ + LL^=DES_SPtrans[1][u1]; \ + LL^=DES_SPtrans[3][u2]; \ + s1=(int)t>>16; \ + s2=(int)t>>24L; \ + s1&=0x3f; \ + s2&=0x3f; \ + LL^=DES_SPtrans[5][s1]; \ LL^=DES_SPtrans[7][s2]; } #endif #else -#define D_ENCRYPT(LL,R,S) {\ - LOAD_DATA_tmp(R,S,u,t,E0,E1); \ - t=ROTATE(t,4); \ - LL^=\ - DES_SPtrans[0][(u>> 2L)&0x3f]^ \ - DES_SPtrans[2][(u>>10L)&0x3f]^ \ - DES_SPtrans[4][(u>>18L)&0x3f]^ \ - DES_SPtrans[6][(u>>26L)&0x3f]^ \ - DES_SPtrans[1][(t>> 2L)&0x3f]^ \ - DES_SPtrans[3][(t>>10L)&0x3f]^ \ - DES_SPtrans[5][(t>>18L)&0x3f]^ \ +#define D_ENCRYPT(LL,R,S) { \ + LOAD_DATA_tmp(R,S,u,t,E0,E1); \ + t=ROTATE(t,4); \ + LL^= \ + DES_SPtrans[0][(u>> 2L)&0x3f]^ \ + DES_SPtrans[2][(u>>10L)&0x3f]^ \ + DES_SPtrans[4][(u>>18L)&0x3f]^ \ + DES_SPtrans[6][(u>>26L)&0x3f]^ \ + DES_SPtrans[1][(t>> 2L)&0x3f]^ \ + DES_SPtrans[3][(t>>10L)&0x3f]^ \ + DES_SPtrans[5][(t>>18L)&0x3f]^ \ DES_SPtrans[7][(t>>26L)&0x3f]; } #endif #endif @@ -359,34 +360,34 @@ static inline uint32_t ROTATE(uint32_t a, uint32_t n) I first got ~42 operations without xors. When I remembered how to use xors :-) I got it to its final state. */ -#define PERM_OP(a,b,t,n,m) ((t)=((((a)>>(n))^(b))&(m)),\ - (b)^=(t),\ +#define PERM_OP(a,b,t,n,m) ((t)=((((a)>>(n))^(b))&(m)), \ + (b)^=(t), \ (a)^=((t)<<(n))) -#define IP(l,r) \ - { \ - DES_LONG tt; \ - PERM_OP(r,l,tt, 4,0x0f0f0f0fL); \ - PERM_OP(l,r,tt,16,0x0000ffffL); \ - PERM_OP(r,l,tt, 2,0x33333333L); \ - PERM_OP(l,r,tt, 8,0x00ff00ffL); \ - PERM_OP(r,l,tt, 1,0x55555555L); \ +#define IP(l,r) \ + { \ + DES_LONG tt; \ + PERM_OP(r,l,tt, 4,0x0f0f0f0fL); \ + PERM_OP(l,r,tt,16,0x0000ffffL); \ + PERM_OP(r,l,tt, 2,0x33333333L); \ + PERM_OP(l,r,tt, 8,0x00ff00ffL); \ + PERM_OP(r,l,tt, 1,0x55555555L); \ } -#define FP(l,r) \ - { \ - DES_LONG tt; \ - PERM_OP(l,r,tt, 1,0x55555555L); \ - PERM_OP(r,l,tt, 8,0x00ff00ffL); \ - PERM_OP(l,r,tt, 2,0x33333333L); \ - PERM_OP(r,l,tt,16,0x0000ffffL); \ - PERM_OP(l,r,tt, 4,0x0f0f0f0fL); \ +#define FP(l,r) \ + { \ + DES_LONG tt; \ + PERM_OP(l,r,tt, 1,0x55555555L); \ + PERM_OP(r,l,tt, 8,0x00ff00ffL); \ + PERM_OP(l,r,tt, 2,0x33333333L); \ + PERM_OP(r,l,tt,16,0x0000ffffL); \ + PERM_OP(l,r,tt, 4,0x0f0f0f0fL); \ } extern const DES_LONG DES_SPtrans[8][64]; -void fcrypt_body(DES_LONG *out,DES_key_schedule *ks, - DES_LONG Eswap0, DES_LONG Eswap1); +void fcrypt_body(DES_LONG *out, DES_key_schedule *ks, + DES_LONG Eswap0, DES_LONG Eswap1); #ifdef OPENSSL_SMALL_FOOTPRINT #undef DES_UNROLL diff --git a/lib/libcrypto/des/ecb3_enc.c b/lib/libcrypto/des/ecb3_enc.c index c2d8329fe..129b5fafe 100644 --- a/lib/libcrypto/des/ecb3_enc.c +++ b/lib/libcrypto/des/ecb3_enc.c @@ -1,25 +1,25 @@ -/* $OpenBSD: ecb3_enc.c,v 1.8 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: ecb3_enc.c,v 1.9 2023/07/08 07:11:07 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -58,26 +58,27 @@ #include "des_local.h" -void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, - DES_key_schedule *ks1, DES_key_schedule *ks2, - DES_key_schedule *ks3, - int enc) - { - DES_LONG l0,l1; +void +DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, + DES_key_schedule *ks1, DES_key_schedule *ks2, + DES_key_schedule *ks3, + int enc) +{ + DES_LONG l0, l1; DES_LONG ll[2]; const unsigned char *in = &(*input)[0]; unsigned char *out = &(*output)[0]; - c2l(in,l0); - c2l(in,l1); - ll[0]=l0; - ll[1]=l1; + c2l(in, l0); + c2l(in, l1); + ll[0] = l0; + ll[1] = l1; if (enc) - DES_encrypt3(ll,ks1,ks2,ks3); + DES_encrypt3(ll, ks1, ks2, ks3); else - DES_decrypt3(ll,ks1,ks2,ks3); - l0=ll[0]; - l1=ll[1]; - l2c(l0,out); - l2c(l1,out); - } + DES_decrypt3(ll, ks1, ks2, ks3); + l0 = ll[0]; + l1 = ll[1]; + l2c(l0, out); + l2c(l1, out); +} diff --git a/lib/libcrypto/des/ecb_enc.c b/lib/libcrypto/des/ecb_enc.c index 35ce71131..7cc8cc687 100644 --- a/lib/libcrypto/des/ecb_enc.c +++ b/lib/libcrypto/des/ecb_enc.c @@ -1,25 +1,25 @@ -/* $OpenBSD: ecb_enc.c,v 1.17 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: ecb_enc.c,v 1.18 2023/07/08 07:11:07 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -60,59 +60,63 @@ #include #include -const char *DES_options(void) - { - static int init=1; +const char * +DES_options(void) +{ + static int init = 1; static char buf[32]; - if (init) - { - const char *ptr,*unroll,*risc,*size; + if (init) { + const char *ptr, *unroll, *risc, *size; #ifdef DES_PTR - ptr="ptr"; + ptr = "ptr"; #else - ptr="idx"; + ptr = "idx"; #endif #if defined(DES_RISC1) || defined(DES_RISC2) #ifdef DES_RISC1 - risc="risc1"; + risc = "risc1"; #endif #ifdef DES_RISC2 - risc="risc2"; + risc = "risc2"; #endif #else - risc="cisc"; + risc = "cisc"; #endif #ifdef DES_UNROLL - unroll="16"; + unroll = "16"; #else - unroll="2"; + unroll = "2"; #endif if (sizeof(DES_LONG) != sizeof(long)) - size="int"; + size = "int"; else - size="long"; - snprintf(buf,sizeof buf,"des(%s,%s,%s,%s)",ptr,risc,unroll, - size); - init=0; - } - return(buf); + size = "long"; + snprintf(buf, sizeof buf, "des(%s,%s,%s,%s)", ptr, risc, unroll, + size); + init = 0; } - + return (buf); +} -void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, - DES_key_schedule *ks, int enc) - { +void +DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, + DES_key_schedule *ks, int enc) +{ DES_LONG l; DES_LONG ll[2]; const unsigned char *in = &(*input)[0]; unsigned char *out = &(*output)[0]; - c2l(in,l); ll[0]=l; - c2l(in,l); ll[1]=l; - DES_encrypt1(ll,ks,enc); - l=ll[0]; l2c(l,out); - l=ll[1]; l2c(l,out); - l=ll[0]=ll[1]=0; - } + c2l(in, l); + ll[0] = l; + c2l(in, l); + ll[1] = l; + DES_encrypt1(ll, ks, enc); + l = ll[0]; + l2c(l, out); + l = ll[1]; + l2c(l, out); + l = ll[0] = ll[1] = 0; +} diff --git a/lib/libcrypto/des/ede_cbcm_enc.c b/lib/libcrypto/des/ede_cbcm_enc.c index 3f1609d74..eb6fd4f54 100644 --- a/lib/libcrypto/des/ede_cbcm_enc.c +++ b/lib/libcrypto/des/ede_cbcm_enc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ede_cbcm_enc.c,v 1.7 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: ede_cbcm_enc.c,v 1.9 2023/07/08 07:34:34 jsing Exp $ */ /* Written by Ben Laurie for the OpenSSL * project 13 Feb 1999. */ @@ -10,7 +10,7 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in @@ -73,127 +73,117 @@ http://www.cs.technion.ac.il/users/wwwb/cgi-bin/tr-get.cgi/1998/CS/CS0928.ps.gz #ifndef OPENSSL_NO_DESCBCM #include "des_local.h" -void DES_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *ks1, DES_key_schedule *ks2, - DES_key_schedule *ks3, DES_cblock *ivec1, DES_cblock *ivec2, - int enc) - { - DES_LONG tin0,tin1; - DES_LONG tout0,tout1,xor0,xor1,m0,m1; - long l=length; - DES_LONG tin[2]; - unsigned char *iv1,*iv2; +void +DES_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *ks1, DES_key_schedule *ks2, + DES_key_schedule *ks3, DES_cblock *ivec1, DES_cblock *ivec2, + int enc) +{ + DES_LONG tin0, tin1; + DES_LONG tout0, tout1, xor0, xor1, m0, m1; + long l = length; + DES_LONG tin[2]; + unsigned char *iv1, *iv2; - iv1 = &(*ivec1)[0]; - iv2 = &(*ivec2)[0]; + iv1 = &(*ivec1)[0]; + iv2 = &(*ivec2)[0]; - if (enc) - { - c2l(iv1,m0); - c2l(iv1,m1); - c2l(iv2,tout0); - c2l(iv2,tout1); - for (l-=8; l>=-7; l-=8) - { - tin[0]=m0; - tin[1]=m1; - DES_encrypt1(tin,ks3,1); - m0=tin[0]; - m1=tin[1]; + if (enc) { + c2l(iv1, m0); + c2l(iv1, m1); + c2l(iv2, tout0); + c2l(iv2, tout1); + for (l -= 8; l >= -7; l -= 8) { + tin[0] = m0; + tin[1] = m1; + DES_encrypt1(tin, ks3, 1); + m0 = tin[0]; + m1 = tin[1]; - if(l < 0) - { - c2ln(in,tin0,tin1,l+8); + if (l < 0) { + c2ln(in, tin0, tin1, l + 8); + } else { + c2l(in, tin0); + c2l(in, tin1); + } + tin0 ^= tout0; + tin1 ^= tout1; + + tin[0] = tin0; + tin[1] = tin1; + DES_encrypt1(tin, ks1, 1); + tin[0] ^= m0; + tin[1] ^= m1; + DES_encrypt1(tin, ks2, 0); + tin[0] ^= m0; + tin[1] ^= m1; + DES_encrypt1(tin, ks1, 1); + tout0 = tin[0]; + tout1 = tin[1]; + + l2c(tout0, out); + l2c(tout1, out); } - else - { - c2l(in,tin0); - c2l(in,tin1); + iv1 = &(*ivec1)[0]; + l2c(m0, iv1); + l2c(m1, iv1); + + iv2 = &(*ivec2)[0]; + l2c(tout0, iv2); + l2c(tout1, iv2); + } else { + DES_LONG t0, t1; + + c2l(iv1, m0); + c2l(iv1, m1); + c2l(iv2, xor0); + c2l(iv2, xor1); + for (l -= 8; l >= -7; l -= 8) { + tin[0] = m0; + tin[1] = m1; + DES_encrypt1(tin, ks3, 1); + m0 = tin[0]; + m1 = tin[1]; + + c2l(in, tin0); + c2l(in, tin1); + + t0 = tin0; + t1 = tin1; + + tin[0] = tin0; + tin[1] = tin1; + DES_encrypt1(tin, ks1, 0); + tin[0] ^= m0; + tin[1] ^= m1; + DES_encrypt1(tin, ks2, 1); + tin[0] ^= m0; + tin[1] ^= m1; + DES_encrypt1(tin, ks1, 0); + tout0 = tin[0]; + tout1 = tin[1]; + + tout0 ^= xor0; + tout1 ^= xor1; + if (l < 0) { + l2cn(tout0, tout1, out, l + 8); + } else { + l2c(tout0, out); + l2c(tout1, out); + } + xor0 = t0; + xor1 = t1; } - tin0^=tout0; - tin1^=tout1; - tin[0]=tin0; - tin[1]=tin1; - DES_encrypt1(tin,ks1,1); - tin[0]^=m0; - tin[1]^=m1; - DES_encrypt1(tin,ks2,0); - tin[0]^=m0; - tin[1]^=m1; - DES_encrypt1(tin,ks1,1); - tout0=tin[0]; - tout1=tin[1]; + iv1 = &(*ivec1)[0]; + l2c(m0, iv1); + l2c(m1, iv1); - l2c(tout0,out); - l2c(tout1,out); - } - iv1=&(*ivec1)[0]; - l2c(m0,iv1); - l2c(m1,iv1); - - iv2=&(*ivec2)[0]; - l2c(tout0,iv2); - l2c(tout1,iv2); + iv2 = &(*ivec2)[0]; + l2c(xor0, iv2); + l2c(xor1, iv2); } - else - { - DES_LONG t0,t1; - - c2l(iv1,m0); - c2l(iv1,m1); - c2l(iv2,xor0); - c2l(iv2,xor1); - for (l-=8; l>=-7; l-=8) - { - tin[0]=m0; - tin[1]=m1; - DES_encrypt1(tin,ks3,1); - m0=tin[0]; - m1=tin[1]; - - c2l(in,tin0); - c2l(in,tin1); - - t0=tin0; - t1=tin1; - - tin[0]=tin0; - tin[1]=tin1; - DES_encrypt1(tin,ks1,0); - tin[0]^=m0; - tin[1]^=m1; - DES_encrypt1(tin,ks2,1); - tin[0]^=m0; - tin[1]^=m1; - DES_encrypt1(tin,ks1,0); - tout0=tin[0]; - tout1=tin[1]; - - tout0^=xor0; - tout1^=xor1; - if(l < 0) - { - l2cn(tout0,tout1,out,l+8); - } - else - { - l2c(tout0,out); - l2c(tout1,out); - } - xor0=t0; - xor1=t1; - } - - iv1=&(*ivec1)[0]; - l2c(m0,iv1); - l2c(m1,iv1); - - iv2=&(*ivec2)[0]; - l2c(xor0,iv2); - l2c(xor1,iv2); - } - tin0=tin1=tout0=tout1=xor0=xor1=0; - tin[0]=tin[1]=0; - } + tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0; + tin[0] = tin[1] = 0; +} #endif diff --git a/lib/libcrypto/des/enc_read.c b/lib/libcrypto/des/enc_read.c index a9010f6f9..8095f265c 100644 --- a/lib/libcrypto/des/enc_read.c +++ b/lib/libcrypto/des/enc_read.c @@ -1,25 +1,25 @@ -/* $OpenBSD: enc_read.c,v 1.16 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: enc_read.c,v 1.17 2023/07/08 07:11:07 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -84,146 +84,139 @@ int DES_rw_mode = DES_PCBC_MODE; * used on multiple files. */ - -int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched, - DES_cblock *iv) - { +int +DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched, + DES_cblock *iv) +{ /* data to be unencrypted */ - int net_num=0; - static unsigned char *net=NULL; - /* extra unencrypted data + int net_num = 0; + static unsigned char *net = NULL; + /* extra unencrypted data * for when a block of 100 comes in but is des_read one byte at * a time. */ - static unsigned char *unnet=NULL; - static int unnet_start=0; - static int unnet_left=0; - static unsigned char *tmpbuf=NULL; + static unsigned char *unnet = NULL; + static int unnet_start = 0; + static int unnet_left = 0; + static unsigned char *tmpbuf = NULL; int i; - long num=0,rnum; + long num = 0, rnum; unsigned char *p; - if (tmpbuf == NULL) - { - tmpbuf=malloc(BSIZE); - if (tmpbuf == NULL) return(-1); - } - if (net == NULL) - { - net=malloc(BSIZE); - if (net == NULL) return(-1); - } - if (unnet == NULL) - { - unnet=malloc(BSIZE); - if (unnet == NULL) return(-1); - } + if (tmpbuf == NULL) { + tmpbuf = malloc(BSIZE); + if (tmpbuf == NULL) + return (-1); + } + if (net == NULL) { + net = malloc(BSIZE); + if (net == NULL) + return (-1); + } + if (unnet == NULL) { + unnet = malloc(BSIZE); + if (unnet == NULL) + return (-1); + } /* left over data from last decrypt */ - if (unnet_left != 0) - { - if (unnet_left < len) - { + if (unnet_left != 0) { + if (unnet_left < len) { /* we still still need more data but will return * with the number of bytes we have - should always * check the return value */ - memcpy(buf,&(unnet[unnet_start]), - unnet_left); + memcpy(buf, &(unnet[unnet_start]), + unnet_left); /* eay 26/08/92 I had the next 2 lines * reversed :-( */ - i=unnet_left; - unnet_start=unnet_left=0; - } - else - { - memcpy(buf,&(unnet[unnet_start]),len); - unnet_start+=len; - unnet_left-=len; - i=len; - } - return(i); + i = unnet_left; + unnet_start = unnet_left = 0; + } else { + memcpy(buf, &(unnet[unnet_start]), len); + unnet_start += len; + unnet_left -= len; + i = len; } + return (i); + } /* We need to get more data. */ - if (len > MAXWRITE) len=MAXWRITE; + if (len > MAXWRITE) + len = MAXWRITE; /* first - get the length */ - while (net_num < HDRSIZE) - { - i=read(fd,(void *)&(net[net_num]),HDRSIZE-net_num); + while (net_num < HDRSIZE) { + i = read(fd, (void *)&(net[net_num]), HDRSIZE - net_num); #ifdef EINTR - if ((i == -1) && (errno == EINTR)) continue; + if ((i == -1) && (errno == EINTR)) + continue; #endif - if (i <= 0) return(0); - net_num+=i; - } + if (i <= 0) + return (0); + net_num += i; + } /* we now have at net_num bytes in net */ - p=net; + p = net; /* num=0; */ - n2l(p,num); + n2l(p, num); /* num should be rounded up to the next group of eight * we make sure that we have read a multiple of 8 bytes from the net. */ if ((num > MAXWRITE) || (num < 0)) /* error */ - return(-1); - rnum=(num < 8)?8:((num+7)/8*8); + return (-1); + rnum = (num < 8) ? 8 : ((num + 7)/8*8); - net_num=0; - while (net_num < rnum) - { - i=read(fd,(void *)&(net[net_num]),rnum-net_num); + net_num = 0; + while (net_num < rnum) { + i = read(fd, (void *)&(net[net_num]), rnum - net_num); #ifdef EINTR - if ((i == -1) && (errno == EINTR)) continue; + if ((i == -1) && (errno == EINTR)) + continue; #endif - if (i <= 0) return(0); - net_num+=i; - } + if (i <= 0) + return (0); + net_num += i; + } /* Check if there will be data left over. */ - if (len < num) - { + if (len < num) { if (DES_rw_mode & DES_PCBC_MODE) - DES_pcbc_encrypt(net,unnet,num,sched,iv,DES_DECRYPT); + DES_pcbc_encrypt(net, unnet, num, sched, iv, + DES_DECRYPT); else - DES_cbc_encrypt(net,unnet,num,sched,iv,DES_DECRYPT); - memcpy(buf,unnet,len); - unnet_start=len; - unnet_left=num-len; + DES_cbc_encrypt(net, unnet, num, sched, iv, + DES_DECRYPT); + memcpy(buf, unnet, len); + unnet_start = len; + unnet_left = num - len; /* The following line is done because we return num * as the number of bytes read. */ - num=len; - } - else - { + num = len; + } else { /* >output is a multiple of 8 byes, if len < rnum * >we must be careful. The user must be aware that this * >routine will write more bytes than he asked for. * >The length of the buffer must be correct. * FIXED - Should be ok now 18-9-90 - eay */ - if (len < rnum) - { - + if (len < rnum) { if (DES_rw_mode & DES_PCBC_MODE) - DES_pcbc_encrypt(net,tmpbuf,num,sched,iv, - DES_DECRYPT); + DES_pcbc_encrypt(net, tmpbuf, num, sched, iv, + DES_DECRYPT); else - DES_cbc_encrypt(net,tmpbuf,num,sched,iv, - DES_DECRYPT); + DES_cbc_encrypt(net, tmpbuf, num, sched, iv, + DES_DECRYPT); /* eay 26/08/92 fix a bug that returned more * bytes than you asked for (returned len bytes :-( */ - memcpy(buf,tmpbuf,num); - } - else - { + memcpy(buf, tmpbuf, num); + } else { if (DES_rw_mode & DES_PCBC_MODE) - DES_pcbc_encrypt(net,buf,num,sched,iv, - DES_DECRYPT); + DES_pcbc_encrypt(net, buf, num, sched, iv, + DES_DECRYPT); else - DES_cbc_encrypt(net,buf,num,sched,iv, - DES_DECRYPT); - } + DES_cbc_encrypt(net, buf, num, sched, iv, + DES_DECRYPT); } - return num; } - + return num; +} diff --git a/lib/libcrypto/des/enc_writ.c b/lib/libcrypto/des/enc_writ.c index 65fa720c1..3def8a8d7 100644 --- a/lib/libcrypto/des/enc_writ.c +++ b/lib/libcrypto/des/enc_writ.c @@ -1,25 +1,25 @@ -/* $OpenBSD: enc_writ.c,v 1.15 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: enc_writ.c,v 1.17 2023/07/08 07:34:34 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -79,95 +79,89 @@ * - This code cannot handle non-blocking sockets. */ -int DES_enc_write(int fd, const void *_buf, int len, - DES_key_schedule *sched, DES_cblock *iv) - { +int +DES_enc_write(int fd, const void *_buf, int len, + DES_key_schedule *sched, DES_cblock *iv) +{ #ifdef _LIBC extern unsigned long time(); extern int write(); #endif - const unsigned char *buf=_buf; + const unsigned char *buf = _buf; long rnum; - int i,j,k,outnum; - static unsigned char *outbuf=NULL; + int i, j, k, outnum; + static unsigned char *outbuf = NULL; unsigned char shortbuf[8]; unsigned char *p; const unsigned char *cp; - static int start=1; + static int start = 1; - if (outbuf == NULL) - { - outbuf=malloc(BSIZE+HDRSIZE); - if (outbuf == NULL) return(-1); - } + if (outbuf == NULL) { + outbuf = malloc(BSIZE + HDRSIZE); + if (outbuf == NULL) + return (-1); + } /* If we are sending less than 8 bytes, the same char will look * the same if we don't pad it out with random bytes */ - if (start) - { - start=0; - } + if (start) { + start = 0; + } /* lets recurse if we want to send the data in small chunks */ - if (len > MAXWRITE) - { - j=0; - for (i=0; i MAXWRITE)?MAXWRITE:(len-i),sched,iv); + if (len > MAXWRITE) { + j = 0; + for (i = 0; i < len; i += k) { + k = DES_enc_write(fd, &(buf[i]), + ((len - i) > MAXWRITE) ? MAXWRITE : (len - i), + sched, iv); if (k < 0) - return(k); + return (k); else - j+=k; - } - return(j); + j += k; } + return (j); + } /* write length first */ - p=outbuf; - l2n(len,p); + p = outbuf; + l2n(len, p); /* pad short strings */ - if (len < 8) - { - cp=shortbuf; - memcpy(shortbuf,buf,len); - arc4random_buf(shortbuf+len, 8-len); - rnum=8; - } - else - { - cp=buf; - rnum=((len+7)/8*8); /* round up to nearest eight */ - } + if (len < 8) { + cp = shortbuf; + memcpy(shortbuf, buf, len); + arc4random_buf(shortbuf + len, 8 - len); + rnum = 8; + } else { + cp = buf; + rnum = ((len + 7)/8*8); /* round up to nearest eight */ + } if (DES_rw_mode & DES_PCBC_MODE) - DES_pcbc_encrypt(cp,&(outbuf[HDRSIZE]),(len<8)?8:len,sched,iv, - DES_ENCRYPT); + DES_pcbc_encrypt(cp, &(outbuf[HDRSIZE]), (len < 8) ? 8 : len, + sched, iv, DES_ENCRYPT); else - DES_cbc_encrypt(cp,&(outbuf[HDRSIZE]),(len<8)?8:len,sched,iv, - DES_ENCRYPT); + DES_cbc_encrypt(cp, &(outbuf[HDRSIZE]), (len < 8) ? 8 : len, + sched, iv, DES_ENCRYPT); /* output */ - outnum=rnum+HDRSIZE; + outnum = rnum + HDRSIZE; - for (j=0; j @@ -18,57 +18,58 @@ #include "des_local.h" /* Added more values to handle illegal salt values the way normal - * crypt() implementations do. The patch was sent by + * crypt() implementations do. The patch was sent by * Bjorn Gronvall */ -static unsigned const char con_salt[128]={ -0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9, -0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,0xE0,0xE1, -0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9, -0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1, -0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9, -0xFA,0xFB,0xFC,0xFD,0xFE,0xFF,0x00,0x01, -0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09, -0x0A,0x0B,0x05,0x06,0x07,0x08,0x09,0x0A, -0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12, -0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A, -0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22, -0x23,0x24,0x25,0x20,0x21,0x22,0x23,0x24, -0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C, -0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34, -0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C, -0x3D,0x3E,0x3F,0x40,0x41,0x42,0x43,0x44, +static unsigned const char con_salt[128] = { + 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, + 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0xE0, 0xE1, + 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, + 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, + 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, + 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, 0x00, 0x01, + 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, + 0x0A, 0x0B, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, + 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, + 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, + 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, + 0x23, 0x24, 0x25, 0x20, 0x21, 0x22, 0x23, 0x24, + 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, + 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, + 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, + 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, }; -static unsigned const char cov_2char[64]={ -0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35, -0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44, -0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C, -0x4D,0x4E,0x4F,0x50,0x51,0x52,0x53,0x54, -0x55,0x56,0x57,0x58,0x59,0x5A,0x61,0x62, -0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A, -0x6B,0x6C,0x6D,0x6E,0x6F,0x70,0x71,0x72, -0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A +static unsigned const char cov_2char[64] = { + 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, + 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, + 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, + 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, + 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x61, 0x62, + 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, + 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, + 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A }; -char *DES_crypt(const char *buf, const char *salt) - { +char * +DES_crypt(const char *buf, const char *salt) +{ static char buff[14]; - return(DES_fcrypt(buf,salt,buff)); - } + return (DES_fcrypt(buf, salt, buff)); +} - -char *DES_fcrypt(const char *buf, const char *salt, char *ret) - { - unsigned int i,j,x,y; - DES_LONG Eswap0,Eswap1; - DES_LONG out[2],ll; +char * +DES_fcrypt(const char *buf, const char *salt, char *ret) +{ + unsigned int i, j, x, y; + DES_LONG Eswap0, Eswap1; + DES_LONG out[2], ll; DES_cblock key; DES_key_schedule ks; unsigned char bb[9]; - unsigned char *b=bb; - unsigned char c,u; + unsigned char *b = bb; + unsigned char c, u; /* eay 25/08/92 * If you call crypt("pwd","*") as often happens when you @@ -78,48 +79,47 @@ char *DES_fcrypt(const char *buf, const char *salt, char *ret) * crypt to "*". This was found when replacing the crypt in * our shared libraries. People found that the disabled * accounts effectively had no passwd :-(. */ - x=ret[0]=((salt[0] == '\0')?'A':salt[0]); - Eswap0=con_salt[x]<<2; - x=ret[1]=((salt[1] == '\0')?'A':salt[1]); - Eswap1=con_salt[x]<<6; + x = ret[0] = ((salt[0] == '\0') ? 'A' : salt[0]); + Eswap0 = con_salt[x] << 2; + x = ret[1] = ((salt[1] == '\0') ? 'A' : salt[1]); + Eswap1 = con_salt[x] << 6; /* EAY r=strlen(buf); r=(r+7)/8; */ - for (i=0; i<8; i++) - { - c= *(buf++); - if (!c) break; - key[i]=(c<<1); - } - for (; i<8; i++) - key[i]=0; - - DES_set_key_unchecked(&key,&ks); - fcrypt_body(&(out[0]),&ks,Eswap0,Eswap1); - - ll=out[0]; l2c(ll,b); - ll=out[1]; l2c(ll,b); - y=0; - u=0x80; - bb[8]=0; - for (i=2; i<13; i++) - { - c=0; - for (j=0; j<6; j++) - { - c<<=1; - if (bb[y] & u) c|=1; - u>>=1; - if (!u) - { - y++; - u=0x80; - } - } - ret[i]=cov_2char[c]; - } - ret[13]='\0'; - return(ret); + for (i = 0; i < 8; i++) { + c = *(buf++); + if (!c) + break; + key[i] = (c << 1); } + for (; i < 8; i++) + key[i] = 0; + DES_set_key_unchecked(&key, &ks); + fcrypt_body(&(out[0]), &ks, Eswap0, Eswap1); + + ll = out[0]; + l2c(ll, b); + ll = out[1]; + l2c(ll, b); + y = 0; + u = 0x80; + bb[8] = 0; + for (i = 2; i < 13; i++) { + c = 0; + for (j = 0; j < 6; j++) { + c <<= 1; + if (bb[y] & u) + c |= 1; + u >>= 1; + if (!u) { + y++; + u = 0x80; + } + } + ret[i] = cov_2char[c]; + } + ret[13] = '\0'; + return (ret); +} diff --git a/lib/libcrypto/des/fcrypt_b.c b/lib/libcrypto/des/fcrypt_b.c index 903c6de94..58c9bc34c 100644 --- a/lib/libcrypto/des/fcrypt_b.c +++ b/lib/libcrypto/des/fcrypt_b.c @@ -1,25 +1,25 @@ -/* $OpenBSD: fcrypt_b.c,v 1.10 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: fcrypt_b.c,v 1.12 2023/07/08 07:34:34 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -71,76 +71,75 @@ #ifndef OPENBSD_DES_ASM #undef PERM_OP -#define PERM_OP(a,b,t,n,m) ((t)=((((a)>>(n))^(b))&(m)),\ - (b)^=(t),\ +#define PERM_OP(a,b,t,n,m) ((t)=((((a)>>(n))^(b))&(m)), \ + (b)^=(t), \ (a)^=((t)<<(n))) #undef HPERM_OP -#define HPERM_OP(a,t,n,m) ((t)=((((a)<<(16-(n)))^(a))&(m)),\ - (a)=(a)^(t)^(t>>(16-(n))))\ +#define HPERM_OP(a,t,n,m) ((t)=((((a)<<(16-(n)))^(a))&(m)), \ + (a)=(a)^(t)^(t>>(16-(n)))) \ -void fcrypt_body(DES_LONG *out, DES_key_schedule *ks, DES_LONG Eswap0, - DES_LONG Eswap1) - { - DES_LONG l,r,t,u; +void +fcrypt_body(DES_LONG *out, DES_key_schedule *ks, DES_LONG Eswap0, + DES_LONG Eswap1) +{ + DES_LONG l, r, t, u; #ifdef DES_PTR - const unsigned char *des_SP=(const unsigned char *)DES_SPtrans; + const unsigned char *des_SP = (const unsigned char *)DES_SPtrans; #endif DES_LONG *s; int j; - DES_LONG E0,E1; + DES_LONG E0, E1; - l=0; - r=0; + l = 0; + r = 0; - s=(DES_LONG *)ks; - E0=Eswap0; - E1=Eswap1; + s = (DES_LONG *)ks; + E0 = Eswap0; + E1 = Eswap1; - for (j=0; j<25; j++) - { + for (j = 0; j < 25; j++) { #ifndef DES_UNROLL int i; - for (i=0; i<32; i+=4) - { - D_ENCRYPT(l,r,i+0); /* 1 */ - D_ENCRYPT(r,l,i+2); /* 2 */ - } + for (i = 0; i < 32; i += 4) { + D_ENCRYPT(l, r, i + 0); /* 1 */ + D_ENCRYPT(r, l, i + 2); /* 2 */ + } #else - D_ENCRYPT(l,r, 0); /* 1 */ - D_ENCRYPT(r,l, 2); /* 2 */ - D_ENCRYPT(l,r, 4); /* 3 */ - D_ENCRYPT(r,l, 6); /* 4 */ - D_ENCRYPT(l,r, 8); /* 5 */ - D_ENCRYPT(r,l,10); /* 6 */ - D_ENCRYPT(l,r,12); /* 7 */ - D_ENCRYPT(r,l,14); /* 8 */ - D_ENCRYPT(l,r,16); /* 9 */ - D_ENCRYPT(r,l,18); /* 10 */ - D_ENCRYPT(l,r,20); /* 11 */ - D_ENCRYPT(r,l,22); /* 12 */ - D_ENCRYPT(l,r,24); /* 13 */ - D_ENCRYPT(r,l,26); /* 14 */ - D_ENCRYPT(l,r,28); /* 15 */ - D_ENCRYPT(r,l,30); /* 16 */ + D_ENCRYPT(l, r, 0); /* 1 */ + D_ENCRYPT(r, l, 2); /* 2 */ + D_ENCRYPT(l, r, 4); /* 3 */ + D_ENCRYPT(r, l, 6); /* 4 */ + D_ENCRYPT(l, r, 8); /* 5 */ + D_ENCRYPT(r, l, 10); /* 6 */ + D_ENCRYPT(l, r, 12); /* 7 */ + D_ENCRYPT(r, l, 14); /* 8 */ + D_ENCRYPT(l, r, 16); /* 9 */ + D_ENCRYPT(r, l, 18); /* 10 */ + D_ENCRYPT(l, r, 20); /* 11 */ + D_ENCRYPT(r, l, 22); /* 12 */ + D_ENCRYPT(l, r, 24); /* 13 */ + D_ENCRYPT(r, l, 26); /* 14 */ + D_ENCRYPT(l, r, 28); /* 15 */ + D_ENCRYPT(r, l, 30); /* 16 */ #endif - t=l; - l=r; - r=t; - } - l=ROTATE(l,3)&0xffffffffL; - r=ROTATE(r,3)&0xffffffffL; - - PERM_OP(l,r,t, 1,0x55555555L); - PERM_OP(r,l,t, 8,0x00ff00ffL); - PERM_OP(l,r,t, 2,0x33333333L); - PERM_OP(r,l,t,16,0x0000ffffL); - PERM_OP(l,r,t, 4,0x0f0f0f0fL); - - out[0]=r; - out[1]=l; + t = l; + l = r; + r = t; } + l = ROTATE(l, 3) & 0xffffffffL; + r = ROTATE(r, 3) & 0xffffffffL; + + PERM_OP(l, r, t, 1, 0x55555555L); + PERM_OP(r, l, t, 8, 0x00ff00ffL); + PERM_OP(l, r, t, 2, 0x33333333L); + PERM_OP(r, l, t, 16, 0x0000ffffL); + PERM_OP(l, r, t, 4, 0x0f0f0f0fL); + + out[0] = r; + out[1] = l; +} #endif /* OPENBSD_DES_ASM */ diff --git a/lib/libcrypto/des/ncbc_enc.c b/lib/libcrypto/des/ncbc_enc.c index f2e1274b7..c4da94c48 100644 --- a/lib/libcrypto/des/ncbc_enc.c +++ b/lib/libcrypto/des/ncbc_enc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ncbc_enc.c,v 1.8 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: ncbc_enc.c,v 1.10 2023/07/08 07:34:34 jsing Exp $ */ /* * #included by: * cbc_enc.c (DES_cbc_encrypt) @@ -10,21 +10,21 @@ * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -39,10 +39,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -54,7 +54,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -64,85 +64,92 @@ #include "des_local.h" #ifdef CBC_ENC_C__DONT_UPDATE_IV -void DES_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, - DES_key_schedule *_schedule, DES_cblock *ivec, int enc) +void +DES_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, + DES_key_schedule *_schedule, DES_cblock *ivec, int enc) #else -void DES_ncbc_encrypt(const unsigned char *in, unsigned char *out, long length, - DES_key_schedule *_schedule, DES_cblock *ivec, int enc) +void +DES_ncbc_encrypt(const unsigned char *in, unsigned char *out, long length, + DES_key_schedule *_schedule, DES_cblock *ivec, int enc) #endif - { - DES_LONG tin0,tin1; - DES_LONG tout0,tout1,xor0,xor1; - long l=length; +{ + DES_LONG tin0, tin1; + DES_LONG tout0, tout1, xor0, xor1; + long l = length; DES_LONG tin[2]; unsigned char *iv; iv = &(*ivec)[0]; - if (enc) - { - c2l(iv,tout0); - c2l(iv,tout1); - for (l-=8; l>=0; l-=8) - { - c2l(in,tin0); - c2l(in,tin1); - tin0^=tout0; tin[0]=tin0; - tin1^=tout1; tin[1]=tin1; - DES_encrypt1((DES_LONG *)tin,_schedule,DES_ENCRYPT); - tout0=tin[0]; l2c(tout0,out); - tout1=tin[1]; l2c(tout1,out); - } - if (l != -8) - { - c2ln(in,tin0,tin1,l+8); - tin0^=tout0; tin[0]=tin0; - tin1^=tout1; tin[1]=tin1; - DES_encrypt1((DES_LONG *)tin,_schedule,DES_ENCRYPT); - tout0=tin[0]; l2c(tout0,out); - tout1=tin[1]; l2c(tout1,out); - } + if (enc) { + c2l(iv, tout0); + c2l(iv, tout1); + for (l -= 8; l >= 0; l -= 8) { + c2l(in, tin0); + c2l(in, tin1); + tin0 ^= tout0; + tin[0] = tin0; + tin1 ^= tout1; + tin[1] = tin1; + DES_encrypt1((DES_LONG *)tin, _schedule, DES_ENCRYPT); + tout0 = tin[0]; + l2c(tout0, out); + tout1 = tin[1]; + l2c(tout1, out); + } + if (l != -8) { + c2ln(in, tin0, tin1, l + 8); + tin0 ^= tout0; + tin[0] = tin0; + tin1 ^= tout1; + tin[1] = tin1; + DES_encrypt1((DES_LONG *)tin, _schedule, DES_ENCRYPT); + tout0 = tin[0]; + l2c(tout0, out); + tout1 = tin[1]; + l2c(tout1, out); + } #ifndef CBC_ENC_C__DONT_UPDATE_IV iv = &(*ivec)[0]; - l2c(tout0,iv); - l2c(tout1,iv); + l2c(tout0, iv); + l2c(tout1, iv); #endif + } else { + c2l(iv, xor0); + c2l(iv, xor1); + for (l -= 8; l >= 0; l -= 8) { + c2l(in, tin0); + tin[0] = tin0; + c2l(in, tin1); + tin[1] = tin1; + DES_encrypt1((DES_LONG *)tin, _schedule, DES_DECRYPT); + tout0 = tin[0] ^ xor0; + tout1 = tin[1] ^ xor1; + l2c(tout0, out); + l2c(tout1, out); + xor0 = tin0; + xor1 = tin1; } - else - { - c2l(iv,xor0); - c2l(iv,xor1); - for (l-=8; l>=0; l-=8) - { - c2l(in,tin0); tin[0]=tin0; - c2l(in,tin1); tin[1]=tin1; - DES_encrypt1((DES_LONG *)tin,_schedule,DES_DECRYPT); - tout0=tin[0]^xor0; - tout1=tin[1]^xor1; - l2c(tout0,out); - l2c(tout1,out); - xor0=tin0; - xor1=tin1; - } - if (l != -8) - { - c2l(in,tin0); tin[0]=tin0; - c2l(in,tin1); tin[1]=tin1; - DES_encrypt1((DES_LONG *)tin,_schedule,DES_DECRYPT); - tout0=tin[0]^xor0; - tout1=tin[1]^xor1; - l2cn(tout0,tout1,out,l+8); + if (l != -8) { + c2l(in, tin0); + tin[0] = tin0; + c2l(in, tin1); + tin[1] = tin1; + DES_encrypt1((DES_LONG *)tin, _schedule, DES_DECRYPT); + tout0 = tin[0] ^ xor0; + tout1 = tin[1] ^ xor1; + l2cn(tout0, tout1, out, l + 8); #ifndef CBC_ENC_C__DONT_UPDATE_IV - xor0=tin0; - xor1=tin1; -#endif - } -#ifndef CBC_ENC_C__DONT_UPDATE_IV - iv = &(*ivec)[0]; - l2c(xor0,iv); - l2c(xor1,iv); + xor0 = tin0; + xor1 = tin1; #endif } - tin0=tin1=tout0=tout1=xor0=xor1=0; - tin[0]=tin[1]=0; +#ifndef CBC_ENC_C__DONT_UPDATE_IV + iv = &(*ivec)[0]; + l2c(xor0, iv); + l2c(xor1, iv); +#endif } + tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0; + tin[0] = tin[1] = 0; +} diff --git a/lib/libcrypto/des/ofb64ede.c b/lib/libcrypto/des/ofb64ede.c index 65969313b..2922fc77f 100644 --- a/lib/libcrypto/des/ofb64ede.c +++ b/lib/libcrypto/des/ofb64ede.c @@ -1,25 +1,25 @@ -/* $OpenBSD: ofb64ede.c,v 1.7 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: ofb64ede.c,v 1.8 2023/07/08 07:11:07 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -62,53 +62,51 @@ * used. The extra state information to record how much of the * 64bit block we have used is contained in *num; */ -void DES_ede3_ofb64_encrypt(const unsigned char *in, - unsigned char *out, long length, - DES_key_schedule *k1, DES_key_schedule *k2, - DES_key_schedule *k3, DES_cblock *ivec, - int *num) - { - DES_LONG v0,v1; - int n= *num; - long l=length; +void +DES_ede3_ofb64_encrypt(const unsigned char *in, + unsigned char *out, long length, + DES_key_schedule *k1, DES_key_schedule *k2, + DES_key_schedule *k3, DES_cblock *ivec, + int *num) +{ + DES_LONG v0, v1; + int n = *num; + long l = length; DES_cblock d; char *dp; DES_LONG ti[2]; unsigned char *iv; - int save=0; + int save = 0; iv = &(*ivec)[0]; - c2l(iv,v0); - c2l(iv,v1); - ti[0]=v0; - ti[1]=v1; - dp=(char *)d; - l2c(v0,dp); - l2c(v1,dp); - while (l--) - { - if (n == 0) - { + c2l(iv, v0); + c2l(iv, v1); + ti[0] = v0; + ti[1] = v1; + dp = (char *)d; + l2c(v0, dp); + l2c(v1, dp); + while (l--) { + if (n == 0) { /* ti[0]=v0; */ /* ti[1]=v1; */ - DES_encrypt3(ti,k1,k2,k3); - v0=ti[0]; - v1=ti[1]; + DES_encrypt3(ti, k1, k2, k3); + v0 = ti[0]; + v1 = ti[1]; - dp=(char *)d; - l2c(v0,dp); - l2c(v1,dp); + dp = (char *)d; + l2c(v0, dp); + l2c(v1, dp); save++; - } - *(out++)= *(in++)^d[n]; - n=(n+1)&0x07; } - if (save) - { - iv = &(*ivec)[0]; - l2c(v0,iv); - l2c(v1,iv); - } - v0=v1=ti[0]=ti[1]=0; - *num=n; + *(out++) = *(in++) ^ d[n]; + n = (n + 1) & 0x07; } + if (save) { + iv = &(*ivec)[0]; + l2c(v0, iv); + l2c(v1, iv); + } + v0 = v1 = ti[0] = ti[1] = 0; + *num = n; +} diff --git a/lib/libcrypto/des/ofb64enc.c b/lib/libcrypto/des/ofb64enc.c index 10deca00e..c3b1b8af8 100644 --- a/lib/libcrypto/des/ofb64enc.c +++ b/lib/libcrypto/des/ofb64enc.c @@ -1,25 +1,25 @@ -/* $OpenBSD: ofb64enc.c,v 1.7 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: ofb64enc.c,v 1.8 2023/07/08 07:11:07 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -62,49 +62,48 @@ * used. The extra state information to record how much of the * 64bit block we have used is contained in *num; */ -void DES_ofb64_encrypt(const unsigned char *in, - unsigned char *out, long length, - DES_key_schedule *schedule, DES_cblock *ivec, int *num) - { - DES_LONG v0,v1,t; - int n= *num; - long l=length; +void +DES_ofb64_encrypt(const unsigned char *in, + unsigned char *out, long length, + DES_key_schedule *schedule, DES_cblock *ivec, int *num) +{ + DES_LONG v0, v1, t; + int n = *num; + long l = length; DES_cblock d; unsigned char *dp; DES_LONG ti[2]; unsigned char *iv; - int save=0; + int save = 0; iv = &(*ivec)[0]; - c2l(iv,v0); - c2l(iv,v1); - ti[0]=v0; - ti[1]=v1; - dp=d; - l2c(v0,dp); - l2c(v1,dp); - while (l--) - { - if (n == 0) - { - DES_encrypt1(ti,schedule,DES_ENCRYPT); - dp=d; - t=ti[0]; l2c(t,dp); - t=ti[1]; l2c(t,dp); + c2l(iv, v0); + c2l(iv, v1); + ti[0] = v0; + ti[1] = v1; + dp = d; + l2c(v0, dp); + l2c(v1, dp); + while (l--) { + if (n == 0) { + DES_encrypt1(ti, schedule, DES_ENCRYPT); + dp = d; + t = ti[0]; + l2c(t, dp); + t = ti[1]; + l2c(t, dp); save++; - } - *(out++)= *(in++)^d[n]; - n=(n+1)&0x07; } - if (save) - { - v0=ti[0]; - v1=ti[1]; - iv = &(*ivec)[0]; - l2c(v0,iv); - l2c(v1,iv); - } - t=v0=v1=ti[0]=ti[1]=0; - *num=n; + *(out++) = *(in++) ^ d[n]; + n = (n + 1) & 0x07; } - + if (save) { + v0 = ti[0]; + v1 = ti[1]; + iv = &(*ivec)[0]; + l2c(v0, iv); + l2c(v1, iv); + } + t = v0 = v1 = ti[0] = ti[1] = 0; + *num = n; +} diff --git a/lib/libcrypto/des/ofb_enc.c b/lib/libcrypto/des/ofb_enc.c index 25abb6db9..990b927eb 100644 --- a/lib/libcrypto/des/ofb_enc.c +++ b/lib/libcrypto/des/ofb_enc.c @@ -1,25 +1,25 @@ -/* $OpenBSD: ofb_enc.c,v 1.7 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: ofb_enc.c,v 1.8 2023/07/08 07:11:07 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -64,72 +64,70 @@ * the second. The second 12 bits will come from the 3rd and half the 4th * byte. */ -void DES_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits, - long length, DES_key_schedule *schedule, - DES_cblock *ivec) - { - DES_LONG d0,d1,vv0,vv1,v0,v1,n=(numbits+7)/8; - DES_LONG mask0,mask1; - long l=length; - int num=numbits; +void +DES_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits, + long length, DES_key_schedule *schedule, + DES_cblock *ivec) +{ + DES_LONG d0, d1, vv0, vv1, v0, v1, n = (numbits + 7)/8; + DES_LONG mask0, mask1; + long l = length; + int num = numbits; DES_LONG ti[2]; unsigned char *iv; - if (num > 64) return; - if (num > 32) - { - mask0=0xffffffffL; + if (num > 64) + return; + if (num > 32) { + mask0 = 0xffffffffL; if (num >= 64) - mask1=mask0; + mask1 = mask0; else - mask1=(1L<<(num-32))-1; - } - else - { + mask1 = (1L << (num - 32)) - 1; + } else { if (num == 32) - mask0=0xffffffffL; + mask0 = 0xffffffffL; else - mask0=(1L< 0) - { - ti[0]=v0; - ti[1]=v1; - DES_encrypt1((DES_LONG *)ti,schedule,DES_ENCRYPT); - vv0=ti[0]; - vv1=ti[1]; - c2ln(in,d0,d1,n); - in+=n; - d0=(d0^vv0)&mask0; - d1=(d1^vv1)&mask1; - l2cn(d0,d1,out,n); - out+=n; - - if (num == 32) - { v0=v1; v1=vv0; } - else if (num == 64) - { v0=vv0; v1=vv1; } - else if (num > 32) /* && num != 64 */ - { - v0=((v1>>(num-32))|(vv0<<(64-num)))&0xffffffffL; - v1=((vv0>>(num-32))|(vv1<<(64-num)))&0xffffffffL; - } - else /* num < 32 */ - { - v0=((v0>>num)|(v1<<(32-num)))&0xffffffffL; - v1=((v1>>num)|(vv0<<(32-num)))&0xffffffffL; - } - } - iv = &(*ivec)[0]; - l2c(v0,iv); - l2c(v1,iv); - v0=v1=d0=d1=ti[0]=ti[1]=vv0=vv1=0; + mask0 = (1L << num) - 1; + mask1 = 0x00000000L; } + iv = &(*ivec)[0]; + c2l(iv, v0); + c2l(iv, v1); + ti[0] = v0; + ti[1] = v1; + while (l-- > 0) { + ti[0] = v0; + ti[1] = v1; + DES_encrypt1((DES_LONG *)ti, schedule, DES_ENCRYPT); + vv0 = ti[0]; + vv1 = ti[1]; + c2ln(in, d0, d1, n); + in += n; + d0 = (d0 ^ vv0) & mask0; + d1 = (d1 ^ vv1) & mask1; + l2cn(d0, d1, out, n); + out += n; + + if (num == 32) { + v0 = v1; + v1 = vv0; + } else if (num == 64) { + v0 = vv0; + v1 = vv1; + } else if (num > 32) { /* && num != 64 */ + v0 = ((v1 >> (num - 32))|(vv0 << (64 - num))) & + 0xffffffffL; + v1 = ((vv0 >> (num - 32))|(vv1 << (64 - num))) & + 0xffffffffL; + } else /* num < 32 */ { + v0 = ((v0 >> num)|(v1 << (32 - num))) & 0xffffffffL; + v1 = ((v1 >> num)|(vv0 << (32 - num))) & 0xffffffffL; + } + } + iv = &(*ivec)[0]; + l2c(v0, iv); + l2c(v1, iv); + v0 = v1 = d0 = d1 = ti[0] = ti[1] = vv0 = vv1 = 0; +} diff --git a/lib/libcrypto/des/pcbc_enc.c b/lib/libcrypto/des/pcbc_enc.c index 1f8688d1f..3a420f013 100644 --- a/lib/libcrypto/des/pcbc_enc.c +++ b/lib/libcrypto/des/pcbc_enc.c @@ -1,25 +1,25 @@ -/* $OpenBSD: pcbc_enc.c,v 1.7 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: pcbc_enc.c,v 1.9 2023/07/08 07:34:34 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -58,66 +58,59 @@ #include "des_local.h" -void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int enc) - { - DES_LONG sin0,sin1,xor0,xor1,tout0,tout1; +void +DES_pcbc_encrypt(const unsigned char *input, unsigned char *output, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int enc) +{ + DES_LONG sin0, sin1, xor0, xor1, tout0, tout1; DES_LONG tin[2]; const unsigned char *in; - unsigned char *out,*iv; + unsigned char *out, *iv; - in=input; - out=output; + in = input; + out = output; iv = &(*ivec)[0]; - if (enc) - { - c2l(iv,xor0); - c2l(iv,xor1); - for (; length>0; length-=8) - { - if (length >= 8) - { - c2l(in,sin0); - c2l(in,sin1); - } - else - c2ln(in,sin0,sin1,length); - tin[0]=sin0^xor0; - tin[1]=sin1^xor1; - DES_encrypt1((DES_LONG *)tin,schedule,DES_ENCRYPT); - tout0=tin[0]; - tout1=tin[1]; - xor0=sin0^tout0; - xor1=sin1^tout1; - l2c(tout0,out); - l2c(tout1,out); - } + if (enc) { + c2l(iv, xor0); + c2l(iv, xor1); + for (; length > 0; length -= 8) { + if (length >= 8) { + c2l(in, sin0); + c2l(in, sin1); + } else + c2ln(in, sin0, sin1, length); + tin[0] = sin0 ^ xor0; + tin[1] = sin1 ^ xor1; + DES_encrypt1((DES_LONG *)tin, schedule, DES_ENCRYPT); + tout0 = tin[0]; + tout1 = tin[1]; + xor0 = sin0 ^ tout0; + xor1 = sin1 ^ tout1; + l2c(tout0, out); + l2c(tout1, out); } - else - { - c2l(iv,xor0); c2l(iv,xor1); - for (; length>0; length-=8) - { - c2l(in,sin0); - c2l(in,sin1); - tin[0]=sin0; - tin[1]=sin1; - DES_encrypt1((DES_LONG *)tin,schedule,DES_DECRYPT); - tout0=tin[0]^xor0; - tout1=tin[1]^xor1; - if (length >= 8) - { - l2c(tout0,out); - l2c(tout1,out); - } - else - l2cn(tout0,tout1,out,length); - xor0=tout0^sin0; - xor1=tout1^sin1; - } + } else { + c2l(iv, xor0); + c2l(iv, xor1); + for (; length > 0; length -= 8) { + c2l(in, sin0); + c2l(in, sin1); + tin[0] = sin0; + tin[1] = sin1; + DES_encrypt1((DES_LONG *)tin, schedule, DES_DECRYPT); + tout0 = tin[0] ^ xor0; + tout1 = tin[1] ^ xor1; + if (length >= 8) { + l2c(tout0, out); + l2c(tout1, out); + } else + l2cn(tout0, tout1, out, length); + xor0 = tout0 ^ sin0; + xor1 = tout1 ^ sin1; } - tin[0]=tin[1]=0; - sin0=sin1=xor0=xor1=tout0=tout1=0; } + tin[0] = tin[1] = 0; + sin0 = sin1 = xor0 = xor1 = tout0 = tout1 = 0; +} diff --git a/lib/libcrypto/des/qud_cksm.c b/lib/libcrypto/des/qud_cksm.c index 7ff43620a..ab2866826 100644 --- a/lib/libcrypto/des/qud_cksm.c +++ b/lib/libcrypto/des/qud_cksm.c @@ -1,25 +1,25 @@ -/* $OpenBSD: qud_cksm.c,v 1.8 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: qud_cksm.c,v 1.10 2023/07/08 07:34:34 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -73,53 +73,53 @@ /* Got the value MIT uses via brute force :-) 2/10/90 eay */ #define NOISE ((DES_LONG)83653421L) -DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[], - long length, int out_count, DES_cblock *seed) - { - DES_LONG z0,z1,t0,t1; +DES_LONG +DES_quad_cksum(const unsigned char *input, DES_cblock output[], + long length, int out_count, DES_cblock *seed) +{ + DES_LONG z0, z1, t0, t1; int i; long l; const unsigned char *cp; DES_LONG *lp; - if (out_count < 1) out_count=1; - lp = (DES_LONG *) &(output[0])[0]; + if (out_count < 1) + out_count = 1; + lp = (DES_LONG *)&(output[0])[0]; - z0=Q_B0((*seed)[0])|Q_B1((*seed)[1])|Q_B2((*seed)[2])|Q_B3((*seed)[3]); - z1=Q_B0((*seed)[4])|Q_B1((*seed)[5])|Q_B2((*seed)[6])|Q_B3((*seed)[7]); + z0 = Q_B0((*seed)[0])|Q_B1((*seed)[1])|Q_B2((*seed)[2])|Q_B3( + (*seed)[3]); + z1 = Q_B0((*seed)[4])|Q_B1((*seed)[5])|Q_B2((*seed)[6])|Q_B3( + (*seed)[7]); - for (i=0; ((i<4)&&(i 0) - { - if (l > 1) - { - t0= (DES_LONG)(*(cp++)); - t0|=(DES_LONG)Q_B1(*(cp++)); + for (i = 0; ((i < 4) && (i < out_count)); i++) { + cp = input; + l = length; + while (l > 0) { + if (l > 1) { + t0 = (DES_LONG)(*(cp++)); + t0 |= (DES_LONG)Q_B1(*(cp++)); l--; - } - else - t0= (DES_LONG)(*(cp++)); + } else + t0 = (DES_LONG)(*(cp++)); l--; /* add */ - t0+=z0; - t0&=0xffffffffL; - t1=z1; + t0 += z0; + t0 &= 0xffffffffL; + t1 = z1; /* square, well sort of square */ - z0=((((t0*t0)&0xffffffffL)+((t1*t1)&0xffffffffL)) - &0xffffffffL)%0x7fffffffL; - z1=((t0*((t1+NOISE)&0xffffffffL))&0xffffffffL)%0x7fffffffL; - } - if (lp != NULL) - { + z0 = ((((t0*t0) & 0xffffffffL) + + ((t1*t1) & 0xffffffffL)) & 0xffffffffL) % + 0x7fffffffL; + z1 = ((t0*((t1 + NOISE) & 0xffffffffL)) & 0xffffffffL) % + 0x7fffffffL; + } + if (lp != NULL) { /* The MIT library assumes that the checksum is * composed of 2*out_count 32 bit ints */ *lp++ = z0; *lp++ = z1; - } } - return(z0); } - + return (z0); +} diff --git a/lib/libcrypto/des/rand_key.c b/lib/libcrypto/des/rand_key.c index 7abb811df..aba899fe0 100644 --- a/lib/libcrypto/des/rand_key.c +++ b/lib/libcrypto/des/rand_key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rand_key.c,v 1.8 2014/10/22 13:02:04 jsing Exp $ */ +/* $OpenBSD: rand_key.c,v 1.9 2023/07/08 07:11:07 beck Exp $ */ /* ==================================================================== * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. * @@ -7,7 +7,7 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in diff --git a/lib/libcrypto/des/set_key.c b/lib/libcrypto/des/set_key.c index 5196a64f1..91116c4d1 100644 --- a/lib/libcrypto/des/set_key.c +++ b/lib/libcrypto/des/set_key.c @@ -1,25 +1,25 @@ -/* $OpenBSD: set_key.c,v 1.21 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: set_key.c,v 1.23 2023/07/08 07:34:34 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -68,43 +68,45 @@ int DES_check_key = 0; /* defaults to false */ -static const unsigned char odd_parity[256]={ - 1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14, - 16, 16, 19, 19, 21, 21, 22, 22, 25, 25, 26, 26, 28, 28, 31, 31, - 32, 32, 35, 35, 37, 37, 38, 38, 41, 41, 42, 42, 44, 44, 47, 47, - 49, 49, 50, 50, 52, 52, 55, 55, 56, 56, 59, 59, 61, 61, 62, 62, - 64, 64, 67, 67, 69, 69, 70, 70, 73, 73, 74, 74, 76, 76, 79, 79, - 81, 81, 82, 82, 84, 84, 87, 87, 88, 88, 91, 91, 93, 93, 94, 94, - 97, 97, 98, 98,100,100,103,103,104,104,107,107,109,109,110,110, -112,112,115,115,117,117,118,118,121,121,122,122,124,124,127,127, -128,128,131,131,133,133,134,134,137,137,138,138,140,140,143,143, -145,145,146,146,148,148,151,151,152,152,155,155,157,157,158,158, -161,161,162,162,164,164,167,167,168,168,171,171,173,173,174,174, -176,176,179,179,181,181,182,182,185,185,186,186,188,188,191,191, -193,193,194,194,196,196,199,199,200,200,203,203,205,205,206,206, -208,208,211,211,213,213,214,214,217,217,218,218,220,220,223,223, -224,224,227,227,229,229,230,230,233,233,234,234,236,236,239,239, -241,241,242,242,244,244,247,247,248,248,251,251,253,253,254,254}; +static const unsigned char odd_parity[256] = { + 1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14, + 16, 16, 19, 19, 21, 21, 22, 22, 25, 25, 26, 26, 28, 28, 31, 31, + 32, 32, 35, 35, 37, 37, 38, 38, 41, 41, 42, 42, 44, 44, 47, 47, + 49, 49, 50, 50, 52, 52, 55, 55, 56, 56, 59, 59, 61, 61, 62, 62, + 64, 64, 67, 67, 69, 69, 70, 70, 73, 73, 74, 74, 76, 76, 79, 79, + 81, 81, 82, 82, 84, 84, 87, 87, 88, 88, 91, 91, 93, 93, 94, 94, + 97, 97, 98, 98, 100, 100, 103, 103, 104, 104, 107, 107, 109, 109, 110, 110, + 112, 112, 115, 115, 117, 117, 118, 118, 121, 121, 122, 122, 124, 124, 127, 127, + 128, 128, 131, 131, 133, 133, 134, 134, 137, 137, 138, 138, 140, 140, 143, 143, + 145, 145, 146, 146, 148, 148, 151, 151, 152, 152, 155, 155, 157, 157, 158, 158, + 161, 161, 162, 162, 164, 164, 167, 167, 168, 168, 171, 171, 173, 173, 174, 174, + 176, 176, 179, 179, 181, 181, 182, 182, 185, 185, 186, 186, 188, 188, 191, 191, + 193, 193, 194, 194, 196, 196, 199, 199, 200, 200, 203, 203, 205, 205, 206, 206, + 208, 208, 211, 211, 213, 213, 214, 214, 217, 217, 218, 218, 220, 220, 223, 223, + 224, 224, 227, 227, 229, 229, 230, 230, 233, 233, 234, 234, 236, 236, 239, 239, + 241, 241, 242, 242, 244, 244, 247, 247, 248, 248, 251, 251, 253, 253, 254, 254, +}; -void DES_set_odd_parity(DES_cblock *key) - { +void +DES_set_odd_parity(DES_cblock *key) +{ unsigned int i; - for (i=0; i>(n))^(b))&(m)),\ * (b)^=(t),\ * (a)=((a)^((t)<<(n)))) */ -#define HPERM_OP(a,t,n,m) ((t)=((((a)<<(16-(n)))^(a))&(m)),\ +#define HPERM_OP(a,t,n,m) ((t)=((((a)<<(16-(n)))^(a))&(m)), \ (a)=(a)^(t)^(t>>(16-(n)))) -static const DES_LONG des_skb[8][64]={ +static const DES_LONG des_skb[8][64] = { { - /* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ - 0x00000000L,0x00000010L,0x20000000L,0x20000010L, - 0x00010000L,0x00010010L,0x20010000L,0x20010010L, - 0x00000800L,0x00000810L,0x20000800L,0x20000810L, - 0x00010800L,0x00010810L,0x20010800L,0x20010810L, - 0x00000020L,0x00000030L,0x20000020L,0x20000030L, - 0x00010020L,0x00010030L,0x20010020L,0x20010030L, - 0x00000820L,0x00000830L,0x20000820L,0x20000830L, - 0x00010820L,0x00010830L,0x20010820L,0x20010830L, - 0x00080000L,0x00080010L,0x20080000L,0x20080010L, - 0x00090000L,0x00090010L,0x20090000L,0x20090010L, - 0x00080800L,0x00080810L,0x20080800L,0x20080810L, - 0x00090800L,0x00090810L,0x20090800L,0x20090810L, - 0x00080020L,0x00080030L,0x20080020L,0x20080030L, - 0x00090020L,0x00090030L,0x20090020L,0x20090030L, - 0x00080820L,0x00080830L,0x20080820L,0x20080830L, - 0x00090820L,0x00090830L,0x20090820L,0x20090830L, - },{ - /* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */ - 0x00000000L,0x02000000L,0x00002000L,0x02002000L, - 0x00200000L,0x02200000L,0x00202000L,0x02202000L, - 0x00000004L,0x02000004L,0x00002004L,0x02002004L, - 0x00200004L,0x02200004L,0x00202004L,0x02202004L, - 0x00000400L,0x02000400L,0x00002400L,0x02002400L, - 0x00200400L,0x02200400L,0x00202400L,0x02202400L, - 0x00000404L,0x02000404L,0x00002404L,0x02002404L, - 0x00200404L,0x02200404L,0x00202404L,0x02202404L, - 0x10000000L,0x12000000L,0x10002000L,0x12002000L, - 0x10200000L,0x12200000L,0x10202000L,0x12202000L, - 0x10000004L,0x12000004L,0x10002004L,0x12002004L, - 0x10200004L,0x12200004L,0x10202004L,0x12202004L, - 0x10000400L,0x12000400L,0x10002400L,0x12002400L, - 0x10200400L,0x12200400L,0x10202400L,0x12202400L, - 0x10000404L,0x12000404L,0x10002404L,0x12002404L, - 0x10200404L,0x12200404L,0x10202404L,0x12202404L, - },{ - /* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */ - 0x00000000L,0x00000001L,0x00040000L,0x00040001L, - 0x01000000L,0x01000001L,0x01040000L,0x01040001L, - 0x00000002L,0x00000003L,0x00040002L,0x00040003L, - 0x01000002L,0x01000003L,0x01040002L,0x01040003L, - 0x00000200L,0x00000201L,0x00040200L,0x00040201L, - 0x01000200L,0x01000201L,0x01040200L,0x01040201L, - 0x00000202L,0x00000203L,0x00040202L,0x00040203L, - 0x01000202L,0x01000203L,0x01040202L,0x01040203L, - 0x08000000L,0x08000001L,0x08040000L,0x08040001L, - 0x09000000L,0x09000001L,0x09040000L,0x09040001L, - 0x08000002L,0x08000003L,0x08040002L,0x08040003L, - 0x09000002L,0x09000003L,0x09040002L,0x09040003L, - 0x08000200L,0x08000201L,0x08040200L,0x08040201L, - 0x09000200L,0x09000201L,0x09040200L,0x09040201L, - 0x08000202L,0x08000203L,0x08040202L,0x08040203L, - 0x09000202L,0x09000203L,0x09040202L,0x09040203L, - },{ - /* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */ - 0x00000000L,0x00100000L,0x00000100L,0x00100100L, - 0x00000008L,0x00100008L,0x00000108L,0x00100108L, - 0x00001000L,0x00101000L,0x00001100L,0x00101100L, - 0x00001008L,0x00101008L,0x00001108L,0x00101108L, - 0x04000000L,0x04100000L,0x04000100L,0x04100100L, - 0x04000008L,0x04100008L,0x04000108L,0x04100108L, - 0x04001000L,0x04101000L,0x04001100L,0x04101100L, - 0x04001008L,0x04101008L,0x04001108L,0x04101108L, - 0x00020000L,0x00120000L,0x00020100L,0x00120100L, - 0x00020008L,0x00120008L,0x00020108L,0x00120108L, - 0x00021000L,0x00121000L,0x00021100L,0x00121100L, - 0x00021008L,0x00121008L,0x00021108L,0x00121108L, - 0x04020000L,0x04120000L,0x04020100L,0x04120100L, - 0x04020008L,0x04120008L,0x04020108L,0x04120108L, - 0x04021000L,0x04121000L,0x04021100L,0x04121100L, - 0x04021008L,0x04121008L,0x04021108L,0x04121108L, - },{ - /* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ - 0x00000000L,0x10000000L,0x00010000L,0x10010000L, - 0x00000004L,0x10000004L,0x00010004L,0x10010004L, - 0x20000000L,0x30000000L,0x20010000L,0x30010000L, - 0x20000004L,0x30000004L,0x20010004L,0x30010004L, - 0x00100000L,0x10100000L,0x00110000L,0x10110000L, - 0x00100004L,0x10100004L,0x00110004L,0x10110004L, - 0x20100000L,0x30100000L,0x20110000L,0x30110000L, - 0x20100004L,0x30100004L,0x20110004L,0x30110004L, - 0x00001000L,0x10001000L,0x00011000L,0x10011000L, - 0x00001004L,0x10001004L,0x00011004L,0x10011004L, - 0x20001000L,0x30001000L,0x20011000L,0x30011000L, - 0x20001004L,0x30001004L,0x20011004L,0x30011004L, - 0x00101000L,0x10101000L,0x00111000L,0x10111000L, - 0x00101004L,0x10101004L,0x00111004L,0x10111004L, - 0x20101000L,0x30101000L,0x20111000L,0x30111000L, - 0x20101004L,0x30101004L,0x20111004L,0x30111004L, - },{ - /* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */ - 0x00000000L,0x08000000L,0x00000008L,0x08000008L, - 0x00000400L,0x08000400L,0x00000408L,0x08000408L, - 0x00020000L,0x08020000L,0x00020008L,0x08020008L, - 0x00020400L,0x08020400L,0x00020408L,0x08020408L, - 0x00000001L,0x08000001L,0x00000009L,0x08000009L, - 0x00000401L,0x08000401L,0x00000409L,0x08000409L, - 0x00020001L,0x08020001L,0x00020009L,0x08020009L, - 0x00020401L,0x08020401L,0x00020409L,0x08020409L, - 0x02000000L,0x0A000000L,0x02000008L,0x0A000008L, - 0x02000400L,0x0A000400L,0x02000408L,0x0A000408L, - 0x02020000L,0x0A020000L,0x02020008L,0x0A020008L, - 0x02020400L,0x0A020400L,0x02020408L,0x0A020408L, - 0x02000001L,0x0A000001L,0x02000009L,0x0A000009L, - 0x02000401L,0x0A000401L,0x02000409L,0x0A000409L, - 0x02020001L,0x0A020001L,0x02020009L,0x0A020009L, - 0x02020401L,0x0A020401L,0x02020409L,0x0A020409L, - },{ - /* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */ - 0x00000000L,0x00000100L,0x00080000L,0x00080100L, - 0x01000000L,0x01000100L,0x01080000L,0x01080100L, - 0x00000010L,0x00000110L,0x00080010L,0x00080110L, - 0x01000010L,0x01000110L,0x01080010L,0x01080110L, - 0x00200000L,0x00200100L,0x00280000L,0x00280100L, - 0x01200000L,0x01200100L,0x01280000L,0x01280100L, - 0x00200010L,0x00200110L,0x00280010L,0x00280110L, - 0x01200010L,0x01200110L,0x01280010L,0x01280110L, - 0x00000200L,0x00000300L,0x00080200L,0x00080300L, - 0x01000200L,0x01000300L,0x01080200L,0x01080300L, - 0x00000210L,0x00000310L,0x00080210L,0x00080310L, - 0x01000210L,0x01000310L,0x01080210L,0x01080310L, - 0x00200200L,0x00200300L,0x00280200L,0x00280300L, - 0x01200200L,0x01200300L,0x01280200L,0x01280300L, - 0x00200210L,0x00200310L,0x00280210L,0x00280310L, - 0x01200210L,0x01200310L,0x01280210L,0x01280310L, - },{ - /* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */ - 0x00000000L,0x04000000L,0x00040000L,0x04040000L, - 0x00000002L,0x04000002L,0x00040002L,0x04040002L, - 0x00002000L,0x04002000L,0x00042000L,0x04042000L, - 0x00002002L,0x04002002L,0x00042002L,0x04042002L, - 0x00000020L,0x04000020L,0x00040020L,0x04040020L, - 0x00000022L,0x04000022L,0x00040022L,0x04040022L, - 0x00002020L,0x04002020L,0x00042020L,0x04042020L, - 0x00002022L,0x04002022L,0x00042022L,0x04042022L, - 0x00000800L,0x04000800L,0x00040800L,0x04040800L, - 0x00000802L,0x04000802L,0x00040802L,0x04040802L, - 0x00002800L,0x04002800L,0x00042800L,0x04042800L, - 0x00002802L,0x04002802L,0x00042802L,0x04042802L, - 0x00000820L,0x04000820L,0x00040820L,0x04040820L, - 0x00000822L,0x04000822L,0x00040822L,0x04040822L, - 0x00002820L,0x04002820L,0x00042820L,0x04042820L, - 0x00002822L,0x04002822L,0x00042822L,0x04042822L, - }}; + /* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ + 0x00000000L, 0x00000010L, 0x20000000L, 0x20000010L, + 0x00010000L, 0x00010010L, 0x20010000L, 0x20010010L, + 0x00000800L, 0x00000810L, 0x20000800L, 0x20000810L, + 0x00010800L, 0x00010810L, 0x20010800L, 0x20010810L, + 0x00000020L, 0x00000030L, 0x20000020L, 0x20000030L, + 0x00010020L, 0x00010030L, 0x20010020L, 0x20010030L, + 0x00000820L, 0x00000830L, 0x20000820L, 0x20000830L, + 0x00010820L, 0x00010830L, 0x20010820L, 0x20010830L, + 0x00080000L, 0x00080010L, 0x20080000L, 0x20080010L, + 0x00090000L, 0x00090010L, 0x20090000L, 0x20090010L, + 0x00080800L, 0x00080810L, 0x20080800L, 0x20080810L, + 0x00090800L, 0x00090810L, 0x20090800L, 0x20090810L, + 0x00080020L, 0x00080030L, 0x20080020L, 0x20080030L, + 0x00090020L, 0x00090030L, 0x20090020L, 0x20090030L, + 0x00080820L, 0x00080830L, 0x20080820L, 0x20080830L, + 0x00090820L, 0x00090830L, 0x20090820L, 0x20090830L, + }, { + /* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */ + 0x00000000L, 0x02000000L, 0x00002000L, 0x02002000L, + 0x00200000L, 0x02200000L, 0x00202000L, 0x02202000L, + 0x00000004L, 0x02000004L, 0x00002004L, 0x02002004L, + 0x00200004L, 0x02200004L, 0x00202004L, 0x02202004L, + 0x00000400L, 0x02000400L, 0x00002400L, 0x02002400L, + 0x00200400L, 0x02200400L, 0x00202400L, 0x02202400L, + 0x00000404L, 0x02000404L, 0x00002404L, 0x02002404L, + 0x00200404L, 0x02200404L, 0x00202404L, 0x02202404L, + 0x10000000L, 0x12000000L, 0x10002000L, 0x12002000L, + 0x10200000L, 0x12200000L, 0x10202000L, 0x12202000L, + 0x10000004L, 0x12000004L, 0x10002004L, 0x12002004L, + 0x10200004L, 0x12200004L, 0x10202004L, 0x12202004L, + 0x10000400L, 0x12000400L, 0x10002400L, 0x12002400L, + 0x10200400L, 0x12200400L, 0x10202400L, 0x12202400L, + 0x10000404L, 0x12000404L, 0x10002404L, 0x12002404L, + 0x10200404L, 0x12200404L, 0x10202404L, 0x12202404L, + }, { + /* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */ + 0x00000000L, 0x00000001L, 0x00040000L, 0x00040001L, + 0x01000000L, 0x01000001L, 0x01040000L, 0x01040001L, + 0x00000002L, 0x00000003L, 0x00040002L, 0x00040003L, + 0x01000002L, 0x01000003L, 0x01040002L, 0x01040003L, + 0x00000200L, 0x00000201L, 0x00040200L, 0x00040201L, + 0x01000200L, 0x01000201L, 0x01040200L, 0x01040201L, + 0x00000202L, 0x00000203L, 0x00040202L, 0x00040203L, + 0x01000202L, 0x01000203L, 0x01040202L, 0x01040203L, + 0x08000000L, 0x08000001L, 0x08040000L, 0x08040001L, + 0x09000000L, 0x09000001L, 0x09040000L, 0x09040001L, + 0x08000002L, 0x08000003L, 0x08040002L, 0x08040003L, + 0x09000002L, 0x09000003L, 0x09040002L, 0x09040003L, + 0x08000200L, 0x08000201L, 0x08040200L, 0x08040201L, + 0x09000200L, 0x09000201L, 0x09040200L, 0x09040201L, + 0x08000202L, 0x08000203L, 0x08040202L, 0x08040203L, + 0x09000202L, 0x09000203L, 0x09040202L, 0x09040203L, + }, { + /* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */ + 0x00000000L, 0x00100000L, 0x00000100L, 0x00100100L, + 0x00000008L, 0x00100008L, 0x00000108L, 0x00100108L, + 0x00001000L, 0x00101000L, 0x00001100L, 0x00101100L, + 0x00001008L, 0x00101008L, 0x00001108L, 0x00101108L, + 0x04000000L, 0x04100000L, 0x04000100L, 0x04100100L, + 0x04000008L, 0x04100008L, 0x04000108L, 0x04100108L, + 0x04001000L, 0x04101000L, 0x04001100L, 0x04101100L, + 0x04001008L, 0x04101008L, 0x04001108L, 0x04101108L, + 0x00020000L, 0x00120000L, 0x00020100L, 0x00120100L, + 0x00020008L, 0x00120008L, 0x00020108L, 0x00120108L, + 0x00021000L, 0x00121000L, 0x00021100L, 0x00121100L, + 0x00021008L, 0x00121008L, 0x00021108L, 0x00121108L, + 0x04020000L, 0x04120000L, 0x04020100L, 0x04120100L, + 0x04020008L, 0x04120008L, 0x04020108L, 0x04120108L, + 0x04021000L, 0x04121000L, 0x04021100L, 0x04121100L, + 0x04021008L, 0x04121008L, 0x04021108L, 0x04121108L, + }, { + /* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ + 0x00000000L, 0x10000000L, 0x00010000L, 0x10010000L, + 0x00000004L, 0x10000004L, 0x00010004L, 0x10010004L, + 0x20000000L, 0x30000000L, 0x20010000L, 0x30010000L, + 0x20000004L, 0x30000004L, 0x20010004L, 0x30010004L, + 0x00100000L, 0x10100000L, 0x00110000L, 0x10110000L, + 0x00100004L, 0x10100004L, 0x00110004L, 0x10110004L, + 0x20100000L, 0x30100000L, 0x20110000L, 0x30110000L, + 0x20100004L, 0x30100004L, 0x20110004L, 0x30110004L, + 0x00001000L, 0x10001000L, 0x00011000L, 0x10011000L, + 0x00001004L, 0x10001004L, 0x00011004L, 0x10011004L, + 0x20001000L, 0x30001000L, 0x20011000L, 0x30011000L, + 0x20001004L, 0x30001004L, 0x20011004L, 0x30011004L, + 0x00101000L, 0x10101000L, 0x00111000L, 0x10111000L, + 0x00101004L, 0x10101004L, 0x00111004L, 0x10111004L, + 0x20101000L, 0x30101000L, 0x20111000L, 0x30111000L, + 0x20101004L, 0x30101004L, 0x20111004L, 0x30111004L, + }, { + /* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */ + 0x00000000L, 0x08000000L, 0x00000008L, 0x08000008L, + 0x00000400L, 0x08000400L, 0x00000408L, 0x08000408L, + 0x00020000L, 0x08020000L, 0x00020008L, 0x08020008L, + 0x00020400L, 0x08020400L, 0x00020408L, 0x08020408L, + 0x00000001L, 0x08000001L, 0x00000009L, 0x08000009L, + 0x00000401L, 0x08000401L, 0x00000409L, 0x08000409L, + 0x00020001L, 0x08020001L, 0x00020009L, 0x08020009L, + 0x00020401L, 0x08020401L, 0x00020409L, 0x08020409L, + 0x02000000L, 0x0A000000L, 0x02000008L, 0x0A000008L, + 0x02000400L, 0x0A000400L, 0x02000408L, 0x0A000408L, + 0x02020000L, 0x0A020000L, 0x02020008L, 0x0A020008L, + 0x02020400L, 0x0A020400L, 0x02020408L, 0x0A020408L, + 0x02000001L, 0x0A000001L, 0x02000009L, 0x0A000009L, + 0x02000401L, 0x0A000401L, 0x02000409L, 0x0A000409L, + 0x02020001L, 0x0A020001L, 0x02020009L, 0x0A020009L, + 0x02020401L, 0x0A020401L, 0x02020409L, 0x0A020409L, + }, { + /* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */ + 0x00000000L, 0x00000100L, 0x00080000L, 0x00080100L, + 0x01000000L, 0x01000100L, 0x01080000L, 0x01080100L, + 0x00000010L, 0x00000110L, 0x00080010L, 0x00080110L, + 0x01000010L, 0x01000110L, 0x01080010L, 0x01080110L, + 0x00200000L, 0x00200100L, 0x00280000L, 0x00280100L, + 0x01200000L, 0x01200100L, 0x01280000L, 0x01280100L, + 0x00200010L, 0x00200110L, 0x00280010L, 0x00280110L, + 0x01200010L, 0x01200110L, 0x01280010L, 0x01280110L, + 0x00000200L, 0x00000300L, 0x00080200L, 0x00080300L, + 0x01000200L, 0x01000300L, 0x01080200L, 0x01080300L, + 0x00000210L, 0x00000310L, 0x00080210L, 0x00080310L, + 0x01000210L, 0x01000310L, 0x01080210L, 0x01080310L, + 0x00200200L, 0x00200300L, 0x00280200L, 0x00280300L, + 0x01200200L, 0x01200300L, 0x01280200L, 0x01280300L, + 0x00200210L, 0x00200310L, 0x00280210L, 0x00280310L, + 0x01200210L, 0x01200310L, 0x01280210L, 0x01280310L, + }, { + /* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */ + 0x00000000L, 0x04000000L, 0x00040000L, 0x04040000L, + 0x00000002L, 0x04000002L, 0x00040002L, 0x04040002L, + 0x00002000L, 0x04002000L, 0x00042000L, 0x04042000L, + 0x00002002L, 0x04002002L, 0x00042002L, 0x04042002L, + 0x00000020L, 0x04000020L, 0x00040020L, 0x04040020L, + 0x00000022L, 0x04000022L, 0x00040022L, 0x04040022L, + 0x00002020L, 0x04002020L, 0x00042020L, 0x04042020L, + 0x00002022L, 0x04002022L, 0x00042022L, 0x04042022L, + 0x00000800L, 0x04000800L, 0x00040800L, 0x04040800L, + 0x00000802L, 0x04000802L, 0x00040802L, 0x04040802L, + 0x00002800L, 0x04002800L, 0x00042800L, 0x04042800L, + 0x00002802L, 0x04002802L, 0x00042802L, 0x04042802L, + 0x00000820L, 0x04000820L, 0x00040820L, 0x04040820L, + 0x00000822L, 0x04000822L, 0x00040822L, 0x04040822L, + 0x00002820L, 0x04002820L, 0x00042820L, 0x04042820L, + 0x00002822L, 0x04002822L, 0x00042822L, 0x04042822L, + }, +}; -int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule) - { - if (DES_check_key) - { +int +DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule) +{ + if (DES_check_key) { return DES_set_key_checked(key, schedule); - } - else - { + } else { DES_set_key_unchecked(key, schedule); return 0; - } } +} /* return 0 if key parity is odd (correct), * return -1 if key parity error, * return -2 if illegal weak key. */ -int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule) - { +int +DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule) +{ if (!DES_check_key_parity(key)) - return(-1); + return (-1); if (DES_is_weak_key(key)) - return(-2); + return (-2); DES_set_key_unchecked(key, schedule); return 0; - } +} -void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule) - { - static const int shifts2[16]={0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0}; - DES_LONG c,d,t,s,t2; +void +DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule) +{ + static const int shifts2[16] = {0, 0,1, 1,1, 1,1, 1,0, 1,1, 1,1, 1,1, 0}; + DES_LONG c, d, t, s, t2; const unsigned char *in; DES_LONG *k; int i; @@ -342,55 +346,58 @@ void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule) k = &schedule->ks->deslong[0]; in = &(*key)[0]; - c2l(in,c); - c2l(in,d); + c2l(in, c); + c2l(in, d); /* do PC1 in 47 simple operations :-) * Thanks to John Fletcher (john_fletcher@lccmail.ocf.llnl.gov) * for the inspiration. :-) */ - PERM_OP (d,c,t,4,0x0f0f0f0fL); - HPERM_OP(c,t,-2,0xcccc0000L); - HPERM_OP(d,t,-2,0xcccc0000L); - PERM_OP (d,c,t,1,0x55555555L); - PERM_OP (c,d,t,8,0x00ff00ffL); - PERM_OP (d,c,t,1,0x55555555L); - d= (((d&0x000000ffL)<<16L)| (d&0x0000ff00L) | - ((d&0x00ff0000L)>>16L)|((c&0xf0000000L)>>4L)); - c&=0x0fffffffL; + PERM_OP(d, c, t, 4, 0x0f0f0f0fL); + HPERM_OP(c, t, -2, 0xcccc0000L); + HPERM_OP(d, t, -2, 0xcccc0000L); + PERM_OP(d, c, t, 1, 0x55555555L); + PERM_OP(c, d, t, 8, 0x00ff00ffL); + PERM_OP(d, c, t, 1, 0x55555555L); + d = (((d & 0x000000ffL) << 16L) | (d & 0x0000ff00L) | + ((d & 0x00ff0000L) >> 16L)|((c & 0xf0000000L) >> 4L)); + c &= 0x0fffffffL; - for (i=0; i>2L)|(c<<26L)); d=((d>>2L)|(d<<26L)); } - else - { c=((c>>1L)|(c<<27L)); d=((d>>1L)|(d<<27L)); } - c&=0x0fffffffL; - d&=0x0fffffffL; + for (i = 0; i < ITERATIONS; i++) { + if (shifts2[i]) { + c = ((c >> 2L)|(c << 26L)); + d = ((d >> 2L)|(d << 26L)); + } else { + c = ((c >> 1L)|(c << 27L)); + d = ((d >> 1L)|(d << 27L)); + } + c &= 0x0fffffffL; + d &= 0x0fffffffL; /* could be a few less shifts but I am to lazy at this * point in time to investigate */ - s= des_skb[0][ (c )&0x3f ]| - des_skb[1][((c>> 6L)&0x03)|((c>> 7L)&0x3c)]| - des_skb[2][((c>>13L)&0x0f)|((c>>14L)&0x30)]| - des_skb[3][((c>>20L)&0x01)|((c>>21L)&0x06) | - ((c>>22L)&0x38)]; - t= des_skb[4][ (d )&0x3f ]| - des_skb[5][((d>> 7L)&0x03)|((d>> 8L)&0x3c)]| - des_skb[6][ (d>>15L)&0x3f ]| - des_skb[7][((d>>21L)&0x0f)|((d>>22L)&0x30)]; + s = des_skb[0][(c)&0x3f]| + des_skb[1][((c >> 6L) & 0x03)|((c >> 7L) & 0x3c)]| + des_skb[2][((c >> 13L) & 0x0f)|((c >> 14L) & 0x30)]| + des_skb[3][((c >> 20L) & 0x01)|((c >> 21L) & 0x06) | + ((c >> 22L) & 0x38)]; + t = des_skb[4][(d)&0x3f]| + des_skb[5][((d >> 7L) & 0x03)|((d >> 8L) & 0x3c)]| + des_skb[6][(d >> 15L) & 0x3f]| + des_skb[7][((d >> 21L) & 0x0f)|((d >> 22L) & 0x30)]; /* table contained 0213 4657 */ - t2=((t<<16L)|(s&0x0000ffffL))&0xffffffffL; - *(k++)=ROTATE(t2,30)&0xffffffffL; + t2 = ((t << 16L)|(s & 0x0000ffffL)) & 0xffffffffL; + *(k++) = ROTATE(t2, 30) & 0xffffffffL; - t2=((s>>16L)|(t&0xffff0000L)); - *(k++)=ROTATE(t2,26)&0xffffffffL; - } + t2 = ((s >> 16L)|(t & 0xffff0000L)); + *(k++) = ROTATE(t2, 26) & 0xffffffffL; } +} -int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule) - { - return(DES_set_key(key,schedule)); - } +int +DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule) +{ + return (DES_set_key(key, schedule)); +} /* #undef des_fixup_key_parity void des_fixup_key_parity(des_cblock *key) diff --git a/lib/libcrypto/des/spr.h b/lib/libcrypto/des/spr.h index 5e717065f..e0f413e46 100644 --- a/lib/libcrypto/des/spr.h +++ b/lib/libcrypto/des/spr.h @@ -1,25 +1,25 @@ -/* $OpenBSD: spr.h,v 1.6 2016/12/21 15:49:29 jsing Exp $ */ +/* $OpenBSD: spr.h,v 1.8 2023/07/08 07:34:34 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -58,151 +58,152 @@ __BEGIN_HIDDEN_DECLS -const DES_LONG DES_SPtrans[8][64]={ -{ +const DES_LONG DES_SPtrans[8][64] = { + { /* nibble 0 */ -0x02080800L, 0x00080000L, 0x02000002L, 0x02080802L, -0x02000000L, 0x00080802L, 0x00080002L, 0x02000002L, -0x00080802L, 0x02080800L, 0x02080000L, 0x00000802L, -0x02000802L, 0x02000000L, 0x00000000L, 0x00080002L, -0x00080000L, 0x00000002L, 0x02000800L, 0x00080800L, -0x02080802L, 0x02080000L, 0x00000802L, 0x02000800L, -0x00000002L, 0x00000800L, 0x00080800L, 0x02080002L, -0x00000800L, 0x02000802L, 0x02080002L, 0x00000000L, -0x00000000L, 0x02080802L, 0x02000800L, 0x00080002L, -0x02080800L, 0x00080000L, 0x00000802L, 0x02000800L, -0x02080002L, 0x00000800L, 0x00080800L, 0x02000002L, -0x00080802L, 0x00000002L, 0x02000002L, 0x02080000L, -0x02080802L, 0x00080800L, 0x02080000L, 0x02000802L, -0x02000000L, 0x00000802L, 0x00080002L, 0x00000000L, -0x00080000L, 0x02000000L, 0x02000802L, 0x02080800L, -0x00000002L, 0x02080002L, 0x00000800L, 0x00080802L, -},{ + 0x02080800L, 0x00080000L, 0x02000002L, 0x02080802L, + 0x02000000L, 0x00080802L, 0x00080002L, 0x02000002L, + 0x00080802L, 0x02080800L, 0x02080000L, 0x00000802L, + 0x02000802L, 0x02000000L, 0x00000000L, 0x00080002L, + 0x00080000L, 0x00000002L, 0x02000800L, 0x00080800L, + 0x02080802L, 0x02080000L, 0x00000802L, 0x02000800L, + 0x00000002L, 0x00000800L, 0x00080800L, 0x02080002L, + 0x00000800L, 0x02000802L, 0x02080002L, 0x00000000L, + 0x00000000L, 0x02080802L, 0x02000800L, 0x00080002L, + 0x02080800L, 0x00080000L, 0x00000802L, 0x02000800L, + 0x02080002L, 0x00000800L, 0x00080800L, 0x02000002L, + 0x00080802L, 0x00000002L, 0x02000002L, 0x02080000L, + 0x02080802L, 0x00080800L, 0x02080000L, 0x02000802L, + 0x02000000L, 0x00000802L, 0x00080002L, 0x00000000L, + 0x00080000L, 0x02000000L, 0x02000802L, 0x02080800L, + 0x00000002L, 0x02080002L, 0x00000800L, 0x00080802L, + }, { /* nibble 1 */ -0x40108010L, 0x00000000L, 0x00108000L, 0x40100000L, -0x40000010L, 0x00008010L, 0x40008000L, 0x00108000L, -0x00008000L, 0x40100010L, 0x00000010L, 0x40008000L, -0x00100010L, 0x40108000L, 0x40100000L, 0x00000010L, -0x00100000L, 0x40008010L, 0x40100010L, 0x00008000L, -0x00108010L, 0x40000000L, 0x00000000L, 0x00100010L, -0x40008010L, 0x00108010L, 0x40108000L, 0x40000010L, -0x40000000L, 0x00100000L, 0x00008010L, 0x40108010L, -0x00100010L, 0x40108000L, 0x40008000L, 0x00108010L, -0x40108010L, 0x00100010L, 0x40000010L, 0x00000000L, -0x40000000L, 0x00008010L, 0x00100000L, 0x40100010L, -0x00008000L, 0x40000000L, 0x00108010L, 0x40008010L, -0x40108000L, 0x00008000L, 0x00000000L, 0x40000010L, -0x00000010L, 0x40108010L, 0x00108000L, 0x40100000L, -0x40100010L, 0x00100000L, 0x00008010L, 0x40008000L, -0x40008010L, 0x00000010L, 0x40100000L, 0x00108000L, -},{ + 0x40108010L, 0x00000000L, 0x00108000L, 0x40100000L, + 0x40000010L, 0x00008010L, 0x40008000L, 0x00108000L, + 0x00008000L, 0x40100010L, 0x00000010L, 0x40008000L, + 0x00100010L, 0x40108000L, 0x40100000L, 0x00000010L, + 0x00100000L, 0x40008010L, 0x40100010L, 0x00008000L, + 0x00108010L, 0x40000000L, 0x00000000L, 0x00100010L, + 0x40008010L, 0x00108010L, 0x40108000L, 0x40000010L, + 0x40000000L, 0x00100000L, 0x00008010L, 0x40108010L, + 0x00100010L, 0x40108000L, 0x40008000L, 0x00108010L, + 0x40108010L, 0x00100010L, 0x40000010L, 0x00000000L, + 0x40000000L, 0x00008010L, 0x00100000L, 0x40100010L, + 0x00008000L, 0x40000000L, 0x00108010L, 0x40008010L, + 0x40108000L, 0x00008000L, 0x00000000L, 0x40000010L, + 0x00000010L, 0x40108010L, 0x00108000L, 0x40100000L, + 0x40100010L, 0x00100000L, 0x00008010L, 0x40008000L, + 0x40008010L, 0x00000010L, 0x40100000L, 0x00108000L, + }, { /* nibble 2 */ -0x04000001L, 0x04040100L, 0x00000100L, 0x04000101L, -0x00040001L, 0x04000000L, 0x04000101L, 0x00040100L, -0x04000100L, 0x00040000L, 0x04040000L, 0x00000001L, -0x04040101L, 0x00000101L, 0x00000001L, 0x04040001L, -0x00000000L, 0x00040001L, 0x04040100L, 0x00000100L, -0x00000101L, 0x04040101L, 0x00040000L, 0x04000001L, -0x04040001L, 0x04000100L, 0x00040101L, 0x04040000L, -0x00040100L, 0x00000000L, 0x04000000L, 0x00040101L, -0x04040100L, 0x00000100L, 0x00000001L, 0x00040000L, -0x00000101L, 0x00040001L, 0x04040000L, 0x04000101L, -0x00000000L, 0x04040100L, 0x00040100L, 0x04040001L, -0x00040001L, 0x04000000L, 0x04040101L, 0x00000001L, -0x00040101L, 0x04000001L, 0x04000000L, 0x04040101L, -0x00040000L, 0x04000100L, 0x04000101L, 0x00040100L, -0x04000100L, 0x00000000L, 0x04040001L, 0x00000101L, -0x04000001L, 0x00040101L, 0x00000100L, 0x04040000L, -},{ + 0x04000001L, 0x04040100L, 0x00000100L, 0x04000101L, + 0x00040001L, 0x04000000L, 0x04000101L, 0x00040100L, + 0x04000100L, 0x00040000L, 0x04040000L, 0x00000001L, + 0x04040101L, 0x00000101L, 0x00000001L, 0x04040001L, + 0x00000000L, 0x00040001L, 0x04040100L, 0x00000100L, + 0x00000101L, 0x04040101L, 0x00040000L, 0x04000001L, + 0x04040001L, 0x04000100L, 0x00040101L, 0x04040000L, + 0x00040100L, 0x00000000L, 0x04000000L, 0x00040101L, + 0x04040100L, 0x00000100L, 0x00000001L, 0x00040000L, + 0x00000101L, 0x00040001L, 0x04040000L, 0x04000101L, + 0x00000000L, 0x04040100L, 0x00040100L, 0x04040001L, + 0x00040001L, 0x04000000L, 0x04040101L, 0x00000001L, + 0x00040101L, 0x04000001L, 0x04000000L, 0x04040101L, + 0x00040000L, 0x04000100L, 0x04000101L, 0x00040100L, + 0x04000100L, 0x00000000L, 0x04040001L, 0x00000101L, + 0x04000001L, 0x00040101L, 0x00000100L, 0x04040000L, + }, { /* nibble 3 */ -0x00401008L, 0x10001000L, 0x00000008L, 0x10401008L, -0x00000000L, 0x10400000L, 0x10001008L, 0x00400008L, -0x10401000L, 0x10000008L, 0x10000000L, 0x00001008L, -0x10000008L, 0x00401008L, 0x00400000L, 0x10000000L, -0x10400008L, 0x00401000L, 0x00001000L, 0x00000008L, -0x00401000L, 0x10001008L, 0x10400000L, 0x00001000L, -0x00001008L, 0x00000000L, 0x00400008L, 0x10401000L, -0x10001000L, 0x10400008L, 0x10401008L, 0x00400000L, -0x10400008L, 0x00001008L, 0x00400000L, 0x10000008L, -0x00401000L, 0x10001000L, 0x00000008L, 0x10400000L, -0x10001008L, 0x00000000L, 0x00001000L, 0x00400008L, -0x00000000L, 0x10400008L, 0x10401000L, 0x00001000L, -0x10000000L, 0x10401008L, 0x00401008L, 0x00400000L, -0x10401008L, 0x00000008L, 0x10001000L, 0x00401008L, -0x00400008L, 0x00401000L, 0x10400000L, 0x10001008L, -0x00001008L, 0x10000000L, 0x10000008L, 0x10401000L, -},{ + 0x00401008L, 0x10001000L, 0x00000008L, 0x10401008L, + 0x00000000L, 0x10400000L, 0x10001008L, 0x00400008L, + 0x10401000L, 0x10000008L, 0x10000000L, 0x00001008L, + 0x10000008L, 0x00401008L, 0x00400000L, 0x10000000L, + 0x10400008L, 0x00401000L, 0x00001000L, 0x00000008L, + 0x00401000L, 0x10001008L, 0x10400000L, 0x00001000L, + 0x00001008L, 0x00000000L, 0x00400008L, 0x10401000L, + 0x10001000L, 0x10400008L, 0x10401008L, 0x00400000L, + 0x10400008L, 0x00001008L, 0x00400000L, 0x10000008L, + 0x00401000L, 0x10001000L, 0x00000008L, 0x10400000L, + 0x10001008L, 0x00000000L, 0x00001000L, 0x00400008L, + 0x00000000L, 0x10400008L, 0x10401000L, 0x00001000L, + 0x10000000L, 0x10401008L, 0x00401008L, 0x00400000L, + 0x10401008L, 0x00000008L, 0x10001000L, 0x00401008L, + 0x00400008L, 0x00401000L, 0x10400000L, 0x10001008L, + 0x00001008L, 0x10000000L, 0x10000008L, 0x10401000L, + }, { /* nibble 4 */ -0x08000000L, 0x00010000L, 0x00000400L, 0x08010420L, -0x08010020L, 0x08000400L, 0x00010420L, 0x08010000L, -0x00010000L, 0x00000020L, 0x08000020L, 0x00010400L, -0x08000420L, 0x08010020L, 0x08010400L, 0x00000000L, -0x00010400L, 0x08000000L, 0x00010020L, 0x00000420L, -0x08000400L, 0x00010420L, 0x00000000L, 0x08000020L, -0x00000020L, 0x08000420L, 0x08010420L, 0x00010020L, -0x08010000L, 0x00000400L, 0x00000420L, 0x08010400L, -0x08010400L, 0x08000420L, 0x00010020L, 0x08010000L, -0x00010000L, 0x00000020L, 0x08000020L, 0x08000400L, -0x08000000L, 0x00010400L, 0x08010420L, 0x00000000L, -0x00010420L, 0x08000000L, 0x00000400L, 0x00010020L, -0x08000420L, 0x00000400L, 0x00000000L, 0x08010420L, -0x08010020L, 0x08010400L, 0x00000420L, 0x00010000L, -0x00010400L, 0x08010020L, 0x08000400L, 0x00000420L, -0x00000020L, 0x00010420L, 0x08010000L, 0x08000020L, -},{ + 0x08000000L, 0x00010000L, 0x00000400L, 0x08010420L, + 0x08010020L, 0x08000400L, 0x00010420L, 0x08010000L, + 0x00010000L, 0x00000020L, 0x08000020L, 0x00010400L, + 0x08000420L, 0x08010020L, 0x08010400L, 0x00000000L, + 0x00010400L, 0x08000000L, 0x00010020L, 0x00000420L, + 0x08000400L, 0x00010420L, 0x00000000L, 0x08000020L, + 0x00000020L, 0x08000420L, 0x08010420L, 0x00010020L, + 0x08010000L, 0x00000400L, 0x00000420L, 0x08010400L, + 0x08010400L, 0x08000420L, 0x00010020L, 0x08010000L, + 0x00010000L, 0x00000020L, 0x08000020L, 0x08000400L, + 0x08000000L, 0x00010400L, 0x08010420L, 0x00000000L, + 0x00010420L, 0x08000000L, 0x00000400L, 0x00010020L, + 0x08000420L, 0x00000400L, 0x00000000L, 0x08010420L, + 0x08010020L, 0x08010400L, 0x00000420L, 0x00010000L, + 0x00010400L, 0x08010020L, 0x08000400L, 0x00000420L, + 0x00000020L, 0x00010420L, 0x08010000L, 0x08000020L, + }, { /* nibble 5 */ -0x80000040L, 0x00200040L, 0x00000000L, 0x80202000L, -0x00200040L, 0x00002000L, 0x80002040L, 0x00200000L, -0x00002040L, 0x80202040L, 0x00202000L, 0x80000000L, -0x80002000L, 0x80000040L, 0x80200000L, 0x00202040L, -0x00200000L, 0x80002040L, 0x80200040L, 0x00000000L, -0x00002000L, 0x00000040L, 0x80202000L, 0x80200040L, -0x80202040L, 0x80200000L, 0x80000000L, 0x00002040L, -0x00000040L, 0x00202000L, 0x00202040L, 0x80002000L, -0x00002040L, 0x80000000L, 0x80002000L, 0x00202040L, -0x80202000L, 0x00200040L, 0x00000000L, 0x80002000L, -0x80000000L, 0x00002000L, 0x80200040L, 0x00200000L, -0x00200040L, 0x80202040L, 0x00202000L, 0x00000040L, -0x80202040L, 0x00202000L, 0x00200000L, 0x80002040L, -0x80000040L, 0x80200000L, 0x00202040L, 0x00000000L, -0x00002000L, 0x80000040L, 0x80002040L, 0x80202000L, -0x80200000L, 0x00002040L, 0x00000040L, 0x80200040L, -},{ + 0x80000040L, 0x00200040L, 0x00000000L, 0x80202000L, + 0x00200040L, 0x00002000L, 0x80002040L, 0x00200000L, + 0x00002040L, 0x80202040L, 0x00202000L, 0x80000000L, + 0x80002000L, 0x80000040L, 0x80200000L, 0x00202040L, + 0x00200000L, 0x80002040L, 0x80200040L, 0x00000000L, + 0x00002000L, 0x00000040L, 0x80202000L, 0x80200040L, + 0x80202040L, 0x80200000L, 0x80000000L, 0x00002040L, + 0x00000040L, 0x00202000L, 0x00202040L, 0x80002000L, + 0x00002040L, 0x80000000L, 0x80002000L, 0x00202040L, + 0x80202000L, 0x00200040L, 0x00000000L, 0x80002000L, + 0x80000000L, 0x00002000L, 0x80200040L, 0x00200000L, + 0x00200040L, 0x80202040L, 0x00202000L, 0x00000040L, + 0x80202040L, 0x00202000L, 0x00200000L, 0x80002040L, + 0x80000040L, 0x80200000L, 0x00202040L, 0x00000000L, + 0x00002000L, 0x80000040L, 0x80002040L, 0x80202000L, + 0x80200000L, 0x00002040L, 0x00000040L, 0x80200040L, + }, { /* nibble 6 */ -0x00004000L, 0x00000200L, 0x01000200L, 0x01000004L, -0x01004204L, 0x00004004L, 0x00004200L, 0x00000000L, -0x01000000L, 0x01000204L, 0x00000204L, 0x01004000L, -0x00000004L, 0x01004200L, 0x01004000L, 0x00000204L, -0x01000204L, 0x00004000L, 0x00004004L, 0x01004204L, -0x00000000L, 0x01000200L, 0x01000004L, 0x00004200L, -0x01004004L, 0x00004204L, 0x01004200L, 0x00000004L, -0x00004204L, 0x01004004L, 0x00000200L, 0x01000000L, -0x00004204L, 0x01004000L, 0x01004004L, 0x00000204L, -0x00004000L, 0x00000200L, 0x01000000L, 0x01004004L, -0x01000204L, 0x00004204L, 0x00004200L, 0x00000000L, -0x00000200L, 0x01000004L, 0x00000004L, 0x01000200L, -0x00000000L, 0x01000204L, 0x01000200L, 0x00004200L, -0x00000204L, 0x00004000L, 0x01004204L, 0x01000000L, -0x01004200L, 0x00000004L, 0x00004004L, 0x01004204L, -0x01000004L, 0x01004200L, 0x01004000L, 0x00004004L, -},{ + 0x00004000L, 0x00000200L, 0x01000200L, 0x01000004L, + 0x01004204L, 0x00004004L, 0x00004200L, 0x00000000L, + 0x01000000L, 0x01000204L, 0x00000204L, 0x01004000L, + 0x00000004L, 0x01004200L, 0x01004000L, 0x00000204L, + 0x01000204L, 0x00004000L, 0x00004004L, 0x01004204L, + 0x00000000L, 0x01000200L, 0x01000004L, 0x00004200L, + 0x01004004L, 0x00004204L, 0x01004200L, 0x00000004L, + 0x00004204L, 0x01004004L, 0x00000200L, 0x01000000L, + 0x00004204L, 0x01004000L, 0x01004004L, 0x00000204L, + 0x00004000L, 0x00000200L, 0x01000000L, 0x01004004L, + 0x01000204L, 0x00004204L, 0x00004200L, 0x00000000L, + 0x00000200L, 0x01000004L, 0x00000004L, 0x01000200L, + 0x00000000L, 0x01000204L, 0x01000200L, 0x00004200L, + 0x00000204L, 0x00004000L, 0x01004204L, 0x01000000L, + 0x01004200L, 0x00000004L, 0x00004004L, 0x01004204L, + 0x01000004L, 0x01004200L, 0x01004000L, 0x00004004L, + }, { /* nibble 7 */ -0x20800080L, 0x20820000L, 0x00020080L, 0x00000000L, -0x20020000L, 0x00800080L, 0x20800000L, 0x20820080L, -0x00000080L, 0x20000000L, 0x00820000L, 0x00020080L, -0x00820080L, 0x20020080L, 0x20000080L, 0x20800000L, -0x00020000L, 0x00820080L, 0x00800080L, 0x20020000L, -0x20820080L, 0x20000080L, 0x00000000L, 0x00820000L, -0x20000000L, 0x00800000L, 0x20020080L, 0x20800080L, -0x00800000L, 0x00020000L, 0x20820000L, 0x00000080L, -0x00800000L, 0x00020000L, 0x20000080L, 0x20820080L, -0x00020080L, 0x20000000L, 0x00000000L, 0x00820000L, -0x20800080L, 0x20020080L, 0x20020000L, 0x00800080L, -0x20820000L, 0x00000080L, 0x00800080L, 0x20020000L, -0x20820080L, 0x00800000L, 0x20800000L, 0x20000080L, -0x00820000L, 0x00020080L, 0x20020080L, 0x20800000L, -0x00000080L, 0x20820000L, 0x00820080L, 0x00000000L, -0x20000000L, 0x20800080L, 0x00020000L, 0x00820080L, -}}; + 0x20800080L, 0x20820000L, 0x00020080L, 0x00000000L, + 0x20020000L, 0x00800080L, 0x20800000L, 0x20820080L, + 0x00000080L, 0x20000000L, 0x00820000L, 0x00020080L, + 0x00820080L, 0x20020080L, 0x20000080L, 0x20800000L, + 0x00020000L, 0x00820080L, 0x00800080L, 0x20020000L, + 0x20820080L, 0x20000080L, 0x00000000L, 0x00820000L, + 0x20000000L, 0x00800000L, 0x20020080L, 0x20800080L, + 0x00800000L, 0x00020000L, 0x20820000L, 0x00000080L, + 0x00800000L, 0x00020000L, 0x20000080L, 0x20820080L, + 0x00020080L, 0x20000000L, 0x00000000L, 0x00820000L, + 0x20800080L, 0x20020080L, 0x20020000L, 0x00800080L, + 0x20820000L, 0x00000080L, 0x00800080L, 0x20020000L, + 0x20820080L, 0x00800000L, 0x20800000L, 0x20000080L, + 0x00820000L, 0x00020080L, 0x20020080L, 0x20800000L, + 0x00000080L, 0x20820000L, 0x00820080L, 0x00000000L, + 0x20000000L, 0x20800080L, 0x00020000L, 0x00820080L, + }, +}; __END_HIDDEN_DECLS diff --git a/lib/libcrypto/des/str2key.c b/lib/libcrypto/des/str2key.c index 316e80392..dd17a441b 100644 --- a/lib/libcrypto/des/str2key.c +++ b/lib/libcrypto/des/str2key.c @@ -1,25 +1,25 @@ -/* $OpenBSD: str2key.c,v 1.11 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: str2key.c,v 1.13 2023/07/08 07:34:34 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -59,116 +59,108 @@ #include #include "des_local.h" -void DES_string_to_key(const char *str, DES_cblock *key) - { +void +DES_string_to_key(const char *str, DES_cblock *key) +{ DES_key_schedule ks; - int i,length; + int i, length; unsigned char j; - memset(key,0,8); - length=strlen(str); + memset(key, 0, 8); + length = strlen(str); #ifdef OLD_STR_TO_KEY - for (i=0; i>4)&0x0f); - j=((j<<2)&0xcc)|((j>>2)&0x33); - j=((j<<1)&0xaa)|((j>>1)&0x55); - (*key)[7-(i%8)]^=j; - } + j = ((j << 4) & 0xf0)|((j >> 4) & 0x0f); + j = ((j << 2) & 0xcc)|((j >> 2) & 0x33); + j = ((j << 1) & 0xaa)|((j >> 1) & 0x55); + (*key)[7 - (i % 8)] ^= j; } + } #endif DES_set_odd_parity(key); #ifdef EXPERIMENTAL_STR_TO_STRONG_KEY - if(DES_is_weak_key(key)) - (*key)[7] ^= 0xF0; - DES_set_key(key,&ks); + if (DES_is_weak_key(key)) + (*key)[7] ^= 0xF0; + DES_set_key(key, &ks); #else - DES_set_key_unchecked(key,&ks); + DES_set_key_unchecked(key, &ks); #endif - DES_cbc_cksum((const unsigned char*)str,key,length,&ks,key); - explicit_bzero(&ks,sizeof(ks)); + DES_cbc_cksum((const unsigned char *)str, key, length, &ks, key); + explicit_bzero(&ks, sizeof(ks)); DES_set_odd_parity(key); - } +} -void DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2) - { +void +DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2) +{ DES_key_schedule ks; - int i,length; + int i, length; unsigned char j; - memset(key1,0,8); - memset(key2,0,8); - length=strlen(str); + memset(key1, 0, 8); + memset(key2, 0, 8); + length = strlen(str); #ifdef OLD_STR_TO_KEY - if (length <= 8) - { - for (i=0; i>4)&0x0f); - j=((j<<2)&0xcc)|((j>>2)&0x33); - j=((j<<1)&0xaa)|((j>>1)&0x55); - if ((i%16) < 8) - (*key1)[7-(i%8)]^=j; - else - (*key2)[7-(i%8)]^=j; - } - } - if (length <= 8) memcpy(key2,key1,8); -#endif - DES_set_odd_parity(key1); - DES_set_odd_parity(key2); -#ifdef EXPERIMENTAL_STR_TO_STRONG_KEY - if(DES_is_weak_key(key1)) - (*key1)[7] ^= 0xF0; - DES_set_key(key1,&ks); -#else - DES_set_key_unchecked(key1,&ks); -#endif - DES_cbc_cksum((const unsigned char*)str,key1,length,&ks,key1); -#ifdef EXPERIMENTAL_STR_TO_STRONG_KEY - if(DES_is_weak_key(key2)) - (*key2)[7] ^= 0xF0; - DES_set_key(key2,&ks); -#else - DES_set_key_unchecked(key2,&ks); -#endif - DES_cbc_cksum((const unsigned char*)str,key2,length,&ks,key2); - explicit_bzero(&ks,sizeof(ks)); - DES_set_odd_parity(key1); - DES_set_odd_parity(key2); } +#else /* MIT COMPATIBLE */ + for (i = 0; i < length; i++) { + j = str[i]; + if ((i % 32) < 16) { + if ((i % 16) < 8) + (*key1)[i % 8] ^= (j << 1); + else + (*key2)[i % 8] ^= (j << 1); + } else { + j = ((j << 4) & 0xf0)|((j >> 4) & 0x0f); + j = ((j << 2) & 0xcc)|((j >> 2) & 0x33); + j = ((j << 1) & 0xaa)|((j >> 1) & 0x55); + if ((i % 16) < 8) + (*key1)[7 - (i % 8)] ^= j; + else + (*key2)[7 - (i % 8)] ^= j; + } + } + if (length <= 8) + memcpy(key2, key1, 8); +#endif + DES_set_odd_parity(key1); + DES_set_odd_parity(key2); +#ifdef EXPERIMENTAL_STR_TO_STRONG_KEY + if (DES_is_weak_key(key1)) + (*key1)[7] ^= 0xF0; + DES_set_key(key1, &ks); +#else + DES_set_key_unchecked(key1, &ks); +#endif + DES_cbc_cksum((const unsigned char *)str, key1, length, &ks, key1); +#ifdef EXPERIMENTAL_STR_TO_STRONG_KEY + if (DES_is_weak_key(key2)) + (*key2)[7] ^= 0xF0; + DES_set_key(key2, &ks); +#else + DES_set_key_unchecked(key2, &ks); +#endif + DES_cbc_cksum((const unsigned char *)str, key2, length, &ks, key2); + explicit_bzero(&ks, sizeof(ks)); + DES_set_odd_parity(key1); + DES_set_odd_parity(key2); +} diff --git a/lib/libcrypto/des/xcbc_enc.c b/lib/libcrypto/des/xcbc_enc.c index 0152f3eff..87f348a9a 100644 --- a/lib/libcrypto/des/xcbc_enc.c +++ b/lib/libcrypto/des/xcbc_enc.c @@ -1,25 +1,25 @@ -/* $OpenBSD: xcbc_enc.c,v 1.10 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: xcbc_enc.c,v 1.12 2023/07/08 07:34:34 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -60,89 +60,94 @@ /* RSA's DESX */ -void DES_xcbc_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, const_DES_cblock *inw, - const_DES_cblock *outw, int enc) - { - DES_LONG tin0,tin1; - DES_LONG tout0,tout1,xor0,xor1; - DES_LONG inW0,inW1,outW0,outW1; +void +DES_xcbc_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, const_DES_cblock *inw, + const_DES_cblock *outw, int enc) +{ + DES_LONG tin0, tin1; + DES_LONG tout0, tout1, xor0, xor1; + DES_LONG inW0, inW1, outW0, outW1; const unsigned char *in2; - long l=length; + long l = length; DES_LONG tin[2]; unsigned char *iv; in2 = &(*inw)[0]; - c2l(in2,inW0); - c2l(in2,inW1); + c2l(in2, inW0); + c2l(in2, inW1); in2 = &(*outw)[0]; - c2l(in2,outW0); - c2l(in2,outW1); + c2l(in2, outW0); + c2l(in2, outW1); iv = &(*ivec)[0]; - if (enc) - { - c2l(iv,tout0); - c2l(iv,tout1); - for (l-=8; l>=0; l-=8) - { - c2l(in,tin0); - c2l(in,tin1); - tin0^=tout0^inW0; tin[0]=tin0; - tin1^=tout1^inW1; tin[1]=tin1; - DES_encrypt1(tin,schedule,DES_ENCRYPT); - tout0=tin[0]^outW0; l2c(tout0,out); - tout1=tin[1]^outW1; l2c(tout1,out); - } - if (l != -8) - { - c2ln(in,tin0,tin1,l+8); - tin0^=tout0^inW0; tin[0]=tin0; - tin1^=tout1^inW1; tin[1]=tin1; - DES_encrypt1(tin,schedule,DES_ENCRYPT); - tout0=tin[0]^outW0; l2c(tout0,out); - tout1=tin[1]^outW1; l2c(tout1,out); - } - iv = &(*ivec)[0]; - l2c(tout0,iv); - l2c(tout1,iv); + if (enc) { + c2l(iv, tout0); + c2l(iv, tout1); + for (l -= 8; l >= 0; l -= 8) { + c2l(in, tin0); + c2l(in, tin1); + tin0 ^= tout0 ^ inW0; + tin[0] = tin0; + tin1 ^= tout1 ^ inW1; + tin[1] = tin1; + DES_encrypt1(tin, schedule, DES_ENCRYPT); + tout0 = tin[0] ^ outW0; + l2c(tout0, out); + tout1 = tin[1] ^ outW1; + l2c(tout1, out); + } + if (l != -8) { + c2ln(in, tin0, tin1, l + 8); + tin0 ^= tout0 ^ inW0; + tin[0] = tin0; + tin1 ^= tout1 ^ inW1; + tin[1] = tin1; + DES_encrypt1(tin, schedule, DES_ENCRYPT); + tout0 = tin[0] ^ outW0; + l2c(tout0, out); + tout1 = tin[1] ^ outW1; + l2c(tout1, out); + } + iv = &(*ivec)[0]; + l2c(tout0, iv); + l2c(tout1, iv); + } else { + c2l(iv, xor0); + c2l(iv, xor1); + for (l -= 8; l > 0; l -= 8) { + c2l(in, tin0); + tin[0] = tin0 ^ outW0; + c2l(in, tin1); + tin[1] = tin1 ^ outW1; + DES_encrypt1(tin, schedule, DES_DECRYPT); + tout0 = tin[0] ^ xor0 ^ inW0; + tout1 = tin[1] ^ xor1 ^ inW1; + l2c(tout0, out); + l2c(tout1, out); + xor0 = tin0; + xor1 = tin1; + } + if (l != -8) { + c2l(in, tin0); + tin[0] = tin0 ^ outW0; + c2l(in, tin1); + tin[1] = tin1 ^ outW1; + DES_encrypt1(tin, schedule, DES_DECRYPT); + tout0 = tin[0] ^ xor0 ^ inW0; + tout1 = tin[1] ^ xor1 ^ inW1; + l2cn(tout0, tout1, out, l + 8); + xor0 = tin0; + xor1 = tin1; } - else - { - c2l(iv,xor0); - c2l(iv,xor1); - for (l-=8; l>0; l-=8) - { - c2l(in,tin0); tin[0]=tin0^outW0; - c2l(in,tin1); tin[1]=tin1^outW1; - DES_encrypt1(tin,schedule,DES_DECRYPT); - tout0=tin[0]^xor0^inW0; - tout1=tin[1]^xor1^inW1; - l2c(tout0,out); - l2c(tout1,out); - xor0=tin0; - xor1=tin1; - } - if (l != -8) - { - c2l(in,tin0); tin[0]=tin0^outW0; - c2l(in,tin1); tin[1]=tin1^outW1; - DES_encrypt1(tin,schedule,DES_DECRYPT); - tout0=tin[0]^xor0^inW0; - tout1=tin[1]^xor1^inW1; - l2cn(tout0,tout1,out,l+8); - xor0=tin0; - xor1=tin1; - } iv = &(*ivec)[0]; - l2c(xor0,iv); - l2c(xor1,iv); - } - tin0=tin1=tout0=tout1=xor0=xor1=0; - inW0=inW1=outW0=outW1=0; - tin[0]=tin[1]=0; + l2c(xor0, iv); + l2c(xor1, iv); } - + tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0; + inW0 = inW1 = outW0 = outW1 = 0; + tin[0] = tin[1] = 0; +} diff --git a/lib/libcrypto/dh/dh_ameth.c b/lib/libcrypto/dh/dh_ameth.c index 3de0bb933..cc594cfd3 100644 --- a/lib/libcrypto/dh/dh_ameth.c +++ b/lib/libcrypto/dh/dh_ameth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dh_ameth.c,v 1.28 2023/04/17 05:57:17 tb Exp $ */ +/* $OpenBSD: dh_ameth.c,v 1.30 2023/07/08 15:29:03 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -65,6 +65,7 @@ #include #include "asn1_local.h" +#include "bn_local.h" #include "dh_local.h" #include "evp_local.h" @@ -280,17 +281,6 @@ err: return 0; } -static void -update_buflen(const BIGNUM *b, size_t *pbuflen) -{ - size_t i; - - if (!b) - return; - if (*pbuflen < (i = (size_t)BN_num_bytes(b))) - *pbuflen = i; -} - static int dh_param_decode(EVP_PKEY *pkey, const unsigned char **pder, int derlen) { @@ -313,9 +303,7 @@ dh_param_encode(const EVP_PKEY *pkey, unsigned char **pder) static int do_dh_print(BIO *bp, const DH *x, int indent, ASN1_PCTX *ctx, int ptype) { - unsigned char *m = NULL; int reason = ERR_R_BUF_LIB, ret = 0; - size_t buf_len = 0; const char *ktype = NULL; BIGNUM *priv_key, *pub_key; @@ -329,17 +317,6 @@ do_dh_print(BIO *bp, const DH *x, int indent, ASN1_PCTX *ctx, int ptype) else pub_key = NULL; - update_buflen(x->p, &buf_len); - - if (buf_len == 0) { - reason = ERR_R_PASSED_NULL_PARAMETER; - goto err; - } - - update_buflen(x->g, &buf_len); - update_buflen(pub_key, &buf_len); - update_buflen(priv_key, &buf_len); - if (ptype == 2) ktype = "PKCS#3 DH Private-Key"; else if (ptype == 1) @@ -347,9 +324,8 @@ do_dh_print(BIO *bp, const DH *x, int indent, ASN1_PCTX *ctx, int ptype) else ktype = "PKCS#3 DH Parameters"; - m= malloc(buf_len + 10); - if (m == NULL) { - reason = ERR_R_MALLOC_FAILURE; + if (x->p == NULL) { + reason = ERR_R_PASSED_NULL_PARAMETER; goto err; } @@ -359,14 +335,14 @@ do_dh_print(BIO *bp, const DH *x, int indent, ASN1_PCTX *ctx, int ptype) goto err; indent += 4; - if (!ASN1_bn_print(bp, "private-key:", priv_key, m, indent)) + if (!bn_printf(bp, priv_key, indent, "private-key:")) goto err; - if (!ASN1_bn_print(bp, "public-key:", pub_key, m, indent)) + if (!bn_printf(bp, pub_key, indent, "public-key:")) goto err; - if (!ASN1_bn_print(bp, "prime:", x->p, m, indent)) + if (!bn_printf(bp, x->p, indent, "prime:")) goto err; - if (!ASN1_bn_print(bp, "generator:", x->g, m, indent)) + if (!bn_printf(bp, x->g, indent, "generator:")) goto err; if (x->length != 0) { if (!BIO_indent(bp, indent, 128)) @@ -378,10 +354,9 @@ do_dh_print(BIO *bp, const DH *x, int indent, ASN1_PCTX *ctx, int ptype) ret = 1; if (0) { -err: + err: DHerror(reason); } - free(m); return(ret); } @@ -473,6 +448,7 @@ DHparams_print(BIO *bp, const DH *x) { return do_dh_print(bp, x, 4, NULL, 0); } +LCRYPTO_ALIAS(DHparams_print); int DHparams_print_fp(FILE *fp, const DH *x) @@ -491,6 +467,7 @@ DHparams_print_fp(FILE *fp, const DH *x) return ret; } +LCRYPTO_ALIAS(DHparams_print_fp); static int dh_pkey_public_check(const EVP_PKEY *pkey) diff --git a/lib/libcrypto/dh/dh_asn1.c b/lib/libcrypto/dh/dh_asn1.c index 10184f0b2..2e0b054d3 100644 --- a/lib/libcrypto/dh/dh_asn1.c +++ b/lib/libcrypto/dh/dh_asn1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dh_asn1.c,v 1.11 2022/01/07 09:27:13 tb Exp $ */ +/* $OpenBSD: dh_asn1.c,v 1.12 2023/07/08 15:29:03 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -131,39 +131,46 @@ d2i_DHparams(DH **a, const unsigned char **in, long len) return (DH *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &DHparams_it); } +LCRYPTO_ALIAS(d2i_DHparams); int i2d_DHparams(const DH *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &DHparams_it); } +LCRYPTO_ALIAS(i2d_DHparams); DH * d2i_DHparams_bio(BIO *bp, DH **a) { return ASN1_item_d2i_bio(&DHparams_it, bp, a); } +LCRYPTO_ALIAS(d2i_DHparams_bio); int i2d_DHparams_bio(BIO *bp, DH *a) { return ASN1_item_i2d_bio(&DHparams_it, bp, a); } +LCRYPTO_ALIAS(i2d_DHparams_bio); DH * d2i_DHparams_fp(FILE *fp, DH **a) { return ASN1_item_d2i_fp(&DHparams_it, fp, a); } +LCRYPTO_ALIAS(d2i_DHparams_fp); int i2d_DHparams_fp(FILE *fp, DH *a) { return ASN1_item_i2d_fp(&DHparams_it, fp, a); } +LCRYPTO_ALIAS(i2d_DHparams_fp); DH * DHparams_dup(DH *dh) { return ASN1_item_dup(&DHparams_it, dh); } +LCRYPTO_ALIAS(DHparams_dup); diff --git a/lib/libcrypto/dh/dh_check.c b/lib/libcrypto/dh/dh_check.c index 9bbbd55b3..f3d89f620 100644 --- a/lib/libcrypto/dh/dh_check.c +++ b/lib/libcrypto/dh/dh_check.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dh_check.c,v 1.26 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: dh_check.c,v 1.27 2023/07/08 15:29:03 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -227,6 +227,7 @@ DH_check(const DH *dh, int *flags) BN_CTX_free(ctx); return ok; } +LCRYPTO_ALIAS(DH_check); int DH_check_pub_key_ex(const DH *dh, const BIGNUM *pub_key) @@ -299,3 +300,4 @@ DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *flags) return ok; } +LCRYPTO_ALIAS(DH_check_pub_key); diff --git a/lib/libcrypto/dh/dh_err.c b/lib/libcrypto/dh/dh_err.c index db66d68e3..f5dda2898 100644 --- a/lib/libcrypto/dh/dh_err.c +++ b/lib/libcrypto/dh/dh_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dh_err.c,v 1.18 2022/07/12 14:42:49 kn Exp $ */ +/* $OpenBSD: dh_err.c,v 1.19 2023/07/08 15:29:03 beck Exp $ */ /* ==================================================================== * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * @@ -111,3 +111,4 @@ void ERR_load_DH_strings(void) } #endif } +LCRYPTO_ALIAS(ERR_load_DH_strings); diff --git a/lib/libcrypto/dh/dh_gen.c b/lib/libcrypto/dh/dh_gen.c index d51d10d2a..3ffa5d80f 100644 --- a/lib/libcrypto/dh/dh_gen.c +++ b/lib/libcrypto/dh/dh_gen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dh_gen.c,v 1.20 2023/04/13 15:18:29 tb Exp $ */ +/* $OpenBSD: dh_gen.c,v 1.21 2023/07/08 15:29:03 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -75,6 +75,7 @@ DH_generate_parameters_ex(DH *ret, int prime_len, int generator, BN_GENCB *cb) return ret->meth->generate_params(ret, prime_len, generator, cb); return dh_builtin_genparams(ret, prime_len, generator, cb); } +LCRYPTO_ALIAS(DH_generate_parameters_ex); /* * We generate DH parameters as follows: @@ -193,3 +194,4 @@ DH_generate_parameters(int prime_len, int generator, DH_free(ret); return NULL; } +LCRYPTO_ALIAS(DH_generate_parameters); diff --git a/lib/libcrypto/dh/dh_key.c b/lib/libcrypto/dh/dh_key.c index 89ae5f0fd..a4bd68948 100644 --- a/lib/libcrypto/dh/dh_key.c +++ b/lib/libcrypto/dh/dh_key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dh_key.c,v 1.38 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: dh_key.c,v 1.39 2023/07/08 15:29:03 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -77,12 +77,14 @@ DH_generate_key(DH *dh) { return dh->meth->generate_key(dh); } +LCRYPTO_ALIAS(DH_generate_key); int DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh) { return dh->meth->compute_key(key, pub_key, dh); } +LCRYPTO_ALIAS(DH_compute_key); static DH_METHOD dh_ossl = { .name = "OpenSSL DH Method", @@ -98,6 +100,7 @@ DH_OpenSSL(void) { return &dh_ossl; } +LCRYPTO_ALIAS(DH_OpenSSL); static int generate_key(DH *dh) diff --git a/lib/libcrypto/dh/dh_lib.c b/lib/libcrypto/dh/dh_lib.c index e5cb46485..987f0b1f7 100644 --- a/lib/libcrypto/dh/dh_lib.c +++ b/lib/libcrypto/dh/dh_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dh_lib.c,v 1.38 2023/03/07 09:27:10 jsing Exp $ */ +/* $OpenBSD: dh_lib.c,v 1.39 2023/07/08 15:29:03 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -78,6 +78,7 @@ DH_set_default_method(const DH_METHOD *meth) { default_DH_method = meth; } +LCRYPTO_ALIAS(DH_set_default_method); const DH_METHOD * DH_get_default_method(void) @@ -86,6 +87,7 @@ DH_get_default_method(void) default_DH_method = DH_OpenSSL(); return default_DH_method; } +LCRYPTO_ALIAS(DH_get_default_method); int DH_set_method(DH *dh, const DH_METHOD *meth) @@ -108,12 +110,14 @@ DH_set_method(DH *dh, const DH_METHOD *meth) meth->init(dh); return 1; } +LCRYPTO_ALIAS(DH_set_method); DH * DH_new(void) { return DH_new_method(NULL); } +LCRYPTO_ALIAS(DH_new); DH * DH_new_method(ENGINE *engine) @@ -174,6 +178,7 @@ DH_new_method(ENGINE *engine) } return ret; } +LCRYPTO_ALIAS(DH_new_method); void DH_free(DH *r) @@ -204,6 +209,7 @@ DH_free(DH *r) BN_free(r->priv_key); free(r); } +LCRYPTO_ALIAS(DH_free); int DH_up_ref(DH *r) @@ -212,6 +218,7 @@ DH_up_ref(DH *r) return i > 1 ? 1 : 0; } +LCRYPTO_ALIAS(DH_up_ref); int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, @@ -220,30 +227,35 @@ DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DH, argl, argp, new_func, dup_func, free_func); } +LCRYPTO_ALIAS(DH_get_ex_new_index); int DH_set_ex_data(DH *d, int idx, void *arg) { return CRYPTO_set_ex_data(&d->ex_data, idx, arg); } +LCRYPTO_ALIAS(DH_set_ex_data); void * DH_get_ex_data(DH *d, int idx) { return CRYPTO_get_ex_data(&d->ex_data, idx); } +LCRYPTO_ALIAS(DH_get_ex_data); int DH_size(const DH *dh) { return BN_num_bytes(dh->p); } +LCRYPTO_ALIAS(DH_size); int DH_bits(const DH *dh) { return BN_num_bits(dh->p); } +LCRYPTO_ALIAS(DH_bits); int DH_security_bits(const DH *dh) @@ -257,12 +269,14 @@ DH_security_bits(const DH *dh) return BN_security_bits(BN_num_bits(dh->p), N); } +LCRYPTO_ALIAS(DH_security_bits); ENGINE * DH_get0_engine(DH *dh) { return dh->engine; } +LCRYPTO_ALIAS(DH_get0_engine); void DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g) @@ -274,6 +288,7 @@ DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g) if (g != NULL) *g = dh->g; } +LCRYPTO_ALIAS(DH_get0_pqg); int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g) @@ -297,6 +312,7 @@ DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g) return 1; } +LCRYPTO_ALIAS(DH_set0_pqg); void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key) @@ -306,6 +322,7 @@ DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key) if (priv_key != NULL) *priv_key = dh->priv_key; } +LCRYPTO_ALIAS(DH_get0_key); int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key) @@ -321,60 +338,70 @@ DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key) return 1; } +LCRYPTO_ALIAS(DH_set0_key); const BIGNUM * DH_get0_p(const DH *dh) { return dh->p; } +LCRYPTO_ALIAS(DH_get0_p); const BIGNUM * DH_get0_q(const DH *dh) { return dh->q; } +LCRYPTO_ALIAS(DH_get0_q); const BIGNUM * DH_get0_g(const DH *dh) { return dh->g; } +LCRYPTO_ALIAS(DH_get0_g); const BIGNUM * DH_get0_priv_key(const DH *dh) { return dh->priv_key; } +LCRYPTO_ALIAS(DH_get0_priv_key); const BIGNUM * DH_get0_pub_key(const DH *dh) { return dh->pub_key; } +LCRYPTO_ALIAS(DH_get0_pub_key); void DH_clear_flags(DH *dh, int flags) { dh->flags &= ~flags; } +LCRYPTO_ALIAS(DH_clear_flags); int DH_test_flags(const DH *dh, int flags) { return dh->flags & flags; } +LCRYPTO_ALIAS(DH_test_flags); void DH_set_flags(DH *dh, int flags) { dh->flags |= flags; } +LCRYPTO_ALIAS(DH_set_flags); long DH_get_length(const DH *dh) { return dh->length; } +LCRYPTO_ALIAS(DH_get_length); int DH_set_length(DH *dh, long length) @@ -385,3 +412,4 @@ DH_set_length(DH *dh, long length) dh->length = length; return 1; } +LCRYPTO_ALIAS(DH_set_length); diff --git a/lib/libcrypto/dsa/dsa_ameth.c b/lib/libcrypto/dsa/dsa_ameth.c index f282caae0..5a0c3116a 100644 --- a/lib/libcrypto/dsa/dsa_ameth.c +++ b/lib/libcrypto/dsa/dsa_ameth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsa_ameth.c,v 1.42 2023/03/04 21:42:49 tb Exp $ */ +/* $OpenBSD: dsa_ameth.c,v 1.43 2023/07/07 06:59:18 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -385,25 +385,12 @@ int_dsa_free(EVP_PKEY *pkey) DSA_free(pkey->pkey.dsa); } -static void -update_buflen(const BIGNUM *b, size_t *pbuflen) -{ - size_t i; - - if (!b) - return; - if (*pbuflen < (i = (size_t)BN_num_bytes(b))) - *pbuflen = i; -} - static int do_dsa_print(BIO *bp, const DSA *x, int off, int ptype) { - unsigned char *m = NULL; - int ret = 0; - size_t buf_len = 0; const char *ktype = NULL; const BIGNUM *priv_key, *pub_key; + int ret = 0; if (ptype == 2) priv_key = x->priv_key; @@ -422,18 +409,6 @@ do_dsa_print(BIO *bp, const DSA *x, int off, int ptype) else ktype = "DSA-Parameters"; - update_buflen(x->p, &buf_len); - update_buflen(x->q, &buf_len); - update_buflen(x->g, &buf_len); - update_buflen(priv_key, &buf_len); - update_buflen(pub_key, &buf_len); - - m = malloc(buf_len + 10); - if (m == NULL) { - DSAerror(ERR_R_MALLOC_FAILURE); - goto err; - } - if (priv_key) { if (!BIO_indent(bp, off, 128)) goto err; @@ -442,19 +417,20 @@ do_dsa_print(BIO *bp, const DSA *x, int off, int ptype) goto err; } - if (!ASN1_bn_print(bp, "priv:", priv_key, m, off)) + if (!bn_printf(bp, priv_key, off, "priv:")) goto err; - if (!ASN1_bn_print(bp, "pub: ", pub_key, m, off)) + if (!bn_printf(bp, pub_key, off, "pub: ")) goto err; - if (!ASN1_bn_print(bp, "P: ", x->p, m, off)) + if (!bn_printf(bp, x->p, off, "P: ")) goto err; - if (!ASN1_bn_print(bp, "Q: ", x->q, m, off)) + if (!bn_printf(bp, x->q, off, "Q: ")) goto err; - if (!ASN1_bn_print(bp, "G: ", x->g, m, off)) + if (!bn_printf(bp, x->g, off, "G: ")) goto err; + ret = 1; -err: - free(m); + + err: return ret; } @@ -594,27 +570,16 @@ dsa_sig_print(BIO *bp, const X509_ALGOR *sigalg, const ASN1_STRING *sig, dsa_sig = d2i_DSA_SIG(NULL, &p, sig->length); if (dsa_sig) { int rv = 0; - size_t buf_len = 0; - unsigned char *m = NULL; - - update_buflen(dsa_sig->r, &buf_len); - update_buflen(dsa_sig->s, &buf_len); - m = malloc(buf_len + 10); - if (m == NULL) { - DSAerror(ERR_R_MALLOC_FAILURE); - goto err; - } if (BIO_write(bp, "\n", 1) != 1) goto err; - if (!ASN1_bn_print(bp, "r: ", dsa_sig->r, m, indent)) + if (!bn_printf(bp, dsa_sig->r, indent, "r: ")) goto err; - if (!ASN1_bn_print(bp, "s: ", dsa_sig->s, m, indent)) + if (!bn_printf(bp, dsa_sig->s, indent, "s: ")) goto err; rv = 1; -err: - free(m); + err: DSA_SIG_free(dsa_sig); return rv; } diff --git a/lib/libcrypto/dsa/dsa_asn1.c b/lib/libcrypto/dsa/dsa_asn1.c index 70a826ca9..5e4f882cf 100644 --- a/lib/libcrypto/dsa/dsa_asn1.c +++ b/lib/libcrypto/dsa/dsa_asn1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsa_asn1.c,v 1.30 2023/03/25 09:09:28 tb Exp $ */ +/* $OpenBSD: dsa_asn1.c,v 1.31 2023/07/08 14:28:15 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -126,12 +126,14 @@ d2i_DSA_SIG(DSA_SIG **a, const unsigned char **in, long len) return (DSA_SIG *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &DSA_SIG_it); } +LCRYPTO_ALIAS(d2i_DSA_SIG); int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &DSA_SIG_it); } +LCRYPTO_ALIAS(i2d_DSA_SIG); void DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps) @@ -141,6 +143,7 @@ DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps) if (ps != NULL) *ps = sig->s; } +LCRYPTO_ALIAS(DSA_SIG_get0); int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s) @@ -155,6 +158,7 @@ DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s) return 1; } +LCRYPTO_ALIAS(DSA_SIG_set0); /* Override the default free and new methods */ static int @@ -243,12 +247,14 @@ d2i_DSAPrivateKey(DSA **a, const unsigned char **in, long len) return (DSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &DSAPrivateKey_it); } +LCRYPTO_ALIAS(d2i_DSAPrivateKey); int i2d_DSAPrivateKey(const DSA *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &DSAPrivateKey_it); } +LCRYPTO_ALIAS(i2d_DSAPrivateKey); static const ASN1_AUX DSAparams_aux = { .app_data = NULL, @@ -299,36 +305,42 @@ d2i_DSAparams(DSA **a, const unsigned char **in, long len) return (DSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &DSAparams_it); } +LCRYPTO_ALIAS(d2i_DSAparams); int i2d_DSAparams(const DSA *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &DSAparams_it); } +LCRYPTO_ALIAS(i2d_DSAparams); DSA * d2i_DSAparams_bio(BIO *bp, DSA **a) { return ASN1_item_d2i_bio(&DSAparams_it, bp, a); } +LCRYPTO_ALIAS(d2i_DSAparams_bio); int i2d_DSAparams_bio(BIO *bp, DSA *a) { return ASN1_item_i2d_bio(&DSAparams_it, bp, a); } +LCRYPTO_ALIAS(i2d_DSAparams_bio); DSA * d2i_DSAparams_fp(FILE *fp, DSA **a) { return ASN1_item_d2i_fp(&DSAparams_it, fp, a); } +LCRYPTO_ALIAS(d2i_DSAparams_fp); int i2d_DSAparams_fp(FILE *fp, DSA *a) { return ASN1_item_i2d_fp(&DSAparams_it, fp, a); } +LCRYPTO_ALIAS(i2d_DSAparams_fp); static const ASN1_AUX DSAPublicKey_aux = { .app_data = NULL, @@ -385,18 +397,21 @@ d2i_DSAPublicKey(DSA **a, const unsigned char **in, long len) return (DSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &DSAPublicKey_it); } +LCRYPTO_ALIAS(d2i_DSAPublicKey); int i2d_DSAPublicKey(const DSA *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &DSAPublicKey_it); } +LCRYPTO_ALIAS(i2d_DSAPublicKey); DSA * DSAparams_dup(DSA *dsa) { return ASN1_item_dup(&DSAparams_it, dsa); } +LCRYPTO_ALIAS(DSAparams_dup); int DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig, @@ -422,6 +437,7 @@ DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig, return ret; } +LCRYPTO_ALIAS(DSA_sign); /* * data has already been hashed (probably with SHA or SHA-1). @@ -457,3 +473,4 @@ DSA_verify(int type, const unsigned char *dgst, int dgst_len, return ret; } +LCRYPTO_ALIAS(DSA_verify); diff --git a/lib/libcrypto/dsa/dsa_err.c b/lib/libcrypto/dsa/dsa_err.c index 8f105a875..6934fe14f 100644 --- a/lib/libcrypto/dsa/dsa_err.c +++ b/lib/libcrypto/dsa/dsa_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsa_err.c,v 1.18 2023/03/04 20:47:04 tb Exp $ */ +/* $OpenBSD: dsa_err.c,v 1.19 2023/07/08 14:28:15 beck Exp $ */ /* ==================================================================== * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * @@ -101,3 +101,4 @@ void ERR_load_DSA_strings(void) } #endif } +LCRYPTO_ALIAS(ERR_load_DSA_strings); diff --git a/lib/libcrypto/dsa/dsa_gen.c b/lib/libcrypto/dsa/dsa_gen.c index 4a16278b5..490c7e51b 100644 --- a/lib/libcrypto/dsa/dsa_gen.c +++ b/lib/libcrypto/dsa/dsa_gen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsa_gen.c,v 1.29 2023/04/13 14:58:27 tb Exp $ */ +/* $OpenBSD: dsa_gen.c,v 1.30 2023/07/08 14:28:15 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -94,6 +94,7 @@ DSA_generate_parameters_ex(DSA *ret, int bits, const unsigned char *seed_in, seed_len, NULL, counter_ret, h_ret, cb); } } +LCRYPTO_ALIAS(DSA_generate_parameters_ex); int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits, const EVP_MD *evpmd, @@ -375,5 +376,6 @@ DSA_generate_parameters(int bits, unsigned char *seed_in, int seed_len, DSA_free(ret); return NULL; } +LCRYPTO_ALIAS(DSA_generate_parameters); #endif diff --git a/lib/libcrypto/dsa/dsa_key.c b/lib/libcrypto/dsa/dsa_key.c index 890f991df..c378707e3 100644 --- a/lib/libcrypto/dsa/dsa_key.c +++ b/lib/libcrypto/dsa/dsa_key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsa_key.c,v 1.33 2023/01/11 04:35:26 jsing Exp $ */ +/* $OpenBSD: dsa_key.c,v 1.34 2023/07/08 14:28:15 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -78,6 +78,7 @@ DSA_generate_key(DSA *dsa) return dsa->meth->dsa_keygen(dsa); return dsa_builtin_keygen(dsa); } +LCRYPTO_ALIAS(DSA_generate_key); static int dsa_builtin_keygen(DSA *dsa) diff --git a/lib/libcrypto/dsa/dsa_lib.c b/lib/libcrypto/dsa/dsa_lib.c index 6986f9ad6..46a7dbcfb 100644 --- a/lib/libcrypto/dsa/dsa_lib.c +++ b/lib/libcrypto/dsa/dsa_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsa_lib.c,v 1.42 2023/03/11 15:29:03 tb Exp $ */ +/* $OpenBSD: dsa_lib.c,v 1.43 2023/07/08 14:28:15 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -84,6 +84,7 @@ DSA_set_default_method(const DSA_METHOD *meth) { default_DSA_method = meth; } +LCRYPTO_ALIAS(DSA_set_default_method); const DSA_METHOD * DSA_get_default_method(void) @@ -92,12 +93,14 @@ DSA_get_default_method(void) default_DSA_method = DSA_OpenSSL(); return default_DSA_method; } +LCRYPTO_ALIAS(DSA_get_default_method); DSA * DSA_new(void) { return DSA_new_method(NULL); } +LCRYPTO_ALIAS(DSA_new); int DSA_set_method(DSA *dsa, const DSA_METHOD *meth) @@ -119,6 +122,7 @@ DSA_set_method(DSA *dsa, const DSA_METHOD *meth) meth->init(dsa); return 1; } +LCRYPTO_ALIAS(DSA_set_method); DSA * DSA_new_method(ENGINE *engine) @@ -179,6 +183,7 @@ DSA_new_method(ENGINE *engine) return ret; } +LCRYPTO_ALIAS(DSA_new_method); void DSA_free(DSA *r) @@ -209,6 +214,7 @@ DSA_free(DSA *r) BN_free(r->r); free(r); } +LCRYPTO_ALIAS(DSA_free); int DSA_up_ref(DSA *r) @@ -216,6 +222,7 @@ DSA_up_ref(DSA *r) int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_DSA); return i > 1 ? 1 : 0; } +LCRYPTO_ALIAS(DSA_up_ref); int DSA_size(const DSA *r) @@ -231,6 +238,7 @@ DSA_size(const DSA *r) return ret; } +LCRYPTO_ALIAS(DSA_size); int DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, @@ -239,18 +247,21 @@ DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DSA, argl, argp, new_func, dup_func, free_func); } +LCRYPTO_ALIAS(DSA_get_ex_new_index); int DSA_set_ex_data(DSA *d, int idx, void *arg) { return CRYPTO_set_ex_data(&d->ex_data, idx, arg); } +LCRYPTO_ALIAS(DSA_set_ex_data); void * DSA_get_ex_data(DSA *d, int idx) { return CRYPTO_get_ex_data(&d->ex_data, idx); } +LCRYPTO_ALIAS(DSA_get_ex_data); int DSA_security_bits(const DSA *d) @@ -260,6 +271,7 @@ DSA_security_bits(const DSA *d) return BN_security_bits(BN_num_bits(d->p), BN_num_bits(d->q)); } +LCRYPTO_ALIAS(DSA_security_bits); #ifndef OPENSSL_NO_DH DH * @@ -301,6 +313,7 @@ err: DH_free(ret); return NULL; } +LCRYPTO_ALIAS(DSA_dup_DH); #endif void @@ -313,6 +326,7 @@ DSA_get0_pqg(const DSA *d, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g) if (g != NULL) *g = d->g; } +LCRYPTO_ALIAS(DSA_get0_pqg); int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g) @@ -336,6 +350,7 @@ DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g) return 1; } +LCRYPTO_ALIAS(DSA_set0_pqg); void DSA_get0_key(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key) @@ -345,6 +360,7 @@ DSA_get0_key(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key) if (priv_key != NULL) *priv_key = d->priv_key; } +LCRYPTO_ALIAS(DSA_get0_key); int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key) @@ -363,66 +379,77 @@ DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key) return 1; } +LCRYPTO_ALIAS(DSA_set0_key); const BIGNUM * DSA_get0_p(const DSA *d) { return d->p; } +LCRYPTO_ALIAS(DSA_get0_p); const BIGNUM * DSA_get0_q(const DSA *d) { return d->q; } +LCRYPTO_ALIAS(DSA_get0_q); const BIGNUM * DSA_get0_g(const DSA *d) { return d->g; } +LCRYPTO_ALIAS(DSA_get0_g); const BIGNUM * DSA_get0_pub_key(const DSA *d) { return d->pub_key; } +LCRYPTO_ALIAS(DSA_get0_pub_key); const BIGNUM * DSA_get0_priv_key(const DSA *d) { return d->priv_key; } +LCRYPTO_ALIAS(DSA_get0_priv_key); void DSA_clear_flags(DSA *d, int flags) { d->flags &= ~flags; } +LCRYPTO_ALIAS(DSA_clear_flags); int DSA_test_flags(const DSA *d, int flags) { return d->flags & flags; } +LCRYPTO_ALIAS(DSA_test_flags); void DSA_set_flags(DSA *d, int flags) { d->flags |= flags; } +LCRYPTO_ALIAS(DSA_set_flags); ENGINE * DSA_get0_engine(DSA *d) { return d->engine; } +LCRYPTO_ALIAS(DSA_get0_engine); int DSA_bits(const DSA *dsa) { return BN_num_bits(dsa->p); } +LCRYPTO_ALIAS(DSA_bits); int dsa_check_key(const DSA *dsa) diff --git a/lib/libcrypto/dsa/dsa_meth.c b/lib/libcrypto/dsa/dsa_meth.c index 392afb84d..c84b5287e 100644 --- a/lib/libcrypto/dsa/dsa_meth.c +++ b/lib/libcrypto/dsa/dsa_meth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsa_meth.c,v 1.6 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: dsa_meth.c,v 1.7 2023/07/08 14:28:15 beck Exp $ */ /* * Copyright (c) 2018 Theo Buehler * @@ -38,6 +38,7 @@ DSA_meth_new(const char *name, int flags) return meth; } +LCRYPTO_ALIAS(DSA_meth_new); void DSA_meth_free(DSA_METHOD *meth) @@ -48,6 +49,7 @@ DSA_meth_free(DSA_METHOD *meth) free(meth->name); free(meth); } +LCRYPTO_ALIAS(DSA_meth_free); DSA_METHOD * DSA_meth_dup(const DSA_METHOD *meth) @@ -64,12 +66,14 @@ DSA_meth_dup(const DSA_METHOD *meth) return copy; } +LCRYPTO_ALIAS(DSA_meth_dup); const char * DSA_meth_get0_name(const DSA_METHOD *meth) { return meth->name; } +LCRYPTO_ALIAS(DSA_meth_get0_name); int DSA_meth_set1_name(DSA_METHOD *meth, const char *name) @@ -86,6 +90,7 @@ DSA_meth_set1_name(DSA_METHOD *meth, const char *name) return 1; } +LCRYPTO_ALIAS(DSA_meth_set1_name); int DSA_meth_set_sign(DSA_METHOD *meth, @@ -94,6 +99,7 @@ DSA_meth_set_sign(DSA_METHOD *meth, meth->dsa_do_sign = sign; return 1; } +LCRYPTO_ALIAS(DSA_meth_set_sign); int DSA_meth_set_finish(DSA_METHOD *meth, int (*finish)(DSA *)) @@ -101,3 +107,4 @@ DSA_meth_set_finish(DSA_METHOD *meth, int (*finish)(DSA *)) meth->finish = finish; return 1; } +LCRYPTO_ALIAS(DSA_meth_set_finish); diff --git a/lib/libcrypto/dsa/dsa_ossl.c b/lib/libcrypto/dsa/dsa_ossl.c index b69cf1a03..36b2a6346 100644 --- a/lib/libcrypto/dsa/dsa_ossl.c +++ b/lib/libcrypto/dsa/dsa_ossl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsa_ossl.c,v 1.51 2023/03/27 10:25:02 tb Exp $ */ +/* $OpenBSD: dsa_ossl.c,v 1.52 2023/07/08 14:28:15 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -91,6 +91,7 @@ DSA_OpenSSL(void) { return &openssl_dsa_meth; } +LCRYPTO_ALIAS(DSA_OpenSSL); /* * Since DSA parameters are entirely arbitrary and checking them to be @@ -440,6 +441,7 @@ DSA_SIG_new(void) { return calloc(1, sizeof(DSA_SIG)); } +LCRYPTO_ALIAS(DSA_SIG_new); void DSA_SIG_free(DSA_SIG *sig) @@ -451,21 +453,25 @@ DSA_SIG_free(DSA_SIG *sig) BN_free(sig->s); free(sig); } +LCRYPTO_ALIAS(DSA_SIG_free); int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) { return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp); } +LCRYPTO_ALIAS(DSA_sign_setup); DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) { return dsa->meth->dsa_do_sign(dgst, dlen, dsa); } +LCRYPTO_ALIAS(DSA_do_sign); int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, DSA *dsa) { return dsa->meth->dsa_do_verify(dgst, dgst_len, sig, dsa); } +LCRYPTO_ALIAS(DSA_do_verify); diff --git a/lib/libcrypto/dsa/dsa_prn.c b/lib/libcrypto/dsa/dsa_prn.c index 4ed656a04..f276d8248 100644 --- a/lib/libcrypto/dsa/dsa_prn.c +++ b/lib/libcrypto/dsa/dsa_prn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsa_prn.c,v 1.9 2022/11/19 06:33:00 tb Exp $ */ +/* $OpenBSD: dsa_prn.c,v 1.10 2023/07/08 14:28:15 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -77,6 +77,7 @@ DSA_print_fp(FILE *fp, const DSA *x, int off) BIO_free(b); return ret; } +LCRYPTO_ALIAS(DSA_print_fp); int DSAparams_print_fp(FILE *fp, const DSA *x) @@ -93,6 +94,7 @@ DSAparams_print_fp(FILE *fp, const DSA *x) BIO_free(b); return ret; } +LCRYPTO_ALIAS(DSAparams_print_fp); int DSA_print(BIO *bp, const DSA *x, int off) @@ -111,6 +113,7 @@ DSA_print(BIO *bp, const DSA *x, int off) EVP_PKEY_free(pk); return ret; } +LCRYPTO_ALIAS(DSA_print); int DSAparams_print(BIO *bp, const DSA *x) @@ -129,3 +132,4 @@ DSAparams_print(BIO *bp, const DSA *x) EVP_PKEY_free(pk); return ret; } +LCRYPTO_ALIAS(DSAparams_print); diff --git a/lib/libcrypto/dso/dso_dlfcn.c b/lib/libcrypto/dso/dso_dlfcn.c index 95afd26b8..77c19aa27 100644 --- a/lib/libcrypto/dso/dso_dlfcn.c +++ b/lib/libcrypto/dso/dso_dlfcn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dso_dlfcn.c,v 1.29 2017/01/29 17:49:23 beck Exp $ */ +/* $OpenBSD: dso_dlfcn.c,v 1.30 2023/07/08 07:22:58 beck Exp $ */ /* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL * project 2000. */ @@ -68,6 +68,7 @@ DSO_METHOD_dlfcn(void) { return NULL; } +LCRYPTO_ALIAS(DSO_METHOD_dlfcn); #else #ifdef HAVE_DLFCN_H @@ -105,6 +106,7 @@ DSO_METHOD_dlfcn(void) { return (&dso_meth_dlfcn); } +LCRYPTO_ALIAS(DSO_METHOD_dlfcn); /* For this DSO_METHOD, our meth_data STACK will contain; * (i) the handle (void*) returned from dlopen(). diff --git a/lib/libcrypto/dso/dso_err.c b/lib/libcrypto/dso/dso_err.c index 2eee155b5..9dec8a66b 100644 --- a/lib/libcrypto/dso/dso_err.c +++ b/lib/libcrypto/dso/dso_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dso_err.c,v 1.10 2022/07/12 14:42:49 kn Exp $ */ +/* $OpenBSD: dso_err.c,v 1.11 2023/07/08 07:22:58 beck Exp $ */ /* ==================================================================== * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. * @@ -103,3 +103,4 @@ ERR_load_DSO_strings(void) } #endif } +LCRYPTO_ALIAS(ERR_load_DSO_strings); diff --git a/lib/libcrypto/dso/dso_lib.c b/lib/libcrypto/dso/dso_lib.c index 6dc98803e..ca762f68d 100644 --- a/lib/libcrypto/dso/dso_lib.c +++ b/lib/libcrypto/dso/dso_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dso_lib.c,v 1.20 2018/08/24 19:27:01 tb Exp $ */ +/* $OpenBSD: dso_lib.c,v 1.21 2023/07/08 07:22:58 beck Exp $ */ /* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL * project 2000. */ @@ -70,24 +70,28 @@ DSO_new(void) { return (DSO_new_method(NULL)); } +LCRYPTO_ALIAS(DSO_new); void DSO_set_default_method(DSO_METHOD *meth) { default_DSO_meth = meth; } +LCRYPTO_ALIAS(DSO_set_default_method); DSO_METHOD * DSO_get_default_method(void) { return (default_DSO_meth); } +LCRYPTO_ALIAS(DSO_get_default_method); DSO_METHOD * DSO_get_method(DSO *dso) { return (dso->meth); } +LCRYPTO_ALIAS(DSO_get_method); DSO_METHOD * DSO_set_method(DSO *dso, DSO_METHOD *meth) @@ -98,6 +102,7 @@ DSO_set_method(DSO *dso, DSO_METHOD *meth) dso->meth = meth; return (mtmp); } +LCRYPTO_ALIAS(DSO_set_method); DSO * DSO_new_method(DSO_METHOD *meth) @@ -132,6 +137,7 @@ DSO_new_method(DSO_METHOD *meth) } return (ret); } +LCRYPTO_ALIAS(DSO_new_method); int DSO_free(DSO *dso) @@ -163,12 +169,14 @@ DSO_free(DSO *dso) free(dso); return (1); } +LCRYPTO_ALIAS(DSO_free); int DSO_flags(DSO *dso) { return ((dso == NULL) ? 0 : dso->flags); } +LCRYPTO_ALIAS(DSO_flags); int @@ -184,6 +192,7 @@ DSO_up_ref(DSO *dso) refs = CRYPTO_add(&dso->references, 1, CRYPTO_LOCK_DSO); return ((refs > 1) ? 1 : 0); } +LCRYPTO_ALIAS(DSO_up_ref); DSO * DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags) @@ -238,6 +247,7 @@ err: DSO_free(ret); return (NULL); } +LCRYPTO_ALIAS(DSO_load); void * DSO_bind_var(DSO *dso, const char *symname) @@ -259,6 +269,7 @@ DSO_bind_var(DSO *dso, const char *symname) /* Success */ return (ret); } +LCRYPTO_ALIAS(DSO_bind_var); DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname) @@ -280,6 +291,7 @@ DSO_bind_func(DSO *dso, const char *symname) /* Success */ return (ret); } +LCRYPTO_ALIAS(DSO_bind_func); /* I don't really like these *_ctrl functions very much to be perfectly * honest. For one thing, I think I have to return a negative value for @@ -317,6 +329,7 @@ DSO_ctrl(DSO *dso, int cmd, long larg, void *parg) } return (dso->meth->dso_ctrl(dso, cmd, larg, parg)); } +LCRYPTO_ALIAS(DSO_ctrl); int DSO_set_name_converter(DSO *dso, DSO_NAME_CONVERTER_FUNC cb, @@ -331,6 +344,7 @@ DSO_set_name_converter(DSO *dso, DSO_NAME_CONVERTER_FUNC cb, dso->name_converter = cb; return (1); } +LCRYPTO_ALIAS(DSO_set_name_converter); const char * DSO_get_filename(DSO *dso) @@ -341,6 +355,7 @@ DSO_get_filename(DSO *dso) } return (dso->filename); } +LCRYPTO_ALIAS(DSO_get_filename); int DSO_set_filename(DSO *dso, const char *filename) @@ -365,6 +380,7 @@ DSO_set_filename(DSO *dso, const char *filename) dso->filename = copied; return (1); } +LCRYPTO_ALIAS(DSO_set_filename); char * DSO_merge(DSO *dso, const char *filespec1, const char *filespec2) @@ -384,6 +400,7 @@ DSO_merge(DSO *dso, const char *filespec1, const char *filespec2) } return (result); } +LCRYPTO_ALIAS(DSO_merge); char * DSO_convert_filename(DSO *dso, const char *filename) @@ -415,6 +432,7 @@ DSO_convert_filename(DSO *dso, const char *filename) } return (result); } +LCRYPTO_ALIAS(DSO_convert_filename); const char * DSO_get_loaded_filename(DSO *dso) @@ -425,6 +443,7 @@ DSO_get_loaded_filename(DSO *dso) } return (dso->loaded_filename); } +LCRYPTO_ALIAS(DSO_get_loaded_filename); int DSO_pathbyaddr(void *addr, char *path, int sz) @@ -438,6 +457,7 @@ DSO_pathbyaddr(void *addr, char *path, int sz) } return (*meth->pathbyaddr)(addr, path, sz); } +LCRYPTO_ALIAS(DSO_pathbyaddr); void * DSO_global_lookup(const char *name) @@ -451,3 +471,4 @@ DSO_global_lookup(const char *name) } return (*meth->globallookup)(name); } +LCRYPTO_ALIAS(DSO_global_lookup); diff --git a/lib/libcrypto/dso/dso_null.c b/lib/libcrypto/dso/dso_null.c index a3dc0ec1f..dfe6a8444 100644 --- a/lib/libcrypto/dso/dso_null.c +++ b/lib/libcrypto/dso/dso_null.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dso_null.c,v 1.7 2014/07/11 08:44:48 jsing Exp $ */ +/* $OpenBSD: dso_null.c,v 1.8 2023/07/08 07:22:58 beck Exp $ */ /* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL * project 2000. */ @@ -72,3 +72,4 @@ DSO_METHOD_null(void) { return (&dso_meth_null); } +LCRYPTO_ALIAS(DSO_METHOD_null); diff --git a/lib/libcrypto/dso/dso_openssl.c b/lib/libcrypto/dso/dso_openssl.c index 37d8d5805..a639a5c7d 100644 --- a/lib/libcrypto/dso/dso_openssl.c +++ b/lib/libcrypto/dso/dso_openssl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dso_openssl.c,v 1.6 2014/07/11 08:44:48 jsing Exp $ */ +/* $OpenBSD: dso_openssl.c,v 1.7 2023/07/08 07:22:58 beck Exp $ */ /* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL * project 2000. */ @@ -73,3 +73,4 @@ DSO_METHOD_openssl(void) return (DSO_METHOD_null()); #endif } +LCRYPTO_ALIAS(DSO_METHOD_openssl); diff --git a/lib/libcrypto/ec/ec_ameth.c b/lib/libcrypto/ec/ec_ameth.c index 8676ace9d..49ae80494 100644 --- a/lib/libcrypto/ec/ec_ameth.c +++ b/lib/libcrypto/ec/ec_ameth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_ameth.c,v 1.40 2023/07/03 09:25:44 tb Exp $ */ +/* $OpenBSD: ec_ameth.c,v 1.41 2023/07/07 06:59:18 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -427,9 +427,7 @@ int_ec_free(EVP_PKEY *pkey) static int do_EC_KEY_print(BIO *bp, const EC_KEY *x, int off, int ktype) { - unsigned char *buffer = NULL; const char *ecstr; - size_t buf_len = 0, i; int ret = 0, reason = ERR_R_BIO_LIB; BIGNUM *pub_key = NULL; BN_CTX *ctx = NULL; @@ -454,24 +452,13 @@ do_EC_KEY_print(BIO *bp, const EC_KEY *x, int off, int ktype) reason = ERR_R_EC_LIB; goto err; } - if (pub_key) - buf_len = (size_t) BN_num_bytes(pub_key); } } if (ktype == 2) { priv_key = EC_KEY_get0_private_key(x); - if (priv_key && (i = (size_t) BN_num_bytes(priv_key)) > buf_len) - buf_len = i; } else priv_key = NULL; - if (ktype > 0) { - buf_len += 10; - if ((buffer = malloc(buf_len)) == NULL) { - reason = ERR_R_MALLOC_FAILURE; - goto err; - } - } if (ktype == 2) ecstr = "Private-Key"; else if (ktype == 1) @@ -485,19 +472,21 @@ do_EC_KEY_print(BIO *bp, const EC_KEY *x, int off, int ktype) EC_GROUP_order_bits(group)) <= 0) goto err; - if (!ASN1_bn_print(bp, "priv:", priv_key, buffer, off)) + if (!bn_printf(bp, priv_key, off, "priv:")) goto err; - if (!ASN1_bn_print(bp, "pub: ", pub_key, buffer, off)) + if (!bn_printf(bp, pub_key, off, "pub: ")) goto err; if (!ECPKParameters_print(bp, group, off)) goto err; + ret = 1; + err: if (!ret) ECerror(reason); BN_free(pub_key); BN_CTX_free(ctx); - free(buffer); + return (ret); } diff --git a/lib/libcrypto/ec/ec_asn1.c b/lib/libcrypto/ec/ec_asn1.c index 6aedab977..683ca1741 100644 --- a/lib/libcrypto/ec/ec_asn1.c +++ b/lib/libcrypto/ec/ec_asn1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_asn1.c,v 1.46 2023/06/27 07:28:57 tb Exp $ */ +/* $OpenBSD: ec_asn1.c,v 1.48 2023/07/07 19:37:53 beck Exp $ */ /* * Written by Nils Larsch for the OpenSSL project. */ @@ -72,6 +72,7 @@ EC_GROUP_get_basis_type(const EC_GROUP *group) { return 0; } +LCRYPTO_ALIAS(EC_GROUP_get_basis_type); /* some structures needed for the asn1 encoding */ typedef struct x9_62_pentanomial_st { @@ -1101,6 +1102,7 @@ d2i_ECPKParameters(EC_GROUP **a, const unsigned char **in, long len) ECPKPARAMETERS_free(params); return (group); } +LCRYPTO_ALIAS(d2i_ECPKParameters); int i2d_ECPKParameters(const EC_GROUP *a, unsigned char **out) @@ -1119,6 +1121,7 @@ i2d_ECPKParameters(const EC_GROUP *a, unsigned char **out) ECPKPARAMETERS_free(tmp); return (ret); } +LCRYPTO_ALIAS(i2d_ECPKParameters); /* some EC_KEY functions */ @@ -1213,6 +1216,7 @@ d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, long len) return (NULL); } +LCRYPTO_ALIAS(d2i_ECPrivateKey); int i2d_ECPrivateKey(EC_KEY *a, unsigned char **out) @@ -1297,6 +1301,7 @@ i2d_ECPrivateKey(EC_KEY *a, unsigned char **out) EC_PRIVATEKEY_free(priv_key); return (ok ? ret : 0); } +LCRYPTO_ALIAS(i2d_ECPrivateKey); int i2d_ECParameters(EC_KEY *a, unsigned char **out) @@ -1307,6 +1312,7 @@ i2d_ECParameters(EC_KEY *a, unsigned char **out) } return i2d_ECPKParameters(a->group, out); } +LCRYPTO_ALIAS(i2d_ECParameters); EC_KEY * d2i_ECParameters(EC_KEY **a, const unsigned char **in, long len) @@ -1336,6 +1342,7 @@ d2i_ECParameters(EC_KEY **a, const unsigned char **in, long len) *a = ret; return ret; } +LCRYPTO_ALIAS(d2i_ECParameters); EC_KEY * o2i_ECPublicKey(EC_KEY **a, const unsigned char **in, long len) @@ -1362,6 +1369,7 @@ o2i_ECPublicKey(EC_KEY **a, const unsigned char **in, long len) *in += len; return ret; } +LCRYPTO_ALIAS(o2i_ECPublicKey); int i2o_ECPublicKey(const EC_KEY *a, unsigned char **out) @@ -1400,3 +1408,4 @@ i2o_ECPublicKey(const EC_KEY *a, unsigned char **out) *out += buf_len; return buf_len; } +LCRYPTO_ALIAS(i2o_ECPublicKey); diff --git a/lib/libcrypto/ec/ec_check.c b/lib/libcrypto/ec/ec_check.c index 4a38dec53..0f98ef613 100644 --- a/lib/libcrypto/ec/ec_check.c +++ b/lib/libcrypto/ec/ec_check.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_check.c,v 1.14 2023/07/03 09:29:55 tb Exp $ */ +/* $OpenBSD: ec_check.c,v 1.15 2023/07/07 13:54:45 beck Exp $ */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * @@ -109,3 +109,4 @@ EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx_in) return ret; } +LCRYPTO_ALIAS(EC_GROUP_check); diff --git a/lib/libcrypto/ec/ec_curve.c b/lib/libcrypto/ec/ec_curve.c index a8a1e4d52..9d19628b3 100644 --- a/lib/libcrypto/ec/ec_curve.c +++ b/lib/libcrypto/ec/ec_curve.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_curve.c,v 1.41 2023/05/02 13:01:57 tb Exp $ */ +/* $OpenBSD: ec_curve.c,v 1.42 2023/07/07 13:54:45 beck Exp $ */ /* * Written by Nils Larsch for the OpenSSL project. */ @@ -3122,6 +3122,7 @@ EC_GROUP_new_by_curve_name(int nid) ECerror(EC_R_UNKNOWN_GROUP); return NULL; } +LCRYPTO_ALIAS(EC_GROUP_new_by_curve_name); size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems) @@ -3140,6 +3141,7 @@ EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems) return CURVE_LIST_LENGTH; } +LCRYPTO_ALIAS(EC_get_builtin_curves); static const struct { const char *name; @@ -3174,6 +3176,7 @@ EC_curve_nid2nist(int nid) return NULL; } +LCRYPTO_ALIAS(EC_curve_nid2nist); int EC_curve_nist2nid(const char *name) @@ -3187,3 +3190,4 @@ EC_curve_nist2nid(const char *name) return NID_undef; } +LCRYPTO_ALIAS(EC_curve_nist2nid); diff --git a/lib/libcrypto/ec/ec_cvt.c b/lib/libcrypto/ec/ec_cvt.c index 90e740073..5b196dd67 100644 --- a/lib/libcrypto/ec/ec_cvt.c +++ b/lib/libcrypto/ec/ec_cvt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_cvt.c,v 1.11 2023/04/25 19:53:30 tb Exp $ */ +/* $OpenBSD: ec_cvt.c,v 1.12 2023/07/07 13:54:45 beck Exp $ */ /* * Originally written by Bodo Moeller for the OpenSSL project. */ @@ -100,3 +100,4 @@ EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, { return ec_group_new_curve(EC_GFp_mont_method(), p, a, b, ctx); } +LCRYPTO_ALIAS(EC_GROUP_new_curve_GFp); diff --git a/lib/libcrypto/ec/ec_err.c b/lib/libcrypto/ec/ec_err.c index d10b8e6f7..d797b937c 100644 --- a/lib/libcrypto/ec/ec_err.c +++ b/lib/libcrypto/ec/ec_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_err.c,v 1.16 2023/07/05 17:10:10 tb Exp $ */ +/* $OpenBSD: ec_err.c,v 1.17 2023/07/07 13:54:45 beck Exp $ */ /* ==================================================================== * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * @@ -147,3 +147,4 @@ ERR_load_EC_strings(void) } #endif } +LCRYPTO_ALIAS(ERR_load_EC_strings); diff --git a/lib/libcrypto/ec/ec_key.c b/lib/libcrypto/ec/ec_key.c index a15d06b01..e5ff18980 100644 --- a/lib/libcrypto/ec/ec_key.c +++ b/lib/libcrypto/ec/ec_key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_key.c,v 1.35 2023/07/05 08:39:40 tb Exp $ */ +/* $OpenBSD: ec_key.c,v 1.36 2023/07/07 13:54:45 beck Exp $ */ /* * Written by Nils Larsch for the OpenSSL project. */ @@ -78,6 +78,7 @@ EC_KEY_new(void) { return EC_KEY_new_method(NULL); } +LCRYPTO_ALIAS(EC_KEY_new); EC_KEY * EC_KEY_new_by_curve_name(int nid) @@ -97,6 +98,7 @@ EC_KEY_new_by_curve_name(int nid) } return ret; } +LCRYPTO_ALIAS(EC_KEY_new_by_curve_name); void EC_KEY_free(EC_KEY *r) @@ -124,6 +126,7 @@ EC_KEY_free(EC_KEY *r) freezero(r, sizeof(EC_KEY)); } +LCRYPTO_ALIAS(EC_KEY_free); EC_KEY * EC_KEY_copy(EC_KEY *dest, const EC_KEY *src) @@ -197,6 +200,7 @@ EC_KEY_copy(EC_KEY *dest, const EC_KEY *src) return dest; } +LCRYPTO_ALIAS(EC_KEY_copy); EC_KEY * EC_KEY_dup(const EC_KEY *ec_key) @@ -211,6 +215,7 @@ EC_KEY_dup(const EC_KEY *ec_key) } return ret; } +LCRYPTO_ALIAS(EC_KEY_dup); int EC_KEY_up_ref(EC_KEY *r) @@ -218,18 +223,21 @@ EC_KEY_up_ref(EC_KEY *r) int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_EC); return ((i > 1) ? 1 : 0); } +LCRYPTO_ALIAS(EC_KEY_up_ref); int EC_KEY_set_ex_data(EC_KEY *r, int idx, void *arg) { return CRYPTO_set_ex_data(&r->ex_data, idx, arg); } +LCRYPTO_ALIAS(EC_KEY_set_ex_data); void * EC_KEY_get_ex_data(const EC_KEY *r, int idx) { return CRYPTO_get_ex_data(&r->ex_data, idx); } +LCRYPTO_ALIAS(EC_KEY_get_ex_data); int EC_KEY_generate_key(EC_KEY *eckey) @@ -239,6 +247,7 @@ EC_KEY_generate_key(EC_KEY *eckey) ECerror(EC_R_NOT_IMPLEMENTED); return 0; } +LCRYPTO_ALIAS(EC_KEY_generate_key); int ec_key_gen(EC_KEY *eckey) @@ -355,6 +364,7 @@ EC_KEY_check_key(const EC_KEY *eckey) return ret; } +LCRYPTO_ALIAS(EC_KEY_check_key); int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, BIGNUM *y) @@ -409,12 +419,14 @@ EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, BIGNUM *y) return ret; } +LCRYPTO_ALIAS(EC_KEY_set_public_key_affine_coordinates); const EC_GROUP * EC_KEY_get0_group(const EC_KEY *key) { return key->group; } +LCRYPTO_ALIAS(EC_KEY_get0_group); int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group) @@ -426,12 +438,14 @@ EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group) key->group = EC_GROUP_dup(group); return (key->group == NULL) ? 0 : 1; } +LCRYPTO_ALIAS(EC_KEY_set_group); const BIGNUM * EC_KEY_get0_private_key(const EC_KEY *key) { return key->priv_key; } +LCRYPTO_ALIAS(EC_KEY_get0_private_key); int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *priv_key) @@ -446,12 +460,14 @@ EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *priv_key) return 1; } +LCRYPTO_ALIAS(EC_KEY_set_private_key); const EC_POINT * EC_KEY_get0_public_key(const EC_KEY *key) { return key->pub_key; } +LCRYPTO_ALIAS(EC_KEY_get0_public_key); int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub_key) @@ -466,24 +482,28 @@ EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub_key) return 1; } +LCRYPTO_ALIAS(EC_KEY_set_public_key); unsigned int EC_KEY_get_enc_flags(const EC_KEY *key) { return key->enc_flag; } +LCRYPTO_ALIAS(EC_KEY_get_enc_flags); void EC_KEY_set_enc_flags(EC_KEY *key, unsigned int flags) { key->enc_flag = flags; } +LCRYPTO_ALIAS(EC_KEY_set_enc_flags); point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key) { return key->conv_form; } +LCRYPTO_ALIAS(EC_KEY_get_conv_form); void EC_KEY_set_conv_form(EC_KEY *key, point_conversion_form_t cform) @@ -492,6 +512,7 @@ EC_KEY_set_conv_form(EC_KEY *key, point_conversion_form_t cform) if (key->group != NULL) EC_GROUP_set_point_conversion_form(key->group, cform); } +LCRYPTO_ALIAS(EC_KEY_set_conv_form); void EC_KEY_set_asn1_flag(EC_KEY *key, int flag) @@ -499,6 +520,7 @@ EC_KEY_set_asn1_flag(EC_KEY *key, int flag) if (key->group != NULL) EC_GROUP_set_asn1_flag(key->group, flag); } +LCRYPTO_ALIAS(EC_KEY_set_asn1_flag); int EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx) @@ -507,21 +529,25 @@ EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx) return 0; return EC_GROUP_precompute_mult(key->group, ctx); } +LCRYPTO_ALIAS(EC_KEY_precompute_mult); int EC_KEY_get_flags(const EC_KEY *key) { return key->flags; } +LCRYPTO_ALIAS(EC_KEY_get_flags); void EC_KEY_set_flags(EC_KEY *key, int flags) { key->flags |= flags; } +LCRYPTO_ALIAS(EC_KEY_set_flags); void EC_KEY_clear_flags(EC_KEY *key, int flags) { key->flags &= ~flags; } +LCRYPTO_ALIAS(EC_KEY_clear_flags); diff --git a/lib/libcrypto/ec/ec_kmeth.c b/lib/libcrypto/ec/ec_kmeth.c index ec45e679d..3e997f8a5 100644 --- a/lib/libcrypto/ec/ec_kmeth.c +++ b/lib/libcrypto/ec/ec_kmeth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_kmeth.c,v 1.10 2023/07/05 11:37:46 tb Exp $ */ +/* $OpenBSD: ec_kmeth.c,v 1.11 2023/07/07 13:54:45 beck Exp $ */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. @@ -92,12 +92,14 @@ EC_KEY_OpenSSL(void) { return &openssl_ec_key_method; } +LCRYPTO_ALIAS(EC_KEY_OpenSSL); const EC_KEY_METHOD * EC_KEY_get_default_method(void) { return default_ec_key_meth; } +LCRYPTO_ALIAS(EC_KEY_get_default_method); void EC_KEY_set_default_method(const EC_KEY_METHOD *meth) @@ -107,12 +109,14 @@ EC_KEY_set_default_method(const EC_KEY_METHOD *meth) else default_ec_key_meth = meth; } +LCRYPTO_ALIAS(EC_KEY_set_default_method); const EC_KEY_METHOD * EC_KEY_get_method(const EC_KEY *key) { return key->meth; } +LCRYPTO_ALIAS(EC_KEY_get_method); int EC_KEY_set_method(EC_KEY *key, const EC_KEY_METHOD *meth) @@ -132,6 +136,7 @@ EC_KEY_set_method(EC_KEY *key, const EC_KEY_METHOD *meth) return meth->init(key); return 1; } +LCRYPTO_ALIAS(EC_KEY_set_method); EC_KEY * EC_KEY_new_method(ENGINE *engine) @@ -180,6 +185,7 @@ EC_KEY_new_method(ENGINE *engine) EC_KEY_free(ret); return NULL; } +LCRYPTO_ALIAS(EC_KEY_new_method); EC_KEY_METHOD * EC_KEY_METHOD_new(const EC_KEY_METHOD *meth) @@ -193,6 +199,7 @@ EC_KEY_METHOD_new(const EC_KEY_METHOD *meth) ret->flags |= EC_KEY_METHOD_DYNAMIC; return ret; } +LCRYPTO_ALIAS(EC_KEY_METHOD_new); void EC_KEY_METHOD_free(EC_KEY_METHOD *meth) @@ -202,6 +209,7 @@ EC_KEY_METHOD_free(EC_KEY_METHOD *meth) if (meth->flags & EC_KEY_METHOD_DYNAMIC) free(meth); } +LCRYPTO_ALIAS(EC_KEY_METHOD_free); void EC_KEY_METHOD_set_init(EC_KEY_METHOD *meth, @@ -219,12 +227,14 @@ EC_KEY_METHOD_set_init(EC_KEY_METHOD *meth, meth->set_private = set_private; meth->set_public = set_public; } +LCRYPTO_ALIAS(EC_KEY_METHOD_set_init); void EC_KEY_METHOD_set_keygen(EC_KEY_METHOD *meth, int (*keygen)(EC_KEY *key)) { meth->keygen = keygen; } +LCRYPTO_ALIAS(EC_KEY_METHOD_set_keygen); void EC_KEY_METHOD_set_compute_key(EC_KEY_METHOD *meth, @@ -233,6 +243,7 @@ EC_KEY_METHOD_set_compute_key(EC_KEY_METHOD *meth, { meth->compute_key = ckey; } +LCRYPTO_ALIAS(EC_KEY_METHOD_set_compute_key); void EC_KEY_METHOD_set_sign(EC_KEY_METHOD *meth, @@ -249,6 +260,7 @@ EC_KEY_METHOD_set_sign(EC_KEY_METHOD *meth, meth->sign_setup = sign_setup; meth->sign_sig = sign_sig; } +LCRYPTO_ALIAS(EC_KEY_METHOD_set_sign); void EC_KEY_METHOD_set_verify(EC_KEY_METHOD *meth, @@ -260,6 +272,7 @@ EC_KEY_METHOD_set_verify(EC_KEY_METHOD *meth, meth->verify = verify; meth->verify_sig = verify_sig; } +LCRYPTO_ALIAS(EC_KEY_METHOD_set_verify); void @@ -284,6 +297,7 @@ EC_KEY_METHOD_get_init(const EC_KEY_METHOD *meth, if (pset_public != NULL) *pset_public = meth->set_public; } +LCRYPTO_ALIAS(EC_KEY_METHOD_get_init); void EC_KEY_METHOD_get_keygen(const EC_KEY_METHOD *meth, @@ -292,6 +306,7 @@ EC_KEY_METHOD_get_keygen(const EC_KEY_METHOD *meth, if (pkeygen != NULL) *pkeygen = meth->keygen; } +LCRYPTO_ALIAS(EC_KEY_METHOD_get_keygen); void EC_KEY_METHOD_get_compute_key(const EC_KEY_METHOD *meth, @@ -301,6 +316,7 @@ EC_KEY_METHOD_get_compute_key(const EC_KEY_METHOD *meth, if (pck != NULL) *pck = meth->compute_key; } +LCRYPTO_ALIAS(EC_KEY_METHOD_get_compute_key); void EC_KEY_METHOD_get_sign(const EC_KEY_METHOD *meth, @@ -320,6 +336,7 @@ EC_KEY_METHOD_get_sign(const EC_KEY_METHOD *meth, if (psign_sig != NULL) *psign_sig = meth->sign_sig; } +LCRYPTO_ALIAS(EC_KEY_METHOD_get_sign); void EC_KEY_METHOD_get_verify(const EC_KEY_METHOD *meth, @@ -333,3 +350,4 @@ EC_KEY_METHOD_get_verify(const EC_KEY_METHOD *meth, if (pverify_sig != NULL) *pverify_sig = meth->verify_sig; } +LCRYPTO_ALIAS(EC_KEY_METHOD_get_verify); diff --git a/lib/libcrypto/ec/ec_lib.c b/lib/libcrypto/ec/ec_lib.c index 8cea0bb95..b5788492c 100644 --- a/lib/libcrypto/ec/ec_lib.c +++ b/lib/libcrypto/ec/ec_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_lib.c,v 1.62 2023/07/03 07:26:40 tb Exp $ */ +/* $OpenBSD: ec_lib.c,v 1.64 2023/07/07 19:37:53 beck Exp $ */ /* * Originally written by Bodo Moeller for the OpenSSL project. */ @@ -110,6 +110,7 @@ EC_GROUP_new(const EC_METHOD *meth) } return ret; } +LCRYPTO_ALIAS(EC_GROUP_new); void @@ -128,6 +129,7 @@ EC_GROUP_free(EC_GROUP *group) freezero(group->seed, group->seed_len); freezero(group, sizeof *group); } +LCRYPTO_ALIAS(EC_GROUP_free); void EC_GROUP_clear_free(EC_GROUP *group) @@ -188,6 +190,7 @@ EC_GROUP_copy(EC_GROUP *dest, const EC_GROUP *src) return dest->meth->group_copy(dest, src); } +LCRYPTO_ALIAS(EC_GROUP_copy); EC_GROUP * @@ -202,6 +205,7 @@ EC_GROUP_dup(const EC_GROUP *a) } return t; } +LCRYPTO_ALIAS(EC_GROUP_dup); const EC_METHOD * @@ -209,6 +213,7 @@ EC_GROUP_method_of(const EC_GROUP *group) { return group->meth; } +LCRYPTO_ALIAS(EC_GROUP_method_of); int @@ -216,6 +221,7 @@ EC_METHOD_get_field_type(const EC_METHOD *meth) { return meth->field_type; } +LCRYPTO_ALIAS(EC_METHOD_get_field_type); /* * If there is a user-provided cofactor, sanity check and use it. Otherwise @@ -349,6 +355,7 @@ EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, return 1; } +LCRYPTO_ALIAS(EC_GROUP_set_generator); const EC_POINT * @@ -356,6 +363,7 @@ EC_GROUP_get0_generator(const EC_GROUP *group) { return group->generator; } +LCRYPTO_ALIAS(EC_GROUP_get0_generator); int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx) @@ -365,6 +373,7 @@ EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx) return !BN_is_zero(order); } +LCRYPTO_ALIAS(EC_GROUP_get_order); const BIGNUM * EC_GROUP_get0_order(const EC_GROUP *group) @@ -377,6 +386,7 @@ EC_GROUP_order_bits(const EC_GROUP *group) { return group->meth->group_order_bits(group); } +LCRYPTO_ALIAS(EC_GROUP_order_bits); int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, BN_CTX *ctx) @@ -386,6 +396,7 @@ EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, BN_CTX *ctx) return !BN_is_zero(&group->cofactor); } +LCRYPTO_ALIAS(EC_GROUP_get_cofactor); void @@ -393,6 +404,7 @@ EC_GROUP_set_curve_name(EC_GROUP *group, int nid) { group->curve_name = nid; } +LCRYPTO_ALIAS(EC_GROUP_set_curve_name); int @@ -400,6 +412,7 @@ EC_GROUP_get_curve_name(const EC_GROUP *group) { return group->curve_name; } +LCRYPTO_ALIAS(EC_GROUP_get_curve_name); void @@ -407,6 +420,7 @@ EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag) { group->asn1_flag = flag; } +LCRYPTO_ALIAS(EC_GROUP_set_asn1_flag); int @@ -414,6 +428,7 @@ EC_GROUP_get_asn1_flag(const EC_GROUP *group) { return group->asn1_flag; } +LCRYPTO_ALIAS(EC_GROUP_get_asn1_flag); void @@ -422,6 +437,7 @@ EC_GROUP_set_point_conversion_form(EC_GROUP *group, { group->asn1_form = form; } +LCRYPTO_ALIAS(EC_GROUP_set_point_conversion_form); point_conversion_form_t @@ -429,6 +445,7 @@ EC_GROUP_get_point_conversion_form(const EC_GROUP *group) { return group->asn1_form; } +LCRYPTO_ALIAS(EC_GROUP_get_point_conversion_form); size_t @@ -449,6 +466,7 @@ EC_GROUP_set_seed(EC_GROUP *group, const unsigned char *p, size_t len) return len; } +LCRYPTO_ALIAS(EC_GROUP_set_seed); unsigned char * @@ -456,6 +474,7 @@ EC_GROUP_get0_seed(const EC_GROUP *group) { return group->seed; } +LCRYPTO_ALIAS(EC_GROUP_get0_seed); size_t @@ -463,6 +482,7 @@ EC_GROUP_get_seed_len(const EC_GROUP *group) { return group->seed_len; } +LCRYPTO_ALIAS(EC_GROUP_get_seed_len); int EC_GROUP_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, @@ -488,6 +508,7 @@ EC_GROUP_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, return ret; } +LCRYPTO_ALIAS(EC_GROUP_set_curve); int EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, @@ -513,6 +534,7 @@ EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, return ret; } +LCRYPTO_ALIAS(EC_GROUP_get_curve); int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, @@ -537,6 +559,7 @@ EC_GROUP_get_degree(const EC_GROUP *group) } return group->meth->group_get_degree(group); } +LCRYPTO_ALIAS(EC_GROUP_get_degree); int @@ -562,6 +585,7 @@ EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx_in) return ret; } +LCRYPTO_ALIAS(EC_GROUP_check_discriminant); int @@ -637,6 +661,7 @@ EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx) BN_CTX_free(ctx); return -1; } +LCRYPTO_ALIAS(EC_GROUP_cmp); /* * Coordinate blinding for EC_POINT. @@ -682,6 +707,7 @@ EC_POINT_new(const EC_GROUP *group) } return ret; } +LCRYPTO_ALIAS(EC_POINT_new); void EC_POINT_free(EC_POINT *point) @@ -694,6 +720,7 @@ EC_POINT_free(EC_POINT *point) freezero(point, sizeof *point); } +LCRYPTO_ALIAS(EC_POINT_free); void EC_POINT_clear_free(EC_POINT *point) @@ -716,6 +743,7 @@ EC_POINT_copy(EC_POINT *dest, const EC_POINT *src) return 1; return dest->meth->point_copy(dest, src); } +LCRYPTO_ALIAS(EC_POINT_copy); EC_POINT * EC_POINT_dup(const EC_POINT *a, const EC_GROUP *group) @@ -736,12 +764,14 @@ EC_POINT_dup(const EC_POINT *a, const EC_GROUP *group) } else return t; } +LCRYPTO_ALIAS(EC_POINT_dup); const EC_METHOD * EC_POINT_method_of(const EC_POINT *point) { return point->meth; } +LCRYPTO_ALIAS(EC_POINT_method_of); int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point) @@ -756,6 +786,7 @@ EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point) } return group->meth->point_set_to_infinity(group, point); } +LCRYPTO_ALIAS(EC_POINT_set_to_infinity); int EC_POINT_set_Jprojective_coordinates(const EC_GROUP *group, EC_POINT *point, @@ -875,6 +906,7 @@ EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *point, return ret; } +LCRYPTO_ALIAS(EC_POINT_set_affine_coordinates); int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *point, @@ -911,6 +943,7 @@ EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *point, return ret; } +LCRYPTO_ALIAS(EC_POINT_get_affine_coordinates); int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, const EC_POINT *point, @@ -948,6 +981,7 @@ EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, return ret; } +LCRYPTO_ALIAS(EC_POINT_add); int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, @@ -977,6 +1011,7 @@ EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, return ret; } +LCRYPTO_ALIAS(EC_POINT_dbl); int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx_in) @@ -1005,6 +1040,7 @@ EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx_in) return ret; } +LCRYPTO_ALIAS(EC_POINT_invert); int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) @@ -1019,6 +1055,7 @@ EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) } return group->meth->is_at_infinity(group, point); } +LCRYPTO_ALIAS(EC_POINT_is_at_infinity); int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, @@ -1048,6 +1085,7 @@ EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, return ret; } +LCRYPTO_ALIAS(EC_POINT_is_on_curve); int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, @@ -1077,6 +1115,7 @@ EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, return ret; } +LCRYPTO_ALIAS(EC_POINT_cmp); int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx_in) @@ -1105,6 +1144,7 @@ EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx_in) return ret; } +LCRYPTO_ALIAS(EC_POINT_make_affine); int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], @@ -1137,6 +1177,7 @@ EC_POINTs_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], return ret; } +LCRYPTO_ALIAS(EC_POINTs_make_affine); int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, @@ -1178,6 +1219,7 @@ EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, return ret; } +LCRYPTO_ALIAS(EC_POINTs_mul); int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, @@ -1239,18 +1281,21 @@ EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, return ret; } +LCRYPTO_ALIAS(EC_POINT_mul); int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx_in) { return 1; } +LCRYPTO_ALIAS(EC_GROUP_precompute_mult); int EC_GROUP_have_precompute_mult(const EC_GROUP *group) { return 0; } +LCRYPTO_ALIAS(EC_GROUP_have_precompute_mult); int ec_group_simple_order_bits(const EC_GROUP *group) @@ -1283,3 +1328,4 @@ ECParameters_dup(EC_KEY *key) return dup; } +LCRYPTO_ALIAS(ECParameters_dup); diff --git a/lib/libcrypto/ec/ec_oct.c b/lib/libcrypto/ec/ec_oct.c index f9de2f13a..9308d409c 100644 --- a/lib/libcrypto/ec/ec_oct.c +++ b/lib/libcrypto/ec/ec_oct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_oct.c,v 1.14 2023/05/04 06:45:51 tb Exp $ */ +/* $OpenBSD: ec_oct.c,v 1.16 2023/07/07 19:37:53 beck Exp $ */ /* * Originally written by Bodo Moeller for the OpenSSL project. */ @@ -99,6 +99,7 @@ EC_POINT_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *point, return ret; } +LCRYPTO_ALIAS(EC_POINT_set_compressed_coordinates); int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, EC_POINT *point, @@ -136,6 +137,7 @@ EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *point, return ret; } +LCRYPTO_ALIAS(EC_POINT_point2oct); int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point, @@ -165,3 +167,4 @@ EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point, return ret; } +LCRYPTO_ALIAS(EC_POINT_oct2point); diff --git a/lib/libcrypto/ec/ec_print.c b/lib/libcrypto/ec/ec_print.c index da33c4ecc..312770f66 100644 --- a/lib/libcrypto/ec/ec_print.c +++ b/lib/libcrypto/ec/ec_print.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_print.c,v 1.12 2023/06/23 10:34:16 tb Exp $ */ +/* $OpenBSD: ec_print.c,v 1.13 2023/07/07 13:54:45 beck Exp $ */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * @@ -81,6 +81,7 @@ EC_POINT_point2bn(const EC_GROUP *group, const EC_POINT *point, return ret; } +LCRYPTO_ALIAS(EC_POINT_point2bn); EC_POINT * EC_POINT_bn2point(const EC_GROUP *group, @@ -117,6 +118,7 @@ EC_POINT_bn2point(const EC_GROUP *group, free(buf); return ret; } +LCRYPTO_ALIAS(EC_POINT_bn2point); static const char *HEX_DIGITS = "0123456789ABCDEF"; @@ -159,6 +161,7 @@ EC_POINT_point2hex(const EC_GROUP *group, const EC_POINT *point, return ret; } +LCRYPTO_ALIAS(EC_POINT_point2hex); EC_POINT * EC_POINT_hex2point(const EC_GROUP *group, const char *buf, @@ -176,3 +179,4 @@ EC_POINT_hex2point(const EC_GROUP *group, const char *buf, return ret; } +LCRYPTO_ALIAS(EC_POINT_hex2point); diff --git a/lib/libcrypto/ec/eck_prn.c b/lib/libcrypto/ec/eck_prn.c index f65b74518..6e89bfa73 100644 --- a/lib/libcrypto/ec/eck_prn.c +++ b/lib/libcrypto/ec/eck_prn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eck_prn.c,v 1.27 2023/07/06 15:18:02 tb Exp $ */ +/* $OpenBSD: eck_prn.c,v 1.28 2023/07/07 13:54:45 beck Exp $ */ /* * Written by Nils Larsch for the OpenSSL project. */ @@ -86,6 +86,7 @@ ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off) BIO_free(b); return (ret); } +LCRYPTO_ALIAS(ECPKParameters_print_fp); int EC_KEY_print_fp(FILE *fp, const EC_KEY *x, int off) @@ -102,6 +103,7 @@ EC_KEY_print_fp(FILE *fp, const EC_KEY *x, int off) BIO_free(b); return (ret); } +LCRYPTO_ALIAS(EC_KEY_print_fp); int ECParameters_print_fp(FILE *fp, const EC_KEY *x) @@ -118,6 +120,7 @@ ECParameters_print_fp(FILE *fp, const EC_KEY *x) BIO_free(b); return (ret); } +LCRYPTO_ALIAS(ECParameters_print_fp); int EC_KEY_print(BIO *bp, const EC_KEY *x, int off) @@ -136,6 +139,7 @@ EC_KEY_print(BIO *bp, const EC_KEY *x, int off) EVP_PKEY_free(pk); return ret; } +LCRYPTO_ALIAS(EC_KEY_print); int ECParameters_print(BIO *bp, const EC_KEY *x) @@ -154,6 +158,7 @@ ECParameters_print(BIO *bp, const EC_KEY *x) EVP_PKEY_free(pk); return ret; } +LCRYPTO_ALIAS(ECParameters_print); static int print_bin(BIO *fp, const char *str, const unsigned char *num, @@ -310,6 +315,7 @@ ECPKParameters_print(BIO *bp, const EC_GROUP *group, int off) return ecpk_print_explicit_parameters(bp, group, off); } +LCRYPTO_ALIAS(ECPKParameters_print); static int print_bin(BIO *fp, const char *name, const unsigned char *buf, diff --git a/lib/libcrypto/ec/ecp_mont.c b/lib/libcrypto/ec/ecp_mont.c index b11385560..76d1f578e 100644 --- a/lib/libcrypto/ec/ecp_mont.c +++ b/lib/libcrypto/ec/ecp_mont.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecp_mont.c,v 1.29 2023/04/11 18:58:20 jsing Exp $ */ +/* $OpenBSD: ecp_mont.c,v 1.30 2023/07/07 13:54:45 beck Exp $ */ /* * Originally written by Bodo Moeller for the OpenSSL project. */ @@ -269,3 +269,4 @@ EC_GFp_mont_method(void) { return &ec_GFp_mont_method; } +LCRYPTO_ALIAS(EC_GFp_mont_method); diff --git a/lib/libcrypto/ec/ecp_smpl.c b/lib/libcrypto/ec/ecp_smpl.c index d3ee9f5d9..9aa9af11f 100644 --- a/lib/libcrypto/ec/ecp_smpl.c +++ b/lib/libcrypto/ec/ecp_smpl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecp_smpl.c,v 1.45 2023/06/30 18:19:35 tb Exp $ */ +/* $OpenBSD: ecp_smpl.c,v 1.46 2023/07/07 13:54:45 beck Exp $ */ /* Includes code written by Lenka Fibikova * for the OpenSSL project. * Includes code written by Bodo Moeller for the OpenSSL project. @@ -1604,3 +1604,4 @@ EC_GFp_simple_method(void) { return &ec_GFp_simple_method; } +LCRYPTO_ALIAS(EC_GFp_simple_method); diff --git a/lib/libcrypto/ecdh/ecdh.c b/lib/libcrypto/ecdh/ecdh.c index 117956403..0781c30e0 100644 --- a/lib/libcrypto/ecdh/ecdh.c +++ b/lib/libcrypto/ecdh/ecdh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecdh.c,v 1.3 2023/07/05 17:10:10 tb Exp $ */ +/* $OpenBSD: ecdh.c,v 1.4 2023/07/07 13:54:45 beck Exp $ */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * @@ -264,9 +264,11 @@ ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, } return eckey->meth->compute_key(out, outlen, pub_key, eckey, KDF); } +LCRYPTO_ALIAS(ECDH_compute_key); int ECDH_size(const EC_KEY *d) { return (EC_GROUP_get_degree(EC_KEY_get0_group(d)) + 7) / 8; } +LCRYPTO_ALIAS(ECDH_size); diff --git a/lib/libcrypto/ecdh/ech_err.c b/lib/libcrypto/ecdh/ech_err.c index e0cfddfe9..1b194fe0f 100644 --- a/lib/libcrypto/ecdh/ech_err.c +++ b/lib/libcrypto/ecdh/ech_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ech_err.c,v 1.7 2022/07/12 14:42:49 kn Exp $ */ +/* $OpenBSD: ech_err.c,v 1.8 2023/07/07 13:54:45 beck Exp $ */ /* ==================================================================== * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * @@ -91,3 +91,4 @@ ERR_load_ECDH_strings(void) } #endif } +LCRYPTO_ALIAS(ERR_load_ECDH_strings); diff --git a/lib/libcrypto/ecdh/ech_lib.c b/lib/libcrypto/ecdh/ech_lib.c index 52019b01c..c8e5744c0 100644 --- a/lib/libcrypto/ecdh/ech_lib.c +++ b/lib/libcrypto/ecdh/ech_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ech_lib.c,v 1.23 2023/07/05 08:39:40 tb Exp $ */ +/* $OpenBSD: ech_lib.c,v 1.24 2023/07/07 13:54:45 beck Exp $ */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * @@ -98,12 +98,14 @@ ECDH_OpenSSL(void) { return &openssl_ecdh_meth; } +LCRYPTO_ALIAS(ECDH_OpenSSL); void ECDH_set_default_method(const ECDH_METHOD *meth) { default_ECDH_method = meth; } +LCRYPTO_ALIAS(ECDH_set_default_method); const ECDH_METHOD * ECDH_get_default_method(void) @@ -113,12 +115,14 @@ ECDH_get_default_method(void) } return default_ECDH_method; } +LCRYPTO_ALIAS(ECDH_get_default_method); int ECDH_set_method(EC_KEY *eckey, const ECDH_METHOD *meth) { return 0; } +LCRYPTO_ALIAS(ECDH_set_method); int ECDH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, @@ -126,15 +130,18 @@ ECDH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, { return -1; } +LCRYPTO_ALIAS(ECDH_get_ex_new_index); int ECDH_set_ex_data(EC_KEY *d, int idx, void *arg) { return 0; } +LCRYPTO_ALIAS(ECDH_set_ex_data); void * ECDH_get_ex_data(EC_KEY *d, int idx) { return NULL; } +LCRYPTO_ALIAS(ECDH_get_ex_data); diff --git a/lib/libcrypto/ecdsa/ecdsa.c b/lib/libcrypto/ecdsa/ecdsa.c index b9c7ea638..5a93b8463 100644 --- a/lib/libcrypto/ecdsa/ecdsa.c +++ b/lib/libcrypto/ecdsa/ecdsa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecdsa.c,v 1.10 2023/07/05 17:10:10 tb Exp $ */ +/* $OpenBSD: ecdsa.c,v 1.11 2023/07/07 13:54:45 beck Exp $ */ /* ==================================================================== * Copyright (c) 2000-2002 The OpenSSL Project. All rights reserved. * @@ -104,24 +104,28 @@ d2i_ECDSA_SIG(ECDSA_SIG **a, const unsigned char **in, long len) return (ECDSA_SIG *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &ECDSA_SIG_it); } +LCRYPTO_ALIAS(d2i_ECDSA_SIG); int i2d_ECDSA_SIG(const ECDSA_SIG *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &ECDSA_SIG_it); } +LCRYPTO_ALIAS(i2d_ECDSA_SIG); ECDSA_SIG * ECDSA_SIG_new(void) { return (ECDSA_SIG *)ASN1_item_new(&ECDSA_SIG_it); } +LCRYPTO_ALIAS(ECDSA_SIG_new); void ECDSA_SIG_free(ECDSA_SIG *a) { ASN1_item_free((ASN1_VALUE *)a, &ECDSA_SIG_it); } +LCRYPTO_ALIAS(ECDSA_SIG_free); void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps) @@ -131,18 +135,21 @@ ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps) if (ps != NULL) *ps = sig->s; } +LCRYPTO_ALIAS(ECDSA_SIG_get0); const BIGNUM * ECDSA_SIG_get0_r(const ECDSA_SIG *sig) { return sig->r; } +LCRYPTO_ALIAS(ECDSA_SIG_get0_r); const BIGNUM * ECDSA_SIG_get0_s(const ECDSA_SIG *sig) { return sig->s; } +LCRYPTO_ALIAS(ECDSA_SIG_get0_s); int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s) @@ -156,6 +163,7 @@ ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s) sig->s = s; return 1; } +LCRYPTO_ALIAS(ECDSA_SIG_set0); int ECDSA_size(const EC_KEY *r) @@ -183,6 +191,7 @@ ECDSA_size(const EC_KEY *r) err: return ret; } +LCRYPTO_ALIAS(ECDSA_size); /* * FIPS 186-5, section 6.4.1, step 2: convert hashed message into an integer. @@ -751,6 +760,7 @@ ECDSA_do_sign(const unsigned char *digest, int digest_len, EC_KEY *key) { return ECDSA_do_sign_ex(digest, digest_len, NULL, NULL, key); } +LCRYPTO_ALIAS(ECDSA_do_sign); ECDSA_SIG * ECDSA_do_sign_ex(const unsigned char *digest, int digest_len, @@ -762,6 +772,7 @@ ECDSA_do_sign_ex(const unsigned char *digest, int digest_len, } return key->meth->sign_sig(digest, digest_len, kinv, out_r, key); } +LCRYPTO_ALIAS(ECDSA_do_sign_ex); int ECDSA_sign(int type, const unsigned char *digest, int digest_len, @@ -770,6 +781,7 @@ ECDSA_sign(int type, const unsigned char *digest, int digest_len, return ECDSA_sign_ex(type, digest, digest_len, signature, signature_len, NULL, NULL, key); } +LCRYPTO_ALIAS(ECDSA_sign); int ECDSA_sign_ex(int type, const unsigned char *digest, int digest_len, @@ -783,6 +795,7 @@ ECDSA_sign_ex(int type, const unsigned char *digest, int digest_len, return key->meth->sign(type, digest, digest_len, signature, signature_len, kinv, r, key); } +LCRYPTO_ALIAS(ECDSA_sign_ex); int ECDSA_sign_setup(EC_KEY *key, BN_CTX *in_ctx, BIGNUM **out_kinv, @@ -794,6 +807,7 @@ ECDSA_sign_setup(EC_KEY *key, BN_CTX *in_ctx, BIGNUM **out_kinv, } return key->meth->sign_setup(key, in_ctx, out_kinv, out_r); } +LCRYPTO_ALIAS(ECDSA_sign_setup); int ECDSA_do_verify(const unsigned char *digest, int digest_len, @@ -805,6 +819,7 @@ ECDSA_do_verify(const unsigned char *digest, int digest_len, } return key->meth->verify_sig(digest, digest_len, sig, key); } +LCRYPTO_ALIAS(ECDSA_do_verify); int ECDSA_verify(int type, const unsigned char *digest, int digest_len, @@ -816,3 +831,4 @@ ECDSA_verify(int type, const unsigned char *digest, int digest_len, } return key->meth->verify(type, digest, digest_len, sigbuf, sig_len, key); } +LCRYPTO_ALIAS(ECDSA_verify); diff --git a/lib/libcrypto/ecdsa/ecs_err.c b/lib/libcrypto/ecdsa/ecs_err.c index c839c3522..54d2f3f6e 100644 --- a/lib/libcrypto/ecdsa/ecs_err.c +++ b/lib/libcrypto/ecdsa/ecs_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecs_err.c,v 1.7 2022/07/12 14:42:49 kn Exp $ */ +/* $OpenBSD: ecs_err.c,v 1.8 2023/07/07 13:54:45 beck Exp $ */ /* ==================================================================== * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * @@ -94,3 +94,4 @@ ERR_load_ECDSA_strings(void) } #endif } +LCRYPTO_ALIAS(ERR_load_ECDSA_strings); diff --git a/lib/libcrypto/ecdsa/ecs_lib.c b/lib/libcrypto/ecdsa/ecs_lib.c index ed02b552c..e3e67ba07 100644 --- a/lib/libcrypto/ecdsa/ecs_lib.c +++ b/lib/libcrypto/ecdsa/ecs_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecs_lib.c,v 1.24 2023/07/05 11:37:46 tb Exp $ */ +/* $OpenBSD: ecs_lib.c,v 1.25 2023/07/07 13:54:45 beck Exp $ */ /* ==================================================================== * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. * @@ -80,12 +80,14 @@ ECDSA_OpenSSL(void) { return &openssl_ecdsa_meth; } +LCRYPTO_ALIAS(ECDSA_OpenSSL); void ECDSA_set_default_method(const ECDSA_METHOD *meth) { default_ECDSA_method = meth; } +LCRYPTO_ALIAS(ECDSA_set_default_method); const ECDSA_METHOD * ECDSA_get_default_method(void) @@ -95,12 +97,14 @@ ECDSA_get_default_method(void) } return default_ECDSA_method; } +LCRYPTO_ALIAS(ECDSA_get_default_method); int ECDSA_set_method(EC_KEY *eckey, const ECDSA_METHOD *meth) { return 0; } +LCRYPTO_ALIAS(ECDSA_set_method); int ECDSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, @@ -108,15 +112,18 @@ ECDSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, { return -1; } +LCRYPTO_ALIAS(ECDSA_get_ex_new_index); int ECDSA_set_ex_data(EC_KEY *d, int idx, void *arg) { return 0; } +LCRYPTO_ALIAS(ECDSA_set_ex_data); void * ECDSA_get_ex_data(EC_KEY *d, int idx) { return NULL; } +LCRYPTO_ALIAS(ECDSA_get_ex_data); diff --git a/lib/libcrypto/err/err.c b/lib/libcrypto/err/err.c index 365eae0e9..8fbeea715 100644 --- a/lib/libcrypto/err/err.c +++ b/lib/libcrypto/err/err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: err.c,v 1.52 2023/04/09 19:10:23 tb Exp $ */ +/* $OpenBSD: err.c,v 1.54 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -308,6 +308,7 @@ ERR_get_implementation(void) err_fns_check(); return err_fns; } +LCRYPTO_ALIAS(ERR_get_implementation); int ERR_set_implementation(const ERR_FNS *fns) @@ -324,6 +325,7 @@ ERR_set_implementation(const ERR_FNS *fns) CRYPTO_w_unlock(CRYPTO_LOCK_ERR); return ret; } +LCRYPTO_ALIAS(ERR_set_implementation); /* These are the callbacks provided to "lh_new()" when creating the LHASH tables * internal to the "err_defaults" implementation. */ @@ -685,6 +687,7 @@ ERR_load_ERR_strings(void) (void) pthread_once(&once, ERR_load_ERR_strings_internal); } +LCRYPTO_ALIAS(ERR_load_ERR_strings); static void err_load_strings(int lib, ERR_STRING_DATA *str) @@ -703,6 +706,7 @@ ERR_load_strings(int lib, ERR_STRING_DATA *str) ERR_load_ERR_strings(); err_load_strings(lib, str); } +LCRYPTO_ALIAS(ERR_load_strings); void ERR_unload_strings(int lib, ERR_STRING_DATA *str) @@ -717,6 +721,7 @@ ERR_unload_strings(int lib, ERR_STRING_DATA *str) str++; } } +LCRYPTO_ALIAS(ERR_unload_strings); void ERR_free_strings(void) @@ -727,6 +732,7 @@ ERR_free_strings(void) err_fns_check(); ERRFN(err_del)(); } +LCRYPTO_ALIAS(ERR_free_strings); /********************************************************/ @@ -748,6 +754,7 @@ ERR_put_error(int lib, int func, int reason, const char *file, int line) err_clear_data(es, es->top); errno = save_errno; } +LCRYPTO_ALIAS(ERR_put_error); void ERR_clear_error(void) @@ -762,6 +769,7 @@ ERR_clear_error(void) } es->top = es->bottom = 0; } +LCRYPTO_ALIAS(ERR_clear_error); unsigned long @@ -769,12 +777,14 @@ ERR_get_error(void) { return (get_error_values(1, 0, NULL, NULL, NULL, NULL)); } +LCRYPTO_ALIAS(ERR_get_error); unsigned long ERR_get_error_line(const char **file, int *line) { return (get_error_values(1, 0, file, line, NULL, NULL)); } +LCRYPTO_ALIAS(ERR_get_error_line); unsigned long ERR_get_error_line_data(const char **file, int *line, @@ -782,6 +792,7 @@ ERR_get_error_line_data(const char **file, int *line, { return (get_error_values(1, 0, file, line, data, flags)); } +LCRYPTO_ALIAS(ERR_get_error_line_data); unsigned long @@ -789,12 +800,14 @@ ERR_peek_error(void) { return (get_error_values(0, 0, NULL, NULL, NULL, NULL)); } +LCRYPTO_ALIAS(ERR_peek_error); unsigned long ERR_peek_error_line(const char **file, int *line) { return (get_error_values(0, 0, file, line, NULL, NULL)); } +LCRYPTO_ALIAS(ERR_peek_error_line); unsigned long ERR_peek_error_line_data(const char **file, int *line, @@ -802,18 +815,21 @@ ERR_peek_error_line_data(const char **file, int *line, { return (get_error_values(0, 0, file, line, data, flags)); } +LCRYPTO_ALIAS(ERR_peek_error_line_data); unsigned long ERR_peek_last_error(void) { return (get_error_values(0, 1, NULL, NULL, NULL, NULL)); } +LCRYPTO_ALIAS(ERR_peek_last_error); unsigned long ERR_peek_last_error_line(const char **file, int *line) { return (get_error_values(0, 1, file, line, NULL, NULL)); } +LCRYPTO_ALIAS(ERR_peek_last_error_line); unsigned long ERR_peek_last_error_line_data(const char **file, int *line, @@ -821,6 +837,7 @@ ERR_peek_last_error_line_data(const char **file, int *line, { return (get_error_values(0, 1, file, line, data, flags)); } +LCRYPTO_ALIAS(ERR_peek_last_error_line_data); static unsigned long get_error_values(int inc, int top, const char **file, int *line, @@ -942,6 +959,7 @@ ERR_error_string_n(unsigned long e, char *buf, size_t len) } } } +LCRYPTO_ALIAS(ERR_error_string_n); /* BAD for multi-threading: uses a local buffer if ret == NULL */ /* ERR_error_string_n should be used instead for ret != NULL @@ -957,18 +975,21 @@ ERR_error_string(unsigned long e, char *ret) return ret; } +LCRYPTO_ALIAS(ERR_error_string); LHASH_OF(ERR_STRING_DATA) *ERR_get_string_table(void) { err_fns_check(); return ERRFN(err_get)(0); } +LCRYPTO_ALIAS(ERR_get_string_table); LHASH_OF(ERR_STATE) *ERR_get_err_state_table(void) { err_fns_check(); return ERRFN(thread_get)(0); } +LCRYPTO_ALIAS(ERR_get_err_state_table); void ERR_release_err_state_table(LHASH_OF(ERR_STATE) **hash) @@ -976,6 +997,7 @@ ERR_release_err_state_table(LHASH_OF(ERR_STATE) **hash) err_fns_check(); ERRFN(thread_release)(hash); } +LCRYPTO_ALIAS(ERR_release_err_state_table); const char * ERR_lib_error_string(unsigned long e) @@ -992,6 +1014,7 @@ ERR_lib_error_string(unsigned long e) p = ERRFN(err_get_item)(&d); return ((p == NULL) ? NULL : p->string); } +LCRYPTO_ALIAS(ERR_lib_error_string); const char * ERR_func_error_string(unsigned long e) @@ -1006,6 +1029,7 @@ ERR_func_error_string(unsigned long e) p = ERRFN(err_get_item)(&d); return ((p == NULL) ? NULL : p->string); } +LCRYPTO_ALIAS(ERR_func_error_string); const char * ERR_reason_error_string(unsigned long e) @@ -1024,6 +1048,7 @@ ERR_reason_error_string(unsigned long e) } return ((p == NULL) ? NULL : p->string); } +LCRYPTO_ALIAS(ERR_reason_error_string); void ERR_remove_thread_state(const CRYPTO_THREADID *id) @@ -1039,12 +1064,14 @@ ERR_remove_thread_state(const CRYPTO_THREADID *id) * items reaches zero. */ ERRFN(thread_del_item)(&tmp); } +LCRYPTO_ALIAS(ERR_remove_thread_state); void ERR_remove_state(unsigned long pid) { ERR_remove_thread_state(NULL); } +LCRYPTO_ALIAS(ERR_remove_state); ERR_STATE * ERR_get_state(void) @@ -1084,6 +1111,7 @@ ERR_get_state(void) } return ret; } +LCRYPTO_ALIAS(ERR_get_state); int ERR_get_next_error_library(void) @@ -1091,6 +1119,7 @@ ERR_get_next_error_library(void) err_fns_check(); return ERRFN(get_next_lib)(); } +LCRYPTO_ALIAS(ERR_get_next_error_library); void ERR_set_error_data(char *data, int flags) @@ -1108,6 +1137,7 @@ ERR_set_error_data(char *data, int flags) es->err_data[i] = data; es->err_data_flags[i] = flags; } +LCRYPTO_ALIAS(ERR_set_error_data); void ERR_asprintf_error_data(char * format, ...) @@ -1124,6 +1154,7 @@ ERR_asprintf_error_data(char * format, ...) else ERR_set_error_data(errbuf, ERR_TXT_MALLOCED|ERR_TXT_STRING); } +LCRYPTO_ALIAS(ERR_asprintf_error_data); void ERR_add_error_vdata(int num, va_list args) @@ -1166,6 +1197,7 @@ ERR_set_mark(void) es->err_flags[es->top] |= ERR_FLAG_MARK; return 1; } +LCRYPTO_ALIAS(ERR_set_mark); int ERR_pop_to_mark(void) @@ -1187,6 +1219,7 @@ ERR_pop_to_mark(void) es->err_flags[es->top]&=~ERR_FLAG_MARK; return 1; } +LCRYPTO_ALIAS(ERR_pop_to_mark); void err_clear_last_constant_time(int clear) diff --git a/lib/libcrypto/err/err_all.c b/lib/libcrypto/err/err_all.c index 9a46e93c2..12a0fcd32 100644 --- a/lib/libcrypto/err/err_all.c +++ b/lib/libcrypto/err/err_all.c @@ -1,4 +1,4 @@ -/* $OpenBSD: err_all.c,v 1.28 2023/06/11 05:35:43 tb Exp $ */ +/* $OpenBSD: err_all.c,v 1.29 2023/07/07 13:54:45 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -174,3 +174,4 @@ ERR_load_crypto_strings(void) static pthread_once_t loaded = PTHREAD_ONCE_INIT; (void) pthread_once(&loaded, ERR_load_crypto_strings_internal); } +LCRYPTO_ALIAS(ERR_load_crypto_strings); diff --git a/lib/libcrypto/err/err_prn.c b/lib/libcrypto/err/err_prn.c index 6b5c455f0..d60cfdcb9 100644 --- a/lib/libcrypto/err/err_prn.c +++ b/lib/libcrypto/err/err_prn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: err_prn.c,v 1.19 2022/01/07 09:02:18 tb Exp $ */ +/* $OpenBSD: err_prn.c,v 1.20 2023/07/07 13:54:45 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -88,6 +88,7 @@ ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u), void *u) break; /* abort outputting the error report */ } } +LCRYPTO_ALIAS(ERR_print_errors_cb); static int print_fp(const char *str, size_t len, void *fp) @@ -105,6 +106,7 @@ ERR_print_errors_fp(FILE *fp) { ERR_print_errors_cb(print_fp, fp); } +LCRYPTO_ALIAS(ERR_print_errors_fp); static int print_bio(const char *str, size_t len, void *bp) @@ -117,3 +119,4 @@ ERR_print_errors(BIO *bp) { ERR_print_errors_cb(print_bio, bp); } +LCRYPTO_ALIAS(ERR_print_errors); diff --git a/lib/libcrypto/evp/bio_b64.c b/lib/libcrypto/evp/bio_b64.c index 8880a2837..3c47628f5 100644 --- a/lib/libcrypto/evp/bio_b64.c +++ b/lib/libcrypto/evp/bio_b64.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bio_b64.c,v 1.26 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: bio_b64.c,v 1.28 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/bio_enc.c b/lib/libcrypto/evp/bio_enc.c index 098b1ea32..d2132adb4 100644 --- a/lib/libcrypto/evp/bio_enc.c +++ b/lib/libcrypto/evp/bio_enc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bio_enc.c,v 1.27 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: bio_enc.c,v 1.29 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/bio_md.c b/lib/libcrypto/evp/bio_md.c index 4b7ca4455..ccfcd1ea1 100644 --- a/lib/libcrypto/evp/bio_md.c +++ b/lib/libcrypto/evp/bio_md.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bio_md.c,v 1.19 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: bio_md.c,v 1.21 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/c_all.c b/lib/libcrypto/evp/c_all.c index 936d7e810..10e35dd7a 100644 --- a/lib/libcrypto/evp/c_all.c +++ b/lib/libcrypto/evp/c_all.c @@ -1,4 +1,4 @@ -/* $OpenBSD: c_all.c,v 1.29 2023/04/25 15:48:48 tb Exp $ */ +/* $OpenBSD: c_all.c,v 1.31 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/cipher_method_lib.c b/lib/libcrypto/evp/cipher_method_lib.c index 55dc6b788..c3f510fcc 100644 --- a/lib/libcrypto/evp/cipher_method_lib.c +++ b/lib/libcrypto/evp/cipher_method_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cipher_method_lib.c,v 1.8 2023/03/01 11:27:37 tb Exp $ */ +/* $OpenBSD: cipher_method_lib.c,v 1.10 2023/07/07 19:37:53 beck Exp $ */ /* * Written by Richard Levitte (levitte@openssl.org) for the OpenSSL project * 2015. diff --git a/lib/libcrypto/evp/digest.c b/lib/libcrypto/evp/digest.c index 7c129f025..ca3fb219c 100644 --- a/lib/libcrypto/evp/digest.c +++ b/lib/libcrypto/evp/digest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: digest.c,v 1.36 2022/12/26 07:18:52 jmc Exp $ */ +/* $OpenBSD: digest.c,v 1.38 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/e_aes.c b/lib/libcrypto/evp/e_aes.c index 790b26384..3d3b1a9d6 100644 --- a/lib/libcrypto/evp/e_aes.c +++ b/lib/libcrypto/evp/e_aes.c @@ -1,4 +1,4 @@ -/* $OpenBSD: e_aes.c,v 1.51 2023/03/01 11:16:06 tb Exp $ */ +/* $OpenBSD: e_aes.c,v 1.53 2023/07/07 19:37:53 beck Exp $ */ /* ==================================================================== * Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved. * diff --git a/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c b/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c index 9cde38615..09a73da74 100644 --- a/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c +++ b/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: e_aes_cbc_hmac_sha1.c,v 1.17 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: e_aes_cbc_hmac_sha1.c,v 1.19 2023/07/07 19:37:53 beck Exp $ */ /* ==================================================================== * Copyright (c) 2011-2013 The OpenSSL Project. All rights reserved. * diff --git a/lib/libcrypto/evp/e_bf.c b/lib/libcrypto/evp/e_bf.c index c2ab3178a..9146a531e 100644 --- a/lib/libcrypto/evp/e_bf.c +++ b/lib/libcrypto/evp/e_bf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: e_bf.c,v 1.15 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: e_bf.c,v 1.17 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/e_camellia.c b/lib/libcrypto/evp/e_camellia.c index 884f8cef2..cec7649e3 100644 --- a/lib/libcrypto/evp/e_camellia.c +++ b/lib/libcrypto/evp/e_camellia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: e_camellia.c,v 1.16 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: e_camellia.c,v 1.18 2023/07/07 19:37:53 beck Exp $ */ /* ==================================================================== * Copyright (c) 2006 The OpenSSL Project. All rights reserved. * diff --git a/lib/libcrypto/evp/e_cast.c b/lib/libcrypto/evp/e_cast.c index 98683e1d0..a0e52dfdf 100644 --- a/lib/libcrypto/evp/e_cast.c +++ b/lib/libcrypto/evp/e_cast.c @@ -1,4 +1,4 @@ -/* $OpenBSD: e_cast.c,v 1.14 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: e_cast.c,v 1.16 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/e_chacha.c b/lib/libcrypto/evp/e_chacha.c index f27ed1d37..add048847 100644 --- a/lib/libcrypto/evp/e_chacha.c +++ b/lib/libcrypto/evp/e_chacha.c @@ -1,4 +1,4 @@ -/* $OpenBSD: e_chacha.c,v 1.10 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: e_chacha.c,v 1.12 2023/07/07 19:37:53 beck Exp $ */ /* * Copyright (c) 2014 Joel Sing * diff --git a/lib/libcrypto/evp/e_chacha20poly1305.c b/lib/libcrypto/evp/e_chacha20poly1305.c index 1bd04c1f1..a17657899 100644 --- a/lib/libcrypto/evp/e_chacha20poly1305.c +++ b/lib/libcrypto/evp/e_chacha20poly1305.c @@ -1,4 +1,4 @@ -/* $OpenBSD: e_chacha20poly1305.c,v 1.28 2023/03/01 11:16:06 tb Exp $ */ +/* $OpenBSD: e_chacha20poly1305.c,v 1.30 2023/07/07 19:37:53 beck Exp $ */ /* * Copyright (c) 2022 Joel Sing diff --git a/lib/libcrypto/evp/e_des.c b/lib/libcrypto/evp/e_des.c index dffabc812..64d098ca1 100644 --- a/lib/libcrypto/evp/e_des.c +++ b/lib/libcrypto/evp/e_des.c @@ -1,4 +1,4 @@ -/* $OpenBSD: e_des.c,v 1.20 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: e_des.c,v 1.22 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/e_des3.c b/lib/libcrypto/evp/e_des3.c index d6c7537ae..3e6c5234c 100644 --- a/lib/libcrypto/evp/e_des3.c +++ b/lib/libcrypto/evp/e_des3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: e_des3.c,v 1.26 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: e_des3.c,v 1.28 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/e_gost2814789.c b/lib/libcrypto/evp/e_gost2814789.c index 6344a11e9..359cf5e4c 100644 --- a/lib/libcrypto/evp/e_gost2814789.c +++ b/lib/libcrypto/evp/e_gost2814789.c @@ -1,4 +1,4 @@ -/* $OpenBSD: e_gost2814789.c,v 1.11 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: e_gost2814789.c,v 1.13 2023/07/07 19:37:53 beck Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov * Copyright (c) 2005-2006 Cryptocom LTD diff --git a/lib/libcrypto/evp/e_idea.c b/lib/libcrypto/evp/e_idea.c index b8349ee9c..b2129dc99 100644 --- a/lib/libcrypto/evp/e_idea.c +++ b/lib/libcrypto/evp/e_idea.c @@ -1,4 +1,4 @@ -/* $OpenBSD: e_idea.c,v 1.18 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: e_idea.c,v 1.20 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/e_null.c b/lib/libcrypto/evp/e_null.c index ddd633dc7..f30c207ff 100644 --- a/lib/libcrypto/evp/e_null.c +++ b/lib/libcrypto/evp/e_null.c @@ -1,4 +1,4 @@ -/* $OpenBSD: e_null.c,v 1.16 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: e_null.c,v 1.18 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/e_rc2.c b/lib/libcrypto/evp/e_rc2.c index 78697d08c..32559e223 100644 --- a/lib/libcrypto/evp/e_rc2.c +++ b/lib/libcrypto/evp/e_rc2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: e_rc2.c,v 1.20 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: e_rc2.c,v 1.22 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/e_rc4.c b/lib/libcrypto/evp/e_rc4.c index 7afc6af9c..2503d3704 100644 --- a/lib/libcrypto/evp/e_rc4.c +++ b/lib/libcrypto/evp/e_rc4.c @@ -1,4 +1,4 @@ -/* $OpenBSD: e_rc4.c,v 1.15 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: e_rc4.c,v 1.17 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/e_rc4_hmac_md5.c b/lib/libcrypto/evp/e_rc4_hmac_md5.c index b3be57d5f..bcf8daea6 100644 --- a/lib/libcrypto/evp/e_rc4_hmac_md5.c +++ b/lib/libcrypto/evp/e_rc4_hmac_md5.c @@ -1,4 +1,4 @@ -/* $OpenBSD: e_rc4_hmac_md5.c,v 1.10 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: e_rc4_hmac_md5.c,v 1.12 2023/07/07 19:37:53 beck Exp $ */ /* ==================================================================== * Copyright (c) 2011 The OpenSSL Project. All rights reserved. * diff --git a/lib/libcrypto/evp/e_sm4.c b/lib/libcrypto/evp/e_sm4.c index 0d3744810..c1664db39 100644 --- a/lib/libcrypto/evp/e_sm4.c +++ b/lib/libcrypto/evp/e_sm4.c @@ -1,4 +1,4 @@ -/* $OpenBSD: e_sm4.c,v 1.7 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: e_sm4.c,v 1.9 2023/07/07 19:37:53 beck Exp $ */ /* * Copyright (c) 2017, 2019 Ribose Inc * diff --git a/lib/libcrypto/evp/e_xcbc_d.c b/lib/libcrypto/evp/e_xcbc_d.c index bbbc3a1ee..32f9f2eaa 100644 --- a/lib/libcrypto/evp/e_xcbc_d.c +++ b/lib/libcrypto/evp/e_xcbc_d.c @@ -1,4 +1,4 @@ -/* $OpenBSD: e_xcbc_d.c,v 1.13 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: e_xcbc_d.c,v 1.15 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/encode.c b/lib/libcrypto/evp/encode.c index 718bdb5fc..c62a1dea8 100644 --- a/lib/libcrypto/evp/encode.c +++ b/lib/libcrypto/evp/encode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: encode.c,v 1.30 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: encode.c,v 1.32 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/evp_aead.c b/lib/libcrypto/evp/evp_aead.c index 58f1c8722..3579533e5 100644 --- a/lib/libcrypto/evp/evp_aead.c +++ b/lib/libcrypto/evp/evp_aead.c @@ -1,4 +1,4 @@ -/* $OpenBSD: evp_aead.c,v 1.8 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: evp_aead.c,v 1.10 2023/07/07 19:37:53 beck Exp $ */ /* * Copyright (c) 2014, Google Inc. * diff --git a/lib/libcrypto/evp/evp_enc.c b/lib/libcrypto/evp/evp_enc.c index df818e3a6..27f753baa 100644 --- a/lib/libcrypto/evp/evp_enc.c +++ b/lib/libcrypto/evp/evp_enc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: evp_enc.c,v 1.50 2023/03/01 11:16:06 tb Exp $ */ +/* $OpenBSD: evp_enc.c,v 1.52 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/evp_err.c b/lib/libcrypto/evp/evp_err.c index 9cf89f47f..039e17e6c 100644 --- a/lib/libcrypto/evp/evp_err.c +++ b/lib/libcrypto/evp/evp_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: evp_err.c,v 1.30 2022/11/10 15:17:30 jsing Exp $ */ +/* $OpenBSD: evp_err.c,v 1.32 2023/07/07 19:37:53 beck Exp $ */ /* ==================================================================== * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * diff --git a/lib/libcrypto/evp/evp_key.c b/lib/libcrypto/evp/evp_key.c index 6fc8588cd..2f6e7e70c 100644 --- a/lib/libcrypto/evp/evp_key.c +++ b/lib/libcrypto/evp/evp_key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: evp_key.c,v 1.28 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: evp_key.c,v 1.30 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/evp_lib.c b/lib/libcrypto/evp/evp_lib.c index f64842b86..24ce1963d 100644 --- a/lib/libcrypto/evp/evp_lib.c +++ b/lib/libcrypto/evp/evp_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: evp_lib.c,v 1.25 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: evp_lib.c,v 1.27 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/evp_pbe.c b/lib/libcrypto/evp/evp_pbe.c index 565955524..4a23a98f8 100644 --- a/lib/libcrypto/evp/evp_pbe.c +++ b/lib/libcrypto/evp/evp_pbe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: evp_pbe.c,v 1.27 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: evp_pbe.c,v 1.29 2023/07/07 19:37:53 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ diff --git a/lib/libcrypto/evp/evp_pkey.c b/lib/libcrypto/evp/evp_pkey.c index d2fbdee46..9e29a1ae6 100644 --- a/lib/libcrypto/evp/evp_pkey.c +++ b/lib/libcrypto/evp/evp_pkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: evp_pkey.c,v 1.25 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: evp_pkey.c,v 1.27 2023/07/07 19:37:53 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ diff --git a/lib/libcrypto/evp/m_gost2814789.c b/lib/libcrypto/evp/m_gost2814789.c index ca303dab9..9b8a09e5a 100644 --- a/lib/libcrypto/evp/m_gost2814789.c +++ b/lib/libcrypto/evp/m_gost2814789.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m_gost2814789.c,v 1.4 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: m_gost2814789.c,v 1.6 2023/07/07 19:37:53 beck Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov * Copyright (c) 2005-2006 Cryptocom LTD diff --git a/lib/libcrypto/evp/m_gostr341194.c b/lib/libcrypto/evp/m_gostr341194.c index 33e96a5a2..723349a0d 100644 --- a/lib/libcrypto/evp/m_gostr341194.c +++ b/lib/libcrypto/evp/m_gostr341194.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m_gostr341194.c,v 1.5 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: m_gostr341194.c,v 1.7 2023/07/07 19:37:53 beck Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov * Copyright (c) 2005-2006 Cryptocom LTD diff --git a/lib/libcrypto/evp/m_md4.c b/lib/libcrypto/evp/m_md4.c index c1e0256b3..199dba848 100644 --- a/lib/libcrypto/evp/m_md4.c +++ b/lib/libcrypto/evp/m_md4.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m_md4.c,v 1.19 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: m_md4.c,v 1.21 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/m_md5.c b/lib/libcrypto/evp/m_md5.c index b66b25bab..0dfad89aa 100644 --- a/lib/libcrypto/evp/m_md5.c +++ b/lib/libcrypto/evp/m_md5.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m_md5.c,v 1.18 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: m_md5.c,v 1.20 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/m_md5_sha1.c b/lib/libcrypto/evp/m_md5_sha1.c index b1944b881..f4a6600ec 100644 --- a/lib/libcrypto/evp/m_md5_sha1.c +++ b/lib/libcrypto/evp/m_md5_sha1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m_md5_sha1.c,v 1.5 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: m_md5_sha1.c,v 1.7 2023/07/07 19:37:53 beck Exp $ */ /* * Copyright (c) 2017 Joel Sing * diff --git a/lib/libcrypto/evp/m_null.c b/lib/libcrypto/evp/m_null.c index d09c0007f..28634d2da 100644 --- a/lib/libcrypto/evp/m_null.c +++ b/lib/libcrypto/evp/m_null.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m_null.c,v 1.12 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: m_null.c,v 1.14 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/m_ripemd.c b/lib/libcrypto/evp/m_ripemd.c index 896de59d1..638d0cd27 100644 --- a/lib/libcrypto/evp/m_ripemd.c +++ b/lib/libcrypto/evp/m_ripemd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m_ripemd.c,v 1.15 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: m_ripemd.c,v 1.17 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/m_sha1.c b/lib/libcrypto/evp/m_sha1.c index b7f4705d8..c65e0515c 100644 --- a/lib/libcrypto/evp/m_sha1.c +++ b/lib/libcrypto/evp/m_sha1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m_sha1.c,v 1.23 2023/04/16 16:42:06 jsing Exp $ */ +/* $OpenBSD: m_sha1.c,v 1.25 2023/07/07 19:37:53 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/m_sha3.c b/lib/libcrypto/evp/m_sha3.c index 9944ec979..67f94f795 100644 --- a/lib/libcrypto/evp/m_sha3.c +++ b/lib/libcrypto/evp/m_sha3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m_sha3.c,v 1.1 2023/04/16 17:06:19 jsing Exp $ */ +/* $OpenBSD: m_sha3.c,v 1.3 2023/07/07 19:37:53 beck Exp $ */ /* * Copyright (c) 2023 Joel Sing * diff --git a/lib/libcrypto/evp/m_sigver.c b/lib/libcrypto/evp/m_sigver.c index 49b1ce29b..47c01f784 100644 --- a/lib/libcrypto/evp/m_sigver.c +++ b/lib/libcrypto/evp/m_sigver.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m_sigver.c,v 1.11 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: m_sigver.c,v 1.13 2023/07/07 19:37:53 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ diff --git a/lib/libcrypto/evp/m_sm3.c b/lib/libcrypto/evp/m_sm3.c index bf0ef527e..ea30d8d22 100644 --- a/lib/libcrypto/evp/m_sm3.c +++ b/lib/libcrypto/evp/m_sm3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m_sm3.c,v 1.4 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: m_sm3.c,v 1.6 2023/07/07 19:37:53 beck Exp $ */ /* * Copyright (c) 2018, Ribose Inc * diff --git a/lib/libcrypto/evp/m_streebog.c b/lib/libcrypto/evp/m_streebog.c index 5a0dece59..48fa65864 100644 --- a/lib/libcrypto/evp/m_streebog.c +++ b/lib/libcrypto/evp/m_streebog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m_streebog.c,v 1.5 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: m_streebog.c,v 1.7 2023/07/07 19:37:54 beck Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov * Copyright (c) 2005-2006 Cryptocom LTD diff --git a/lib/libcrypto/evp/m_wp.c b/lib/libcrypto/evp/m_wp.c index 2e0b46d5d..44d13b148 100644 --- a/lib/libcrypto/evp/m_wp.c +++ b/lib/libcrypto/evp/m_wp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m_wp.c,v 1.11 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: m_wp.c,v 1.13 2023/07/07 19:37:54 beck Exp $ */ #include diff --git a/lib/libcrypto/evp/names.c b/lib/libcrypto/evp/names.c index 10ce13bb8..f7864f595 100644 --- a/lib/libcrypto/evp/names.c +++ b/lib/libcrypto/evp/names.c @@ -1,4 +1,4 @@ -/* $OpenBSD: names.c,v 1.17 2023/06/29 06:11:33 tb Exp $ */ +/* $OpenBSD: names.c,v 1.19 2023/07/07 19:37:54 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/p5_crpt.c b/lib/libcrypto/evp/p5_crpt.c index e85a60f50..d26439ad2 100644 --- a/lib/libcrypto/evp/p5_crpt.c +++ b/lib/libcrypto/evp/p5_crpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p5_crpt.c,v 1.21 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: p5_crpt.c,v 1.23 2023/07/07 19:37:54 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ diff --git a/lib/libcrypto/evp/p5_crpt2.c b/lib/libcrypto/evp/p5_crpt2.c index 6c0cf529a..3c66af931 100644 --- a/lib/libcrypto/evp/p5_crpt2.c +++ b/lib/libcrypto/evp/p5_crpt2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p5_crpt2.c,v 1.25 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: p5_crpt2.c,v 1.27 2023/07/07 19:37:54 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ diff --git a/lib/libcrypto/evp/p_dec.c b/lib/libcrypto/evp/p_dec.c index 33dd30191..d55b48b77 100644 --- a/lib/libcrypto/evp/p_dec.c +++ b/lib/libcrypto/evp/p_dec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p_dec.c,v 1.13 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: p_dec.c,v 1.15 2023/07/07 19:37:54 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/p_enc.c b/lib/libcrypto/evp/p_enc.c index 4685f55ca..1abaf0b26 100644 --- a/lib/libcrypto/evp/p_enc.c +++ b/lib/libcrypto/evp/p_enc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p_enc.c,v 1.13 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: p_enc.c,v 1.15 2023/07/07 19:37:54 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/p_lib.c b/lib/libcrypto/evp/p_lib.c index e1760122c..85e7978ff 100644 --- a/lib/libcrypto/evp/p_lib.c +++ b/lib/libcrypto/evp/p_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p_lib.c,v 1.32 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: p_lib.c,v 1.34 2023/07/07 19:37:54 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/p_open.c b/lib/libcrypto/evp/p_open.c index bce900b9a..d18548e3f 100644 --- a/lib/libcrypto/evp/p_open.c +++ b/lib/libcrypto/evp/p_open.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p_open.c,v 1.21 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: p_open.c,v 1.23 2023/07/07 19:37:54 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/p_seal.c b/lib/libcrypto/evp/p_seal.c index 8b9740fbc..b98da9436 100644 --- a/lib/libcrypto/evp/p_seal.c +++ b/lib/libcrypto/evp/p_seal.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p_seal.c,v 1.14 2014/10/22 13:02:04 jsing Exp $ */ +/* $OpenBSD: p_seal.c,v 1.16 2023/07/07 19:37:54 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/p_sign.c b/lib/libcrypto/evp/p_sign.c index 1f78d1efe..f7c21178a 100644 --- a/lib/libcrypto/evp/p_sign.c +++ b/lib/libcrypto/evp/p_sign.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p_sign.c,v 1.17 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: p_sign.c,v 1.19 2023/07/07 19:37:54 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/p_verify.c b/lib/libcrypto/evp/p_verify.c index 545715325..da7ab5425 100644 --- a/lib/libcrypto/evp/p_verify.c +++ b/lib/libcrypto/evp/p_verify.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p_verify.c,v 1.16 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: p_verify.c,v 1.18 2023/07/07 19:37:54 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/evp/pmeth_fn.c b/lib/libcrypto/evp/pmeth_fn.c index cab1dfab6..a304752e6 100644 --- a/lib/libcrypto/evp/pmeth_fn.c +++ b/lib/libcrypto/evp/pmeth_fn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmeth_fn.c,v 1.7 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: pmeth_fn.c,v 1.9 2023/07/07 19:37:54 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ diff --git a/lib/libcrypto/evp/pmeth_gn.c b/lib/libcrypto/evp/pmeth_gn.c index d31bb7c0b..b4c0395d9 100644 --- a/lib/libcrypto/evp/pmeth_gn.c +++ b/lib/libcrypto/evp/pmeth_gn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmeth_gn.c,v 1.11 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: pmeth_gn.c,v 1.13 2023/07/07 19:37:54 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ diff --git a/lib/libcrypto/evp/pmeth_lib.c b/lib/libcrypto/evp/pmeth_lib.c index 3341ba1e0..b480a574f 100644 --- a/lib/libcrypto/evp/pmeth_lib.c +++ b/lib/libcrypto/evp/pmeth_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmeth_lib.c,v 1.31 2023/06/20 14:14:00 tb Exp $ */ +/* $OpenBSD: pmeth_lib.c,v 1.33 2023/07/07 19:37:54 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ diff --git a/lib/libcrypto/ex_data.c b/lib/libcrypto/ex_data.c index 0a9c59121..71b2fc397 100644 --- a/lib/libcrypto/ex_data.c +++ b/lib/libcrypto/ex_data.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ex_data.c,v 1.21 2023/06/16 11:20:01 tb Exp $ */ +/* $OpenBSD: ex_data.c,v 1.22 2023/07/08 08:28:23 beck Exp $ */ /* * Overhaul notes; @@ -217,6 +217,7 @@ CRYPTO_get_ex_data_implementation(void) IMPL_CHECK return impl; } +LCRYPTO_ALIAS(CRYPTO_get_ex_data_implementation); int CRYPTO_set_ex_data_implementation(const CRYPTO_EX_DATA_IMPL *i) @@ -230,6 +231,7 @@ CRYPTO_set_ex_data_implementation(const CRYPTO_EX_DATA_IMPL *i) CRYPTO_w_unlock(CRYPTO_LOCK_EX_DATA); return toret; } +LCRYPTO_ALIAS(CRYPTO_set_ex_data_implementation); /****************************************************************************/ /* Interal (default) implementation of "ex_data" support. API functions are @@ -547,6 +549,7 @@ CRYPTO_ex_data_new_class(void) IMPL_CHECK return EX_IMPL(new_class)(); } +LCRYPTO_ALIAS(CRYPTO_ex_data_new_class); /* Release all "ex_data" state to prevent memory leaks. This can't be made * thread-safe without overhauling a lot of stuff, and shouldn't really be @@ -558,6 +561,7 @@ CRYPTO_cleanup_all_ex_data(void) IMPL_CHECK EX_IMPL(cleanup)(); } +LCRYPTO_ALIAS(CRYPTO_cleanup_all_ex_data); /* Inside an existing class, get/register a new index. */ int @@ -571,6 +575,7 @@ CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, argl, argp, new_func, dup_func, free_func); return ret; } +LCRYPTO_ALIAS(CRYPTO_get_ex_new_index); /* Initialise a new CRYPTO_EX_DATA for use in a particular class - including * calling new() callbacks for each index in the class used by this variable */ @@ -580,6 +585,7 @@ CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad) IMPL_CHECK return EX_IMPL(new_ex_data)(class_index, obj, ad); } +LCRYPTO_ALIAS(CRYPTO_new_ex_data); /* Duplicate a CRYPTO_EX_DATA variable - including calling dup() callbacks for * each index in the class used by this variable */ @@ -589,6 +595,7 @@ CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from) IMPL_CHECK return EX_IMPL(dup_ex_data)(class_index, to, from); } +LCRYPTO_ALIAS(CRYPTO_dup_ex_data); /* Cleanup a CRYPTO_EX_DATA variable - including calling free() callbacks for * each index in the class used by this variable */ @@ -598,6 +605,7 @@ CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad) IMPL_CHECK EX_IMPL(free_ex_data)(class_index, obj, ad); } +LCRYPTO_ALIAS(CRYPTO_free_ex_data); /* For a given CRYPTO_EX_DATA variable, set the value corresponding to a * particular index in the class used by this variable */ @@ -624,6 +632,7 @@ CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val) sk_void_set(ad->sk, idx, val); return (1); } +LCRYPTO_ALIAS(CRYPTO_set_ex_data); /* For a given CRYPTO_EX_DATA_ variable, get the value corresponding to a * particular index in the class used by this variable */ @@ -637,3 +646,4 @@ CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) else return (sk_void_value(ad->sk, idx)); } +LCRYPTO_ALIAS(CRYPTO_get_ex_data); diff --git a/lib/libcrypto/gost/gost2814789.c b/lib/libcrypto/gost/gost2814789.c index 1e0f17da4..dac3a8eab 100644 --- a/lib/libcrypto/gost/gost2814789.c +++ b/lib/libcrypto/gost/gost2814789.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gost2814789.c,v 1.8 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: gost2814789.c,v 1.9 2023/07/08 14:30:44 beck Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov * Copyright (c) 2005-2006 Cryptocom LTD @@ -180,6 +180,7 @@ Gost2814789_ecb_encrypt(const unsigned char *in, unsigned char *out, else Gost2814789_decrypt(in, out, key); } +LCRYPTO_ALIAS(Gost2814789_ecb_encrypt); static inline void Gost2814789_encrypt_mesh(unsigned char *iv, GOST2814789_KEY *key) @@ -318,6 +319,7 @@ Gost2814789_cfb64_encrypt(const unsigned char *in, unsigned char *out, *num = n; } } +LCRYPTO_ALIAS(Gost2814789_cfb64_encrypt); static inline void Gost2814789_cnt_next(unsigned char *ivec, unsigned char *out, @@ -403,6 +405,7 @@ Gost2814789_cnt_encrypt(const unsigned char *in, unsigned char *out, size_t len, *num=n; } +LCRYPTO_ALIAS(Gost2814789_cnt_encrypt); int GOST2814789IMIT_Init(GOST2814789IMIT_CTX *c, int nid) @@ -411,6 +414,7 @@ GOST2814789IMIT_Init(GOST2814789IMIT_CTX *c, int nid) memset(c->mac, 0, 8); return Gost2814789_set_sbox(&c->cipher, nid); } +LCRYPTO_ALIAS(GOST2814789IMIT_Init); static void GOST2814789IMIT_block_data_order(GOST2814789IMIT_CTX *ctx, @@ -435,6 +439,8 @@ GOST2814789IMIT_block_data_order(GOST2814789IMIT_CTX *ctx, #define HASH_BLOCK_DATA_ORDER GOST2814789IMIT_block_data_order #include "md32_common.h" +LCRYPTO_ALIAS(GOST2814789IMIT_Update); +LCRYPTO_ALIAS(GOST2814789IMIT_Transform); int GOST2814789IMIT_Final(unsigned char *md, GOST2814789IMIT_CTX *c) @@ -450,6 +456,7 @@ GOST2814789IMIT_Final(unsigned char *md, GOST2814789IMIT_CTX *c) memcpy(md, c->mac, 4); return 1; } +LCRYPTO_ALIAS(GOST2814789IMIT_Final); unsigned char * GOST2814789IMIT(const unsigned char *d, size_t n, unsigned char *md, int nid, @@ -468,5 +475,6 @@ GOST2814789IMIT(const unsigned char *d, size_t n, unsigned char *md, int nid, explicit_bzero(&c, sizeof(c)); return (md); } +LCRYPTO_ALIAS(GOST2814789IMIT); #endif diff --git a/lib/libcrypto/gost/gost89_params.c b/lib/libcrypto/gost/gost89_params.c index 9c4a97ee6..ef9c9cde6 100644 --- a/lib/libcrypto/gost/gost89_params.c +++ b/lib/libcrypto/gost/gost89_params.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gost89_params.c,v 1.3 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: gost89_params.c,v 1.4 2023/07/08 14:30:44 beck Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov * Copyright (c) 2005-2006 Cryptocom LTD @@ -211,6 +211,7 @@ Gost2814789_set_sbox(GOST2814789_KEY *key, int nid) return 1; } +LCRYPTO_ALIAS(Gost2814789_set_sbox); int Gost2814789_set_key(GOST2814789_KEY *key, const unsigned char *userKey, @@ -228,6 +229,7 @@ Gost2814789_set_key(GOST2814789_KEY *key, const unsigned char *userKey, return 1; } +LCRYPTO_ALIAS(Gost2814789_set_key); void Gost2814789_cryptopro_key_mesh(GOST2814789_KEY *key) diff --git a/lib/libcrypto/gost/gost_asn1.c b/lib/libcrypto/gost/gost_asn1.c index d83ded55b..28e3a58e5 100644 --- a/lib/libcrypto/gost/gost_asn1.c +++ b/lib/libcrypto/gost/gost_asn1.c @@ -273,23 +273,27 @@ d2i_GOST_CIPHER_PARAMS(GOST_CIPHER_PARAMS **a, const unsigned char **in, long le return (GOST_CIPHER_PARAMS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &GOST_CIPHER_PARAMS_it); } +LCRYPTO_ALIAS(d2i_GOST_CIPHER_PARAMS); int i2d_GOST_CIPHER_PARAMS(GOST_CIPHER_PARAMS *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &GOST_CIPHER_PARAMS_it); } +LCRYPTO_ALIAS(i2d_GOST_CIPHER_PARAMS); GOST_CIPHER_PARAMS * GOST_CIPHER_PARAMS_new(void) { return (GOST_CIPHER_PARAMS *)ASN1_item_new(&GOST_CIPHER_PARAMS_it); } +LCRYPTO_ALIAS(GOST_CIPHER_PARAMS_new); void GOST_CIPHER_PARAMS_free(GOST_CIPHER_PARAMS *a) { ASN1_item_free((ASN1_VALUE *)a, &GOST_CIPHER_PARAMS_it); } +LCRYPTO_ALIAS(GOST_CIPHER_PARAMS_free); #endif diff --git a/lib/libcrypto/gost/gost_err.c b/lib/libcrypto/gost/gost_err.c index 0c46dbc36..380f60289 100644 --- a/lib/libcrypto/gost/gost_err.c +++ b/lib/libcrypto/gost/gost_err.c @@ -103,3 +103,4 @@ ERR_load_GOST_strings(void) { } #endif } +LCRYPTO_ALIAS(ERR_load_GOST_strings); diff --git a/lib/libcrypto/gost/gostr341001_key.c b/lib/libcrypto/gost/gostr341001_key.c index 62694318d..efc9e5745 100644 --- a/lib/libcrypto/gost/gostr341001_key.c +++ b/lib/libcrypto/gost/gostr341001_key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gostr341001_key.c,v 1.12 2023/03/07 09:27:10 jsing Exp $ */ +/* $OpenBSD: gostr341001_key.c,v 1.13 2023/07/08 14:30:44 beck Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov * Copyright (c) 2005-2006 Cryptocom LTD @@ -88,6 +88,7 @@ GOST_KEY_new(void) ret->digest_nid = NID_undef; return (ret); } +LCRYPTO_ALIAS(GOST_KEY_new); void GOST_KEY_free(GOST_KEY *r) @@ -107,6 +108,7 @@ GOST_KEY_free(GOST_KEY *r) freezero(r, sizeof(GOST_KEY)); } +LCRYPTO_ALIAS(GOST_KEY_free); int GOST_KEY_check_key(const GOST_KEY *key) @@ -176,6 +178,7 @@ err: EC_POINT_free(point); return (ok); } +LCRYPTO_ALIAS(GOST_KEY_check_key); int GOST_KEY_set_public_key_affine_coordinates(GOST_KEY *key, BIGNUM *x, BIGNUM *y) @@ -232,12 +235,14 @@ err: return ok; } +LCRYPTO_ALIAS(GOST_KEY_set_public_key_affine_coordinates); const EC_GROUP * GOST_KEY_get0_group(const GOST_KEY *key) { return key->group; } +LCRYPTO_ALIAS(GOST_KEY_get0_group); int GOST_KEY_set_group(GOST_KEY *key, const EC_GROUP *group) @@ -246,12 +251,14 @@ GOST_KEY_set_group(GOST_KEY *key, const EC_GROUP *group) key->group = EC_GROUP_dup(group); return (key->group == NULL) ? 0 : 1; } +LCRYPTO_ALIAS(GOST_KEY_set_group); const BIGNUM * GOST_KEY_get0_private_key(const GOST_KEY *key) { return key->priv_key; } +LCRYPTO_ALIAS(GOST_KEY_get0_private_key); int GOST_KEY_set_private_key(GOST_KEY *key, const BIGNUM *priv_key) @@ -260,12 +267,14 @@ GOST_KEY_set_private_key(GOST_KEY *key, const BIGNUM *priv_key) key->priv_key = BN_dup(priv_key); return (key->priv_key == NULL) ? 0 : 1; } +LCRYPTO_ALIAS(GOST_KEY_set_private_key); const EC_POINT * GOST_KEY_get0_public_key(const GOST_KEY *key) { return key->pub_key; } +LCRYPTO_ALIAS(GOST_KEY_get0_public_key); int GOST_KEY_set_public_key(GOST_KEY *key, const EC_POINT *pub_key) @@ -274,12 +283,14 @@ GOST_KEY_set_public_key(GOST_KEY *key, const EC_POINT *pub_key) key->pub_key = EC_POINT_dup(pub_key, key->group); return (key->pub_key == NULL) ? 0 : 1; } +LCRYPTO_ALIAS(GOST_KEY_set_public_key); int GOST_KEY_get_digest(const GOST_KEY *key) { return key->digest_nid; } +LCRYPTO_ALIAS(GOST_KEY_get_digest); int GOST_KEY_set_digest(GOST_KEY *key, int digest_nid) { @@ -292,6 +303,7 @@ GOST_KEY_set_digest(GOST_KEY *key, int digest_nid) return 0; } +LCRYPTO_ALIAS(GOST_KEY_set_digest); size_t GOST_KEY_get_size(const GOST_KEY *r) @@ -318,4 +330,5 @@ GOST_KEY_get_size(const GOST_KEY *r) BN_free(order); return (i); } +LCRYPTO_ALIAS(GOST_KEY_get_size); #endif diff --git a/lib/libcrypto/gost/gostr341194.c b/lib/libcrypto/gost/gostr341194.c index 63058300a..311c30453 100644 --- a/lib/libcrypto/gost/gostr341194.c +++ b/lib/libcrypto/gost/gostr341194.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gostr341194.c,v 1.6 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: gostr341194.c,v 1.7 2023/07/08 14:30:44 beck Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov * Copyright (c) 2005-2006 Cryptocom LTD @@ -205,6 +205,7 @@ GOSTR341194_Init(GOSTR341194_CTX *c, int nid) memset(c, 0, sizeof(*c)); return Gost2814789_set_sbox(&c->cipher, nid); } +LCRYPTO_ALIAS(GOSTR341194_Init); static void GOSTR341194_block_data_order(GOSTR341194_CTX *ctx, const unsigned char *p, @@ -230,6 +231,8 @@ GOSTR341194_block_data_order(GOSTR341194_CTX *ctx, const unsigned char *p, #define HASH_BLOCK_DATA_ORDER GOSTR341194_block_data_order #include "md32_common.h" +LCRYPTO_ALIAS(GOSTR341194_Update); +LCRYPTO_ALIAS(GOSTR341194_Transform); int GOSTR341194_Final(unsigned char *md, GOSTR341194_CTX * c) @@ -254,6 +257,7 @@ GOSTR341194_Final(unsigned char *md, GOSTR341194_CTX * c) return 1; } +LCRYPTO_ALIAS(GOSTR341194_Final); unsigned char * GOSTR341194(const unsigned char *d, size_t n, unsigned char *md, int nid) @@ -270,4 +274,5 @@ GOSTR341194(const unsigned char *d, size_t n, unsigned char *md, int nid) explicit_bzero(&c, sizeof(c)); return (md); } +LCRYPTO_ALIAS(GOSTR341194); #endif diff --git a/lib/libcrypto/gost/streebog.c b/lib/libcrypto/gost/streebog.c index 2785fca61..60c575794 100644 --- a/lib/libcrypto/gost/streebog.c +++ b/lib/libcrypto/gost/streebog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: streebog.c,v 1.8 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: streebog.c,v 1.9 2023/07/08 14:30:44 beck Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov * Copyright (c) 2005-2006 Cryptocom LTD @@ -1365,12 +1365,14 @@ STREEBOG512_Final(unsigned char *md, STREEBOG_CTX *c) return 1; } +LCRYPTO_ALIAS(STREEBOG512_Final); int STREEBOG256_Final(unsigned char *md, STREEBOG_CTX * c) { return STREEBOG512_Final(md, c); } +LCRYPTO_ALIAS(STREEBOG256_Final); int STREEBOG512_Update(STREEBOG_CTX *c, const void *_data, size_t len) @@ -1411,18 +1413,21 @@ STREEBOG512_Update(STREEBOG_CTX *c, const void *_data, size_t len) return 1; } +LCRYPTO_ALIAS(STREEBOG512_Update); int STREEBOG256_Update(STREEBOG_CTX *c, const void *data, size_t len) { return STREEBOG512_Update(c, data, len); } +LCRYPTO_ALIAS(STREEBOG256_Update); void STREEBOG512_Transform(STREEBOG_CTX *c, const unsigned char *data) { streebog_block_data_order(c, data, 1); } +LCRYPTO_ALIAS(STREEBOG512_Transform); int STREEBOG256_Init(STREEBOG_CTX *c) @@ -1433,6 +1438,7 @@ STREEBOG256_Init(STREEBOG_CTX *c) c->md_len = STREEBOG256_LENGTH; return 1; } +LCRYPTO_ALIAS(STREEBOG256_Init); int STREEBOG512_Init(STREEBOG_CTX *c) @@ -1444,6 +1450,7 @@ STREEBOG512_Init(STREEBOG_CTX *c) c->md_len = STREEBOG512_LENGTH; return 1; } +LCRYPTO_ALIAS(STREEBOG512_Init); unsigned char * STREEBOG256(const unsigned char *d, size_t n, unsigned char *md) @@ -1459,6 +1466,7 @@ STREEBOG256(const unsigned char *d, size_t n, unsigned char *md) explicit_bzero(&c, sizeof(c)); return (md); } +LCRYPTO_ALIAS(STREEBOG256); unsigned char * STREEBOG512(const unsigned char *d, size_t n, unsigned char *md) @@ -1474,5 +1482,6 @@ STREEBOG512(const unsigned char *d, size_t n, unsigned char *md) explicit_bzero(&c, sizeof(c)); return (md); } +LCRYPTO_ALIAS(STREEBOG512); #endif diff --git a/lib/libcrypto/hidden/openssl/asn1.h b/lib/libcrypto/hidden/openssl/asn1.h index 0bdfd7b05..7e41ec862 100644 --- a/lib/libcrypto/hidden/openssl/asn1.h +++ b/lib/libcrypto/hidden/openssl/asn1.h @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1.h,v 1.1 2023/07/05 21:23:37 beck Exp $ */ +/* $OpenBSD: asn1.h,v 1.2 2023/07/07 19:37:54 beck Exp $ */ /* * Copyright (c) 2023 Bob Beck * @@ -80,7 +80,6 @@ LCRYPTO_USED(ASN1_UTCTIME_check); LCRYPTO_USED(ASN1_UTCTIME_set); LCRYPTO_USED(ASN1_UTCTIME_adj); LCRYPTO_USED(ASN1_UTCTIME_set_string); -LCRYPTO_USED(ASN1_UTCTIME_cmp_time_t); LCRYPTO_USED(ASN1_GENERALIZEDTIME_check); LCRYPTO_USED(ASN1_GENERALIZEDTIME_set); LCRYPTO_USED(ASN1_GENERALIZEDTIME_adj); @@ -194,7 +193,6 @@ LCRYPTO_USED(ASN1_put_object); LCRYPTO_USED(ASN1_put_eoc); LCRYPTO_USED(ASN1_object_size); LCRYPTO_USED(ASN1_item_dup); -LCRYPTO_USED(ASN1_dup); LCRYPTO_USED(ASN1_d2i_fp); LCRYPTO_USED(ASN1_item_d2i_fp); LCRYPTO_USED(ASN1_i2d_fp); diff --git a/lib/libcrypto/hidden/openssl/asn1t.h b/lib/libcrypto/hidden/openssl/asn1t.h index dcc95cf0b..d37d1dbbc 100644 --- a/lib/libcrypto/hidden/openssl/asn1t.h +++ b/lib/libcrypto/hidden/openssl/asn1t.h @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1t.h,v 1.1 2023/07/05 21:23:37 beck Exp $ */ +/* $OpenBSD: asn1t.h,v 1.2 2023/07/07 19:37:54 beck Exp $ */ /* * Copyright (c) 2023 Bob Beck * diff --git a/lib/libcrypto/hidden/openssl/bio.h b/lib/libcrypto/hidden/openssl/bio.h index 72c50d519..c04a0a447 100644 --- a/lib/libcrypto/hidden/openssl/bio.h +++ b/lib/libcrypto/hidden/openssl/bio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bio.h,v 1.1 2023/07/05 21:23:37 beck Exp $ */ +/* $OpenBSD: bio.h,v 1.2 2023/07/07 19:37:54 beck Exp $ */ /* * Copyright (c) 2023 Bob Beck * diff --git a/lib/libcrypto/hidden/openssl/bn.h b/lib/libcrypto/hidden/openssl/bn.h new file mode 100644 index 000000000..6c23a5c6d --- /dev/null +++ b/lib/libcrypto/hidden/openssl/bn.h @@ -0,0 +1,163 @@ +/* $OpenBSD: bn.h,v 1.1 2023/07/08 12:21:58 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_BN_H +#define _LIBCRYPTO_BN_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/bn.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(BN_set_flags); +LCRYPTO_USED(BN_get_flags); +LCRYPTO_USED(BN_with_flags); +LCRYPTO_USED(BN_GENCB_new); +LCRYPTO_USED(BN_GENCB_free); +LCRYPTO_USED(BN_GENCB_call); +LCRYPTO_USED(BN_GENCB_set_old); +LCRYPTO_USED(BN_GENCB_set); +LCRYPTO_USED(BN_GENCB_get_arg); +LCRYPTO_USED(BN_abs_is_word); +LCRYPTO_USED(BN_is_zero); +LCRYPTO_USED(BN_is_one); +LCRYPTO_USED(BN_is_word); +LCRYPTO_USED(BN_is_odd); +LCRYPTO_USED(BN_zero); +LCRYPTO_USED(BN_one); +LCRYPTO_USED(BN_value_one); +LCRYPTO_USED(BN_options); +LCRYPTO_USED(BN_CTX_new); +LCRYPTO_USED(BN_CTX_free); +LCRYPTO_USED(BN_CTX_start); +LCRYPTO_USED(BN_CTX_get); +LCRYPTO_USED(BN_CTX_end); +LCRYPTO_USED(BN_rand); +LCRYPTO_USED(BN_pseudo_rand); +LCRYPTO_USED(BN_rand_range); +LCRYPTO_USED(BN_pseudo_rand_range); +LCRYPTO_USED(BN_num_bits); +LCRYPTO_USED(BN_num_bits_word); +LCRYPTO_USED(BN_new); +LCRYPTO_USED(BN_clear_free); +LCRYPTO_USED(BN_copy); +LCRYPTO_USED(BN_swap); +LCRYPTO_USED(BN_bin2bn); +LCRYPTO_USED(BN_bn2bin); +LCRYPTO_USED(BN_bn2binpad); +LCRYPTO_USED(BN_lebin2bn); +LCRYPTO_USED(BN_bn2lebinpad); +LCRYPTO_USED(BN_mpi2bn); +LCRYPTO_USED(BN_bn2mpi); +LCRYPTO_USED(BN_sub); +LCRYPTO_USED(BN_usub); +LCRYPTO_USED(BN_uadd); +LCRYPTO_USED(BN_add); +LCRYPTO_USED(BN_mul); +LCRYPTO_USED(BN_sqr); +LCRYPTO_USED(BN_set_negative); +LCRYPTO_USED(BN_is_negative); +LCRYPTO_USED(BN_nnmod); +LCRYPTO_USED(BN_mod_add); +LCRYPTO_USED(BN_mod_add_quick); +LCRYPTO_USED(BN_mod_sub); +LCRYPTO_USED(BN_mod_sub_quick); +LCRYPTO_USED(BN_mod_mul); +LCRYPTO_USED(BN_mod_sqr); +LCRYPTO_USED(BN_mod_lshift1); +LCRYPTO_USED(BN_mod_lshift1_quick); +LCRYPTO_USED(BN_mod_lshift); +LCRYPTO_USED(BN_mod_lshift_quick); +LCRYPTO_USED(BN_mod_word); +LCRYPTO_USED(BN_div_word); +LCRYPTO_USED(BN_mul_word); +LCRYPTO_USED(BN_add_word); +LCRYPTO_USED(BN_sub_word); +LCRYPTO_USED(BN_set_word); +LCRYPTO_USED(BN_get_word); +LCRYPTO_USED(BN_cmp); +LCRYPTO_USED(BN_free); +LCRYPTO_USED(BN_is_bit_set); +LCRYPTO_USED(BN_lshift); +LCRYPTO_USED(BN_lshift1); +LCRYPTO_USED(BN_exp); +LCRYPTO_USED(BN_mod_exp_mont_consttime); +LCRYPTO_USED(BN_mod_exp_mont_word); +LCRYPTO_USED(BN_mod_exp2_mont); +LCRYPTO_USED(BN_mod_exp_simple); +LCRYPTO_USED(BN_mask_bits); +LCRYPTO_USED(BN_print_fp); +LCRYPTO_USED(BN_print); +LCRYPTO_USED(BN_rshift); +LCRYPTO_USED(BN_rshift1); +LCRYPTO_USED(BN_clear); +LCRYPTO_USED(BN_dup); +LCRYPTO_USED(BN_ucmp); +LCRYPTO_USED(BN_set_bit); +LCRYPTO_USED(BN_clear_bit); +LCRYPTO_USED(BN_bn2hex); +LCRYPTO_USED(BN_bn2dec); +LCRYPTO_USED(BN_hex2bn); +LCRYPTO_USED(BN_dec2bn); +LCRYPTO_USED(BN_asc2bn); +LCRYPTO_USED(BN_kronecker); +LCRYPTO_USED(BN_mod_sqrt); +LCRYPTO_USED(BN_consttime_swap); +LCRYPTO_USED(BN_security_bits); +LCRYPTO_USED(BN_generate_prime_ex); +LCRYPTO_USED(BN_is_prime_ex); +LCRYPTO_USED(BN_is_prime_fasttest_ex); +LCRYPTO_USED(BN_MONT_CTX_new); +LCRYPTO_USED(BN_mod_mul_montgomery); +LCRYPTO_USED(BN_to_montgomery); +LCRYPTO_USED(BN_from_montgomery); +LCRYPTO_USED(BN_MONT_CTX_free); +LCRYPTO_USED(BN_MONT_CTX_set); +LCRYPTO_USED(BN_MONT_CTX_copy); +LCRYPTO_USED(BN_MONT_CTX_set_locked); +LCRYPTO_USED(BN_BLINDING_new); +LCRYPTO_USED(BN_BLINDING_free); +LCRYPTO_USED(BN_BLINDING_update); +LCRYPTO_USED(BN_BLINDING_convert); +LCRYPTO_USED(BN_BLINDING_invert); +LCRYPTO_USED(BN_BLINDING_convert_ex); +LCRYPTO_USED(BN_BLINDING_invert_ex); +LCRYPTO_USED(BN_BLINDING_thread_id); +LCRYPTO_USED(BN_BLINDING_get_flags); +LCRYPTO_USED(BN_BLINDING_set_flags); +LCRYPTO_USED(BN_BLINDING_create_param); +LCRYPTO_USED(get_rfc2409_prime_768); +LCRYPTO_USED(get_rfc2409_prime_1024); +LCRYPTO_USED(BN_get_rfc2409_prime_768); +LCRYPTO_USED(BN_get_rfc2409_prime_1024); +LCRYPTO_USED(get_rfc3526_prime_1536); +LCRYPTO_USED(get_rfc3526_prime_2048); +LCRYPTO_USED(get_rfc3526_prime_3072); +LCRYPTO_USED(get_rfc3526_prime_4096); +LCRYPTO_USED(get_rfc3526_prime_6144); +LCRYPTO_USED(get_rfc3526_prime_8192); +LCRYPTO_USED(BN_get_rfc3526_prime_1536); +LCRYPTO_USED(BN_get_rfc3526_prime_2048); +LCRYPTO_USED(BN_get_rfc3526_prime_3072); +LCRYPTO_USED(BN_get_rfc3526_prime_4096); +LCRYPTO_USED(BN_get_rfc3526_prime_6144); +LCRYPTO_USED(BN_get_rfc3526_prime_8192); +LCRYPTO_USED(ERR_load_BN_strings); + +#endif /* _LIBCRYPTO_BN_H */ diff --git a/lib/libcrypto/hidden/openssl/buffer.h b/lib/libcrypto/hidden/openssl/buffer.h new file mode 100644 index 000000000..8dd86277f --- /dev/null +++ b/lib/libcrypto/hidden/openssl/buffer.h @@ -0,0 +1,34 @@ +/* $OpenBSD: buffer.h,v 1.1 2023/07/08 08:26:26 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_BUFFER_H +#define _LIBCRYPTO_BUFFER_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/buffer.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(BUF_MEM_new); +LCRYPTO_USED(BUF_MEM_free); +LCRYPTO_USED(BUF_MEM_grow); +LCRYPTO_USED(BUF_MEM_grow_clean); +LCRYPTO_USED(ERR_load_BUF_strings); + +#endif /* _LIBCRYPTO_BUFFER_H */ diff --git a/lib/libcrypto/hidden/openssl/cast.h b/lib/libcrypto/hidden/openssl/cast.h new file mode 100644 index 000000000..68cf61826 --- /dev/null +++ b/lib/libcrypto/hidden/openssl/cast.h @@ -0,0 +1,36 @@ +/* $OpenBSD: cast.h,v 1.1 2023/07/08 10:44:00 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_CAST_H +#define _LIBCRYPTO_CAST_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/cast.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(CAST_set_key); +LCRYPTO_USED(CAST_ecb_encrypt); +LCRYPTO_USED(CAST_encrypt); +LCRYPTO_USED(CAST_decrypt); +LCRYPTO_USED(CAST_cbc_encrypt); +LCRYPTO_USED(CAST_cfb64_encrypt); +LCRYPTO_USED(CAST_ofb64_encrypt); + +#endif /* _LIBCRYPTO_CAST_H */ diff --git a/lib/libcrypto/hidden/openssl/chacha.h b/lib/libcrypto/hidden/openssl/chacha.h index 98108261c..a9f3b7e90 100644 --- a/lib/libcrypto/hidden/openssl/chacha.h +++ b/lib/libcrypto/hidden/openssl/chacha.h @@ -1,4 +1,4 @@ -/* $OpenBSD: chacha.h,v 1.2 2023/07/05 21:14:54 bcook Exp $ */ +/* $OpenBSD: chacha.h,v 1.3 2023/07/07 19:37:54 beck Exp $ */ /* * Copyright (c) 2023 Bob Beck * diff --git a/lib/libcrypto/hidden/openssl/cmac.h b/lib/libcrypto/hidden/openssl/cmac.h new file mode 100644 index 000000000..cefdb4f6e --- /dev/null +++ b/lib/libcrypto/hidden/openssl/cmac.h @@ -0,0 +1,38 @@ +/* $OpenBSD: cmac.h,v 1.1 2023/07/08 14:27:14 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_CMAC_H +#define _LIBCRYPTO_CMAC_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/cmac.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(CMAC_CTX_new); +LCRYPTO_USED(CMAC_CTX_cleanup); +LCRYPTO_USED(CMAC_CTX_free); +LCRYPTO_USED(CMAC_CTX_get0_cipher_ctx); +LCRYPTO_USED(CMAC_CTX_copy); +LCRYPTO_USED(CMAC_Init); +LCRYPTO_USED(CMAC_Update); +LCRYPTO_USED(CMAC_Final); +LCRYPTO_USED(CMAC_resume); + +#endif /* _LIBCRYPTO_CMAC_H */ diff --git a/lib/libcrypto/hidden/openssl/cms.h b/lib/libcrypto/hidden/openssl/cms.h new file mode 100644 index 000000000..c777e857d --- /dev/null +++ b/lib/libcrypto/hidden/openssl/cms.h @@ -0,0 +1,146 @@ +/* $OpenBSD: cms.h,v 1.1 2023/07/08 08:26:26 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_CMS_H +#define _LIBCRYPTO_CMS_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/cms.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(CMS_ContentInfo_new); +LCRYPTO_USED(CMS_ContentInfo_free); +LCRYPTO_USED(d2i_CMS_ContentInfo); +LCRYPTO_USED(i2d_CMS_ContentInfo); +LCRYPTO_USED(CMS_ReceiptRequest_new); +LCRYPTO_USED(CMS_ReceiptRequest_free); +LCRYPTO_USED(d2i_CMS_ReceiptRequest); +LCRYPTO_USED(i2d_CMS_ReceiptRequest); +LCRYPTO_USED(CMS_ContentInfo_print_ctx); +LCRYPTO_USED(CMS_get0_type); +LCRYPTO_USED(CMS_dataInit); +LCRYPTO_USED(CMS_dataFinal); +LCRYPTO_USED(CMS_is_detached); +LCRYPTO_USED(CMS_set_detached); +LCRYPTO_USED(CMS_stream); +LCRYPTO_USED(d2i_CMS_bio); +LCRYPTO_USED(i2d_CMS_bio); +LCRYPTO_USED(BIO_new_CMS); +LCRYPTO_USED(i2d_CMS_bio_stream); +LCRYPTO_USED(PEM_write_bio_CMS_stream); +LCRYPTO_USED(SMIME_read_CMS); +LCRYPTO_USED(SMIME_write_CMS); +LCRYPTO_USED(CMS_final); +LCRYPTO_USED(CMS_sign); +LCRYPTO_USED(CMS_sign_receipt); +LCRYPTO_USED(CMS_data); +LCRYPTO_USED(CMS_data_create); +LCRYPTO_USED(CMS_digest_verify); +LCRYPTO_USED(CMS_digest_create); +LCRYPTO_USED(CMS_EncryptedData_decrypt); +LCRYPTO_USED(CMS_EncryptedData_encrypt); +LCRYPTO_USED(CMS_EncryptedData_set1_key); +LCRYPTO_USED(CMS_verify); +LCRYPTO_USED(CMS_verify_receipt); +LCRYPTO_USED(CMS_get0_signers); +LCRYPTO_USED(CMS_encrypt); +LCRYPTO_USED(CMS_decrypt); +LCRYPTO_USED(CMS_decrypt_set1_pkey); +LCRYPTO_USED(CMS_decrypt_set1_key); +LCRYPTO_USED(CMS_decrypt_set1_password); +LCRYPTO_USED(CMS_get0_RecipientInfos); +LCRYPTO_USED(CMS_RecipientInfo_type); +LCRYPTO_USED(CMS_RecipientInfo_get0_pkey_ctx); +LCRYPTO_USED(CMS_EnvelopedData_create); +LCRYPTO_USED(CMS_add1_recipient_cert); +LCRYPTO_USED(CMS_RecipientInfo_set0_pkey); +LCRYPTO_USED(CMS_RecipientInfo_ktri_cert_cmp); +LCRYPTO_USED(CMS_RecipientInfo_ktri_get0_algs); +LCRYPTO_USED(CMS_RecipientInfo_ktri_get0_signer_id); +LCRYPTO_USED(CMS_add0_recipient_key); +LCRYPTO_USED(CMS_RecipientInfo_kekri_get0_id); +LCRYPTO_USED(CMS_RecipientInfo_set0_key); +LCRYPTO_USED(CMS_RecipientInfo_kekri_id_cmp); +LCRYPTO_USED(CMS_RecipientInfo_set0_password); +LCRYPTO_USED(CMS_add0_recipient_password); +LCRYPTO_USED(CMS_RecipientInfo_decrypt); +LCRYPTO_USED(CMS_RecipientInfo_encrypt); +LCRYPTO_USED(CMS_uncompress); +LCRYPTO_USED(CMS_compress); +LCRYPTO_USED(CMS_set1_eContentType); +LCRYPTO_USED(CMS_get0_eContentType); +LCRYPTO_USED(CMS_add0_CertificateChoices); +LCRYPTO_USED(CMS_add0_cert); +LCRYPTO_USED(CMS_add1_cert); +LCRYPTO_USED(CMS_get1_certs); +LCRYPTO_USED(CMS_add0_RevocationInfoChoice); +LCRYPTO_USED(CMS_add0_crl); +LCRYPTO_USED(CMS_add1_crl); +LCRYPTO_USED(CMS_get1_crls); +LCRYPTO_USED(CMS_SignedData_init); +LCRYPTO_USED(CMS_add1_signer); +LCRYPTO_USED(CMS_SignerInfo_get0_pkey_ctx); +LCRYPTO_USED(CMS_SignerInfo_get0_md_ctx); +LCRYPTO_USED(CMS_get0_SignerInfos); +LCRYPTO_USED(CMS_SignerInfo_set1_signer_cert); +LCRYPTO_USED(CMS_SignerInfo_get0_signer_id); +LCRYPTO_USED(CMS_SignerInfo_cert_cmp); +LCRYPTO_USED(CMS_set1_signers_certs); +LCRYPTO_USED(CMS_SignerInfo_get0_algs); +LCRYPTO_USED(CMS_SignerInfo_get0_signature); +LCRYPTO_USED(CMS_SignerInfo_sign); +LCRYPTO_USED(CMS_SignerInfo_verify); +LCRYPTO_USED(CMS_SignerInfo_verify_content); +LCRYPTO_USED(CMS_add_smimecap); +LCRYPTO_USED(CMS_add_simple_smimecap); +LCRYPTO_USED(CMS_add_standard_smimecap); +LCRYPTO_USED(CMS_signed_get_attr_count); +LCRYPTO_USED(CMS_signed_get_attr_by_NID); +LCRYPTO_USED(CMS_signed_get_attr_by_OBJ); +LCRYPTO_USED(CMS_signed_get_attr); +LCRYPTO_USED(CMS_signed_delete_attr); +LCRYPTO_USED(CMS_signed_add1_attr); +LCRYPTO_USED(CMS_signed_add1_attr_by_OBJ); +LCRYPTO_USED(CMS_signed_add1_attr_by_NID); +LCRYPTO_USED(CMS_signed_add1_attr_by_txt); +LCRYPTO_USED(CMS_signed_get0_data_by_OBJ); +LCRYPTO_USED(CMS_unsigned_get_attr_count); +LCRYPTO_USED(CMS_unsigned_get_attr_by_NID); +LCRYPTO_USED(CMS_unsigned_get_attr_by_OBJ); +LCRYPTO_USED(CMS_unsigned_get_attr); +LCRYPTO_USED(CMS_unsigned_delete_attr); +LCRYPTO_USED(CMS_unsigned_add1_attr); +LCRYPTO_USED(CMS_unsigned_add1_attr_by_OBJ); +LCRYPTO_USED(CMS_unsigned_add1_attr_by_NID); +LCRYPTO_USED(CMS_unsigned_add1_attr_by_txt); +LCRYPTO_USED(CMS_unsigned_get0_data_by_OBJ); +LCRYPTO_USED(CMS_RecipientInfo_kari_get0_alg); +LCRYPTO_USED(CMS_RecipientInfo_kari_get0_reks); +LCRYPTO_USED(CMS_RecipientInfo_kari_get0_orig_id); +LCRYPTO_USED(CMS_RecipientInfo_kari_orig_id_cmp); +LCRYPTO_USED(CMS_RecipientEncryptedKey_get0_id); +LCRYPTO_USED(CMS_RecipientEncryptedKey_cert_cmp); +LCRYPTO_USED(CMS_RecipientInfo_kari_set0_pkey); +LCRYPTO_USED(CMS_RecipientInfo_kari_get0_ctx); +LCRYPTO_USED(CMS_RecipientInfo_kari_decrypt); +LCRYPTO_USED(CMS_SharedInfo_encode); +LCRYPTO_USED(ERR_load_CMS_strings); + +#endif /* _LIBCRYPTO_CMS_H */ diff --git a/lib/libcrypto/hidden/openssl/comp.h b/lib/libcrypto/hidden/openssl/comp.h new file mode 100644 index 000000000..fc97324ea --- /dev/null +++ b/lib/libcrypto/hidden/openssl/comp.h @@ -0,0 +1,37 @@ +/* $OpenBSD: comp.h,v 1.1 2023/07/08 08:26:26 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_COMP_H +#define _LIBCRYPTO_COMP_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/comp.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(COMP_CTX_new); +LCRYPTO_USED(COMP_CTX_free); +LCRYPTO_USED(COMP_compress_block); +LCRYPTO_USED(COMP_expand_block); +LCRYPTO_USED(COMP_rle); +LCRYPTO_USED(COMP_zlib); +LCRYPTO_USED(COMP_zlib_cleanup); +LCRYPTO_USED(ERR_load_COMP_strings); + +#endif /* _LIBCRYPTO_COMP_H */ diff --git a/lib/libcrypto/hidden/openssl/conf_api.h b/lib/libcrypto/hidden/openssl/conf_api.h new file mode 100644 index 000000000..5ff895661 --- /dev/null +++ b/lib/libcrypto/hidden/openssl/conf_api.h @@ -0,0 +1,36 @@ +/* $OpenBSD: conf_api.h,v 1.1 2023/07/08 08:26:26 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_CONF_API_H +#define _LIBCRYPTO_CONF_API_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/conf_api.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(_CONF_new_section); +LCRYPTO_USED(_CONF_get_section); +LCRYPTO_USED(_CONF_get_section_values); +LCRYPTO_USED(_CONF_add_string); +LCRYPTO_USED(_CONF_get_string); +LCRYPTO_USED(_CONF_new_data); +LCRYPTO_USED(_CONF_free_data); + +#endif /* _LIBCRYPTO_CONF_API_H */ diff --git a/lib/libcrypto/hidden/openssl/crypto.h b/lib/libcrypto/hidden/openssl/crypto.h new file mode 100644 index 000000000..69ffa9480 --- /dev/null +++ b/lib/libcrypto/hidden/openssl/crypto.h @@ -0,0 +1,79 @@ +/* $OpenBSD: crypto.h,v 1.1 2023/07/08 08:28:23 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_CRYPTO_H +#define _LIBCRYPTO_CRYPTO_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/crypto.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(OpenSSL_version); +LCRYPTO_USED(OpenSSL_version_num); +LCRYPTO_USED(SSLeay_version); +LCRYPTO_USED(SSLeay); +LCRYPTO_USED(CRYPTO_get_ex_data_implementation); +LCRYPTO_USED(CRYPTO_set_ex_data_implementation); +LCRYPTO_USED(CRYPTO_ex_data_new_class); +LCRYPTO_USED(CRYPTO_get_ex_new_index); +LCRYPTO_USED(CRYPTO_new_ex_data); +LCRYPTO_USED(CRYPTO_dup_ex_data); +LCRYPTO_USED(CRYPTO_free_ex_data); +LCRYPTO_USED(CRYPTO_set_ex_data); +LCRYPTO_USED(CRYPTO_get_ex_data); +LCRYPTO_USED(CRYPTO_cleanup_all_ex_data); +LCRYPTO_USED(CRYPTO_lock); +LCRYPTO_USED(CRYPTO_add_lock); +LCRYPTO_USED(CRYPTO_THREADID_current); +LCRYPTO_USED(CRYPTO_THREADID_cmp); +LCRYPTO_USED(CRYPTO_THREADID_cpy); +LCRYPTO_USED(CRYPTO_THREADID_hash); +LCRYPTO_USED(CRYPTO_set_mem_functions); +LCRYPTO_USED(CRYPTO_set_locked_mem_functions); +LCRYPTO_USED(CRYPTO_set_mem_ex_functions); +LCRYPTO_USED(CRYPTO_set_locked_mem_ex_functions); +LCRYPTO_USED(CRYPTO_set_mem_debug_functions); +LCRYPTO_USED(CRYPTO_get_mem_functions); +LCRYPTO_USED(CRYPTO_get_locked_mem_functions); +LCRYPTO_USED(CRYPTO_get_mem_ex_functions); +LCRYPTO_USED(CRYPTO_get_locked_mem_ex_functions); +LCRYPTO_USED(CRYPTO_get_mem_debug_functions); +LCRYPTO_USED(CRYPTO_realloc_clean); +LCRYPTO_USED(CRYPTO_remalloc); +LCRYPTO_USED(CRYPTO_set_mem_debug_options); +LCRYPTO_USED(CRYPTO_get_mem_debug_options); +LCRYPTO_USED(CRYPTO_push_info_); +LCRYPTO_USED(CRYPTO_pop_info); +LCRYPTO_USED(CRYPTO_remove_all_info); +LCRYPTO_USED(CRYPTO_dbg_malloc); +LCRYPTO_USED(CRYPTO_dbg_realloc); +LCRYPTO_USED(CRYPTO_dbg_free); +LCRYPTO_USED(CRYPTO_dbg_set_options); +LCRYPTO_USED(CRYPTO_dbg_get_options); +LCRYPTO_USED(CRYPTO_mem_leaks_fp); +LCRYPTO_USED(CRYPTO_mem_leaks); +LCRYPTO_USED(CRYPTO_mem_leaks_cb); +LCRYPTO_USED(OpenSSLDie); +LCRYPTO_USED(OPENSSL_cpu_caps); +LCRYPTO_USED(OPENSSL_init_crypto); +LCRYPTO_USED(OPENSSL_cleanup); +LCRYPTO_USED(ERR_load_CRYPTO_strings); + +#endif /* _LIBCRYPTO_CRYPTO_H */ diff --git a/lib/libcrypto/hidden/openssl/ct.h b/lib/libcrypto/hidden/openssl/ct.h new file mode 100644 index 000000000..a1c9b338e --- /dev/null +++ b/lib/libcrypto/hidden/openssl/ct.h @@ -0,0 +1,85 @@ +/* $OpenBSD: ct.h,v 1.1 2023/07/08 07:22:58 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_CT_H +#define _LIBCRYPTO_CT_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/ct.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(CT_POLICY_EVAL_CTX_new); +LCRYPTO_USED(CT_POLICY_EVAL_CTX_free); +LCRYPTO_USED(CT_POLICY_EVAL_CTX_get0_cert); +LCRYPTO_USED(CT_POLICY_EVAL_CTX_set1_cert); +LCRYPTO_USED(CT_POLICY_EVAL_CTX_get0_issuer); +LCRYPTO_USED(CT_POLICY_EVAL_CTX_set1_issuer); +LCRYPTO_USED(CT_POLICY_EVAL_CTX_get0_log_store); +LCRYPTO_USED(CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE); +LCRYPTO_USED(CT_POLICY_EVAL_CTX_get_time); +LCRYPTO_USED(CT_POLICY_EVAL_CTX_set_time); +LCRYPTO_USED(SCT_new); +LCRYPTO_USED(SCT_new_from_base64); +LCRYPTO_USED(SCT_free); +LCRYPTO_USED(SCT_LIST_free); +LCRYPTO_USED(SCT_get_version); +LCRYPTO_USED(SCT_set_version); +LCRYPTO_USED(SCT_get_log_entry_type); +LCRYPTO_USED(SCT_set_log_entry_type); +LCRYPTO_USED(SCT_get0_log_id); +LCRYPTO_USED(SCT_set0_log_id); +LCRYPTO_USED(SCT_set1_log_id); +LCRYPTO_USED(SCT_get_timestamp); +LCRYPTO_USED(SCT_set_timestamp); +LCRYPTO_USED(SCT_get_signature_nid); +LCRYPTO_USED(SCT_set_signature_nid); +LCRYPTO_USED(SCT_get0_extensions); +LCRYPTO_USED(SCT_set0_extensions); +LCRYPTO_USED(SCT_set1_extensions); +LCRYPTO_USED(SCT_get0_signature); +LCRYPTO_USED(SCT_set0_signature); +LCRYPTO_USED(SCT_set1_signature); +LCRYPTO_USED(SCT_get_source); +LCRYPTO_USED(SCT_set_source); +LCRYPTO_USED(SCT_validation_status_string); +LCRYPTO_USED(SCT_print); +LCRYPTO_USED(SCT_LIST_print); +LCRYPTO_USED(SCT_get_validation_status); +LCRYPTO_USED(SCT_validate); +LCRYPTO_USED(SCT_LIST_validate); +LCRYPTO_USED(i2o_SCT_LIST); +LCRYPTO_USED(o2i_SCT_LIST); +LCRYPTO_USED(i2d_SCT_LIST); +LCRYPTO_USED(d2i_SCT_LIST); +LCRYPTO_USED(i2o_SCT); +LCRYPTO_USED(o2i_SCT); +LCRYPTO_USED(CTLOG_new); +LCRYPTO_USED(CTLOG_new_from_base64); +LCRYPTO_USED(CTLOG_free); +LCRYPTO_USED(CTLOG_get0_name); +LCRYPTO_USED(CTLOG_get0_log_id); +LCRYPTO_USED(CTLOG_get0_public_key); +LCRYPTO_USED(CTLOG_STORE_new); +LCRYPTO_USED(CTLOG_STORE_free); +LCRYPTO_USED(CTLOG_STORE_get0_log_by_id); +LCRYPTO_USED(CTLOG_STORE_load_file); +LCRYPTO_USED(CTLOG_STORE_load_default_file); + +#endif /* _LIBCRYPTO_CT_H */ diff --git a/lib/libcrypto/hidden/openssl/curve25519.h b/lib/libcrypto/hidden/openssl/curve25519.h new file mode 100644 index 000000000..3afa324e0 --- /dev/null +++ b/lib/libcrypto/hidden/openssl/curve25519.h @@ -0,0 +1,34 @@ +/* $OpenBSD: curve25519.h,v 1.1 2023/07/08 15:12:49 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_CURVE25519_H +#define _LIBCRYPTO_CURVE25519_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/curve25519.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(X25519_keypair); +LCRYPTO_USED(X25519); +LCRYPTO_USED(ED25519_keypair); +LCRYPTO_USED(ED25519_sign); +LCRYPTO_USED(ED25519_verify); + +#endif /* _LIBCRYPTO_CURVE25519_H */ diff --git a/lib/libcrypto/hidden/openssl/dh.h b/lib/libcrypto/hidden/openssl/dh.h new file mode 100644 index 000000000..7e6d57815 --- /dev/null +++ b/lib/libcrypto/hidden/openssl/dh.h @@ -0,0 +1,74 @@ +/* $OpenBSD: dh.h,v 1.1 2023/07/08 15:29:04 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_DH_H +#define _LIBCRYPTO_DH_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/dh.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(d2i_DHparams_bio); +LCRYPTO_USED(i2d_DHparams_bio); +LCRYPTO_USED(d2i_DHparams_fp); +LCRYPTO_USED(i2d_DHparams_fp); +LCRYPTO_USED(DHparams_dup); +LCRYPTO_USED(DH_OpenSSL); +LCRYPTO_USED(DH_set_default_method); +LCRYPTO_USED(DH_get_default_method); +LCRYPTO_USED(DH_set_method); +LCRYPTO_USED(DH_new_method); +LCRYPTO_USED(DH_new); +LCRYPTO_USED(DH_free); +LCRYPTO_USED(DH_up_ref); +LCRYPTO_USED(DH_size); +LCRYPTO_USED(DH_bits); +LCRYPTO_USED(DH_get_ex_new_index); +LCRYPTO_USED(DH_set_ex_data); +LCRYPTO_USED(DH_get_ex_data); +LCRYPTO_USED(DH_security_bits); +LCRYPTO_USED(DH_get0_engine); +LCRYPTO_USED(DH_get0_pqg); +LCRYPTO_USED(DH_set0_pqg); +LCRYPTO_USED(DH_get0_key); +LCRYPTO_USED(DH_set0_key); +LCRYPTO_USED(DH_get0_p); +LCRYPTO_USED(DH_get0_q); +LCRYPTO_USED(DH_get0_g); +LCRYPTO_USED(DH_get0_priv_key); +LCRYPTO_USED(DH_get0_pub_key); +LCRYPTO_USED(DH_clear_flags); +LCRYPTO_USED(DH_test_flags); +LCRYPTO_USED(DH_set_flags); +LCRYPTO_USED(DH_get_length); +LCRYPTO_USED(DH_set_length); +LCRYPTO_USED(DH_generate_parameters); +LCRYPTO_USED(DH_generate_parameters_ex); +LCRYPTO_USED(DH_check); +LCRYPTO_USED(DH_check_pub_key); +LCRYPTO_USED(DH_generate_key); +LCRYPTO_USED(DH_compute_key); +LCRYPTO_USED(d2i_DHparams); +LCRYPTO_USED(i2d_DHparams); +LCRYPTO_USED(DHparams_print_fp); +LCRYPTO_USED(DHparams_print); +LCRYPTO_USED(ERR_load_DH_strings); + +#endif /* _LIBCRYPTO_DH_H */ diff --git a/lib/libcrypto/hidden/openssl/dsa.h b/lib/libcrypto/hidden/openssl/dsa.h new file mode 100644 index 000000000..b2b0058cb --- /dev/null +++ b/lib/libcrypto/hidden/openssl/dsa.h @@ -0,0 +1,94 @@ +/* $OpenBSD: dsa.h,v 1.1 2023/07/08 14:28:15 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_DSA_H +#define _LIBCRYPTO_DSA_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/dsa.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(d2i_DSAparams_bio); +LCRYPTO_USED(i2d_DSAparams_bio); +LCRYPTO_USED(d2i_DSAparams_fp); +LCRYPTO_USED(i2d_DSAparams_fp); +LCRYPTO_USED(DSAparams_dup); +LCRYPTO_USED(DSA_SIG_new); +LCRYPTO_USED(DSA_SIG_free); +LCRYPTO_USED(i2d_DSA_SIG); +LCRYPTO_USED(d2i_DSA_SIG); +LCRYPTO_USED(DSA_SIG_get0); +LCRYPTO_USED(DSA_SIG_set0); +LCRYPTO_USED(DSA_do_sign); +LCRYPTO_USED(DSA_do_verify); +LCRYPTO_USED(DSA_OpenSSL); +LCRYPTO_USED(DSA_set_default_method); +LCRYPTO_USED(DSA_get_default_method); +LCRYPTO_USED(DSA_set_method); +LCRYPTO_USED(DSA_new); +LCRYPTO_USED(DSA_new_method); +LCRYPTO_USED(DSA_free); +LCRYPTO_USED(DSA_up_ref); +LCRYPTO_USED(DSA_size); +LCRYPTO_USED(DSA_bits); +LCRYPTO_USED(DSA_sign_setup); +LCRYPTO_USED(DSA_sign); +LCRYPTO_USED(DSA_verify); +LCRYPTO_USED(DSA_get_ex_new_index); +LCRYPTO_USED(DSA_set_ex_data); +LCRYPTO_USED(DSA_get_ex_data); +LCRYPTO_USED(DSA_security_bits); +LCRYPTO_USED(d2i_DSAPublicKey); +LCRYPTO_USED(i2d_DSAPublicKey); +LCRYPTO_USED(d2i_DSAPrivateKey); +LCRYPTO_USED(i2d_DSAPrivateKey); +LCRYPTO_USED(d2i_DSAparams); +LCRYPTO_USED(i2d_DSAparams); +LCRYPTO_USED(DSA_generate_parameters); +LCRYPTO_USED(DSA_generate_parameters_ex); +LCRYPTO_USED(DSA_generate_key); +LCRYPTO_USED(DSAparams_print); +LCRYPTO_USED(DSA_print); +LCRYPTO_USED(DSAparams_print_fp); +LCRYPTO_USED(DSA_print_fp); +LCRYPTO_USED(DSA_dup_DH); +LCRYPTO_USED(DSA_get0_pqg); +LCRYPTO_USED(DSA_set0_pqg); +LCRYPTO_USED(DSA_get0_key); +LCRYPTO_USED(DSA_set0_key); +LCRYPTO_USED(DSA_get0_p); +LCRYPTO_USED(DSA_get0_q); +LCRYPTO_USED(DSA_get0_g); +LCRYPTO_USED(DSA_get0_pub_key); +LCRYPTO_USED(DSA_get0_priv_key); +LCRYPTO_USED(DSA_clear_flags); +LCRYPTO_USED(DSA_test_flags); +LCRYPTO_USED(DSA_set_flags); +LCRYPTO_USED(DSA_get0_engine); +LCRYPTO_USED(DSA_meth_new); +LCRYPTO_USED(DSA_meth_free); +LCRYPTO_USED(DSA_meth_dup); +LCRYPTO_USED(DSA_meth_get0_name); +LCRYPTO_USED(DSA_meth_set1_name); +LCRYPTO_USED(DSA_meth_set_sign); +LCRYPTO_USED(DSA_meth_set_finish); +LCRYPTO_USED(ERR_load_DSA_strings); + +#endif /* _LIBCRYPTO_DSA_H */ diff --git a/lib/libcrypto/hidden/openssl/dso.h b/lib/libcrypto/hidden/openssl/dso.h new file mode 100644 index 000000000..a5e989c89 --- /dev/null +++ b/lib/libcrypto/hidden/openssl/dso.h @@ -0,0 +1,54 @@ +/* $OpenBSD: dso.h,v 1.1 2023/07/08 07:22:58 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_DSO_H +#define _LIBCRYPTO_DSO_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/dso.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(DSO_new); +LCRYPTO_USED(DSO_new_method); +LCRYPTO_USED(DSO_free); +LCRYPTO_USED(DSO_flags); +LCRYPTO_USED(DSO_up_ref); +LCRYPTO_USED(DSO_ctrl); +LCRYPTO_USED(DSO_set_name_converter); +LCRYPTO_USED(DSO_get_filename); +LCRYPTO_USED(DSO_set_filename); +LCRYPTO_USED(DSO_convert_filename); +LCRYPTO_USED(DSO_merge); +LCRYPTO_USED(DSO_get_loaded_filename); +LCRYPTO_USED(DSO_set_default_method); +LCRYPTO_USED(DSO_get_default_method); +LCRYPTO_USED(DSO_get_method); +LCRYPTO_USED(DSO_set_method); +LCRYPTO_USED(DSO_load); +LCRYPTO_USED(DSO_bind_var); +LCRYPTO_USED(DSO_bind_func); +LCRYPTO_USED(DSO_METHOD_openssl); +LCRYPTO_USED(DSO_METHOD_null); +LCRYPTO_USED(DSO_METHOD_dlfcn); +LCRYPTO_USED(DSO_pathbyaddr); +LCRYPTO_USED(DSO_global_lookup); +LCRYPTO_USED(ERR_load_DSO_strings); + +#endif /* _LIBCRYPTO_DSO_H */ diff --git a/lib/libcrypto/hidden/openssl/ec.h b/lib/libcrypto/hidden/openssl/ec.h new file mode 100644 index 000000000..5e4121eac --- /dev/null +++ b/lib/libcrypto/hidden/openssl/ec.h @@ -0,0 +1,146 @@ +/* $OpenBSD: ec.h,v 1.2 2023/07/07 19:37:54 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_EC_H +#define _LIBCRYPTO_EC_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/ec.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(EC_GFp_simple_method); +LCRYPTO_USED(EC_GFp_mont_method); +LCRYPTO_USED(EC_GROUP_new); +LCRYPTO_USED(EC_GROUP_free); +LCRYPTO_USED(EC_GROUP_copy); +LCRYPTO_USED(EC_GROUP_dup); +LCRYPTO_USED(EC_GROUP_method_of); +LCRYPTO_USED(EC_METHOD_get_field_type); +LCRYPTO_USED(EC_GROUP_set_generator); +LCRYPTO_USED(EC_GROUP_get0_generator); +LCRYPTO_USED(EC_GROUP_get_order); +LCRYPTO_USED(EC_GROUP_order_bits); +LCRYPTO_USED(EC_GROUP_get_cofactor); +LCRYPTO_USED(EC_GROUP_set_curve_name); +LCRYPTO_USED(EC_GROUP_get_curve_name); +LCRYPTO_USED(EC_GROUP_set_asn1_flag); +LCRYPTO_USED(EC_GROUP_get_asn1_flag); +LCRYPTO_USED(EC_GROUP_set_point_conversion_form); +LCRYPTO_USED(EC_GROUP_get_point_conversion_form); +LCRYPTO_USED(EC_GROUP_get0_seed); +LCRYPTO_USED(EC_GROUP_get_seed_len); +LCRYPTO_USED(EC_GROUP_set_seed); +LCRYPTO_USED(EC_GROUP_set_curve); +LCRYPTO_USED(EC_GROUP_get_curve); +LCRYPTO_USED(EC_GROUP_get_degree); +LCRYPTO_USED(EC_GROUP_check); +LCRYPTO_USED(EC_GROUP_check_discriminant); +LCRYPTO_USED(EC_GROUP_cmp); +LCRYPTO_USED(EC_GROUP_new_curve_GFp); +LCRYPTO_USED(EC_GROUP_new_by_curve_name); +LCRYPTO_USED(EC_get_builtin_curves); +LCRYPTO_USED(EC_curve_nid2nist); +LCRYPTO_USED(EC_curve_nist2nid); +LCRYPTO_USED(EC_POINT_new); +LCRYPTO_USED(EC_POINT_free); +LCRYPTO_USED(EC_POINT_copy); +LCRYPTO_USED(EC_POINT_dup); +LCRYPTO_USED(EC_POINT_method_of); +LCRYPTO_USED(EC_POINT_set_to_infinity); +LCRYPTO_USED(EC_POINT_set_affine_coordinates); +LCRYPTO_USED(EC_POINT_get_affine_coordinates); +LCRYPTO_USED(EC_POINT_set_compressed_coordinates); +LCRYPTO_USED(EC_POINT_point2oct); +LCRYPTO_USED(EC_POINT_oct2point); +LCRYPTO_USED(EC_POINT_point2bn); +LCRYPTO_USED(EC_POINT_bn2point); +LCRYPTO_USED(EC_POINT_point2hex); +LCRYPTO_USED(EC_POINT_hex2point); +LCRYPTO_USED(EC_POINT_add); +LCRYPTO_USED(EC_POINT_dbl); +LCRYPTO_USED(EC_POINT_invert); +LCRYPTO_USED(EC_POINT_is_at_infinity); +LCRYPTO_USED(EC_POINT_is_on_curve); +LCRYPTO_USED(EC_POINT_cmp); +LCRYPTO_USED(EC_POINT_make_affine); +LCRYPTO_USED(EC_POINTs_make_affine); +LCRYPTO_USED(EC_POINTs_mul); +LCRYPTO_USED(EC_POINT_mul); +LCRYPTO_USED(EC_GROUP_precompute_mult); +LCRYPTO_USED(EC_GROUP_have_precompute_mult); +LCRYPTO_USED(EC_GROUP_get_basis_type); +LCRYPTO_USED(d2i_ECPKParameters); +LCRYPTO_USED(i2d_ECPKParameters); +LCRYPTO_USED(ECPKParameters_print); +LCRYPTO_USED(ECPKParameters_print_fp); +LCRYPTO_USED(EC_KEY_new); +LCRYPTO_USED(EC_KEY_get_flags); +LCRYPTO_USED(EC_KEY_set_flags); +LCRYPTO_USED(EC_KEY_clear_flags); +LCRYPTO_USED(EC_KEY_new_by_curve_name); +LCRYPTO_USED(EC_KEY_free); +LCRYPTO_USED(EC_KEY_copy); +LCRYPTO_USED(EC_KEY_dup); +LCRYPTO_USED(EC_KEY_up_ref); +LCRYPTO_USED(EC_KEY_get0_group); +LCRYPTO_USED(EC_KEY_set_group); +LCRYPTO_USED(EC_KEY_get0_private_key); +LCRYPTO_USED(EC_KEY_set_private_key); +LCRYPTO_USED(EC_KEY_get0_public_key); +LCRYPTO_USED(EC_KEY_set_public_key); +LCRYPTO_USED(EC_KEY_get_enc_flags); +LCRYPTO_USED(EC_KEY_set_enc_flags); +LCRYPTO_USED(EC_KEY_get_conv_form); +LCRYPTO_USED(EC_KEY_set_conv_form); +LCRYPTO_USED(EC_KEY_set_asn1_flag); +LCRYPTO_USED(EC_KEY_precompute_mult); +LCRYPTO_USED(EC_KEY_generate_key); +LCRYPTO_USED(EC_KEY_check_key); +LCRYPTO_USED(EC_KEY_set_public_key_affine_coordinates); +LCRYPTO_USED(d2i_ECPrivateKey); +LCRYPTO_USED(i2d_ECPrivateKey); +LCRYPTO_USED(d2i_ECParameters); +LCRYPTO_USED(i2d_ECParameters); +LCRYPTO_USED(o2i_ECPublicKey); +LCRYPTO_USED(i2o_ECPublicKey); +LCRYPTO_USED(ECParameters_print); +LCRYPTO_USED(EC_KEY_print); +LCRYPTO_USED(ECParameters_print_fp); +LCRYPTO_USED(EC_KEY_print_fp); +LCRYPTO_USED(EC_KEY_set_ex_data); +LCRYPTO_USED(EC_KEY_get_ex_data); +LCRYPTO_USED(EC_KEY_OpenSSL); +LCRYPTO_USED(EC_KEY_get_default_method); +LCRYPTO_USED(EC_KEY_set_default_method); +LCRYPTO_USED(EC_KEY_get_method); +LCRYPTO_USED(EC_KEY_set_method); +LCRYPTO_USED(EC_KEY_new_method); +LCRYPTO_USED(EC_KEY_METHOD_new); +LCRYPTO_USED(EC_KEY_METHOD_free); +LCRYPTO_USED(EC_KEY_METHOD_set_init); +LCRYPTO_USED(EC_KEY_METHOD_set_keygen); +LCRYPTO_USED(EC_KEY_METHOD_set_compute_key); +LCRYPTO_USED(EC_KEY_METHOD_get_init); +LCRYPTO_USED(EC_KEY_METHOD_get_keygen); +LCRYPTO_USED(EC_KEY_METHOD_get_compute_key); +LCRYPTO_USED(ECParameters_dup); +LCRYPTO_USED(ERR_load_EC_strings); + +#endif /* _LIBCRYPTO_EC_H */ diff --git a/lib/libcrypto/hidden/openssl/ecdh.h b/lib/libcrypto/hidden/openssl/ecdh.h new file mode 100644 index 000000000..db56f8a58 --- /dev/null +++ b/lib/libcrypto/hidden/openssl/ecdh.h @@ -0,0 +1,39 @@ +/* $OpenBSD: ecdh.h,v 1.1 2023/07/08 06:04:33 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_ECDH_H +#define _LIBCRYPTO_ECDH_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/ecdh.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(ECDH_OpenSSL); +LCRYPTO_USED(ECDH_set_default_method); +LCRYPTO_USED(ECDH_get_default_method); +LCRYPTO_USED(ECDH_set_method); +LCRYPTO_USED(ECDH_size); +LCRYPTO_USED(ECDH_compute_key); +LCRYPTO_USED(ECDH_get_ex_new_index); +LCRYPTO_USED(ECDH_set_ex_data); +LCRYPTO_USED(ECDH_get_ex_data); +LCRYPTO_USED(ERR_load_ECDH_strings); + +#endif /* _LIBCRYPTO_ECDH_H */ diff --git a/lib/libcrypto/hidden/openssl/ecdsa.h b/lib/libcrypto/hidden/openssl/ecdsa.h new file mode 100644 index 000000000..ef8a78993 --- /dev/null +++ b/lib/libcrypto/hidden/openssl/ecdsa.h @@ -0,0 +1,57 @@ +/* $OpenBSD: ecdsa.h,v 1.2 2023/07/07 19:37:54 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_ECDSA_H +#define _LIBCRYPTO_ECDSA_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/ecdsa.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(ECDSA_SIG_new); +LCRYPTO_USED(ECDSA_SIG_free); +LCRYPTO_USED(i2d_ECDSA_SIG); +LCRYPTO_USED(d2i_ECDSA_SIG); +LCRYPTO_USED(ECDSA_SIG_get0); +LCRYPTO_USED(ECDSA_SIG_get0_r); +LCRYPTO_USED(ECDSA_SIG_get0_s); +LCRYPTO_USED(ECDSA_SIG_set0); +LCRYPTO_USED(ECDSA_do_sign); +LCRYPTO_USED(ECDSA_do_sign_ex); +LCRYPTO_USED(ECDSA_do_verify); +LCRYPTO_USED(ECDSA_OpenSSL); +LCRYPTO_USED(ECDSA_set_default_method); +LCRYPTO_USED(ECDSA_get_default_method); +LCRYPTO_USED(ECDSA_set_method); +LCRYPTO_USED(ECDSA_size); +LCRYPTO_USED(ECDSA_sign_setup); +LCRYPTO_USED(ECDSA_sign); +LCRYPTO_USED(ECDSA_sign_ex); +LCRYPTO_USED(ECDSA_verify); +LCRYPTO_USED(ECDSA_get_ex_new_index); +LCRYPTO_USED(ECDSA_set_ex_data); +LCRYPTO_USED(ECDSA_get_ex_data); +LCRYPTO_USED(EC_KEY_METHOD_set_sign); +LCRYPTO_USED(EC_KEY_METHOD_set_verify); +LCRYPTO_USED(EC_KEY_METHOD_get_sign); +LCRYPTO_USED(EC_KEY_METHOD_get_verify); +LCRYPTO_USED(ERR_load_ECDSA_strings); + +#endif /* _LIBCRYPTO_ECDSA_H */ diff --git a/lib/libcrypto/hidden/openssl/err.h b/lib/libcrypto/hidden/openssl/err.h new file mode 100644 index 000000000..bc2a96644 --- /dev/null +++ b/lib/libcrypto/hidden/openssl/err.h @@ -0,0 +1,66 @@ +/* $OpenBSD: err.h,v 1.2 2023/07/07 19:37:54 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_ERR_H +#define _LIBCRYPTO_ERR_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/err.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(ERR_put_error); +LCRYPTO_USED(ERR_set_error_data); +LCRYPTO_USED(ERR_get_error); +LCRYPTO_USED(ERR_get_error_line); +LCRYPTO_USED(ERR_get_error_line_data); +LCRYPTO_USED(ERR_peek_error); +LCRYPTO_USED(ERR_peek_error_line); +LCRYPTO_USED(ERR_peek_error_line_data); +LCRYPTO_USED(ERR_peek_last_error); +LCRYPTO_USED(ERR_peek_last_error_line); +LCRYPTO_USED(ERR_peek_last_error_line_data); +LCRYPTO_USED(ERR_clear_error); +LCRYPTO_USED(ERR_error_string); +LCRYPTO_USED(ERR_error_string_n); +LCRYPTO_USED(ERR_lib_error_string); +LCRYPTO_USED(ERR_func_error_string); +LCRYPTO_USED(ERR_reason_error_string); +LCRYPTO_USED(ERR_print_errors_cb); +LCRYPTO_USED(ERR_print_errors_fp); +LCRYPTO_USED(ERR_print_errors); +LCRYPTO_USED(ERR_asprintf_error_data); +LCRYPTO_USED(ERR_load_strings); +LCRYPTO_USED(ERR_unload_strings); +LCRYPTO_USED(ERR_load_ERR_strings); +LCRYPTO_USED(ERR_load_crypto_strings); +LCRYPTO_USED(ERR_free_strings); +LCRYPTO_USED(ERR_remove_thread_state); +LCRYPTO_USED(ERR_remove_state); +LCRYPTO_USED(ERR_get_state); +LCRYPTO_USED(ERR_get_string_table); +LCRYPTO_USED(ERR_get_err_state_table); +LCRYPTO_USED(ERR_release_err_state_table); +LCRYPTO_USED(ERR_get_next_error_library); +LCRYPTO_USED(ERR_set_mark); +LCRYPTO_USED(ERR_pop_to_mark); +LCRYPTO_USED(ERR_get_implementation); +LCRYPTO_USED(ERR_set_implementation); + +#endif /* _LIBCRYPTO_ERR_H */ diff --git a/lib/libcrypto/hidden/openssl/gost.h b/lib/libcrypto/hidden/openssl/gost.h new file mode 100644 index 000000000..e30e6611a --- /dev/null +++ b/lib/libcrypto/hidden/openssl/gost.h @@ -0,0 +1,71 @@ +/* $OpenBSD: gost.h,v 1.1 2023/07/08 14:30:44 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_GOST_H +#define _LIBCRYPTO_GOST_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/gost.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(Gost2814789_set_sbox); +LCRYPTO_USED(Gost2814789_set_key); +LCRYPTO_USED(Gost2814789_ecb_encrypt); +LCRYPTO_USED(Gost2814789_cfb64_encrypt); +LCRYPTO_USED(Gost2814789_cnt_encrypt); +LCRYPTO_USED(GOST_CIPHER_PARAMS_new); +LCRYPTO_USED(GOST_CIPHER_PARAMS_free); +LCRYPTO_USED(d2i_GOST_CIPHER_PARAMS); +LCRYPTO_USED(i2d_GOST_CIPHER_PARAMS); +LCRYPTO_USED(GOST2814789IMIT_Init); +LCRYPTO_USED(GOST2814789IMIT_Update); +LCRYPTO_USED(GOST2814789IMIT_Final); +LCRYPTO_USED(GOST2814789IMIT_Transform); +LCRYPTO_USED(GOST2814789IMIT); +LCRYPTO_USED(GOSTR341194_Init); +LCRYPTO_USED(GOSTR341194_Update); +LCRYPTO_USED(GOSTR341194_Final); +LCRYPTO_USED(GOSTR341194_Transform); +LCRYPTO_USED(GOSTR341194); +LCRYPTO_USED(STREEBOG256_Init); +LCRYPTO_USED(STREEBOG256_Update); +LCRYPTO_USED(STREEBOG256_Final); +LCRYPTO_USED(STREEBOG256); +LCRYPTO_USED(STREEBOG512_Init); +LCRYPTO_USED(STREEBOG512_Update); +LCRYPTO_USED(STREEBOG512_Final); +LCRYPTO_USED(STREEBOG512_Transform); +LCRYPTO_USED(STREEBOG512); +LCRYPTO_USED(GOST_KEY_new); +LCRYPTO_USED(GOST_KEY_free); +LCRYPTO_USED(GOST_KEY_check_key); +LCRYPTO_USED(GOST_KEY_set_public_key_affine_coordinates); +LCRYPTO_USED(GOST_KEY_get0_group); +LCRYPTO_USED(GOST_KEY_set_group); +LCRYPTO_USED(GOST_KEY_get_digest); +LCRYPTO_USED(GOST_KEY_set_digest); +LCRYPTO_USED(GOST_KEY_get0_private_key); +LCRYPTO_USED(GOST_KEY_set_private_key); +LCRYPTO_USED(GOST_KEY_get0_public_key); +LCRYPTO_USED(GOST_KEY_set_public_key); +LCRYPTO_USED(GOST_KEY_get_size); +LCRYPTO_USED(ERR_load_GOST_strings); + +#endif /* _LIBCRYPTO_GOST_H */ diff --git a/lib/libcrypto/hidden/openssl/hkdf.h b/lib/libcrypto/hidden/openssl/hkdf.h new file mode 100644 index 000000000..0c01cf3e6 --- /dev/null +++ b/lib/libcrypto/hidden/openssl/hkdf.h @@ -0,0 +1,32 @@ +/* $OpenBSD: hkdf.h,v 1.2 2023/07/07 19:37:54 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_HKDF_H +#define _LIBCRYPTO_HKDF_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/hkdf.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(HKDF); +LCRYPTO_USED(HKDF_extract); +LCRYPTO_USED(HKDF_expand); + +#endif /* _LIBCRYPTO_HKDF_H */ diff --git a/lib/libcrypto/hidden/openssl/idea.h b/lib/libcrypto/hidden/openssl/idea.h new file mode 100644 index 000000000..f8c7caf6a --- /dev/null +++ b/lib/libcrypto/hidden/openssl/idea.h @@ -0,0 +1,37 @@ +/* $OpenBSD: idea.h,v 1.1 2023/07/08 10:44:00 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_IDEA_H +#define _LIBCRYPTO_IDEA_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/idea.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(idea_options); +LCRYPTO_USED(idea_ecb_encrypt); +LCRYPTO_USED(idea_set_encrypt_key); +LCRYPTO_USED(idea_set_decrypt_key); +LCRYPTO_USED(idea_cbc_encrypt); +LCRYPTO_USED(idea_cfb64_encrypt); +LCRYPTO_USED(idea_ofb64_encrypt); +LCRYPTO_USED(idea_encrypt); + +#endif /* _LIBCRYPTO_IDEA_H */ diff --git a/lib/libcrypto/hidden/openssl/lhash.h b/lib/libcrypto/hidden/openssl/lhash.h new file mode 100644 index 000000000..151f154a4 --- /dev/null +++ b/lib/libcrypto/hidden/openssl/lhash.h @@ -0,0 +1,44 @@ +/* $OpenBSD: lhash.h,v 1.2 2023/07/07 19:37:54 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_LHASH_H +#define _LIBCRYPTO_LHASH_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/lhash.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(lh_new); +LCRYPTO_USED(lh_free); +LCRYPTO_USED(lh_insert); +LCRYPTO_USED(lh_delete); +LCRYPTO_USED(lh_retrieve); +LCRYPTO_USED(lh_doall); +LCRYPTO_USED(lh_doall_arg); +LCRYPTO_USED(lh_strhash); +LCRYPTO_USED(lh_num_items); +LCRYPTO_USED(lh_stats); +LCRYPTO_USED(lh_node_stats); +LCRYPTO_USED(lh_node_usage_stats); +LCRYPTO_USED(lh_stats_bio); +LCRYPTO_USED(lh_node_stats_bio); +LCRYPTO_USED(lh_node_usage_stats_bio); + +#endif /* _LIBCRYPTO_LHASH_H */ diff --git a/lib/libcrypto/hidden/openssl/md4.h b/lib/libcrypto/hidden/openssl/md4.h new file mode 100644 index 000000000..c5fc22c47 --- /dev/null +++ b/lib/libcrypto/hidden/openssl/md4.h @@ -0,0 +1,34 @@ +/* $OpenBSD: md4.h,v 1.1 2023/07/08 10:45:57 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_MD4_H +#define _LIBCRYPTO_MD4_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/md4.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(MD4_Init); +LCRYPTO_USED(MD4_Update); +LCRYPTO_USED(MD4_Final); +LCRYPTO_USED(MD4); +LCRYPTO_USED(MD4_Transform); + +#endif /* _LIBCRYPTO_MD4_H */ diff --git a/lib/libcrypto/hidden/openssl/md5.h b/lib/libcrypto/hidden/openssl/md5.h new file mode 100644 index 000000000..3dfade7f7 --- /dev/null +++ b/lib/libcrypto/hidden/openssl/md5.h @@ -0,0 +1,34 @@ +/* $OpenBSD: md5.h,v 1.1 2023/07/08 10:45:57 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_MD5_H +#define _LIBCRYPTO_MD5_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/md5.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(MD5_Init); +LCRYPTO_USED(MD5_Update); +LCRYPTO_USED(MD5_Final); +LCRYPTO_USED(MD5); +LCRYPTO_USED(MD5_Transform); + +#endif /* _LIBCRYPTO_MD5_H */ diff --git a/lib/libcrypto/hidden/openssl/modes.h b/lib/libcrypto/hidden/openssl/modes.h new file mode 100644 index 000000000..4162861be --- /dev/null +++ b/lib/libcrypto/hidden/openssl/modes.h @@ -0,0 +1,57 @@ +/* $OpenBSD: modes.h,v 1.1 2023/07/08 14:56:54 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_MODES_H +#define _LIBCRYPTO_MODES_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/modes.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(CRYPTO_cbc128_encrypt); +LCRYPTO_USED(CRYPTO_cbc128_decrypt); +LCRYPTO_USED(CRYPTO_ctr128_encrypt); +LCRYPTO_USED(CRYPTO_ctr128_encrypt_ctr32); +LCRYPTO_USED(CRYPTO_ofb128_encrypt); +LCRYPTO_USED(CRYPTO_cfb128_encrypt); +LCRYPTO_USED(CRYPTO_cfb128_8_encrypt); +LCRYPTO_USED(CRYPTO_cfb128_1_encrypt); +LCRYPTO_USED(CRYPTO_gcm128_new); +LCRYPTO_USED(CRYPTO_gcm128_init); +LCRYPTO_USED(CRYPTO_gcm128_setiv); +LCRYPTO_USED(CRYPTO_gcm128_aad); +LCRYPTO_USED(CRYPTO_gcm128_encrypt); +LCRYPTO_USED(CRYPTO_gcm128_decrypt); +LCRYPTO_USED(CRYPTO_gcm128_encrypt_ctr32); +LCRYPTO_USED(CRYPTO_gcm128_decrypt_ctr32); +LCRYPTO_USED(CRYPTO_gcm128_finish); +LCRYPTO_USED(CRYPTO_gcm128_tag); +LCRYPTO_USED(CRYPTO_gcm128_release); +LCRYPTO_USED(CRYPTO_ccm128_init); +LCRYPTO_USED(CRYPTO_ccm128_setiv); +LCRYPTO_USED(CRYPTO_ccm128_aad); +LCRYPTO_USED(CRYPTO_ccm128_encrypt); +LCRYPTO_USED(CRYPTO_ccm128_decrypt); +LCRYPTO_USED(CRYPTO_ccm128_encrypt_ccm64); +LCRYPTO_USED(CRYPTO_ccm128_decrypt_ccm64); +LCRYPTO_USED(CRYPTO_ccm128_tag); +LCRYPTO_USED(CRYPTO_xts128_encrypt); + +#endif /* _LIBCRYPTO_MODES_H */ diff --git a/lib/libcrypto/hidden/openssl/objects.h b/lib/libcrypto/hidden/openssl/objects.h new file mode 100644 index 000000000..f658a7cfa --- /dev/null +++ b/lib/libcrypto/hidden/openssl/objects.h @@ -0,0 +1,61 @@ +/* $OpenBSD: objects.h,v 1.1 2023/07/08 12:27:51 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_OBJECTS_H +#define _LIBCRYPTO_OBJECTS_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/objects.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(OBJ_NAME_init); +LCRYPTO_USED(OBJ_NAME_new_index); +LCRYPTO_USED(OBJ_NAME_get); +LCRYPTO_USED(OBJ_NAME_add); +LCRYPTO_USED(OBJ_NAME_remove); +LCRYPTO_USED(OBJ_NAME_cleanup); +LCRYPTO_USED(OBJ_NAME_do_all); +LCRYPTO_USED(OBJ_NAME_do_all_sorted); +LCRYPTO_USED(OBJ_dup); +LCRYPTO_USED(OBJ_nid2obj); +LCRYPTO_USED(OBJ_nid2ln); +LCRYPTO_USED(OBJ_nid2sn); +LCRYPTO_USED(OBJ_obj2nid); +LCRYPTO_USED(OBJ_txt2obj); +LCRYPTO_USED(OBJ_obj2txt); +LCRYPTO_USED(OBJ_txt2nid); +LCRYPTO_USED(OBJ_ln2nid); +LCRYPTO_USED(OBJ_sn2nid); +LCRYPTO_USED(OBJ_cmp); +LCRYPTO_USED(OBJ_bsearch_); +LCRYPTO_USED(OBJ_new_nid); +LCRYPTO_USED(OBJ_add_object); +LCRYPTO_USED(OBJ_create); +LCRYPTO_USED(OBJ_cleanup); +LCRYPTO_USED(OBJ_create_objects); +LCRYPTO_USED(OBJ_length); +LCRYPTO_USED(OBJ_get0_data); +LCRYPTO_USED(OBJ_find_sigid_algs); +LCRYPTO_USED(OBJ_find_sigid_by_algs); +LCRYPTO_USED(OBJ_add_sigid); +LCRYPTO_USED(OBJ_sigid_free); +LCRYPTO_USED(ERR_load_OBJ_strings); + +#endif /* _LIBCRYPTO_OBJECTS_H */ diff --git a/lib/libcrypto/hidden/openssl/ocsp.h b/lib/libcrypto/hidden/openssl/ocsp.h new file mode 100644 index 000000000..654696224 --- /dev/null +++ b/lib/libcrypto/hidden/openssl/ocsp.h @@ -0,0 +1,190 @@ +/* $OpenBSD: ocsp.h,v 1.1 2023/07/08 10:44:00 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_OCSP_H +#define _LIBCRYPTO_OCSP_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/ocsp.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(OCSP_RESPID_new); +LCRYPTO_USED(OCSP_RESPID_free); +LCRYPTO_USED(d2i_OCSP_RESPID); +LCRYPTO_USED(i2d_OCSP_RESPID); +LCRYPTO_USED(OCSP_CERTID_dup); +LCRYPTO_USED(OCSP_sendreq_bio); +LCRYPTO_USED(OCSP_sendreq_new); +LCRYPTO_USED(OCSP_sendreq_nbio); +LCRYPTO_USED(OCSP_REQ_CTX_free); +LCRYPTO_USED(OCSP_REQ_CTX_set1_req); +LCRYPTO_USED(OCSP_REQ_CTX_add1_header); +LCRYPTO_USED(OCSP_cert_to_id); +LCRYPTO_USED(OCSP_cert_id_new); +LCRYPTO_USED(OCSP_request_add0_id); +LCRYPTO_USED(OCSP_request_add1_nonce); +LCRYPTO_USED(OCSP_basic_add1_nonce); +LCRYPTO_USED(OCSP_check_nonce); +LCRYPTO_USED(OCSP_copy_nonce); +LCRYPTO_USED(OCSP_request_set1_name); +LCRYPTO_USED(OCSP_request_add1_cert); +LCRYPTO_USED(OCSP_request_sign); +LCRYPTO_USED(OCSP_response_status); +LCRYPTO_USED(OCSP_response_get1_basic); +LCRYPTO_USED(OCSP_resp_get0_signature); +LCRYPTO_USED(OCSP_resp_get0_tbs_sigalg); +LCRYPTO_USED(OCSP_resp_get0_respdata); +LCRYPTO_USED(OCSP_resp_get0_signer); +LCRYPTO_USED(OCSP_resp_count); +LCRYPTO_USED(OCSP_resp_get0); +LCRYPTO_USED(OCSP_resp_get0_produced_at); +LCRYPTO_USED(OCSP_resp_get0_certs); +LCRYPTO_USED(OCSP_resp_get0_id); +LCRYPTO_USED(OCSP_resp_find); +LCRYPTO_USED(OCSP_single_get0_status); +LCRYPTO_USED(OCSP_resp_find_status); +LCRYPTO_USED(OCSP_check_validity); +LCRYPTO_USED(OCSP_request_verify); +LCRYPTO_USED(OCSP_parse_url); +LCRYPTO_USED(OCSP_id_issuer_cmp); +LCRYPTO_USED(OCSP_id_cmp); +LCRYPTO_USED(OCSP_request_onereq_count); +LCRYPTO_USED(OCSP_request_onereq_get0); +LCRYPTO_USED(OCSP_onereq_get0_id); +LCRYPTO_USED(OCSP_id_get0_info); +LCRYPTO_USED(OCSP_request_is_signed); +LCRYPTO_USED(OCSP_response_create); +LCRYPTO_USED(OCSP_basic_add1_status); +LCRYPTO_USED(OCSP_basic_add1_cert); +LCRYPTO_USED(OCSP_basic_sign); +LCRYPTO_USED(OCSP_crlID_new); +LCRYPTO_USED(OCSP_accept_responses_new); +LCRYPTO_USED(OCSP_archive_cutoff_new); +LCRYPTO_USED(OCSP_url_svcloc_new); +LCRYPTO_USED(OCSP_REQUEST_get_ext_count); +LCRYPTO_USED(OCSP_REQUEST_get_ext_by_NID); +LCRYPTO_USED(OCSP_REQUEST_get_ext_by_OBJ); +LCRYPTO_USED(OCSP_REQUEST_get_ext_by_critical); +LCRYPTO_USED(OCSP_REQUEST_get_ext); +LCRYPTO_USED(OCSP_REQUEST_delete_ext); +LCRYPTO_USED(OCSP_REQUEST_get1_ext_d2i); +LCRYPTO_USED(OCSP_REQUEST_add1_ext_i2d); +LCRYPTO_USED(OCSP_REQUEST_add_ext); +LCRYPTO_USED(OCSP_ONEREQ_get_ext_count); +LCRYPTO_USED(OCSP_ONEREQ_get_ext_by_NID); +LCRYPTO_USED(OCSP_ONEREQ_get_ext_by_OBJ); +LCRYPTO_USED(OCSP_ONEREQ_get_ext_by_critical); +LCRYPTO_USED(OCSP_ONEREQ_get_ext); +LCRYPTO_USED(OCSP_ONEREQ_delete_ext); +LCRYPTO_USED(OCSP_ONEREQ_get1_ext_d2i); +LCRYPTO_USED(OCSP_ONEREQ_add1_ext_i2d); +LCRYPTO_USED(OCSP_ONEREQ_add_ext); +LCRYPTO_USED(OCSP_BASICRESP_get_ext_count); +LCRYPTO_USED(OCSP_BASICRESP_get_ext_by_NID); +LCRYPTO_USED(OCSP_BASICRESP_get_ext_by_OBJ); +LCRYPTO_USED(OCSP_BASICRESP_get_ext_by_critical); +LCRYPTO_USED(OCSP_BASICRESP_get_ext); +LCRYPTO_USED(OCSP_BASICRESP_delete_ext); +LCRYPTO_USED(OCSP_BASICRESP_get1_ext_d2i); +LCRYPTO_USED(OCSP_BASICRESP_add1_ext_i2d); +LCRYPTO_USED(OCSP_BASICRESP_add_ext); +LCRYPTO_USED(OCSP_SINGLERESP_get_ext_count); +LCRYPTO_USED(OCSP_SINGLERESP_get_ext_by_NID); +LCRYPTO_USED(OCSP_SINGLERESP_get_ext_by_OBJ); +LCRYPTO_USED(OCSP_SINGLERESP_get_ext_by_critical); +LCRYPTO_USED(OCSP_SINGLERESP_get_ext); +LCRYPTO_USED(OCSP_SINGLERESP_delete_ext); +LCRYPTO_USED(OCSP_SINGLERESP_get1_ext_d2i); +LCRYPTO_USED(OCSP_SINGLERESP_add1_ext_i2d); +LCRYPTO_USED(OCSP_SINGLERESP_add_ext); +LCRYPTO_USED(OCSP_SINGLERESP_get0_id); +LCRYPTO_USED(OCSP_SINGLERESP_new); +LCRYPTO_USED(OCSP_SINGLERESP_free); +LCRYPTO_USED(d2i_OCSP_SINGLERESP); +LCRYPTO_USED(i2d_OCSP_SINGLERESP); +LCRYPTO_USED(OCSP_CERTSTATUS_new); +LCRYPTO_USED(OCSP_CERTSTATUS_free); +LCRYPTO_USED(d2i_OCSP_CERTSTATUS); +LCRYPTO_USED(i2d_OCSP_CERTSTATUS); +LCRYPTO_USED(OCSP_REVOKEDINFO_new); +LCRYPTO_USED(OCSP_REVOKEDINFO_free); +LCRYPTO_USED(d2i_OCSP_REVOKEDINFO); +LCRYPTO_USED(i2d_OCSP_REVOKEDINFO); +LCRYPTO_USED(OCSP_BASICRESP_new); +LCRYPTO_USED(OCSP_BASICRESP_free); +LCRYPTO_USED(d2i_OCSP_BASICRESP); +LCRYPTO_USED(i2d_OCSP_BASICRESP); +LCRYPTO_USED(OCSP_RESPDATA_new); +LCRYPTO_USED(OCSP_RESPDATA_free); +LCRYPTO_USED(d2i_OCSP_RESPDATA); +LCRYPTO_USED(i2d_OCSP_RESPDATA); +LCRYPTO_USED(OCSP_RESPID_new); +LCRYPTO_USED(OCSP_RESPID_free); +LCRYPTO_USED(d2i_OCSP_RESPID); +LCRYPTO_USED(i2d_OCSP_RESPID); +LCRYPTO_USED(OCSP_RESPONSE_new); +LCRYPTO_USED(OCSP_RESPONSE_free); +LCRYPTO_USED(d2i_OCSP_RESPONSE); +LCRYPTO_USED(i2d_OCSP_RESPONSE); +LCRYPTO_USED(d2i_OCSP_RESPONSE_bio); +LCRYPTO_USED(i2d_OCSP_RESPONSE_bio); +LCRYPTO_USED(OCSP_RESPBYTES_new); +LCRYPTO_USED(OCSP_RESPBYTES_free); +LCRYPTO_USED(d2i_OCSP_RESPBYTES); +LCRYPTO_USED(i2d_OCSP_RESPBYTES); +LCRYPTO_USED(OCSP_ONEREQ_new); +LCRYPTO_USED(OCSP_ONEREQ_free); +LCRYPTO_USED(d2i_OCSP_ONEREQ); +LCRYPTO_USED(i2d_OCSP_ONEREQ); +LCRYPTO_USED(OCSP_CERTID_new); +LCRYPTO_USED(OCSP_CERTID_free); +LCRYPTO_USED(d2i_OCSP_CERTID); +LCRYPTO_USED(i2d_OCSP_CERTID); +LCRYPTO_USED(OCSP_REQUEST_new); +LCRYPTO_USED(OCSP_REQUEST_free); +LCRYPTO_USED(d2i_OCSP_REQUEST); +LCRYPTO_USED(i2d_OCSP_REQUEST); +LCRYPTO_USED(d2i_OCSP_REQUEST_bio); +LCRYPTO_USED(i2d_OCSP_REQUEST_bio); +LCRYPTO_USED(OCSP_SIGNATURE_new); +LCRYPTO_USED(OCSP_SIGNATURE_free); +LCRYPTO_USED(d2i_OCSP_SIGNATURE); +LCRYPTO_USED(i2d_OCSP_SIGNATURE); +LCRYPTO_USED(OCSP_REQINFO_new); +LCRYPTO_USED(OCSP_REQINFO_free); +LCRYPTO_USED(d2i_OCSP_REQINFO); +LCRYPTO_USED(i2d_OCSP_REQINFO); +LCRYPTO_USED(OCSP_CRLID_new); +LCRYPTO_USED(OCSP_CRLID_free); +LCRYPTO_USED(d2i_OCSP_CRLID); +LCRYPTO_USED(i2d_OCSP_CRLID); +LCRYPTO_USED(OCSP_SERVICELOC_new); +LCRYPTO_USED(OCSP_SERVICELOC_free); +LCRYPTO_USED(d2i_OCSP_SERVICELOC); +LCRYPTO_USED(i2d_OCSP_SERVICELOC); +LCRYPTO_USED(OCSP_response_status_str); +LCRYPTO_USED(OCSP_cert_status_str); +LCRYPTO_USED(OCSP_crl_reason_str); +LCRYPTO_USED(OCSP_REQUEST_print); +LCRYPTO_USED(OCSP_RESPONSE_print); +LCRYPTO_USED(OCSP_basic_verify); +LCRYPTO_USED(ERR_load_OCSP_strings); + +#endif /* _LIBCRYPTO_OCSP_H */ diff --git a/lib/libcrypto/hidden/openssl/pem.h b/lib/libcrypto/hidden/openssl/pem.h new file mode 100644 index 000000000..5838f07f4 --- /dev/null +++ b/lib/libcrypto/hidden/openssl/pem.h @@ -0,0 +1,149 @@ +/* $OpenBSD: pem.h,v 1.2 2023/07/07 19:37:54 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_PEM_H +#define _LIBCRYPTO_PEM_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/pem.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(PEM_get_EVP_CIPHER_INFO); +LCRYPTO_USED(PEM_do_header); +LCRYPTO_USED(PEM_read_bio); +LCRYPTO_USED(PEM_write_bio); +LCRYPTO_USED(PEM_bytes_read_bio); +LCRYPTO_USED(PEM_ASN1_read_bio); +LCRYPTO_USED(PEM_ASN1_write_bio); +LCRYPTO_USED(PEM_X509_INFO_read_bio); +LCRYPTO_USED(PEM_X509_INFO_write_bio); +LCRYPTO_USED(PEM_read); +LCRYPTO_USED(PEM_write); +LCRYPTO_USED(PEM_ASN1_read); +LCRYPTO_USED(PEM_ASN1_write); +LCRYPTO_USED(PEM_X509_INFO_read); +LCRYPTO_USED(PEM_SignInit); +LCRYPTO_USED(PEM_SignUpdate); +LCRYPTO_USED(PEM_SignFinal); +LCRYPTO_USED(PEM_def_callback); +LCRYPTO_USED(PEM_proc_type); +LCRYPTO_USED(PEM_dek_info); +LCRYPTO_USED(PEM_read_X509); +LCRYPTO_USED(PEM_read_bio_X509); +LCRYPTO_USED(PEM_write_X509); +LCRYPTO_USED(PEM_write_bio_X509); +LCRYPTO_USED(PEM_read_X509_AUX); +LCRYPTO_USED(PEM_read_bio_X509_AUX); +LCRYPTO_USED(PEM_write_X509_AUX); +LCRYPTO_USED(PEM_write_bio_X509_AUX); +LCRYPTO_USED(PEM_read_X509_REQ); +LCRYPTO_USED(PEM_read_bio_X509_REQ); +LCRYPTO_USED(PEM_write_X509_REQ); +LCRYPTO_USED(PEM_write_bio_X509_REQ); +LCRYPTO_USED(PEM_write_X509_REQ_NEW); +LCRYPTO_USED(PEM_write_bio_X509_REQ_NEW); +LCRYPTO_USED(PEM_read_X509_CRL); +LCRYPTO_USED(PEM_read_bio_X509_CRL); +LCRYPTO_USED(PEM_write_X509_CRL); +LCRYPTO_USED(PEM_write_bio_X509_CRL); +LCRYPTO_USED(PEM_read_PKCS7); +LCRYPTO_USED(PEM_read_bio_PKCS7); +LCRYPTO_USED(PEM_write_PKCS7); +LCRYPTO_USED(PEM_write_bio_PKCS7); +LCRYPTO_USED(PEM_read_PKCS8); +LCRYPTO_USED(PEM_read_bio_PKCS8); +LCRYPTO_USED(PEM_write_PKCS8); +LCRYPTO_USED(PEM_write_bio_PKCS8); +LCRYPTO_USED(PEM_read_PKCS8_PRIV_KEY_INFO); +LCRYPTO_USED(PEM_read_bio_PKCS8_PRIV_KEY_INFO); +LCRYPTO_USED(PEM_write_PKCS8_PRIV_KEY_INFO); +LCRYPTO_USED(PEM_write_bio_PKCS8_PRIV_KEY_INFO); +LCRYPTO_USED(PEM_read_RSAPrivateKey); +LCRYPTO_USED(PEM_read_bio_RSAPrivateKey); +LCRYPTO_USED(PEM_write_RSAPrivateKey); +LCRYPTO_USED(PEM_write_bio_RSAPrivateKey); +LCRYPTO_USED(PEM_read_RSAPublicKey); +LCRYPTO_USED(PEM_read_bio_RSAPublicKey); +LCRYPTO_USED(PEM_write_RSAPublicKey); +LCRYPTO_USED(PEM_write_bio_RSAPublicKey); +LCRYPTO_USED(PEM_read_RSA_PUBKEY); +LCRYPTO_USED(PEM_read_bio_RSA_PUBKEY); +LCRYPTO_USED(PEM_write_RSA_PUBKEY); +LCRYPTO_USED(PEM_write_bio_RSA_PUBKEY); +LCRYPTO_USED(PEM_read_DSAPrivateKey); +LCRYPTO_USED(PEM_read_bio_DSAPrivateKey); +LCRYPTO_USED(PEM_write_DSAPrivateKey); +LCRYPTO_USED(PEM_write_bio_DSAPrivateKey); +LCRYPTO_USED(PEM_read_DSA_PUBKEY); +LCRYPTO_USED(PEM_read_bio_DSA_PUBKEY); +LCRYPTO_USED(PEM_write_DSA_PUBKEY); +LCRYPTO_USED(PEM_write_bio_DSA_PUBKEY); +LCRYPTO_USED(PEM_read_DSAparams); +LCRYPTO_USED(PEM_read_bio_DSAparams); +LCRYPTO_USED(PEM_write_DSAparams); +LCRYPTO_USED(PEM_write_bio_DSAparams); +LCRYPTO_USED(PEM_read_ECPKParameters); +LCRYPTO_USED(PEM_read_bio_ECPKParameters); +LCRYPTO_USED(PEM_write_ECPKParameters); +LCRYPTO_USED(PEM_write_bio_ECPKParameters); +LCRYPTO_USED(PEM_read_ECPrivateKey); +LCRYPTO_USED(PEM_read_bio_ECPrivateKey); +LCRYPTO_USED(PEM_write_ECPrivateKey); +LCRYPTO_USED(PEM_write_bio_ECPrivateKey); +LCRYPTO_USED(PEM_read_EC_PUBKEY); +LCRYPTO_USED(PEM_read_bio_EC_PUBKEY); +LCRYPTO_USED(PEM_write_EC_PUBKEY); +LCRYPTO_USED(PEM_write_bio_EC_PUBKEY); +LCRYPTO_USED(PEM_read_DHparams); +LCRYPTO_USED(PEM_read_bio_DHparams); +LCRYPTO_USED(PEM_write_DHparams); +LCRYPTO_USED(PEM_write_bio_DHparams); +LCRYPTO_USED(PEM_read_PrivateKey); +LCRYPTO_USED(PEM_read_bio_PrivateKey); +LCRYPTO_USED(PEM_write_PrivateKey); +LCRYPTO_USED(PEM_write_bio_PrivateKey); +LCRYPTO_USED(PEM_read_PUBKEY); +LCRYPTO_USED(PEM_read_bio_PUBKEY); +LCRYPTO_USED(PEM_write_PUBKEY); +LCRYPTO_USED(PEM_write_bio_PUBKEY); +LCRYPTO_USED(PEM_write_bio_PrivateKey_traditional); +LCRYPTO_USED(PEM_write_bio_PKCS8PrivateKey_nid); +LCRYPTO_USED(PEM_write_bio_PKCS8PrivateKey); +LCRYPTO_USED(i2d_PKCS8PrivateKey_bio); +LCRYPTO_USED(i2d_PKCS8PrivateKey_nid_bio); +LCRYPTO_USED(d2i_PKCS8PrivateKey_bio); +LCRYPTO_USED(i2d_PKCS8PrivateKey_fp); +LCRYPTO_USED(i2d_PKCS8PrivateKey_nid_fp); +LCRYPTO_USED(PEM_write_PKCS8PrivateKey_nid); +LCRYPTO_USED(d2i_PKCS8PrivateKey_fp); +LCRYPTO_USED(PEM_write_PKCS8PrivateKey); +LCRYPTO_USED(PEM_read_bio_Parameters); +LCRYPTO_USED(PEM_write_bio_Parameters); +LCRYPTO_USED(b2i_PrivateKey); +LCRYPTO_USED(b2i_PublicKey); +LCRYPTO_USED(b2i_PrivateKey_bio); +LCRYPTO_USED(b2i_PublicKey_bio); +LCRYPTO_USED(i2b_PrivateKey_bio); +LCRYPTO_USED(i2b_PublicKey_bio); +LCRYPTO_USED(b2i_PVK_bio); +LCRYPTO_USED(i2b_PVK_bio); +LCRYPTO_USED(ERR_load_PEM_strings); + +#endif /* _LIBCRYPTO_PEM_H */ diff --git a/lib/libcrypto/hidden/openssl/poly1305.h b/lib/libcrypto/hidden/openssl/poly1305.h new file mode 100644 index 000000000..7a459cb5a --- /dev/null +++ b/lib/libcrypto/hidden/openssl/poly1305.h @@ -0,0 +1,32 @@ +/* $OpenBSD: poly1305.h,v 1.2 2023/07/07 19:37:54 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_POLY1305_H +#define _LIBCRYPTO_POLY1305_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/poly1305.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(CRYPTO_poly1305_init); +LCRYPTO_USED(CRYPTO_poly1305_update); +LCRYPTO_USED(CRYPTO_poly1305_finish); + +#endif /* _LIBCRYPTO_POLY1305_H */ diff --git a/lib/libcrypto/hidden/openssl/rand.h b/lib/libcrypto/hidden/openssl/rand.h new file mode 100644 index 000000000..d94a1bfd5 --- /dev/null +++ b/lib/libcrypto/hidden/openssl/rand.h @@ -0,0 +1,34 @@ +/* $OpenBSD: rand.h,v 1.2 2023/07/07 19:37:54 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_RAND_H +#define _LIBCRYPTO_RAND_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/rand.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(RAND_set_rand_method); +LCRYPTO_USED(RAND_get_rand_method); +LCRYPTO_USED(RAND_set_rand_engine); +LCRYPTO_USED(RAND_SSLeay); +LCRYPTO_USED(ERR_load_RAND_strings); + +#endif /* _LIBCRYPTO_RAND_H */ diff --git a/lib/libcrypto/hidden/openssl/rc2.h b/lib/libcrypto/hidden/openssl/rc2.h new file mode 100644 index 000000000..c08c38d7c --- /dev/null +++ b/lib/libcrypto/hidden/openssl/rc2.h @@ -0,0 +1,36 @@ +/* $OpenBSD: rc2.h,v 1.1 2023/07/07 13:40:44 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_RC2_H +#define _LIBCRYPTO_RC2_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/rc2.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(RC2_set_key); +LCRYPTO_USED(RC2_ecb_encrypt); +LCRYPTO_USED(RC2_encrypt); +LCRYPTO_USED(RC2_decrypt); +LCRYPTO_USED(RC2_cbc_encrypt); +LCRYPTO_USED(RC2_cfb64_encrypt); +LCRYPTO_USED(RC2_ofb64_encrypt); + +#endif /* _LIBCRYPTO_RC2_H */ diff --git a/lib/libcrypto/hidden/openssl/rsa.h b/lib/libcrypto/hidden/openssl/rsa.h new file mode 100644 index 000000000..f4342e21d --- /dev/null +++ b/lib/libcrypto/hidden/openssl/rsa.h @@ -0,0 +1,142 @@ +/* $OpenBSD: rsa.h,v 1.1 2023/07/08 12:26:45 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_RSA_H +#define _LIBCRYPTO_RSA_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/rsa.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(RSA_new); +LCRYPTO_USED(RSA_new_method); +LCRYPTO_USED(RSA_bits); +LCRYPTO_USED(RSA_size); +LCRYPTO_USED(RSA_generate_key); +LCRYPTO_USED(RSA_generate_key_ex); +LCRYPTO_USED(RSA_check_key); +LCRYPTO_USED(RSA_public_encrypt); +LCRYPTO_USED(RSA_private_encrypt); +LCRYPTO_USED(RSA_public_decrypt); +LCRYPTO_USED(RSA_private_decrypt); +LCRYPTO_USED(RSA_free); +LCRYPTO_USED(RSA_up_ref); +LCRYPTO_USED(RSA_flags); +LCRYPTO_USED(RSA_set_default_method); +LCRYPTO_USED(RSA_get_default_method); +LCRYPTO_USED(RSA_get_method); +LCRYPTO_USED(RSA_set_method); +LCRYPTO_USED(RSA_PKCS1_OpenSSL); +LCRYPTO_USED(RSA_PKCS1_SSLeay); +LCRYPTO_USED(RSA_pkey_ctx_ctrl); +LCRYPTO_USED(d2i_RSAPublicKey); +LCRYPTO_USED(i2d_RSAPublicKey); +LCRYPTO_USED(d2i_RSAPrivateKey); +LCRYPTO_USED(i2d_RSAPrivateKey); +LCRYPTO_USED(RSA_PSS_PARAMS_new); +LCRYPTO_USED(RSA_PSS_PARAMS_free); +LCRYPTO_USED(d2i_RSA_PSS_PARAMS); +LCRYPTO_USED(i2d_RSA_PSS_PARAMS); +LCRYPTO_USED(RSA_OAEP_PARAMS_new); +LCRYPTO_USED(RSA_OAEP_PARAMS_free); +LCRYPTO_USED(d2i_RSA_OAEP_PARAMS); +LCRYPTO_USED(i2d_RSA_OAEP_PARAMS); +LCRYPTO_USED(RSA_print_fp); +LCRYPTO_USED(RSA_print); +LCRYPTO_USED(RSA_sign); +LCRYPTO_USED(RSA_verify); +LCRYPTO_USED(RSA_sign_ASN1_OCTET_STRING); +LCRYPTO_USED(RSA_verify_ASN1_OCTET_STRING); +LCRYPTO_USED(RSA_blinding_on); +LCRYPTO_USED(RSA_blinding_off); +LCRYPTO_USED(RSA_setup_blinding); +LCRYPTO_USED(RSA_padding_add_PKCS1_type_1); +LCRYPTO_USED(RSA_padding_check_PKCS1_type_1); +LCRYPTO_USED(RSA_padding_add_PKCS1_type_2); +LCRYPTO_USED(RSA_padding_check_PKCS1_type_2); +LCRYPTO_USED(PKCS1_MGF1); +LCRYPTO_USED(RSA_padding_add_PKCS1_OAEP); +LCRYPTO_USED(RSA_padding_check_PKCS1_OAEP); +LCRYPTO_USED(RSA_padding_add_PKCS1_OAEP_mgf1); +LCRYPTO_USED(RSA_padding_check_PKCS1_OAEP_mgf1); +LCRYPTO_USED(RSA_padding_add_none); +LCRYPTO_USED(RSA_padding_check_none); +LCRYPTO_USED(RSA_verify_PKCS1_PSS); +LCRYPTO_USED(RSA_padding_add_PKCS1_PSS); +LCRYPTO_USED(RSA_verify_PKCS1_PSS_mgf1); +LCRYPTO_USED(RSA_padding_add_PKCS1_PSS_mgf1); +LCRYPTO_USED(RSA_get_ex_new_index); +LCRYPTO_USED(RSA_set_ex_data); +LCRYPTO_USED(RSA_get_ex_data); +LCRYPTO_USED(RSA_security_bits); +LCRYPTO_USED(RSA_get0_key); +LCRYPTO_USED(RSA_set0_key); +LCRYPTO_USED(RSA_get0_crt_params); +LCRYPTO_USED(RSA_set0_crt_params); +LCRYPTO_USED(RSA_get0_factors); +LCRYPTO_USED(RSA_set0_factors); +LCRYPTO_USED(RSA_get0_n); +LCRYPTO_USED(RSA_get0_e); +LCRYPTO_USED(RSA_get0_d); +LCRYPTO_USED(RSA_get0_p); +LCRYPTO_USED(RSA_get0_q); +LCRYPTO_USED(RSA_get0_dmp1); +LCRYPTO_USED(RSA_get0_dmq1); +LCRYPTO_USED(RSA_get0_iqmp); +LCRYPTO_USED(RSA_get0_pss_params); +LCRYPTO_USED(RSA_clear_flags); +LCRYPTO_USED(RSA_test_flags); +LCRYPTO_USED(RSA_set_flags); +LCRYPTO_USED(RSAPublicKey_dup); +LCRYPTO_USED(RSAPrivateKey_dup); +LCRYPTO_USED(RSA_meth_new); +LCRYPTO_USED(RSA_meth_free); +LCRYPTO_USED(RSA_meth_dup); +LCRYPTO_USED(RSA_meth_set1_name); +LCRYPTO_USED(RSA_meth_set_priv_enc); +LCRYPTO_USED(RSA_meth_set_priv_dec); +LCRYPTO_USED(RSA_meth_get_finish); +LCRYPTO_USED(RSA_meth_set_finish); +LCRYPTO_USED(RSA_meth_set_pub_enc); +LCRYPTO_USED(RSA_meth_set_pub_dec); +LCRYPTO_USED(RSA_meth_set_mod_exp); +LCRYPTO_USED(RSA_meth_set_bn_mod_exp); +LCRYPTO_USED(RSA_meth_set_init); +LCRYPTO_USED(RSA_meth_set_keygen); +LCRYPTO_USED(RSA_meth_set_flags); +LCRYPTO_USED(RSA_meth_set0_app_data); +LCRYPTO_USED(RSA_meth_get0_name); +LCRYPTO_USED(RSA_meth_get_pub_enc); +LCRYPTO_USED(RSA_meth_get_pub_dec); +LCRYPTO_USED(RSA_meth_get_priv_enc); +LCRYPTO_USED(RSA_meth_get_priv_dec); +LCRYPTO_USED(RSA_meth_get_mod_exp); +LCRYPTO_USED(RSA_meth_get_bn_mod_exp); +LCRYPTO_USED(RSA_meth_get_init); +LCRYPTO_USED(RSA_meth_get_keygen); +LCRYPTO_USED(RSA_meth_get_flags); +LCRYPTO_USED(RSA_meth_get0_app_data); +LCRYPTO_USED(RSA_meth_get_sign); +LCRYPTO_USED(RSA_meth_set_sign); +LCRYPTO_USED(RSA_meth_get_verify); +LCRYPTO_USED(RSA_meth_set_verify); +LCRYPTO_USED(ERR_load_RSA_strings); + +#endif /* _LIBCRYPTO_RSA_H */ diff --git a/lib/libcrypto/hidden/openssl/sha.h b/lib/libcrypto/hidden/openssl/sha.h new file mode 100644 index 000000000..ee5879320 --- /dev/null +++ b/lib/libcrypto/hidden/openssl/sha.h @@ -0,0 +1,52 @@ +/* $OpenBSD: sha.h,v 1.1 2023/07/08 12:24:10 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_SHA_H +#define _LIBCRYPTO_SHA_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/sha.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(SHA1_Init); +LCRYPTO_USED(SHA1_Update); +LCRYPTO_USED(SHA1_Final); +LCRYPTO_USED(SHA1); +LCRYPTO_USED(SHA1_Transform); +LCRYPTO_USED(SHA224_Init); +LCRYPTO_USED(SHA224_Update); +LCRYPTO_USED(SHA224_Final); +LCRYPTO_USED(SHA224); +LCRYPTO_USED(SHA256_Init); +LCRYPTO_USED(SHA256_Update); +LCRYPTO_USED(SHA256_Final); +LCRYPTO_USED(SHA256); +LCRYPTO_USED(SHA256_Transform); +LCRYPTO_USED(SHA384_Init); +LCRYPTO_USED(SHA384_Update); +LCRYPTO_USED(SHA384_Final); +LCRYPTO_USED(SHA384); +LCRYPTO_USED(SHA512_Init); +LCRYPTO_USED(SHA512_Update); +LCRYPTO_USED(SHA512_Final); +LCRYPTO_USED(SHA512); +LCRYPTO_USED(SHA512_Transform); + +#endif /* _LIBCRYPTO_SHA_H */ diff --git a/lib/libcrypto/hidden/openssl/sm3.h b/lib/libcrypto/hidden/openssl/sm3.h new file mode 100644 index 000000000..12a0e1ad1 --- /dev/null +++ b/lib/libcrypto/hidden/openssl/sm3.h @@ -0,0 +1,32 @@ +/* $OpenBSD: sm3.h,v 1.3 2023/07/08 06:13:08 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_SM3_H +#define _LIBCRYPTO_SM3_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/sm3.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(SM3_Init); +LCRYPTO_USED(SM3_Update); +LCRYPTO_USED(SM3_Final); + +#endif /* _LIBCRYPTO_SM3_H */ diff --git a/lib/libcrypto/hidden/openssl/sm4.h b/lib/libcrypto/hidden/openssl/sm4.h new file mode 100644 index 000000000..1b80e5cbc --- /dev/null +++ b/lib/libcrypto/hidden/openssl/sm4.h @@ -0,0 +1,32 @@ +/* $OpenBSD: sm4.h,v 1.2 2023/07/07 19:37:54 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_SM4_H +#define _LIBCRYPTO_SM4_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/sm4.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(SM4_set_key); +LCRYPTO_USED(SM4_decrypt); +LCRYPTO_USED(SM4_encrypt); + +#endif /* _LIBCRYPTO_SM4_H */ diff --git a/lib/libcrypto/hidden/openssl/ts.h b/lib/libcrypto/hidden/openssl/ts.h new file mode 100644 index 000000000..638f72f2f --- /dev/null +++ b/lib/libcrypto/hidden/openssl/ts.h @@ -0,0 +1,219 @@ +/* $OpenBSD: ts.h,v 1.2 2023/07/07 19:37:54 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_TS_H +#define _LIBCRYPTO_TS_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/ts.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(TS_REQ_new); +LCRYPTO_USED(TS_REQ_free); +LCRYPTO_USED(i2d_TS_REQ); +LCRYPTO_USED(d2i_TS_REQ); +LCRYPTO_USED(TS_REQ_dup); +LCRYPTO_USED(d2i_TS_REQ_fp); +LCRYPTO_USED(i2d_TS_REQ_fp); +LCRYPTO_USED(d2i_TS_REQ_bio); +LCRYPTO_USED(i2d_TS_REQ_bio); +LCRYPTO_USED(TS_MSG_IMPRINT_new); +LCRYPTO_USED(TS_MSG_IMPRINT_free); +LCRYPTO_USED(i2d_TS_MSG_IMPRINT); +LCRYPTO_USED(d2i_TS_MSG_IMPRINT); +LCRYPTO_USED(TS_MSG_IMPRINT_dup); +LCRYPTO_USED(d2i_TS_MSG_IMPRINT_fp); +LCRYPTO_USED(i2d_TS_MSG_IMPRINT_fp); +LCRYPTO_USED(d2i_TS_MSG_IMPRINT_bio); +LCRYPTO_USED(i2d_TS_MSG_IMPRINT_bio); +LCRYPTO_USED(TS_RESP_new); +LCRYPTO_USED(TS_RESP_free); +LCRYPTO_USED(i2d_TS_RESP); +LCRYPTO_USED(d2i_TS_RESP); +LCRYPTO_USED(PKCS7_to_TS_TST_INFO); +LCRYPTO_USED(TS_RESP_dup); +LCRYPTO_USED(d2i_TS_RESP_fp); +LCRYPTO_USED(i2d_TS_RESP_fp); +LCRYPTO_USED(d2i_TS_RESP_bio); +LCRYPTO_USED(i2d_TS_RESP_bio); +LCRYPTO_USED(TS_STATUS_INFO_new); +LCRYPTO_USED(TS_STATUS_INFO_free); +LCRYPTO_USED(i2d_TS_STATUS_INFO); +LCRYPTO_USED(d2i_TS_STATUS_INFO); +LCRYPTO_USED(TS_STATUS_INFO_dup); +LCRYPTO_USED(TS_TST_INFO_new); +LCRYPTO_USED(TS_TST_INFO_free); +LCRYPTO_USED(i2d_TS_TST_INFO); +LCRYPTO_USED(d2i_TS_TST_INFO); +LCRYPTO_USED(TS_TST_INFO_dup); +LCRYPTO_USED(d2i_TS_TST_INFO_fp); +LCRYPTO_USED(i2d_TS_TST_INFO_fp); +LCRYPTO_USED(d2i_TS_TST_INFO_bio); +LCRYPTO_USED(i2d_TS_TST_INFO_bio); +LCRYPTO_USED(TS_ACCURACY_new); +LCRYPTO_USED(TS_ACCURACY_free); +LCRYPTO_USED(i2d_TS_ACCURACY); +LCRYPTO_USED(d2i_TS_ACCURACY); +LCRYPTO_USED(TS_ACCURACY_dup); +LCRYPTO_USED(ESS_ISSUER_SERIAL_new); +LCRYPTO_USED(ESS_ISSUER_SERIAL_free); +LCRYPTO_USED(i2d_ESS_ISSUER_SERIAL); +LCRYPTO_USED(d2i_ESS_ISSUER_SERIAL); +LCRYPTO_USED(ESS_ISSUER_SERIAL_dup); +LCRYPTO_USED(ESS_CERT_ID_new); +LCRYPTO_USED(ESS_CERT_ID_free); +LCRYPTO_USED(i2d_ESS_CERT_ID); +LCRYPTO_USED(d2i_ESS_CERT_ID); +LCRYPTO_USED(ESS_CERT_ID_dup); +LCRYPTO_USED(ESS_SIGNING_CERT_new); +LCRYPTO_USED(ESS_SIGNING_CERT_free); +LCRYPTO_USED(i2d_ESS_SIGNING_CERT); +LCRYPTO_USED(d2i_ESS_SIGNING_CERT); +LCRYPTO_USED(ESS_SIGNING_CERT_dup); +LCRYPTO_USED(TS_REQ_set_version); +LCRYPTO_USED(TS_REQ_get_version); +LCRYPTO_USED(TS_REQ_set_msg_imprint); +LCRYPTO_USED(TS_REQ_get_msg_imprint); +LCRYPTO_USED(TS_MSG_IMPRINT_set_algo); +LCRYPTO_USED(TS_MSG_IMPRINT_get_algo); +LCRYPTO_USED(TS_MSG_IMPRINT_set_msg); +LCRYPTO_USED(TS_MSG_IMPRINT_get_msg); +LCRYPTO_USED(TS_REQ_set_policy_id); +LCRYPTO_USED(TS_REQ_get_policy_id); +LCRYPTO_USED(TS_REQ_set_nonce); +LCRYPTO_USED(TS_REQ_get_nonce); +LCRYPTO_USED(TS_REQ_set_cert_req); +LCRYPTO_USED(TS_REQ_get_cert_req); +LCRYPTO_USED(TS_REQ_get_exts); +LCRYPTO_USED(TS_REQ_ext_free); +LCRYPTO_USED(TS_REQ_get_ext_count); +LCRYPTO_USED(TS_REQ_get_ext_by_NID); +LCRYPTO_USED(TS_REQ_get_ext_by_OBJ); +LCRYPTO_USED(TS_REQ_get_ext_by_critical); +LCRYPTO_USED(TS_REQ_get_ext); +LCRYPTO_USED(TS_REQ_delete_ext); +LCRYPTO_USED(TS_REQ_add_ext); +LCRYPTO_USED(TS_REQ_get_ext_d2i); +LCRYPTO_USED(TS_REQ_print_bio); +LCRYPTO_USED(TS_RESP_set_status_info); +LCRYPTO_USED(TS_RESP_get_status_info); +LCRYPTO_USED(TS_STATUS_INFO_get0_failure_info); +LCRYPTO_USED(TS_STATUS_INFO_get0_text); +LCRYPTO_USED(TS_STATUS_INFO_get0_status); +LCRYPTO_USED(TS_STATUS_INFO_set_status); +LCRYPTO_USED(TS_RESP_set_tst_info); +LCRYPTO_USED(TS_RESP_get_token); +LCRYPTO_USED(TS_RESP_get_tst_info); +LCRYPTO_USED(TS_TST_INFO_set_version); +LCRYPTO_USED(TS_TST_INFO_get_version); +LCRYPTO_USED(TS_TST_INFO_set_policy_id); +LCRYPTO_USED(TS_TST_INFO_get_policy_id); +LCRYPTO_USED(TS_TST_INFO_set_msg_imprint); +LCRYPTO_USED(TS_TST_INFO_get_msg_imprint); +LCRYPTO_USED(TS_TST_INFO_set_serial); +LCRYPTO_USED(TS_TST_INFO_get_serial); +LCRYPTO_USED(TS_TST_INFO_set_time); +LCRYPTO_USED(TS_TST_INFO_get_time); +LCRYPTO_USED(TS_TST_INFO_set_accuracy); +LCRYPTO_USED(TS_TST_INFO_get_accuracy); +LCRYPTO_USED(TS_ACCURACY_set_seconds); +LCRYPTO_USED(TS_ACCURACY_get_seconds); +LCRYPTO_USED(TS_ACCURACY_set_millis); +LCRYPTO_USED(TS_ACCURACY_get_millis); +LCRYPTO_USED(TS_ACCURACY_set_micros); +LCRYPTO_USED(TS_ACCURACY_get_micros); +LCRYPTO_USED(TS_TST_INFO_set_ordering); +LCRYPTO_USED(TS_TST_INFO_get_ordering); +LCRYPTO_USED(TS_TST_INFO_set_nonce); +LCRYPTO_USED(TS_TST_INFO_get_nonce); +LCRYPTO_USED(TS_TST_INFO_set_tsa); +LCRYPTO_USED(TS_TST_INFO_get_tsa); +LCRYPTO_USED(TS_TST_INFO_get_exts); +LCRYPTO_USED(TS_TST_INFO_ext_free); +LCRYPTO_USED(TS_TST_INFO_get_ext_count); +LCRYPTO_USED(TS_TST_INFO_get_ext_by_NID); +LCRYPTO_USED(TS_TST_INFO_get_ext_by_OBJ); +LCRYPTO_USED(TS_TST_INFO_get_ext_by_critical); +LCRYPTO_USED(TS_TST_INFO_get_ext); +LCRYPTO_USED(TS_TST_INFO_delete_ext); +LCRYPTO_USED(TS_TST_INFO_add_ext); +LCRYPTO_USED(TS_TST_INFO_get_ext_d2i); +LCRYPTO_USED(TS_RESP_CTX_new); +LCRYPTO_USED(TS_RESP_CTX_free); +LCRYPTO_USED(TS_RESP_CTX_set_signer_cert); +LCRYPTO_USED(TS_RESP_CTX_set_signer_key); +LCRYPTO_USED(TS_RESP_CTX_set_def_policy); +LCRYPTO_USED(TS_RESP_CTX_set_certs); +LCRYPTO_USED(TS_RESP_CTX_add_policy); +LCRYPTO_USED(TS_RESP_CTX_add_md); +LCRYPTO_USED(TS_RESP_CTX_set_accuracy); +LCRYPTO_USED(TS_RESP_CTX_set_clock_precision_digits); +LCRYPTO_USED(TS_RESP_CTX_add_flags); +LCRYPTO_USED(TS_RESP_CTX_set_serial_cb); +LCRYPTO_USED(TS_RESP_CTX_set_time_cb); +LCRYPTO_USED(TS_RESP_CTX_set_extension_cb); +LCRYPTO_USED(TS_RESP_CTX_set_status_info); +LCRYPTO_USED(TS_RESP_CTX_set_status_info_cond); +LCRYPTO_USED(TS_RESP_CTX_add_failure_info); +LCRYPTO_USED(TS_RESP_CTX_get_request); +LCRYPTO_USED(TS_RESP_CTX_get_tst_info); +LCRYPTO_USED(TS_RESP_create_response); +LCRYPTO_USED(TS_RESP_verify_signature); +LCRYPTO_USED(TS_RESP_verify_response); +LCRYPTO_USED(TS_RESP_verify_token); +LCRYPTO_USED(TS_VERIFY_CTX_new); +LCRYPTO_USED(TS_VERIFY_CTX_free); +LCRYPTO_USED(TS_VERIFY_CTX_cleanup); +LCRYPTO_USED(TS_VERIFY_CTX_add_flags); +LCRYPTO_USED(TS_VERIFY_CTX_set_flags); +LCRYPTO_USED(TS_VERIFY_CTX_set_data); +LCRYPTO_USED(TS_VERIFY_CTX_set_store); +LCRYPTO_USED(TS_VERIFY_CTX_set_certs); +LCRYPTO_USED(TS_VERIFY_CTX_set_imprint); +LCRYPTO_USED(TS_REQ_to_TS_VERIFY_CTX); +LCRYPTO_USED(TS_RESP_print_bio); +LCRYPTO_USED(TS_STATUS_INFO_print_bio); +LCRYPTO_USED(TS_TST_INFO_print_bio); +LCRYPTO_USED(TS_ASN1_INTEGER_print_bio); +LCRYPTO_USED(TS_OBJ_print_bio); +LCRYPTO_USED(TS_ext_print_bio); +LCRYPTO_USED(TS_X509_ALGOR_print_bio); +LCRYPTO_USED(TS_MSG_IMPRINT_print_bio); +LCRYPTO_USED(TS_CONF_load_cert); +LCRYPTO_USED(TS_CONF_load_certs); +LCRYPTO_USED(TS_CONF_load_key); +LCRYPTO_USED(TS_CONF_get_tsa_section); +LCRYPTO_USED(TS_CONF_set_serial); +LCRYPTO_USED(TS_CONF_set_crypto_device); +LCRYPTO_USED(TS_CONF_set_default_engine); +LCRYPTO_USED(TS_CONF_set_signer_cert); +LCRYPTO_USED(TS_CONF_set_certs); +LCRYPTO_USED(TS_CONF_set_signer_key); +LCRYPTO_USED(TS_CONF_set_def_policy); +LCRYPTO_USED(TS_CONF_set_policies); +LCRYPTO_USED(TS_CONF_set_digests); +LCRYPTO_USED(TS_CONF_set_accuracy); +LCRYPTO_USED(TS_CONF_set_clock_precision_digits); +LCRYPTO_USED(TS_CONF_set_ordering); +LCRYPTO_USED(TS_CONF_set_tsa_name); +LCRYPTO_USED(TS_CONF_set_ess_cert_id_chain); +LCRYPTO_USED(ERR_load_TS_strings); + +#endif /* _LIBCRYPTO_TS_H */ diff --git a/lib/libcrypto/hidden/openssl/txt_db.h b/lib/libcrypto/hidden/openssl/txt_db.h new file mode 100644 index 000000000..f93dbc67d --- /dev/null +++ b/lib/libcrypto/hidden/openssl/txt_db.h @@ -0,0 +1,35 @@ +/* $OpenBSD: txt_db.h,v 1.1 2023/07/08 11:28:03 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_TXT_DB_H +#define _LIBCRYPTO_TXT_DB_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/txt_db.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(TXT_DB_read); +LCRYPTO_USED(TXT_DB_write); +LCRYPTO_USED(TXT_DB_create_index); +LCRYPTO_USED(TXT_DB_free); +LCRYPTO_USED(TXT_DB_get_by_index); +LCRYPTO_USED(TXT_DB_insert); + +#endif /* _LIBCRYPTO_TXT_DB_H */ diff --git a/lib/libcrypto/hkdf/hkdf.c b/lib/libcrypto/hkdf/hkdf.c index 9e0e20632..4f9c9e566 100644 --- a/lib/libcrypto/hkdf/hkdf.c +++ b/lib/libcrypto/hkdf/hkdf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hkdf.c,v 1.9 2023/06/01 02:34:23 tb Exp $ */ +/* $OpenBSD: hkdf.c,v 1.10 2023/07/07 13:54:46 beck Exp $ */ /* Copyright (c) 2014, Google Inc. * * Permission to use, copy, modify, and/or distribute this software for any @@ -42,6 +42,7 @@ HKDF(uint8_t *out_key, size_t out_len, const EVP_MD *digest, return 1; } +LCRYPTO_ALIAS(HKDF); /* https://tools.ietf.org/html/rfc5869#section-2.2 */ int @@ -63,6 +64,7 @@ HKDF_extract(uint8_t *out_key, size_t *out_len, *out_len = len; return 1; } +LCRYPTO_ALIAS(HKDF_extract); /* https://tools.ietf.org/html/rfc5869#section-2.3 */ int @@ -118,3 +120,4 @@ HKDF_expand(uint8_t *out_key, size_t out_len, CRYPTOerror(ERR_R_CRYPTO_LIB); return ret; } +LCRYPTO_ALIAS(HKDF_expand); diff --git a/lib/libcrypto/idea/i_cbc.c b/lib/libcrypto/idea/i_cbc.c index e382a0a69..d75134063 100644 --- a/lib/libcrypto/idea/i_cbc.c +++ b/lib/libcrypto/idea/i_cbc.c @@ -1,25 +1,25 @@ -/* $OpenBSD: i_cbc.c,v 1.4 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: i_cbc.c,v 1.6 2023/07/08 10:44:00 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -59,91 +59,97 @@ #include #include "idea_local.h" -void idea_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, - IDEA_KEY_SCHEDULE *ks, unsigned char *iv, int encrypt) - { - unsigned long tin0,tin1; - unsigned long tout0,tout1,xor0,xor1; - long l=length; +void +idea_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, + IDEA_KEY_SCHEDULE *ks, unsigned char *iv, int encrypt) +{ + unsigned long tin0, tin1; + unsigned long tout0, tout1, xor0, xor1; + long l = length; unsigned long tin[2]; - if (encrypt) + if (encrypt) { + n2l(iv, tout0); + n2l(iv, tout1); + iv -= 8; + for (l -= 8; l >= 0; l -= 8) { - n2l(iv,tout0); - n2l(iv,tout1); - iv-=8; - for (l-=8; l>=0; l-=8) - { - n2l(in,tin0); - n2l(in,tin1); - tin0^=tout0; - tin1^=tout1; - tin[0]=tin0; - tin[1]=tin1; - idea_encrypt(tin,ks); - tout0=tin[0]; l2n(tout0,out); - tout1=tin[1]; l2n(tout1,out); - } - if (l != -8) - { - n2ln(in,tin0,tin1,l+8); - tin0^=tout0; - tin1^=tout1; - tin[0]=tin0; - tin[1]=tin1; - idea_encrypt(tin,ks); - tout0=tin[0]; l2n(tout0,out); - tout1=tin[1]; l2n(tout1,out); - } - l2n(tout0,iv); - l2n(tout1,iv); + n2l(in, tin0); + n2l(in, tin1); + tin0 ^= tout0; + tin1 ^= tout1; + tin[0] = tin0; + tin[1] = tin1; + idea_encrypt(tin, ks); + tout0 = tin[0]; + l2n(tout0, out); + tout1 = tin[1]; + l2n(tout1, out); } - else + if (l != -8) { + n2ln(in, tin0, tin1, l + 8); + tin0 ^= tout0; + tin1 ^= tout1; + tin[0] = tin0; + tin[1] = tin1; + idea_encrypt(tin, ks); + tout0 = tin[0]; + l2n(tout0, out); + tout1 = tin[1]; + l2n(tout1, out); + } + l2n(tout0, iv); + l2n(tout1, iv); + } else { + n2l(iv, xor0); + n2l(iv, xor1); + iv -= 8; + for (l -= 8; l >= 0; l -= 8) { - n2l(iv,xor0); - n2l(iv,xor1); - iv-=8; - for (l-=8; l>=0; l-=8) - { - n2l(in,tin0); tin[0]=tin0; - n2l(in,tin1); tin[1]=tin1; - idea_encrypt(tin,ks); - tout0=tin[0]^xor0; - tout1=tin[1]^xor1; - l2n(tout0,out); - l2n(tout1,out); - xor0=tin0; - xor1=tin1; - } - if (l != -8) - { - n2l(in,tin0); tin[0]=tin0; - n2l(in,tin1); tin[1]=tin1; - idea_encrypt(tin,ks); - tout0=tin[0]^xor0; - tout1=tin[1]^xor1; - l2nn(tout0,tout1,out,l+8); - xor0=tin0; - xor1=tin1; - } - l2n(xor0,iv); - l2n(xor1,iv); + n2l(in, tin0); + tin[0] = tin0; + n2l(in, tin1); + tin[1] = tin1; + idea_encrypt(tin, ks); + tout0 = tin[0] ^ xor0; + tout1 = tin[1] ^ xor1; + l2n(tout0, out); + l2n(tout1, out); + xor0 = tin0; + xor1 = tin1; } - tin0=tin1=tout0=tout1=xor0=xor1=0; - tin[0]=tin[1]=0; + if (l != -8) { + n2l(in, tin0); + tin[0] = tin0; + n2l(in, tin1); + tin[1] = tin1; + idea_encrypt(tin, ks); + tout0 = tin[0] ^ xor0; + tout1 = tin[1] ^ xor1; + l2nn(tout0, tout1, out, l + 8); + xor0 = tin0; + xor1 = tin1; + } + l2n(xor0, iv); + l2n(xor1, iv); } + tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0; + tin[0] = tin[1] = 0; +} +LCRYPTO_ALIAS(idea_cbc_encrypt); -void idea_encrypt(unsigned long *d, IDEA_KEY_SCHEDULE *key) - { +void +idea_encrypt(unsigned long *d, IDEA_KEY_SCHEDULE *key) +{ IDEA_INT *p; - unsigned long x1,x2,x3,x4,t0,t1,ul; + unsigned long x1, x2, x3, x4, t0, t1, ul; - x2=d[0]; - x1=(x2>>16); - x4=d[1]; - x3=(x4>>16); + x2 = d[0]; + x1 = (x2 >> 16); + x4 = d[1]; + x3 = (x4 >> 16); - p= &(key->data[0][0]); + p = &(key->data[0][0]); E_IDEA(0); E_IDEA(1); @@ -154,15 +160,17 @@ void idea_encrypt(unsigned long *d, IDEA_KEY_SCHEDULE *key) E_IDEA(6); E_IDEA(7); - x1&=0xffff; - idea_mul(x1,x1,*p,ul); p++; + x1 &= 0xffff; + idea_mul(x1, x1, *p, ul); + p++; - t0= x3+ *(p++); - t1= x2+ *(p++); + t0 = x3 + *(p++); + t1 = x2 + *(p++); - x4&=0xffff; - idea_mul(x4,x4,*p,ul); + x4 &= 0xffff; + idea_mul(x4, x4, *p, ul); - d[0]=(t0&0xffff)|((x1&0xffff)<<16); - d[1]=(x4&0xffff)|((t1&0xffff)<<16); - } + d[0] = (t0 & 0xffff)|((x1 & 0xffff) << 16); + d[1] = (x4 & 0xffff)|((t1 & 0xffff) << 16); +} +LCRYPTO_ALIAS(idea_encrypt); diff --git a/lib/libcrypto/idea/i_cfb64.c b/lib/libcrypto/idea/i_cfb64.c index d6b641197..a1a543f61 100644 --- a/lib/libcrypto/idea/i_cfb64.c +++ b/lib/libcrypto/idea/i_cfb64.c @@ -1,25 +1,25 @@ -/* $OpenBSD: i_cfb64.c,v 1.4 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: i_cfb64.c,v 1.6 2023/07/08 10:44:00 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -64,59 +64,61 @@ * 64bit block we have used is contained in *num; */ -void idea_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, IDEA_KEY_SCHEDULE *schedule, - unsigned char *ivec, int *num, int encrypt) - { - unsigned long v0,v1,t; - int n= *num; - long l=length; +void +idea_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, IDEA_KEY_SCHEDULE *schedule, + unsigned char *ivec, int *num, int encrypt) +{ + unsigned long v0, v1, t; + int n = *num; + long l = length; unsigned long ti[2]; - unsigned char *iv,c,cc; + unsigned char *iv, c, cc; - iv=(unsigned char *)ivec; - if (encrypt) - { - while (l--) - { - if (n == 0) - { - n2l(iv,v0); ti[0]=v0; - n2l(iv,v1); ti[1]=v1; - idea_encrypt((unsigned long *)ti,schedule); - iv=(unsigned char *)ivec; - t=ti[0]; l2n(t,iv); - t=ti[1]; l2n(t,iv); - iv=(unsigned char *)ivec; - } - c= *(in++)^iv[n]; - *(out++)=c; - iv[n]=c; - n=(n+1)&0x07; + iv = (unsigned char *)ivec; + if (encrypt) { + while (l--) { + if (n == 0) { + n2l(iv, v0); + ti[0] = v0; + n2l(iv, v1); + ti[1] = v1; + idea_encrypt((unsigned long *)ti, schedule); + iv = (unsigned char *)ivec; + t = ti[0]; + l2n(t, iv); + t = ti[1]; + l2n(t, iv); + iv = (unsigned char *)ivec; } + c = *(in++) ^ iv[n]; + *(out++) = c; + iv[n] = c; + n = (n + 1) & 0x07; } - else - { - while (l--) - { - if (n == 0) - { - n2l(iv,v0); ti[0]=v0; - n2l(iv,v1); ti[1]=v1; - idea_encrypt((unsigned long *)ti,schedule); - iv=(unsigned char *)ivec; - t=ti[0]; l2n(t,iv); - t=ti[1]; l2n(t,iv); - iv=(unsigned char *)ivec; - } - cc= *(in++); - c=iv[n]; - iv[n]=cc; - *(out++)=c^cc; - n=(n+1)&0x07; + } else { + while (l--) { + if (n == 0) { + n2l(iv, v0); + ti[0] = v0; + n2l(iv, v1); + ti[1] = v1; + idea_encrypt((unsigned long *)ti, schedule); + iv = (unsigned char *)ivec; + t = ti[0]; + l2n(t, iv); + t = ti[1]; + l2n(t, iv); + iv = (unsigned char *)ivec; } + cc = *(in++); + c = iv[n]; + iv[n] = cc; + *(out++) = c ^ cc; + n = (n + 1) & 0x07; } - v0=v1=ti[0]=ti[1]=t=c=cc=0; - *num=n; } - + v0 = v1 = ti[0] = ti[1] = t = c = cc = 0; + *num = n; +} +LCRYPTO_ALIAS(idea_cfb64_encrypt); diff --git a/lib/libcrypto/idea/i_ecb.c b/lib/libcrypto/idea/i_ecb.c index 6fada765c..19521a753 100644 --- a/lib/libcrypto/idea/i_ecb.c +++ b/lib/libcrypto/idea/i_ecb.c @@ -1,25 +1,25 @@ -/* $OpenBSD: i_ecb.c,v 1.4 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: i_ecb.c,v 1.6 2023/07/08 10:44:00 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -60,24 +60,31 @@ #include "idea_local.h" #include -const char *idea_options(void) - { +const char * +idea_options(void) +{ if (sizeof(short) != sizeof(IDEA_INT)) - return("idea(int)"); + return ("idea(int)"); else - return("idea(short)"); - } + return ("idea(short)"); +} +LCRYPTO_ALIAS(idea_options); -void idea_ecb_encrypt(const unsigned char *in, unsigned char *out, - IDEA_KEY_SCHEDULE *ks) - { - unsigned long l0,l1,d[2]; - - n2l(in,l0); d[0]=l0; - n2l(in,l1); d[1]=l1; - idea_encrypt(d,ks); - l0=d[0]; l2n(l0,out); - l1=d[1]; l2n(l1,out); - l0=l1=d[0]=d[1]=0; - } +void +idea_ecb_encrypt(const unsigned char *in, unsigned char *out, + IDEA_KEY_SCHEDULE *ks) +{ + unsigned long l0, l1, d[2]; + n2l(in, l0); + d[0] = l0; + n2l(in, l1); + d[1] = l1; + idea_encrypt(d, ks); + l0 = d[0]; + l2n(l0, out); + l1 = d[1]; + l2n(l1, out); + l0 = l1 = d[0] = d[1] = 0; +} +LCRYPTO_ALIAS(idea_ecb_encrypt); diff --git a/lib/libcrypto/idea/i_ofb64.c b/lib/libcrypto/idea/i_ofb64.c index b63144b6c..5af394ef7 100644 --- a/lib/libcrypto/idea/i_ofb64.c +++ b/lib/libcrypto/idea/i_ofb64.c @@ -1,25 +1,25 @@ -/* $OpenBSD: i_ofb64.c,v 1.4 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: i_ofb64.c,v 1.6 2023/07/08 10:44:00 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -63,49 +63,49 @@ * used. The extra state information to record how much of the * 64bit block we have used is contained in *num; */ -void idea_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, IDEA_KEY_SCHEDULE *schedule, - unsigned char *ivec, int *num) - { - unsigned long v0,v1,t; - int n= *num; - long l=length; +void +idea_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, IDEA_KEY_SCHEDULE *schedule, + unsigned char *ivec, int *num) +{ + unsigned long v0, v1, t; + int n = *num; + long l = length; unsigned char d[8]; char *dp; unsigned long ti[2]; unsigned char *iv; - int save=0; + int save = 0; - iv=(unsigned char *)ivec; - n2l(iv,v0); - n2l(iv,v1); - ti[0]=v0; - ti[1]=v1; - dp=(char *)d; - l2n(v0,dp); - l2n(v1,dp); - while (l--) - { - if (n == 0) - { - idea_encrypt((unsigned long *)ti,schedule); - dp=(char *)d; - t=ti[0]; l2n(t,dp); - t=ti[1]; l2n(t,dp); + iv = (unsigned char *)ivec; + n2l(iv, v0); + n2l(iv, v1); + ti[0] = v0; + ti[1] = v1; + dp = (char *)d; + l2n(v0, dp); + l2n(v1, dp); + while (l--) { + if (n == 0) { + idea_encrypt((unsigned long *)ti, schedule); + dp = (char *)d; + t = ti[0]; + l2n(t, dp); + t = ti[1]; + l2n(t, dp); save++; - } - *(out++)= *(in++)^d[n]; - n=(n+1)&0x07; } - if (save) - { - v0=ti[0]; - v1=ti[1]; - iv=(unsigned char *)ivec; - l2n(v0,iv); - l2n(v1,iv); - } - t=v0=v1=ti[0]=ti[1]=0; - *num=n; + *(out++) = *(in++) ^ d[n]; + n = (n + 1) & 0x07; } - + if (save) { + v0 = ti[0]; + v1 = ti[1]; + iv = (unsigned char *)ivec; + l2n(v0, iv); + l2n(v1, iv); + } + t = v0 = v1 = ti[0] = ti[1] = 0; + *num = n; +} +LCRYPTO_ALIAS(idea_ofb64_encrypt); diff --git a/lib/libcrypto/idea/i_skey.c b/lib/libcrypto/idea/i_skey.c index 433816512..ad349bba5 100644 --- a/lib/libcrypto/idea/i_skey.c +++ b/lib/libcrypto/idea/i_skey.c @@ -1,25 +1,25 @@ -/* $OpenBSD: i_skey.c,v 1.5 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: i_skey.c,v 1.7 2023/07/08 10:44:00 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -61,97 +61,109 @@ #include "idea_local.h" static IDEA_INT inverse(unsigned int xin); -void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks) - { +void +idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks) +{ int i; - IDEA_INT *kt,*kf,r0,r1,r2; + IDEA_INT *kt, *kf, r0, r1, r2; - kt= &(ks->data[0][0]); - n2s(key,kt[0]); n2s(key,kt[1]); n2s(key,kt[2]); n2s(key,kt[3]); - n2s(key,kt[4]); n2s(key,kt[5]); n2s(key,kt[6]); n2s(key,kt[7]); + kt = &(ks->data[0][0]); + n2s(key, kt[0]); + n2s(key, kt[1]); + n2s(key, kt[2]); + n2s(key, kt[3]); + n2s(key, kt[4]); + n2s(key, kt[5]); + n2s(key, kt[6]); + n2s(key, kt[7]); - kf=kt; - kt+=8; - for (i=0; i<6; i++) - { - r2= kf[1]; - r1= kf[2]; - *(kt++)= ((r2<<9) | (r1>>7))&0xffff; - r0= kf[3]; - *(kt++)= ((r1<<9) | (r0>>7))&0xffff; - r1= kf[4]; - *(kt++)= ((r0<<9) | (r1>>7))&0xffff; - r0= kf[5]; - *(kt++)= ((r1<<9) | (r0>>7))&0xffff; - r1= kf[6]; - *(kt++)= ((r0<<9) | (r1>>7))&0xffff; - r0= kf[7]; - *(kt++)= ((r1<<9) | (r0>>7))&0xffff; - r1= kf[0]; - if (i >= 5) break; - *(kt++)= ((r0<<9) | (r1>>7))&0xffff; - *(kt++)= ((r1<<9) | (r2>>7))&0xffff; - kf+=8; - } - } - -void idea_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk) + kf = kt; + kt += 8; + for (i = 0; i < 6; i++) { - int r; - IDEA_INT *fp,*tp,t; - - tp= &(dk->data[0][0]); - fp= &(ek->data[8][0]); - for (r=0; r<9; r++) - { - *(tp++)=inverse(fp[0]); - *(tp++)=((int)(0x10000L-fp[2])&0xffff); - *(tp++)=((int)(0x10000L-fp[1])&0xffff); - *(tp++)=inverse(fp[3]); - if (r == 8) break; - fp-=6; - *(tp++)=fp[4]; - *(tp++)=fp[5]; - } - - tp= &(dk->data[0][0]); - t=tp[1]; - tp[1]=tp[2]; - tp[2]=t; - - t=tp[49]; - tp[49]=tp[50]; - tp[50]=t; + r2 = kf[1]; + r1 = kf[2]; + *(kt++) = ((r2 << 9) | (r1 >> 7)) & 0xffff; + r0 = kf[3]; + *(kt++) = ((r1 << 9) | (r0 >> 7)) & 0xffff; + r1 = kf[4]; + *(kt++) = ((r0 << 9) | (r1 >> 7)) & 0xffff; + r0 = kf[5]; + *(kt++) = ((r1 << 9) | (r0 >> 7)) & 0xffff; + r1 = kf[6]; + *(kt++) = ((r0 << 9) | (r1 >> 7)) & 0xffff; + r0 = kf[7]; + *(kt++) = ((r1 << 9) | (r0 >> 7)) & 0xffff; + r1 = kf[0]; + if (i >= 5) + break; + *(kt++) = ((r0 << 9) | (r1 >> 7)) & 0xffff; + *(kt++) = ((r1 << 9) | (r2 >> 7)) & 0xffff; + kf += 8; } +} +LCRYPTO_ALIAS(idea_set_encrypt_key); + +void +idea_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk) +{ + int r; + IDEA_INT *fp, *tp, t; + + tp = &(dk->data[0][0]); + fp = &(ek->data[8][0]); + for (r = 0; r < 9; r++) + { + *(tp++) = inverse(fp[0]); + *(tp++) = ((int)(0x10000L - fp[2]) & 0xffff); + *(tp++) = ((int)(0x10000L - fp[1]) & 0xffff); + *(tp++) = inverse(fp[3]); + if (r == 8) + break; + fp -= 6; + *(tp++) = fp[4]; + *(tp++) = fp[5]; + } + + tp = &(dk->data[0][0]); + t = tp[1]; + tp[1] = tp[2]; + tp[2] = t; + + t = tp[49]; + tp[49] = tp[50]; + tp[50] = t; +} +LCRYPTO_ALIAS(idea_set_decrypt_key); /* taken directly from the 'paper' I'll have a look at it later */ -static IDEA_INT inverse(unsigned int xin) - { - long n1,n2,q,r,b1,b2,t; +static IDEA_INT +inverse(unsigned int xin) +{ + long n1, n2, q, r, b1, b2, t; if (xin == 0) - b2=0; - else - { - n1=0x10001; - n2=xin; - b2=1; - b1=0; + b2 = 0; + else { + n1 = 0x10001; + n2 = xin; + b2 = 1; + b1 = 0; - do { - r=(n1%n2); - q=(n1-r)/n2; - if (r == 0) - { if (b2 < 0) b2=0x10001+b2; } - else - { - n1=n2; - n2=r; - t=b2; - b2=b1-q*b2; - b1=t; - } - } while (r != 0); - } - return((IDEA_INT)b2); + do { + r = (n1 % n2); + q = (n1 - r)/n2; + if (r == 0) { + if (b2 < 0) + b2 = 0x10001 + b2; + } else { + n1 = n2; + n2 = r; + t = b2; + b2 = b1 - q*b2; + b1 = t; + } + } while (r != 0); } + return ((IDEA_INT)b2); +} diff --git a/lib/libcrypto/idea/idea.h b/lib/libcrypto/idea/idea.h index f76bcaeba..e5ddd3a6f 100644 --- a/lib/libcrypto/idea/idea.h +++ b/lib/libcrypto/idea/idea.h @@ -1,25 +1,25 @@ -/* $OpenBSD: idea.h,v 1.10 2014/06/12 15:49:29 deraadt Exp $ */ +/* $OpenBSD: idea.h,v 1.11 2023/07/07 12:51:58 beck Exp $ */ /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -75,23 +75,22 @@ extern "C" { #endif -typedef struct idea_key_st - { +typedef struct idea_key_st { IDEA_INT data[9][6]; - } IDEA_KEY_SCHEDULE; +} IDEA_KEY_SCHEDULE; const char *idea_options(void); void idea_ecb_encrypt(const unsigned char *in, unsigned char *out, - IDEA_KEY_SCHEDULE *ks); + IDEA_KEY_SCHEDULE *ks); void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks); void idea_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk); void idea_cbc_encrypt(const unsigned char *in, unsigned char *out, - long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,int enc); + long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, int enc); void idea_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, - int *num,int enc); + long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, + int *num, int enc); void idea_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, int *num); + long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, int *num); void idea_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE *ks); #ifdef __cplusplus } diff --git a/lib/libcrypto/idea/idea_local.h b/lib/libcrypto/idea/idea_local.h index 2663516c2..c7fd3271a 100644 --- a/lib/libcrypto/idea/idea_local.h +++ b/lib/libcrypto/idea/idea_local.h @@ -1,25 +1,25 @@ -/* $OpenBSD: idea_local.h,v 1.1 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: idea_local.h,v 1.2 2023/07/07 12:51:58 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,24 +49,24 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ -/* The new form of this macro (check if the a*b == 0) was suggested by +/* The new form of this macro (check if the a*b == 0) was suggested by * Colin Plumb */ /* Removal of the inner if from from Wei Dai 24/4/96 */ -#define idea_mul(r,a,b,ul) \ -ul=(unsigned long)a*b; \ -if (ul != 0) \ - { \ - r=(ul&0xffff)-(ul>>16); \ - r-=((r)>>16); \ - } \ -else \ +#define idea_mul(r,a,b,ul) \ +ul=(unsigned long)a*b; \ +if (ul != 0) \ + { \ + r=(ul&0xffff)-(ul>>16); \ + r-=((r)>>16); \ + } \ +else \ r=(-(int)a-b+1); /* assuming a or b is 0 and in range */ /* 7/12/95 - Many thanks to Rhys Weatherley @@ -80,46 +80,46 @@ else \ */ /* NOTE - c is not incremented as per n2l */ -#define n2ln(c,l1,l2,n) { \ - c+=n; \ - l1=l2=0; \ - switch (n) { \ - case 8: l2 =((unsigned long)(*(--(c)))) ; \ - case 7: l2|=((unsigned long)(*(--(c))))<< 8; \ - case 6: l2|=((unsigned long)(*(--(c))))<<16; \ - case 5: l2|=((unsigned long)(*(--(c))))<<24; \ - case 4: l1 =((unsigned long)(*(--(c)))) ; \ - case 3: l1|=((unsigned long)(*(--(c))))<< 8; \ - case 2: l1|=((unsigned long)(*(--(c))))<<16; \ - case 1: l1|=((unsigned long)(*(--(c))))<<24; \ - } \ +#define n2ln(c,l1,l2,n) { \ + c+=n; \ + l1=l2=0; \ + switch (n) { \ + case 8: l2 =((unsigned long)(*(--(c)))) ; \ + case 7: l2|=((unsigned long)(*(--(c))))<< 8; \ + case 6: l2|=((unsigned long)(*(--(c))))<<16; \ + case 5: l2|=((unsigned long)(*(--(c))))<<24; \ + case 4: l1 =((unsigned long)(*(--(c)))) ; \ + case 3: l1|=((unsigned long)(*(--(c))))<< 8; \ + case 2: l1|=((unsigned long)(*(--(c))))<<16; \ + case 1: l1|=((unsigned long)(*(--(c))))<<24; \ + } \ } /* NOTE - c is not incremented as per l2n */ -#define l2nn(l1,l2,c,n) { \ - c+=n; \ - switch (n) { \ - case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \ - case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \ - case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \ - case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \ - case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \ - case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \ - case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \ - case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \ - } \ +#define l2nn(l1,l2,c,n) { \ + c+=n; \ + switch (n) { \ + case 8: *(--(c))=(unsigned char)(((l2) )&0xff);\ + case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff);\ + case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff);\ + case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff);\ + case 4: *(--(c))=(unsigned char)(((l1) )&0xff);\ + case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff);\ + case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff);\ + case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff);\ + } \ } #undef n2l -#define n2l(c,l) (l =((unsigned long)(*((c)++)))<<24L, \ - l|=((unsigned long)(*((c)++)))<<16L, \ - l|=((unsigned long)(*((c)++)))<< 8L, \ +#define n2l(c,l) (l =((unsigned long)(*((c)++)))<<24L, \ + l|=((unsigned long)(*((c)++)))<<16L, \ + l|=((unsigned long)(*((c)++)))<< 8L, \ l|=((unsigned long)(*((c)++)))) #undef l2n -#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ +#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ *((c)++)=(unsigned char)(((l) )&0xff)) #undef s2n @@ -130,21 +130,20 @@ else \ #define n2s(c,l) (l =((IDEA_INT)(*((c)++)))<< 8L, \ l|=((IDEA_INT)(*((c)++))) ) -#define E_IDEA(num) \ - x1&=0xffff; \ - idea_mul(x1,x1,*p,ul); p++; \ - x2+= *(p++); \ - x3+= *(p++); \ - x4&=0xffff; \ - idea_mul(x4,x4,*p,ul); p++; \ - t0=(x1^x3)&0xffff; \ - idea_mul(t0,t0,*p,ul); p++; \ - t1=(t0+(x2^x4))&0xffff; \ - idea_mul(t1,t1,*p,ul); p++; \ - t0+=t1; \ - x1^=t1; \ - x4^=t0; \ - ul=x2^t0; /* do the swap to x3 */ \ - x2=x3^t1; \ +#define E_IDEA(num) \ + x1&=0xffff; \ + idea_mul(x1,x1,*p,ul); p++; \ + x2+= *(p++); \ + x3+= *(p++); \ + x4&=0xffff; \ + idea_mul(x4,x4,*p,ul); p++; \ + t0=(x1^x3)&0xffff; \ + idea_mul(t0,t0,*p,ul); p++; \ + t1=(t0+(x2^x4))&0xffff; \ + idea_mul(t1,t1,*p,ul); p++; \ + t0+=t1; \ + x1^=t1; \ + x4^=t0; \ + ul=x2^t0; /* do the swap to x3 */ \ + x2=x3^t1; \ x3=ul; - diff --git a/lib/libcrypto/lhash/lh_stats.c b/lib/libcrypto/lhash/lh_stats.c index e7dde4780..123792a2a 100644 --- a/lib/libcrypto/lhash/lh_stats.c +++ b/lib/libcrypto/lhash/lh_stats.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lh_stats.c,v 1.12 2014/07/11 08:44:48 jsing Exp $ */ +/* $OpenBSD: lh_stats.c,v 1.13 2023/07/07 13:40:44 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -96,6 +96,7 @@ lh_stats(LHASH *lh, FILE *out) fprintf(out, "down_load = %lu\n", lh->down_load); #endif } +LCRYPTO_ALIAS(lh_stats); void lh_node_stats(LHASH *lh, FILE *out) @@ -109,6 +110,7 @@ lh_node_stats(LHASH *lh, FILE *out) fprintf(out, "node %6u -> %3u\n", i, num); } } +LCRYPTO_ALIAS(lh_node_stats); void lh_node_usage_stats(LHASH *lh, FILE *out) @@ -136,6 +138,7 @@ lh_node_usage_stats(LHASH *lh, FILE *out) (int)(total / n_used), (int)((total % n_used) * 100 / n_used)); } +LCRYPTO_ALIAS(lh_node_usage_stats); #else @@ -152,6 +155,7 @@ lh_stats(const _LHASH *lh, FILE *fp) BIO_free(bp); end:; } +LCRYPTO_ALIAS(lh_stats); void lh_node_stats(const _LHASH *lh, FILE *fp) @@ -166,6 +170,7 @@ lh_node_stats(const _LHASH *lh, FILE *fp) BIO_free(bp); end:; } +LCRYPTO_ALIAS(lh_node_stats); void lh_node_usage_stats(const _LHASH *lh, FILE *fp) @@ -180,6 +185,7 @@ lh_node_usage_stats(const _LHASH *lh, FILE *fp) BIO_free(bp); end:; } +LCRYPTO_ALIAS(lh_node_usage_stats); void @@ -210,6 +216,7 @@ lh_stats_bio(const _LHASH *lh, BIO *out) BIO_printf(out, "down_load = %lu\n", lh->down_load); #endif } +LCRYPTO_ALIAS(lh_stats_bio); void lh_node_stats_bio(const _LHASH *lh, BIO *out) @@ -223,6 +230,7 @@ lh_node_stats_bio(const _LHASH *lh, BIO *out) BIO_printf(out, "node %6u -> %3u\n", i, num); } } +LCRYPTO_ALIAS(lh_node_stats_bio); void lh_node_usage_stats_bio(const _LHASH *lh, BIO *out) @@ -250,5 +258,6 @@ lh_node_usage_stats_bio(const _LHASH *lh, BIO *out) (int)(total / n_used), (int)((total % n_used) * 100 / n_used)); } +LCRYPTO_ALIAS(lh_node_usage_stats_bio); #endif diff --git a/lib/libcrypto/lhash/lhash.c b/lib/libcrypto/lhash/lhash.c index a68e46670..3adec71ed 100644 --- a/lib/libcrypto/lhash/lhash.c +++ b/lib/libcrypto/lhash/lhash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lhash.c,v 1.19 2019/05/12 00:09:59 beck Exp $ */ +/* $OpenBSD: lhash.c,v 1.20 2023/07/07 13:40:44 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -133,6 +133,7 @@ lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c) return (ret); } +LCRYPTO_ALIAS(lh_new); void lh_free(_LHASH *lh) @@ -154,6 +155,7 @@ lh_free(_LHASH *lh) free(lh->b); free(lh); } +LCRYPTO_ALIAS(lh_free); void * lh_insert(_LHASH *lh, void *data) @@ -191,6 +193,7 @@ lh_insert(_LHASH *lh, void *data) } return (ret); } +LCRYPTO_ALIAS(lh_insert); void * lh_delete(_LHASH *lh, const void *data) @@ -220,6 +223,7 @@ lh_delete(_LHASH *lh, const void *data) return (ret); } +LCRYPTO_ALIAS(lh_delete); void * lh_retrieve(_LHASH *lh, const void *data) @@ -240,6 +244,7 @@ lh_retrieve(_LHASH *lh, const void *data) } return (ret); } +LCRYPTO_ALIAS(lh_retrieve); static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func, @@ -275,12 +280,14 @@ lh_doall(_LHASH *lh, LHASH_DOALL_FN_TYPE func) { doall_util_fn(lh, 0, func, (LHASH_DOALL_ARG_FN_TYPE)0, NULL); } +LCRYPTO_ALIAS(lh_doall); void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg) { doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg); } +LCRYPTO_ALIAS(lh_doall_arg); static void expand(_LHASH *lh) @@ -426,9 +433,11 @@ lh_strhash(const char *c) } return (ret >> 16) ^ ret; } +LCRYPTO_ALIAS(lh_strhash); unsigned long lh_num_items(const _LHASH *lh) { return lh ? lh->num_items : 0; } +LCRYPTO_ALIAS(lh_num_items); diff --git a/lib/libcrypto/malloc-wrapper.c b/lib/libcrypto/malloc-wrapper.c index cb9a31186..4d57f00b2 100644 --- a/lib/libcrypto/malloc-wrapper.c +++ b/lib/libcrypto/malloc-wrapper.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc-wrapper.c,v 1.7 2018/05/13 13:49:04 jsing Exp $ */ +/* $OpenBSD: malloc-wrapper.c,v 1.8 2023/07/08 08:28:23 beck Exp $ */ /* * Copyright (c) 2014 Bob Beck * @@ -18,12 +18,15 @@ #include #include +#include + int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), void (*f)(void *)) { return 0; } +LCRYPTO_ALIAS(CRYPTO_set_mem_functions); int CRYPTO_set_mem_ex_functions(void *(*m)(size_t, const char *, int), @@ -31,12 +34,14 @@ CRYPTO_set_mem_ex_functions(void *(*m)(size_t, const char *, int), { return 0; } +LCRYPTO_ALIAS(CRYPTO_set_mem_ex_functions); int CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*f)(void *)) { return 0; } +LCRYPTO_ALIAS(CRYPTO_set_locked_mem_functions); int CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t, const char *, int), @@ -44,6 +49,7 @@ CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t, const char *, int), { return 0; } +LCRYPTO_ALIAS(CRYPTO_set_locked_mem_ex_functions); int CRYPTO_set_mem_debug_functions(void (*m)(void *, int, const char *, int, int), @@ -52,6 +58,7 @@ CRYPTO_set_mem_debug_functions(void (*m)(void *, int, const char *, int, int), { return 0; } +LCRYPTO_ALIAS(CRYPTO_set_mem_debug_functions); void @@ -65,6 +72,7 @@ CRYPTO_get_mem_functions(void *(**m)(size_t), void *(**r)(void *, size_t), if (f != NULL) *f = free; } +LCRYPTO_ALIAS(CRYPTO_get_mem_functions); void CRYPTO_get_mem_ex_functions(void *(**m)(size_t, const char *, int), @@ -77,6 +85,7 @@ CRYPTO_get_mem_ex_functions(void *(**m)(size_t, const char *, int), if (f != NULL) *f = free; } +LCRYPTO_ALIAS(CRYPTO_get_mem_ex_functions); void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *)) @@ -86,6 +95,7 @@ CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *)) if (f != NULL) *f = free; } +LCRYPTO_ALIAS(CRYPTO_get_locked_mem_functions); void CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t, const char *, int), @@ -96,6 +106,7 @@ CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t, const char *, int), if (f != NULL) *f = free; } +LCRYPTO_ALIAS(CRYPTO_get_locked_mem_ex_functions); void CRYPTO_get_mem_debug_functions(void (**m)(void *, int, const char *, int, int), @@ -113,6 +124,7 @@ CRYPTO_get_mem_debug_functions(void (**m)(void *, int, const char *, int, int), if (go != NULL) *go = NULL; } +LCRYPTO_ALIAS(CRYPTO_get_mem_debug_functions); void * @@ -162,6 +174,7 @@ CRYPTO_realloc_clean(void *ptr, int old_len, int num, const char *file, return NULL; return recallocarray(ptr, old_len, num, 1); } +LCRYPTO_ALIAS(CRYPTO_realloc_clean); void CRYPTO_free(void *ptr) @@ -175,15 +188,18 @@ CRYPTO_remalloc(void *a, int num, const char *file, int line) free(a); return malloc(num); } +LCRYPTO_ALIAS(CRYPTO_remalloc); void CRYPTO_set_mem_debug_options(long bits) { return; } +LCRYPTO_ALIAS(CRYPTO_set_mem_debug_options); long CRYPTO_get_mem_debug_options(void) { return 0; } +LCRYPTO_ALIAS(CRYPTO_get_mem_debug_options); diff --git a/lib/libcrypto/man/ASN1_bn_print.3 b/lib/libcrypto/man/ASN1_bn_print.3 deleted file mode 100644 index 45e572119..000000000 --- a/lib/libcrypto/man/ASN1_bn_print.3 +++ /dev/null @@ -1,119 +0,0 @@ -.\" $OpenBSD: ASN1_bn_print.3,v 1.2 2022/12/14 20:27:28 schwarze Exp $ -.\" -.\" Copyright (c) 2021 Ingo Schwarze -.\" -.\" Permission to use, copy, modify, and distribute this software for any -.\" purpose with or without fee is hereby granted, provided that the above -.\" copyright notice and this permission notice appear in all copies. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -.\" -.Dd $Mdocdate: December 14 2022 $ -.Dt ASN1_BN_PRINT 3 -.Os -.Sh NAME -.Nm ASN1_bn_print -.Nd pretty-print a BIGNUM object -.Sh SYNOPSIS -.In openssl/asn1.h -.Ft int -.Fo ASN1_bn_print -.Fa "BIO *bio_out" -.Fa "const char *label" -.Fa "const BIGNUM *bn" -.Fa "unsigned char *buffer" -.Fa "int indent" -.Fc -.Sh DESCRIPTION -.Fn ASN1_bn_print -prints -.Fa bn -to -.Fa bio_out -in human-readable form. -Despite its name and the header file, -this function has nothing to do with ASN.1. -.Pp -The caller is responsible for providing a -.Fa buffer -that is at least -.Fn BN_num_bytes bn -+ 1 bytes long. -To avoid a buffer overrun, be careful to not forget the -.Dq plus one . -It is unspecified what the buffer may contain after the function returns. -.Pp -If -.Fa indent -is greater than zero, -.Fa indent -space characters are printed first, but not more than 128. -.Pp -The NUL-terminated -.Fa label -is printed next. -.Pp -After that, there are three cases: -.Bl -bullet -.It -If -.Fa bn -represents the number zero, -.Qq 0 -is printed. -.It -If -.Fa bn -can be represented by the data type -.Vt unsigned long , -it is printed in decimal notation, -followed by hexadecimal notation in parentheses, -both optionally preceded by a minus sign. -.It -Otherwise, the string -.Qq Pq Negative -is printed if appropriate, a new output line is started, -and the indentation is increased by four space characters. -The bytes of the value of -.Fa bn -are then printed in big-endian order, each byte represented -by a two-digit hexadecimal number, -and each but the last byte followed by a colon. -A new output line is started after every group of 15 bytes. -.El -.Pp -Finally, a newline character is printed to end the output. -.Pp -If -.Fa bn -is a -.Dv NULL -pointer, all arguments are ignored and nothing is printed. -.Sh RETURN VALUES -.Fn ASN1_bn_print -returns 1 -if successful or if -.Fa bn -is a -.Dv NULL -pointer. -It returns 0 if printing fails. -.Sh SEE ALSO -.Xr ASN1_buf_print 3 , -.Xr BIO_new 3 , -.Xr BIO_write 3 , -.Xr BN_is_negative 3 , -.Xr BN_is_zero 3 , -.Xr BN_new 3 , -.Xr BN_num_bytes 3 , -.Xr BN_print 3 -.Sh HISTORY -.Fn ASN1_bn_print -first appeared in OpenSSL 1.0.0 and has been available since -.Ox 4.9 . diff --git a/lib/libcrypto/man/ASN1_buf_print.3 b/lib/libcrypto/man/ASN1_buf_print.3 index 12ee84ada..67b39bea7 100644 --- a/lib/libcrypto/man/ASN1_buf_print.3 +++ b/lib/libcrypto/man/ASN1_buf_print.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ASN1_buf_print.3,v 1.1 2022/12/14 20:27:28 schwarze Exp $ +.\" $OpenBSD: ASN1_buf_print.3,v 1.2 2023/07/09 06:45:03 tb Exp $ .\" .\" Copyright (c) 2022 Ingo Schwarze .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: December 14 2022 $ +.Dd $Mdocdate: July 9 2023 $ .Dt ASN1_BUF_PRINT 3 .Os .Sh NAME @@ -58,7 +58,6 @@ space characters, but not by more than 64 characters. .Fn ASN1_buf_print returns 1 if successful or 0 if printing fails. .Sh SEE ALSO -.Xr ASN1_bn_print 3 , .Xr ASN1_item_print 3 , .Xr ASN1_STRING_print_ex 3 , .Xr ASN1_TIME_print 3 , diff --git a/lib/libcrypto/man/BN_bn2bin.3 b/lib/libcrypto/man/BN_bn2bin.3 index ec69909d9..0fe9a9073 100644 --- a/lib/libcrypto/man/BN_bn2bin.3 +++ b/lib/libcrypto/man/BN_bn2bin.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: BN_bn2bin.3,v 1.15 2021/12/08 21:52:29 schwarze Exp $ +.\" $OpenBSD: BN_bn2bin.3,v 1.16 2023/07/09 06:45:03 tb Exp $ .\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 .\" .\" This file was written by Ulf Moeller @@ -49,7 +49,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: December 8 2021 $ +.Dd $Mdocdate: July 9 2023 $ .Dt BN_BN2BIN 3 .Os .Sh NAME @@ -353,7 +353,6 @@ on error. The error codes can be obtained by .Xr ERR_get_error 3 . .Sh SEE ALSO -.Xr ASN1_bn_print 3 , .Xr ASN1_INTEGER_to_BN 3 , .Xr BN_new 3 , .Xr BN_num_bytes 3 , diff --git a/lib/libcrypto/man/BN_new.3 b/lib/libcrypto/man/BN_new.3 index bef41a9fe..3a3e98379 100644 --- a/lib/libcrypto/man/BN_new.3 +++ b/lib/libcrypto/man/BN_new.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: BN_new.3,v 1.27 2023/04/28 16:39:19 schwarze Exp $ +.\" $OpenBSD: BN_new.3,v 1.28 2023/07/09 06:45:03 tb Exp $ .\" full merge up to: OpenSSL man3/BN_new 2457c19d Mar 6 08:43:36 2004 +0000 .\" selective merge up to: man3/BN_new 681acb31 Sep 29 13:10:34 2017 +0200 .\" full merge up to: OpenSSL man7/bn 05ea606a May 20 20:52:46 2016 -0400 @@ -50,7 +50,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: April 28 2023 $ +.Dd $Mdocdate: July 9 2023 $ .Dt BN_NEW 3 .Os .Sh NAME @@ -133,7 +133,6 @@ If the allocation fails, it returns and sets an error code that can be obtained by .Xr ERR_get_error 3 . .Sh SEE ALSO -.Xr ASN1_bn_print 3 , .Xr BN_add 3 , .Xr BN_add_word 3 , .Xr BN_BLINDING_new 3 , diff --git a/lib/libcrypto/man/EVP_MD_meth_new.3 b/lib/libcrypto/man/EVP_MD_meth_new.3 new file mode 100644 index 000000000..d6720ef8b --- /dev/null +++ b/lib/libcrypto/man/EVP_MD_meth_new.3 @@ -0,0 +1,292 @@ +.\" $OpenBSD: EVP_MD_meth_new.3,v 1.2 2023/07/09 06:47:51 tb Exp $ +.\" selective merge up to: +.\" OpenSSL man3/EVP_MD_meth_new 0388d212 Dec 14 12:47:07 2018 -0800 +.\" +.\" This file was written by Richard Levitte +.\" Copyright (c) 2015 The OpenSSL Project. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" +.\" 3. All advertising materials mentioning features or use of this +.\" software must display the following acknowledgment: +.\" "This product includes software developed by the OpenSSL Project +.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" +.\" +.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to +.\" endorse or promote products derived from this software without +.\" prior written permission. For written permission, please contact +.\" openssl-core@openssl.org. +.\" +.\" 5. Products derived from this software may not be called "OpenSSL" +.\" nor may "OpenSSL" appear in their names without prior written +.\" permission of the OpenSSL Project. +.\" +.\" 6. Redistributions of any form whatsoever must retain the following +.\" acknowledgment: +.\" "This product includes software developed by the OpenSSL Project +.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +.\" OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd $Mdocdate: July 9 2023 $ +.Dt EVP_MD_METH_NEW 3 +.Os +.Sh NAME +.Nm EVP_MD_meth_dup , +.Nm EVP_MD_meth_new , +.Nm EVP_MD_meth_free , +.Nm EVP_MD_meth_set_input_blocksize , +.Nm EVP_MD_meth_set_result_size , +.Nm EVP_MD_meth_set_app_datasize , +.Nm EVP_MD_meth_set_flags , +.Nm EVP_MD_meth_set_init , +.Nm EVP_MD_meth_set_update , +.Nm EVP_MD_meth_set_final , +.Nm EVP_MD_meth_set_copy , +.Nm EVP_MD_meth_set_cleanup , +.Nm EVP_MD_meth_set_ctrl +.Nd Routines to build up EVP_MD methods +.Sh SYNOPSIS +.In openssl/evp.h +.Ft EVP_MD * +.Fo EVP_MD_meth_new +.Fa "int md_type" +.Fa "int pkey_type" +.Fc +.Ft void +.Fo EVP_MD_meth_free +.Fa "EVP_MD *md" +.Fc +.Ft EVP_MD * +.Fo EVP_MD_meth_dup +.Fa "const EVP_MD *md" +.Fc +.Ft int +.Fo EVP_MD_meth_set_input_blocksize +.Fa "EVP_MD *md" +.Fa "int blocksize" +.Fc +.Ft int +.Fo EVP_MD_meth_set_result_size +.Fa "EVP_MD *md" +.Fa "int resultsize" +.Fc +.Ft int +.Fo EVP_MD_meth_set_app_datasize +.Fa "EVP_MD *md" +.Fa "int datasize" +.Fc +.Ft int +.Fo EVP_MD_meth_set_flags +.Fa "EVP_MD *md" +.Fa "unsigned long flags" +.Fc +.Ft int +.Fo EVP_MD_meth_set_init +.Fa "EVP_MD *md" +.Fa "int (*init)(EVP_MD_CTX *ctx)" +.Fc +.Ft int +.Fo EVP_MD_meth_set_update +.Fa "EVP_MD *md" +.Fa "int (*update)(EVP_MD_CTX *ctx, const void *data, size_t count)" +.Fc +.Ft int +.Fo EVP_MD_meth_set_final +.Fa "EVP_MD *md" +.Fa "int (*final)(EVP_MD_CTX *ctx, unsigned char *md)" +.Fc +.Ft int +.Fo EVP_MD_meth_set_copy +.Fa "EVP_MD *md" +.Fa "int (*copy)(EVP_MD_CTX *to, const EVP_MD_CTX *from)" +.Fc +.Ft int +.Fo EVP_MD_meth_set_cleanup +.Fa "EVP_MD *md" +.Fa "int (*cleanup)(EVP_MD_CTX *ctx)" +.Fc +.Ft int +.Fo EVP_MD_meth_set_ctrl +.Fa "EVP_MD *md" +.Fa "int (*ctrl)(EVP_MD_CTX *ctx, int cmd, int p1, void *p2)" +.Fc +.Sh DESCRIPTION +The +.Vt EVP_MD +type is a structure for digest method implementation. +It can also have associated public/private key signing and verifying +routines. +.Pp +.Fn EVP_MD_meth_new +creates a new +.Vt EVP_MD +structure. +.Pp +.Fn EVP_MD_meth_dup +creates a copy of +.Fa md . +.Pp +.Fn EVP_MD_meth_free +destroys a +.Vt EVP_MD +structure. +.Pp +.Fn EVP_MD_meth_set_input_blocksize +sets the internal input block size for the method +.Fa md +to +.Fa blocksize +bytes. +.Pp +.Fn EVP_MD_meth_set_result_size +sets the size of the result that the digest method in +.Fa md +is expected to produce to +.Fa resultsize +bytes. +.Pp +The digest method may have its own private data, which OpenSSL will +allocate for it. +.Fn EVP_MD_meth_set_app_datasize +should be used to set the size for it to +.Fa datasize . +.Pp +.Fn EVP_MD_meth_set_flags +sets the flags to describe optional behaviours in the particular +.Fa md . +Several flags can be or'd together. +The available flags are: +.Bl -tag -width Ds +.It EVP_MD_FLAG_ONESHOT +This digest method can only handle one block of input. +.It EVP_MD_FLAG_DIGALGID_NULL +When setting up a DigestAlgorithmIdentifier, this flag will have the +parameter set to NULL by default. +Use this for PKCS#1. +.Em Note: if combined with EVP_MD_FLAG_DIGALGID_ABSENT, the latter will override. +.It EVP_MD_FLAG_DIGALGID_ABSENT +When setting up a DigestAlgorithmIdentifier, this flag will have the +parameter be left absent by default. +.Em Note: if combined with EVP_MD_FLAG_DIGALGID_NULL, the latter will be overridden. +.It EVP_MD_FLAG_DIGALGID_CUSTOM +Custom DigestAlgorithmIdentifier handling via ctrl, with +.Sy EVP_MD_FLAG_DIGALGID_ABSENT +as default. +.Em Note: if combined with EVP_MD_FLAG_DIGALGID_NULL, the latter will be overridden. +Currently unused. +.It EVP_MD_FLAG_FIPS +This digest method is suitable for use in FIPS mode. +Currently unused. +.El +.Pp +.Fn EVP_MD_meth_set_init +sets the digest init function for +.Fa md . +The digest init function is called by +.Xr EVP_Digest 3 , +.Xr EVP_DigestInit 3 , +.Xr EVP_DigestInit_ex 3 , +EVP_SignInit, +.Xr EVP_SignInit_ex 3 , +.Xr EVP_VerifyInit 3 +and +.Xr EVP_VerifyInit_ex 3 . +.Pp +.Fn EVP_MD_meth_set_update +sets the digest update function for +.Fa md . +The digest update function is called by +.Xr EVP_Digest 3 , +.Xr EVP_DigestUpdate 3 +and +.Xr EVP_SignUpdate 3 . +.Pp +.Fn EVP_MD_meth_set_final +sets the digest final function for +.Fa md . +The digest final function is called by +.Xr EVP_Digest 3 , +.Xr EVP_DigestFinal 3 , +.Xr EVP_DigestFinal_ex 3 , +.Xr EVP_SignFinal 3 +and +.Xr EVP_VerifyFinal 3 . +.Pp +.Fn EVP_MD_meth_set_copy +sets the function for +.Fa md +to do extra computations after the method's private data structure has +been copied from one +.Vt EVP_MD_CTX +object to another. +If all that's needed is to copy the data, there is no need for this copy +function. +The copy function is passed two +.Vt EVP_MD_CTX +objects, the private data structure is then available with +.Xr EVP_MD_CTX_md_data 3 . +This copy function is called by +.Xr EVP_MD_CTX_copy 3 +and +.Xr EVP_MD_CTX_copy_ex 3 . +.Pp +.Fn EVP_MD_meth_set_cleanup +sets the function for +.Fa md +to do extra cleanup before the method's private data structure is +cleaned out and freed. +The cleanup function is passed an +.Vt EVP_MD_CTX +object, the private data structure is then available with +.Xr EVP_MD_CTX_md_data 3 . +This cleanup function is called by +.Xr EVP_MD_CTX_reset 3 +and +.Xr EVP_MD_CTX_free 3 . +.Pp +.Fn EVP_MD_meth_set_ctrl +sets the control function for +.Fa md . +See +.Xr EVP_MD_CTX_ctrl 3 +for the available controls. +.Sh RETURN VALUES +.Fn EVP_MD_meth_new +and +.Fn EVP_MD_meth_dup +return a pointer to a newly created +.Vt EVP_MD , +or NULL on failure. +All +.Fn EVP_MD_meth_set_* +functions return 1. +.Sh SEE ALSO +.Xr EVP_DigestInit 3 , +.Xr EVP_SignInit 3 , +.Xr EVP_VerifyInit 3 +.Sh HISTORY +All these functions +first appeared in OpenSSL 1.1.0 and have been available since +.Ox 7.1 . diff --git a/lib/libcrypto/man/Makefile b/lib/libcrypto/man/Makefile index abefb79c1..00ac9f448 100644 --- a/lib/libcrypto/man/Makefile +++ b/lib/libcrypto/man/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.251 2023/05/01 07:28:11 tb Exp $ +# $OpenBSD: Makefile,v 1.253 2023/07/09 06:45:03 tb Exp $ .include @@ -18,7 +18,6 @@ MAN= \ ASN1_TIME_set.3 \ ASN1_TYPE_get.3 \ ASN1_UNIVERSALSTRING_to_string.3 \ - ASN1_bn_print.3 \ ASN1_buf_print.3 \ ASN1_generate_nconf.3 \ ASN1_get_object.3 \ @@ -174,6 +173,7 @@ MAN= \ EVP_DigestVerifyInit.3 \ EVP_EncodeInit.3 \ EVP_EncryptInit.3 \ + EVP_MD_meth_new.3 \ EVP_OpenInit.3 \ EVP_PKCS82PKEY.3 \ EVP_PKEY_CTX_ctrl.3 \ diff --git a/lib/libcrypto/man/evp.3 b/lib/libcrypto/man/evp.3 index dad999fc1..6eb6ebfa3 100644 --- a/lib/libcrypto/man/evp.3 +++ b/lib/libcrypto/man/evp.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: evp.3,v 1.14 2019/08/25 17:08:20 schwarze Exp $ +.\" $OpenBSD: evp.3,v 1.15 2023/07/09 06:49:25 tb Exp $ .\" OpenSSL a9c85cea Nov 11 09:33:55 2016 +0100 .\" .\" This file was written by Ulf Moeller , @@ -51,7 +51,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: August 25 2019 $ +.Dd $Mdocdate: July 9 2023 $ .Dt EVP 3 .Os .Sh NAME @@ -192,6 +192,7 @@ operations are more efficient using the high level interfaces. .Xr EVP_DigestSignInit 3 , .Xr EVP_EncodeInit 3 , .Xr EVP_EncryptInit 3 , +.Xr EVP_MD_meth_new 3 , .Xr EVP_OpenInit 3 , .Xr EVP_PKEY_decrypt 3 , .Xr EVP_PKEY_derive 3 , diff --git a/lib/libcrypto/md4/md4.h b/lib/libcrypto/md4/md4.h index 04aacc980..cb4f3cb6e 100644 --- a/lib/libcrypto/md4/md4.h +++ b/lib/libcrypto/md4/md4.h @@ -1,25 +1,25 @@ -/* $OpenBSD: md4.h,v 1.16 2015/09/14 01:45:03 doug Exp $ */ +/* $OpenBSD: md4.h,v 1.17 2023/07/08 06:47:26 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -83,13 +83,12 @@ extern "C" { #define MD4_LBLOCK (MD4_CBLOCK/4) #define MD4_DIGEST_LENGTH 16 -typedef struct MD4state_st - { - MD4_LONG A,B,C,D; - MD4_LONG Nl,Nh; +typedef struct MD4state_st { + MD4_LONG A, B,C, D; + MD4_LONG Nl, Nh; MD4_LONG data[MD4_LBLOCK]; unsigned int num; - } MD4_CTX; +} MD4_CTX; int MD4_Init(MD4_CTX *c); int MD4_Update(MD4_CTX *c, const void *data, size_t len); diff --git a/lib/libcrypto/md4/md4_dgst.c b/lib/libcrypto/md4/md4_dgst.c index aa7b7f793..e6fff4893 100644 --- a/lib/libcrypto/md4/md4_dgst.c +++ b/lib/libcrypto/md4/md4_dgst.c @@ -1,25 +1,25 @@ -/* $OpenBSD: md4_dgst.c,v 1.17 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: md4_dgst.c,v 1.20 2023/07/08 10:45:57 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -59,7 +59,64 @@ #include #include #include -#include "md4_local.h" + +#include +#include +#include +#include + +__BEGIN_HIDDEN_DECLS + +void md4_block_data_order (MD4_CTX *c, const void *p, size_t num); + +__END_HIDDEN_DECLS + +#define DATA_ORDER_IS_LITTLE_ENDIAN + +#define HASH_LONG MD4_LONG +#define HASH_CTX MD4_CTX +#define HASH_CBLOCK MD4_CBLOCK +#define HASH_UPDATE MD4_Update +#define HASH_TRANSFORM MD4_Transform +#define HASH_FINAL MD4_Final +#define HASH_MAKE_STRING(c,s) do { \ + unsigned long ll; \ + ll=(c)->A; HOST_l2c(ll,(s)); \ + ll=(c)->B; HOST_l2c(ll,(s)); \ + ll=(c)->C; HOST_l2c(ll,(s)); \ + ll=(c)->D; HOST_l2c(ll,(s)); \ + } while (0) +#define HASH_BLOCK_DATA_ORDER md4_block_data_order + +#include "md32_common.h" +LCRYPTO_ALIAS(MD4_Update); +LCRYPTO_ALIAS(MD4_Final); +LCRYPTO_ALIAS(MD4_Transform); + +/* +#define F(x,y,z) (((x) & (y)) | ((~(x)) & (z))) +#define G(x,y,z) (((x) & (y)) | ((x) & ((z))) | ((y) & ((z)))) +*/ + +/* As pointed out by Wei Dai , the above can be + * simplified to the code below. Wei attributes these optimizations + * to Peter Gutmann's SHS code, and he attributes it to Rich Schroeppel. + */ +#define F(b,c,d) ((((c) ^ (d)) & (b)) ^ (d)) +#define G(b,c,d) (((b) & (c)) | ((b) & (d)) | ((c) & (d))) +#define H(b,c,d) ((b) ^ (c) ^ (d)) + +#define R0(a,b,c,d,k,s,t) { \ + a+=((k)+(t)+F((b),(c),(d))); \ + a=ROTATE(a,s); }; + +#define R1(a,b,c,d,k,s,t) { \ + a+=((k)+(t)+G((b),(c),(d))); \ + a=ROTATE(a,s); };\ + +#define R2(a,b,c,d,k,s,t) { \ + a+=((k)+(t)+H((b),(c),(d))); \ + a=ROTATE(a,s); }; /* Implemented from RFC1186 The MD4 Message-Digest Algorithm */ @@ -69,99 +126,131 @@ #define INIT_DATA_C (unsigned long)0x98badcfeL #define INIT_DATA_D (unsigned long)0x10325476L -int MD4_Init(MD4_CTX *c) - { - memset (c,0,sizeof(*c)); - c->A=INIT_DATA_A; - c->B=INIT_DATA_B; - c->C=INIT_DATA_C; - c->D=INIT_DATA_D; +int +MD4_Init(MD4_CTX *c) +{ + memset (c, 0, sizeof(*c)); + c->A = INIT_DATA_A; + c->B = INIT_DATA_B; + c->C = INIT_DATA_C; + c->D = INIT_DATA_D; return 1; - } +} +LCRYPTO_ALIAS(MD4_Init); #ifndef md4_block_data_order #ifdef X #undef X #endif -void md4_block_data_order (MD4_CTX *c, const void *data_, size_t num) - { - const unsigned char *data=data_; - unsigned MD32_REG_T A,B,C,D,l; +void +md4_block_data_order(MD4_CTX *c, const void *data_, size_t num) +{ + const unsigned char *data = data_; + unsigned MD32_REG_T A, B,C, D, l; #ifndef MD32_XARRAY /* See comment in crypto/sha/sha_locl.h for details. */ unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7, - XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15; + XX8, XX9, XX10, XX11, XX12, XX13, XX14, XX15; # define X(i) XX##i #else MD4_LONG XX[MD4_LBLOCK]; # define X(i) XX[i] #endif - A=c->A; - B=c->B; - C=c->C; - D=c->D; + A = c->A; + B = c->B; + C = c->C; + D = c->D; - for (;num--;) - { - HOST_c2l(data,l); X( 0)=l; - HOST_c2l(data,l); X( 1)=l; - /* Round 0 */ - R0(A,B,C,D,X( 0), 3,0); HOST_c2l(data,l); X( 2)=l; - R0(D,A,B,C,X( 1), 7,0); HOST_c2l(data,l); X( 3)=l; - R0(C,D,A,B,X( 2),11,0); HOST_c2l(data,l); X( 4)=l; - R0(B,C,D,A,X( 3),19,0); HOST_c2l(data,l); X( 5)=l; - R0(A,B,C,D,X( 4), 3,0); HOST_c2l(data,l); X( 6)=l; - R0(D,A,B,C,X( 5), 7,0); HOST_c2l(data,l); X( 7)=l; - R0(C,D,A,B,X( 6),11,0); HOST_c2l(data,l); X( 8)=l; - R0(B,C,D,A,X( 7),19,0); HOST_c2l(data,l); X( 9)=l; - R0(A,B,C,D,X( 8), 3,0); HOST_c2l(data,l); X(10)=l; - R0(D,A,B,C,X( 9), 7,0); HOST_c2l(data,l); X(11)=l; - R0(C,D,A,B,X(10),11,0); HOST_c2l(data,l); X(12)=l; - R0(B,C,D,A,X(11),19,0); HOST_c2l(data,l); X(13)=l; - R0(A,B,C,D,X(12), 3,0); HOST_c2l(data,l); X(14)=l; - R0(D,A,B,C,X(13), 7,0); HOST_c2l(data,l); X(15)=l; - R0(C,D,A,B,X(14),11,0); - R0(B,C,D,A,X(15),19,0); - /* Round 1 */ - R1(A,B,C,D,X( 0), 3,0x5A827999L); - R1(D,A,B,C,X( 4), 5,0x5A827999L); - R1(C,D,A,B,X( 8), 9,0x5A827999L); - R1(B,C,D,A,X(12),13,0x5A827999L); - R1(A,B,C,D,X( 1), 3,0x5A827999L); - R1(D,A,B,C,X( 5), 5,0x5A827999L); - R1(C,D,A,B,X( 9), 9,0x5A827999L); - R1(B,C,D,A,X(13),13,0x5A827999L); - R1(A,B,C,D,X( 2), 3,0x5A827999L); - R1(D,A,B,C,X( 6), 5,0x5A827999L); - R1(C,D,A,B,X(10), 9,0x5A827999L); - R1(B,C,D,A,X(14),13,0x5A827999L); - R1(A,B,C,D,X( 3), 3,0x5A827999L); - R1(D,A,B,C,X( 7), 5,0x5A827999L); - R1(C,D,A,B,X(11), 9,0x5A827999L); - R1(B,C,D,A,X(15),13,0x5A827999L); - /* Round 2 */ - R2(A,B,C,D,X( 0), 3,0x6ED9EBA1L); - R2(D,A,B,C,X( 8), 9,0x6ED9EBA1L); - R2(C,D,A,B,X( 4),11,0x6ED9EBA1L); - R2(B,C,D,A,X(12),15,0x6ED9EBA1L); - R2(A,B,C,D,X( 2), 3,0x6ED9EBA1L); - R2(D,A,B,C,X(10), 9,0x6ED9EBA1L); - R2(C,D,A,B,X( 6),11,0x6ED9EBA1L); - R2(B,C,D,A,X(14),15,0x6ED9EBA1L); - R2(A,B,C,D,X( 1), 3,0x6ED9EBA1L); - R2(D,A,B,C,X( 9), 9,0x6ED9EBA1L); - R2(C,D,A,B,X( 5),11,0x6ED9EBA1L); - R2(B,C,D,A,X(13),15,0x6ED9EBA1L); - R2(A,B,C,D,X( 3), 3,0x6ED9EBA1L); - R2(D,A,B,C,X(11), 9,0x6ED9EBA1L); - R2(C,D,A,B,X( 7),11,0x6ED9EBA1L); - R2(B,C,D,A,X(15),15,0x6ED9EBA1L); + for (; num--; ) { + HOST_c2l(data, l); + X( 0) = l; + HOST_c2l(data, l); + X( 1) = l; + /* Round 0 */ + R0(A, B,C, D,X( 0), 3, 0); + HOST_c2l(data, l); + X( 2) = l; + R0(D, A,B, C,X( 1), 7, 0); + HOST_c2l(data, l); + X( 3) = l; + R0(C, D,A, B,X( 2), 11, 0); + HOST_c2l(data, l); + X( 4) = l; + R0(B, C,D, A,X( 3), 19, 0); + HOST_c2l(data, l); + X( 5) = l; + R0(A, B,C, D,X( 4), 3, 0); + HOST_c2l(data, l); + X( 6) = l; + R0(D, A,B, C,X( 5), 7, 0); + HOST_c2l(data, l); + X( 7) = l; + R0(C, D,A, B,X( 6), 11, 0); + HOST_c2l(data, l); + X( 8) = l; + R0(B, C,D, A,X( 7), 19, 0); + HOST_c2l(data, l); + X( 9) = l; + R0(A, B,C, D,X( 8), 3, 0); + HOST_c2l(data, l); + X(10) = l; + R0(D, A,B, C,X( 9), 7, 0); + HOST_c2l(data, l); + X(11) = l; + R0(C, D,A, B,X(10), 11, 0); + HOST_c2l(data, l); + X(12) = l; + R0(B, C,D, A,X(11), 19, 0); + HOST_c2l(data, l); + X(13) = l; + R0(A, B,C, D,X(12), 3, 0); + HOST_c2l(data, l); + X(14) = l; + R0(D, A,B, C,X(13), 7, 0); + HOST_c2l(data, l); + X(15) = l; + R0(C, D,A, B,X(14), 11, 0); + R0(B, C,D, A,X(15), 19, 0); + /* Round 1 */ + R1(A, B,C, D,X( 0), 3, 0x5A827999L); + R1(D, A,B, C,X( 4), 5, 0x5A827999L); + R1(C, D,A, B,X( 8), 9, 0x5A827999L); + R1(B, C,D, A,X(12), 13, 0x5A827999L); + R1(A, B,C, D,X( 1), 3, 0x5A827999L); + R1(D, A,B, C,X( 5), 5, 0x5A827999L); + R1(C, D,A, B,X( 9), 9, 0x5A827999L); + R1(B, C,D, A,X(13), 13, 0x5A827999L); + R1(A, B,C, D,X( 2), 3, 0x5A827999L); + R1(D, A,B, C,X( 6), 5, 0x5A827999L); + R1(C, D,A, B,X(10), 9, 0x5A827999L); + R1(B, C,D, A,X(14), 13, 0x5A827999L); + R1(A, B,C, D,X( 3), 3, 0x5A827999L); + R1(D, A,B, C,X( 7), 5, 0x5A827999L); + R1(C, D,A, B,X(11), 9, 0x5A827999L); + R1(B, C,D, A,X(15), 13, 0x5A827999L); + /* Round 2 */ + R2(A, B,C, D,X( 0), 3, 0x6ED9EBA1L); + R2(D, A,B, C,X( 8), 9, 0x6ED9EBA1L); + R2(C, D,A, B,X( 4), 11, 0x6ED9EBA1L); + R2(B, C,D, A,X(12), 15, 0x6ED9EBA1L); + R2(A, B,C, D,X( 2), 3, 0x6ED9EBA1L); + R2(D, A,B, C,X(10), 9, 0x6ED9EBA1L); + R2(C, D,A, B,X( 6), 11, 0x6ED9EBA1L); + R2(B, C,D, A,X(14), 15, 0x6ED9EBA1L); + R2(A, B,C, D,X( 1), 3, 0x6ED9EBA1L); + R2(D, A,B, C,X( 9), 9, 0x6ED9EBA1L); + R2(C, D,A, B,X( 5), 11, 0x6ED9EBA1L); + R2(B, C,D, A,X(13), 15, 0x6ED9EBA1L); + R2(A, B,C, D,X( 3), 3, 0x6ED9EBA1L); + R2(D, A,B, C,X(11), 9, 0x6ED9EBA1L); + R2(C, D,A, B,X( 7), 11, 0x6ED9EBA1L); + R2(B, C,D, A,X(15), 15, 0x6ED9EBA1L); - A = c->A += A; - B = c->B += B; - C = c->C += C; - D = c->D += D; - } + A = c->A += A; + B = c->B += B; + C = c->C += C; + D = c->D += D; } +} #endif diff --git a/lib/libcrypto/md4/md4_local.h b/lib/libcrypto/md4/md4_local.h deleted file mode 100644 index a5aa123ca..000000000 --- a/lib/libcrypto/md4/md4_local.h +++ /dev/null @@ -1,112 +0,0 @@ -/* $OpenBSD: md4_local.h,v 1.1 2022/11/26 16:08:53 tb Exp $ */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include -#include -#include -#include - -__BEGIN_HIDDEN_DECLS - -void md4_block_data_order (MD4_CTX *c, const void *p,size_t num); - -__END_HIDDEN_DECLS - -#define DATA_ORDER_IS_LITTLE_ENDIAN - -#define HASH_LONG MD4_LONG -#define HASH_CTX MD4_CTX -#define HASH_CBLOCK MD4_CBLOCK -#define HASH_UPDATE MD4_Update -#define HASH_TRANSFORM MD4_Transform -#define HASH_FINAL MD4_Final -#define HASH_MAKE_STRING(c,s) do { \ - unsigned long ll; \ - ll=(c)->A; HOST_l2c(ll,(s)); \ - ll=(c)->B; HOST_l2c(ll,(s)); \ - ll=(c)->C; HOST_l2c(ll,(s)); \ - ll=(c)->D; HOST_l2c(ll,(s)); \ - } while (0) -#define HASH_BLOCK_DATA_ORDER md4_block_data_order - -#include "md32_common.h" - -/* -#define F(x,y,z) (((x) & (y)) | ((~(x)) & (z))) -#define G(x,y,z) (((x) & (y)) | ((x) & ((z))) | ((y) & ((z)))) -*/ - -/* As pointed out by Wei Dai , the above can be - * simplified to the code below. Wei attributes these optimizations - * to Peter Gutmann's SHS code, and he attributes it to Rich Schroeppel. - */ -#define F(b,c,d) ((((c) ^ (d)) & (b)) ^ (d)) -#define G(b,c,d) (((b) & (c)) | ((b) & (d)) | ((c) & (d))) -#define H(b,c,d) ((b) ^ (c) ^ (d)) - -#define R0(a,b,c,d,k,s,t) { \ - a+=((k)+(t)+F((b),(c),(d))); \ - a=ROTATE(a,s); }; - -#define R1(a,b,c,d,k,s,t) { \ - a+=((k)+(t)+G((b),(c),(d))); \ - a=ROTATE(a,s); };\ - -#define R2(a,b,c,d,k,s,t) { \ - a+=((k)+(t)+H((b),(c),(d))); \ - a=ROTATE(a,s); }; diff --git a/lib/libcrypto/md4/md4_one.c b/lib/libcrypto/md4/md4_one.c index c1fd6f3e5..3879a2ab4 100644 --- a/lib/libcrypto/md4/md4_one.c +++ b/lib/libcrypto/md4/md4_one.c @@ -1,25 +1,25 @@ -/* $OpenBSD: md4_one.c,v 1.10 2015/09/14 01:45:03 doug Exp $ */ +/* $OpenBSD: md4_one.c,v 1.12 2023/07/08 10:45:57 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -61,17 +61,19 @@ #include #include -unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md) - { +unsigned char * +MD4(const unsigned char *d, size_t n, unsigned char *md) +{ MD4_CTX c; static unsigned char m[MD4_DIGEST_LENGTH]; - if (md == NULL) md=m; + if (md == NULL) + md = m; if (!MD4_Init(&c)) return NULL; - MD4_Update(&c,d,n); - MD4_Final(md,&c); - explicit_bzero(&c,sizeof(c)); - return(md); - } - + MD4_Update(&c, d, n); + MD4_Final(md, &c); + explicit_bzero(&c, sizeof(c)); + return (md); +} +LCRYPTO_ALIAS(MD4); diff --git a/lib/libcrypto/md5/md5.h b/lib/libcrypto/md5/md5.h index e2c511c7c..d248c93a8 100644 --- a/lib/libcrypto/md5/md5.h +++ b/lib/libcrypto/md5/md5.h @@ -1,25 +1,25 @@ -/* $OpenBSD: md5.h,v 1.20 2014/10/20 13:06:54 bcook Exp $ */ +/* $OpenBSD: md5.h,v 1.21 2023/07/08 06:50:38 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -86,20 +86,19 @@ extern "C" { #define MD5_LBLOCK (MD5_CBLOCK/4) #define MD5_DIGEST_LENGTH 16 -typedef struct MD5state_st - { - MD5_LONG A,B,C,D; - MD5_LONG Nl,Nh; +typedef struct MD5state_st { + MD5_LONG A, B,C, D; + MD5_LONG Nl, Nh; MD5_LONG data[MD5_LBLOCK]; unsigned int num; - } MD5_CTX; +} MD5_CTX; int MD5_Init(MD5_CTX *c); int MD5_Update(MD5_CTX *c, const void *data, size_t len) - __attribute__ ((__bounded__(__buffer__,2,3))); + __attribute__ ((__bounded__(__buffer__, 2, 3))); int MD5_Final(unsigned char *md, MD5_CTX *c); unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md) - __attribute__ ((__bounded__(__buffer__,1,2))); + __attribute__ ((__bounded__(__buffer__, 1, 2))); void MD5_Transform(MD5_CTX *c, const unsigned char *b); #ifdef __cplusplus } diff --git a/lib/libcrypto/md5/md5_dgst.c b/lib/libcrypto/md5/md5_dgst.c index 5acdcd200..b0eb47219 100644 --- a/lib/libcrypto/md5/md5_dgst.c +++ b/lib/libcrypto/md5/md5_dgst.c @@ -1,25 +1,25 @@ -/* $OpenBSD: md5_dgst.c,v 1.15 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: md5_dgst.c,v 1.18 2023/07/08 10:45:57 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -57,10 +57,87 @@ */ #include -#include "md5_local.h" #include #include +#include +#include + +#include + +#include + +#ifdef MD5_ASM +# if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__) || \ + defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64) +# define md5_block_data_order md5_block_asm_data_order +# elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64) +# define md5_block_data_order md5_block_asm_data_order +# endif +#endif + +__BEGIN_HIDDEN_DECLS + +void md5_block_data_order (MD5_CTX *c, const void *p, size_t num); + +__END_HIDDEN_DECLS + +#define DATA_ORDER_IS_LITTLE_ENDIAN + +#define HASH_LONG MD5_LONG +#define HASH_CTX MD5_CTX +#define HASH_CBLOCK MD5_CBLOCK +#define HASH_UPDATE MD5_Update +#define HASH_TRANSFORM MD5_Transform +#define HASH_FINAL MD5_Final +#define HASH_MAKE_STRING(c,s) do { \ + unsigned long ll; \ + ll=(c)->A; HOST_l2c(ll,(s)); \ + ll=(c)->B; HOST_l2c(ll,(s)); \ + ll=(c)->C; HOST_l2c(ll,(s)); \ + ll=(c)->D; HOST_l2c(ll,(s)); \ + } while (0) +#define HASH_BLOCK_DATA_ORDER md5_block_data_order + +#include "md32_common.h" +LCRYPTO_ALIAS(MD5_Update); +LCRYPTO_ALIAS(MD5_Transform); +LCRYPTO_ALIAS(MD5_Final); + +/* +#define F(x,y,z) (((x) & (y)) | ((~(x)) & (z))) +#define G(x,y,z) (((x) & (z)) | ((y) & (~(z)))) +*/ + +/* As pointed out by Wei Dai , the above can be + * simplified to the code below. Wei attributes these optimizations + * to Peter Gutmann's SHS code, and he attributes it to Rich Schroeppel. + */ +#define F(b,c,d) ((((c) ^ (d)) & (b)) ^ (d)) +#define G(b,c,d) ((((b) ^ (c)) & (d)) ^ (c)) +#define H(b,c,d) ((b) ^ (c) ^ (d)) +#define I(b,c,d) (((~(d)) | (b)) ^ (c)) + +#define R0(a,b,c,d,k,s,t) { \ + a+=((k)+(t)+F((b),(c),(d))); \ + a=ROTATE(a,s); \ + a+=b; };\ + +#define R1(a,b,c,d,k,s,t) { \ + a+=((k)+(t)+G((b),(c),(d))); \ + a=ROTATE(a,s); \ + a+=b; }; + +#define R2(a,b,c,d,k,s,t) { \ + a+=((k)+(t)+H((b),(c),(d))); \ + a=ROTATE(a,s); \ + a+=b; }; + +#define R3(a,b,c,d,k,s,t) { \ + a+=((k)+(t)+I((b),(c),(d))); \ + a=ROTATE(a,s); \ + a+=b; }; + /* Implemented from RFC1321 The MD5 Message-Digest Algorithm */ @@ -69,115 +146,148 @@ #define INIT_DATA_C (unsigned long)0x98badcfeL #define INIT_DATA_D (unsigned long)0x10325476L -int MD5_Init(MD5_CTX *c) - { - memset (c,0,sizeof(*c)); - c->A=INIT_DATA_A; - c->B=INIT_DATA_B; - c->C=INIT_DATA_C; - c->D=INIT_DATA_D; +int +MD5_Init(MD5_CTX *c) +{ + memset (c, 0, sizeof(*c)); + c->A = INIT_DATA_A; + c->B = INIT_DATA_B; + c->C = INIT_DATA_C; + c->D = INIT_DATA_D; return 1; - } +} +LCRYPTO_ALIAS(MD5_Init); #ifndef md5_block_data_order #ifdef X #undef X #endif -void md5_block_data_order (MD5_CTX *c, const void *data_, size_t num) - { - const unsigned char *data=data_; - unsigned MD32_REG_T A,B,C,D,l; +void +md5_block_data_order(MD5_CTX *c, const void *data_, size_t num) +{ + const unsigned char *data = data_; + unsigned MD32_REG_T A, B,C, D, l; #ifndef MD32_XARRAY /* See comment in crypto/sha/sha_locl.h for details. */ unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7, - XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15; + XX8, XX9, XX10, XX11, XX12, XX13, XX14, XX15; # define X(i) XX##i #else MD5_LONG XX[MD5_LBLOCK]; # define X(i) XX[i] #endif - A=c->A; - B=c->B; - C=c->C; - D=c->D; + A = c->A; + B = c->B; + C = c->C; + D = c->D; - for (;num--;) - { - HOST_c2l(data,l); X( 0)=l; HOST_c2l(data,l); X( 1)=l; - /* Round 0 */ - R0(A,B,C,D,X( 0), 7,0xd76aa478L); HOST_c2l(data,l); X( 2)=l; - R0(D,A,B,C,X( 1),12,0xe8c7b756L); HOST_c2l(data,l); X( 3)=l; - R0(C,D,A,B,X( 2),17,0x242070dbL); HOST_c2l(data,l); X( 4)=l; - R0(B,C,D,A,X( 3),22,0xc1bdceeeL); HOST_c2l(data,l); X( 5)=l; - R0(A,B,C,D,X( 4), 7,0xf57c0fafL); HOST_c2l(data,l); X( 6)=l; - R0(D,A,B,C,X( 5),12,0x4787c62aL); HOST_c2l(data,l); X( 7)=l; - R0(C,D,A,B,X( 6),17,0xa8304613L); HOST_c2l(data,l); X( 8)=l; - R0(B,C,D,A,X( 7),22,0xfd469501L); HOST_c2l(data,l); X( 9)=l; - R0(A,B,C,D,X( 8), 7,0x698098d8L); HOST_c2l(data,l); X(10)=l; - R0(D,A,B,C,X( 9),12,0x8b44f7afL); HOST_c2l(data,l); X(11)=l; - R0(C,D,A,B,X(10),17,0xffff5bb1L); HOST_c2l(data,l); X(12)=l; - R0(B,C,D,A,X(11),22,0x895cd7beL); HOST_c2l(data,l); X(13)=l; - R0(A,B,C,D,X(12), 7,0x6b901122L); HOST_c2l(data,l); X(14)=l; - R0(D,A,B,C,X(13),12,0xfd987193L); HOST_c2l(data,l); X(15)=l; - R0(C,D,A,B,X(14),17,0xa679438eL); - R0(B,C,D,A,X(15),22,0x49b40821L); - /* Round 1 */ - R1(A,B,C,D,X( 1), 5,0xf61e2562L); - R1(D,A,B,C,X( 6), 9,0xc040b340L); - R1(C,D,A,B,X(11),14,0x265e5a51L); - R1(B,C,D,A,X( 0),20,0xe9b6c7aaL); - R1(A,B,C,D,X( 5), 5,0xd62f105dL); - R1(D,A,B,C,X(10), 9,0x02441453L); - R1(C,D,A,B,X(15),14,0xd8a1e681L); - R1(B,C,D,A,X( 4),20,0xe7d3fbc8L); - R1(A,B,C,D,X( 9), 5,0x21e1cde6L); - R1(D,A,B,C,X(14), 9,0xc33707d6L); - R1(C,D,A,B,X( 3),14,0xf4d50d87L); - R1(B,C,D,A,X( 8),20,0x455a14edL); - R1(A,B,C,D,X(13), 5,0xa9e3e905L); - R1(D,A,B,C,X( 2), 9,0xfcefa3f8L); - R1(C,D,A,B,X( 7),14,0x676f02d9L); - R1(B,C,D,A,X(12),20,0x8d2a4c8aL); - /* Round 2 */ - R2(A,B,C,D,X( 5), 4,0xfffa3942L); - R2(D,A,B,C,X( 8),11,0x8771f681L); - R2(C,D,A,B,X(11),16,0x6d9d6122L); - R2(B,C,D,A,X(14),23,0xfde5380cL); - R2(A,B,C,D,X( 1), 4,0xa4beea44L); - R2(D,A,B,C,X( 4),11,0x4bdecfa9L); - R2(C,D,A,B,X( 7),16,0xf6bb4b60L); - R2(B,C,D,A,X(10),23,0xbebfbc70L); - R2(A,B,C,D,X(13), 4,0x289b7ec6L); - R2(D,A,B,C,X( 0),11,0xeaa127faL); - R2(C,D,A,B,X( 3),16,0xd4ef3085L); - R2(B,C,D,A,X( 6),23,0x04881d05L); - R2(A,B,C,D,X( 9), 4,0xd9d4d039L); - R2(D,A,B,C,X(12),11,0xe6db99e5L); - R2(C,D,A,B,X(15),16,0x1fa27cf8L); - R2(B,C,D,A,X( 2),23,0xc4ac5665L); - /* Round 3 */ - R3(A,B,C,D,X( 0), 6,0xf4292244L); - R3(D,A,B,C,X( 7),10,0x432aff97L); - R3(C,D,A,B,X(14),15,0xab9423a7L); - R3(B,C,D,A,X( 5),21,0xfc93a039L); - R3(A,B,C,D,X(12), 6,0x655b59c3L); - R3(D,A,B,C,X( 3),10,0x8f0ccc92L); - R3(C,D,A,B,X(10),15,0xffeff47dL); - R3(B,C,D,A,X( 1),21,0x85845dd1L); - R3(A,B,C,D,X( 8), 6,0x6fa87e4fL); - R3(D,A,B,C,X(15),10,0xfe2ce6e0L); - R3(C,D,A,B,X( 6),15,0xa3014314L); - R3(B,C,D,A,X(13),21,0x4e0811a1L); - R3(A,B,C,D,X( 4), 6,0xf7537e82L); - R3(D,A,B,C,X(11),10,0xbd3af235L); - R3(C,D,A,B,X( 2),15,0x2ad7d2bbL); - R3(B,C,D,A,X( 9),21,0xeb86d391L); + for (; num--; ) { + HOST_c2l(data, l); + X( 0) = l; + HOST_c2l(data, l); + X( 1) = l; + /* Round 0 */ + R0(A, B,C, D,X( 0), 7, 0xd76aa478L); + HOST_c2l(data, l); + X( 2) = l; + R0(D, A,B, C,X( 1), 12, 0xe8c7b756L); + HOST_c2l(data, l); + X( 3) = l; + R0(C, D,A, B,X( 2), 17, 0x242070dbL); + HOST_c2l(data, l); + X( 4) = l; + R0(B, C,D, A,X( 3), 22, 0xc1bdceeeL); + HOST_c2l(data, l); + X( 5) = l; + R0(A, B,C, D,X( 4), 7, 0xf57c0fafL); + HOST_c2l(data, l); + X( 6) = l; + R0(D, A,B, C,X( 5), 12, 0x4787c62aL); + HOST_c2l(data, l); + X( 7) = l; + R0(C, D,A, B,X( 6), 17, 0xa8304613L); + HOST_c2l(data, l); + X( 8) = l; + R0(B, C,D, A,X( 7), 22, 0xfd469501L); + HOST_c2l(data, l); + X( 9) = l; + R0(A, B,C, D,X( 8), 7, 0x698098d8L); + HOST_c2l(data, l); + X(10) = l; + R0(D, A,B, C,X( 9), 12, 0x8b44f7afL); + HOST_c2l(data, l); + X(11) = l; + R0(C, D,A, B,X(10), 17, 0xffff5bb1L); + HOST_c2l(data, l); + X(12) = l; + R0(B, C,D, A,X(11), 22, 0x895cd7beL); + HOST_c2l(data, l); + X(13) = l; + R0(A, B,C, D,X(12), 7, 0x6b901122L); + HOST_c2l(data, l); + X(14) = l; + R0(D, A,B, C,X(13), 12, 0xfd987193L); + HOST_c2l(data, l); + X(15) = l; + R0(C, D,A, B,X(14), 17, 0xa679438eL); + R0(B, C,D, A,X(15), 22, 0x49b40821L); + /* Round 1 */ + R1(A, B,C, D,X( 1), 5, 0xf61e2562L); + R1(D, A,B, C,X( 6), 9, 0xc040b340L); + R1(C, D,A, B,X(11), 14, 0x265e5a51L); + R1(B, C,D, A,X( 0), 20, 0xe9b6c7aaL); + R1(A, B,C, D,X( 5), 5, 0xd62f105dL); + R1(D, A,B, C,X(10), 9, 0x02441453L); + R1(C, D,A, B,X(15), 14, 0xd8a1e681L); + R1(B, C,D, A,X( 4), 20, 0xe7d3fbc8L); + R1(A, B,C, D,X( 9), 5, 0x21e1cde6L); + R1(D, A,B, C,X(14), 9, 0xc33707d6L); + R1(C, D,A, B,X( 3), 14, 0xf4d50d87L); + R1(B, C,D, A,X( 8), 20, 0x455a14edL); + R1(A, B,C, D,X(13), 5, 0xa9e3e905L); + R1(D, A,B, C,X( 2), 9, 0xfcefa3f8L); + R1(C, D,A, B,X( 7), 14, 0x676f02d9L); + R1(B, C,D, A,X(12), 20, 0x8d2a4c8aL); + /* Round 2 */ + R2(A, B,C, D,X( 5), 4, 0xfffa3942L); + R2(D, A,B, C,X( 8), 11, 0x8771f681L); + R2(C, D,A, B,X(11), 16, 0x6d9d6122L); + R2(B, C,D, A,X(14), 23, 0xfde5380cL); + R2(A, B,C, D,X( 1), 4, 0xa4beea44L); + R2(D, A,B, C,X( 4), 11, 0x4bdecfa9L); + R2(C, D,A, B,X( 7), 16, 0xf6bb4b60L); + R2(B, C,D, A,X(10), 23, 0xbebfbc70L); + R2(A, B,C, D,X(13), 4, 0x289b7ec6L); + R2(D, A,B, C,X( 0), 11, 0xeaa127faL); + R2(C, D,A, B,X( 3), 16, 0xd4ef3085L); + R2(B, C,D, A,X( 6), 23, 0x04881d05L); + R2(A, B,C, D,X( 9), 4, 0xd9d4d039L); + R2(D, A,B, C,X(12), 11, 0xe6db99e5L); + R2(C, D,A, B,X(15), 16, 0x1fa27cf8L); + R2(B, C,D, A,X( 2), 23, 0xc4ac5665L); + /* Round 3 */ + R3(A, B,C, D,X( 0), 6, 0xf4292244L); + R3(D, A,B, C,X( 7), 10, 0x432aff97L); + R3(C, D,A, B,X(14), 15, 0xab9423a7L); + R3(B, C,D, A,X( 5), 21, 0xfc93a039L); + R3(A, B,C, D,X(12), 6, 0x655b59c3L); + R3(D, A,B, C,X( 3), 10, 0x8f0ccc92L); + R3(C, D,A, B,X(10), 15, 0xffeff47dL); + R3(B, C,D, A,X( 1), 21, 0x85845dd1L); + R3(A, B,C, D,X( 8), 6, 0x6fa87e4fL); + R3(D, A,B, C,X(15), 10, 0xfe2ce6e0L); + R3(C, D,A, B,X( 6), 15, 0xa3014314L); + R3(B, C,D, A,X(13), 21, 0x4e0811a1L); + R3(A, B,C, D,X( 4), 6, 0xf7537e82L); + R3(D, A,B, C,X(11), 10, 0xbd3af235L); + R3(C, D,A, B,X( 2), 15, 0x2ad7d2bbL); + R3(B, C,D, A,X( 9), 21, 0xeb86d391L); - A = c->A += A; - B = c->B += B; - C = c->C += C; - D = c->D += D; - } + A = c->A += A; + B = c->B += B; + C = c->C += C; + D = c->D += D; } +} #endif diff --git a/lib/libcrypto/md5/md5_local.h b/lib/libcrypto/md5/md5_local.h deleted file mode 100644 index 6026733a7..000000000 --- a/lib/libcrypto/md5/md5_local.h +++ /dev/null @@ -1,132 +0,0 @@ -/* $OpenBSD: md5_local.h,v 1.1 2022/11/26 16:08:53 tb Exp $ */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include -#include - -#include - -#include - -#ifdef MD5_ASM -# if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__) || \ - defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64) -# define md5_block_data_order md5_block_asm_data_order -# elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64) -# define md5_block_data_order md5_block_asm_data_order -# endif -#endif - -__BEGIN_HIDDEN_DECLS - -void md5_block_data_order (MD5_CTX *c, const void *p,size_t num); - -__END_HIDDEN_DECLS - -#define DATA_ORDER_IS_LITTLE_ENDIAN - -#define HASH_LONG MD5_LONG -#define HASH_CTX MD5_CTX -#define HASH_CBLOCK MD5_CBLOCK -#define HASH_UPDATE MD5_Update -#define HASH_TRANSFORM MD5_Transform -#define HASH_FINAL MD5_Final -#define HASH_MAKE_STRING(c,s) do { \ - unsigned long ll; \ - ll=(c)->A; HOST_l2c(ll,(s)); \ - ll=(c)->B; HOST_l2c(ll,(s)); \ - ll=(c)->C; HOST_l2c(ll,(s)); \ - ll=(c)->D; HOST_l2c(ll,(s)); \ - } while (0) -#define HASH_BLOCK_DATA_ORDER md5_block_data_order - -#include "md32_common.h" - -/* -#define F(x,y,z) (((x) & (y)) | ((~(x)) & (z))) -#define G(x,y,z) (((x) & (z)) | ((y) & (~(z)))) -*/ - -/* As pointed out by Wei Dai , the above can be - * simplified to the code below. Wei attributes these optimizations - * to Peter Gutmann's SHS code, and he attributes it to Rich Schroeppel. - */ -#define F(b,c,d) ((((c) ^ (d)) & (b)) ^ (d)) -#define G(b,c,d) ((((b) ^ (c)) & (d)) ^ (c)) -#define H(b,c,d) ((b) ^ (c) ^ (d)) -#define I(b,c,d) (((~(d)) | (b)) ^ (c)) - -#define R0(a,b,c,d,k,s,t) { \ - a+=((k)+(t)+F((b),(c),(d))); \ - a=ROTATE(a,s); \ - a+=b; };\ - -#define R1(a,b,c,d,k,s,t) { \ - a+=((k)+(t)+G((b),(c),(d))); \ - a=ROTATE(a,s); \ - a+=b; }; - -#define R2(a,b,c,d,k,s,t) { \ - a+=((k)+(t)+H((b),(c),(d))); \ - a=ROTATE(a,s); \ - a+=b; }; - -#define R3(a,b,c,d,k,s,t) { \ - a+=((k)+(t)+I((b),(c),(d))); \ - a=ROTATE(a,s); \ - a+=b; }; diff --git a/lib/libcrypto/md5/md5_one.c b/lib/libcrypto/md5/md5_one.c index 3fb05de30..3d5fba572 100644 --- a/lib/libcrypto/md5/md5_one.c +++ b/lib/libcrypto/md5/md5_one.c @@ -1,25 +1,25 @@ -/* $OpenBSD: md5_one.c,v 1.10 2015/09/10 15:56:25 jsing Exp $ */ +/* $OpenBSD: md5_one.c,v 1.12 2023/07/08 10:45:57 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -61,17 +61,19 @@ #include #include -unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md) - { +unsigned char * +MD5(const unsigned char *d, size_t n, unsigned char *md) +{ MD5_CTX c; static unsigned char m[MD5_DIGEST_LENGTH]; - if (md == NULL) md=m; + if (md == NULL) + md = m; if (!MD5_Init(&c)) return NULL; - MD5_Update(&c,d,n); - MD5_Final(md,&c); - explicit_bzero(&c,sizeof(c)); - return(md); - } - + MD5_Update(&c, d, n); + MD5_Final(md, &c); + explicit_bzero(&c, sizeof(c)); + return (md); +} +LCRYPTO_ALIAS(MD5); diff --git a/lib/libcrypto/mem_dbg.c b/lib/libcrypto/mem_dbg.c index 602b139d1..e2eacebe1 100644 --- a/lib/libcrypto/mem_dbg.c +++ b/lib/libcrypto/mem_dbg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem_dbg.c,v 1.24 2019/01/29 14:40:54 deraadt Exp $ */ +/* $OpenBSD: mem_dbg.c,v 1.25 2023/07/08 08:28:23 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -133,30 +133,35 @@ CRYPTO_dbg_set_options(long bits) { return; } +LCRYPTO_ALIAS(CRYPTO_dbg_set_options); long CRYPTO_dbg_get_options(void) { return (0); } +LCRYPTO_ALIAS(CRYPTO_dbg_get_options); int CRYPTO_push_info_(const char *info, const char *file, int line) { return (0); } +LCRYPTO_ALIAS(CRYPTO_push_info_); int CRYPTO_pop_info(void) { return (0); } +LCRYPTO_ALIAS(CRYPTO_pop_info); int CRYPTO_remove_all_info(void) { return (0); } +LCRYPTO_ALIAS(CRYPTO_remove_all_info); void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line, @@ -164,12 +169,14 @@ CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line, { OPENSSL_assert("CRYPTO_dbg_malloc is no longer permitted"); } +LCRYPTO_ALIAS(CRYPTO_dbg_malloc); void CRYPTO_dbg_free(void *addr, int before_p) { OPENSSL_assert("CRYPTO_dbg_free is no longer permitted"); } +LCRYPTO_ALIAS(CRYPTO_dbg_free); void CRYPTO_dbg_realloc(void *addr1, void *addr2, int num, @@ -177,18 +184,21 @@ CRYPTO_dbg_realloc(void *addr1, void *addr2, int num, { OPENSSL_assert("CRYPTO_dbg_realloc is no longer permitted"); } +LCRYPTO_ALIAS(CRYPTO_dbg_realloc); int CRYPTO_mem_leaks(BIO *b) { return -1; } +LCRYPTO_ALIAS(CRYPTO_mem_leaks); int CRYPTO_mem_leaks_fp(FILE *fp) { return -1; } +LCRYPTO_ALIAS(CRYPTO_mem_leaks_fp); int @@ -196,3 +206,4 @@ CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb) { return -1; } +LCRYPTO_ALIAS(CRYPTO_mem_leaks_cb); diff --git a/lib/libcrypto/modes/cbc128.c b/lib/libcrypto/modes/cbc128.c index f2eebc6e7..f8ebf79a8 100644 --- a/lib/libcrypto/modes/cbc128.c +++ b/lib/libcrypto/modes/cbc128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cbc128.c,v 1.6 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: cbc128.c,v 1.8 2023/07/08 14:56:54 beck Exp $ */ /* ==================================================================== * Copyright (c) 2008 The OpenSSL Project. All rights reserved. * @@ -7,7 +7,7 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in @@ -66,117 +66,128 @@ #define STRICT_ALIGNMENT 0 #endif -void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], block128_f block) +void +CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], block128_f block) { size_t n; const unsigned char *iv = ivec; #if !defined(OPENSSL_SMALL_FOOTPRINT) if (STRICT_ALIGNMENT && - ((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) != 0) { - while (len>=16) { - for(n=0; n<16; ++n) + ((size_t)in|(size_t)out|(size_t)ivec) % sizeof(size_t) != 0) { + while (len >= 16) { + for (n = 0; n < 16; ++n) out[n] = in[n] ^ iv[n]; (*block)(out, out, key); iv = out; len -= 16; - in += 16; + in += 16; out += 16; } } else { - while (len>=16) { - for(n=0; n<16; n+=sizeof(size_t)) - *(size_t*)(out+n) = - *(size_t*)(in+n) ^ *(size_t*)(iv+n); + while (len >= 16) { + for (n = 0; n < 16; n += sizeof(size_t)) + *(size_t *)(out + n) = + *(size_t *)(in + n) ^ *(size_t *)(iv + n); (*block)(out, out, key); iv = out; len -= 16; - in += 16; + in += 16; out += 16; } } #endif while (len) { - for(n=0; n<16 && n=16) { + ((size_t)in|(size_t)out|(size_t)ivec) % sizeof(size_t) != + 0) { + while (len >= 16) { (*block)(in, out, key); - for(n=0; n<16; ++n) + for (n = 0; n < 16; ++n) out[n] ^= iv[n]; iv = in; len -= 16; - in += 16; + in += 16; out += 16; } - } else if (16%sizeof(size_t) == 0) { /* always true */ - while (len>=16) { - size_t *out_t=(size_t *)out, *iv_t=(size_t *)iv; + } else if (16 % sizeof(size_t) == 0) { /* always true */ + while (len >= 16) { + size_t *out_t = (size_t *)out, + *iv_t = (size_t *)iv; (*block)(in, out, key); - for(n=0; n<16/sizeof(size_t); n++) + for (n = 0; n < 16/sizeof(size_t); n++) out_t[n] ^= iv_t[n]; iv = in; len -= 16; - in += 16; + in += 16; out += 16; } } - memmove(ivec,iv,16); + memmove(ivec, iv, 16); } else { if (STRICT_ALIGNMENT && - ((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) != 0) { + ((size_t)in|(size_t)out|(size_t)ivec) % sizeof(size_t) != + 0) { unsigned char c; - while (len>=16) { + while (len >= 16) { (*block)(in, tmp.c, key); - for(n=0; n<16; ++n) { + for (n = 0; n < 16; ++n) { c = in[n]; out[n] = tmp.c[n] ^ ivec[n]; ivec[n] = c; } len -= 16; - in += 16; + in += 16; out += 16; } - } else if (16%sizeof(size_t) == 0) { /* always true */ - while (len>=16) { - size_t c, *out_t=(size_t *)out, *ivec_t=(size_t *)ivec; - const size_t *in_t=(const size_t *)in; + } else if (16 % sizeof(size_t) == 0) { /* always true */ + while (len >= 16) { + size_t c, *out_t = (size_t *)out, + *ivec_t = (size_t *)ivec; + const size_t *in_t = (const size_t *)in; (*block)(in, tmp.c, key); - for(n=0; n<16/sizeof(size_t); n++) { + for (n = 0; n < 16/sizeof(size_t); n++) { c = in_t[n]; out_t[n] = tmp.t[n] ^ ivec_t[n]; ivec_t[n] = c; } len -= 16; - in += 16; + in += 16; out += 16; } } @@ -185,18 +196,19 @@ void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, while (len) { unsigned char c; (*block)(in, tmp.c, key); - for(n=0; n<16 && nnonce.c,0,sizeof(ctx->nonce.c)); - ctx->nonce.c[0] = ((u8)(L-1)&7) | (u8)(((M-2)/2)&7)<<3; + memset(ctx->nonce.c, 0, sizeof(ctx->nonce.c)); + ctx->nonce.c[0] = ((u8)(L - 1) & 7) | (u8)(((M - 2)/2) & 7) << 3; ctx->blocks = 0; ctx->block = block; ctx->key = key; } +LCRYPTO_ALIAS(CRYPTO_ccm128_init); /* !!! Following interfaces are to be called *once* per packet !!! */ /* Then you setup per-message nonce and pass the length of the message */ -int CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx, - const unsigned char *nonce,size_t nlen,size_t mlen) +int +CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx, + const unsigned char *nonce, size_t nlen, size_t mlen) { - unsigned int L = ctx->nonce.c[0]&7; /* the L parameter */ + unsigned int L = ctx->nonce.c[0] & 7; /* the L parameter */ - if (nlen<(14-L)) return -1; /* nonce is too short */ + if (nlen < (14 - L)) + return -1; /* nonce is too short */ - if (sizeof(mlen)==8 && L>=3) { - ctx->nonce.c[8] = (u8)(mlen>>(56%(sizeof(mlen)*8))); - ctx->nonce.c[9] = (u8)(mlen>>(48%(sizeof(mlen)*8))); - ctx->nonce.c[10] = (u8)(mlen>>(40%(sizeof(mlen)*8))); - ctx->nonce.c[11] = (u8)(mlen>>(32%(sizeof(mlen)*8))); - } - else + if (sizeof(mlen) == 8 && L >= 3) { + ctx->nonce.c[8] = (u8)(mlen >> (56 % (sizeof(mlen)*8))); + ctx->nonce.c[9] = (u8)(mlen >> (48 % (sizeof(mlen)*8))); + ctx->nonce.c[10] = (u8)(mlen >> (40 % (sizeof(mlen)*8))); + ctx->nonce.c[11] = (u8)(mlen >> (32 % (sizeof(mlen)*8))); + } else ctx->nonce.u[1] = 0; - ctx->nonce.c[12] = (u8)(mlen>>24); - ctx->nonce.c[13] = (u8)(mlen>>16); - ctx->nonce.c[14] = (u8)(mlen>>8); + ctx->nonce.c[12] = (u8)(mlen >> 24); + ctx->nonce.c[13] = (u8)(mlen >> 16); + ctx->nonce.c[14] = (u8)(mlen >> 8); ctx->nonce.c[15] = (u8)mlen; ctx->nonce.c[0] &= ~0x40; /* clear Adata flag */ - memcpy(&ctx->nonce.c[1],nonce,14-L); + memcpy(&ctx->nonce.c[1], nonce, 14 - L); return 0; } +LCRYPTO_ALIAS(CRYPTO_ccm128_setiv); /* Then you pass additional authentication data, this is optional */ -void CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx, - const unsigned char *aad,size_t alen) -{ unsigned int i; +void +CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx, + const unsigned char *aad, size_t alen) +{ + unsigned int i; block128_f block = ctx->block; - if (alen==0) return; + if (alen == 0) + return; ctx->nonce.c[0] |= 0x40; /* set Adata flag */ - (*block)(ctx->nonce.c,ctx->cmac.c,ctx->key), - ctx->blocks++; + (*block)(ctx->nonce.c, ctx->cmac.c, ctx->key), + ctx->blocks++; - if (alen<(0x10000-0x100)) { - ctx->cmac.c[0] ^= (u8)(alen>>8); + if (alen < (0x10000 - 0x100)) { + ctx->cmac.c[0] ^= (u8)(alen >> 8); ctx->cmac.c[1] ^= (u8)alen; - i=2; - } - else if (sizeof(alen)==8 && alen>=(size_t)1<<(32%(sizeof(alen)*8))) { + i = 2; + } else if (sizeof(alen) == 8 && + alen >= (size_t)1 << (32 % (sizeof(alen)*8))) { ctx->cmac.c[0] ^= 0xFF; ctx->cmac.c[1] ^= 0xFF; - ctx->cmac.c[2] ^= (u8)(alen>>(56%(sizeof(alen)*8))); - ctx->cmac.c[3] ^= (u8)(alen>>(48%(sizeof(alen)*8))); - ctx->cmac.c[4] ^= (u8)(alen>>(40%(sizeof(alen)*8))); - ctx->cmac.c[5] ^= (u8)(alen>>(32%(sizeof(alen)*8))); - ctx->cmac.c[6] ^= (u8)(alen>>24); - ctx->cmac.c[7] ^= (u8)(alen>>16); - ctx->cmac.c[8] ^= (u8)(alen>>8); + ctx->cmac.c[2] ^= (u8)(alen >> (56 % (sizeof(alen)*8))); + ctx->cmac.c[3] ^= (u8)(alen >> (48 % (sizeof(alen)*8))); + ctx->cmac.c[4] ^= (u8)(alen >> (40 % (sizeof(alen)*8))); + ctx->cmac.c[5] ^= (u8)(alen >> (32 % (sizeof(alen)*8))); + ctx->cmac.c[6] ^= (u8)(alen >> 24); + ctx->cmac.c[7] ^= (u8)(alen >> 16); + ctx->cmac.c[8] ^= (u8)(alen >> 8); ctx->cmac.c[9] ^= (u8)alen; - i=10; - } - else { + i = 10; + } else { ctx->cmac.c[0] ^= 0xFF; ctx->cmac.c[1] ^= 0xFE; - ctx->cmac.c[2] ^= (u8)(alen>>24); - ctx->cmac.c[3] ^= (u8)(alen>>16); - ctx->cmac.c[4] ^= (u8)(alen>>8); + ctx->cmac.c[2] ^= (u8)(alen >> 24); + ctx->cmac.c[3] ^= (u8)(alen >> 16); + ctx->cmac.c[4] ^= (u8)(alen >> 8); ctx->cmac.c[5] ^= (u8)alen; - i=6; + i = 6; } do { - for(;i<16 && alen;++i,++aad,--alen) + for (; i < 16 && alen; ++i, ++aad, --alen) ctx->cmac.c[i] ^= *aad; - (*block)(ctx->cmac.c,ctx->cmac.c,ctx->key), - ctx->blocks++; - i=0; + (*block)(ctx->cmac.c, ctx->cmac.c, ctx->key), + ctx->blocks++; + i = 0; } while (alen); } +LCRYPTO_ALIAS(CRYPTO_ccm128_aad); /* Finally you encrypt or decrypt the message */ /* counter part of nonce may not be larger than L*8 bits, * L is not larger than 8, therefore 64-bit counter... */ -static void ctr64_inc(unsigned char *counter) { - unsigned int n=8; - u8 c; +static void +ctr64_inc(unsigned char *counter) +{ + unsigned int n = 8; + u8 c; counter += 8; do { @@ -163,60 +172,70 @@ static void ctr64_inc(unsigned char *counter) { c = counter[n]; ++c; counter[n] = c; - if (c) return; + if (c) + return; } while (n); } -int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, - const unsigned char *inp, unsigned char *out, - size_t len) +int +CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, + const unsigned char *inp, unsigned char *out, + size_t len) { - size_t n; - unsigned int i,L; - unsigned char flags0 = ctx->nonce.c[0]; - block128_f block = ctx->block; - void * key = ctx->key; - union { u64 u[2]; u8 c[16]; } scratch; + size_t n; + unsigned int i, L; + unsigned char flags0 = ctx->nonce.c[0]; + block128_f block = ctx->block; + void *key = ctx->key; + union { + u64 u[2]; + u8 c[16]; + } scratch; - if (!(flags0&0x40)) - (*block)(ctx->nonce.c,ctx->cmac.c,key), - ctx->blocks++; + if (!(flags0 & 0x40)) + (*block)(ctx->nonce.c, ctx->cmac.c, key), + ctx->blocks++; - ctx->nonce.c[0] = L = flags0&7; - for (n=0,i=15-L;i<15;++i) { + ctx->nonce.c[0] = L = flags0 & 7; + for (n = 0, i = 15 - L; i < 15; ++i) { n |= ctx->nonce.c[i]; - ctx->nonce.c[i]=0; + ctx->nonce.c[i] = 0; n <<= 8; } n |= ctx->nonce.c[15]; /* reconstructed length */ - ctx->nonce.c[15]=1; + ctx->nonce.c[15] = 1; - if (n!=len) return -1; /* length mismatch */ + if (n != len) + return -1; /* length mismatch */ - ctx->blocks += ((len+15)>>3)|1; - if (ctx->blocks > (U64(1)<<61)) return -2; /* too much data */ + ctx->blocks += ((len + 15) >> 3)|1; + if (ctx->blocks > (U64(1) << 61)) + return -2; /* too much data */ - while (len>=16) { + while (len >= 16) { #ifdef __STRICT_ALIGNMENT - union { u64 u[2]; u8 c[16]; } temp; + union { + u64 u[2]; + u8 c[16]; + } temp; - memcpy (temp.c,inp,16); + memcpy(temp.c, inp, 16); ctx->cmac.u[0] ^= temp.u[0]; ctx->cmac.u[1] ^= temp.u[1]; #else - ctx->cmac.u[0] ^= ((u64*)inp)[0]; - ctx->cmac.u[1] ^= ((u64*)inp)[1]; + ctx->cmac.u[0] ^= ((u64 *)inp)[0]; + ctx->cmac.u[1] ^= ((u64 *)inp)[1]; #endif - (*block)(ctx->cmac.c,ctx->cmac.c,key); - (*block)(ctx->nonce.c,scratch.c,key); + (*block)(ctx->cmac.c, ctx->cmac.c, key); + (*block)(ctx->nonce.c, scratch.c, key); ctr64_inc(ctx->nonce.c); #ifdef __STRICT_ALIGNMENT temp.u[0] ^= scratch.u[0]; temp.u[1] ^= scratch.u[1]; - memcpy(out,temp.c,16); + memcpy(out, temp.c, 16); #else - ((u64*)out)[0] = scratch.u[0]^((u64*)inp)[0]; - ((u64*)out)[1] = scratch.u[1]^((u64*)inp)[1]; + ((u64 *)out)[0] = scratch.u[0] ^ ((u64 *)inp)[0]; + ((u64 *)out)[1] = scratch.u[1] ^ ((u64 *)inp)[1]; #endif inp += 16; out += 16; @@ -224,16 +243,18 @@ int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, } if (len) { - for (i=0; icmac.c[i] ^= inp[i]; - (*block)(ctx->cmac.c,ctx->cmac.c,key); - (*block)(ctx->nonce.c,scratch.c,key); - for (i=0; icmac.c[i] ^= inp[i]; + (*block)(ctx->cmac.c, ctx->cmac.c, key); + (*block)(ctx->nonce.c, scratch.c, key); + for (i = 0; i < len; ++i) + out[i] = scratch.c[i] ^ inp[i]; } - for (i=15-L;i<16;++i) - ctx->nonce.c[i]=0; + for (i = 15 - L; i < 16; ++i) + ctx->nonce.c[i] = 0; - (*block)(ctx->nonce.c,scratch.c,key); + (*block)(ctx->nonce.c, scratch.c, key); ctx->cmac.u[0] ^= scratch.u[0]; ctx->cmac.u[1] ^= scratch.u[1]; @@ -241,48 +262,59 @@ int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, return 0; } +LCRYPTO_ALIAS(CRYPTO_ccm128_encrypt); -int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, - const unsigned char *inp, unsigned char *out, - size_t len) +int +CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, + const unsigned char *inp, unsigned char *out, + size_t len) { - size_t n; - unsigned int i,L; - unsigned char flags0 = ctx->nonce.c[0]; - block128_f block = ctx->block; - void * key = ctx->key; - union { u64 u[2]; u8 c[16]; } scratch; + size_t n; + unsigned int i, L; + unsigned char flags0 = ctx->nonce.c[0]; + block128_f block = ctx->block; + void *key = ctx->key; + union { + u64 u[2]; + u8 c[16]; + } scratch; - if (!(flags0&0x40)) - (*block)(ctx->nonce.c,ctx->cmac.c,key); + if (!(flags0 & 0x40)) + (*block)(ctx->nonce.c, ctx->cmac.c, key); - ctx->nonce.c[0] = L = flags0&7; - for (n=0,i=15-L;i<15;++i) { + ctx->nonce.c[0] = L = flags0 & 7; + for (n = 0, i = 15 - L; i < 15; ++i) { n |= ctx->nonce.c[i]; - ctx->nonce.c[i]=0; + ctx->nonce.c[i] = 0; n <<= 8; } n |= ctx->nonce.c[15]; /* reconstructed length */ - ctx->nonce.c[15]=1; + ctx->nonce.c[15] = 1; - if (n!=len) return -1; + if (n != len) + return -1; - while (len>=16) { + while (len >= 16) { #ifdef __STRICT_ALIGNMENT - union { u64 u[2]; u8 c[16]; } temp; + union { + u64 u[2]; + u8 c[16]; + } temp; #endif - (*block)(ctx->nonce.c,scratch.c,key); + (*block)(ctx->nonce.c, scratch.c, key); ctr64_inc(ctx->nonce.c); #ifdef __STRICT_ALIGNMENT - memcpy (temp.c,inp,16); + memcpy(temp.c, inp, 16); ctx->cmac.u[0] ^= (scratch.u[0] ^= temp.u[0]); ctx->cmac.u[1] ^= (scratch.u[1] ^= temp.u[1]); - memcpy (out,scratch.c,16); + memcpy(out, scratch.c, 16); #else - ctx->cmac.u[0] ^= (((u64*)out)[0] = scratch.u[0]^((u64*)inp)[0]); - ctx->cmac.u[1] ^= (((u64*)out)[1] = scratch.u[1]^((u64*)inp)[1]); + ctx->cmac.u[0] ^= (((u64 *)out)[0] = scratch.u[0] ^ + ((u64 *)inp)[0]); + ctx->cmac.u[1] ^= (((u64 *)out)[1] = scratch.u[1] ^ + ((u64 *)inp)[1]); #endif - (*block)(ctx->cmac.c,ctx->cmac.c,key); + (*block)(ctx->cmac.c, ctx->cmac.c, key); inp += 16; out += 16; @@ -290,16 +322,16 @@ int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, } if (len) { - (*block)(ctx->nonce.c,scratch.c,key); - for (i=0; icmac.c[i] ^= (out[i] = scratch.c[i]^inp[i]); - (*block)(ctx->cmac.c,ctx->cmac.c,key); + (*block)(ctx->nonce.c, scratch.c, key); + for (i = 0; i < len; ++i) + ctx->cmac.c[i] ^= (out[i] = scratch.c[i] ^ inp[i]); + (*block)(ctx->cmac.c, ctx->cmac.c, key); } - for (i=15-L;i<16;++i) - ctx->nonce.c[i]=0; + for (i = 15 - L; i < 16; ++i) + ctx->nonce.c[i] = 0; - (*block)(ctx->nonce.c,scratch.c,key); + (*block)(ctx->nonce.c, scratch.c, key); ctx->cmac.u[0] ^= scratch.u[0]; ctx->cmac.u[1] ^= scratch.u[1]; @@ -307,69 +339,81 @@ int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, return 0; } +LCRYPTO_ALIAS(CRYPTO_ccm128_decrypt); -static void ctr64_add (unsigned char *counter,size_t inc) -{ size_t n=8, val=0; +static void +ctr64_add(unsigned char *counter, size_t inc) +{ + size_t n = 8, val = 0; counter += 8; do { --n; - val += counter[n] + (inc&0xff); + val += counter[n] + (inc & 0xff); counter[n] = (unsigned char)val; val >>= 8; /* carry bit */ inc >>= 8; - } while(n && (inc || val)); + } while (n && (inc || val)); } -int CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx, - const unsigned char *inp, unsigned char *out, - size_t len,ccm128_f stream) +int +CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx, + const unsigned char *inp, unsigned char *out, + size_t len, ccm128_f stream) { - size_t n; - unsigned int i,L; - unsigned char flags0 = ctx->nonce.c[0]; - block128_f block = ctx->block; - void * key = ctx->key; - union { u64 u[2]; u8 c[16]; } scratch; + size_t n; + unsigned int i, L; + unsigned char flags0 = ctx->nonce.c[0]; + block128_f block = ctx->block; + void *key = ctx->key; + union { + u64 u[2]; + u8 c[16]; + } scratch; - if (!(flags0&0x40)) - (*block)(ctx->nonce.c,ctx->cmac.c,key), - ctx->blocks++; + if (!(flags0 & 0x40)) + (*block)(ctx->nonce.c, ctx->cmac.c, key), + ctx->blocks++; - ctx->nonce.c[0] = L = flags0&7; - for (n=0,i=15-L;i<15;++i) { + ctx->nonce.c[0] = L = flags0 & 7; + for (n = 0, i = 15 - L; i < 15; ++i) { n |= ctx->nonce.c[i]; - ctx->nonce.c[i]=0; + ctx->nonce.c[i] = 0; n <<= 8; } n |= ctx->nonce.c[15]; /* reconstructed length */ - ctx->nonce.c[15]=1; + ctx->nonce.c[15] = 1; - if (n!=len) return -1; /* length mismatch */ + if (n != len) + return -1; /* length mismatch */ - ctx->blocks += ((len+15)>>3)|1; - if (ctx->blocks > (U64(1)<<61)) return -2; /* too much data */ + ctx->blocks += ((len + 15) >> 3)|1; + if (ctx->blocks > (U64(1) << 61)) + return -2; /* too much data */ - if ((n=len/16)) { - (*stream)(inp,out,n,key,ctx->nonce.c,ctx->cmac.c); - n *= 16; + if ((n = len/16)) { + (*stream)(inp, out, n, key, ctx->nonce.c, ctx->cmac.c); + n *= 16; inp += n; out += n; len -= n; - if (len) ctr64_add(ctx->nonce.c,n/16); + if (len) + ctr64_add(ctx->nonce.c, n/16); } if (len) { - for (i=0; icmac.c[i] ^= inp[i]; - (*block)(ctx->cmac.c,ctx->cmac.c,key); - (*block)(ctx->nonce.c,scratch.c,key); - for (i=0; icmac.c[i] ^= inp[i]; + (*block)(ctx->cmac.c, ctx->cmac.c, key); + (*block)(ctx->nonce.c, scratch.c, key); + for (i = 0; i < len; ++i) + out[i] = scratch.c[i] ^ inp[i]; } - for (i=15-L;i<16;++i) - ctx->nonce.c[i]=0; + for (i = 15 - L; i < 16; ++i) + ctx->nonce.c[i] = 0; - (*block)(ctx->nonce.c,scratch.c,key); + (*block)(ctx->nonce.c, scratch.c, key); ctx->cmac.u[0] ^= scratch.u[0]; ctx->cmac.u[1] ^= scratch.u[1]; @@ -377,52 +421,59 @@ int CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx, return 0; } +LCRYPTO_ALIAS(CRYPTO_ccm128_encrypt_ccm64); -int CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx, - const unsigned char *inp, unsigned char *out, - size_t len,ccm128_f stream) +int +CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx, + const unsigned char *inp, unsigned char *out, + size_t len, ccm128_f stream) { - size_t n; - unsigned int i,L; - unsigned char flags0 = ctx->nonce.c[0]; - block128_f block = ctx->block; - void * key = ctx->key; - union { u64 u[2]; u8 c[16]; } scratch; + size_t n; + unsigned int i, L; + unsigned char flags0 = ctx->nonce.c[0]; + block128_f block = ctx->block; + void *key = ctx->key; + union { + u64 u[2]; + u8 c[16]; + } scratch; - if (!(flags0&0x40)) - (*block)(ctx->nonce.c,ctx->cmac.c,key); + if (!(flags0 & 0x40)) + (*block)(ctx->nonce.c, ctx->cmac.c, key); - ctx->nonce.c[0] = L = flags0&7; - for (n=0,i=15-L;i<15;++i) { + ctx->nonce.c[0] = L = flags0 & 7; + for (n = 0, i = 15 - L; i < 15; ++i) { n |= ctx->nonce.c[i]; - ctx->nonce.c[i]=0; + ctx->nonce.c[i] = 0; n <<= 8; } n |= ctx->nonce.c[15]; /* reconstructed length */ - ctx->nonce.c[15]=1; + ctx->nonce.c[15] = 1; - if (n!=len) return -1; + if (n != len) + return -1; - if ((n=len/16)) { - (*stream)(inp,out,n,key,ctx->nonce.c,ctx->cmac.c); - n *= 16; + if ((n = len/16)) { + (*stream)(inp, out, n, key, ctx->nonce.c, ctx->cmac.c); + n *= 16; inp += n; out += n; len -= n; - if (len) ctr64_add(ctx->nonce.c,n/16); + if (len) + ctr64_add(ctx->nonce.c, n/16); } if (len) { - (*block)(ctx->nonce.c,scratch.c,key); - for (i=0; icmac.c[i] ^= (out[i] = scratch.c[i]^inp[i]); - (*block)(ctx->cmac.c,ctx->cmac.c,key); + (*block)(ctx->nonce.c, scratch.c, key); + for (i = 0; i < len; ++i) + ctx->cmac.c[i] ^= (out[i] = scratch.c[i] ^ inp[i]); + (*block)(ctx->cmac.c, ctx->cmac.c, key); } - for (i=15-L;i<16;++i) - ctx->nonce.c[i]=0; + for (i = 15 - L; i < 16; ++i) + ctx->nonce.c[i] = 0; - (*block)(ctx->nonce.c,scratch.c,key); + (*block)(ctx->nonce.c, scratch.c, key); ctx->cmac.u[0] ^= scratch.u[0]; ctx->cmac.u[1] ^= scratch.u[1]; @@ -430,12 +481,18 @@ int CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx, return 0; } +LCRYPTO_ALIAS(CRYPTO_ccm128_decrypt_ccm64); -size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx,unsigned char *tag,size_t len) -{ unsigned int M = (ctx->nonce.c[0]>>3)&7; /* the M parameter */ +size_t +CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len) +{ + unsigned int M = (ctx->nonce.c[0] >> 3) & 7; /* the M parameter */ - M *= 2; M += 2; - if (len != M) return 0; - memcpy(tag,ctx->cmac.c,M); + M *= 2; + M += 2; + if (len != M) + return 0; + memcpy(tag, ctx->cmac.c, M); return M; } +LCRYPTO_ALIAS(CRYPTO_ccm128_tag); diff --git a/lib/libcrypto/modes/cfb128.c b/lib/libcrypto/modes/cfb128.c index 8555ce055..931353a62 100644 --- a/lib/libcrypto/modes/cfb128.c +++ b/lib/libcrypto/modes/cfb128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cfb128.c,v 1.5 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: cfb128.c,v 1.7 2023/07/08 14:56:54 beck Exp $ */ /* ==================================================================== * Copyright (c) 2008 The OpenSSL Project. All rights reserved. * @@ -7,7 +7,7 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in @@ -63,172 +63,189 @@ * used. The extra state information to record how much of the * 128bit block we have used is contained in *num; */ -void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], int *num, - int enc, block128_f block) +void +CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], int *num, + int enc, block128_f block) { - unsigned int n; - size_t l = 0; + unsigned int n; + size_t l = 0; - n = *num; + n = *num; - if (enc) { + if (enc) { #if !defined(OPENSSL_SMALL_FOOTPRINT) - if (16%sizeof(size_t) == 0) do { /* always true actually */ - while (n && len) { - *(out++) = ivec[n] ^= *(in++); - --len; - n = (n+1) % 16; - } + if (16 % sizeof(size_t) == 0) + do { /* always true actually */ + while (n && len) { + *(out++) = ivec[n] ^= *(in++); + --len; + n = (n + 1) % 16; + } #ifdef __STRICT_ALIGNMENT - if (((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) != 0) - break; + if (((size_t)in|(size_t)out|(size_t)ivec) % + sizeof(size_t) != 0) + break; #endif - while (len>=16) { - (*block)(ivec, ivec, key); - for (; n<16; n+=sizeof(size_t)) { - *(size_t*)(out+n) = - *(size_t*)(ivec+n) ^= *(size_t*)(in+n); - } - len -= 16; - out += 16; - in += 16; - n = 0; - } - if (len) { - (*block)(ivec, ivec, key); - while (len--) { - out[n] = ivec[n] ^= in[n]; - ++n; - } - } - *num = n; - return; - } while (0); + while (len >= 16) { + (*block)(ivec, ivec, key); + for (; n < 16; n += sizeof(size_t)) { + *(size_t *)(out + n) = + *(size_t *)(ivec + n) ^= *(size_t *)(in + + n); + } + len -= 16; + out += 16; + in += 16; + n = 0; + } + if (len) { + (*block)(ivec, ivec, key); + while (len--) { + out[n] = ivec[n] ^= in[n]; + ++n; + } + } + *num = n; + return; + } while (0); /* the rest would be commonly eliminated by x86* compiler */ #endif - while (l= 16) { + (*block)(ivec, ivec, key); + for (; n < 16; n += sizeof(size_t)) { + size_t t = *(size_t *)(in + n); + *(size_t *)(out + n) = *(size_t *)(ivec + + n) ^ t; + *(size_t *)(ivec + n) = t; + } + len -= 16; + out += 16; + in += 16; + n = 0; + } + if (len) { + (*block)(ivec, ivec, key); + while (len--) { + unsigned char c; + out[n] = ivec[n] ^ (c = in[n]); + ivec[n] = c; + ++n; + } + } + *num = n; + return; + } while (0); + /* the rest would be commonly eliminated by x86* compiler */ +#endif + while (l < len) { unsigned char c; - *(out++) = ivec[n] ^ (c = *(in++)); ivec[n] = c; - --len; - n = (n+1) % 16; - } -#ifdef __STRICT_ALIGNMENT - if (((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) != 0) - break; -#endif - while (len>=16) { - (*block)(ivec, ivec, key); - for (; n<16; n+=sizeof(size_t)) { - size_t t = *(size_t*)(in+n); - *(size_t*)(out+n) = *(size_t*)(ivec+n) ^ t; - *(size_t*)(ivec+n) = t; + if (n == 0) { + (*block)(ivec, ivec, key); } - len -= 16; - out += 16; - in += 16; - n = 0; + out[l] = ivec[n] ^ (c = in[l]); + ivec[n] = c; + ++l; + n = (n + 1) % 16; } - if (len) { - (*block)(ivec, ivec, key); - while (len--) { - unsigned char c; - out[n] = ivec[n] ^ (c = in[n]); ivec[n] = c; - ++n; - } - } *num = n; - return; - } while (0); - /* the rest would be commonly eliminated by x86* compiler */ -#endif - while (l128) return; + if (nbits <= 0 || nbits > 128) + return; /* fill in the first half of the new IV with the current IV */ - memcpy(ovec,ivec,16); + memcpy(ovec, ivec, 16); /* construct the new IV */ - (*block)(ivec,ivec,key); - num = (nbits+7)/8; + (*block)(ivec, ivec, key); + num = (nbits + 7)/8; if (enc) /* encrypt the input */ - for(n=0 ; n < num ; ++n) - out[n] = (ovec[16+n] = in[n] ^ ivec[n]); + for (n = 0; n < num; ++n) + out[n] = (ovec[16 + n] = in[n] ^ ivec[n]); else /* decrypt the input */ - for(n=0 ; n < num ; ++n) - out[n] = (ovec[16+n] = in[n]) ^ ivec[n]; + for (n = 0; n < num; ++n) + out[n] = (ovec[16 + n] = in[n]) ^ ivec[n]; /* shift ovec left... */ - rem = nbits%8; + rem = nbits % 8; num = nbits/8; - if(rem==0) - memcpy(ivec,ovec+num,16); + if (rem == 0) + memcpy(ivec, ovec + num, 16); else - for(n=0 ; n < 16 ; ++n) - ivec[n] = ovec[n+num]<>(8-rem); + for (n = 0; n < 16; ++n) + ivec[n] = ovec[n + num] << rem | + ovec[n + num + 1] >> (8 - rem); /* it is not necessary to cleanse ovec, since the IV is not secret */ } /* N.B. This expects the input to be packed, MS bit first */ -void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out, - size_t bits, const void *key, - unsigned char ivec[16], int *num, - int enc, block128_f block) +void +CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out, + size_t bits, const void *key, + unsigned char ivec[16], int *num, + int enc, block128_f block) { - size_t n; - unsigned char c[1],d[1]; + size_t n; + unsigned char c[1], d[1]; - for(n=0 ; n> (unsigned int)(n%8)); + c[0] = (in[n/8] & (1 << (7 - n % 8))) ? 0x80 : 0; + cfbr_encrypt_block(c, d, 1, key, ivec, enc, block); + out[n/8] = (out[n/8] & ~(1 << (unsigned int)(7 - n % 8))) | + ((d[0] & 0x80) >> (unsigned int)(n % 8)); } } +LCRYPTO_ALIAS(CRYPTO_cfb128_1_encrypt); -void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const void *key, - unsigned char ivec[16], int *num, - int enc, block128_f block) +void +CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const void *key, + unsigned char ivec[16], int *num, + int enc, block128_f block) { - size_t n; + size_t n; - for(n=0 ; n=16) { - (*block)(ivec, ecount_buf, key); - ctr128_inc_aligned(ivec); - for (; n<16; n+=sizeof(size_t)) - *(size_t *)(out+n) = - *(size_t *)(in+n) ^ *(size_t *)(ecount_buf+n); - len -= 16; - out += 16; - in += 16; - n = 0; - } - if (len) { - (*block)(ivec, ecount_buf, key); - ctr128_inc_aligned(ivec); - while (len--) { - out[n] = in[n] ^ ecount_buf[n]; - ++n; + while (len >= 16) { + (*block)(ivec, ecount_buf, key); + ctr128_inc_aligned(ivec); + for (; n < 16; n += sizeof(size_t)) + *(size_t *)(out + n) = + *(size_t *)(in + n) ^ *(size_t *)(ecount_buf + + n); + len -= 16; + out += 16; + in += 16; + n = 0; } - } - *num = n; - return; - } while(0); + if (len) { + (*block)(ivec, ecount_buf, key); + ctr128_inc_aligned(ivec); + while (len--) { + out[n] = in[n] ^ ecount_buf[n]; + ++n; + } + } + *num = n; + return; + } while (0); /* the rest would be commonly eliminated by x86* compiler */ #endif - while (l=16) { + ctr32 = GETU32(ivec + 12); + while (len >= 16) { size_t blocks = len/16; /* * 1<<28 is just a not-so-small yet not-so-large number... * Below condition is practically never met, but it has to * be checked for code correctness. */ - if (sizeof(size_t)>sizeof(unsigned int) && blocks>(1U<<28)) - blocks = (1U<<28); + if (sizeof(size_t) > sizeof(unsigned int) && + blocks > (1U << 28)) + blocks = (1U << 28); /* * As (*func) operates on 32-bit counter, caller * has to handle overflow. 'if' below detects the @@ -223,29 +236,32 @@ void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out, ctr32 += (u32)blocks; if (ctr32 < blocks) { blocks -= ctr32; - ctr32 = 0; + ctr32 = 0; } - (*func)(in,out,blocks,key,ivec); + (*func)(in, out, blocks, key, ivec); /* (*ctr) does not update ivec, caller does: */ - PUTU32(ivec+12,ctr32); + PUTU32(ivec + 12, ctr32); /* ... overflow was detected, propagate carry. */ - if (ctr32 == 0) ctr96_inc(ivec); + if (ctr32 == 0) + ctr96_inc(ivec); blocks *= 16; len -= blocks; out += blocks; - in += blocks; + in += blocks; } if (len) { - memset(ecount_buf,0,16); - (*func)(ecount_buf,ecount_buf,1,key,ivec); + memset(ecount_buf, 0, 16); + (*func)(ecount_buf, ecount_buf, 1, key, ivec); ++ctr32; - PUTU32(ivec+12,ctr32); - if (ctr32 == 0) ctr96_inc(ivec); + PUTU32(ivec + 12, ctr32); + if (ctr32 == 0) + ctr96_inc(ivec); while (len--) { out[n] = in[n] ^ ecount_buf[n]; ++n; } } - *num=n; + *num = n; } +LCRYPTO_ALIAS(CRYPTO_ctr128_encrypt_ctr32); diff --git a/lib/libcrypto/modes/gcm128.c b/lib/libcrypto/modes/gcm128.c index 36aac413c..c4fc5cb94 100644 --- a/lib/libcrypto/modes/gcm128.c +++ b/lib/libcrypto/modes/gcm128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gcm128.c,v 1.23 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: gcm128.c,v 1.25 2023/07/08 14:56:54 beck Exp $ */ /* ==================================================================== * Copyright (c) 2010 The OpenSSL Project. All rights reserved. * @@ -69,17 +69,17 @@ #endif #define PACK(s) ((size_t)(s)<<(sizeof(size_t)*8-16)) -#define REDUCE1BIT(V) \ - do { \ - if (sizeof(size_t)==8) { \ - u64 T = U64(0xe100000000000000) & (0-(V.lo&1)); \ - V.lo = (V.hi<<63)|(V.lo>>1); \ - V.hi = (V.hi>>1 )^T; \ - } else { \ - u32 T = 0xe1000000U & (0-(u32)(V.lo&1)); \ - V.lo = (V.hi<<63)|(V.lo>>1); \ - V.hi = (V.hi>>1 )^((u64)T<<32); \ - } \ +#define REDUCE1BIT(V) \ + do { \ + if (sizeof(size_t)==8) { \ + u64 T = U64(0xe100000000000000) & (0-(V.lo&1)); \ + V.lo = (V.hi<<63)|(V.lo>>1); \ + V.hi = (V.hi>>1 )^T; \ + } else { \ + u32 T = 0xe1000000U & (0-(u32)(V.lo&1)); \ + V.lo = (V.hi<<63)|(V.lo>>1); \ + V.hi = (V.hi>>1 )^((u64)T<<32); \ + } \ } while(0) /* @@ -118,7 +118,8 @@ */ #if TABLE_BITS==8 -static void gcm_init_8bit(u128 Htable[256], u64 H[2]) +static void +gcm_init_8bit(u128 Htable[256], u64 H[2]) { int i, j; u128 V; @@ -128,24 +129,25 @@ static void gcm_init_8bit(u128 Htable[256], u64 H[2]) V.hi = H[0]; V.lo = H[1]; - for (Htable[128]=V, i=64; i>0; i>>=1) { + for (Htable[128] = V, i = 64; i > 0; i >>= 1) { REDUCE1BIT(V); Htable[i] = V; } - for (i=2; i<256; i<<=1) { - u128 *Hi = Htable+i, H0 = *Hi; - for (j=1; j>8); - Z.hi = (Z.hi>>8); + rem = (size_t)Z.lo & 0xff; + Z.lo = (Z.hi << 56)|(Z.lo >> 8); + Z.hi = (Z.hi >> 8); #if SIZE_MAX == 0xffffffffffffffff Z.hi ^= rem_8bit[rem]; #else - Z.hi ^= (u64)rem_8bit[rem]<<32; + Z.hi ^= (u64)rem_8bit[rem] << 32; #endif } @@ -238,10 +241,14 @@ static void gcm_gmult_8bit(u64 Xi[2], const u128 Htable[256]) #else u8 *p = (u8 *)Xi; u32 v; - v = (u32)(Z.hi>>32); PUTU32(p,v); - v = (u32)(Z.hi); PUTU32(p+4,v); - v = (u32)(Z.lo>>32); PUTU32(p+8,v); - v = (u32)(Z.lo); PUTU32(p+12,v); + v = (u32)(Z.hi >> 32); + PUTU32(p, v); + v = (u32)(Z.hi); + PUTU32(p + 4, v); + v = (u32)(Z.lo >> 32); + PUTU32(p + 8, v); + v = (u32)(Z.lo); + PUTU32(p + 12, v); #endif #else /* BIG_ENDIAN */ Xi[0] = Z.hi; @@ -252,7 +259,8 @@ static void gcm_gmult_8bit(u64 Xi[2], const u128 Htable[256]) #elif TABLE_BITS==4 -static void gcm_init_4bit(u128 Htable[16], u64 H[2]) +static void +gcm_init_4bit(u128 Htable[16], u64 H[2]) { u128 V; #if defined(OPENSSL_SMALL_FOOTPRINT) @@ -265,17 +273,17 @@ static void gcm_init_4bit(u128 Htable[16], u64 H[2]) V.lo = H[1]; #if defined(OPENSSL_SMALL_FOOTPRINT) - for (Htable[8]=V, i=4; i>0; i>>=1) { + for (Htable[8] = V, i = 4; i > 0; i >>= 1) { REDUCE1BIT(V); Htable[i] = V; } - for (i=2; i<16; i<<=1) { - u128 *Hi = Htable+i; + for (i = 2; i < 16; i <<= 1) { + u128 *Hi = Htable + i; int j; - for (V=*Hi, j=1; j>32; - Htable[j].lo = V.hi<<32|V.hi>>32; + Htable[j].hi = V.lo << 32|V.lo >> 32; + Htable[j].lo = V.hi << 32|V.hi >> 32; } #endif } @@ -330,44 +344,46 @@ static const size_t rem_4bit[16] = { PACK(0xE100), PACK(0xFD20), PACK(0xD940), PACK(0xC560), PACK(0x9180), PACK(0x8DA0), PACK(0xA9C0), PACK(0xB5E0) }; -static void gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16]) +static void +gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16]) { u128 Z; int cnt = 15; size_t rem, nlo, nhi; - nlo = ((const u8 *)Xi)[15]; - nhi = nlo>>4; + nlo = ((const u8 *)Xi)[15]; + nhi = nlo >> 4; nlo &= 0xf; Z.hi = Htable[nlo].hi; Z.lo = Htable[nlo].lo; while (1) { - rem = (size_t)Z.lo&0xf; - Z.lo = (Z.hi<<60)|(Z.lo>>4); - Z.hi = (Z.hi>>4); + rem = (size_t)Z.lo & 0xf; + Z.lo = (Z.hi << 60)|(Z.lo >> 4); + Z.hi = (Z.hi >> 4); #if SIZE_MAX == 0xffffffffffffffff Z.hi ^= rem_4bit[rem]; #else - Z.hi ^= (u64)rem_4bit[rem]<<32; + Z.hi ^= (u64)rem_4bit[rem] << 32; #endif Z.hi ^= Htable[nhi].hi; Z.lo ^= Htable[nhi].lo; - if (--cnt<0) break; + if (--cnt < 0) + break; - nlo = ((const u8 *)Xi)[cnt]; - nhi = nlo>>4; + nlo = ((const u8 *)Xi)[cnt]; + nhi = nlo >> 4; nlo &= 0xf; - rem = (size_t)Z.lo&0xf; - Z.lo = (Z.hi<<60)|(Z.lo>>4); - Z.hi = (Z.hi>>4); + rem = (size_t)Z.lo & 0xf; + Z.lo = (Z.hi << 60)|(Z.lo >> 4); + Z.hi = (Z.hi >> 4); #if SIZE_MAX == 0xffffffffffffffff Z.hi ^= rem_4bit[rem]; #else - Z.hi ^= (u64)rem_4bit[rem]<<32; + Z.hi ^= (u64)rem_4bit[rem] << 32; #endif Z.hi ^= Htable[nlo].hi; Z.lo ^= Htable[nlo].lo; @@ -380,10 +396,14 @@ static void gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16]) #else u8 *p = (u8 *)Xi; u32 v; - v = (u32)(Z.hi>>32); PUTU32(p,v); - v = (u32)(Z.hi); PUTU32(p+4,v); - v = (u32)(Z.lo>>32); PUTU32(p+8,v); - v = (u32)(Z.lo); PUTU32(p+12,v); + v = (u32)(Z.hi >> 32); + PUTU32(p, v); + v = (u32)(Z.hi); + PUTU32(p + 4, v); + v = (u32)(Z.lo >> 32); + PUTU32(p + 8, v); + v = (u32)(Z.lo); + PUTU32(p + 12, v); #endif #else /* BIG_ENDIAN */ Xi[0] = Z.hi; @@ -399,54 +419,56 @@ static void gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16]) * mostly as reference and a placeholder for possible future * non-trivial optimization[s]... */ -static void gcm_ghash_4bit(u64 Xi[2],const u128 Htable[16], - const u8 *inp,size_t len) +static void +gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16], + const u8 *inp, size_t len) { - u128 Z; - int cnt; - size_t rem, nlo, nhi; + u128 Z; + int cnt; + size_t rem, nlo, nhi; #if 1 - do { - cnt = 15; - nlo = ((const u8 *)Xi)[15]; - nlo ^= inp[15]; - nhi = nlo>>4; - nlo &= 0xf; - - Z.hi = Htable[nlo].hi; - Z.lo = Htable[nlo].lo; - - while (1) { - rem = (size_t)Z.lo&0xf; - Z.lo = (Z.hi<<60)|(Z.lo>>4); - Z.hi = (Z.hi>>4); -#if SIZE_MAX == 0xffffffffffffffff - Z.hi ^= rem_4bit[rem]; -#else - Z.hi ^= (u64)rem_4bit[rem]<<32; -#endif - Z.hi ^= Htable[nhi].hi; - Z.lo ^= Htable[nhi].lo; - - if (--cnt<0) break; - - nlo = ((const u8 *)Xi)[cnt]; - nlo ^= inp[cnt]; - nhi = nlo>>4; + do { + cnt = 15; + nlo = ((const u8 *)Xi)[15]; + nlo ^= inp[15]; + nhi = nlo >> 4; nlo &= 0xf; - rem = (size_t)Z.lo&0xf; - Z.lo = (Z.hi<<60)|(Z.lo>>4); - Z.hi = (Z.hi>>4); + Z.hi = Htable[nlo].hi; + Z.lo = Htable[nlo].lo; + + while (1) { + rem = (size_t)Z.lo & 0xf; + Z.lo = (Z.hi << 60)|(Z.lo >> 4); + Z.hi = (Z.hi >> 4); #if SIZE_MAX == 0xffffffffffffffff - Z.hi ^= rem_4bit[rem]; + Z.hi ^= rem_4bit[rem]; #else - Z.hi ^= (u64)rem_4bit[rem]<<32; + Z.hi ^= (u64)rem_4bit[rem] << 32; #endif - Z.hi ^= Htable[nlo].hi; - Z.lo ^= Htable[nlo].lo; - } + Z.hi ^= Htable[nhi].hi; + Z.lo ^= Htable[nhi].lo; + + if (--cnt < 0) + break; + + nlo = ((const u8 *)Xi)[cnt]; + nlo ^= inp[cnt]; + nhi = nlo >> 4; + nlo &= 0xf; + + rem = (size_t)Z.lo & 0xf; + Z.lo = (Z.hi << 60)|(Z.lo >> 4); + Z.hi = (Z.hi >> 4); +#if SIZE_MAX == 0xffffffffffffffff + Z.hi ^= rem_4bit[rem]; +#else + Z.hi ^= (u64)rem_4bit[rem] << 32; +#endif + Z.hi ^= Htable[nlo].hi; + Z.lo ^= Htable[nlo].lo; + } #else /* * Extra 256+16 bytes per-key plus 512 bytes shared tables @@ -454,115 +476,120 @@ static void gcm_ghash_4bit(u64 Xi[2],const u128 Htable[16], * the rem_8bit even here, but the priority is to minimize * cache footprint... */ - u128 Hshr4[16]; /* Htable shifted right by 4 bits */ - u8 Hshl4[16]; /* Htable shifted left by 4 bits */ - static const unsigned short rem_8bit[256] = { - 0x0000, 0x01C2, 0x0384, 0x0246, 0x0708, 0x06CA, 0x048C, 0x054E, - 0x0E10, 0x0FD2, 0x0D94, 0x0C56, 0x0918, 0x08DA, 0x0A9C, 0x0B5E, - 0x1C20, 0x1DE2, 0x1FA4, 0x1E66, 0x1B28, 0x1AEA, 0x18AC, 0x196E, - 0x1230, 0x13F2, 0x11B4, 0x1076, 0x1538, 0x14FA, 0x16BC, 0x177E, - 0x3840, 0x3982, 0x3BC4, 0x3A06, 0x3F48, 0x3E8A, 0x3CCC, 0x3D0E, - 0x3650, 0x3792, 0x35D4, 0x3416, 0x3158, 0x309A, 0x32DC, 0x331E, - 0x2460, 0x25A2, 0x27E4, 0x2626, 0x2368, 0x22AA, 0x20EC, 0x212E, - 0x2A70, 0x2BB2, 0x29F4, 0x2836, 0x2D78, 0x2CBA, 0x2EFC, 0x2F3E, - 0x7080, 0x7142, 0x7304, 0x72C6, 0x7788, 0x764A, 0x740C, 0x75CE, - 0x7E90, 0x7F52, 0x7D14, 0x7CD6, 0x7998, 0x785A, 0x7A1C, 0x7BDE, - 0x6CA0, 0x6D62, 0x6F24, 0x6EE6, 0x6BA8, 0x6A6A, 0x682C, 0x69EE, - 0x62B0, 0x6372, 0x6134, 0x60F6, 0x65B8, 0x647A, 0x663C, 0x67FE, - 0x48C0, 0x4902, 0x4B44, 0x4A86, 0x4FC8, 0x4E0A, 0x4C4C, 0x4D8E, - 0x46D0, 0x4712, 0x4554, 0x4496, 0x41D8, 0x401A, 0x425C, 0x439E, - 0x54E0, 0x5522, 0x5764, 0x56A6, 0x53E8, 0x522A, 0x506C, 0x51AE, - 0x5AF0, 0x5B32, 0x5974, 0x58B6, 0x5DF8, 0x5C3A, 0x5E7C, 0x5FBE, - 0xE100, 0xE0C2, 0xE284, 0xE346, 0xE608, 0xE7CA, 0xE58C, 0xE44E, - 0xEF10, 0xEED2, 0xEC94, 0xED56, 0xE818, 0xE9DA, 0xEB9C, 0xEA5E, - 0xFD20, 0xFCE2, 0xFEA4, 0xFF66, 0xFA28, 0xFBEA, 0xF9AC, 0xF86E, - 0xF330, 0xF2F2, 0xF0B4, 0xF176, 0xF438, 0xF5FA, 0xF7BC, 0xF67E, - 0xD940, 0xD882, 0xDAC4, 0xDB06, 0xDE48, 0xDF8A, 0xDDCC, 0xDC0E, - 0xD750, 0xD692, 0xD4D4, 0xD516, 0xD058, 0xD19A, 0xD3DC, 0xD21E, - 0xC560, 0xC4A2, 0xC6E4, 0xC726, 0xC268, 0xC3AA, 0xC1EC, 0xC02E, - 0xCB70, 0xCAB2, 0xC8F4, 0xC936, 0xCC78, 0xCDBA, 0xCFFC, 0xCE3E, - 0x9180, 0x9042, 0x9204, 0x93C6, 0x9688, 0x974A, 0x950C, 0x94CE, - 0x9F90, 0x9E52, 0x9C14, 0x9DD6, 0x9898, 0x995A, 0x9B1C, 0x9ADE, - 0x8DA0, 0x8C62, 0x8E24, 0x8FE6, 0x8AA8, 0x8B6A, 0x892C, 0x88EE, - 0x83B0, 0x8272, 0x8034, 0x81F6, 0x84B8, 0x857A, 0x873C, 0x86FE, - 0xA9C0, 0xA802, 0xAA44, 0xAB86, 0xAEC8, 0xAF0A, 0xAD4C, 0xAC8E, - 0xA7D0, 0xA612, 0xA454, 0xA596, 0xA0D8, 0xA11A, 0xA35C, 0xA29E, - 0xB5E0, 0xB422, 0xB664, 0xB7A6, 0xB2E8, 0xB32A, 0xB16C, 0xB0AE, - 0xBBF0, 0xBA32, 0xB874, 0xB9B6, 0xBCF8, 0xBD3A, 0xBF7C, 0xBEBE }; + u128 Hshr4[16]; /* Htable shifted right by 4 bits */ + u8 Hshl4[16]; /* Htable shifted left by 4 bits */ + static const unsigned short rem_8bit[256] = { + 0x0000, 0x01C2, 0x0384, 0x0246, 0x0708, 0x06CA, 0x048C, 0x054E, + 0x0E10, 0x0FD2, 0x0D94, 0x0C56, 0x0918, 0x08DA, 0x0A9C, 0x0B5E, + 0x1C20, 0x1DE2, 0x1FA4, 0x1E66, 0x1B28, 0x1AEA, 0x18AC, 0x196E, + 0x1230, 0x13F2, 0x11B4, 0x1076, 0x1538, 0x14FA, 0x16BC, 0x177E, + 0x3840, 0x3982, 0x3BC4, 0x3A06, 0x3F48, 0x3E8A, 0x3CCC, 0x3D0E, + 0x3650, 0x3792, 0x35D4, 0x3416, 0x3158, 0x309A, 0x32DC, 0x331E, + 0x2460, 0x25A2, 0x27E4, 0x2626, 0x2368, 0x22AA, 0x20EC, 0x212E, + 0x2A70, 0x2BB2, 0x29F4, 0x2836, 0x2D78, 0x2CBA, 0x2EFC, 0x2F3E, + 0x7080, 0x7142, 0x7304, 0x72C6, 0x7788, 0x764A, 0x740C, 0x75CE, + 0x7E90, 0x7F52, 0x7D14, 0x7CD6, 0x7998, 0x785A, 0x7A1C, 0x7BDE, + 0x6CA0, 0x6D62, 0x6F24, 0x6EE6, 0x6BA8, 0x6A6A, 0x682C, 0x69EE, + 0x62B0, 0x6372, 0x6134, 0x60F6, 0x65B8, 0x647A, 0x663C, 0x67FE, + 0x48C0, 0x4902, 0x4B44, 0x4A86, 0x4FC8, 0x4E0A, 0x4C4C, 0x4D8E, + 0x46D0, 0x4712, 0x4554, 0x4496, 0x41D8, 0x401A, 0x425C, 0x439E, + 0x54E0, 0x5522, 0x5764, 0x56A6, 0x53E8, 0x522A, 0x506C, 0x51AE, + 0x5AF0, 0x5B32, 0x5974, 0x58B6, 0x5DF8, 0x5C3A, 0x5E7C, 0x5FBE, + 0xE100, 0xE0C2, 0xE284, 0xE346, 0xE608, 0xE7CA, 0xE58C, 0xE44E, + 0xEF10, 0xEED2, 0xEC94, 0xED56, 0xE818, 0xE9DA, 0xEB9C, 0xEA5E, + 0xFD20, 0xFCE2, 0xFEA4, 0xFF66, 0xFA28, 0xFBEA, 0xF9AC, 0xF86E, + 0xF330, 0xF2F2, 0xF0B4, 0xF176, 0xF438, 0xF5FA, 0xF7BC, 0xF67E, + 0xD940, 0xD882, 0xDAC4, 0xDB06, 0xDE48, 0xDF8A, 0xDDCC, 0xDC0E, + 0xD750, 0xD692, 0xD4D4, 0xD516, 0xD058, 0xD19A, 0xD3DC, 0xD21E, + 0xC560, 0xC4A2, 0xC6E4, 0xC726, 0xC268, 0xC3AA, 0xC1EC, 0xC02E, + 0xCB70, 0xCAB2, 0xC8F4, 0xC936, 0xCC78, 0xCDBA, 0xCFFC, 0xCE3E, + 0x9180, 0x9042, 0x9204, 0x93C6, 0x9688, 0x974A, 0x950C, 0x94CE, + 0x9F90, 0x9E52, 0x9C14, 0x9DD6, 0x9898, 0x995A, 0x9B1C, 0x9ADE, + 0x8DA0, 0x8C62, 0x8E24, 0x8FE6, 0x8AA8, 0x8B6A, 0x892C, 0x88EE, + 0x83B0, 0x8272, 0x8034, 0x81F6, 0x84B8, 0x857A, 0x873C, 0x86FE, + 0xA9C0, 0xA802, 0xAA44, 0xAB86, 0xAEC8, 0xAF0A, 0xAD4C, 0xAC8E, + 0xA7D0, 0xA612, 0xA454, 0xA596, 0xA0D8, 0xA11A, 0xA35C, 0xA29E, + 0xB5E0, 0xB422, 0xB664, 0xB7A6, 0xB2E8, 0xB32A, 0xB16C, 0xB0AE, + 0xBBF0, 0xBA32, 0xB874, 0xB9B6, 0xBCF8, 0xBD3A, 0xBF7C, 0xBEBE }; /* * This pre-processing phase slows down procedure by approximately * same time as it makes each loop spin faster. In other words * single block performance is approximately same as straightforward * "4-bit" implementation, and then it goes only faster... */ - for (cnt=0; cnt<16; ++cnt) { - Z.hi = Htable[cnt].hi; - Z.lo = Htable[cnt].lo; - Hshr4[cnt].lo = (Z.hi<<60)|(Z.lo>>4); - Hshr4[cnt].hi = (Z.hi>>4); - Hshl4[cnt] = (u8)(Z.lo<<4); - } + for (cnt = 0; cnt < 16; ++cnt) { + Z.hi = Htable[cnt].hi; + Z.lo = Htable[cnt].lo; + Hshr4[cnt].lo = (Z.hi << 60)|(Z.lo >> 4); + Hshr4[cnt].hi = (Z.hi >> 4); + Hshl4[cnt] = (u8)(Z.lo << 4); + } - do { - for (Z.lo=0, Z.hi=0, cnt=15; cnt; --cnt) { - nlo = ((const u8 *)Xi)[cnt]; - nlo ^= inp[cnt]; - nhi = nlo>>4; + do { + for (Z.lo = 0, Z.hi = 0, cnt = 15; cnt; --cnt) { + nlo = ((const u8 *)Xi)[cnt]; + nlo ^= inp[cnt]; + nhi = nlo >> 4; + nlo &= 0xf; + + Z.hi ^= Htable[nlo].hi; + Z.lo ^= Htable[nlo].lo; + + rem = (size_t)Z.lo & 0xff; + + Z.lo = (Z.hi << 56)|(Z.lo >> 8); + Z.hi = (Z.hi >> 8); + + Z.hi ^= Hshr4[nhi].hi; + Z.lo ^= Hshr4[nhi].lo; + Z.hi ^= (u64)rem_8bit[rem ^ Hshl4[nhi]] << 48; + } + + nlo = ((const u8 *)Xi)[0]; + nlo ^= inp[0]; + nhi = nlo >> 4; nlo &= 0xf; Z.hi ^= Htable[nlo].hi; Z.lo ^= Htable[nlo].lo; - rem = (size_t)Z.lo&0xff; + rem = (size_t)Z.lo & 0xf; - Z.lo = (Z.hi<<56)|(Z.lo>>8); - Z.hi = (Z.hi>>8); + Z.lo = (Z.hi << 60)|(Z.lo >> 4); + Z.hi = (Z.hi >> 4); - Z.hi ^= Hshr4[nhi].hi; - Z.lo ^= Hshr4[nhi].lo; - Z.hi ^= (u64)rem_8bit[rem^Hshl4[nhi]]<<48; - } - - nlo = ((const u8 *)Xi)[0]; - nlo ^= inp[0]; - nhi = nlo>>4; - nlo &= 0xf; - - Z.hi ^= Htable[nlo].hi; - Z.lo ^= Htable[nlo].lo; - - rem = (size_t)Z.lo&0xf; - - Z.lo = (Z.hi<<60)|(Z.lo>>4); - Z.hi = (Z.hi>>4); - - Z.hi ^= Htable[nhi].hi; - Z.lo ^= Htable[nhi].lo; - Z.hi ^= ((u64)rem_8bit[rem<<4])<<48; + Z.hi ^= Htable[nhi].hi; + Z.lo ^= Htable[nhi].lo; + Z.hi ^= ((u64)rem_8bit[rem << 4]) << 48; #endif #if BYTE_ORDER == LITTLE_ENDIAN #ifdef BSWAP8 - Xi[0] = BSWAP8(Z.hi); - Xi[1] = BSWAP8(Z.lo); + Xi[0] = BSWAP8(Z.hi); + Xi[1] = BSWAP8(Z.lo); #else - u8 *p = (u8 *)Xi; - u32 v; - v = (u32)(Z.hi>>32); PUTU32(p,v); - v = (u32)(Z.hi); PUTU32(p+4,v); - v = (u32)(Z.lo>>32); PUTU32(p+8,v); - v = (u32)(Z.lo); PUTU32(p+12,v); + u8 *p = (u8 *)Xi; + u32 v; + v = (u32)(Z.hi >> 32); + PUTU32(p, v); + v = (u32)(Z.hi); + PUTU32(p + 4, v); + v = (u32)(Z.lo >> 32); + PUTU32(p + 8, v); + v = (u32)(Z.lo); + PUTU32(p + 12, v); #endif #else /* BIG_ENDIAN */ - Xi[0] = Z.hi; - Xi[1] = Z.lo; + Xi[0] = Z.hi; + Xi[1] = Z.lo; #endif - } while (inp+=16, len-=16); + } while (inp += 16, len -= 16); } #endif #else -void gcm_gmult_4bit(u64 Xi[2],const u128 Htable[16]); -void gcm_ghash_4bit(u64 Xi[2],const u128 Htable[16],const u8 *inp,size_t len); +void gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16]); +void gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16], const u8 *inp, + size_t len); #endif #define GCM_MUL(ctx,Xi) gcm_gmult_4bit(ctx->Xi.u,ctx->Htable) @@ -576,37 +603,38 @@ void gcm_ghash_4bit(u64 Xi[2],const u128 Htable[16],const u8 *inp,size_t len); #else /* TABLE_BITS */ -static void gcm_gmult_1bit(u64 Xi[2],const u64 H[2]) +static void +gcm_gmult_1bit(u64 Xi[2], const u64 H[2]) { - u128 V,Z = { 0,0 }; + u128 V, Z = { 0,0 }; long X; - int i,j; + int i, j; const long *xi = (const long *)Xi; V.hi = H[0]; /* H is in host byte order, no byte swapping */ V.lo = H[1]; - for (j=0; j<16/sizeof(long); ++j) { + for (j = 0; j < 16/sizeof(long); ++j) { #if BYTE_ORDER == LITTLE_ENDIAN #if SIZE_MAX == 0xffffffffffffffff #ifdef BSWAP8 - X = (long)(BSWAP8(xi[j])); + X = (long)(BSWAP8(xi[j])); #else - const u8 *p = (const u8 *)(xi+j); - X = (long)((u64)GETU32(p)<<32|GETU32(p+4)); + const u8 *p = (const u8 *)(xi + j); + X = (long)((u64)GETU32(p) << 32|GETU32(p + 4)); #endif #else - const u8 *p = (const u8 *)(xi+j); - X = (long)GETU32(p); + const u8 *p = (const u8 *)(xi + j); + X = (long)GETU32(p); #endif #else /* BIG_ENDIAN */ X = xi[j]; #endif - for (i=0; i<8*sizeof(long); ++i, X<<=1) { - u64 M = (u64)(X>>(8*sizeof(long)-1)); - Z.hi ^= V.hi&M; - Z.lo ^= V.lo&M; + for (i = 0; i < 8*sizeof(long); ++i, X <<= 1) { + u64 M = (u64)(X >> (8*sizeof(long) - 1)); + Z.hi ^= V.hi & M; + Z.lo ^= V.lo & M; REDUCE1BIT(V); } @@ -619,10 +647,14 @@ static void gcm_gmult_1bit(u64 Xi[2],const u64 H[2]) #else u8 *p = (u8 *)Xi; u32 v; - v = (u32)(Z.hi>>32); PUTU32(p,v); - v = (u32)(Z.hi); PUTU32(p+4,v); - v = (u32)(Z.lo>>32); PUTU32(p+8,v); - v = (u32)(Z.lo); PUTU32(p+12,v); + v = (u32)(Z.hi >> 32); + PUTU32(p, v); + v = (u32)(Z.hi); + PUTU32(p + 4, v); + v = (u32)(Z.lo >> 32); + PUTU32(p + 8, v); + v = (u32)(Z.lo); + PUTU32(p + 12, v); #endif #else /* BIG_ENDIAN */ Xi[0] = Z.hi; @@ -633,39 +665,43 @@ static void gcm_gmult_1bit(u64 Xi[2],const u64 H[2]) #endif -#if defined(GHASH_ASM) && \ - (defined(__i386) || defined(__i386__) || \ - defined(__x86_64) || defined(__x86_64__) || \ +#if defined(GHASH_ASM) && \ + (defined(__i386) || defined(__i386__) || \ + defined(__x86_64) || defined(__x86_64__) || \ defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64)) #include "x86_arch.h" #endif #if TABLE_BITS==4 && defined(GHASH_ASM) -# if (defined(__i386) || defined(__i386__) || \ - defined(__x86_64) || defined(__x86_64__) || \ +# if (defined(__i386) || defined(__i386__) || \ + defined(__x86_64) || defined(__x86_64__) || \ defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64)) # define GHASH_ASM_X86_OR_64 # define GCM_FUNCREF_4BIT -void gcm_init_clmul(u128 Htable[16],const u64 Xi[2]); -void gcm_gmult_clmul(u64 Xi[2],const u128 Htable[16]); -void gcm_ghash_clmul(u64 Xi[2],const u128 Htable[16],const u8 *inp,size_t len); +void gcm_init_clmul(u128 Htable[16], const u64 Xi[2]); +void gcm_gmult_clmul(u64 Xi[2], const u128 Htable[16]); +void gcm_ghash_clmul(u64 Xi[2], const u128 Htable[16], const u8 *inp, + size_t len); # if defined(__i386) || defined(__i386__) || defined(_M_IX86) # define GHASH_ASM_X86 -void gcm_gmult_4bit_mmx(u64 Xi[2],const u128 Htable[16]); -void gcm_ghash_4bit_mmx(u64 Xi[2],const u128 Htable[16],const u8 *inp,size_t len); +void gcm_gmult_4bit_mmx(u64 Xi[2], const u128 Htable[16]); +void gcm_ghash_4bit_mmx(u64 Xi[2], const u128 Htable[16], const u8 *inp, + size_t len); -void gcm_gmult_4bit_x86(u64 Xi[2],const u128 Htable[16]); -void gcm_ghash_4bit_x86(u64 Xi[2],const u128 Htable[16],const u8 *inp,size_t len); +void gcm_gmult_4bit_x86(u64 Xi[2], const u128 Htable[16]); +void gcm_ghash_4bit_x86(u64 Xi[2], const u128 Htable[16], const u8 *inp, + size_t len); # endif # elif defined(__arm__) || defined(__arm) # include "arm_arch.h" # if __ARM_ARCH__>=7 && !defined(__STRICT_ALIGNMENT) # define GHASH_ASM_ARM # define GCM_FUNCREF_4BIT -void gcm_gmult_neon(u64 Xi[2],const u128 Htable[16]); -void gcm_ghash_neon(u64 Xi[2],const u128 Htable[16],const u8 *inp,size_t len); +void gcm_gmult_neon(u64 Xi[2], const u128 Htable[16]); +void gcm_ghash_neon(u64 Xi[2], const u128 Htable[16], const u8 *inp, + size_t len); # endif # endif #endif @@ -679,13 +715,14 @@ void gcm_ghash_neon(u64 Xi[2],const u128 Htable[16],const u8 *inp,size_t len); # endif #endif -void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx,void *key,block128_f block) +void +CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, block128_f block) { - memset(ctx,0,sizeof(*ctx)); + memset(ctx, 0, sizeof(*ctx)); ctx->block = block; - ctx->key = key; + ctx->key = key; - (*block)(ctx->H.c,ctx->H.c,key); + (*block)(ctx->H.c, ctx->H.c, key); #if BYTE_ORDER == LITTLE_ENDIAN /* H is stored in host byte order */ @@ -694,29 +731,29 @@ void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx,void *key,block128_f block) ctx->H.u[1] = BSWAP8(ctx->H.u[1]); #else u8 *p = ctx->H.c; - u64 hi,lo; - hi = (u64)GETU32(p) <<32|GETU32(p+4); - lo = (u64)GETU32(p+8)<<32|GETU32(p+12); + u64 hi, lo; + hi = (u64)GETU32(p) << 32|GETU32(p + 4); + lo = (u64)GETU32(p + 8) << 32|GETU32(p + 12); ctx->H.u[0] = hi; ctx->H.u[1] = lo; #endif #endif #if TABLE_BITS==8 - gcm_init_8bit(ctx->Htable,ctx->H.u); + gcm_init_8bit(ctx->Htable, ctx->H.u); #elif TABLE_BITS==4 # if defined(GHASH_ASM_X86_OR_64) # if !defined(GHASH_ASM_X86) || defined(OPENSSL_IA32_SSE2) /* check FXSR and PCLMULQDQ bits */ if ((OPENSSL_cpu_caps() & (CPUCAP_MASK_FXSR | CPUCAP_MASK_PCLMUL)) == (CPUCAP_MASK_FXSR | CPUCAP_MASK_PCLMUL)) { - gcm_init_clmul(ctx->Htable,ctx->H.u); + gcm_init_clmul(ctx->Htable, ctx->H.u); ctx->gmult = gcm_gmult_clmul; ctx->ghash = gcm_ghash_clmul; return; } # endif - gcm_init_4bit(ctx->Htable,ctx->H.u); + gcm_init_4bit(ctx->Htable, ctx->H.u); # if defined(GHASH_ASM_X86) /* x86 only */ # if defined(OPENSSL_IA32_SSE2) if (OPENSSL_cpu_caps() & CPUCAP_MASK_SSE) { /* check SSE bit */ @@ -738,112 +775,118 @@ void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx,void *key,block128_f block) ctx->gmult = gcm_gmult_neon; ctx->ghash = gcm_ghash_neon; } else { - gcm_init_4bit(ctx->Htable,ctx->H.u); + gcm_init_4bit(ctx->Htable, ctx->H.u); ctx->gmult = gcm_gmult_4bit; ctx->ghash = gcm_ghash_4bit; } # else - gcm_init_4bit(ctx->Htable,ctx->H.u); + gcm_init_4bit(ctx->Htable, ctx->H.u); # endif #endif } +LCRYPTO_ALIAS(CRYPTO_gcm128_init); -void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx,const unsigned char *iv,size_t len) +void +CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv, size_t len) { unsigned int ctr; #ifdef GCM_FUNCREF_4BIT - void (*gcm_gmult_p)(u64 Xi[2],const u128 Htable[16]) = ctx->gmult; + void (*gcm_gmult_p)(u64 Xi[2], const u128 Htable[16]) = ctx->gmult; #endif - ctx->Yi.u[0] = 0; - ctx->Yi.u[1] = 0; - ctx->Xi.u[0] = 0; - ctx->Xi.u[1] = 0; + ctx->Yi.u[0] = 0; + ctx->Yi.u[1] = 0; + ctx->Xi.u[0] = 0; + ctx->Xi.u[1] = 0; ctx->len.u[0] = 0; /* AAD length */ ctx->len.u[1] = 0; /* message length */ ctx->ares = 0; ctx->mres = 0; - if (len==12) { - memcpy(ctx->Yi.c,iv,12); - ctx->Yi.c[15]=1; - ctr=1; - } - else { + if (len == 12) { + memcpy(ctx->Yi.c, iv, 12); + ctx->Yi.c[15] = 1; + ctr = 1; + } else { size_t i; u64 len0 = len; - while (len>=16) { - for (i=0; i<16; ++i) ctx->Yi.c[i] ^= iv[i]; - GCM_MUL(ctx,Yi); + while (len >= 16) { + for (i = 0; i < 16; ++i) + ctx->Yi.c[i] ^= iv[i]; + GCM_MUL(ctx, Yi); iv += 16; len -= 16; } if (len) { - for (i=0; iYi.c[i] ^= iv[i]; - GCM_MUL(ctx,Yi); + for (i = 0; i < len; ++i) + ctx->Yi.c[i] ^= iv[i]; + GCM_MUL(ctx, Yi); } len0 <<= 3; #if BYTE_ORDER == LITTLE_ENDIAN #ifdef BSWAP8 - ctx->Yi.u[1] ^= BSWAP8(len0); + ctx->Yi.u[1] ^= BSWAP8(len0); #else - ctx->Yi.c[8] ^= (u8)(len0>>56); - ctx->Yi.c[9] ^= (u8)(len0>>48); - ctx->Yi.c[10] ^= (u8)(len0>>40); - ctx->Yi.c[11] ^= (u8)(len0>>32); - ctx->Yi.c[12] ^= (u8)(len0>>24); - ctx->Yi.c[13] ^= (u8)(len0>>16); - ctx->Yi.c[14] ^= (u8)(len0>>8); + ctx->Yi.c[8] ^= (u8)(len0 >> 56); + ctx->Yi.c[9] ^= (u8)(len0 >> 48); + ctx->Yi.c[10] ^= (u8)(len0 >> 40); + ctx->Yi.c[11] ^= (u8)(len0 >> 32); + ctx->Yi.c[12] ^= (u8)(len0 >> 24); + ctx->Yi.c[13] ^= (u8)(len0 >> 16); + ctx->Yi.c[14] ^= (u8)(len0 >> 8); ctx->Yi.c[15] ^= (u8)(len0); #endif #else /* BIG_ENDIAN */ - ctx->Yi.u[1] ^= len0; + ctx->Yi.u[1] ^= len0; #endif - GCM_MUL(ctx,Yi); + GCM_MUL(ctx, Yi); #if BYTE_ORDER == LITTLE_ENDIAN #ifdef BSWAP4 ctr = BSWAP4(ctx->Yi.d[3]); #else - ctr = GETU32(ctx->Yi.c+12); + ctr = GETU32(ctx->Yi.c + 12); #endif #else /* BIG_ENDIAN */ ctr = ctx->Yi.d[3]; #endif } - (*ctx->block)(ctx->Yi.c,ctx->EK0.c,ctx->key); + (*ctx->block)(ctx->Yi.c, ctx->EK0.c, ctx->key); ++ctr; #if BYTE_ORDER == LITTLE_ENDIAN #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else - PUTU32(ctx->Yi.c+12,ctr); + PUTU32(ctx->Yi.c + 12, ctr); #endif #else /* BIG_ENDIAN */ ctx->Yi.d[3] = ctr; #endif } +LCRYPTO_ALIAS(CRYPTO_gcm128_setiv); -int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx,const unsigned char *aad,size_t len) +int +CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad, size_t len) { size_t i; unsigned int n; u64 alen = ctx->len.u[0]; #ifdef GCM_FUNCREF_4BIT - void (*gcm_gmult_p)(u64 Xi[2],const u128 Htable[16]) = ctx->gmult; + void (*gcm_gmult_p)(u64 Xi[2], const u128 Htable[16]) = ctx->gmult; # ifdef GHASH - void (*gcm_ghash_p)(u64 Xi[2],const u128 Htable[16], - const u8 *inp,size_t len) = ctx->ghash; + void (*gcm_ghash_p)(u64 Xi[2], const u128 Htable[16], + const u8 *inp, size_t len) = ctx->ghash; # endif #endif - if (ctx->len.u[1]) return -2; + if (ctx->len.u[1]) + return -2; alen += len; - if (alen>(U64(1)<<61) || (sizeof(len)==8 && alen (U64(1) << 61) || (sizeof(len) == 8 && alen < len)) return -1; ctx->len.u[0] = alen; @@ -852,9 +895,10 @@ int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx,const unsigned char *aad,size_t len) while (n && len) { ctx->Xi.c[n] ^= *(aad++); --len; - n = (n+1)%16; + n = (n + 1) % 16; } - if (n==0) GCM_MUL(ctx,Xi); + if (n == 0) + GCM_MUL(ctx, Xi); else { ctx->ares = n; return 0; @@ -862,53 +906,57 @@ int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx,const unsigned char *aad,size_t len) } #ifdef GHASH - if ((i = (len&(size_t)-16))) { - GHASH(ctx,aad,i); + if ((i = (len & (size_t)-16))) { + GHASH(ctx, aad, i); aad += i; len -= i; } #else - while (len>=16) { - for (i=0; i<16; ++i) ctx->Xi.c[i] ^= aad[i]; - GCM_MUL(ctx,Xi); + while (len >= 16) { + for (i = 0; i < 16; ++i) + ctx->Xi.c[i] ^= aad[i]; + GCM_MUL(ctx, Xi); aad += 16; len -= 16; } #endif if (len) { n = (unsigned int)len; - for (i=0; iXi.c[i] ^= aad[i]; + for (i = 0; i < len; ++i) + ctx->Xi.c[i] ^= aad[i]; } ctx->ares = n; return 0; } +LCRYPTO_ALIAS(CRYPTO_gcm128_aad); -int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len) +int +CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, + const unsigned char *in, unsigned char *out, + size_t len) { unsigned int n, ctr; size_t i; - u64 mlen = ctx->len.u[1]; + u64 mlen = ctx->len.u[1]; block128_f block = ctx->block; - void *key = ctx->key; + void *key = ctx->key; #ifdef GCM_FUNCREF_4BIT - void (*gcm_gmult_p)(u64 Xi[2],const u128 Htable[16]) = ctx->gmult; + void (*gcm_gmult_p)(u64 Xi[2], const u128 Htable[16]) = ctx->gmult; # ifdef GHASH - void (*gcm_ghash_p)(u64 Xi[2],const u128 Htable[16], - const u8 *inp,size_t len) = ctx->ghash; + void (*gcm_ghash_p)(u64 Xi[2], const u128 Htable[16], + const u8 *inp, size_t len) = ctx->ghash; # endif #endif mlen += len; - if (mlen>((U64(1)<<36)-32) || (sizeof(len)==8 && mlen ((U64(1) << 36) - 32) || (sizeof(len) == 8 && mlen < len)) return -1; ctx->len.u[1] = mlen; if (ctx->ares) { /* First call to encrypt finalizes GHASH(AAD) */ - GCM_MUL(ctx,Xi); + GCM_MUL(ctx, Xi); ctx->ares = 0; } @@ -916,7 +964,7 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, #ifdef BSWAP4 ctr = BSWAP4(ctx->Yi.d[3]); #else - ctr = GETU32(ctx->Yi.c+12); + ctr = GETU32(ctx->Yi.c + 12); #endif #else /* BIG_ENDIAN */ ctr = ctx->Yi.d[3]; @@ -924,173 +972,181 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, n = ctx->mres; #if !defined(OPENSSL_SMALL_FOOTPRINT) - if (16%sizeof(size_t) == 0) do { /* always true actually */ - if (n) { - while (n && len) { - ctx->Xi.c[n] ^= *(out++) = *(in++)^ctx->EKi.c[n]; - --len; - n = (n+1)%16; + if (16 % sizeof(size_t) == 0) + do { /* always true actually */ + if (n) { + while (n && len) { + ctx->Xi.c[n] ^= *(out++) = *(in++) ^ + ctx->EKi.c[n]; + --len; + n = (n + 1) % 16; + } + if (n == 0) + GCM_MUL(ctx, Xi); + else { + ctx->mres = n; + return 0; + } } - if (n==0) GCM_MUL(ctx,Xi); - else { - ctx->mres = n; - return 0; - } - } #ifdef __STRICT_ALIGNMENT - if (((size_t)in|(size_t)out)%sizeof(size_t) != 0) - break; + if (((size_t)in|(size_t)out) % sizeof(size_t) != 0) + break; #endif #if defined(GHASH) && defined(GHASH_CHUNK) - while (len>=GHASH_CHUNK) { - size_t j=GHASH_CHUNK; + while (len >= GHASH_CHUNK) { + size_t j = GHASH_CHUNK; - while (j) { - size_t *out_t=(size_t *)out; - const size_t *in_t=(const size_t *)in; + while (j) { + size_t *out_t = (size_t *)out; + const size_t *in_t = (const size_t *)in; - (*block)(ctx->Yi.c,ctx->EKi.c,key); - ++ctr; + (*block)(ctx->Yi.c, ctx->EKi.c, key); + ++ctr; #if BYTE_ORDER == LITTLE_ENDIAN #ifdef BSWAP4 - ctx->Yi.d[3] = BSWAP4(ctr); + ctx->Yi.d[3] = BSWAP4(ctr); #else - PUTU32(ctx->Yi.c+12,ctr); + PUTU32(ctx->Yi.c + 12, ctr); #endif #else /* BIG_ENDIAN */ - ctx->Yi.d[3] = ctr; + ctx->Yi.d[3] = ctr; #endif - for (i=0; i<16/sizeof(size_t); ++i) - out_t[i] = in_t[i] ^ ctx->EKi.t[i]; - out += 16; - in += 16; - j -= 16; - } - GHASH(ctx,out-GHASH_CHUNK,GHASH_CHUNK); - len -= GHASH_CHUNK; - } - if ((i = (len&(size_t)-16))) { - size_t j=i; - - while (len>=16) { - size_t *out_t=(size_t *)out; - const size_t *in_t=(const size_t *)in; - - (*block)(ctx->Yi.c,ctx->EKi.c,key); - ++ctr; -#if BYTE_ORDER == LITTLE_ENDIAN -#ifdef BSWAP4 - ctx->Yi.d[3] = BSWAP4(ctr); -#else - PUTU32(ctx->Yi.c+12,ctr); -#endif -#else /* BIG_ENDIAN */ - ctx->Yi.d[3] = ctr; -#endif - for (i=0; i<16/sizeof(size_t); ++i) - out_t[i] = in_t[i] ^ ctx->EKi.t[i]; - out += 16; - in += 16; - len -= 16; - } - GHASH(ctx,out-j,j); - } -#else - while (len>=16) { - size_t *out_t=(size_t *)out; - const size_t *in_t=(const size_t *)in; - - (*block)(ctx->Yi.c,ctx->EKi.c,key); - ++ctr; -#if BYTE_ORDER == LITTLE_ENDIAN -#ifdef BSWAP4 - ctx->Yi.d[3] = BSWAP4(ctr); -#else - PUTU32(ctx->Yi.c+12,ctr); -#endif -#else /* BIG_ENDIAN */ - ctx->Yi.d[3] = ctr; -#endif - for (i=0; i<16/sizeof(size_t); ++i) - ctx->Xi.t[i] ^= - out_t[i] = in_t[i]^ctx->EKi.t[i]; - GCM_MUL(ctx,Xi); - out += 16; - in += 16; - len -= 16; - } -#endif - if (len) { - (*block)(ctx->Yi.c,ctx->EKi.c,key); - ++ctr; -#if BYTE_ORDER == LITTLE_ENDIAN -#ifdef BSWAP4 - ctx->Yi.d[3] = BSWAP4(ctr); -#else - PUTU32(ctx->Yi.c+12,ctr); -#endif -#else /* BIG_ENDIAN */ - ctx->Yi.d[3] = ctr; -#endif - while (len--) { - ctx->Xi.c[n] ^= out[n] = in[n]^ctx->EKi.c[n]; - ++n; + for (i = 0; i < 16/sizeof(size_t); ++i) + out_t[i] = in_t[i] ^ + ctx->EKi.t[i]; + out += 16; + in += 16; + j -= 16; + } + GHASH(ctx, out - GHASH_CHUNK, GHASH_CHUNK); + len -= GHASH_CHUNK; } - } + if ((i = (len & (size_t)-16))) { + size_t j = i; - ctx->mres = n; - return 0; - } while(0); + while (len >= 16) { + size_t *out_t = (size_t *)out; + const size_t *in_t = (const size_t *)in; + + (*block)(ctx->Yi.c, ctx->EKi.c, key); + ++ctr; +#if BYTE_ORDER == LITTLE_ENDIAN +#ifdef BSWAP4 + ctx->Yi.d[3] = BSWAP4(ctr); +#else + PUTU32(ctx->Yi.c + 12, ctr); #endif - for (i=0;iYi.c,ctx->EKi.c,key); +#else /* BIG_ENDIAN */ + ctx->Yi.d[3] = ctr; +#endif + for (i = 0; i < 16/sizeof(size_t); ++i) + out_t[i] = in_t[i] ^ + ctx->EKi.t[i]; + out += 16; + in += 16; + len -= 16; + } + GHASH(ctx, out - j, j); + } +#else + while (len >= 16) { + size_t *out_t = (size_t *)out; + const size_t *in_t = (const size_t *)in; + + (*block)(ctx->Yi.c, ctx->EKi.c, key); + ++ctr; +#if BYTE_ORDER == LITTLE_ENDIAN +#ifdef BSWAP4 + ctx->Yi.d[3] = BSWAP4(ctr); +#else + PUTU32(ctx->Yi.c + 12, ctr); +#endif +#else /* BIG_ENDIAN */ + ctx->Yi.d[3] = ctr; +#endif + for (i = 0; i < 16/sizeof(size_t); ++i) + ctx->Xi.t[i] ^= + out_t[i] = in_t[i] ^ ctx->EKi.t[i]; + GCM_MUL(ctx, Xi); + out += 16; + in += 16; + len -= 16; + } +#endif + if (len) { + (*block)(ctx->Yi.c, ctx->EKi.c, key); + ++ctr; +#if BYTE_ORDER == LITTLE_ENDIAN +#ifdef BSWAP4 + ctx->Yi.d[3] = BSWAP4(ctr); +#else + PUTU32(ctx->Yi.c + 12, ctr); +#endif +#else /* BIG_ENDIAN */ + ctx->Yi.d[3] = ctr; +#endif + while (len--) { + ctx->Xi.c[n] ^= out[n] = in[n] ^ + ctx->EKi.c[n]; + ++n; + } + } + + ctx->mres = n; + return 0; + } while (0); +#endif + for (i = 0; i < len; ++i) { + if (n == 0) { + (*block)(ctx->Yi.c, ctx->EKi.c, key); ++ctr; #if BYTE_ORDER == LITTLE_ENDIAN #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else - PUTU32(ctx->Yi.c+12,ctr); + PUTU32(ctx->Yi.c + 12, ctr); #endif #else /* BIG_ENDIAN */ ctx->Yi.d[3] = ctr; #endif } - ctx->Xi.c[n] ^= out[i] = in[i]^ctx->EKi.c[n]; - n = (n+1)%16; - if (n==0) - GCM_MUL(ctx,Xi); + ctx->Xi.c[n] ^= out[i] = in[i] ^ ctx->EKi.c[n]; + n = (n + 1) % 16; + if (n == 0) + GCM_MUL(ctx, Xi); } ctx->mres = n; return 0; } +LCRYPTO_ALIAS(CRYPTO_gcm128_encrypt); -int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len) +int +CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, + const unsigned char *in, unsigned char *out, + size_t len) { unsigned int n, ctr; size_t i; - u64 mlen = ctx->len.u[1]; + u64 mlen = ctx->len.u[1]; block128_f block = ctx->block; - void *key = ctx->key; + void *key = ctx->key; #ifdef GCM_FUNCREF_4BIT - void (*gcm_gmult_p)(u64 Xi[2],const u128 Htable[16]) = ctx->gmult; + void (*gcm_gmult_p)(u64 Xi[2], const u128 Htable[16]) = ctx->gmult; # ifdef GHASH - void (*gcm_ghash_p)(u64 Xi[2],const u128 Htable[16], - const u8 *inp,size_t len) = ctx->ghash; + void (*gcm_ghash_p)(u64 Xi[2], const u128 Htable[16], + const u8 *inp, size_t len) = ctx->ghash; # endif #endif mlen += len; - if (mlen>((U64(1)<<36)-32) || (sizeof(len)==8 && mlen ((U64(1) << 36) - 32) || (sizeof(len) == 8 && mlen < len)) return -1; ctx->len.u[1] = mlen; if (ctx->ares) { /* First call to decrypt finalizes GHASH(AAD) */ - GCM_MUL(ctx,Xi); + GCM_MUL(ctx, Xi); ctx->ares = 0; } @@ -1098,7 +1154,7 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, #ifdef BSWAP4 ctr = BSWAP4(ctx->Yi.d[3]); #else - ctr = GETU32(ctx->Yi.c+12); + ctr = GETU32(ctx->Yi.c + 12); #endif #else /* BIG_ENDIAN */ ctr = ctx->Yi.d[3]; @@ -1106,179 +1162,185 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, n = ctx->mres; #if !defined(OPENSSL_SMALL_FOOTPRINT) - if (16%sizeof(size_t) == 0) do { /* always true actually */ - if (n) { - while (n && len) { - u8 c = *(in++); - *(out++) = c^ctx->EKi.c[n]; - ctx->Xi.c[n] ^= c; - --len; - n = (n+1)%16; + if (16 % sizeof(size_t) == 0) + do { /* always true actually */ + if (n) { + while (n && len) { + u8 c = *(in++); + *(out++) = c ^ ctx->EKi.c[n]; + ctx->Xi.c[n] ^= c; + --len; + n = (n + 1) % 16; + } + if (n == 0) + GCM_MUL(ctx, Xi); + else { + ctx->mres = n; + return 0; + } } - if (n==0) GCM_MUL (ctx,Xi); - else { - ctx->mres = n; - return 0; - } - } #ifdef __STRICT_ALIGNMENT - if (((size_t)in|(size_t)out)%sizeof(size_t) != 0) - break; + if (((size_t)in|(size_t)out) % sizeof(size_t) != 0) + break; #endif #if defined(GHASH) && defined(GHASH_CHUNK) - while (len>=GHASH_CHUNK) { - size_t j=GHASH_CHUNK; + while (len >= GHASH_CHUNK) { + size_t j = GHASH_CHUNK; - GHASH(ctx,in,GHASH_CHUNK); - while (j) { - size_t *out_t=(size_t *)out; - const size_t *in_t=(const size_t *)in; + GHASH(ctx, in, GHASH_CHUNK); + while (j) { + size_t *out_t = (size_t *)out; + const size_t *in_t = (const size_t *)in; - (*block)(ctx->Yi.c,ctx->EKi.c,key); - ++ctr; + (*block)(ctx->Yi.c, ctx->EKi.c, key); + ++ctr; +#if BYTE_ORDER == LITTLE_ENDIAN +#ifdef BSWAP4 + ctx->Yi.d[3] = BSWAP4(ctr); +#else + PUTU32(ctx->Yi.c + 12, ctr); +#endif +#else /* BIG_ENDIAN */ + ctx->Yi.d[3] = ctr; +#endif + for (i = 0; i < 16/sizeof(size_t); ++i) + out_t[i] = in_t[i] ^ + ctx->EKi.t[i]; + out += 16; + in += 16; + j -= 16; + } + len -= GHASH_CHUNK; + } + if ((i = (len & (size_t)-16))) { + GHASH(ctx, in, i); + while (len >= 16) { + size_t *out_t = (size_t *)out; + const size_t *in_t = (const size_t *)in; + + (*block)(ctx->Yi.c, ctx->EKi.c, key); + ++ctr; +#if BYTE_ORDER == LITTLE_ENDIAN +#ifdef BSWAP4 + ctx->Yi.d[3] = BSWAP4(ctr); +#else + PUTU32(ctx->Yi.c + 12, ctr); +#endif +#else /* BIG_ENDIAN */ + ctx->Yi.d[3] = ctr; +#endif + for (i = 0; i < 16/sizeof(size_t); ++i) + out_t[i] = in_t[i] ^ + ctx->EKi.t[i]; + out += 16; + in += 16; + len -= 16; + } + } +#else + while (len >= 16) { + size_t *out_t = (size_t *)out; + const size_t *in_t = (const size_t *)in; + + (*block)(ctx->Yi.c, ctx->EKi.c, key); + ++ctr; #if BYTE_ORDER == LITTLE_ENDIAN #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else - PUTU32(ctx->Yi.c+12,ctr); + PUTU32(ctx->Yi.c + 12, ctr); #endif #else /* BIG_ENDIAN */ ctx->Yi.d[3] = ctr; #endif - for (i=0; i<16/sizeof(size_t); ++i) - out_t[i] = in_t[i]^ctx->EKi.t[i]; - out += 16; - in += 16; - j -= 16; - } - len -= GHASH_CHUNK; - } - if ((i = (len&(size_t)-16))) { - GHASH(ctx,in,i); - while (len>=16) { - size_t *out_t=(size_t *)out; - const size_t *in_t=(const size_t *)in; - - (*block)(ctx->Yi.c,ctx->EKi.c,key); - ++ctr; -#if BYTE_ORDER == LITTLE_ENDIAN -#ifdef BSWAP4 - ctx->Yi.d[3] = BSWAP4(ctr); -#else - PUTU32(ctx->Yi.c+12,ctr); -#endif -#else /* BIG_ENDIAN */ - ctx->Yi.d[3] = ctr; -#endif - for (i=0; i<16/sizeof(size_t); ++i) - out_t[i] = in_t[i]^ctx->EKi.t[i]; - out += 16; - in += 16; - len -= 16; - } - } -#else - while (len>=16) { - size_t *out_t=(size_t *)out; - const size_t *in_t=(const size_t *)in; - - (*block)(ctx->Yi.c,ctx->EKi.c,key); - ++ctr; -#if BYTE_ORDER == LITTLE_ENDIAN -#ifdef BSWAP4 - ctx->Yi.d[3] = BSWAP4(ctr); -#else - PUTU32(ctx->Yi.c+12,ctr); -#endif -#else /* BIG_ENDIAN */ - ctx->Yi.d[3] = ctr; -#endif - for (i=0; i<16/sizeof(size_t); ++i) { - size_t c = in[i]; - out[i] = c^ctx->EKi.t[i]; - ctx->Xi.t[i] ^= c; + for (i = 0; i < 16/sizeof(size_t); ++i) { + size_t c = in[i]; + out[i] = c ^ ctx->EKi.t[i]; + ctx->Xi.t[i] ^= c; + } + GCM_MUL(ctx, Xi); + out += 16; + in += 16; + len -= 16; } - GCM_MUL(ctx,Xi); - out += 16; - in += 16; - len -= 16; - } #endif - if (len) { - (*block)(ctx->Yi.c,ctx->EKi.c,key); - ++ctr; + if (len) { + (*block)(ctx->Yi.c, ctx->EKi.c, key); + ++ctr; #if BYTE_ORDER == LITTLE_ENDIAN #ifdef BSWAP4 - ctx->Yi.d[3] = BSWAP4(ctr); + ctx->Yi.d[3] = BSWAP4(ctr); #else - PUTU32(ctx->Yi.c+12,ctr); + PUTU32(ctx->Yi.c + 12, ctr); #endif #else /* BIG_ENDIAN */ - ctx->Yi.d[3] = ctr; + ctx->Yi.d[3] = ctr; #endif - while (len--) { - u8 c = in[n]; - ctx->Xi.c[n] ^= c; - out[n] = c^ctx->EKi.c[n]; - ++n; + while (len--) { + u8 c = in[n]; + ctx->Xi.c[n] ^= c; + out[n] = c ^ ctx->EKi.c[n]; + ++n; + } } - } - ctx->mres = n; - return 0; - } while(0); + ctx->mres = n; + return 0; + } while (0); #endif - for (i=0;iYi.c,ctx->EKi.c,key); + if (n == 0) { + (*block)(ctx->Yi.c, ctx->EKi.c, key); ++ctr; #if BYTE_ORDER == LITTLE_ENDIAN #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else - PUTU32(ctx->Yi.c+12,ctr); + PUTU32(ctx->Yi.c + 12, ctr); #endif #else /* BIG_ENDIAN */ ctx->Yi.d[3] = ctr; #endif } c = in[i]; - out[i] = c^ctx->EKi.c[n]; + out[i] = c ^ ctx->EKi.c[n]; ctx->Xi.c[n] ^= c; - n = (n+1)%16; - if (n==0) - GCM_MUL(ctx,Xi); + n = (n + 1) % 16; + if (n == 0) + GCM_MUL(ctx, Xi); } ctx->mres = n; return 0; } +LCRYPTO_ALIAS(CRYPTO_gcm128_decrypt); -int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len, ctr128_f stream) +int +CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, + const unsigned char *in, unsigned char *out, + size_t len, ctr128_f stream) { unsigned int n, ctr; size_t i; - u64 mlen = ctx->len.u[1]; - void *key = ctx->key; + u64 mlen = ctx->len.u[1]; + void *key = ctx->key; #ifdef GCM_FUNCREF_4BIT - void (*gcm_gmult_p)(u64 Xi[2],const u128 Htable[16]) = ctx->gmult; + void (*gcm_gmult_p)(u64 Xi[2], const u128 Htable[16]) = ctx->gmult; # ifdef GHASH - void (*gcm_ghash_p)(u64 Xi[2],const u128 Htable[16], - const u8 *inp,size_t len) = ctx->ghash; + void (*gcm_ghash_p)(u64 Xi[2], const u128 Htable[16], + const u8 *inp, size_t len) = ctx->ghash; # endif #endif mlen += len; - if (mlen>((U64(1)<<36)-32) || (sizeof(len)==8 && mlen ((U64(1) << 36) - 32) || (sizeof(len) == 8 && mlen < len)) return -1; ctx->len.u[1] = mlen; if (ctx->ares) { /* First call to encrypt finalizes GHASH(AAD) */ - GCM_MUL(ctx,Xi); + GCM_MUL(ctx, Xi); ctx->ares = 0; } @@ -1286,7 +1348,7 @@ int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, #ifdef BSWAP4 ctr = BSWAP4(ctx->Yi.d[3]); #else - ctr = GETU32(ctx->Yi.c+12); + ctr = GETU32(ctx->Yi.c + 12); #endif #else /* BIG_ENDIAN */ ctr = ctx->Yi.d[3]; @@ -1295,76 +1357,78 @@ int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, n = ctx->mres; if (n) { while (n && len) { - ctx->Xi.c[n] ^= *(out++) = *(in++)^ctx->EKi.c[n]; + ctx->Xi.c[n] ^= *(out++) = *(in++) ^ ctx->EKi.c[n]; --len; - n = (n+1)%16; + n = (n + 1) % 16; } - if (n==0) GCM_MUL(ctx,Xi); + if (n == 0) + GCM_MUL(ctx, Xi); else { ctx->mres = n; return 0; } } #if defined(GHASH) && !defined(OPENSSL_SMALL_FOOTPRINT) - while (len>=GHASH_CHUNK) { - (*stream)(in,out,GHASH_CHUNK/16,key,ctx->Yi.c); + while (len >= GHASH_CHUNK) { + (*stream)(in, out, GHASH_CHUNK/16, key, ctx->Yi.c); ctr += GHASH_CHUNK/16; #if BYTE_ORDER == LITTLE_ENDIAN #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else - PUTU32(ctx->Yi.c+12,ctr); + PUTU32(ctx->Yi.c + 12, ctr); #endif #else /* BIG_ENDIAN */ ctx->Yi.d[3] = ctr; #endif - GHASH(ctx,out,GHASH_CHUNK); + GHASH(ctx, out, GHASH_CHUNK); out += GHASH_CHUNK; - in += GHASH_CHUNK; + in += GHASH_CHUNK; len -= GHASH_CHUNK; } #endif - if ((i = (len&(size_t)-16))) { - size_t j=i/16; + if ((i = (len & (size_t)-16))) { + size_t j = i/16; - (*stream)(in,out,j,key,ctx->Yi.c); + (*stream)(in, out, j, key, ctx->Yi.c); ctr += (unsigned int)j; #if BYTE_ORDER == LITTLE_ENDIAN #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else - PUTU32(ctx->Yi.c+12,ctr); + PUTU32(ctx->Yi.c + 12, ctr); #endif #else /* BIG_ENDIAN */ ctx->Yi.d[3] = ctr; #endif - in += i; + in += i; len -= i; #if defined(GHASH) - GHASH(ctx,out,i); + GHASH(ctx, out, i); out += i; #else while (j--) { - for (i=0;i<16;++i) ctx->Xi.c[i] ^= out[i]; - GCM_MUL(ctx,Xi); + for (i = 0; i < 16; ++i) + ctx->Xi.c[i] ^= out[i]; + GCM_MUL(ctx, Xi); out += 16; } #endif } if (len) { - (*ctx->block)(ctx->Yi.c,ctx->EKi.c,key); + (*ctx->block)(ctx->Yi.c, ctx->EKi.c, key); ++ctr; #if BYTE_ORDER == LITTLE_ENDIAN #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else - PUTU32(ctx->Yi.c+12,ctr); + PUTU32(ctx->Yi.c + 12, ctr); #endif #else /* BIG_ENDIAN */ ctx->Yi.d[3] = ctr; #endif while (len--) { - ctx->Xi.c[n] ^= out[n] = in[n]^ctx->EKi.c[n]; + ctx->Xi.c[n] ^= out[n] = in[n] ^ ctx->EKi.c[n]; ++n; } } @@ -1372,31 +1436,33 @@ int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, ctx->mres = n; return 0; } +LCRYPTO_ALIAS(CRYPTO_gcm128_encrypt_ctr32); -int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len,ctr128_f stream) +int +CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, + const unsigned char *in, unsigned char *out, + size_t len, ctr128_f stream) { unsigned int n, ctr; size_t i; - u64 mlen = ctx->len.u[1]; - void *key = ctx->key; + u64 mlen = ctx->len.u[1]; + void *key = ctx->key; #ifdef GCM_FUNCREF_4BIT - void (*gcm_gmult_p)(u64 Xi[2],const u128 Htable[16]) = ctx->gmult; + void (*gcm_gmult_p)(u64 Xi[2], const u128 Htable[16]) = ctx->gmult; # ifdef GHASH - void (*gcm_ghash_p)(u64 Xi[2],const u128 Htable[16], - const u8 *inp,size_t len) = ctx->ghash; + void (*gcm_ghash_p)(u64 Xi[2], const u128 Htable[16], + const u8 *inp, size_t len) = ctx->ghash; # endif #endif mlen += len; - if (mlen>((U64(1)<<36)-32) || (sizeof(len)==8 && mlen ((U64(1) << 36) - 32) || (sizeof(len) == 8 && mlen < len)) return -1; ctx->len.u[1] = mlen; if (ctx->ares) { /* First call to decrypt finalizes GHASH(AAD) */ - GCM_MUL(ctx,Xi); + GCM_MUL(ctx, Xi); ctx->ares = 0; } @@ -1404,7 +1470,7 @@ int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, #ifdef BSWAP4 ctr = BSWAP4(ctx->Yi.d[3]); #else - ctr = GETU32(ctx->Yi.c+12); + ctr = GETU32(ctx->Yi.c + 12); #endif #else /* BIG_ENDIAN */ ctr = ctx->Yi.d[3]; @@ -1414,74 +1480,76 @@ int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, if (n) { while (n && len) { u8 c = *(in++); - *(out++) = c^ctx->EKi.c[n]; + *(out++) = c ^ ctx->EKi.c[n]; ctx->Xi.c[n] ^= c; --len; - n = (n+1)%16; + n = (n + 1) % 16; } - if (n==0) GCM_MUL (ctx,Xi); + if (n == 0) + GCM_MUL(ctx, Xi); else { ctx->mres = n; return 0; } } #if defined(GHASH) && !defined(OPENSSL_SMALL_FOOTPRINT) - while (len>=GHASH_CHUNK) { - GHASH(ctx,in,GHASH_CHUNK); - (*stream)(in,out,GHASH_CHUNK/16,key,ctx->Yi.c); + while (len >= GHASH_CHUNK) { + GHASH(ctx, in, GHASH_CHUNK); + (*stream)(in, out, GHASH_CHUNK/16, key, ctx->Yi.c); ctr += GHASH_CHUNK/16; #if BYTE_ORDER == LITTLE_ENDIAN #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else - PUTU32(ctx->Yi.c+12,ctr); + PUTU32(ctx->Yi.c + 12, ctr); #endif #else /* BIG_ENDIAN */ ctx->Yi.d[3] = ctr; #endif out += GHASH_CHUNK; - in += GHASH_CHUNK; + in += GHASH_CHUNK; len -= GHASH_CHUNK; } #endif - if ((i = (len&(size_t)-16))) { - size_t j=i/16; + if ((i = (len & (size_t)-16))) { + size_t j = i/16; #if defined(GHASH) - GHASH(ctx,in,i); + GHASH(ctx, in, i); #else while (j--) { size_t k; - for (k=0;k<16;++k) ctx->Xi.c[k] ^= in[k]; - GCM_MUL(ctx,Xi); + for (k = 0; k < 16; ++k) + ctx->Xi.c[k] ^= in[k]; + GCM_MUL(ctx, Xi); in += 16; } - j = i/16; + j = i/16; in -= i; #endif - (*stream)(in,out,j,key,ctx->Yi.c); + (*stream)(in, out, j, key, ctx->Yi.c); ctr += (unsigned int)j; #if BYTE_ORDER == LITTLE_ENDIAN #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else - PUTU32(ctx->Yi.c+12,ctr); + PUTU32(ctx->Yi.c + 12, ctr); #endif #else /* BIG_ENDIAN */ ctx->Yi.d[3] = ctr; #endif out += i; - in += i; + in += i; len -= i; } if (len) { - (*ctx->block)(ctx->Yi.c,ctx->EKi.c,key); + (*ctx->block)(ctx->Yi.c, ctx->EKi.c, key); ++ctr; #if BYTE_ORDER == LITTLE_ENDIAN #ifdef BSWAP4 ctx->Yi.d[3] = BSWAP4(ctr); #else - PUTU32(ctx->Yi.c+12,ctr); + PUTU32(ctx->Yi.c + 12, ctr); #endif #else /* BIG_ENDIAN */ ctx->Yi.d[3] = ctr; @@ -1489,7 +1557,7 @@ int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, while (len--) { u8 c = in[n]; ctx->Xi.c[n] ^= c; - out[n] = c^ctx->EKi.c[n]; + out[n] = c ^ ctx->EKi.c[n]; ++n; } } @@ -1497,18 +1565,20 @@ int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, ctx->mres = n; return 0; } +LCRYPTO_ALIAS(CRYPTO_gcm128_decrypt_ctr32); -int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx,const unsigned char *tag, - size_t len) +int +CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag, + size_t len) { - u64 alen = ctx->len.u[0]<<3; - u64 clen = ctx->len.u[1]<<3; + u64 alen = ctx->len.u[0] << 3; + u64 clen = ctx->len.u[1] << 3; #ifdef GCM_FUNCREF_4BIT - void (*gcm_gmult_p)(u64 Xi[2],const u128 Htable[16]) = ctx->gmult; + void (*gcm_gmult_p)(u64 Xi[2], const u128 Htable[16]) = ctx->gmult; #endif if (ctx->mres || ctx->ares) - GCM_MUL(ctx,Xi); + GCM_MUL(ctx, Xi); #if BYTE_ORDER == LITTLE_ENDIAN #ifdef BSWAP8 @@ -1521,42 +1591,50 @@ int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx,const unsigned char *tag, ctx->len.u[0] = alen; ctx->len.u[1] = clen; - alen = (u64)GETU32(p) <<32|GETU32(p+4); - clen = (u64)GETU32(p+8)<<32|GETU32(p+12); + alen = (u64)GETU32(p) << 32|GETU32(p + 4); + clen = (u64)GETU32(p + 8) << 32|GETU32(p + 12); } #endif #endif ctx->Xi.u[0] ^= alen; ctx->Xi.u[1] ^= clen; - GCM_MUL(ctx,Xi); + GCM_MUL(ctx, Xi); ctx->Xi.u[0] ^= ctx->EK0.u[0]; ctx->Xi.u[1] ^= ctx->EK0.u[1]; - if (tag && len<=sizeof(ctx->Xi)) - return memcmp(ctx->Xi.c,tag,len); + if (tag && len <= sizeof(ctx->Xi)) + return memcmp(ctx->Xi.c, tag, len); else return -1; } +LCRYPTO_ALIAS(CRYPTO_gcm128_finish); -void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len) +void +CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len) { CRYPTO_gcm128_finish(ctx, NULL, 0); - memcpy(tag, ctx->Xi.c, len<=sizeof(ctx->Xi.c)?len:sizeof(ctx->Xi.c)); + memcpy(tag, ctx->Xi.c, + len <= sizeof(ctx->Xi.c) ? len : sizeof(ctx->Xi.c)); } +LCRYPTO_ALIAS(CRYPTO_gcm128_tag); -GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block) +GCM128_CONTEXT * +CRYPTO_gcm128_new(void *key, block128_f block) { GCM128_CONTEXT *ret; if ((ret = malloc(sizeof(GCM128_CONTEXT)))) - CRYPTO_gcm128_init(ret,key,block); + CRYPTO_gcm128_init(ret, key, block); return ret; } +LCRYPTO_ALIAS(CRYPTO_gcm128_new); -void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx) +void +CRYPTO_gcm128_release(GCM128_CONTEXT *ctx) { freezero(ctx, sizeof(*ctx)); } +LCRYPTO_ALIAS(CRYPTO_gcm128_release); diff --git a/lib/libcrypto/modes/modes.h b/lib/libcrypto/modes/modes.h index 44d8326b5..53fa9afb0 100644 --- a/lib/libcrypto/modes/modes.h +++ b/lib/libcrypto/modes/modes.h @@ -1,4 +1,4 @@ -/* $OpenBSD: modes.h,v 1.5 2023/04/25 17:54:10 tb Exp $ */ +/* $OpenBSD: modes.h,v 1.6 2023/07/08 14:55:36 beck Exp $ */ /* ==================================================================== * Copyright (c) 2008 The OpenSSL Project. All rights reserved. * @@ -13,105 +13,105 @@ extern "C" { #endif typedef void (*block128_f)(const unsigned char in[16], - unsigned char out[16], - const void *key); + unsigned char out[16], + const void *key); typedef void (*cbc128_f)(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], int enc); + size_t len, const void *key, + unsigned char ivec[16], int enc); typedef void (*ctr128_f)(const unsigned char *in, unsigned char *out, - size_t blocks, const void *key, - const unsigned char ivec[16]); + size_t blocks, const void *key, + const unsigned char ivec[16]); typedef void (*ccm128_f)(const unsigned char *in, unsigned char *out, - size_t blocks, const void *key, - const unsigned char ivec[16],unsigned char cmac[16]); + size_t blocks, const void *key, + const unsigned char ivec[16], unsigned char cmac[16]); void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], block128_f block); + size_t len, const void *key, + unsigned char ivec[16], block128_f block); void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], block128_f block); + size_t len, const void *key, + unsigned char ivec[16], block128_f block); void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], unsigned char ecount_buf[16], - unsigned int *num, block128_f block); + size_t len, const void *key, + unsigned char ivec[16], unsigned char ecount_buf[16], + unsigned int *num, block128_f block); void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], unsigned char ecount_buf[16], - unsigned int *num, ctr128_f ctr); + size_t len, const void *key, + unsigned char ivec[16], unsigned char ecount_buf[16], + unsigned int *num, ctr128_f ctr); void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], int *num, - block128_f block); + size_t len, const void *key, + unsigned char ivec[16], int *num, + block128_f block); void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], int *num, - int enc, block128_f block); + size_t len, const void *key, + unsigned char ivec[16], int *num, + int enc, block128_f block); void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const void *key, - unsigned char ivec[16], int *num, - int enc, block128_f block); + size_t length, const void *key, + unsigned char ivec[16], int *num, + int enc, block128_f block); void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out, - size_t bits, const void *key, - unsigned char ivec[16], int *num, - int enc, block128_f block); + size_t bits, const void *key, + unsigned char ivec[16], int *num, + int enc, block128_f block); typedef struct gcm128_context GCM128_CONTEXT; GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block); -void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx,void *key,block128_f block); +void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, block128_f block); void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv, - size_t len); + size_t len); int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad, - size_t len); + size_t len); int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len); + const unsigned char *in, unsigned char *out, + size_t len); int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len); + const unsigned char *in, unsigned char *out, + size_t len); int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len, ctr128_f stream); + const unsigned char *in, unsigned char *out, + size_t len, ctr128_f stream); int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len, ctr128_f stream); -int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx,const unsigned char *tag, - size_t len); + const unsigned char *in, unsigned char *out, + size_t len, ctr128_f stream); +int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag, + size_t len); void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len); void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx); typedef struct ccm128_context CCM128_CONTEXT; void CRYPTO_ccm128_init(CCM128_CONTEXT *ctx, - unsigned int M, unsigned int L, void *key,block128_f block); + unsigned int M, unsigned int L, void *key, block128_f block); int CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx, - const unsigned char *nonce, size_t nlen, size_t mlen); + const unsigned char *nonce, size_t nlen, size_t mlen); void CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx, - const unsigned char *aad, size_t alen); + const unsigned char *aad, size_t alen); int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, - const unsigned char *inp, unsigned char *out, size_t len); + const unsigned char *inp, unsigned char *out, size_t len); int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, - const unsigned char *inp, unsigned char *out, size_t len); + const unsigned char *inp, unsigned char *out, size_t len); int CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx, - const unsigned char *inp, unsigned char *out, size_t len, - ccm128_f stream); + const unsigned char *inp, unsigned char *out, size_t len, + ccm128_f stream); int CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx, - const unsigned char *inp, unsigned char *out, size_t len, - ccm128_f stream); + const unsigned char *inp, unsigned char *out, size_t len, + ccm128_f stream); size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len); typedef struct xts128_context XTS128_CONTEXT; int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], - const unsigned char *inp, unsigned char *out, size_t len, int enc); + const unsigned char *inp, unsigned char *out, size_t len, int enc); #ifdef __cplusplus } diff --git a/lib/libcrypto/modes/modes_local.h b/lib/libcrypto/modes/modes_local.h index 943f13924..511855f2e 100644 --- a/lib/libcrypto/modes/modes_local.h +++ b/lib/libcrypto/modes/modes_local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: modes_local.h,v 1.1 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: modes_local.h,v 1.2 2023/07/08 14:55:36 beck Exp $ */ /* ==================================================================== * Copyright (c) 2010 The OpenSSL Project. All rights reserved. * @@ -30,28 +30,28 @@ typedef unsigned char u8; #if !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) #if defined(__GNUC__) && __GNUC__>=2 # if defined(__x86_64) || defined(__x86_64__) -# define BSWAP8(x) ({ u64 ret=(x); \ - asm ("bswapq %0" \ +# define BSWAP8(x) ({ u64 ret=(x); \ + asm ("bswapq %0" \ : "+r"(ret)); ret; }) -# define BSWAP4(x) ({ u32 ret=(x); \ - asm ("bswapl %0" \ +# define BSWAP4(x) ({ u32 ret=(x); \ + asm ("bswapl %0" \ : "+r"(ret)); ret; }) # elif (defined(__i386) || defined(__i386__)) -# define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \ - asm ("bswapl %0; bswapl %1" \ - : "+r"(hi),"+r"(lo)); \ +# define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \ + asm ("bswapl %0; bswapl %1" \ + : "+r"(hi),"+r"(lo)); \ (u64)hi<<32|lo; }) -# define BSWAP4(x) ({ u32 ret=(x); \ - asm ("bswapl %0" \ +# define BSWAP4(x) ({ u32 ret=(x); \ + asm ("bswapl %0" \ : "+r"(ret)); ret; }) # elif (defined(__arm__) || defined(__arm)) && !defined(__STRICT_ALIGNMENT) -# define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \ - asm ("rev %0,%0; rev %1,%1" \ - : "+r"(hi),"+r"(lo)); \ +# define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \ + asm ("rev %0,%0; rev %1,%1" \ + : "+r"(hi),"+r"(lo)); \ (u64)hi<<32|lo; }) -# define BSWAP4(x) ({ u32 ret; \ - asm ("rev %0,%1" \ - : "=r"(ret) : "r"((u32)(x))); \ +# define BSWAP4(x) ({ u32 ret; \ + asm ("rev %0,%1" \ + : "=r"(ret) : "r"((u32)(x))); \ ret; }) # endif #endif @@ -67,7 +67,9 @@ typedef unsigned char u8; /* GCM definitions */ -typedef struct { u64 hi,lo; } u128; +typedef struct { + u64 hi, lo; +} u128; #ifdef TABLE_BITS #undef TABLE_BITS @@ -80,16 +82,21 @@ typedef struct { u64 hi,lo; } u128; struct gcm128_context { /* Following 6 names follow names in GCM specification */ - union { u64 u[2]; u32 d[4]; u8 c[16]; size_t t[16/sizeof(size_t)]; } - Yi,EKi,EK0,len,Xi,H; + union { + u64 u[2]; + u32 d[4]; + u8 c[16]; + size_t t[16/sizeof(size_t)]; + } Yi, EKi, EK0, len, Xi, H; /* Relative position of Xi, H and pre-computed Htable is used * in some assembler modules, i.e. don't change the order! */ #if TABLE_BITS==8 u128 Htable[256]; #else u128 Htable[16]; - void (*gmult)(u64 Xi[2],const u128 Htable[16]); - void (*ghash)(u64 Xi[2],const u128 Htable[16],const u8 *inp,size_t len); + void (*gmult)(u64 Xi[2], const u128 Htable[16]); + void (*ghash)(u64 Xi[2], const u128 Htable[16], const u8 *inp, + size_t len); #endif unsigned int mres, ares; block128_f block; @@ -98,11 +105,14 @@ struct gcm128_context { struct xts128_context { void *key1, *key2; - block128_f block1,block2; + block128_f block1, block2; }; struct ccm128_context { - union { u64 u[2]; u8 c[16]; } nonce, cmac; + union { + u64 u[2]; + u8 c[16]; + } nonce, cmac; u64 blocks; block128_f block; void *key; diff --git a/lib/libcrypto/modes/ofb128.c b/lib/libcrypto/modes/ofb128.c index 3cf5d9815..42afd29d5 100644 --- a/lib/libcrypto/modes/ofb128.c +++ b/lib/libcrypto/modes/ofb128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ofb128.c,v 1.5 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: ofb128.c,v 1.7 2023/07/08 14:56:54 beck Exp $ */ /* ==================================================================== * Copyright (c) 2008 The OpenSSL Project. All rights reserved. * @@ -7,7 +7,7 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in @@ -63,57 +63,62 @@ * used. The extra state information to record how much of the * 128bit block we have used is contained in *num; */ -void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], int *num, - block128_f block) +void +CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], int *num, + block128_f block) { unsigned int n; - size_t l=0; + size_t l = 0; n = *num; #if !defined(OPENSSL_SMALL_FOOTPRINT) - if (16%sizeof(size_t) == 0) do { /* always true actually */ - while (n && len) { - *(out++) = *(in++) ^ ivec[n]; - --len; - n = (n+1) % 16; - } -#ifdef __STRICT_ALIGNMENT - if (((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) != 0) - break; -#endif - while (len>=16) { - (*block)(ivec, ivec, key); - for (; n<16; n+=sizeof(size_t)) - *(size_t*)(out+n) = - *(size_t*)(in+n) ^ *(size_t*)(ivec+n); - len -= 16; - out += 16; - in += 16; - n = 0; - } - if (len) { - (*block)(ivec, ivec, key); - while (len--) { - out[n] = in[n] ^ ivec[n]; - ++n; + if (16 % sizeof(size_t) == 0) + do { /* always true actually */ + while (n && len) { + *(out++) = *(in++) ^ ivec[n]; + --len; + n = (n + 1) % 16; } - } - *num = n; - return; - } while(0); +#ifdef __STRICT_ALIGNMENT + if (((size_t)in|(size_t)out|(size_t)ivec) % + sizeof(size_t) != 0) + break; +#endif + while (len >= 16) { + (*block)(ivec, ivec, key); + for (; n < 16; n += sizeof(size_t)) + *(size_t *)(out + n) = + *(size_t *)(in + n) ^ *(size_t *)(ivec + + n); + len -= 16; + out += 16; + in += 16; + n = 0; + } + if (len) { + (*block)(ivec, ivec, key); + while (len--) { + out[n] = in[n] ^ ivec[n]; + ++n; + } + } + *num = n; + return; + } while (0); /* the rest would be commonly eliminated by x86* compiler */ #endif - while (lblock2)(tweak.c,tweak.c,ctx->key2); + (*ctx->block2)(tweak.c, tweak.c, ctx->key2); - if (!enc && (len%16)) len-=16; + if (!enc && (len % 16)) + len -= 16; - while (len>=16) { + while (len >= 16) { #ifdef __STRICT_ALIGNMENT - memcpy(scratch.c,inp,16); + memcpy(scratch.c, inp, 16); scratch.u[0] ^= tweak.u[0]; scratch.u[1] ^= tweak.u[1]; #else - scratch.u[0] = ((u64*)inp)[0]^tweak.u[0]; - scratch.u[1] = ((u64*)inp)[1]^tweak.u[1]; + scratch.u[0] = ((u64 *)inp)[0] ^ tweak.u[0]; + scratch.u[1] = ((u64 *)inp)[1] ^ tweak.u[1]; #endif - (*ctx->block1)(scratch.c,scratch.c,ctx->key1); + (*ctx->block1)(scratch.c, scratch.c, ctx->key1); #ifdef __STRICT_ALIGNMENT scratch.u[0] ^= tweak.u[0]; scratch.u[1] ^= tweak.u[1]; - memcpy(out,scratch.c,16); + memcpy(out, scratch.c, 16); #else - ((u64*)out)[0] = scratch.u[0]^=tweak.u[0]; - ((u64*)out)[1] = scratch.u[1]^=tweak.u[1]; + ((u64 *)out)[0] = scratch.u[0] ^= tweak.u[0]; + ((u64 *)out)[1] = scratch.u[1] ^= tweak.u[1]; #endif inp += 16; out += 16; len -= 16; - if (len==0) return 0; + if (len == 0) + return 0; #if BYTE_ORDER == LITTLE_ENDIAN - unsigned int carry,res; + unsigned int carry, res; - res = 0x87&(((int)tweak.d[3])>>31); - carry = (unsigned int)(tweak.u[0]>>63); - tweak.u[0] = (tweak.u[0]<<1)^res; - tweak.u[1] = (tweak.u[1]<<1)|carry; + res = 0x87 & (((int)tweak.d[3]) >> 31); + carry = (unsigned int)(tweak.u[0] >> 63); + tweak.u[0] = (tweak.u[0] << 1) ^ res; + tweak.u[1] = (tweak.u[1] << 1)|carry; #else /* BIG_ENDIAN */ size_t c; - for (c=0,i=0;i<16;++i) { + for (c = 0, i = 0; i < 16; ++i) { /*+ substitutes for |, because c is 1 bit */ - c += ((size_t)tweak.c[i])<<1; + c += ((size_t)tweak.c[i]) << 1; tweak.c[i] = (u8)c; - c = c>>8; + c = c >> 8; } - tweak.c[0] ^= (u8)(0x87&(0-c)); + tweak.c[0] ^= (u8)(0x87 & (0 - c)); #endif } if (enc) { - for (i=0;iblock1)(scratch.c,scratch.c,ctx->key1); + (*ctx->block1)(scratch.c, scratch.c, ctx->key1); scratch.u[0] ^= tweak.u[0]; scratch.u[1] ^= tweak.u[1]; - memcpy(out-16,scratch.c,16); - } - else { - union { u64 u[2]; u8 c[16]; } tweak1; + memcpy(out - 16, scratch.c, 16); + } else { + union { + u64 u[2]; + u8 c[16]; + } tweak1; #if BYTE_ORDER == LITTLE_ENDIAN - unsigned int carry,res; + unsigned int carry, res; - res = 0x87&(((int)tweak.d[3])>>31); - carry = (unsigned int)(tweak.u[0]>>63); - tweak1.u[0] = (tweak.u[0]<<1)^res; - tweak1.u[1] = (tweak.u[1]<<1)|carry; + res = 0x87 & (((int)tweak.d[3]) >> 31); + carry = (unsigned int)(tweak.u[0] >> 63); + tweak1.u[0] = (tweak.u[0] << 1) ^ res; + tweak1.u[1] = (tweak.u[1] << 1)|carry; #else size_t c; - for (c=0,i=0;i<16;++i) { + for (c = 0, i = 0; i < 16; ++i) { /*+ substitutes for |, because c is 1 bit */ - c += ((size_t)tweak.c[i])<<1; + c += ((size_t)tweak.c[i]) << 1; tweak1.c[i] = (u8)c; - c = c>>8; + c = c >> 8; } - tweak1.c[0] ^= (u8)(0x87&(0-c)); + tweak1.c[0] ^= (u8)(0x87 & (0 - c)); #endif #ifdef __STRICT_ALIGNMENT - memcpy(scratch.c,inp,16); + memcpy(scratch.c, inp, 16); scratch.u[0] ^= tweak1.u[0]; scratch.u[1] ^= tweak1.u[1]; #else - scratch.u[0] = ((u64*)inp)[0]^tweak1.u[0]; - scratch.u[1] = ((u64*)inp)[1]^tweak1.u[1]; + scratch.u[0] = ((u64 *)inp)[0] ^ tweak1.u[0]; + scratch.u[1] = ((u64 *)inp)[1] ^ tweak1.u[1]; #endif - (*ctx->block1)(scratch.c,scratch.c,ctx->key1); + (*ctx->block1)(scratch.c, scratch.c, ctx->key1); scratch.u[0] ^= tweak1.u[0]; scratch.u[1] ^= tweak1.u[1]; - for (i=0;iblock1)(scratch.c,scratch.c,ctx->key1); + (*ctx->block1)(scratch.c, scratch.c, ctx->key1); #ifdef __STRICT_ALIGNMENT scratch.u[0] ^= tweak.u[0]; scratch.u[1] ^= tweak.u[1]; - memcpy (out,scratch.c,16); + memcpy(out, scratch.c, 16); #else - ((u64*)out)[0] = scratch.u[0]^tweak.u[0]; - ((u64*)out)[1] = scratch.u[1]^tweak.u[1]; + ((u64 *)out)[0] = scratch.u[0] ^ tweak.u[0]; + ((u64 *)out)[1] = scratch.u[1] ^ tweak.u[1]; #endif } return 0; } +LCRYPTO_ALIAS(CRYPTO_xts128_encrypt); diff --git a/lib/libcrypto/objects/o_names.c b/lib/libcrypto/objects/o_names.c index 2cdd2f3aa..48b95d676 100644 --- a/lib/libcrypto/objects/o_names.c +++ b/lib/libcrypto/objects/o_names.c @@ -1,4 +1,4 @@ -/* $OpenBSD: o_names.c,v 1.23 2022/11/08 23:19:09 mbuhl Exp $ */ +/* $OpenBSD: o_names.c,v 1.24 2023/07/08 12:27:51 beck Exp $ */ #include #include #include @@ -47,6 +47,7 @@ OBJ_NAME_init(void) names_lh = lh_OBJ_NAME_new(); return (names_lh != NULL); } +LCRYPTO_ALIAS(OBJ_NAME_init); int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *), @@ -88,6 +89,7 @@ OBJ_NAME_new_index(unsigned long (*hash_func)(const char *), name_funcs->free_func = free_func; return (ret); } +LCRYPTO_ALIAS(OBJ_NAME_new_index); /* static int obj_name_cmp(OBJ_NAME *a, OBJ_NAME *b) */ static int @@ -157,6 +159,7 @@ OBJ_NAME_get(const char *name, int type) } } } +LCRYPTO_ALIAS(OBJ_NAME_get); int OBJ_NAME_add(const char *name, int type, const char *data) @@ -204,6 +207,7 @@ OBJ_NAME_add(const char *name, int type, const char *data) } return (1); } +LCRYPTO_ALIAS(OBJ_NAME_add); int OBJ_NAME_remove(const char *name, int type) @@ -234,6 +238,7 @@ OBJ_NAME_remove(const char *name, int type) } else return (0); } +LCRYPTO_ALIAS(OBJ_NAME_remove); struct doall { int type; @@ -262,6 +267,7 @@ OBJ_NAME_do_all(int type, void (*fn)(const OBJ_NAME *, void *arg), void *arg) lh_OBJ_NAME_doall_arg(names_lh, LHASH_DOALL_ARG_FN(do_all_fn), struct doall, &d); } +LCRYPTO_ALIAS(OBJ_NAME_do_all); struct doall_sorted { int type; @@ -311,6 +317,7 @@ OBJ_NAME_do_all_sorted(int type, void (*fn)(const OBJ_NAME *, void *arg), free(d.names); } } +LCRYPTO_ALIAS(OBJ_NAME_do_all_sorted); static int free_type; @@ -353,3 +360,4 @@ OBJ_NAME_cleanup(int type) } else lh_OBJ_NAME_down_load(names_lh) = down_load; } +LCRYPTO_ALIAS(OBJ_NAME_cleanup); diff --git a/lib/libcrypto/objects/obj_dat.c b/lib/libcrypto/objects/obj_dat.c index 7516a6d09..ff0617745 100644 --- a/lib/libcrypto/objects/obj_dat.c +++ b/lib/libcrypto/objects/obj_dat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: obj_dat.c,v 1.53 2023/05/23 11:51:12 tb Exp $ */ +/* $OpenBSD: obj_dat.c,v 1.54 2023/07/08 12:27:51 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -280,6 +280,7 @@ OBJ_cleanup(void) lh_ADDED_OBJ_free(added); added = NULL; } +LCRYPTO_ALIAS(OBJ_cleanup); int OBJ_new_nid(int num) @@ -290,6 +291,7 @@ OBJ_new_nid(int num) new_nid += num; return (i); } +LCRYPTO_ALIAS(OBJ_new_nid); int OBJ_add_object(const ASN1_OBJECT *obj) @@ -338,6 +340,7 @@ OBJ_add_object(const ASN1_OBJECT *obj) ASN1_OBJECT_free(o); return (NID_undef); } +LCRYPTO_ALIAS(OBJ_add_object); ASN1_OBJECT * OBJ_nid2obj(int n) @@ -366,6 +369,7 @@ OBJ_nid2obj(int n) } } } +LCRYPTO_ALIAS(OBJ_nid2obj); const char * OBJ_nid2sn(int n) @@ -394,6 +398,7 @@ OBJ_nid2sn(int n) } } } +LCRYPTO_ALIAS(OBJ_nid2sn); const char * OBJ_nid2ln(int n) @@ -422,6 +427,7 @@ OBJ_nid2ln(int n) } } } +LCRYPTO_ALIAS(OBJ_nid2ln); static int obj_cmp(const ASN1_OBJECT * const *ap, const unsigned int *bp) @@ -475,6 +481,7 @@ OBJ_obj2nid(const ASN1_OBJECT *a) return (NID_undef); return (nid_objs[*op].nid); } +LCRYPTO_ALIAS(OBJ_obj2nid); /* Convert an object name into an ASN1_OBJECT * if "noname" is not set then search for short and long names first. @@ -495,12 +502,14 @@ OBJ_txt2obj(const char *s, int no_name) return t2i_ASN1_OBJECT_internal(s); } +LCRYPTO_ALIAS(OBJ_txt2obj); int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *aobj, int no_name) { return i2t_ASN1_OBJECT_internal(aobj, buf, buf_len, no_name); } +LCRYPTO_ALIAS(OBJ_obj2txt); int OBJ_txt2nid(const char *s) @@ -513,6 +522,7 @@ OBJ_txt2nid(const char *s) ASN1_OBJECT_free(obj); return nid; } +LCRYPTO_ALIAS(OBJ_txt2nid); int OBJ_ln2nid(const char *s) @@ -535,6 +545,7 @@ OBJ_ln2nid(const char *s) return (NID_undef); return (nid_objs[*op].nid); } +LCRYPTO_ALIAS(OBJ_ln2nid); int OBJ_sn2nid(const char *s) @@ -557,6 +568,7 @@ OBJ_sn2nid(const char *s) return (NID_undef); return (nid_objs[*op].nid); } +LCRYPTO_ALIAS(OBJ_sn2nid); const void * OBJ_bsearch_(const void *key, const void *base, int num, int size, @@ -564,6 +576,7 @@ OBJ_bsearch_(const void *key, const void *base, int num, int size, { return OBJ_bsearch_ex_(key, base, num, size, cmp, 0); } +LCRYPTO_ALIAS(OBJ_bsearch_); const void * OBJ_bsearch_ex_(const void *key, const void *base_, int num, int size, @@ -646,6 +659,7 @@ OBJ_create_objects(BIO *in) } /* return(num); */ } +LCRYPTO_ALIAS(OBJ_create_objects); int OBJ_create(const char *oid, const char *sn, const char *ln) @@ -676,6 +690,7 @@ OBJ_create(const char *oid, const char *sn, const char *ln) free(buf); return (ok); } +LCRYPTO_ALIAS(OBJ_create); size_t OBJ_length(const ASN1_OBJECT *obj) @@ -688,6 +703,7 @@ OBJ_length(const ASN1_OBJECT *obj) return obj->length; } +LCRYPTO_ALIAS(OBJ_length); const unsigned char * OBJ_get0_data(const ASN1_OBJECT *obj) @@ -697,3 +713,4 @@ OBJ_get0_data(const ASN1_OBJECT *obj) return obj->data; } +LCRYPTO_ALIAS(OBJ_get0_data); diff --git a/lib/libcrypto/objects/obj_err.c b/lib/libcrypto/objects/obj_err.c index 50e2a0e0c..04cb4218c 100644 --- a/lib/libcrypto/objects/obj_err.c +++ b/lib/libcrypto/objects/obj_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: obj_err.c,v 1.13 2022/07/12 14:42:49 kn Exp $ */ +/* $OpenBSD: obj_err.c,v 1.14 2023/07/08 12:27:51 beck Exp $ */ /* ==================================================================== * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. * @@ -88,3 +88,4 @@ ERR_load_OBJ_strings(void) } #endif } +LCRYPTO_ALIAS(ERR_load_OBJ_strings); diff --git a/lib/libcrypto/objects/obj_lib.c b/lib/libcrypto/objects/obj_lib.c index eb06adfb9..83575c16c 100644 --- a/lib/libcrypto/objects/obj_lib.c +++ b/lib/libcrypto/objects/obj_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: obj_lib.c,v 1.17 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: obj_lib.c,v 1.18 2023/07/08 12:27:51 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -119,6 +119,7 @@ OBJ_dup(const ASN1_OBJECT *o) free(r); return (NULL); } +LCRYPTO_ALIAS(OBJ_dup); int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b) @@ -130,3 +131,4 @@ OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b) return (ret); return (memcmp(a->data, b->data, a->length)); } +LCRYPTO_ALIAS(OBJ_cmp); diff --git a/lib/libcrypto/objects/obj_xref.c b/lib/libcrypto/objects/obj_xref.c index 3e8730d1c..2318c86ce 100644 --- a/lib/libcrypto/objects/obj_xref.c +++ b/lib/libcrypto/objects/obj_xref.c @@ -1,4 +1,4 @@ -/* $OpenBSD: obj_xref.c,v 1.8 2017/01/21 04:44:43 jsing Exp $ */ +/* $OpenBSD: obj_xref.c,v 1.9 2023/07/08 12:27:51 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -151,6 +151,7 @@ OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid) *ppkey_nid = rv->pkey_id; return 1; } +LCRYPTO_ALIAS(OBJ_find_sigid_algs); int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid) @@ -182,6 +183,7 @@ OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid) *psignid = (*rv)->sign_id; return 1; } +LCRYPTO_ALIAS(OBJ_find_sigid_by_algs); int OBJ_add_sigid(int signid, int dig_id, int pkey_id) @@ -216,6 +218,7 @@ OBJ_add_sigid(int signid, int dig_id, int pkey_id) return 1; } +LCRYPTO_ALIAS(OBJ_add_sigid); static void sid_free(nid_triple *tt) @@ -235,3 +238,4 @@ OBJ_sigid_free(void) sigx_app = NULL; } } +LCRYPTO_ALIAS(OBJ_sigid_free); diff --git a/lib/libcrypto/ocsp/ocsp_asn.c b/lib/libcrypto/ocsp/ocsp_asn.c index 3f00fca10..4fbdd5fd7 100644 --- a/lib/libcrypto/ocsp/ocsp_asn.c +++ b/lib/libcrypto/ocsp/ocsp_asn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ocsp_asn.c,v 1.10 2022/01/07 09:45:52 tb Exp $ */ +/* $OpenBSD: ocsp_asn.c,v 1.11 2023/07/08 10:44:00 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -102,24 +102,28 @@ d2i_OCSP_SIGNATURE(OCSP_SIGNATURE **a, const unsigned char **in, long len) return (OCSP_SIGNATURE *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &OCSP_SIGNATURE_it); } +LCRYPTO_ALIAS(d2i_OCSP_SIGNATURE); int i2d_OCSP_SIGNATURE(OCSP_SIGNATURE *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &OCSP_SIGNATURE_it); } +LCRYPTO_ALIAS(i2d_OCSP_SIGNATURE); OCSP_SIGNATURE * OCSP_SIGNATURE_new(void) { return (OCSP_SIGNATURE *)ASN1_item_new(&OCSP_SIGNATURE_it); } +LCRYPTO_ALIAS(OCSP_SIGNATURE_new); void OCSP_SIGNATURE_free(OCSP_SIGNATURE *a) { ASN1_item_free((ASN1_VALUE *)a, &OCSP_SIGNATURE_it); } +LCRYPTO_ALIAS(OCSP_SIGNATURE_free); static const ASN1_TEMPLATE OCSP_CERTID_seq_tt[] = { { @@ -169,24 +173,28 @@ d2i_OCSP_CERTID(OCSP_CERTID **a, const unsigned char **in, long len) return (OCSP_CERTID *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &OCSP_CERTID_it); } +LCRYPTO_ALIAS(d2i_OCSP_CERTID); int i2d_OCSP_CERTID(OCSP_CERTID *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &OCSP_CERTID_it); } +LCRYPTO_ALIAS(i2d_OCSP_CERTID); OCSP_CERTID * OCSP_CERTID_new(void) { return (OCSP_CERTID *)ASN1_item_new(&OCSP_CERTID_it); } +LCRYPTO_ALIAS(OCSP_CERTID_new); void OCSP_CERTID_free(OCSP_CERTID *a) { ASN1_item_free((ASN1_VALUE *)a, &OCSP_CERTID_it); } +LCRYPTO_ALIAS(OCSP_CERTID_free); static const ASN1_TEMPLATE OCSP_ONEREQ_seq_tt[] = { { @@ -222,24 +230,28 @@ d2i_OCSP_ONEREQ(OCSP_ONEREQ **a, const unsigned char **in, long len) return (OCSP_ONEREQ *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &OCSP_ONEREQ_it); } +LCRYPTO_ALIAS(d2i_OCSP_ONEREQ); int i2d_OCSP_ONEREQ(OCSP_ONEREQ *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &OCSP_ONEREQ_it); } +LCRYPTO_ALIAS(i2d_OCSP_ONEREQ); OCSP_ONEREQ * OCSP_ONEREQ_new(void) { return (OCSP_ONEREQ *)ASN1_item_new(&OCSP_ONEREQ_it); } +LCRYPTO_ALIAS(OCSP_ONEREQ_new); void OCSP_ONEREQ_free(OCSP_ONEREQ *a) { ASN1_item_free((ASN1_VALUE *)a, &OCSP_ONEREQ_it); } +LCRYPTO_ALIAS(OCSP_ONEREQ_free); static const ASN1_TEMPLATE OCSP_REQINFO_seq_tt[] = { { @@ -289,24 +301,28 @@ d2i_OCSP_REQINFO(OCSP_REQINFO **a, const unsigned char **in, long len) return (OCSP_REQINFO *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &OCSP_REQINFO_it); } +LCRYPTO_ALIAS(d2i_OCSP_REQINFO); int i2d_OCSP_REQINFO(OCSP_REQINFO *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &OCSP_REQINFO_it); } +LCRYPTO_ALIAS(i2d_OCSP_REQINFO); OCSP_REQINFO * OCSP_REQINFO_new(void) { return (OCSP_REQINFO *)ASN1_item_new(&OCSP_REQINFO_it); } +LCRYPTO_ALIAS(OCSP_REQINFO_new); void OCSP_REQINFO_free(OCSP_REQINFO *a) { ASN1_item_free((ASN1_VALUE *)a, &OCSP_REQINFO_it); } +LCRYPTO_ALIAS(OCSP_REQINFO_free); static const ASN1_TEMPLATE OCSP_REQUEST_seq_tt[] = { { @@ -341,36 +357,42 @@ d2i_OCSP_REQUEST(OCSP_REQUEST **a, const unsigned char **in, long len) return (OCSP_REQUEST *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &OCSP_REQUEST_it); } +LCRYPTO_ALIAS(d2i_OCSP_REQUEST); int i2d_OCSP_REQUEST(OCSP_REQUEST *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &OCSP_REQUEST_it); } +LCRYPTO_ALIAS(i2d_OCSP_REQUEST); OCSP_REQUEST * d2i_OCSP_REQUEST_bio(BIO *bp, OCSP_REQUEST **a) { return ASN1_item_d2i_bio(&OCSP_REQUEST_it, bp, a); } +LCRYPTO_ALIAS(d2i_OCSP_REQUEST_bio); int i2d_OCSP_REQUEST_bio(BIO *bp, OCSP_REQUEST *a) { return ASN1_item_i2d_bio(&OCSP_REQUEST_it, bp, a); } +LCRYPTO_ALIAS(i2d_OCSP_REQUEST_bio); OCSP_REQUEST * OCSP_REQUEST_new(void) { return (OCSP_REQUEST *)ASN1_item_new(&OCSP_REQUEST_it); } +LCRYPTO_ALIAS(OCSP_REQUEST_new); void OCSP_REQUEST_free(OCSP_REQUEST *a) { ASN1_item_free((ASN1_VALUE *)a, &OCSP_REQUEST_it); } +LCRYPTO_ALIAS(OCSP_REQUEST_free); /* OCSP_RESPONSE templates */ @@ -408,24 +430,28 @@ d2i_OCSP_RESPBYTES(OCSP_RESPBYTES **a, const unsigned char **in, long len) return (OCSP_RESPBYTES *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &OCSP_RESPBYTES_it); } +LCRYPTO_ALIAS(d2i_OCSP_RESPBYTES); int i2d_OCSP_RESPBYTES(OCSP_RESPBYTES *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &OCSP_RESPBYTES_it); } +LCRYPTO_ALIAS(i2d_OCSP_RESPBYTES); OCSP_RESPBYTES * OCSP_RESPBYTES_new(void) { return (OCSP_RESPBYTES *)ASN1_item_new(&OCSP_RESPBYTES_it); } +LCRYPTO_ALIAS(OCSP_RESPBYTES_new); void OCSP_RESPBYTES_free(OCSP_RESPBYTES *a) { ASN1_item_free((ASN1_VALUE *)a, &OCSP_RESPBYTES_it); } +LCRYPTO_ALIAS(OCSP_RESPBYTES_free); static const ASN1_TEMPLATE OCSP_RESPONSE_seq_tt[] = { { @@ -461,36 +487,42 @@ d2i_OCSP_RESPONSE(OCSP_RESPONSE **a, const unsigned char **in, long len) return (OCSP_RESPONSE *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &OCSP_RESPONSE_it); } +LCRYPTO_ALIAS(d2i_OCSP_RESPONSE); int i2d_OCSP_RESPONSE(OCSP_RESPONSE *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &OCSP_RESPONSE_it); } +LCRYPTO_ALIAS(i2d_OCSP_RESPONSE); OCSP_RESPONSE * d2i_OCSP_RESPONSE_bio(BIO *bp, OCSP_RESPONSE **a) { return ASN1_item_d2i_bio(&OCSP_RESPONSE_it, bp, a); } +LCRYPTO_ALIAS(d2i_OCSP_RESPONSE_bio); int i2d_OCSP_RESPONSE_bio(BIO *bp, OCSP_RESPONSE *a) { return ASN1_item_i2d_bio(&OCSP_RESPONSE_it, bp, a); } +LCRYPTO_ALIAS(i2d_OCSP_RESPONSE_bio); OCSP_RESPONSE * OCSP_RESPONSE_new(void) { return (OCSP_RESPONSE *)ASN1_item_new(&OCSP_RESPONSE_it); } +LCRYPTO_ALIAS(OCSP_RESPONSE_new); void OCSP_RESPONSE_free(OCSP_RESPONSE *a) { ASN1_item_free((ASN1_VALUE *)a, &OCSP_RESPONSE_it); } +LCRYPTO_ALIAS(OCSP_RESPONSE_free); static const ASN1_TEMPLATE OCSP_RESPID_ch_tt[] = { { @@ -526,24 +558,28 @@ d2i_OCSP_RESPID(OCSP_RESPID **a, const unsigned char **in, long len) return (OCSP_RESPID *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &OCSP_RESPID_it); } +LCRYPTO_ALIAS(d2i_OCSP_RESPID); int i2d_OCSP_RESPID(OCSP_RESPID *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &OCSP_RESPID_it); } +LCRYPTO_ALIAS(i2d_OCSP_RESPID); OCSP_RESPID * OCSP_RESPID_new(void) { return (OCSP_RESPID *)ASN1_item_new(&OCSP_RESPID_it); } +LCRYPTO_ALIAS(OCSP_RESPID_new); void OCSP_RESPID_free(OCSP_RESPID *a) { ASN1_item_free((ASN1_VALUE *)a, &OCSP_RESPID_it); } +LCRYPTO_ALIAS(OCSP_RESPID_free); static const ASN1_TEMPLATE OCSP_REVOKEDINFO_seq_tt[] = { { @@ -579,24 +615,28 @@ d2i_OCSP_REVOKEDINFO(OCSP_REVOKEDINFO **a, const unsigned char **in, long len) return (OCSP_REVOKEDINFO *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &OCSP_REVOKEDINFO_it); } +LCRYPTO_ALIAS(d2i_OCSP_REVOKEDINFO); int i2d_OCSP_REVOKEDINFO(OCSP_REVOKEDINFO *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &OCSP_REVOKEDINFO_it); } +LCRYPTO_ALIAS(i2d_OCSP_REVOKEDINFO); OCSP_REVOKEDINFO * OCSP_REVOKEDINFO_new(void) { return (OCSP_REVOKEDINFO *)ASN1_item_new(&OCSP_REVOKEDINFO_it); } +LCRYPTO_ALIAS(OCSP_REVOKEDINFO_new); void OCSP_REVOKEDINFO_free(OCSP_REVOKEDINFO *a) { ASN1_item_free((ASN1_VALUE *)a, &OCSP_REVOKEDINFO_it); } +LCRYPTO_ALIAS(OCSP_REVOKEDINFO_free); static const ASN1_TEMPLATE OCSP_CERTSTATUS_ch_tt[] = { { @@ -639,24 +679,28 @@ d2i_OCSP_CERTSTATUS(OCSP_CERTSTATUS **a, const unsigned char **in, long len) return (OCSP_CERTSTATUS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &OCSP_CERTSTATUS_it); } +LCRYPTO_ALIAS(d2i_OCSP_CERTSTATUS); int i2d_OCSP_CERTSTATUS(OCSP_CERTSTATUS *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &OCSP_CERTSTATUS_it); } +LCRYPTO_ALIAS(i2d_OCSP_CERTSTATUS); OCSP_CERTSTATUS * OCSP_CERTSTATUS_new(void) { return (OCSP_CERTSTATUS *)ASN1_item_new(&OCSP_CERTSTATUS_it); } +LCRYPTO_ALIAS(OCSP_CERTSTATUS_new); void OCSP_CERTSTATUS_free(OCSP_CERTSTATUS *a) { ASN1_item_free((ASN1_VALUE *)a, &OCSP_CERTSTATUS_it); } +LCRYPTO_ALIAS(OCSP_CERTSTATUS_free); static const ASN1_TEMPLATE OCSP_SINGLERESP_seq_tt[] = { { @@ -713,24 +757,28 @@ d2i_OCSP_SINGLERESP(OCSP_SINGLERESP **a, const unsigned char **in, long len) return (OCSP_SINGLERESP *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &OCSP_SINGLERESP_it); } +LCRYPTO_ALIAS(d2i_OCSP_SINGLERESP); int i2d_OCSP_SINGLERESP(OCSP_SINGLERESP *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &OCSP_SINGLERESP_it); } +LCRYPTO_ALIAS(i2d_OCSP_SINGLERESP); OCSP_SINGLERESP * OCSP_SINGLERESP_new(void) { return (OCSP_SINGLERESP *)ASN1_item_new(&OCSP_SINGLERESP_it); } +LCRYPTO_ALIAS(OCSP_SINGLERESP_new); void OCSP_SINGLERESP_free(OCSP_SINGLERESP *a) { ASN1_item_free((ASN1_VALUE *)a, &OCSP_SINGLERESP_it); } +LCRYPTO_ALIAS(OCSP_SINGLERESP_free); static const ASN1_TEMPLATE OCSP_RESPDATA_seq_tt[] = { { @@ -787,24 +835,28 @@ d2i_OCSP_RESPDATA(OCSP_RESPDATA **a, const unsigned char **in, long len) return (OCSP_RESPDATA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &OCSP_RESPDATA_it); } +LCRYPTO_ALIAS(d2i_OCSP_RESPDATA); int i2d_OCSP_RESPDATA(OCSP_RESPDATA *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &OCSP_RESPDATA_it); } +LCRYPTO_ALIAS(i2d_OCSP_RESPDATA); OCSP_RESPDATA * OCSP_RESPDATA_new(void) { return (OCSP_RESPDATA *)ASN1_item_new(&OCSP_RESPDATA_it); } +LCRYPTO_ALIAS(OCSP_RESPDATA_new); void OCSP_RESPDATA_free(OCSP_RESPDATA *a) { ASN1_item_free((ASN1_VALUE *)a, &OCSP_RESPDATA_it); } +LCRYPTO_ALIAS(OCSP_RESPDATA_free); static const ASN1_TEMPLATE OCSP_BASICRESP_seq_tt[] = { { @@ -854,24 +906,28 @@ d2i_OCSP_BASICRESP(OCSP_BASICRESP **a, const unsigned char **in, long len) return (OCSP_BASICRESP *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &OCSP_BASICRESP_it); } +LCRYPTO_ALIAS(d2i_OCSP_BASICRESP); int i2d_OCSP_BASICRESP(OCSP_BASICRESP *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &OCSP_BASICRESP_it); } +LCRYPTO_ALIAS(i2d_OCSP_BASICRESP); OCSP_BASICRESP * OCSP_BASICRESP_new(void) { return (OCSP_BASICRESP *)ASN1_item_new(&OCSP_BASICRESP_it); } +LCRYPTO_ALIAS(OCSP_BASICRESP_new); void OCSP_BASICRESP_free(OCSP_BASICRESP *a) { ASN1_item_free((ASN1_VALUE *)a, &OCSP_BASICRESP_it); } +LCRYPTO_ALIAS(OCSP_BASICRESP_free); static const ASN1_TEMPLATE OCSP_CRLID_seq_tt[] = { { @@ -914,24 +970,28 @@ d2i_OCSP_CRLID(OCSP_CRLID **a, const unsigned char **in, long len) return (OCSP_CRLID *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &OCSP_CRLID_it); } +LCRYPTO_ALIAS(d2i_OCSP_CRLID); int i2d_OCSP_CRLID(OCSP_CRLID *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &OCSP_CRLID_it); } +LCRYPTO_ALIAS(i2d_OCSP_CRLID); OCSP_CRLID * OCSP_CRLID_new(void) { return (OCSP_CRLID *)ASN1_item_new(&OCSP_CRLID_it); } +LCRYPTO_ALIAS(OCSP_CRLID_new); void OCSP_CRLID_free(OCSP_CRLID *a) { ASN1_item_free((ASN1_VALUE *)a, &OCSP_CRLID_it); } +LCRYPTO_ALIAS(OCSP_CRLID_free); static const ASN1_TEMPLATE OCSP_SERVICELOC_seq_tt[] = { { @@ -967,21 +1027,25 @@ d2i_OCSP_SERVICELOC(OCSP_SERVICELOC **a, const unsigned char **in, long len) return (OCSP_SERVICELOC *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &OCSP_SERVICELOC_it); } +LCRYPTO_ALIAS(d2i_OCSP_SERVICELOC); int i2d_OCSP_SERVICELOC(OCSP_SERVICELOC *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &OCSP_SERVICELOC_it); } +LCRYPTO_ALIAS(i2d_OCSP_SERVICELOC); OCSP_SERVICELOC * OCSP_SERVICELOC_new(void) { return (OCSP_SERVICELOC *)ASN1_item_new(&OCSP_SERVICELOC_it); } +LCRYPTO_ALIAS(OCSP_SERVICELOC_new); void OCSP_SERVICELOC_free(OCSP_SERVICELOC *a) { ASN1_item_free((ASN1_VALUE *)a, &OCSP_SERVICELOC_it); } +LCRYPTO_ALIAS(OCSP_SERVICELOC_free); diff --git a/lib/libcrypto/ocsp/ocsp_cl.c b/lib/libcrypto/ocsp/ocsp_cl.c index 774702022..89113f78b 100644 --- a/lib/libcrypto/ocsp/ocsp_cl.c +++ b/lib/libcrypto/ocsp/ocsp_cl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ocsp_cl.c,v 1.22 2022/12/26 07:18:52 jmc Exp $ */ +/* $OpenBSD: ocsp_cl.c,v 1.23 2023/07/08 10:44:00 beck Exp $ */ /* Written by Tom Titchener for the OpenSSL * project. */ @@ -99,6 +99,7 @@ OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid) OCSP_ONEREQ_free(one); return NULL; } +LCRYPTO_ALIAS(OCSP_request_add0_id); /* Set requestorName from an X509_NAME structure */ int @@ -119,6 +120,7 @@ OCSP_request_set1_name(OCSP_REQUEST *req, X509_NAME *nm) req->tbsRequest->requestorName = gen; return 1; } +LCRYPTO_ALIAS(OCSP_request_set1_name); /* Add a certificate to an OCSP request */ int @@ -141,6 +143,7 @@ OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert) X509_up_ref(cert); return 1; } +LCRYPTO_ALIAS(OCSP_request_add1_cert); /* Sign an OCSP request set the requestorName to the subject * name of an optional signers certificate and include one @@ -186,6 +189,7 @@ err: req->optionalSignature = NULL; return 0; } +LCRYPTO_ALIAS(OCSP_request_sign); /* Get response status */ int @@ -193,6 +197,7 @@ OCSP_response_status(OCSP_RESPONSE *resp) { return ASN1_ENUMERATED_get(resp->responseStatus); } +LCRYPTO_ALIAS(OCSP_response_status); /* Extract basic response from OCSP_RESPONSE or NULL if * no basic response present. @@ -214,6 +219,7 @@ OCSP_response_get1_basic(OCSP_RESPONSE *resp) return ASN1_item_unpack(rb->response, &OCSP_BASICRESP_it); } +LCRYPTO_ALIAS(OCSP_response_get1_basic); /* Return number of OCSP_SINGLERESP responses present in * a basic response. @@ -225,6 +231,7 @@ OCSP_resp_count(OCSP_BASICRESP *bs) return -1; return sk_OCSP_SINGLERESP_num(bs->tbsResponseData->responses); } +LCRYPTO_ALIAS(OCSP_resp_count); /* Extract an OCSP_SINGLERESP response with a given index */ OCSP_SINGLERESP * @@ -234,18 +241,21 @@ OCSP_resp_get0(OCSP_BASICRESP *bs, int idx) return NULL; return sk_OCSP_SINGLERESP_value(bs->tbsResponseData->responses, idx); } +LCRYPTO_ALIAS(OCSP_resp_get0); const ASN1_GENERALIZEDTIME * OCSP_resp_get0_produced_at(const OCSP_BASICRESP *bs) { return bs->tbsResponseData->producedAt; } +LCRYPTO_ALIAS(OCSP_resp_get0_produced_at); const STACK_OF(X509) * OCSP_resp_get0_certs(const OCSP_BASICRESP *bs) { return bs->certs; } +LCRYPTO_ALIAS(OCSP_resp_get0_certs); int OCSP_resp_get0_id(const OCSP_BASICRESP *bs, const ASN1_OCTET_STRING **pid, @@ -265,24 +275,28 @@ OCSP_resp_get0_id(const OCSP_BASICRESP *bs, const ASN1_OCTET_STRING **pid, return 1; } +LCRYPTO_ALIAS(OCSP_resp_get0_id); const ASN1_OCTET_STRING * OCSP_resp_get0_signature(const OCSP_BASICRESP *bs) { return bs->signature; } +LCRYPTO_ALIAS(OCSP_resp_get0_signature); const X509_ALGOR * OCSP_resp_get0_tbs_sigalg(const OCSP_BASICRESP *bs) { return bs->signatureAlgorithm; } +LCRYPTO_ALIAS(OCSP_resp_get0_tbs_sigalg); const OCSP_RESPDATA * OCSP_resp_get0_respdata(const OCSP_BASICRESP *bs) { return bs->tbsResponseData; } +LCRYPTO_ALIAS(OCSP_resp_get0_respdata); /* Look single response matching a given certificate ID */ int @@ -306,6 +320,7 @@ OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last) } return -1; } +LCRYPTO_ALIAS(OCSP_resp_find); /* Extract status information from an OCSP_SINGLERESP structure. * Note: the revtime and reason values are only set if the @@ -343,6 +358,7 @@ OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason, *nextupd = single->nextUpdate; return ret; } +LCRYPTO_ALIAS(OCSP_single_get0_status); /* This function combines the previous ones: look up a certificate ID and * if found extract status information. Return 0 is successful. @@ -365,6 +381,7 @@ OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status, *status = i; return 1; } +LCRYPTO_ALIAS(OCSP_resp_find_status); /* Check validity of thisUpdate and nextUpdate fields. It is possible that the request will * take a few seconds to process and/or the time wont be totally accurate. Therefore to avoid @@ -442,9 +459,11 @@ OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd, return 1; } +LCRYPTO_ALIAS(OCSP_check_validity); const OCSP_CERTID * OCSP_SINGLERESP_get0_id(const OCSP_SINGLERESP *single) { return single->certId; } +LCRYPTO_ALIAS(OCSP_SINGLERESP_get0_id); diff --git a/lib/libcrypto/ocsp/ocsp_err.c b/lib/libcrypto/ocsp/ocsp_err.c index 7cf5b7e8a..865091f54 100644 --- a/lib/libcrypto/ocsp/ocsp_err.c +++ b/lib/libcrypto/ocsp/ocsp_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ocsp_err.c,v 1.9 2022/07/12 14:42:49 kn Exp $ */ +/* $OpenBSD: ocsp_err.c,v 1.10 2023/07/08 10:44:00 beck Exp $ */ /* ==================================================================== * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. * @@ -116,3 +116,4 @@ ERR_load_OCSP_strings(void) } #endif } +LCRYPTO_ALIAS(ERR_load_OCSP_strings); diff --git a/lib/libcrypto/ocsp/ocsp_ext.c b/lib/libcrypto/ocsp/ocsp_ext.c index 9605d859b..9f8cb74b6 100644 --- a/lib/libcrypto/ocsp/ocsp_ext.c +++ b/lib/libcrypto/ocsp/ocsp_ext.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ocsp_ext.c,v 1.22 2022/12/26 07:18:52 jmc Exp $ */ +/* $OpenBSD: ocsp_ext.c,v 1.23 2023/07/08 10:44:00 beck Exp $ */ /* Written by Tom Titchener for the OpenSSL * project. */ @@ -82,6 +82,7 @@ OCSP_REQUEST_get_ext_count(OCSP_REQUEST *x) { return X509v3_get_ext_count(x->tbsRequest->requestExtensions); } +LCRYPTO_ALIAS(OCSP_REQUEST_get_ext_count); int OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST *x, int nid, int lastpos) @@ -89,6 +90,7 @@ OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST *x, int nid, int lastpos) return X509v3_get_ext_by_NID(x->tbsRequest->requestExtensions, nid, lastpos); } +LCRYPTO_ALIAS(OCSP_REQUEST_get_ext_by_NID); int OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST *x, const ASN1_OBJECT *obj, @@ -97,6 +99,7 @@ OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST *x, const ASN1_OBJECT *obj, return X509v3_get_ext_by_OBJ(x->tbsRequest->requestExtensions, obj, lastpos); } +LCRYPTO_ALIAS(OCSP_REQUEST_get_ext_by_OBJ); int OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST *x, int crit, int lastpos) @@ -104,24 +107,28 @@ OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST *x, int crit, int lastpos) return X509v3_get_ext_by_critical(x->tbsRequest->requestExtensions, crit, lastpos); } +LCRYPTO_ALIAS(OCSP_REQUEST_get_ext_by_critical); X509_EXTENSION * OCSP_REQUEST_get_ext(OCSP_REQUEST *x, int loc) { return X509v3_get_ext(x->tbsRequest->requestExtensions, loc); } +LCRYPTO_ALIAS(OCSP_REQUEST_get_ext); X509_EXTENSION * OCSP_REQUEST_delete_ext(OCSP_REQUEST *x, int loc) { return X509v3_delete_ext(x->tbsRequest->requestExtensions, loc); } +LCRYPTO_ALIAS(OCSP_REQUEST_delete_ext); void * OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST *x, int nid, int *crit, int *idx) { return X509V3_get_d2i(x->tbsRequest->requestExtensions, nid, crit, idx); } +LCRYPTO_ALIAS(OCSP_REQUEST_get1_ext_d2i); int OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST *x, int nid, void *value, int crit, @@ -130,6 +137,7 @@ OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST *x, int nid, void *value, int crit, return X509V3_add1_i2d(&x->tbsRequest->requestExtensions, nid, value, crit, flags); } +LCRYPTO_ALIAS(OCSP_REQUEST_add1_ext_i2d); int OCSP_REQUEST_add_ext(OCSP_REQUEST *x, X509_EXTENSION *ex, int loc) @@ -137,6 +145,7 @@ OCSP_REQUEST_add_ext(OCSP_REQUEST *x, X509_EXTENSION *ex, int loc) return X509v3_add_ext(&(x->tbsRequest->requestExtensions), ex, loc) != NULL; } +LCRYPTO_ALIAS(OCSP_REQUEST_add_ext); /* Single extensions */ @@ -145,18 +154,21 @@ OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ *x) { return X509v3_get_ext_count(x->singleRequestExtensions); } +LCRYPTO_ALIAS(OCSP_ONEREQ_get_ext_count); int OCSP_ONEREQ_get_ext_by_NID(OCSP_ONEREQ *x, int nid, int lastpos) { return X509v3_get_ext_by_NID(x->singleRequestExtensions, nid, lastpos); } +LCRYPTO_ALIAS(OCSP_ONEREQ_get_ext_by_NID); int OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ *x, const ASN1_OBJECT *obj, int lastpos) { return X509v3_get_ext_by_OBJ(x->singleRequestExtensions, obj, lastpos); } +LCRYPTO_ALIAS(OCSP_ONEREQ_get_ext_by_OBJ); int OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ *x, int crit, int lastpos) @@ -164,24 +176,28 @@ OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ *x, int crit, int lastpos) return X509v3_get_ext_by_critical(x->singleRequestExtensions, crit, lastpos); } +LCRYPTO_ALIAS(OCSP_ONEREQ_get_ext_by_critical); X509_EXTENSION * OCSP_ONEREQ_get_ext(OCSP_ONEREQ *x, int loc) { return X509v3_get_ext(x->singleRequestExtensions, loc); } +LCRYPTO_ALIAS(OCSP_ONEREQ_get_ext); X509_EXTENSION * OCSP_ONEREQ_delete_ext(OCSP_ONEREQ *x, int loc) { return X509v3_delete_ext(x->singleRequestExtensions, loc); } +LCRYPTO_ALIAS(OCSP_ONEREQ_delete_ext); void * OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ *x, int nid, int *crit, int *idx) { return X509V3_get_d2i(x->singleRequestExtensions, nid, crit, idx); } +LCRYPTO_ALIAS(OCSP_ONEREQ_get1_ext_d2i); int OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ *x, int nid, void *value, int crit, @@ -190,12 +206,14 @@ OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ *x, int nid, void *value, int crit, return X509V3_add1_i2d(&x->singleRequestExtensions, nid, value, crit, flags); } +LCRYPTO_ALIAS(OCSP_ONEREQ_add1_ext_i2d); int OCSP_ONEREQ_add_ext(OCSP_ONEREQ *x, X509_EXTENSION *ex, int loc) { return X509v3_add_ext(&(x->singleRequestExtensions), ex, loc) != NULL; } +LCRYPTO_ALIAS(OCSP_ONEREQ_add_ext); /* OCSP Basic response */ @@ -204,6 +222,7 @@ OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP *x) { return X509v3_get_ext_count(x->tbsResponseData->responseExtensions); } +LCRYPTO_ALIAS(OCSP_BASICRESP_get_ext_count); int OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP *x, int nid, int lastpos) @@ -211,6 +230,7 @@ OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP *x, int nid, int lastpos) return X509v3_get_ext_by_NID(x->tbsResponseData->responseExtensions, nid, lastpos); } +LCRYPTO_ALIAS(OCSP_BASICRESP_get_ext_by_NID); int OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP *x, const ASN1_OBJECT *obj, @@ -219,6 +239,7 @@ OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP *x, const ASN1_OBJECT *obj, return X509v3_get_ext_by_OBJ(x->tbsResponseData->responseExtensions, obj, lastpos); } +LCRYPTO_ALIAS(OCSP_BASICRESP_get_ext_by_OBJ); int OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP *x, int crit, int lastpos) @@ -226,18 +247,21 @@ OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP *x, int crit, int lastpos) return X509v3_get_ext_by_critical( x->tbsResponseData->responseExtensions, crit, lastpos); } +LCRYPTO_ALIAS(OCSP_BASICRESP_get_ext_by_critical); X509_EXTENSION * OCSP_BASICRESP_get_ext(OCSP_BASICRESP *x, int loc) { return X509v3_get_ext(x->tbsResponseData->responseExtensions, loc); } +LCRYPTO_ALIAS(OCSP_BASICRESP_get_ext); X509_EXTENSION * OCSP_BASICRESP_delete_ext(OCSP_BASICRESP *x, int loc) { return X509v3_delete_ext(x->tbsResponseData->responseExtensions, loc); } +LCRYPTO_ALIAS(OCSP_BASICRESP_delete_ext); void * OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit, int *idx) @@ -245,6 +269,7 @@ OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit, int *idx) return X509V3_get_d2i(x->tbsResponseData->responseExtensions, nid, crit, idx); } +LCRYPTO_ALIAS(OCSP_BASICRESP_get1_ext_d2i); int OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value, int crit, @@ -253,6 +278,7 @@ OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value, int crit, return X509V3_add1_i2d(&x->tbsResponseData->responseExtensions, nid, value, crit, flags); } +LCRYPTO_ALIAS(OCSP_BASICRESP_add1_ext_i2d); int OCSP_BASICRESP_add_ext(OCSP_BASICRESP *x, X509_EXTENSION *ex, int loc) @@ -260,6 +286,7 @@ OCSP_BASICRESP_add_ext(OCSP_BASICRESP *x, X509_EXTENSION *ex, int loc) return X509v3_add_ext(&(x->tbsResponseData->responseExtensions), ex, loc) != NULL; } +LCRYPTO_ALIAS(OCSP_BASICRESP_add_ext); /* OCSP single response extensions */ @@ -268,12 +295,14 @@ OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP *x) { return X509v3_get_ext_count(x->singleExtensions); } +LCRYPTO_ALIAS(OCSP_SINGLERESP_get_ext_count); int OCSP_SINGLERESP_get_ext_by_NID(OCSP_SINGLERESP *x, int nid, int lastpos) { return X509v3_get_ext_by_NID(x->singleExtensions, nid, lastpos); } +LCRYPTO_ALIAS(OCSP_SINGLERESP_get_ext_by_NID); int OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP *x, const ASN1_OBJECT *obj, @@ -281,30 +310,35 @@ OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP *x, const ASN1_OBJECT *obj, { return X509v3_get_ext_by_OBJ(x->singleExtensions, obj, lastpos); } +LCRYPTO_ALIAS(OCSP_SINGLERESP_get_ext_by_OBJ); int OCSP_SINGLERESP_get_ext_by_critical(OCSP_SINGLERESP *x, int crit, int lastpos) { return X509v3_get_ext_by_critical(x->singleExtensions, crit, lastpos); } +LCRYPTO_ALIAS(OCSP_SINGLERESP_get_ext_by_critical); X509_EXTENSION * OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP *x, int loc) { return X509v3_get_ext(x->singleExtensions, loc); } +LCRYPTO_ALIAS(OCSP_SINGLERESP_get_ext); X509_EXTENSION * OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP *x, int loc) { return X509v3_delete_ext(x->singleExtensions, loc); } +LCRYPTO_ALIAS(OCSP_SINGLERESP_delete_ext); void * OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP *x, int nid, int *crit, int *idx) { return X509V3_get_d2i(x->singleExtensions, nid, crit, idx); } +LCRYPTO_ALIAS(OCSP_SINGLERESP_get1_ext_d2i); int OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value, int crit, @@ -312,12 +346,14 @@ OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value, int crit, { return X509V3_add1_i2d(&x->singleExtensions, nid, value, crit, flags); } +LCRYPTO_ALIAS(OCSP_SINGLERESP_add1_ext_i2d); int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc) { return X509v3_add_ext(&(x->singleExtensions), ex, loc) != NULL; } +LCRYPTO_ALIAS(OCSP_SINGLERESP_add_ext); /* Nonce handling functions */ @@ -367,6 +403,7 @@ OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len) { return ocsp_add1_nonce(&req->tbsRequest->requestExtensions, val, len); } +LCRYPTO_ALIAS(OCSP_request_add1_nonce); /* Same as above but for a response */ int @@ -375,6 +412,7 @@ OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val, int len) return ocsp_add1_nonce(&resp->tbsResponseData->responseExtensions, val, len); } +LCRYPTO_ALIAS(OCSP_basic_add1_nonce); /* Check nonce validity in a request and response. * Return value reflects result: @@ -420,6 +458,7 @@ OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *bs) return 0; return 1; } +LCRYPTO_ALIAS(OCSP_check_nonce); /* Copy the nonce value (if any) from an OCSP request to * a response. @@ -438,6 +477,7 @@ OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req) req_ext = OCSP_REQUEST_get_ext(req, req_idx); return OCSP_BASICRESP_add_ext(resp, req_ext, -1); } +LCRYPTO_ALIAS(OCSP_copy_nonce); X509_EXTENSION * OCSP_crlID_new(const char *url, long *n, char *tim) @@ -472,6 +512,7 @@ err: OCSP_CRLID_free(cid); return x; } +LCRYPTO_ALIAS(OCSP_crlID_new); /* AcceptableResponses ::= SEQUENCE OF OBJECT IDENTIFIER */ X509_EXTENSION * @@ -497,6 +538,7 @@ OCSP_accept_responses_new(char **oids) sk_ASN1_OBJECT_pop_free(sk, ASN1_OBJECT_free); return x; } +LCRYPTO_ALIAS(OCSP_accept_responses_new); /* ArchiveCutoff ::= GeneralizedTime */ X509_EXTENSION * @@ -516,6 +558,7 @@ err: ASN1_GENERALIZEDTIME_free(gt); return x; } +LCRYPTO_ALIAS(OCSP_archive_cutoff_new); /* per ACCESS_DESCRIPTION parameter are oids, of which there are currently * two--NID_ad_ocsp, NID_id_ad_caIssuers--and GeneralName value. This @@ -566,3 +609,4 @@ err: OCSP_SERVICELOC_free(sloc); return x; } +LCRYPTO_ALIAS(OCSP_url_svcloc_new); diff --git a/lib/libcrypto/ocsp/ocsp_ht.c b/lib/libcrypto/ocsp/ocsp_ht.c index 255f89039..bf735c72a 100644 --- a/lib/libcrypto/ocsp/ocsp_ht.c +++ b/lib/libcrypto/ocsp/ocsp_ht.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ocsp_ht.c,v 1.25 2018/05/13 10:42:03 tb Exp $ */ +/* $OpenBSD: ocsp_ht.c,v 1.26 2023/07/08 10:44:00 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -115,6 +115,7 @@ OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx) free(rctx->iobuf); free(rctx); } +LCRYPTO_ALIAS(OCSP_REQ_CTX_free); int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req) @@ -128,6 +129,7 @@ OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req) rctx->asn1_len = BIO_get_mem_data(rctx->mem, NULL); return 1; } +LCRYPTO_ALIAS(OCSP_REQ_CTX_set1_req); int OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx, const char *name, @@ -147,6 +149,7 @@ OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx, const char *name, return 0; return 1; } +LCRYPTO_ALIAS(OCSP_REQ_CTX_add1_header); OCSP_REQ_CTX * OCSP_sendreq_new(BIO *io, const char *path, OCSP_REQUEST *req, int maxline) @@ -192,6 +195,7 @@ OCSP_sendreq_new(BIO *io, const char *path, OCSP_REQUEST *req, int maxline) return rctx; } +LCRYPTO_ALIAS(OCSP_sendreq_new); /* Parse the HTTP response. This will look like this: * "HTTP/1.0 200 OK". We need to obtain the numeric code and @@ -437,6 +441,7 @@ next_line: return 0; } +LCRYPTO_ALIAS(OCSP_sendreq_nbio); /* Blocking OCSP request handler: now a special case of non-blocking I/O */ OCSP_RESPONSE * @@ -461,3 +466,4 @@ OCSP_sendreq_bio(BIO *b, const char *path, OCSP_REQUEST *req) return NULL; } +LCRYPTO_ALIAS(OCSP_sendreq_bio); diff --git a/lib/libcrypto/ocsp/ocsp_lib.c b/lib/libcrypto/ocsp/ocsp_lib.c index 09bccc0cf..d3eada2ba 100644 --- a/lib/libcrypto/ocsp/ocsp_lib.c +++ b/lib/libcrypto/ocsp/ocsp_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ocsp_lib.c,v 1.25 2022/01/22 00:31:23 inoguchi Exp $ */ +/* $OpenBSD: ocsp_lib.c,v 1.26 2023/07/08 10:44:00 beck Exp $ */ /* Written by Tom Titchener for the OpenSSL * project. */ @@ -101,6 +101,7 @@ OCSP_cert_to_id(const EVP_MD *dgst, const X509 *subject, const X509 *issuer) return OCSP_cert_id_new(dgst, iname, ikey, serial); } +LCRYPTO_ALIAS(OCSP_cert_to_id); OCSP_CERTID * OCSP_cert_id_new(const EVP_MD *dgst, const X509_NAME *issuerName, @@ -154,6 +155,7 @@ err: OCSP_CERTID_free(cid); return NULL; } +LCRYPTO_ALIAS(OCSP_cert_id_new); int OCSP_id_issuer_cmp(OCSP_CERTID *a, OCSP_CERTID *b) @@ -168,6 +170,7 @@ OCSP_id_issuer_cmp(OCSP_CERTID *a, OCSP_CERTID *b) return ret; return ASN1_OCTET_STRING_cmp(a->issuerKeyHash, b->issuerKeyHash); } +LCRYPTO_ALIAS(OCSP_id_issuer_cmp); int OCSP_id_cmp(OCSP_CERTID *a, OCSP_CERTID *b) @@ -179,6 +182,7 @@ OCSP_id_cmp(OCSP_CERTID *a, OCSP_CERTID *b) return ret; return ASN1_INTEGER_cmp(a->serialNumber, b->serialNumber); } +LCRYPTO_ALIAS(OCSP_id_cmp); /* Parse a URL and split it up into host, port and path components and whether * it is SSL. @@ -235,9 +239,11 @@ OCSP_parse_url(const char *url, char **phost, char **pport, char **ppath, *pport = port; return 1; } +LCRYPTO_ALIAS(OCSP_parse_url); OCSP_CERTID * OCSP_CERTID_dup(OCSP_CERTID *x) { return ASN1_item_dup(&OCSP_CERTID_it, x); } +LCRYPTO_ALIAS(OCSP_CERTID_dup); diff --git a/lib/libcrypto/ocsp/ocsp_prn.c b/lib/libcrypto/ocsp/ocsp_prn.c index fecd14bbf..7e3175b61 100644 --- a/lib/libcrypto/ocsp/ocsp_prn.c +++ b/lib/libcrypto/ocsp/ocsp_prn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ocsp_prn.c,v 1.9 2022/01/07 09:45:52 tb Exp $ */ +/* $OpenBSD: ocsp_prn.c,v 1.10 2023/07/08 10:44:00 beck Exp $ */ /* Written by Tom Titchener for the OpenSSL * project. */ @@ -114,6 +114,7 @@ OCSP_response_status_str(long s) }; return table2string(s, rstat_tbl, 6); } +LCRYPTO_ALIAS(OCSP_response_status_str); const char * OCSP_cert_status_str(long s) @@ -125,6 +126,7 @@ OCSP_cert_status_str(long s) }; return table2string(s, cstat_tbl, 3); } +LCRYPTO_ALIAS(OCSP_cert_status_str); const char * OCSP_crl_reason_str(long s) @@ -141,6 +143,7 @@ OCSP_crl_reason_str(long s) }; return table2string(s, reason_tbl, 8); } +LCRYPTO_ALIAS(OCSP_crl_reason_str); int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST* o, unsigned long flags) @@ -192,6 +195,7 @@ OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST* o, unsigned long flags) err: return 0; } +LCRYPTO_ALIAS(OCSP_REQUEST_print); int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags) @@ -312,3 +316,4 @@ err: OCSP_BASICRESP_free(br); return ret; } +LCRYPTO_ALIAS(OCSP_RESPONSE_print); diff --git a/lib/libcrypto/ocsp/ocsp_srv.c b/lib/libcrypto/ocsp/ocsp_srv.c index d23520708..77c5e2e0f 100644 --- a/lib/libcrypto/ocsp/ocsp_srv.c +++ b/lib/libcrypto/ocsp/ocsp_srv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ocsp_srv.c,v 1.12 2022/01/07 09:45:52 tb Exp $ */ +/* $OpenBSD: ocsp_srv.c,v 1.13 2023/07/08 10:44:00 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2001. */ @@ -76,18 +76,21 @@ OCSP_request_onereq_count(OCSP_REQUEST *req) { return sk_OCSP_ONEREQ_num(req->tbsRequest->requestList); } +LCRYPTO_ALIAS(OCSP_request_onereq_count); OCSP_ONEREQ * OCSP_request_onereq_get0(OCSP_REQUEST *req, int i) { return sk_OCSP_ONEREQ_value(req->tbsRequest->requestList, i); } +LCRYPTO_ALIAS(OCSP_request_onereq_get0); OCSP_CERTID * OCSP_onereq_get0_id(OCSP_ONEREQ *one) { return one->reqCert; } +LCRYPTO_ALIAS(OCSP_onereq_get0_id); int OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd, @@ -105,6 +108,7 @@ OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd, *pserial = cid->serialNumber; return 1; } +LCRYPTO_ALIAS(OCSP_id_get0_info); int OCSP_request_is_signed(OCSP_REQUEST *req) @@ -113,6 +117,7 @@ OCSP_request_is_signed(OCSP_REQUEST *req) return 1; return 0; } +LCRYPTO_ALIAS(OCSP_request_is_signed); /* Create an OCSP response and encode an optional basic response */ OCSP_RESPONSE * @@ -139,6 +144,7 @@ err: OCSP_RESPONSE_free(rsp); return NULL; } +LCRYPTO_ALIAS(OCSP_response_create); OCSP_SINGLERESP * OCSP_basic_add1_status(OCSP_BASICRESP *rsp, OCSP_CERTID *cid, int status, @@ -205,6 +211,7 @@ err: OCSP_SINGLERESP_free(single); return NULL; } +LCRYPTO_ALIAS(OCSP_basic_add1_status); /* Add a certificate to an OCSP request */ int @@ -218,6 +225,7 @@ OCSP_basic_add1_cert(OCSP_BASICRESP *resp, X509 *cert) X509_up_ref(cert); return 1; } +LCRYPTO_ALIAS(OCSP_basic_add1_cert); int OCSP_basic_sign(OCSP_BASICRESP *brsp, X509 *signer, EVP_PKEY *key, @@ -274,3 +282,4 @@ OCSP_basic_sign(OCSP_BASICRESP *brsp, X509 *signer, EVP_PKEY *key, err: return 0; } +LCRYPTO_ALIAS(OCSP_basic_sign); diff --git a/lib/libcrypto/ocsp/ocsp_vfy.c b/lib/libcrypto/ocsp/ocsp_vfy.c index 3c1231885..d197fe4ea 100644 --- a/lib/libcrypto/ocsp/ocsp_vfy.c +++ b/lib/libcrypto/ocsp/ocsp_vfy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ocsp_vfy.c,v 1.22 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: ocsp_vfy.c,v 1.23 2023/07/08 10:44:00 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -183,6 +183,7 @@ end: sk_X509_free(untrusted); return ret; } +LCRYPTO_ALIAS(OCSP_basic_verify); int OCSP_resp_get0_signer(OCSP_BASICRESP *bs, X509 **signer, @@ -190,6 +191,7 @@ OCSP_resp_get0_signer(OCSP_BASICRESP *bs, X509 **signer, { return ocsp_find_signer(signer, bs, extra_certs, NULL, 0) > 0; } +LCRYPTO_ALIAS(OCSP_resp_get0_signer); static int ocsp_find_signer(X509 **psigner, OCSP_BASICRESP *bs, STACK_OF(X509) *certs, @@ -448,6 +450,7 @@ OCSP_request_verify(OCSP_REQUEST *req, STACK_OF(X509) *certs, X509_STORE *store, } return 1; } +LCRYPTO_ALIAS(OCSP_request_verify); static int ocsp_req_find_signer(X509 **psigner, OCSP_REQUEST *req, X509_NAME *nm, diff --git a/lib/libcrypto/pem/pem_all.c b/lib/libcrypto/pem/pem_all.c index 9fa5184ec..21e325b9f 100644 --- a/lib/libcrypto/pem/pem_all.c +++ b/lib/libcrypto/pem/pem_all.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pem_all.c,v 1.20 2023/04/25 17:51:36 tb Exp $ */ +/* $OpenBSD: pem_all.c,v 1.21 2023/07/07 13:40:44 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -147,6 +147,7 @@ PEM_read_X509_REQ(FILE *fp, X509_REQ **x, pem_password_cb *cb, void *u) return PEM_ASN1_read((d2i_of_void *)d2i_X509_REQ, PEM_STRING_X509_REQ, fp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_X509_REQ); int PEM_write_X509_REQ(FILE *fp, X509_REQ *x) @@ -154,6 +155,7 @@ PEM_write_X509_REQ(FILE *fp, X509_REQ *x) return PEM_ASN1_write((i2d_of_void *)i2d_X509_REQ, PEM_STRING_X509_REQ, fp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_X509_REQ); X509_REQ * PEM_read_bio_X509_REQ(BIO *bp, X509_REQ **x, pem_password_cb *cb, void *u) @@ -161,6 +163,7 @@ PEM_read_bio_X509_REQ(BIO *bp, X509_REQ **x, pem_password_cb *cb, void *u) return PEM_ASN1_read_bio((d2i_of_void *)d2i_X509_REQ, PEM_STRING_X509_REQ, bp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_bio_X509_REQ); int PEM_write_bio_X509_REQ(BIO *bp, X509_REQ *x) @@ -168,6 +171,7 @@ PEM_write_bio_X509_REQ(BIO *bp, X509_REQ *x) return PEM_ASN1_write_bio((i2d_of_void *)i2d_X509_REQ, PEM_STRING_X509_REQ, bp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_bio_X509_REQ); int PEM_write_X509_REQ_NEW(FILE *fp, X509_REQ *x) @@ -175,6 +179,7 @@ PEM_write_X509_REQ_NEW(FILE *fp, X509_REQ *x) return PEM_ASN1_write((i2d_of_void *)i2d_X509_REQ, PEM_STRING_X509_REQ_OLD, fp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_X509_REQ_NEW); int PEM_write_bio_X509_REQ_NEW(BIO *bp, X509_REQ *x) @@ -182,6 +187,7 @@ PEM_write_bio_X509_REQ_NEW(BIO *bp, X509_REQ *x) return PEM_ASN1_write_bio((i2d_of_void *)i2d_X509_REQ, PEM_STRING_X509_REQ_OLD, bp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_bio_X509_REQ_NEW); X509_CRL * PEM_read_X509_CRL(FILE *fp, X509_CRL **x, pem_password_cb *cb, void *u) @@ -189,6 +195,7 @@ PEM_read_X509_CRL(FILE *fp, X509_CRL **x, pem_password_cb *cb, void *u) return PEM_ASN1_read((d2i_of_void *)d2i_X509_CRL, PEM_STRING_X509_CRL, fp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_X509_CRL); int PEM_write_X509_CRL(FILE *fp, X509_CRL *x) @@ -196,6 +203,7 @@ PEM_write_X509_CRL(FILE *fp, X509_CRL *x) return PEM_ASN1_write((i2d_of_void *)i2d_X509_CRL, PEM_STRING_X509_CRL, fp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_X509_CRL); X509_CRL * PEM_read_bio_X509_CRL(BIO *bp, X509_CRL **x, pem_password_cb *cb, void *u) @@ -203,6 +211,7 @@ PEM_read_bio_X509_CRL(BIO *bp, X509_CRL **x, pem_password_cb *cb, void *u) return PEM_ASN1_read_bio((d2i_of_void *)d2i_X509_CRL, PEM_STRING_X509_CRL, bp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_bio_X509_CRL); int PEM_write_bio_X509_CRL(BIO *bp, X509_CRL *x) @@ -210,6 +219,7 @@ PEM_write_bio_X509_CRL(BIO *bp, X509_CRL *x) return PEM_ASN1_write_bio((i2d_of_void *)i2d_X509_CRL, PEM_STRING_X509_CRL, bp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_bio_X509_CRL); PKCS7 * PEM_read_PKCS7(FILE *fp, PKCS7 **x, pem_password_cb *cb, void *u) @@ -217,6 +227,7 @@ PEM_read_PKCS7(FILE *fp, PKCS7 **x, pem_password_cb *cb, void *u) return PEM_ASN1_read((d2i_of_void *)d2i_PKCS7, PEM_STRING_PKCS7, fp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_PKCS7); int PEM_write_PKCS7(FILE *fp, PKCS7 *x) @@ -224,6 +235,7 @@ PEM_write_PKCS7(FILE *fp, PKCS7 *x) return PEM_ASN1_write((i2d_of_void *)i2d_PKCS7, PEM_STRING_PKCS7, fp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_PKCS7); PKCS7 * PEM_read_bio_PKCS7(BIO *bp, PKCS7 **x, pem_password_cb *cb, void *u) @@ -231,6 +243,7 @@ PEM_read_bio_PKCS7(BIO *bp, PKCS7 **x, pem_password_cb *cb, void *u) return PEM_ASN1_read_bio((d2i_of_void *)d2i_PKCS7, PEM_STRING_PKCS7, bp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_bio_PKCS7); int PEM_write_bio_PKCS7(BIO *bp, PKCS7 *x) @@ -238,6 +251,7 @@ PEM_write_bio_PKCS7(BIO *bp, PKCS7 *x) return PEM_ASN1_write_bio((i2d_of_void *)i2d_PKCS7, PEM_STRING_PKCS7, bp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_bio_PKCS7); #ifndef OPENSSL_NO_RSA @@ -275,6 +289,7 @@ PEM_read_RSAPrivateKey(FILE *fp, RSA **rsa, pem_password_cb *cb, void *u) pktmp = PEM_read_PrivateKey(fp, NULL, cb, u); return pkey_get_rsa(pktmp, rsa); } +LCRYPTO_ALIAS(PEM_read_RSAPrivateKey); int PEM_write_RSAPrivateKey(FILE *fp, RSA *x, const EVP_CIPHER *enc, @@ -283,6 +298,7 @@ PEM_write_RSAPrivateKey(FILE *fp, RSA *x, const EVP_CIPHER *enc, return PEM_ASN1_write((i2d_of_void *)i2d_RSAPrivateKey, PEM_STRING_RSA, fp, x, enc, kstr, klen, cb, u); } +LCRYPTO_ALIAS(PEM_write_RSAPrivateKey); RSA * PEM_read_bio_RSAPrivateKey(BIO *bp, RSA **rsa, pem_password_cb *cb, void *u) @@ -292,6 +308,7 @@ PEM_read_bio_RSAPrivateKey(BIO *bp, RSA **rsa, pem_password_cb *cb, void *u) pktmp = PEM_read_bio_PrivateKey(bp, NULL, cb, u); return pkey_get_rsa(pktmp, rsa); } +LCRYPTO_ALIAS(PEM_read_bio_RSAPrivateKey); int PEM_write_bio_RSAPrivateKey(BIO *bp, RSA *x, @@ -301,6 +318,7 @@ PEM_write_bio_RSAPrivateKey(BIO *bp, RSA *x, return PEM_ASN1_write_bio((i2d_of_void *)i2d_RSAPrivateKey, PEM_STRING_RSA, bp, x, enc, kstr, klen, cb, u); } +LCRYPTO_ALIAS(PEM_write_bio_RSAPrivateKey); RSA * PEM_read_RSAPublicKey(FILE *fp, RSA **x, pem_password_cb *cb, void *u) @@ -308,6 +326,7 @@ PEM_read_RSAPublicKey(FILE *fp, RSA **x, pem_password_cb *cb, void *u) return PEM_ASN1_read((d2i_of_void *)d2i_RSAPublicKey, PEM_STRING_RSA_PUBLIC, fp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_RSAPublicKey); int PEM_write_RSAPublicKey(FILE *fp, const RSA *x) @@ -315,6 +334,7 @@ PEM_write_RSAPublicKey(FILE *fp, const RSA *x) return PEM_ASN1_write((i2d_of_void *)i2d_RSAPublicKey, PEM_STRING_RSA_PUBLIC, fp, (void *)x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_RSAPublicKey); RSA * PEM_read_bio_RSAPublicKey(BIO *bp, RSA **x, pem_password_cb *cb, void *u) @@ -322,6 +342,7 @@ PEM_read_bio_RSAPublicKey(BIO *bp, RSA **x, pem_password_cb *cb, void *u) return PEM_ASN1_read_bio((d2i_of_void *)d2i_RSAPublicKey, PEM_STRING_RSA_PUBLIC, bp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_bio_RSAPublicKey); int PEM_write_bio_RSAPublicKey(BIO *bp, const RSA *x) @@ -329,6 +350,7 @@ PEM_write_bio_RSAPublicKey(BIO *bp, const RSA *x) return PEM_ASN1_write_bio((i2d_of_void *)i2d_RSAPublicKey, PEM_STRING_RSA_PUBLIC, bp, (void *)x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_bio_RSAPublicKey); RSA * PEM_read_RSA_PUBKEY(FILE *fp, RSA **x, pem_password_cb *cb, void *u) @@ -336,6 +358,7 @@ PEM_read_RSA_PUBKEY(FILE *fp, RSA **x, pem_password_cb *cb, void *u) return PEM_ASN1_read((d2i_of_void *)d2i_RSA_PUBKEY, PEM_STRING_PUBLIC, fp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_RSA_PUBKEY); int PEM_write_RSA_PUBKEY(FILE *fp, RSA *x) @@ -343,6 +366,7 @@ PEM_write_RSA_PUBKEY(FILE *fp, RSA *x) return PEM_ASN1_write((i2d_of_void *)i2d_RSA_PUBKEY, PEM_STRING_PUBLIC, fp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_RSA_PUBKEY); RSA * PEM_read_bio_RSA_PUBKEY(BIO *bp, RSA **x, pem_password_cb *cb, void *u) @@ -350,6 +374,7 @@ PEM_read_bio_RSA_PUBKEY(BIO *bp, RSA **x, pem_password_cb *cb, void *u) return PEM_ASN1_read_bio((d2i_of_void *)d2i_RSA_PUBKEY, PEM_STRING_PUBLIC, bp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_bio_RSA_PUBKEY); int PEM_write_bio_RSA_PUBKEY(BIO *bp, RSA *x) @@ -357,6 +382,7 @@ PEM_write_bio_RSA_PUBKEY(BIO *bp, RSA *x) return PEM_ASN1_write_bio((i2d_of_void *)i2d_RSA_PUBKEY, PEM_STRING_PUBLIC, bp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_bio_RSA_PUBKEY); #endif @@ -388,6 +414,7 @@ PEM_read_DSAPrivateKey(FILE *fp, DSA **dsa, pem_password_cb *cb, void *u) pktmp = PEM_read_PrivateKey(fp, NULL, cb, u); return pkey_get_dsa(pktmp, dsa); /* will free pktmp */ } +LCRYPTO_ALIAS(PEM_read_DSAPrivateKey); int PEM_write_DSAPrivateKey(FILE *fp, DSA *x, const EVP_CIPHER *enc, @@ -396,6 +423,7 @@ PEM_write_DSAPrivateKey(FILE *fp, DSA *x, const EVP_CIPHER *enc, return PEM_ASN1_write((i2d_of_void *)i2d_DSAPrivateKey, PEM_STRING_DSA, fp, x, enc, kstr, klen, cb, u); } +LCRYPTO_ALIAS(PEM_write_DSAPrivateKey); DSA * PEM_read_bio_DSAPrivateKey(BIO *bp, DSA **dsa, pem_password_cb *cb, void *u) @@ -405,6 +433,7 @@ PEM_read_bio_DSAPrivateKey(BIO *bp, DSA **dsa, pem_password_cb *cb, void *u) pktmp = PEM_read_bio_PrivateKey(bp, NULL, cb, u); return pkey_get_dsa(pktmp, dsa); /* will free pktmp */ } +LCRYPTO_ALIAS(PEM_read_bio_DSAPrivateKey); int PEM_write_bio_DSAPrivateKey(BIO *bp, DSA *x, @@ -414,6 +443,7 @@ PEM_write_bio_DSAPrivateKey(BIO *bp, DSA *x, return PEM_ASN1_write_bio((i2d_of_void *)i2d_DSAPrivateKey, PEM_STRING_DSA, bp, x, enc, kstr, klen, cb, u); } +LCRYPTO_ALIAS(PEM_write_bio_DSAPrivateKey); DSA * PEM_read_DSA_PUBKEY(FILE *fp, DSA **x, pem_password_cb *cb, void *u) @@ -421,6 +451,7 @@ PEM_read_DSA_PUBKEY(FILE *fp, DSA **x, pem_password_cb *cb, void *u) return PEM_ASN1_read((d2i_of_void *)d2i_DSA_PUBKEY, PEM_STRING_PUBLIC, fp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_DSA_PUBKEY); int PEM_write_DSA_PUBKEY(FILE *fp, DSA *x) @@ -428,6 +459,7 @@ PEM_write_DSA_PUBKEY(FILE *fp, DSA *x) return PEM_ASN1_write((i2d_of_void *)i2d_DSA_PUBKEY, PEM_STRING_PUBLIC, fp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_DSA_PUBKEY); int PEM_write_bio_DSA_PUBKEY(BIO *bp, DSA *x) @@ -435,6 +467,7 @@ PEM_write_bio_DSA_PUBKEY(BIO *bp, DSA *x) return PEM_ASN1_write_bio((i2d_of_void *)i2d_DSA_PUBKEY, PEM_STRING_PUBLIC, bp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_bio_DSA_PUBKEY); DSA * PEM_read_bio_DSA_PUBKEY(BIO *bp, DSA **x, pem_password_cb *cb, void *u) @@ -442,6 +475,7 @@ PEM_read_bio_DSA_PUBKEY(BIO *bp, DSA **x, pem_password_cb *cb, void *u) return PEM_ASN1_read_bio((d2i_of_void *)d2i_DSA_PUBKEY, PEM_STRING_PUBLIC, bp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_bio_DSA_PUBKEY); DSA * PEM_read_DSAparams(FILE *fp, DSA **x, pem_password_cb *cb, void *u) @@ -449,6 +483,7 @@ PEM_read_DSAparams(FILE *fp, DSA **x, pem_password_cb *cb, void *u) return PEM_ASN1_read((d2i_of_void *)d2i_DSAparams, PEM_STRING_DSAPARAMS, fp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_DSAparams); int PEM_write_DSAparams(FILE *fp, const DSA *x) @@ -456,6 +491,7 @@ PEM_write_DSAparams(FILE *fp, const DSA *x) return PEM_ASN1_write((i2d_of_void *)i2d_DSAparams, PEM_STRING_DSAPARAMS, fp, (void *)x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_DSAparams); DSA * PEM_read_bio_DSAparams(BIO *bp, DSA **x, pem_password_cb *cb, void *u) @@ -463,6 +499,7 @@ PEM_read_bio_DSAparams(BIO *bp, DSA **x, pem_password_cb *cb, void *u) return PEM_ASN1_read_bio((d2i_of_void *)d2i_DSAparams, PEM_STRING_DSAPARAMS, bp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_bio_DSAparams); int PEM_write_bio_DSAparams(BIO *bp, const DSA *x) @@ -470,6 +507,7 @@ PEM_write_bio_DSAparams(BIO *bp, const DSA *x) return PEM_ASN1_write_bio((i2d_of_void *)i2d_DSAparams, PEM_STRING_DSAPARAMS, bp, (void *)x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_bio_DSAparams); #endif @@ -499,6 +537,7 @@ PEM_read_ECPKParameters(FILE *fp, EC_GROUP **x, pem_password_cb *cb, void *u) return PEM_ASN1_read((d2i_of_void *)d2i_ECPKParameters, PEM_STRING_ECPARAMETERS, fp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_ECPKParameters); int PEM_write_ECPKParameters(FILE *fp, const EC_GROUP *x) @@ -506,6 +545,7 @@ PEM_write_ECPKParameters(FILE *fp, const EC_GROUP *x) return PEM_ASN1_write((i2d_of_void *)i2d_ECPKParameters, PEM_STRING_ECPARAMETERS, fp, (void *)x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_ECPKParameters); EC_GROUP * PEM_read_bio_ECPKParameters(BIO *bp, EC_GROUP **x, pem_password_cb *cb, void *u) @@ -513,6 +553,7 @@ PEM_read_bio_ECPKParameters(BIO *bp, EC_GROUP **x, pem_password_cb *cb, void *u) return PEM_ASN1_read_bio((d2i_of_void *)d2i_ECPKParameters, PEM_STRING_ECPARAMETERS, bp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_bio_ECPKParameters); int PEM_write_bio_ECPKParameters(BIO *bp, const EC_GROUP *x) @@ -520,6 +561,7 @@ PEM_write_bio_ECPKParameters(BIO *bp, const EC_GROUP *x) return PEM_ASN1_write_bio((i2d_of_void *)i2d_ECPKParameters, PEM_STRING_ECPARAMETERS, bp, (void *)x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_bio_ECPKParameters); EC_KEY * PEM_read_ECPrivateKey(FILE *fp, EC_KEY **eckey, pem_password_cb *cb, void *u) @@ -529,6 +571,7 @@ PEM_read_ECPrivateKey(FILE *fp, EC_KEY **eckey, pem_password_cb *cb, void *u) pktmp = PEM_read_PrivateKey(fp, NULL, cb, u); return pkey_get_eckey(pktmp, eckey); /* will free pktmp */ } +LCRYPTO_ALIAS(PEM_read_ECPrivateKey); int PEM_write_ECPrivateKey(FILE *fp, EC_KEY *x, const EVP_CIPHER *enc, @@ -537,6 +580,7 @@ PEM_write_ECPrivateKey(FILE *fp, EC_KEY *x, const EVP_CIPHER *enc, return PEM_ASN1_write((i2d_of_void *)i2d_ECPrivateKey, PEM_STRING_ECPRIVATEKEY, fp, x, enc, kstr, klen, cb, u); } +LCRYPTO_ALIAS(PEM_write_ECPrivateKey); EC_KEY * PEM_read_bio_ECPrivateKey(BIO *bp, EC_KEY **key, pem_password_cb *cb, void *u) @@ -545,6 +589,7 @@ PEM_read_bio_ECPrivateKey(BIO *bp, EC_KEY **key, pem_password_cb *cb, void *u) pktmp = PEM_read_bio_PrivateKey(bp, NULL, cb, u); return pkey_get_eckey(pktmp, key); /* will free pktmp */ } +LCRYPTO_ALIAS(PEM_read_bio_ECPrivateKey); int PEM_write_bio_ECPrivateKey(BIO *bp, EC_KEY *x, @@ -554,6 +599,7 @@ PEM_write_bio_ECPrivateKey(BIO *bp, EC_KEY *x, return PEM_ASN1_write_bio((i2d_of_void *)i2d_ECPrivateKey, PEM_STRING_ECPRIVATEKEY, bp, x, enc, kstr, klen, cb, u); } +LCRYPTO_ALIAS(PEM_write_bio_ECPrivateKey); EC_KEY * PEM_read_EC_PUBKEY(FILE *fp, EC_KEY **x, pem_password_cb *cb, void *u) @@ -561,6 +607,7 @@ PEM_read_EC_PUBKEY(FILE *fp, EC_KEY **x, pem_password_cb *cb, void *u) return PEM_ASN1_read((d2i_of_void *)d2i_EC_PUBKEY, PEM_STRING_PUBLIC, fp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_EC_PUBKEY); int PEM_write_EC_PUBKEY(FILE *fp, EC_KEY *x) @@ -568,6 +615,7 @@ PEM_write_EC_PUBKEY(FILE *fp, EC_KEY *x) return PEM_ASN1_write((i2d_of_void *)i2d_EC_PUBKEY, PEM_STRING_PUBLIC, fp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_EC_PUBKEY); EC_KEY * PEM_read_bio_EC_PUBKEY(BIO *bp, EC_KEY **x, pem_password_cb *cb, void *u) @@ -575,6 +623,7 @@ PEM_read_bio_EC_PUBKEY(BIO *bp, EC_KEY **x, pem_password_cb *cb, void *u) return PEM_ASN1_read_bio((d2i_of_void *)d2i_EC_PUBKEY, PEM_STRING_PUBLIC, bp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_bio_EC_PUBKEY); int PEM_write_bio_EC_PUBKEY(BIO *bp, EC_KEY *x) @@ -582,6 +631,7 @@ PEM_write_bio_EC_PUBKEY(BIO *bp, EC_KEY *x) return PEM_ASN1_write_bio((i2d_of_void *)i2d_EC_PUBKEY, PEM_STRING_PUBLIC, bp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_bio_EC_PUBKEY); #endif @@ -593,6 +643,7 @@ PEM_read_DHparams(FILE *fp, DH **x, pem_password_cb *cb, void *u) return PEM_ASN1_read((d2i_of_void *)d2i_DHparams, PEM_STRING_DHPARAMS, fp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_DHparams); int PEM_write_DHparams(FILE *fp, const DH *x) @@ -600,6 +651,7 @@ PEM_write_DHparams(FILE *fp, const DH *x) return PEM_ASN1_write((i2d_of_void *)i2d_DHparams, PEM_STRING_DHPARAMS, fp, (void *)x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_DHparams); DH * PEM_read_bio_DHparams(BIO *bp, DH **x, pem_password_cb *cb, void *u) @@ -607,6 +659,7 @@ PEM_read_bio_DHparams(BIO *bp, DH **x, pem_password_cb *cb, void *u) return PEM_ASN1_read_bio((d2i_of_void *)d2i_DHparams, PEM_STRING_DHPARAMS, bp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_bio_DHparams); int PEM_write_bio_DHparams(BIO *bp, const DH *x) @@ -614,6 +667,7 @@ PEM_write_bio_DHparams(BIO *bp, const DH *x) return PEM_ASN1_write_bio((i2d_of_void *)i2d_DHparams, PEM_STRING_DHPARAMS, bp, (void *)x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_bio_DHparams); #endif @@ -623,6 +677,7 @@ PEM_read_PUBKEY(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u) return PEM_ASN1_read((d2i_of_void *)d2i_PUBKEY, PEM_STRING_PUBLIC, fp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_PUBKEY); int PEM_write_PUBKEY(FILE *fp, EVP_PKEY *x) @@ -630,6 +685,7 @@ PEM_write_PUBKEY(FILE *fp, EVP_PKEY *x) return PEM_ASN1_write((i2d_of_void *)i2d_PUBKEY, PEM_STRING_PUBLIC, fp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_PUBKEY); EVP_PKEY * PEM_read_bio_PUBKEY(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u) @@ -637,6 +693,7 @@ PEM_read_bio_PUBKEY(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u) return PEM_ASN1_read_bio((d2i_of_void *)d2i_PUBKEY, PEM_STRING_PUBLIC, bp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_bio_PUBKEY); int PEM_write_bio_PUBKEY(BIO *bp, EVP_PKEY *x) @@ -644,3 +701,4 @@ PEM_write_bio_PUBKEY(BIO *bp, EVP_PKEY *x) return PEM_ASN1_write_bio((i2d_of_void *)i2d_PUBKEY, PEM_STRING_PUBLIC, bp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_bio_PUBKEY); diff --git a/lib/libcrypto/pem/pem_err.c b/lib/libcrypto/pem/pem_err.c index d817cafff..a94e2d5eb 100644 --- a/lib/libcrypto/pem/pem_err.c +++ b/lib/libcrypto/pem/pem_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pem_err.c,v 1.13 2022/07/12 14:42:50 kn Exp $ */ +/* $OpenBSD: pem_err.c,v 1.14 2023/07/07 13:40:44 beck Exp $ */ /* ==================================================================== * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. * @@ -114,3 +114,4 @@ ERR_load_PEM_strings(void) } #endif } +LCRYPTO_ALIAS(ERR_load_PEM_strings); diff --git a/lib/libcrypto/pem/pem_info.c b/lib/libcrypto/pem/pem_info.c index 3cca828cf..b979c79b3 100644 --- a/lib/libcrypto/pem/pem_info.c +++ b/lib/libcrypto/pem/pem_info.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pem_info.c,v 1.26 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: pem_info.c,v 1.27 2023/07/07 13:40:44 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -93,6 +93,7 @@ PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, BIO_free(b); return (ret); } +LCRYPTO_ALIAS(PEM_X509_INFO_read); STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, @@ -288,6 +289,7 @@ err: return ret; } +LCRYPTO_ALIAS(PEM_X509_INFO_read_bio); /* A TJH addition */ @@ -382,3 +384,4 @@ err: explicit_bzero(buf, PEM_BUFSIZE); return (ret); } +LCRYPTO_ALIAS(PEM_X509_INFO_write_bio); diff --git a/lib/libcrypto/pem/pem_lib.c b/lib/libcrypto/pem/pem_lib.c index 72cdd41b0..3f23a0131 100644 --- a/lib/libcrypto/pem/pem_lib.c +++ b/lib/libcrypto/pem/pem_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pem_lib.c,v 1.52 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: pem_lib.c,v 1.53 2023/07/07 13:40:44 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -127,6 +127,7 @@ PEM_def_callback(char *buf, int num, int w, void *key) } return (int)l; } +LCRYPTO_ALIAS(PEM_def_callback); void PEM_proc_type(char *buf, int type) @@ -146,6 +147,7 @@ PEM_proc_type(char *buf, int type) strlcat(buf, str, PEM_BUFSIZE); strlcat(buf, "\n", PEM_BUFSIZE); } +LCRYPTO_ALIAS(PEM_proc_type); void PEM_dek_info(char *buf, const char *type, int len, char *str) @@ -167,6 +169,7 @@ PEM_dek_info(char *buf, const char *type, int len, char *str) buf[j + i * 2] = '\n'; buf[j + i * 2 + 1] = '\0'; } +LCRYPTO_ALIAS(PEM_dek_info); void * PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, @@ -184,6 +187,7 @@ PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, BIO_free(b); return (ret); } +LCRYPTO_ALIAS(PEM_ASN1_read); static int check_pem(const char *nm, const char *name) @@ -322,6 +326,7 @@ err: free(data); return ret; } +LCRYPTO_ALIAS(PEM_bytes_read_bio); int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp, void *x, @@ -340,6 +345,7 @@ PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp, void *x, BIO_free(b); return (ret); } +LCRYPTO_ALIAS(PEM_ASN1_write); int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, void *x, @@ -438,6 +444,7 @@ err: freezero(data, (unsigned int)dsize); return (ret); } +LCRYPTO_ALIAS(PEM_ASN1_write_bio); int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *plen, @@ -483,6 +490,7 @@ PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *plen, *plen = j + i; return (1); } +LCRYPTO_ALIAS(PEM_do_header); int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher) @@ -544,6 +552,7 @@ PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher) return (1); } +LCRYPTO_ALIAS(PEM_get_EVP_CIPHER_INFO); static int load_iv(char **fromp, unsigned char *to, int num) @@ -590,6 +599,7 @@ PEM_write(FILE *fp, const char *name, const char *header, BIO_free(b); return (ret); } +LCRYPTO_ALIAS(PEM_write); int PEM_write_bio(BIO *bp, const char *name, const char *header, @@ -647,6 +657,7 @@ err: PEMerror(reason); return (0); } +LCRYPTO_ALIAS(PEM_write_bio); int PEM_read(FILE *fp, char **name, char **header, unsigned char **data, long *len) @@ -663,6 +674,7 @@ PEM_read(FILE *fp, char **name, char **header, unsigned char **data, long *len) BIO_free(b); return (ret); } +LCRYPTO_ALIAS(PEM_read); int PEM_read_bio(BIO *bp, char **name, char **header, unsigned char **data, @@ -835,6 +847,7 @@ err: BUF_MEM_free(dataB); return (0); } +LCRYPTO_ALIAS(PEM_read_bio); /* Check pem string and return prefix length. * If for example the pem_str == "RSA PRIVATE KEY" and suffix = "PRIVATE KEY" diff --git a/lib/libcrypto/pem/pem_oth.c b/lib/libcrypto/pem/pem_oth.c index 21498cb6b..2dca978ef 100644 --- a/lib/libcrypto/pem/pem_oth.c +++ b/lib/libcrypto/pem/pem_oth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pem_oth.c,v 1.8 2017/01/29 17:49:23 beck Exp $ */ +/* $OpenBSD: pem_oth.c,v 1.9 2023/07/07 13:40:44 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -85,3 +85,4 @@ PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x, free(data); return (ret); } +LCRYPTO_ALIAS(PEM_ASN1_read_bio); diff --git a/lib/libcrypto/pem/pem_pk8.c b/lib/libcrypto/pem/pem_pk8.c index 43581905f..6d0c0cbd5 100644 --- a/lib/libcrypto/pem/pem_pk8.c +++ b/lib/libcrypto/pem/pem_pk8.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pem_pk8.c,v 1.13 2017/01/29 17:49:23 beck Exp $ */ +/* $OpenBSD: pem_pk8.c,v 1.14 2023/07/07 13:40:44 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -84,6 +84,7 @@ PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid, char *kstr, { return do_pk8pkey(bp, x, 0, nid, NULL, kstr, klen, cb, u); } +LCRYPTO_ALIAS(PEM_write_bio_PKCS8PrivateKey_nid); int PEM_write_bio_PKCS8PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, @@ -91,6 +92,7 @@ PEM_write_bio_PKCS8PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, { return do_pk8pkey(bp, x, 0, -1, enc, kstr, klen, cb, u); } +LCRYPTO_ALIAS(PEM_write_bio_PKCS8PrivateKey); int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, @@ -98,6 +100,7 @@ i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, { return do_pk8pkey(bp, x, 1, -1, enc, kstr, klen, cb, u); } +LCRYPTO_ALIAS(i2d_PKCS8PrivateKey_bio); int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid, @@ -105,6 +108,7 @@ i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid, { return do_pk8pkey(bp, x, 1, nid, NULL, kstr, klen, cb, u); } +LCRYPTO_ALIAS(i2d_PKCS8PrivateKey_nid_bio); static int do_pk8pkey(BIO *bp, EVP_PKEY *x, int isder, int nid, const EVP_CIPHER *enc, @@ -188,6 +192,7 @@ d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u) } return ret; } +LCRYPTO_ALIAS(d2i_PKCS8PrivateKey_bio); int @@ -196,6 +201,7 @@ i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, { return do_pk8pkey_fp(fp, x, 1, -1, enc, kstr, klen, cb, u); } +LCRYPTO_ALIAS(i2d_PKCS8PrivateKey_fp); int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid, char *kstr, @@ -203,6 +209,7 @@ i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid, char *kstr, { return do_pk8pkey_fp(fp, x, 1, nid, NULL, kstr, klen, cb, u); } +LCRYPTO_ALIAS(i2d_PKCS8PrivateKey_nid_fp); int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid, char *kstr, @@ -210,6 +217,7 @@ PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid, char *kstr, { return do_pk8pkey_fp(fp, x, 0, nid, NULL, kstr, klen, cb, u); } +LCRYPTO_ALIAS(PEM_write_PKCS8PrivateKey_nid); int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, @@ -217,6 +225,7 @@ PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, { return do_pk8pkey_fp(fp, x, 0, -1, enc, kstr, klen, cb, u); } +LCRYPTO_ALIAS(PEM_write_PKCS8PrivateKey); static int do_pk8pkey_fp(FILE *fp, EVP_PKEY *x, int isder, int nid, const EVP_CIPHER *enc, @@ -248,6 +257,7 @@ d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u) BIO_free(bp); return ret; } +LCRYPTO_ALIAS(d2i_PKCS8PrivateKey_fp); X509_SIG * PEM_read_PKCS8(FILE *fp, X509_SIG **x, pem_password_cb *cb, void *u) @@ -255,6 +265,7 @@ PEM_read_PKCS8(FILE *fp, X509_SIG **x, pem_password_cb *cb, void *u) return PEM_ASN1_read((d2i_of_void *)d2i_X509_SIG, PEM_STRING_PKCS8, fp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_PKCS8); int PEM_write_PKCS8(FILE *fp, X509_SIG *x) @@ -262,6 +273,7 @@ PEM_write_PKCS8(FILE *fp, X509_SIG *x) return PEM_ASN1_write((i2d_of_void *)i2d_X509_SIG, PEM_STRING_PKCS8, fp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_PKCS8); X509_SIG * PEM_read_bio_PKCS8(BIO *bp, X509_SIG **x, pem_password_cb *cb, void *u) @@ -269,6 +281,7 @@ PEM_read_bio_PKCS8(BIO *bp, X509_SIG **x, pem_password_cb *cb, void *u) return PEM_ASN1_read_bio((d2i_of_void *)d2i_X509_SIG, PEM_STRING_PKCS8, bp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_bio_PKCS8); int PEM_write_bio_PKCS8(BIO *bp, X509_SIG *x) @@ -276,6 +289,7 @@ PEM_write_bio_PKCS8(BIO *bp, X509_SIG *x) return PEM_ASN1_write_bio((i2d_of_void *)i2d_X509_SIG, PEM_STRING_PKCS8, bp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_bio_PKCS8); PKCS8_PRIV_KEY_INFO * PEM_read_PKCS8_PRIV_KEY_INFO(FILE *fp, PKCS8_PRIV_KEY_INFO **x, pem_password_cb *cb, void *u) @@ -283,6 +297,7 @@ PEM_read_PKCS8_PRIV_KEY_INFO(FILE *fp, PKCS8_PRIV_KEY_INFO **x, pem_password_cb return PEM_ASN1_read((d2i_of_void *)d2i_PKCS8_PRIV_KEY_INFO, PEM_STRING_PKCS8INF, fp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_PKCS8_PRIV_KEY_INFO); int PEM_write_PKCS8_PRIV_KEY_INFO(FILE *fp, PKCS8_PRIV_KEY_INFO *x) @@ -290,6 +305,7 @@ PEM_write_PKCS8_PRIV_KEY_INFO(FILE *fp, PKCS8_PRIV_KEY_INFO *x) return PEM_ASN1_write((i2d_of_void *)i2d_PKCS8_PRIV_KEY_INFO, PEM_STRING_PKCS8INF, fp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_PKCS8_PRIV_KEY_INFO); PKCS8_PRIV_KEY_INFO * PEM_read_bio_PKCS8_PRIV_KEY_INFO(BIO *bp, PKCS8_PRIV_KEY_INFO **x, pem_password_cb *cb, void *u) @@ -297,6 +313,7 @@ PEM_read_bio_PKCS8_PRIV_KEY_INFO(BIO *bp, PKCS8_PRIV_KEY_INFO **x, pem_password_ return PEM_ASN1_read_bio((d2i_of_void *)d2i_PKCS8_PRIV_KEY_INFO, PEM_STRING_PKCS8INF, bp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_bio_PKCS8_PRIV_KEY_INFO); int PEM_write_bio_PKCS8_PRIV_KEY_INFO(BIO *bp, PKCS8_PRIV_KEY_INFO *x) @@ -304,3 +321,4 @@ PEM_write_bio_PKCS8_PRIV_KEY_INFO(BIO *bp, PKCS8_PRIV_KEY_INFO *x) return PEM_ASN1_write_bio((i2d_of_void *)i2d_PKCS8_PRIV_KEY_INFO, PEM_STRING_PKCS8INF, bp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_bio_PKCS8_PRIV_KEY_INFO); diff --git a/lib/libcrypto/pem/pem_pkey.c b/lib/libcrypto/pem/pem_pkey.c index fa2d38f56..296195213 100644 --- a/lib/libcrypto/pem/pem_pkey.c +++ b/lib/libcrypto/pem/pem_pkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pem_pkey.c,v 1.26 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: pem_pkey.c,v 1.27 2023/07/07 13:40:44 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -147,6 +147,7 @@ err: freezero(data, len); return (ret); } +LCRYPTO_ALIAS(PEM_read_bio_PrivateKey); int PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, @@ -159,6 +160,7 @@ PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, return PEM_write_bio_PrivateKey_traditional(bp, x, enc, kstr, klen, cb, u); } +LCRYPTO_ALIAS(PEM_write_bio_PrivateKey); int PEM_write_bio_PrivateKey_traditional(BIO *bp, EVP_PKEY *x, @@ -172,6 +174,7 @@ PEM_write_bio_PrivateKey_traditional(BIO *bp, EVP_PKEY *x, return PEM_ASN1_write_bio((i2d_of_void *)i2d_PrivateKey, pem_str, bp, x, enc, kstr, klen, cb, u); } +LCRYPTO_ALIAS(PEM_write_bio_PrivateKey_traditional); EVP_PKEY * PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x) @@ -212,6 +215,7 @@ err: free(data); return (ret); } +LCRYPTO_ALIAS(PEM_read_bio_Parameters); int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x) @@ -226,6 +230,7 @@ PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x) return PEM_ASN1_write_bio((i2d_of_void *)x->ameth->param_encode, pem_str, bp, x, NULL, NULL, 0, 0, NULL); } +LCRYPTO_ALIAS(PEM_write_bio_Parameters); EVP_PKEY * PEM_read_PrivateKey(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u) @@ -242,6 +247,7 @@ PEM_read_PrivateKey(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u) BIO_free(b); return (ret); } +LCRYPTO_ALIAS(PEM_read_PrivateKey); int PEM_write_PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, @@ -258,4 +264,4 @@ PEM_write_PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, BIO_free(b); return ret; } - +LCRYPTO_ALIAS(PEM_write_PrivateKey); diff --git a/lib/libcrypto/pem/pem_sign.c b/lib/libcrypto/pem/pem_sign.c index fddeec79f..461f95744 100644 --- a/lib/libcrypto/pem/pem_sign.c +++ b/lib/libcrypto/pem/pem_sign.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pem_sign.c,v 1.14 2018/08/24 19:51:31 tb Exp $ */ +/* $OpenBSD: pem_sign.c,v 1.15 2023/07/07 13:40:44 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -69,6 +69,7 @@ PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type) { return EVP_DigestInit_ex(ctx, type, NULL); } +LCRYPTO_ALIAS(PEM_SignInit); int PEM_SignUpdate(EVP_MD_CTX *ctx, unsigned char *data, @@ -76,6 +77,7 @@ PEM_SignUpdate(EVP_MD_CTX *ctx, unsigned char *data, { return EVP_DigestUpdate(ctx, data, count); } +LCRYPTO_ALIAS(PEM_SignUpdate); int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen, @@ -103,3 +105,4 @@ err: free(m); return (ret); } +LCRYPTO_ALIAS(PEM_SignFinal); diff --git a/lib/libcrypto/pem/pem_x509.c b/lib/libcrypto/pem/pem_x509.c index f440a9f0a..0016413b5 100644 --- a/lib/libcrypto/pem/pem_x509.c +++ b/lib/libcrypto/pem/pem_x509.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pem_x509.c,v 1.8 2016/09/04 16:10:38 jsing Exp $ */ +/* $OpenBSD: pem_x509.c,v 1.9 2023/07/07 13:40:44 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2001. */ @@ -71,6 +71,7 @@ PEM_read_X509(FILE *fp, X509 **x, pem_password_cb *cb, void *u) return PEM_ASN1_read((d2i_of_void *)d2i_X509, PEM_STRING_X509, fp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_X509); int PEM_write_X509(FILE *fp, X509 *x) @@ -78,6 +79,7 @@ PEM_write_X509(FILE *fp, X509 *x) return PEM_ASN1_write((i2d_of_void *)i2d_X509, PEM_STRING_X509, fp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_X509); X509 * PEM_read_bio_X509(BIO *bp, X509 **x, pem_password_cb *cb, void *u) @@ -85,6 +87,7 @@ PEM_read_bio_X509(BIO *bp, X509 **x, pem_password_cb *cb, void *u) return PEM_ASN1_read_bio((d2i_of_void *)d2i_X509, PEM_STRING_X509, bp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_bio_X509); int PEM_write_bio_X509(BIO *bp, X509 *x) @@ -92,3 +95,4 @@ PEM_write_bio_X509(BIO *bp, X509 *x) return PEM_ASN1_write_bio((i2d_of_void *)i2d_X509, PEM_STRING_X509, bp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_bio_X509); diff --git a/lib/libcrypto/pem/pem_xaux.c b/lib/libcrypto/pem/pem_xaux.c index 68a785170..5f44a2b5e 100644 --- a/lib/libcrypto/pem/pem_xaux.c +++ b/lib/libcrypto/pem/pem_xaux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pem_xaux.c,v 1.10 2021/10/31 16:28:50 tb Exp $ */ +/* $OpenBSD: pem_xaux.c,v 1.11 2023/07/07 13:40:44 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2001. */ @@ -71,6 +71,7 @@ PEM_read_X509_AUX(FILE *fp, X509 **x, pem_password_cb *cb, void *u) return PEM_ASN1_read((d2i_of_void *)d2i_X509_AUX, PEM_STRING_X509_TRUSTED, fp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_X509_AUX); int PEM_write_X509_AUX(FILE *fp, X509 *x) @@ -78,6 +79,7 @@ PEM_write_X509_AUX(FILE *fp, X509 *x) return PEM_ASN1_write((i2d_of_void *)i2d_X509_AUX, PEM_STRING_X509_TRUSTED, fp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_X509_AUX); X509 * PEM_read_bio_X509_AUX(BIO *bp, X509 **x, pem_password_cb *cb, void *u) @@ -85,6 +87,7 @@ PEM_read_bio_X509_AUX(BIO *bp, X509 **x, pem_password_cb *cb, void *u) return PEM_ASN1_read_bio((d2i_of_void *)d2i_X509_AUX, PEM_STRING_X509_TRUSTED, bp, (void **)x, cb, u); } +LCRYPTO_ALIAS(PEM_read_bio_X509_AUX); int PEM_write_bio_X509_AUX(BIO *bp, X509 *x) @@ -92,3 +95,4 @@ PEM_write_bio_X509_AUX(BIO *bp, X509 *x) return PEM_ASN1_write_bio((i2d_of_void *)i2d_X509_AUX, PEM_STRING_X509_TRUSTED, bp, x, NULL, NULL, 0, NULL, NULL); } +LCRYPTO_ALIAS(PEM_write_bio_X509_AUX); diff --git a/lib/libcrypto/pem/pvkfmt.c b/lib/libcrypto/pem/pvkfmt.c index 1417a7b3c..816d8b7dc 100644 --- a/lib/libcrypto/pem/pvkfmt.c +++ b/lib/libcrypto/pem/pvkfmt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pvkfmt.c,v 1.26 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: pvkfmt.c,v 1.27 2023/07/07 13:40:44 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2005. */ @@ -414,24 +414,28 @@ b2i_PrivateKey(const unsigned char **in, long length) { return do_b2i(in, length, 0); } +LCRYPTO_ALIAS(b2i_PrivateKey); EVP_PKEY * b2i_PublicKey(const unsigned char **in, long length) { return do_b2i(in, length, 1); } +LCRYPTO_ALIAS(b2i_PublicKey); EVP_PKEY * b2i_PrivateKey_bio(BIO *in) { return do_b2i_bio(in, 0); } +LCRYPTO_ALIAS(b2i_PrivateKey_bio); EVP_PKEY * b2i_PublicKey_bio(BIO *in) { return do_b2i_bio(in, 1); } +LCRYPTO_ALIAS(b2i_PublicKey_bio); static void write_ledword(unsigned char **out, unsigned int dw) @@ -646,12 +650,14 @@ i2b_PrivateKey_bio(BIO *out, EVP_PKEY *pk) { return do_i2b_bio(out, pk, 0); } +LCRYPTO_ALIAS(i2b_PrivateKey_bio); int i2b_PublicKey_bio(BIO *out, EVP_PKEY *pk) { return do_i2b_bio(out, pk, 1); } +LCRYPTO_ALIAS(i2b_PublicKey_bio); #ifndef OPENSSL_NO_RC4 @@ -837,6 +843,7 @@ b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u) freezero(buf, buflen); return ret; } +LCRYPTO_ALIAS(b2i_PVK_bio); static int i2b_PVK(unsigned char **out, EVP_PKEY*pk, int enclevel, pem_password_cb *cb, @@ -930,6 +937,7 @@ i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel, pem_password_cb *cb, void *u) } return outlen; } +LCRYPTO_ALIAS(i2b_PVK_bio); #endif diff --git a/lib/libcrypto/poly1305/poly1305.c b/lib/libcrypto/poly1305/poly1305.c index 75a34cc3e..a34e8f8e8 100644 --- a/lib/libcrypto/poly1305/poly1305.c +++ b/lib/libcrypto/poly1305/poly1305.c @@ -1,4 +1,4 @@ -/* $OpenBSD: poly1305.c,v 1.3 2014/06/12 15:49:30 deraadt Exp $ */ +/* $OpenBSD: poly1305.c,v 1.4 2023/07/07 12:01:32 beck Exp $ */ /* * Copyright (c) 2014 Joel Sing * @@ -23,6 +23,7 @@ CRYPTO_poly1305_init(poly1305_context *ctx, const unsigned char key[32]) { poly1305_init(ctx, key); } +LCRYPTO_ALIAS(CRYPTO_poly1305_init); void CRYPTO_poly1305_update(poly1305_context *ctx, const unsigned char *in, @@ -30,9 +31,11 @@ CRYPTO_poly1305_update(poly1305_context *ctx, const unsigned char *in, { poly1305_update(ctx, in, len); } +LCRYPTO_ALIAS(CRYPTO_poly1305_update); void CRYPTO_poly1305_finish(poly1305_context *ctx, unsigned char mac[16]) { poly1305_finish(ctx, mac); } +LCRYPTO_ALIAS(CRYPTO_poly1305_finish); diff --git a/lib/libcrypto/rand/rand_err.c b/lib/libcrypto/rand/rand_err.c index c57b9a8d6..b156c0c87 100644 --- a/lib/libcrypto/rand/rand_err.c +++ b/lib/libcrypto/rand/rand_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rand_err.c,v 1.16 2022/07/12 14:42:50 kn Exp $ */ +/* $OpenBSD: rand_err.c,v 1.17 2023/07/07 12:01:32 beck Exp $ */ /* ==================================================================== * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * @@ -91,3 +91,4 @@ ERR_load_RAND_strings(void) } #endif } +LCRYPTO_ALIAS(ERR_load_RAND_strings); diff --git a/lib/libcrypto/rand/rand_lib.c b/lib/libcrypto/rand/rand_lib.c index 8342a55f0..5c5df98c9 100644 --- a/lib/libcrypto/rand/rand_lib.c +++ b/lib/libcrypto/rand/rand_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rand_lib.c,v 1.20 2014/10/22 13:02:04 jsing Exp $ */ +/* $OpenBSD: rand_lib.c,v 1.22 2023/07/07 19:37:54 beck Exp $ */ /* * Copyright (c) 2014 Ted Unangst * @@ -29,18 +29,21 @@ RAND_set_rand_method(const RAND_METHOD *meth) { return 1; } +LCRYPTO_ALIAS(RAND_set_rand_method); const RAND_METHOD * RAND_get_rand_method(void) { return NULL; } +LCRYPTO_ALIAS(RAND_get_rand_method); RAND_METHOD * RAND_SSLeay(void) { return NULL; } +LCRYPTO_ALIAS(RAND_SSLeay); #ifndef OPENSSL_NO_ENGINE int @@ -48,6 +51,7 @@ RAND_set_rand_engine(ENGINE *engine) { return 1; } +LCRYPTO_ALIAS(RAND_set_rand_engine); #endif void diff --git a/lib/libcrypto/rand/randfile.c b/lib/libcrypto/rand/randfile.c index 72c065c48..00008af75 100644 --- a/lib/libcrypto/rand/randfile.c +++ b/lib/libcrypto/rand/randfile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: randfile.c,v 1.42 2015/09/10 15:56:25 jsing Exp $ */ +/* $OpenBSD: randfile.c,v 1.44 2023/07/07 19:37:54 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/lib/libcrypto/rc2/rc2.h b/lib/libcrypto/rc2/rc2.h index 21511ff36..09c6c08a5 100644 --- a/lib/libcrypto/rc2/rc2.h +++ b/lib/libcrypto/rc2/rc2.h @@ -1,25 +1,25 @@ -/* $OpenBSD: rc2.h,v 1.11 2014/07/10 22:45:57 jsing Exp $ */ +/* $OpenBSD: rc2.h,v 1.12 2023/07/07 08:29:37 beck Exp $ */ /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -75,24 +75,23 @@ extern "C" { #endif -typedef struct rc2_key_st - { +typedef struct rc2_key_st { RC2_INT data[64]; - } RC2_KEY; +} RC2_KEY; -void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,int bits); -void RC2_ecb_encrypt(const unsigned char *in,unsigned char *out,RC2_KEY *key, - int enc); -void RC2_encrypt(unsigned long *data,RC2_KEY *key); -void RC2_decrypt(unsigned long *data,RC2_KEY *key); +void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits); +void RC2_ecb_encrypt(const unsigned char *in, unsigned char *out, RC2_KEY *key, + int enc); +void RC2_encrypt(unsigned long *data, RC2_KEY *key); +void RC2_decrypt(unsigned long *data, RC2_KEY *key); void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, - RC2_KEY *ks, unsigned char *iv, int enc); + RC2_KEY *ks, unsigned char *iv, int enc); void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, RC2_KEY *schedule, unsigned char *ivec, - int *num, int enc); + long length, RC2_KEY *schedule, unsigned char *ivec, + int *num, int enc); void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, RC2_KEY *schedule, unsigned char *ivec, - int *num); + long length, RC2_KEY *schedule, unsigned char *ivec, + int *num); #ifdef __cplusplus } diff --git a/lib/libcrypto/rc2/rc2_cbc.c b/lib/libcrypto/rc2/rc2_cbc.c index 44204affb..1d8e2def9 100644 --- a/lib/libcrypto/rc2/rc2_cbc.c +++ b/lib/libcrypto/rc2/rc2_cbc.c @@ -1,25 +1,25 @@ -/* $OpenBSD: rc2_cbc.c,v 1.6 2022/11/26 16:08:54 tb Exp $ */ +/* $OpenBSD: rc2_cbc.c,v 1.8 2023/07/07 13:40:44 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -59,168 +59,178 @@ #include #include "rc2_local.h" -void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, - RC2_KEY *ks, unsigned char *iv, int encrypt) - { - unsigned long tin0,tin1; - unsigned long tout0,tout1,xor0,xor1; - long l=length; +void +RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, + RC2_KEY *ks, unsigned char *iv, int encrypt) +{ + unsigned long tin0, tin1; + unsigned long tout0, tout1, xor0, xor1; + long l = length; unsigned long tin[2]; - if (encrypt) + if (encrypt) { + c2l(iv, tout0); + c2l(iv, tout1); + iv -= 8; + for (l -= 8; l >= 0; l -= 8) { - c2l(iv,tout0); - c2l(iv,tout1); - iv-=8; - for (l-=8; l>=0; l-=8) - { - c2l(in,tin0); - c2l(in,tin1); - tin0^=tout0; - tin1^=tout1; - tin[0]=tin0; - tin[1]=tin1; - RC2_encrypt(tin,ks); - tout0=tin[0]; l2c(tout0,out); - tout1=tin[1]; l2c(tout1,out); - } - if (l != -8) - { - c2ln(in,tin0,tin1,l+8); - tin0^=tout0; - tin1^=tout1; - tin[0]=tin0; - tin[1]=tin1; - RC2_encrypt(tin,ks); - tout0=tin[0]; l2c(tout0,out); - tout1=tin[1]; l2c(tout1,out); - } - l2c(tout0,iv); - l2c(tout1,iv); + c2l(in, tin0); + c2l(in, tin1); + tin0 ^= tout0; + tin1 ^= tout1; + tin[0] = tin0; + tin[1] = tin1; + RC2_encrypt(tin, ks); + tout0 = tin[0]; + l2c(tout0, out); + tout1 = tin[1]; + l2c(tout1, out); } - else + if (l != -8) { + c2ln(in, tin0, tin1, l + 8); + tin0 ^= tout0; + tin1 ^= tout1; + tin[0] = tin0; + tin[1] = tin1; + RC2_encrypt(tin, ks); + tout0 = tin[0]; + l2c(tout0, out); + tout1 = tin[1]; + l2c(tout1, out); + } + l2c(tout0, iv); + l2c(tout1, iv); + } else { + c2l(iv, xor0); + c2l(iv, xor1); + iv -= 8; + for (l -= 8; l >= 0; l -= 8) { - c2l(iv,xor0); - c2l(iv,xor1); - iv-=8; - for (l-=8; l>=0; l-=8) - { - c2l(in,tin0); tin[0]=tin0; - c2l(in,tin1); tin[1]=tin1; - RC2_decrypt(tin,ks); - tout0=tin[0]^xor0; - tout1=tin[1]^xor1; - l2c(tout0,out); - l2c(tout1,out); - xor0=tin0; - xor1=tin1; - } - if (l != -8) - { - c2l(in,tin0); tin[0]=tin0; - c2l(in,tin1); tin[1]=tin1; - RC2_decrypt(tin,ks); - tout0=tin[0]^xor0; - tout1=tin[1]^xor1; - l2cn(tout0,tout1,out,l+8); - xor0=tin0; - xor1=tin1; - } - l2c(xor0,iv); - l2c(xor1,iv); + c2l(in, tin0); + tin[0] = tin0; + c2l(in, tin1); + tin[1] = tin1; + RC2_decrypt(tin, ks); + tout0 = tin[0] ^ xor0; + tout1 = tin[1] ^ xor1; + l2c(tout0, out); + l2c(tout1, out); + xor0 = tin0; + xor1 = tin1; } - tin0=tin1=tout0=tout1=xor0=xor1=0; - tin[0]=tin[1]=0; + if (l != -8) { + c2l(in, tin0); + tin[0] = tin0; + c2l(in, tin1); + tin[1] = tin1; + RC2_decrypt(tin, ks); + tout0 = tin[0] ^ xor0; + tout1 = tin[1] ^ xor1; + l2cn(tout0, tout1, out, l + 8); + xor0 = tin0; + xor1 = tin1; + } + l2c(xor0, iv); + l2c(xor1, iv); } + tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0; + tin[0] = tin[1] = 0; +} +LCRYPTO_ALIAS(RC2_cbc_encrypt); -void RC2_encrypt(unsigned long *d, RC2_KEY *key) - { - int i,n; - RC2_INT *p0,*p1; - RC2_INT x0,x1,x2,x3,t; +void +RC2_encrypt(unsigned long *d, RC2_KEY *key) +{ + int i, n; + RC2_INT *p0, *p1; + RC2_INT x0, x1, x2, x3, t; unsigned long l; - l=d[0]; - x0=(RC2_INT)l&0xffff; - x1=(RC2_INT)(l>>16L); - l=d[1]; - x2=(RC2_INT)l&0xffff; - x3=(RC2_INT)(l>>16L); + l = d[0]; + x0 = (RC2_INT)l & 0xffff; + x1 = (RC2_INT)(l >> 16L); + l = d[1]; + x2 = (RC2_INT)l & 0xffff; + x3 = (RC2_INT)(l >> 16L); - n=3; - i=5; + n = 3; + i = 5; - p0=p1= &(key->data[0]); - for (;;) - { - t=(x0+(x1& ~x3)+(x2&x3)+ *(p0++))&0xffff; - x0=(t<<1)|(t>>15); - t=(x1+(x2& ~x0)+(x3&x0)+ *(p0++))&0xffff; - x1=(t<<2)|(t>>14); - t=(x2+(x3& ~x1)+(x0&x1)+ *(p0++))&0xffff; - x2=(t<<3)|(t>>13); - t=(x3+(x0& ~x2)+(x1&x2)+ *(p0++))&0xffff; - x3=(t<<5)|(t>>11); + p0 = p1 = &(key->data[0]); + for (;;) { + t = (x0 + (x1 & ~x3) + (x2 & x3) + *(p0++)) & 0xffff; + x0 = (t << 1)|(t >> 15); + t = (x1 + (x2 & ~x0) + (x3 & x0) + *(p0++)) & 0xffff; + x1 = (t << 2)|(t >> 14); + t = (x2 + (x3 & ~x1) + (x0 & x1) + *(p0++)) & 0xffff; + x2 = (t << 3)|(t >> 13); + t = (x3 + (x0 & ~x2) + (x1 & x2) + *(p0++)) & 0xffff; + x3 = (t << 5)|(t >> 11); - if (--i == 0) - { - if (--n == 0) break; - i=(n == 2)?6:5; + if (--i == 0) { + if (--n == 0) + break; + i = (n == 2) ? 6 : 5; - x0+=p1[x3&0x3f]; - x1+=p1[x0&0x3f]; - x2+=p1[x1&0x3f]; - x3+=p1[x2&0x3f]; - } + x0 += p1[x3 & 0x3f]; + x1 += p1[x0 & 0x3f]; + x2 += p1[x1 & 0x3f]; + x3 += p1[x2 & 0x3f]; } - - d[0]=(unsigned long)(x0&0xffff)|((unsigned long)(x1&0xffff)<<16L); - d[1]=(unsigned long)(x2&0xffff)|((unsigned long)(x3&0xffff)<<16L); } -void RC2_decrypt(unsigned long *d, RC2_KEY *key) - { - int i,n; - RC2_INT *p0,*p1; - RC2_INT x0,x1,x2,x3,t; + d[0] = (unsigned long)(x0 & 0xffff)|((unsigned long)(x1 & 0xffff) << + 16L); + d[1] = (unsigned long)(x2 & 0xffff)|((unsigned long)(x3 & 0xffff) << + 16L); +} +LCRYPTO_ALIAS(RC2_encrypt); + +void +RC2_decrypt(unsigned long *d, RC2_KEY *key) +{ + int i, n; + RC2_INT *p0, *p1; + RC2_INT x0, x1, x2, x3, t; unsigned long l; - l=d[0]; - x0=(RC2_INT)l&0xffff; - x1=(RC2_INT)(l>>16L); - l=d[1]; - x2=(RC2_INT)l&0xffff; - x3=(RC2_INT)(l>>16L); + l = d[0]; + x0 = (RC2_INT)l & 0xffff; + x1 = (RC2_INT)(l >> 16L); + l = d[1]; + x2 = (RC2_INT)l & 0xffff; + x3 = (RC2_INT)(l >> 16L); - n=3; - i=5; + n = 3; + i = 5; - p0= &(key->data[63]); - p1= &(key->data[0]); - for (;;) - { - t=((x3<<11)|(x3>>5))&0xffff; - x3=(t-(x0& ~x2)-(x1&x2)- *(p0--))&0xffff; - t=((x2<<13)|(x2>>3))&0xffff; - x2=(t-(x3& ~x1)-(x0&x1)- *(p0--))&0xffff; - t=((x1<<14)|(x1>>2))&0xffff; - x1=(t-(x2& ~x0)-(x3&x0)- *(p0--))&0xffff; - t=((x0<<15)|(x0>>1))&0xffff; - x0=(t-(x1& ~x3)-(x2&x3)- *(p0--))&0xffff; + p0 = &(key->data[63]); + p1 = &(key->data[0]); + for (;;) { + t = ((x3 << 11)|(x3 >> 5)) & 0xffff; + x3 = (t - (x0 & ~x2) - (x1 & x2) - *(p0--)) & 0xffff; + t = ((x2 << 13)|(x2 >> 3)) & 0xffff; + x2 = (t - (x3 & ~x1) - (x0 & x1) - *(p0--)) & 0xffff; + t = ((x1 << 14)|(x1 >> 2)) & 0xffff; + x1 = (t - (x2 & ~x0) - (x3 & x0) - *(p0--)) & 0xffff; + t = ((x0 << 15)|(x0 >> 1)) & 0xffff; + x0 = (t - (x1 & ~x3) - (x2 & x3) - *(p0--)) & 0xffff; - if (--i == 0) - { - if (--n == 0) break; - i=(n == 2)?6:5; + if (--i == 0) { + if (--n == 0) + break; + i = (n == 2) ? 6 : 5; - x3=(x3-p1[x2&0x3f])&0xffff; - x2=(x2-p1[x1&0x3f])&0xffff; - x1=(x1-p1[x0&0x3f])&0xffff; - x0=(x0-p1[x3&0x3f])&0xffff; - } + x3 = (x3 - p1[x2 & 0x3f]) & 0xffff; + x2 = (x2 - p1[x1 & 0x3f]) & 0xffff; + x1 = (x1 - p1[x0 & 0x3f]) & 0xffff; + x0 = (x0 - p1[x3 & 0x3f]) & 0xffff; } - - d[0]=(unsigned long)(x0&0xffff)|((unsigned long)(x1&0xffff)<<16L); - d[1]=(unsigned long)(x2&0xffff)|((unsigned long)(x3&0xffff)<<16L); } + d[0] = (unsigned long)(x0 & 0xffff)|((unsigned long)(x1 & 0xffff) << + 16L); + d[1] = (unsigned long)(x2 & 0xffff)|((unsigned long)(x3 & 0xffff) << + 16L); +} +LCRYPTO_ALIAS(RC2_decrypt); diff --git a/lib/libcrypto/rc2/rc2_ecb.c b/lib/libcrypto/rc2/rc2_ecb.c index 84a671a57..6a3c8098e 100644 --- a/lib/libcrypto/rc2/rc2_ecb.c +++ b/lib/libcrypto/rc2/rc2_ecb.c @@ -1,25 +1,25 @@ -/* $OpenBSD: rc2_ecb.c,v 1.7 2022/11/26 16:08:54 tb Exp $ */ +/* $OpenBSD: rc2_ecb.c,v 1.9 2023/07/07 13:40:44 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -68,19 +68,24 @@ * Date: 11 Feb 1996 06:45:03 GMT */ -void RC2_ecb_encrypt(const unsigned char *in, unsigned char *out, RC2_KEY *ks, - int encrypt) - { - unsigned long l,d[2]; +void +RC2_ecb_encrypt(const unsigned char *in, unsigned char *out, RC2_KEY *ks, + int encrypt) +{ + unsigned long l, d[2]; - c2l(in,l); d[0]=l; - c2l(in,l); d[1]=l; + c2l(in, l); + d[0] = l; + c2l(in, l); + d[1] = l; if (encrypt) - RC2_encrypt(d,ks); + RC2_encrypt(d, ks); else - RC2_decrypt(d,ks); - l=d[0]; l2c(l,out); - l=d[1]; l2c(l,out); - l=d[0]=d[1]=0; - } - + RC2_decrypt(d, ks); + l = d[0]; + l2c(l, out); + l = d[1]; + l2c(l, out); + l = d[0] = d[1] = 0; +} +LCRYPTO_ALIAS(RC2_ecb_encrypt); diff --git a/lib/libcrypto/rc2/rc2_local.h b/lib/libcrypto/rc2/rc2_local.h index c8bb468d1..64c9c5388 100644 --- a/lib/libcrypto/rc2/rc2_local.h +++ b/lib/libcrypto/rc2/rc2_local.h @@ -1,25 +1,25 @@ -/* $OpenBSD: rc2_local.h,v 1.1 2022/11/26 16:08:54 tb Exp $ */ +/* $OpenBSD: rc2_local.h,v 1.2 2023/07/07 08:29:37 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -57,100 +57,99 @@ */ #undef c2l -#define c2l(c,l) (l =((unsigned long)(*((c)++))) , \ - l|=((unsigned long)(*((c)++)))<< 8L, \ - l|=((unsigned long)(*((c)++)))<<16L, \ +#define c2l(c,l) (l =((unsigned long)(*((c)++))) , \ + l|=((unsigned long)(*((c)++)))<< 8L, \ + l|=((unsigned long)(*((c)++)))<<16L, \ l|=((unsigned long)(*((c)++)))<<24L) /* NOTE - c is not incremented as per c2l */ #undef c2ln -#define c2ln(c,l1,l2,n) { \ - c+=n; \ - l1=l2=0; \ - switch (n) { \ - case 8: l2 =((unsigned long)(*(--(c))))<<24L; \ - case 7: l2|=((unsigned long)(*(--(c))))<<16L; \ - case 6: l2|=((unsigned long)(*(--(c))))<< 8L; \ - case 5: l2|=((unsigned long)(*(--(c)))); \ - case 4: l1 =((unsigned long)(*(--(c))))<<24L; \ - case 3: l1|=((unsigned long)(*(--(c))))<<16L; \ - case 2: l1|=((unsigned long)(*(--(c))))<< 8L; \ - case 1: l1|=((unsigned long)(*(--(c)))); \ - } \ +#define c2ln(c,l1,l2,n) { \ + c+=n; \ + l1=l2=0; \ + switch (n) { \ + case 8: l2 =((unsigned long)(*(--(c))))<<24L; \ + case 7: l2|=((unsigned long)(*(--(c))))<<16L; \ + case 6: l2|=((unsigned long)(*(--(c))))<< 8L; \ + case 5: l2|=((unsigned long)(*(--(c)))); \ + case 4: l1 =((unsigned long)(*(--(c))))<<24L; \ + case 3: l1|=((unsigned long)(*(--(c))))<<16L; \ + case 2: l1|=((unsigned long)(*(--(c))))<< 8L; \ + case 1: l1|=((unsigned long)(*(--(c)))); \ + } \ } #undef l2c -#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ +#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ *((c)++)=(unsigned char)(((l)>>24L)&0xff)) /* NOTE - c is not incremented as per l2c */ #undef l2cn -#define l2cn(l1,l2,c,n) { \ - c+=n; \ - switch (n) { \ - case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ - case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ - case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ - case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ - case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ - case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ - case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ - case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ - } \ +#define l2cn(l1,l2,c,n) { \ + c+=n; \ + switch (n) { \ + case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff);\ + case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff);\ + case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff);\ + case 5: *(--(c))=(unsigned char)(((l2) )&0xff);\ + case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff);\ + case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff);\ + case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff);\ + case 1: *(--(c))=(unsigned char)(((l1) )&0xff);\ + } \ } /* NOTE - c is not incremented as per n2l */ -#define n2ln(c,l1,l2,n) { \ - c+=n; \ - l1=l2=0; \ - switch (n) { \ - case 8: l2 =((unsigned long)(*(--(c)))) ; \ - case 7: l2|=((unsigned long)(*(--(c))))<< 8; \ - case 6: l2|=((unsigned long)(*(--(c))))<<16; \ - case 5: l2|=((unsigned long)(*(--(c))))<<24; \ - case 4: l1 =((unsigned long)(*(--(c)))) ; \ - case 3: l1|=((unsigned long)(*(--(c))))<< 8; \ - case 2: l1|=((unsigned long)(*(--(c))))<<16; \ - case 1: l1|=((unsigned long)(*(--(c))))<<24; \ - } \ +#define n2ln(c,l1,l2,n) { \ + c+=n; \ + l1=l2=0; \ + switch (n) { \ + case 8: l2 =((unsigned long)(*(--(c)))) ; \ + case 7: l2|=((unsigned long)(*(--(c))))<< 8; \ + case 6: l2|=((unsigned long)(*(--(c))))<<16; \ + case 5: l2|=((unsigned long)(*(--(c))))<<24; \ + case 4: l1 =((unsigned long)(*(--(c)))) ; \ + case 3: l1|=((unsigned long)(*(--(c))))<< 8; \ + case 2: l1|=((unsigned long)(*(--(c))))<<16; \ + case 1: l1|=((unsigned long)(*(--(c))))<<24; \ + } \ } /* NOTE - c is not incremented as per l2n */ -#define l2nn(l1,l2,c,n) { \ - c+=n; \ - switch (n) { \ - case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \ - case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \ - case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \ - case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \ - case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \ - case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \ - case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \ - case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \ - } \ +#define l2nn(l1,l2,c,n) { \ + c+=n; \ + switch (n) { \ + case 8: *(--(c))=(unsigned char)(((l2) )&0xff);\ + case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff);\ + case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff);\ + case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff);\ + case 4: *(--(c))=(unsigned char)(((l1) )&0xff);\ + case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff);\ + case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff);\ + case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff);\ + } \ } #undef n2l -#define n2l(c,l) (l =((unsigned long)(*((c)++)))<<24L, \ - l|=((unsigned long)(*((c)++)))<<16L, \ - l|=((unsigned long)(*((c)++)))<< 8L, \ +#define n2l(c,l) (l =((unsigned long)(*((c)++)))<<24L, \ + l|=((unsigned long)(*((c)++)))<<16L, \ + l|=((unsigned long)(*((c)++)))<< 8L, \ l|=((unsigned long)(*((c)++)))) #undef l2n -#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ +#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ *((c)++)=(unsigned char)(((l) )&0xff)) -#define C_RC2(n) \ - t=(x0+(x1& ~x3)+(x2&x3)+ *(p0++))&0xffff; \ - x0=(t<<1)|(t>>15); \ - t=(x1+(x2& ~x0)+(x3&x0)+ *(p0++))&0xffff; \ - x1=(t<<2)|(t>>14); \ - t=(x2+(x3& ~x1)+(x0&x1)+ *(p0++))&0xffff; \ - x2=(t<<3)|(t>>13); \ - t=(x3+(x0& ~x2)+(x1&x2)+ *(p0++))&0xffff; \ +#define C_RC2(n) \ + t=(x0+(x1& ~x3)+(x2&x3)+ *(p0++))&0xffff; \ + x0=(t<<1)|(t>>15); \ + t=(x1+(x2& ~x0)+(x3&x0)+ *(p0++))&0xffff; \ + x1=(t<<2)|(t>>14); \ + t=(x2+(x3& ~x1)+(x0&x1)+ *(p0++))&0xffff; \ + x2=(t<<3)|(t>>13); \ + t=(x3+(x0& ~x2)+(x1&x2)+ *(p0++))&0xffff; \ x3=(t<<5)|(t>>11); - diff --git a/lib/libcrypto/rc2/rc2_skey.c b/lib/libcrypto/rc2/rc2_skey.c index 82161b16f..d33c02da8 100644 --- a/lib/libcrypto/rc2/rc2_skey.c +++ b/lib/libcrypto/rc2/rc2_skey.c @@ -1,25 +1,25 @@ -/* $OpenBSD: rc2_skey.c,v 1.13 2022/11/26 16:08:54 tb Exp $ */ +/* $OpenBSD: rc2_skey.c,v 1.15 2023/07/07 13:40:44 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -91,48 +91,52 @@ static const unsigned char key_table[256]={ * BSAFE uses the 'retarded' version. What I previously shipped is * the same as specifying 1024 for the 'bits' parameter. Bsafe uses * a version where the bits parameter is the same as len*8 */ -void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits) - { - int i,j; +void +RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits) +{ + int i, j; unsigned char *k; RC2_INT *ki; - unsigned int c,d; + unsigned int c, d; - k= (unsigned char *)&(key->data[0]); - *k=0; /* for if there is a zero length key */ + k = (unsigned char *)&(key->data[0]); + *k = 0; /* for if there is a zero length key */ - if (len > 128) len=128; - if (bits <= 0) bits=1024; - if (bits > 1024) bits=1024; + if (len > 128) + len = 128; + if (bits <= 0) + bits = 1024; + if (bits > 1024) + bits = 1024; - for (i=0; i>3; - i=128-j; - c= (0xff>>(-bits & 0x07)); + j = (bits + 7) >> 3; + i = 128 - j; + c = (0xff >> (-bits & 0x07)); - d=key_table[k[i]&c]; - k[i]=d; - while (i--) - { - d=key_table[k[i+j]^d]; - k[i]=d; - } + d = key_table[k[i] & c]; + k[i] = d; + while (i--) { + d = key_table[k[i + j] ^ d]; + k[i] = d; + } /* copy from bytes into RC2_INT's */ - ki= &(key->data[63]); - for (i=127; i>=0; i-=2) - *(ki--)=((k[i]<<8)|k[i-1])&0xffff; - } + ki = &(key->data[63]); + for (i = 127; i >= 0; i -= 2) + *(ki--) = ((k[i] << 8)|k[i - 1]) & 0xffff; +} +LCRYPTO_ALIAS(RC2_set_key); diff --git a/lib/libcrypto/rc2/rc2cfb64.c b/lib/libcrypto/rc2/rc2cfb64.c index ebdeb9ba5..21266c430 100644 --- a/lib/libcrypto/rc2/rc2cfb64.c +++ b/lib/libcrypto/rc2/rc2cfb64.c @@ -1,25 +1,25 @@ -/* $OpenBSD: rc2cfb64.c,v 1.6 2022/11/26 16:08:54 tb Exp $ */ +/* $OpenBSD: rc2cfb64.c,v 1.8 2023/07/07 13:40:44 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -64,59 +64,61 @@ * 64bit block we have used is contained in *num; */ -void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, RC2_KEY *schedule, unsigned char *ivec, - int *num, int encrypt) - { - unsigned long v0,v1,t; - int n= *num; - long l=length; +void +RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, RC2_KEY *schedule, unsigned char *ivec, + int *num, int encrypt) +{ + unsigned long v0, v1, t; + int n = *num; + long l = length; unsigned long ti[2]; - unsigned char *iv,c,cc; + unsigned char *iv, c, cc; - iv=(unsigned char *)ivec; - if (encrypt) - { - while (l--) - { - if (n == 0) - { - c2l(iv,v0); ti[0]=v0; - c2l(iv,v1); ti[1]=v1; - RC2_encrypt((unsigned long *)ti,schedule); - iv=(unsigned char *)ivec; - t=ti[0]; l2c(t,iv); - t=ti[1]; l2c(t,iv); - iv=(unsigned char *)ivec; - } - c= *(in++)^iv[n]; - *(out++)=c; - iv[n]=c; - n=(n+1)&0x07; + iv = (unsigned char *)ivec; + if (encrypt) { + while (l--) { + if (n == 0) { + c2l(iv, v0); + ti[0] = v0; + c2l(iv, v1); + ti[1] = v1; + RC2_encrypt((unsigned long *)ti, schedule); + iv = (unsigned char *)ivec; + t = ti[0]; + l2c(t, iv); + t = ti[1]; + l2c(t, iv); + iv = (unsigned char *)ivec; } + c = *(in++) ^ iv[n]; + *(out++) = c; + iv[n] = c; + n = (n + 1) & 0x07; } - else - { - while (l--) - { - if (n == 0) - { - c2l(iv,v0); ti[0]=v0; - c2l(iv,v1); ti[1]=v1; - RC2_encrypt((unsigned long *)ti,schedule); - iv=(unsigned char *)ivec; - t=ti[0]; l2c(t,iv); - t=ti[1]; l2c(t,iv); - iv=(unsigned char *)ivec; - } - cc= *(in++); - c=iv[n]; - iv[n]=cc; - *(out++)=c^cc; - n=(n+1)&0x07; + } else { + while (l--) { + if (n == 0) { + c2l(iv, v0); + ti[0] = v0; + c2l(iv, v1); + ti[1] = v1; + RC2_encrypt((unsigned long *)ti, schedule); + iv = (unsigned char *)ivec; + t = ti[0]; + l2c(t, iv); + t = ti[1]; + l2c(t, iv); + iv = (unsigned char *)ivec; } + cc = *(in++); + c = iv[n]; + iv[n] = cc; + *(out++) = c ^ cc; + n = (n + 1) & 0x07; } - v0=v1=ti[0]=ti[1]=t=c=cc=0; - *num=n; } - + v0 = v1 = ti[0] = ti[1] = t = c = cc = 0; + *num = n; +} +LCRYPTO_ALIAS(RC2_cfb64_encrypt); diff --git a/lib/libcrypto/rc2/rc2ofb64.c b/lib/libcrypto/rc2/rc2ofb64.c index 2aa241357..73d8323e9 100644 --- a/lib/libcrypto/rc2/rc2ofb64.c +++ b/lib/libcrypto/rc2/rc2ofb64.c @@ -1,25 +1,25 @@ -/* $OpenBSD: rc2ofb64.c,v 1.6 2022/11/26 16:08:54 tb Exp $ */ +/* $OpenBSD: rc2ofb64.c,v 1.8 2023/07/07 13:40:44 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -63,49 +63,49 @@ * used. The extra state information to record how much of the * 64bit block we have used is contained in *num; */ -void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, RC2_KEY *schedule, unsigned char *ivec, - int *num) - { - unsigned long v0,v1,t; - int n= *num; - long l=length; +void +RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, RC2_KEY *schedule, unsigned char *ivec, + int *num) +{ + unsigned long v0, v1, t; + int n = *num; + long l = length; unsigned char d[8]; char *dp; unsigned long ti[2]; unsigned char *iv; - int save=0; + int save = 0; - iv=(unsigned char *)ivec; - c2l(iv,v0); - c2l(iv,v1); - ti[0]=v0; - ti[1]=v1; - dp=(char *)d; - l2c(v0,dp); - l2c(v1,dp); - while (l--) - { - if (n == 0) - { - RC2_encrypt((unsigned long *)ti,schedule); - dp=(char *)d; - t=ti[0]; l2c(t,dp); - t=ti[1]; l2c(t,dp); + iv = (unsigned char *)ivec; + c2l(iv, v0); + c2l(iv, v1); + ti[0] = v0; + ti[1] = v1; + dp = (char *)d; + l2c(v0, dp); + l2c(v1, dp); + while (l--) { + if (n == 0) { + RC2_encrypt((unsigned long *)ti, schedule); + dp = (char *)d; + t = ti[0]; + l2c(t, dp); + t = ti[1]; + l2c(t, dp); save++; - } - *(out++)= *(in++)^d[n]; - n=(n+1)&0x07; } - if (save) - { - v0=ti[0]; - v1=ti[1]; - iv=(unsigned char *)ivec; - l2c(v0,iv); - l2c(v1,iv); - } - t=v0=v1=ti[0]=ti[1]=0; - *num=n; + *(out++) = *(in++) ^ d[n]; + n = (n + 1) & 0x07; } - + if (save) { + v0 = ti[0]; + v1 = ti[1]; + iv = (unsigned char *)ivec; + l2c(v0, iv); + l2c(v1, iv); + } + t = v0 = v1 = ti[0] = ti[1] = 0; + *num = n; +} +LCRYPTO_ALIAS(RC2_ofb64_encrypt); diff --git a/lib/libcrypto/ripemd/ripemd.h b/lib/libcrypto/ripemd/ripemd.h index a5f3a1293..03ba781c4 100644 --- a/lib/libcrypto/ripemd/ripemd.h +++ b/lib/libcrypto/ripemd/ripemd.h @@ -1,25 +1,25 @@ -/* $OpenBSD: ripemd.h,v 1.14 2014/07/10 22:45:57 jsing Exp $ */ +/* $OpenBSD: ripemd.h,v 1.15 2023/07/08 06:52:56 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -84,19 +84,18 @@ extern "C" { #define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4) #define RIPEMD160_DIGEST_LENGTH 20 -typedef struct RIPEMD160state_st - { - RIPEMD160_LONG A,B,C,D,E; - RIPEMD160_LONG Nl,Nh; +typedef struct RIPEMD160state_st { + RIPEMD160_LONG A, B,C, D, E; + RIPEMD160_LONG Nl, Nh; RIPEMD160_LONG data[RIPEMD160_LBLOCK]; unsigned int num; - } RIPEMD160_CTX; +} RIPEMD160_CTX; int RIPEMD160_Init(RIPEMD160_CTX *c); int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len); int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); unsigned char *RIPEMD160(const unsigned char *d, size_t n, - unsigned char *md); + unsigned char *md); void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b); #ifdef __cplusplus } diff --git a/lib/libcrypto/ripemd/rmd_dgst.c b/lib/libcrypto/ripemd/rmd_dgst.c index d794a7c1e..0b441d5cc 100644 --- a/lib/libcrypto/ripemd/rmd_dgst.c +++ b/lib/libcrypto/ripemd/rmd_dgst.c @@ -1,25 +1,25 @@ -/* $OpenBSD: rmd_dgst.c,v 1.18 2022/11/26 16:08:54 tb Exp $ */ +/* $OpenBSD: rmd_dgst.c,v 1.20 2023/07/08 06:52:56 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -57,234 +57,368 @@ */ #include -#include "rmd_local.h" #include #include +#include +#include +#include +#include + +/* + * DO EXAMINE COMMENTS IN crypto/md5/md5_locl.h & crypto/md5/md5_dgst.c + * FOR EXPLANATIONS ON FOLLOWING "CODE." + * + */ +#ifdef RMD160_ASM +# if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__) +# define ripemd160_block_data_order ripemd160_block_asm_data_order +# endif +#endif + +__BEGIN_HIDDEN_DECLS + +void ripemd160_block_data_order (RIPEMD160_CTX *c, const void *p, size_t num); + +__END_HIDDEN_DECLS + +#define DATA_ORDER_IS_LITTLE_ENDIAN + +#define HASH_LONG RIPEMD160_LONG +#define HASH_CTX RIPEMD160_CTX +#define HASH_CBLOCK RIPEMD160_CBLOCK +#define HASH_UPDATE RIPEMD160_Update +#define HASH_TRANSFORM RIPEMD160_Transform +#define HASH_FINAL RIPEMD160_Final +#define HASH_MAKE_STRING(c,s) do { \ + unsigned long ll; \ + ll=(c)->A; HOST_l2c(ll,(s)); \ + ll=(c)->B; HOST_l2c(ll,(s)); \ + ll=(c)->C; HOST_l2c(ll,(s)); \ + ll=(c)->D; HOST_l2c(ll,(s)); \ + ll=(c)->E; HOST_l2c(ll,(s)); \ + } while (0) +#define HASH_BLOCK_DATA_ORDER ripemd160_block_data_order + +#include "md32_common.h" + +#if 0 +#define F1(x,y,z) ((x)^(y)^(z)) +#define F2(x,y,z) (((x)&(y))|((~x)&z)) +#define F3(x,y,z) (((x)|(~y))^(z)) +#define F4(x,y,z) (((x)&(z))|((y)&(~(z)))) +#define F5(x,y,z) ((x)^((y)|(~(z)))) +#else +/* + * Transformed F2 and F4 are courtesy of Wei Dai + */ +#define F1(x,y,z) ((x) ^ (y) ^ (z)) +#define F2(x,y,z) ((((y) ^ (z)) & (x)) ^ (z)) +#define F3(x,y,z) (((~(y)) | (x)) ^ (z)) +#define F4(x,y,z) ((((x) ^ (y)) & (z)) ^ (y)) +#define F5(x,y,z) (((~(z)) | (y)) ^ (x)) +#endif + +#define RIPEMD160_A 0x67452301L +#define RIPEMD160_B 0xEFCDAB89L +#define RIPEMD160_C 0x98BADCFEL +#define RIPEMD160_D 0x10325476L +#define RIPEMD160_E 0xC3D2E1F0L + +#include "rmdconst.h" + +#define RIP1(a,b,c,d,e,w,s) { \ + a+=F1(b,c,d)+X(w); \ + a=ROTATE(a,s)+e; \ + c=ROTATE(c,10); } + +#define RIP2(a,b,c,d,e,w,s,K) { \ + a+=F2(b,c,d)+X(w)+K; \ + a=ROTATE(a,s)+e; \ + c=ROTATE(c,10); } + +#define RIP3(a,b,c,d,e,w,s,K) { \ + a+=F3(b,c,d)+X(w)+K; \ + a=ROTATE(a,s)+e; \ + c=ROTATE(c,10); } + +#define RIP4(a,b,c,d,e,w,s,K) { \ + a+=F4(b,c,d)+X(w)+K; \ + a=ROTATE(a,s)+e; \ + c=ROTATE(c,10); } + +#define RIP5(a,b,c,d,e,w,s,K) { \ + a+=F5(b,c,d)+X(w)+K; \ + a=ROTATE(a,s)+e; \ + c=ROTATE(c,10); } + # ifdef RMD160_ASM - void ripemd160_block_x86(RIPEMD160_CTX *c, unsigned long *p,size_t num); +void ripemd160_block_x86(RIPEMD160_CTX *c, unsigned long *p, size_t num); # define ripemd160_block ripemd160_block_x86 # else - void ripemd160_block(RIPEMD160_CTX *c, unsigned long *p,size_t num); +void ripemd160_block(RIPEMD160_CTX *c, unsigned long *p, size_t num); # endif -int RIPEMD160_Init(RIPEMD160_CTX *c) - { - memset (c,0,sizeof(*c)); - c->A=RIPEMD160_A; - c->B=RIPEMD160_B; - c->C=RIPEMD160_C; - c->D=RIPEMD160_D; - c->E=RIPEMD160_E; +int +RIPEMD160_Init(RIPEMD160_CTX *c) +{ + memset (c, 0, sizeof(*c)); + c->A = RIPEMD160_A; + c->B = RIPEMD160_B; + c->C = RIPEMD160_C; + c->D = RIPEMD160_D; + c->E = RIPEMD160_E; return 1; - } +} #ifndef ripemd160_block_data_order #ifdef X #undef X #endif -void ripemd160_block_data_order (RIPEMD160_CTX *ctx, const void *p, size_t num) - { - const unsigned char *data=p; - unsigned MD32_REG_T A,B,C,D,E; - unsigned MD32_REG_T a,b,c,d,e,l; +void +ripemd160_block_data_order(RIPEMD160_CTX *ctx, const void *p, size_t num) +{ + const unsigned char *data = p; + unsigned MD32_REG_T A, B,C, D, E; + unsigned MD32_REG_T a, b,c, d,e, l; #ifndef MD32_XARRAY /* See comment in crypto/sha/sha_locl.h for details. */ unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7, - XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15; + XX8, XX9, XX10, XX11, XX12, XX13, XX14, XX15; # define X(i) XX##i #else RIPEMD160_LONG XX[16]; # define X(i) XX[i] #endif - for (;num--;) - { + for (; num--; ) { - A=ctx->A; B=ctx->B; C=ctx->C; D=ctx->D; E=ctx->E; + A = ctx->A; + B = ctx->B; + C = ctx->C; + D = ctx->D; + E = ctx->E; - HOST_c2l(data,l); X( 0)=l;HOST_c2l(data,l); X( 1)=l; - RIP1(A,B,C,D,E,WL00,SL00); HOST_c2l(data,l); X( 2)=l; - RIP1(E,A,B,C,D,WL01,SL01); HOST_c2l(data,l); X( 3)=l; - RIP1(D,E,A,B,C,WL02,SL02); HOST_c2l(data,l); X( 4)=l; - RIP1(C,D,E,A,B,WL03,SL03); HOST_c2l(data,l); X( 5)=l; - RIP1(B,C,D,E,A,WL04,SL04); HOST_c2l(data,l); X( 6)=l; - RIP1(A,B,C,D,E,WL05,SL05); HOST_c2l(data,l); X( 7)=l; - RIP1(E,A,B,C,D,WL06,SL06); HOST_c2l(data,l); X( 8)=l; - RIP1(D,E,A,B,C,WL07,SL07); HOST_c2l(data,l); X( 9)=l; - RIP1(C,D,E,A,B,WL08,SL08); HOST_c2l(data,l); X(10)=l; - RIP1(B,C,D,E,A,WL09,SL09); HOST_c2l(data,l); X(11)=l; - RIP1(A,B,C,D,E,WL10,SL10); HOST_c2l(data,l); X(12)=l; - RIP1(E,A,B,C,D,WL11,SL11); HOST_c2l(data,l); X(13)=l; - RIP1(D,E,A,B,C,WL12,SL12); HOST_c2l(data,l); X(14)=l; - RIP1(C,D,E,A,B,WL13,SL13); HOST_c2l(data,l); X(15)=l; - RIP1(B,C,D,E,A,WL14,SL14); - RIP1(A,B,C,D,E,WL15,SL15); + HOST_c2l(data, l); + X( 0) = l;HOST_c2l(data, l); + X( 1) = l; + RIP1(A, B,C, D,E, WL00, SL00); + HOST_c2l(data, l); + X( 2) = l; + RIP1(E, A,B, C,D, WL01, SL01); + HOST_c2l(data, l); + X( 3) = l; + RIP1(D, E,A, B,C, WL02, SL02); + HOST_c2l(data, l); + X( 4) = l; + RIP1(C, D,E, A,B, WL03, SL03); + HOST_c2l(data, l); + X( 5) = l; + RIP1(B, C,D, E,A, WL04, SL04); + HOST_c2l(data, l); + X( 6) = l; + RIP1(A, B,C, D,E, WL05, SL05); + HOST_c2l(data, l); + X( 7) = l; + RIP1(E, A,B, C,D, WL06, SL06); + HOST_c2l(data, l); + X( 8) = l; + RIP1(D, E,A, B,C, WL07, SL07); + HOST_c2l(data, l); + X( 9) = l; + RIP1(C, D,E, A,B, WL08, SL08); + HOST_c2l(data, l); + X(10) = l; + RIP1(B, C,D, E,A, WL09, SL09); + HOST_c2l(data, l); + X(11) = l; + RIP1(A, B,C, D,E, WL10, SL10); + HOST_c2l(data, l); + X(12) = l; + RIP1(E, A,B, C,D, WL11, SL11); + HOST_c2l(data, l); + X(13) = l; + RIP1(D, E,A, B,C, WL12, SL12); + HOST_c2l(data, l); + X(14) = l; + RIP1(C, D,E, A,B, WL13, SL13); + HOST_c2l(data, l); + X(15) = l; + RIP1(B, C,D, E,A, WL14, SL14); + RIP1(A, B,C, D,E, WL15, SL15); - RIP2(E,A,B,C,D,WL16,SL16,KL1); - RIP2(D,E,A,B,C,WL17,SL17,KL1); - RIP2(C,D,E,A,B,WL18,SL18,KL1); - RIP2(B,C,D,E,A,WL19,SL19,KL1); - RIP2(A,B,C,D,E,WL20,SL20,KL1); - RIP2(E,A,B,C,D,WL21,SL21,KL1); - RIP2(D,E,A,B,C,WL22,SL22,KL1); - RIP2(C,D,E,A,B,WL23,SL23,KL1); - RIP2(B,C,D,E,A,WL24,SL24,KL1); - RIP2(A,B,C,D,E,WL25,SL25,KL1); - RIP2(E,A,B,C,D,WL26,SL26,KL1); - RIP2(D,E,A,B,C,WL27,SL27,KL1); - RIP2(C,D,E,A,B,WL28,SL28,KL1); - RIP2(B,C,D,E,A,WL29,SL29,KL1); - RIP2(A,B,C,D,E,WL30,SL30,KL1); - RIP2(E,A,B,C,D,WL31,SL31,KL1); + RIP2(E, A,B, C,D, WL16, SL16, KL1); + RIP2(D, E,A, B,C, WL17, SL17, KL1); + RIP2(C, D,E, A,B, WL18, SL18, KL1); + RIP2(B, C,D, E,A, WL19, SL19, KL1); + RIP2(A, B,C, D,E, WL20, SL20, KL1); + RIP2(E, A,B, C,D, WL21, SL21, KL1); + RIP2(D, E,A, B,C, WL22, SL22, KL1); + RIP2(C, D,E, A,B, WL23, SL23, KL1); + RIP2(B, C,D, E,A, WL24, SL24, KL1); + RIP2(A, B,C, D,E, WL25, SL25, KL1); + RIP2(E, A,B, C,D, WL26, SL26, KL1); + RIP2(D, E,A, B,C, WL27, SL27, KL1); + RIP2(C, D,E, A,B, WL28, SL28, KL1); + RIP2(B, C,D, E,A, WL29, SL29, KL1); + RIP2(A, B,C, D,E, WL30, SL30, KL1); + RIP2(E, A,B, C,D, WL31, SL31, KL1); - RIP3(D,E,A,B,C,WL32,SL32,KL2); - RIP3(C,D,E,A,B,WL33,SL33,KL2); - RIP3(B,C,D,E,A,WL34,SL34,KL2); - RIP3(A,B,C,D,E,WL35,SL35,KL2); - RIP3(E,A,B,C,D,WL36,SL36,KL2); - RIP3(D,E,A,B,C,WL37,SL37,KL2); - RIP3(C,D,E,A,B,WL38,SL38,KL2); - RIP3(B,C,D,E,A,WL39,SL39,KL2); - RIP3(A,B,C,D,E,WL40,SL40,KL2); - RIP3(E,A,B,C,D,WL41,SL41,KL2); - RIP3(D,E,A,B,C,WL42,SL42,KL2); - RIP3(C,D,E,A,B,WL43,SL43,KL2); - RIP3(B,C,D,E,A,WL44,SL44,KL2); - RIP3(A,B,C,D,E,WL45,SL45,KL2); - RIP3(E,A,B,C,D,WL46,SL46,KL2); - RIP3(D,E,A,B,C,WL47,SL47,KL2); + RIP3(D, E,A, B,C, WL32, SL32, KL2); + RIP3(C, D,E, A,B, WL33, SL33, KL2); + RIP3(B, C,D, E,A, WL34, SL34, KL2); + RIP3(A, B,C, D,E, WL35, SL35, KL2); + RIP3(E, A,B, C,D, WL36, SL36, KL2); + RIP3(D, E,A, B,C, WL37, SL37, KL2); + RIP3(C, D,E, A,B, WL38, SL38, KL2); + RIP3(B, C,D, E,A, WL39, SL39, KL2); + RIP3(A, B,C, D,E, WL40, SL40, KL2); + RIP3(E, A,B, C,D, WL41, SL41, KL2); + RIP3(D, E,A, B,C, WL42, SL42, KL2); + RIP3(C, D,E, A,B, WL43, SL43, KL2); + RIP3(B, C,D, E,A, WL44, SL44, KL2); + RIP3(A, B,C, D,E, WL45, SL45, KL2); + RIP3(E, A,B, C,D, WL46, SL46, KL2); + RIP3(D, E,A, B,C, WL47, SL47, KL2); - RIP4(C,D,E,A,B,WL48,SL48,KL3); - RIP4(B,C,D,E,A,WL49,SL49,KL3); - RIP4(A,B,C,D,E,WL50,SL50,KL3); - RIP4(E,A,B,C,D,WL51,SL51,KL3); - RIP4(D,E,A,B,C,WL52,SL52,KL3); - RIP4(C,D,E,A,B,WL53,SL53,KL3); - RIP4(B,C,D,E,A,WL54,SL54,KL3); - RIP4(A,B,C,D,E,WL55,SL55,KL3); - RIP4(E,A,B,C,D,WL56,SL56,KL3); - RIP4(D,E,A,B,C,WL57,SL57,KL3); - RIP4(C,D,E,A,B,WL58,SL58,KL3); - RIP4(B,C,D,E,A,WL59,SL59,KL3); - RIP4(A,B,C,D,E,WL60,SL60,KL3); - RIP4(E,A,B,C,D,WL61,SL61,KL3); - RIP4(D,E,A,B,C,WL62,SL62,KL3); - RIP4(C,D,E,A,B,WL63,SL63,KL3); + RIP4(C, D,E, A,B, WL48, SL48, KL3); + RIP4(B, C,D, E,A, WL49, SL49, KL3); + RIP4(A, B,C, D,E, WL50, SL50, KL3); + RIP4(E, A,B, C,D, WL51, SL51, KL3); + RIP4(D, E,A, B,C, WL52, SL52, KL3); + RIP4(C, D,E, A,B, WL53, SL53, KL3); + RIP4(B, C,D, E,A, WL54, SL54, KL3); + RIP4(A, B,C, D,E, WL55, SL55, KL3); + RIP4(E, A,B, C,D, WL56, SL56, KL3); + RIP4(D, E,A, B,C, WL57, SL57, KL3); + RIP4(C, D,E, A,B, WL58, SL58, KL3); + RIP4(B, C,D, E,A, WL59, SL59, KL3); + RIP4(A, B,C, D,E, WL60, SL60, KL3); + RIP4(E, A,B, C,D, WL61, SL61, KL3); + RIP4(D, E,A, B,C, WL62, SL62, KL3); + RIP4(C, D,E, A,B, WL63, SL63, KL3); - RIP5(B,C,D,E,A,WL64,SL64,KL4); - RIP5(A,B,C,D,E,WL65,SL65,KL4); - RIP5(E,A,B,C,D,WL66,SL66,KL4); - RIP5(D,E,A,B,C,WL67,SL67,KL4); - RIP5(C,D,E,A,B,WL68,SL68,KL4); - RIP5(B,C,D,E,A,WL69,SL69,KL4); - RIP5(A,B,C,D,E,WL70,SL70,KL4); - RIP5(E,A,B,C,D,WL71,SL71,KL4); - RIP5(D,E,A,B,C,WL72,SL72,KL4); - RIP5(C,D,E,A,B,WL73,SL73,KL4); - RIP5(B,C,D,E,A,WL74,SL74,KL4); - RIP5(A,B,C,D,E,WL75,SL75,KL4); - RIP5(E,A,B,C,D,WL76,SL76,KL4); - RIP5(D,E,A,B,C,WL77,SL77,KL4); - RIP5(C,D,E,A,B,WL78,SL78,KL4); - RIP5(B,C,D,E,A,WL79,SL79,KL4); + RIP5(B, C,D, E,A, WL64, SL64, KL4); + RIP5(A, B,C, D,E, WL65, SL65, KL4); + RIP5(E, A,B, C,D, WL66, SL66, KL4); + RIP5(D, E,A, B,C, WL67, SL67, KL4); + RIP5(C, D,E, A,B, WL68, SL68, KL4); + RIP5(B, C,D, E,A, WL69, SL69, KL4); + RIP5(A, B,C, D,E, WL70, SL70, KL4); + RIP5(E, A,B, C,D, WL71, SL71, KL4); + RIP5(D, E,A, B,C, WL72, SL72, KL4); + RIP5(C, D,E, A,B, WL73, SL73, KL4); + RIP5(B, C,D, E,A, WL74, SL74, KL4); + RIP5(A, B,C, D,E, WL75, SL75, KL4); + RIP5(E, A,B, C,D, WL76, SL76, KL4); + RIP5(D, E,A, B,C, WL77, SL77, KL4); + RIP5(C, D,E, A,B, WL78, SL78, KL4); + RIP5(B, C,D, E,A, WL79, SL79, KL4); - a=A; b=B; c=C; d=D; e=E; - /* Do other half */ - A=ctx->A; B=ctx->B; C=ctx->C; D=ctx->D; E=ctx->E; + a = A; + b = B; + c = C; + d = D; + e = E; + /* Do other half */ + A = ctx->A; + B = ctx->B; + C = ctx->C; + D = ctx->D; + E = ctx->E; - RIP5(A,B,C,D,E,WR00,SR00,KR0); - RIP5(E,A,B,C,D,WR01,SR01,KR0); - RIP5(D,E,A,B,C,WR02,SR02,KR0); - RIP5(C,D,E,A,B,WR03,SR03,KR0); - RIP5(B,C,D,E,A,WR04,SR04,KR0); - RIP5(A,B,C,D,E,WR05,SR05,KR0); - RIP5(E,A,B,C,D,WR06,SR06,KR0); - RIP5(D,E,A,B,C,WR07,SR07,KR0); - RIP5(C,D,E,A,B,WR08,SR08,KR0); - RIP5(B,C,D,E,A,WR09,SR09,KR0); - RIP5(A,B,C,D,E,WR10,SR10,KR0); - RIP5(E,A,B,C,D,WR11,SR11,KR0); - RIP5(D,E,A,B,C,WR12,SR12,KR0); - RIP5(C,D,E,A,B,WR13,SR13,KR0); - RIP5(B,C,D,E,A,WR14,SR14,KR0); - RIP5(A,B,C,D,E,WR15,SR15,KR0); + RIP5(A, B,C, D,E, WR00, SR00, KR0); + RIP5(E, A,B, C,D, WR01, SR01, KR0); + RIP5(D, E,A, B,C, WR02, SR02, KR0); + RIP5(C, D,E, A,B, WR03, SR03, KR0); + RIP5(B, C,D, E,A, WR04, SR04, KR0); + RIP5(A, B,C, D,E, WR05, SR05, KR0); + RIP5(E, A,B, C,D, WR06, SR06, KR0); + RIP5(D, E,A, B,C, WR07, SR07, KR0); + RIP5(C, D,E, A,B, WR08, SR08, KR0); + RIP5(B, C,D, E,A, WR09, SR09, KR0); + RIP5(A, B,C, D,E, WR10, SR10, KR0); + RIP5(E, A,B, C,D, WR11, SR11, KR0); + RIP5(D, E,A, B,C, WR12, SR12, KR0); + RIP5(C, D,E, A,B, WR13, SR13, KR0); + RIP5(B, C,D, E,A, WR14, SR14, KR0); + RIP5(A, B,C, D,E, WR15, SR15, KR0); - RIP4(E,A,B,C,D,WR16,SR16,KR1); - RIP4(D,E,A,B,C,WR17,SR17,KR1); - RIP4(C,D,E,A,B,WR18,SR18,KR1); - RIP4(B,C,D,E,A,WR19,SR19,KR1); - RIP4(A,B,C,D,E,WR20,SR20,KR1); - RIP4(E,A,B,C,D,WR21,SR21,KR1); - RIP4(D,E,A,B,C,WR22,SR22,KR1); - RIP4(C,D,E,A,B,WR23,SR23,KR1); - RIP4(B,C,D,E,A,WR24,SR24,KR1); - RIP4(A,B,C,D,E,WR25,SR25,KR1); - RIP4(E,A,B,C,D,WR26,SR26,KR1); - RIP4(D,E,A,B,C,WR27,SR27,KR1); - RIP4(C,D,E,A,B,WR28,SR28,KR1); - RIP4(B,C,D,E,A,WR29,SR29,KR1); - RIP4(A,B,C,D,E,WR30,SR30,KR1); - RIP4(E,A,B,C,D,WR31,SR31,KR1); + RIP4(E, A,B, C,D, WR16, SR16, KR1); + RIP4(D, E,A, B,C, WR17, SR17, KR1); + RIP4(C, D,E, A,B, WR18, SR18, KR1); + RIP4(B, C,D, E,A, WR19, SR19, KR1); + RIP4(A, B,C, D,E, WR20, SR20, KR1); + RIP4(E, A,B, C,D, WR21, SR21, KR1); + RIP4(D, E,A, B,C, WR22, SR22, KR1); + RIP4(C, D,E, A,B, WR23, SR23, KR1); + RIP4(B, C,D, E,A, WR24, SR24, KR1); + RIP4(A, B,C, D,E, WR25, SR25, KR1); + RIP4(E, A,B, C,D, WR26, SR26, KR1); + RIP4(D, E,A, B,C, WR27, SR27, KR1); + RIP4(C, D,E, A,B, WR28, SR28, KR1); + RIP4(B, C,D, E,A, WR29, SR29, KR1); + RIP4(A, B,C, D,E, WR30, SR30, KR1); + RIP4(E, A,B, C,D, WR31, SR31, KR1); - RIP3(D,E,A,B,C,WR32,SR32,KR2); - RIP3(C,D,E,A,B,WR33,SR33,KR2); - RIP3(B,C,D,E,A,WR34,SR34,KR2); - RIP3(A,B,C,D,E,WR35,SR35,KR2); - RIP3(E,A,B,C,D,WR36,SR36,KR2); - RIP3(D,E,A,B,C,WR37,SR37,KR2); - RIP3(C,D,E,A,B,WR38,SR38,KR2); - RIP3(B,C,D,E,A,WR39,SR39,KR2); - RIP3(A,B,C,D,E,WR40,SR40,KR2); - RIP3(E,A,B,C,D,WR41,SR41,KR2); - RIP3(D,E,A,B,C,WR42,SR42,KR2); - RIP3(C,D,E,A,B,WR43,SR43,KR2); - RIP3(B,C,D,E,A,WR44,SR44,KR2); - RIP3(A,B,C,D,E,WR45,SR45,KR2); - RIP3(E,A,B,C,D,WR46,SR46,KR2); - RIP3(D,E,A,B,C,WR47,SR47,KR2); + RIP3(D, E,A, B,C, WR32, SR32, KR2); + RIP3(C, D,E, A,B, WR33, SR33, KR2); + RIP3(B, C,D, E,A, WR34, SR34, KR2); + RIP3(A, B,C, D,E, WR35, SR35, KR2); + RIP3(E, A,B, C,D, WR36, SR36, KR2); + RIP3(D, E,A, B,C, WR37, SR37, KR2); + RIP3(C, D,E, A,B, WR38, SR38, KR2); + RIP3(B, C,D, E,A, WR39, SR39, KR2); + RIP3(A, B,C, D,E, WR40, SR40, KR2); + RIP3(E, A,B, C,D, WR41, SR41, KR2); + RIP3(D, E,A, B,C, WR42, SR42, KR2); + RIP3(C, D,E, A,B, WR43, SR43, KR2); + RIP3(B, C,D, E,A, WR44, SR44, KR2); + RIP3(A, B,C, D,E, WR45, SR45, KR2); + RIP3(E, A,B, C,D, WR46, SR46, KR2); + RIP3(D, E,A, B,C, WR47, SR47, KR2); - RIP2(C,D,E,A,B,WR48,SR48,KR3); - RIP2(B,C,D,E,A,WR49,SR49,KR3); - RIP2(A,B,C,D,E,WR50,SR50,KR3); - RIP2(E,A,B,C,D,WR51,SR51,KR3); - RIP2(D,E,A,B,C,WR52,SR52,KR3); - RIP2(C,D,E,A,B,WR53,SR53,KR3); - RIP2(B,C,D,E,A,WR54,SR54,KR3); - RIP2(A,B,C,D,E,WR55,SR55,KR3); - RIP2(E,A,B,C,D,WR56,SR56,KR3); - RIP2(D,E,A,B,C,WR57,SR57,KR3); - RIP2(C,D,E,A,B,WR58,SR58,KR3); - RIP2(B,C,D,E,A,WR59,SR59,KR3); - RIP2(A,B,C,D,E,WR60,SR60,KR3); - RIP2(E,A,B,C,D,WR61,SR61,KR3); - RIP2(D,E,A,B,C,WR62,SR62,KR3); - RIP2(C,D,E,A,B,WR63,SR63,KR3); + RIP2(C, D,E, A,B, WR48, SR48, KR3); + RIP2(B, C,D, E,A, WR49, SR49, KR3); + RIP2(A, B,C, D,E, WR50, SR50, KR3); + RIP2(E, A,B, C,D, WR51, SR51, KR3); + RIP2(D, E,A, B,C, WR52, SR52, KR3); + RIP2(C, D,E, A,B, WR53, SR53, KR3); + RIP2(B, C,D, E,A, WR54, SR54, KR3); + RIP2(A, B,C, D,E, WR55, SR55, KR3); + RIP2(E, A,B, C,D, WR56, SR56, KR3); + RIP2(D, E,A, B,C, WR57, SR57, KR3); + RIP2(C, D,E, A,B, WR58, SR58, KR3); + RIP2(B, C,D, E,A, WR59, SR59, KR3); + RIP2(A, B,C, D,E, WR60, SR60, KR3); + RIP2(E, A,B, C,D, WR61, SR61, KR3); + RIP2(D, E,A, B,C, WR62, SR62, KR3); + RIP2(C, D,E, A,B, WR63, SR63, KR3); - RIP1(B,C,D,E,A,WR64,SR64); - RIP1(A,B,C,D,E,WR65,SR65); - RIP1(E,A,B,C,D,WR66,SR66); - RIP1(D,E,A,B,C,WR67,SR67); - RIP1(C,D,E,A,B,WR68,SR68); - RIP1(B,C,D,E,A,WR69,SR69); - RIP1(A,B,C,D,E,WR70,SR70); - RIP1(E,A,B,C,D,WR71,SR71); - RIP1(D,E,A,B,C,WR72,SR72); - RIP1(C,D,E,A,B,WR73,SR73); - RIP1(B,C,D,E,A,WR74,SR74); - RIP1(A,B,C,D,E,WR75,SR75); - RIP1(E,A,B,C,D,WR76,SR76); - RIP1(D,E,A,B,C,WR77,SR77); - RIP1(C,D,E,A,B,WR78,SR78); - RIP1(B,C,D,E,A,WR79,SR79); + RIP1(B, C,D, E,A, WR64, SR64); + RIP1(A, B,C, D,E, WR65, SR65); + RIP1(E, A,B, C,D, WR66, SR66); + RIP1(D, E,A, B,C, WR67, SR67); + RIP1(C, D,E, A,B, WR68, SR68); + RIP1(B, C,D, E,A, WR69, SR69); + RIP1(A, B,C, D,E, WR70, SR70); + RIP1(E, A,B, C,D, WR71, SR71); + RIP1(D, E,A, B,C, WR72, SR72); + RIP1(C, D,E, A,B, WR73, SR73); + RIP1(B, C,D, E,A, WR74, SR74); + RIP1(A, B,C, D,E, WR75, SR75); + RIP1(E, A,B, C,D, WR76, SR76); + RIP1(D, E,A, B,C, WR77, SR77); + RIP1(C, D,E, A,B, WR78, SR78); + RIP1(B, C,D, E,A, WR79, SR79); - D =ctx->B+c+D; - ctx->B=ctx->C+d+E; - ctx->C=ctx->D+e+A; - ctx->D=ctx->E+a+B; - ctx->E=ctx->A+b+C; - ctx->A=D; + D = ctx->B + c + D; + ctx->B = ctx->C + d + E; + ctx->C = ctx->D + e + A; + ctx->D = ctx->E + a + B; + ctx->E = ctx->A + b + C; + ctx->A = D; - } } +} #endif diff --git a/lib/libcrypto/ripemd/rmd_local.h b/lib/libcrypto/ripemd/rmd_local.h deleted file mode 100644 index 1e4681670..000000000 --- a/lib/libcrypto/ripemd/rmd_local.h +++ /dev/null @@ -1,149 +0,0 @@ -/* $OpenBSD: rmd_local.h,v 1.1 2022/11/26 16:08:54 tb Exp $ */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include -#include -#include -#include - -/* - * DO EXAMINE COMMENTS IN crypto/md5/md5_locl.h & crypto/md5/md5_dgst.c - * FOR EXPLANATIONS ON FOLLOWING "CODE." - * - */ -#ifdef RMD160_ASM -# if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__) -# define ripemd160_block_data_order ripemd160_block_asm_data_order -# endif -#endif - -__BEGIN_HIDDEN_DECLS - -void ripemd160_block_data_order (RIPEMD160_CTX *c, const void *p,size_t num); - -__END_HIDDEN_DECLS - -#define DATA_ORDER_IS_LITTLE_ENDIAN - -#define HASH_LONG RIPEMD160_LONG -#define HASH_CTX RIPEMD160_CTX -#define HASH_CBLOCK RIPEMD160_CBLOCK -#define HASH_UPDATE RIPEMD160_Update -#define HASH_TRANSFORM RIPEMD160_Transform -#define HASH_FINAL RIPEMD160_Final -#define HASH_MAKE_STRING(c,s) do { \ - unsigned long ll; \ - ll=(c)->A; HOST_l2c(ll,(s)); \ - ll=(c)->B; HOST_l2c(ll,(s)); \ - ll=(c)->C; HOST_l2c(ll,(s)); \ - ll=(c)->D; HOST_l2c(ll,(s)); \ - ll=(c)->E; HOST_l2c(ll,(s)); \ - } while (0) -#define HASH_BLOCK_DATA_ORDER ripemd160_block_data_order - -#include "md32_common.h" - -#if 0 -#define F1(x,y,z) ((x)^(y)^(z)) -#define F2(x,y,z) (((x)&(y))|((~x)&z)) -#define F3(x,y,z) (((x)|(~y))^(z)) -#define F4(x,y,z) (((x)&(z))|((y)&(~(z)))) -#define F5(x,y,z) ((x)^((y)|(~(z)))) -#else -/* - * Transformed F2 and F4 are courtesy of Wei Dai - */ -#define F1(x,y,z) ((x) ^ (y) ^ (z)) -#define F2(x,y,z) ((((y) ^ (z)) & (x)) ^ (z)) -#define F3(x,y,z) (((~(y)) | (x)) ^ (z)) -#define F4(x,y,z) ((((x) ^ (y)) & (z)) ^ (y)) -#define F5(x,y,z) (((~(z)) | (y)) ^ (x)) -#endif - -#define RIPEMD160_A 0x67452301L -#define RIPEMD160_B 0xEFCDAB89L -#define RIPEMD160_C 0x98BADCFEL -#define RIPEMD160_D 0x10325476L -#define RIPEMD160_E 0xC3D2E1F0L - -#include "rmdconst.h" - -#define RIP1(a,b,c,d,e,w,s) { \ - a+=F1(b,c,d)+X(w); \ - a=ROTATE(a,s)+e; \ - c=ROTATE(c,10); } - -#define RIP2(a,b,c,d,e,w,s,K) { \ - a+=F2(b,c,d)+X(w)+K; \ - a=ROTATE(a,s)+e; \ - c=ROTATE(c,10); } - -#define RIP3(a,b,c,d,e,w,s,K) { \ - a+=F3(b,c,d)+X(w)+K; \ - a=ROTATE(a,s)+e; \ - c=ROTATE(c,10); } - -#define RIP4(a,b,c,d,e,w,s,K) { \ - a+=F4(b,c,d)+X(w)+K; \ - a=ROTATE(a,s)+e; \ - c=ROTATE(c,10); } - -#define RIP5(a,b,c,d,e,w,s,K) { \ - a+=F5(b,c,d)+X(w)+K; \ - a=ROTATE(a,s)+e; \ - c=ROTATE(c,10); } diff --git a/lib/libcrypto/ripemd/rmd_one.c b/lib/libcrypto/ripemd/rmd_one.c index 0d372f32f..18b746039 100644 --- a/lib/libcrypto/ripemd/rmd_one.c +++ b/lib/libcrypto/ripemd/rmd_one.c @@ -1,25 +1,25 @@ -/* $OpenBSD: rmd_one.c,v 1.9 2015/09/10 15:56:25 jsing Exp $ */ +/* $OpenBSD: rmd_one.c,v 1.10 2023/07/08 06:52:56 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -61,18 +61,20 @@ #include #include -unsigned char *RIPEMD160(const unsigned char *d, size_t n, - unsigned char *md) - { +unsigned char * +RIPEMD160(const unsigned char *d, size_t n, + unsigned char *md) +{ RIPEMD160_CTX c; static unsigned char m[RIPEMD160_DIGEST_LENGTH]; - if (md == NULL) md=m; + if (md == NULL) + md = m; if (!RIPEMD160_Init(&c)) return NULL; - RIPEMD160_Update(&c,d,n); - RIPEMD160_Final(md,&c); - explicit_bzero(&c,sizeof(c)); - return(md); - } + RIPEMD160_Update(&c, d, n); + RIPEMD160_Final(md, &c); + explicit_bzero(&c, sizeof(c)); + return (md); +} diff --git a/lib/libcrypto/ripemd/rmdconst.h b/lib/libcrypto/ripemd/rmdconst.h index f34047f4f..7d703da77 100644 --- a/lib/libcrypto/ripemd/rmdconst.h +++ b/lib/libcrypto/ripemd/rmdconst.h @@ -1,25 +1,25 @@ -/* $OpenBSD: rmdconst.h,v 1.3 2016/12/21 15:49:29 jsing Exp $ */ +/* $OpenBSD: rmdconst.h,v 1.4 2023/07/08 06:52:56 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence diff --git a/lib/libcrypto/rsa/rsa_ameth.c b/lib/libcrypto/rsa/rsa_ameth.c index 1cf2069a1..825a9f444 100644 --- a/lib/libcrypto/rsa/rsa_ameth.c +++ b/lib/libcrypto/rsa/rsa_ameth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_ameth.c,v 1.29 2023/05/19 17:31:20 tb Exp $ */ +/* $OpenBSD: rsa_ameth.c,v 1.30 2023/07/07 06:59:18 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -68,6 +68,7 @@ #include #include "asn1_local.h" +#include "bn_local.h" #include "cryptlib.h" #include "evp_local.h" #include "rsa_local.h" @@ -408,44 +409,13 @@ rsa_pss_param_print(BIO *bp, int pss_key, RSA_PSS_PARAMS *pss, int indent) } -static void -update_buflen(const BIGNUM *b, size_t *pbuflen) -{ - size_t i; - - if (!b) - return; - if (*pbuflen < (i = (size_t)BN_num_bytes(b))) - *pbuflen = i; -} - static int pkey_rsa_print(BIO *bp, const EVP_PKEY *pkey, int off, int priv) { const RSA *x = pkey->pkey.rsa; - unsigned char *m = NULL; char *str; const char *s; int ret = 0, mod_len = 0; - size_t buf_len = 0; - - update_buflen(x->n, &buf_len); - update_buflen(x->e, &buf_len); - - if (priv) { - update_buflen(x->d, &buf_len); - update_buflen(x->p, &buf_len); - update_buflen(x->q, &buf_len); - update_buflen(x->dmp1, &buf_len); - update_buflen(x->dmq1, &buf_len); - update_buflen(x->iqmp, &buf_len); - } - - m = malloc(buf_len + 10); - if (m == NULL) { - RSAerror(ERR_R_MALLOC_FAILURE); - goto err; - } if (x->n != NULL) mod_len = BN_num_bits(x->n); @@ -467,29 +437,28 @@ pkey_rsa_print(BIO *bp, const EVP_PKEY *pkey, int off, int priv) str = "Modulus:"; s = "Exponent:"; } - if (!ASN1_bn_print(bp, str, x->n, m, off)) + if (!bn_printf(bp, x->n, off, "%s", str)) goto err; - if (!ASN1_bn_print(bp, s, x->e, m, off)) + if (!bn_printf(bp, x->e, off, "%s", s)) goto err; if (priv) { - if (!ASN1_bn_print(bp, "privateExponent:", x->d, m, off)) + if (!bn_printf(bp, x->d, off, "privateExponent:")) goto err; - if (!ASN1_bn_print(bp, "prime1:", x->p, m, off)) + if (!bn_printf(bp, x->p, off, "prime1:")) goto err; - if (!ASN1_bn_print(bp, "prime2:", x->q, m, off)) + if (!bn_printf(bp, x->q, off, "prime2:")) goto err; - if (!ASN1_bn_print(bp, "exponent1:", x->dmp1, m, off)) + if (!bn_printf(bp, x->dmp1, off, "exponent1:")) goto err; - if (!ASN1_bn_print(bp, "exponent2:", x->dmq1, m, off)) + if (!bn_printf(bp, x->dmq1, off, "exponent2:")) goto err; - if (!ASN1_bn_print(bp, "coefficient:", x->iqmp, m, off)) + if (!bn_printf(bp, x->iqmp, off, "coefficient:")) goto err; } if (pkey_is_pss(pkey) && !rsa_pss_param_print(bp, 1, x->pss, off)) goto err; ret = 1; err: - free(m); return ret; } diff --git a/lib/libcrypto/rsa/rsa_asn1.c b/lib/libcrypto/rsa/rsa_asn1.c index 63c3637f4..0f6d8c49f 100644 --- a/lib/libcrypto/rsa/rsa_asn1.c +++ b/lib/libcrypto/rsa/rsa_asn1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_asn1.c,v 1.16 2022/11/26 16:08:54 tb Exp $ */ +/* $OpenBSD: rsa_asn1.c,v 1.17 2023/07/08 12:26:45 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -269,24 +269,28 @@ d2i_RSA_PSS_PARAMS(RSA_PSS_PARAMS **a, const unsigned char **in, long len) return (RSA_PSS_PARAMS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &RSA_PSS_PARAMS_it); } +LCRYPTO_ALIAS(d2i_RSA_PSS_PARAMS); int i2d_RSA_PSS_PARAMS(RSA_PSS_PARAMS *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &RSA_PSS_PARAMS_it); } +LCRYPTO_ALIAS(i2d_RSA_PSS_PARAMS); RSA_PSS_PARAMS * RSA_PSS_PARAMS_new(void) { return (RSA_PSS_PARAMS *)ASN1_item_new(&RSA_PSS_PARAMS_it); } +LCRYPTO_ALIAS(RSA_PSS_PARAMS_new); void RSA_PSS_PARAMS_free(RSA_PSS_PARAMS *a) { ASN1_item_free((ASN1_VALUE *)a, &RSA_PSS_PARAMS_it); } +LCRYPTO_ALIAS(RSA_PSS_PARAMS_free); static int rsa_oaep_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) @@ -349,24 +353,28 @@ d2i_RSA_OAEP_PARAMS(RSA_OAEP_PARAMS **a, const unsigned char **in, long len) return (RSA_OAEP_PARAMS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &RSA_OAEP_PARAMS_it); } +LCRYPTO_ALIAS(d2i_RSA_OAEP_PARAMS); int i2d_RSA_OAEP_PARAMS(RSA_OAEP_PARAMS *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &RSA_OAEP_PARAMS_it); } +LCRYPTO_ALIAS(i2d_RSA_OAEP_PARAMS); RSA_OAEP_PARAMS * RSA_OAEP_PARAMS_new(void) { return (RSA_OAEP_PARAMS *)ASN1_item_new(&RSA_OAEP_PARAMS_it); } +LCRYPTO_ALIAS(RSA_OAEP_PARAMS_new); void RSA_OAEP_PARAMS_free(RSA_OAEP_PARAMS *a) { ASN1_item_free((ASN1_VALUE *)a, &RSA_OAEP_PARAMS_it); } +LCRYPTO_ALIAS(RSA_OAEP_PARAMS_free); RSA * d2i_RSAPrivateKey(RSA **a, const unsigned char **in, long len) @@ -374,12 +382,14 @@ d2i_RSAPrivateKey(RSA **a, const unsigned char **in, long len) return (RSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &RSAPrivateKey_it); } +LCRYPTO_ALIAS(d2i_RSAPrivateKey); int i2d_RSAPrivateKey(const RSA *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &RSAPrivateKey_it); } +LCRYPTO_ALIAS(i2d_RSAPrivateKey); RSA * @@ -388,21 +398,25 @@ d2i_RSAPublicKey(RSA **a, const unsigned char **in, long len) return (RSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &RSAPublicKey_it); } +LCRYPTO_ALIAS(d2i_RSAPublicKey); int i2d_RSAPublicKey(const RSA *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &RSAPublicKey_it); } +LCRYPTO_ALIAS(i2d_RSAPublicKey); RSA * RSAPublicKey_dup(RSA *rsa) { return ASN1_item_dup(&RSAPublicKey_it, rsa); } +LCRYPTO_ALIAS(RSAPublicKey_dup); RSA * RSAPrivateKey_dup(RSA *rsa) { return ASN1_item_dup(&RSAPrivateKey_it, rsa); } +LCRYPTO_ALIAS(RSAPrivateKey_dup); diff --git a/lib/libcrypto/rsa/rsa_chk.c b/lib/libcrypto/rsa/rsa_chk.c index 5d7f7b307..b7666e0fe 100644 --- a/lib/libcrypto/rsa/rsa_chk.c +++ b/lib/libcrypto/rsa/rsa_chk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_chk.c,v 1.17 2022/11/26 16:08:54 tb Exp $ */ +/* $OpenBSD: rsa_chk.c,v 1.18 2023/07/08 12:26:45 beck Exp $ */ /* ==================================================================== * Copyright (c) 1999 The OpenSSL Project. All rights reserved. * @@ -220,3 +220,4 @@ err: return (ret); } +LCRYPTO_ALIAS(RSA_check_key); diff --git a/lib/libcrypto/rsa/rsa_crpt.c b/lib/libcrypto/rsa/rsa_crpt.c index a1b2eec6c..ea79280b1 100644 --- a/lib/libcrypto/rsa/rsa_crpt.c +++ b/lib/libcrypto/rsa/rsa_crpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_crpt.c,v 1.21 2022/11/26 16:08:54 tb Exp $ */ +/* $OpenBSD: rsa_crpt.c,v 1.22 2023/07/08 12:26:45 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -78,12 +78,14 @@ RSA_bits(const RSA *r) { return BN_num_bits(r->n); } +LCRYPTO_ALIAS(RSA_bits); int RSA_size(const RSA *r) { return BN_num_bytes(r->n); } +LCRYPTO_ALIAS(RSA_size); int RSA_public_encrypt(int flen, const unsigned char *from, unsigned char *to, @@ -91,6 +93,7 @@ RSA_public_encrypt(int flen, const unsigned char *from, unsigned char *to, { return rsa->meth->rsa_pub_enc(flen, from, to, rsa, padding); } +LCRYPTO_ALIAS(RSA_public_encrypt); int RSA_private_encrypt(int flen, const unsigned char *from, unsigned char *to, @@ -98,6 +101,7 @@ RSA_private_encrypt(int flen, const unsigned char *from, unsigned char *to, { return rsa->meth->rsa_priv_enc(flen, from, to, rsa, padding); } +LCRYPTO_ALIAS(RSA_private_encrypt); int RSA_private_decrypt(int flen, const unsigned char *from, unsigned char *to, @@ -105,6 +109,7 @@ RSA_private_decrypt(int flen, const unsigned char *from, unsigned char *to, { return rsa->meth->rsa_priv_dec(flen, from, to, rsa, padding); } +LCRYPTO_ALIAS(RSA_private_decrypt); int RSA_public_decrypt(int flen, const unsigned char *from, unsigned char *to, @@ -112,12 +117,14 @@ RSA_public_decrypt(int flen, const unsigned char *from, unsigned char *to, { return rsa->meth->rsa_pub_dec(flen, from, to, rsa, padding); } +LCRYPTO_ALIAS(RSA_public_decrypt); int RSA_flags(const RSA *r) { return r == NULL ? 0 : r->meth->flags; } +LCRYPTO_ALIAS(RSA_flags); void RSA_blinding_off(RSA *rsa) @@ -126,6 +133,7 @@ RSA_blinding_off(RSA *rsa) rsa->blinding = NULL; rsa->flags |= RSA_FLAG_NO_BLINDING; } +LCRYPTO_ALIAS(RSA_blinding_off); int RSA_blinding_on(RSA *rsa, BN_CTX *ctx) @@ -144,6 +152,7 @@ RSA_blinding_on(RSA *rsa, BN_CTX *ctx) err: return (ret); } +LCRYPTO_ALIAS(RSA_blinding_on); static BIGNUM * rsa_get_public_exp(const BIGNUM *d, const BIGNUM *p, const BIGNUM *q, @@ -220,3 +229,4 @@ err: return ret; } +LCRYPTO_ALIAS(RSA_setup_blinding); diff --git a/lib/libcrypto/rsa/rsa_eay.c b/lib/libcrypto/rsa/rsa_eay.c index 6db563f2a..f6b1d6555 100644 --- a/lib/libcrypto/rsa/rsa_eay.c +++ b/lib/libcrypto/rsa/rsa_eay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_eay.c,v 1.60 2023/05/05 12:21:44 tb Exp $ */ +/* $OpenBSD: rsa_eay.c,v 1.62 2023/07/08 12:26:45 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -121,44 +121,8 @@ #include "bn_local.h" #include "rsa_local.h" -static int RSA_eay_public_encrypt(int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -static int RSA_eay_private_encrypt(int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -static int RSA_eay_public_decrypt(int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -static int RSA_eay_private_decrypt(int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *i, RSA *rsa, BN_CTX *ctx); -static int RSA_eay_init(RSA *rsa); -static int RSA_eay_finish(RSA *rsa); - -static RSA_METHOD rsa_pkcs1_eay_meth = { - .name = "Eric Young's PKCS#1 RSA", - .rsa_pub_enc = RSA_eay_public_encrypt, - .rsa_pub_dec = RSA_eay_public_decrypt, /* signature verification */ - .rsa_priv_enc = RSA_eay_private_encrypt, /* signing */ - .rsa_priv_dec = RSA_eay_private_decrypt, - .rsa_mod_exp = RSA_eay_mod_exp, - .bn_mod_exp = BN_mod_exp_mont_ct, /* XXX probably we should not use Montgomery if e == 3 */ - .init = RSA_eay_init, - .finish = RSA_eay_finish, -}; - -const RSA_METHOD * -RSA_PKCS1_OpenSSL(void) -{ - return &rsa_pkcs1_eay_meth; -} - -const RSA_METHOD * -RSA_PKCS1_SSLeay(void) -{ - return &rsa_pkcs1_eay_meth; -} - static int -RSA_eay_public_encrypt(int flen, const unsigned char *from, unsigned char *to, +rsa_public_encrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding) { BIGNUM *f, *ret; @@ -348,7 +312,7 @@ rsa_blinding_invert(BN_BLINDING *b, BIGNUM *f, BIGNUM *unblind, BN_CTX *ctx) /* signing */ static int -RSA_eay_private_encrypt(int flen, const unsigned char *from, unsigned char *to, +rsa_private_encrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding) { BIGNUM *f, *ret, *res; @@ -476,7 +440,7 @@ err: } static int -RSA_eay_private_decrypt(int flen, const unsigned char *from, unsigned char *to, +rsa_private_decrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding) { BIGNUM *f, *ret; @@ -601,7 +565,7 @@ err: /* signature verification */ static int -RSA_eay_public_decrypt(int flen, const unsigned char *from, unsigned char *to, +rsa_public_decrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding) { BIGNUM *f, *ret; @@ -701,7 +665,7 @@ err: } static int -RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) +rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) { BIGNUM *r1, *m1, *vrfy; BIGNUM dmp1, dmq1, c, pr1; @@ -852,14 +816,14 @@ err: } static int -RSA_eay_init(RSA *rsa) +rsa_init(RSA *rsa) { rsa->flags |= RSA_FLAG_CACHE_PUBLIC | RSA_FLAG_CACHE_PRIVATE; return 1; } static int -RSA_eay_finish(RSA *rsa) +rsa_finish(RSA *rsa) { BN_MONT_CTX_free(rsa->_method_mod_n); BN_MONT_CTX_free(rsa->_method_mod_p); @@ -867,3 +831,29 @@ RSA_eay_finish(RSA *rsa) return 1; } + +static const RSA_METHOD rsa_pkcs1_meth = { + .name = "OpenSSL PKCS#1 RSA", + .rsa_pub_enc = rsa_public_encrypt, + .rsa_pub_dec = rsa_public_decrypt, /* signature verification */ + .rsa_priv_enc = rsa_private_encrypt, /* signing */ + .rsa_priv_dec = rsa_private_decrypt, + .rsa_mod_exp = rsa_mod_exp, + .bn_mod_exp = BN_mod_exp_mont_ct, /* XXX probably we should not use Montgomery if e == 3 */ + .init = rsa_init, + .finish = rsa_finish, +}; + +const RSA_METHOD * +RSA_PKCS1_OpenSSL(void) +{ + return &rsa_pkcs1_meth; +} +LCRYPTO_ALIAS(RSA_PKCS1_OpenSSL); + +const RSA_METHOD * +RSA_PKCS1_SSLeay(void) +{ + return RSA_PKCS1_OpenSSL(); +} +LCRYPTO_ALIAS(RSA_PKCS1_SSLeay); diff --git a/lib/libcrypto/rsa/rsa_err.c b/lib/libcrypto/rsa/rsa_err.c index 79425c0f4..8b5416890 100644 --- a/lib/libcrypto/rsa/rsa_err.c +++ b/lib/libcrypto/rsa/rsa_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_err.c,v 1.21 2022/07/12 14:42:50 kn Exp $ */ +/* $OpenBSD: rsa_err.c,v 1.22 2023/07/08 12:26:45 beck Exp $ */ /* ==================================================================== * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * @@ -155,3 +155,4 @@ ERR_load_RSA_strings(void) } #endif } +LCRYPTO_ALIAS(ERR_load_RSA_strings); diff --git a/lib/libcrypto/rsa/rsa_gen.c b/lib/libcrypto/rsa/rsa_gen.c index 9db8eca92..ff64eb2f0 100644 --- a/lib/libcrypto/rsa/rsa_gen.c +++ b/lib/libcrypto/rsa/rsa_gen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_gen.c,v 1.29 2023/04/13 15:18:29 tb Exp $ */ +/* $OpenBSD: rsa_gen.c,v 1.30 2023/07/08 12:26:45 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -75,6 +75,7 @@ RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb) return rsa->meth->rsa_keygen(rsa, bits, e_value, cb); return rsa_builtin_keygen(rsa, bits, e_value, cb); } +LCRYPTO_ALIAS(RSA_generate_key_ex); static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb) @@ -253,3 +254,4 @@ err: return 0; } +LCRYPTO_ALIAS(RSA_generate_key); diff --git a/lib/libcrypto/rsa/rsa_lib.c b/lib/libcrypto/rsa/rsa_lib.c index 9656252d7..8831253b9 100644 --- a/lib/libcrypto/rsa/rsa_lib.c +++ b/lib/libcrypto/rsa/rsa_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_lib.c,v 1.46 2023/03/11 21:14:26 tb Exp $ */ +/* $OpenBSD: rsa_lib.c,v 1.47 2023/07/08 12:26:45 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -83,12 +83,14 @@ RSA_new(void) return r; } +LCRYPTO_ALIAS(RSA_new); void RSA_set_default_method(const RSA_METHOD *meth) { default_RSA_meth = meth; } +LCRYPTO_ALIAS(RSA_set_default_method); const RSA_METHOD * RSA_get_default_method(void) @@ -98,12 +100,14 @@ RSA_get_default_method(void) return default_RSA_meth; } +LCRYPTO_ALIAS(RSA_get_default_method); const RSA_METHOD * RSA_get_method(const RSA *rsa) { return rsa->meth; } +LCRYPTO_ALIAS(RSA_get_method); int RSA_set_method(RSA *rsa, const RSA_METHOD *meth) @@ -126,6 +130,7 @@ RSA_set_method(RSA *rsa, const RSA_METHOD *meth) meth->init(rsa); return 1; } +LCRYPTO_ALIAS(RSA_set_method); RSA * RSA_new_method(ENGINE *engine) @@ -179,6 +184,7 @@ RSA_new_method(ENGINE *engine) return NULL; } +LCRYPTO_ALIAS(RSA_new_method); void RSA_free(RSA *r) @@ -213,6 +219,7 @@ RSA_free(RSA *r) RSA_PSS_PARAMS_free(r->pss); free(r); } +LCRYPTO_ALIAS(RSA_free); int RSA_up_ref(RSA *r) @@ -220,6 +227,7 @@ RSA_up_ref(RSA *r) int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_RSA); return i > 1 ? 1 : 0; } +LCRYPTO_ALIAS(RSA_up_ref); int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, @@ -228,24 +236,28 @@ RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_RSA, argl, argp, new_func, dup_func, free_func); } +LCRYPTO_ALIAS(RSA_get_ex_new_index); int RSA_set_ex_data(RSA *r, int idx, void *arg) { return CRYPTO_set_ex_data(&r->ex_data, idx, arg); } +LCRYPTO_ALIAS(RSA_set_ex_data); void * RSA_get_ex_data(const RSA *r, int idx) { return CRYPTO_get_ex_data(&r->ex_data, idx); } +LCRYPTO_ALIAS(RSA_get_ex_data); int RSA_security_bits(const RSA *rsa) { return BN_security_bits(RSA_bits(rsa), -1); } +LCRYPTO_ALIAS(RSA_security_bits); void RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d) @@ -257,6 +269,7 @@ RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d) if (d != NULL) *d = r->d; } +LCRYPTO_ALIAS(RSA_get0_key); int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d) @@ -279,6 +292,7 @@ RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d) return 1; } +LCRYPTO_ALIAS(RSA_set0_key); void RSA_get0_crt_params(const RSA *r, const BIGNUM **dmp1, const BIGNUM **dmq1, @@ -291,6 +305,7 @@ RSA_get0_crt_params(const RSA *r, const BIGNUM **dmp1, const BIGNUM **dmq1, if (iqmp != NULL) *iqmp = r->iqmp; } +LCRYPTO_ALIAS(RSA_get0_crt_params); int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp) @@ -315,6 +330,7 @@ RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp) return 1; } +LCRYPTO_ALIAS(RSA_set0_crt_params); void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q) @@ -324,6 +340,7 @@ RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q) if (q != NULL) *q = r->q; } +LCRYPTO_ALIAS(RSA_get0_factors); int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q) @@ -342,78 +359,91 @@ RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q) return 1; } +LCRYPTO_ALIAS(RSA_set0_factors); const BIGNUM * RSA_get0_n(const RSA *r) { return r->n; } +LCRYPTO_ALIAS(RSA_get0_n); const BIGNUM * RSA_get0_e(const RSA *r) { return r->e; } +LCRYPTO_ALIAS(RSA_get0_e); const BIGNUM * RSA_get0_d(const RSA *r) { return r->d; } +LCRYPTO_ALIAS(RSA_get0_d); const BIGNUM * RSA_get0_p(const RSA *r) { return r->p; } +LCRYPTO_ALIAS(RSA_get0_p); const BIGNUM * RSA_get0_q(const RSA *r) { return r->q; } +LCRYPTO_ALIAS(RSA_get0_q); const BIGNUM * RSA_get0_dmp1(const RSA *r) { return r->dmp1; } +LCRYPTO_ALIAS(RSA_get0_dmp1); const BIGNUM * RSA_get0_dmq1(const RSA *r) { return r->dmq1; } +LCRYPTO_ALIAS(RSA_get0_dmq1); const BIGNUM * RSA_get0_iqmp(const RSA *r) { return r->iqmp; } +LCRYPTO_ALIAS(RSA_get0_iqmp); const RSA_PSS_PARAMS * RSA_get0_pss_params(const RSA *r) { return r->pss; } +LCRYPTO_ALIAS(RSA_get0_pss_params); void RSA_clear_flags(RSA *r, int flags) { r->flags &= ~flags; } +LCRYPTO_ALIAS(RSA_clear_flags); int RSA_test_flags(const RSA *r, int flags) { return r->flags & flags; } +LCRYPTO_ALIAS(RSA_test_flags); void RSA_set_flags(RSA *r, int flags) { r->flags |= flags; } +LCRYPTO_ALIAS(RSA_set_flags); int RSA_pkey_ctx_ctrl(EVP_PKEY_CTX *ctx, int optype, int cmd, int p1, void *p2) @@ -426,3 +456,4 @@ RSA_pkey_ctx_ctrl(EVP_PKEY_CTX *ctx, int optype, int cmd, int p1, void *p2) return EVP_PKEY_CTX_ctrl(ctx, -1, optype, cmd, p1, p2); } +LCRYPTO_ALIAS(RSA_pkey_ctx_ctrl); diff --git a/lib/libcrypto/rsa/rsa_meth.c b/lib/libcrypto/rsa/rsa_meth.c index a01192734..71608caa0 100644 --- a/lib/libcrypto/rsa/rsa_meth.c +++ b/lib/libcrypto/rsa/rsa_meth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_meth.c,v 1.6 2022/11/26 16:08:54 tb Exp $ */ +/* $OpenBSD: rsa_meth.c,v 1.7 2023/07/08 12:26:45 beck Exp $ */ /* * Copyright (c) 2018 Theo Buehler * @@ -38,6 +38,7 @@ RSA_meth_new(const char *name, int flags) return meth; } +LCRYPTO_ALIAS(RSA_meth_new); void RSA_meth_free(RSA_METHOD *meth) @@ -48,6 +49,7 @@ RSA_meth_free(RSA_METHOD *meth) free(meth->name); free(meth); } +LCRYPTO_ALIAS(RSA_meth_free); RSA_METHOD * RSA_meth_dup(const RSA_METHOD *meth) @@ -64,6 +66,7 @@ RSA_meth_dup(const RSA_METHOD *meth) return copy; } +LCRYPTO_ALIAS(RSA_meth_dup); int RSA_meth_set1_name(RSA_METHOD *meth, const char *name) @@ -76,12 +79,14 @@ RSA_meth_set1_name(RSA_METHOD *meth, const char *name) meth->name = new_name; return 1; } +LCRYPTO_ALIAS(RSA_meth_set1_name); int (*RSA_meth_get_finish(const RSA_METHOD *meth))(RSA *rsa) { return meth->finish; } +LCRYPTO_ALIAS(RSA_meth_get_finish); int RSA_meth_set_priv_enc(RSA_METHOD *meth, int (*priv_enc)(int flen, @@ -90,6 +95,7 @@ RSA_meth_set_priv_enc(RSA_METHOD *meth, int (*priv_enc)(int flen, meth->rsa_priv_enc = priv_enc; return 1; } +LCRYPTO_ALIAS(RSA_meth_set_priv_enc); int RSA_meth_set_priv_dec(RSA_METHOD *meth, int (*priv_dec)(int flen, @@ -98,6 +104,7 @@ RSA_meth_set_priv_dec(RSA_METHOD *meth, int (*priv_dec)(int flen, meth->rsa_priv_dec = priv_dec; return 1; } +LCRYPTO_ALIAS(RSA_meth_set_priv_dec); int RSA_meth_set_finish(RSA_METHOD *meth, int (*finish)(RSA *rsa)) @@ -105,6 +112,7 @@ RSA_meth_set_finish(RSA_METHOD *meth, int (*finish)(RSA *rsa)) meth->finish = finish; return 1; } +LCRYPTO_ALIAS(RSA_meth_set_finish); int RSA_meth_set_pub_enc(RSA_METHOD *meth, int (*pub_enc)(int flen, @@ -113,6 +121,7 @@ RSA_meth_set_pub_enc(RSA_METHOD *meth, int (*pub_enc)(int flen, meth->rsa_pub_enc = pub_enc; return 1; } +LCRYPTO_ALIAS(RSA_meth_set_pub_enc); int RSA_meth_set_pub_dec(RSA_METHOD *meth, int (*pub_dec)(int flen, @@ -121,6 +130,7 @@ RSA_meth_set_pub_dec(RSA_METHOD *meth, int (*pub_dec)(int flen, meth->rsa_pub_dec = pub_dec; return 1; } +LCRYPTO_ALIAS(RSA_meth_set_pub_dec); int RSA_meth_set_mod_exp(RSA_METHOD *meth, int (*mod_exp)(BIGNUM *r0, @@ -129,6 +139,7 @@ RSA_meth_set_mod_exp(RSA_METHOD *meth, int (*mod_exp)(BIGNUM *r0, meth->rsa_mod_exp = mod_exp; return 1; } +LCRYPTO_ALIAS(RSA_meth_set_mod_exp); int RSA_meth_set_bn_mod_exp(RSA_METHOD *meth, int (*bn_mod_exp)(BIGNUM *r, @@ -138,6 +149,7 @@ RSA_meth_set_bn_mod_exp(RSA_METHOD *meth, int (*bn_mod_exp)(BIGNUM *r, meth->bn_mod_exp = bn_mod_exp; return 1; } +LCRYPTO_ALIAS(RSA_meth_set_bn_mod_exp); int RSA_meth_set_init(RSA_METHOD *meth, int (*init)(RSA *rsa)) @@ -145,6 +157,7 @@ RSA_meth_set_init(RSA_METHOD *meth, int (*init)(RSA *rsa)) meth->init = init; return 1; } +LCRYPTO_ALIAS(RSA_meth_set_init); int RSA_meth_set_keygen(RSA_METHOD *meth, int (*keygen)(RSA *rsa, int bits, @@ -153,6 +166,7 @@ RSA_meth_set_keygen(RSA_METHOD *meth, int (*keygen)(RSA *rsa, int bits, meth->rsa_keygen = keygen; return 1; } +LCRYPTO_ALIAS(RSA_meth_set_keygen); int RSA_meth_set_flags(RSA_METHOD *meth, int flags) @@ -160,6 +174,7 @@ RSA_meth_set_flags(RSA_METHOD *meth, int flags) meth->flags = flags; return 1; } +LCRYPTO_ALIAS(RSA_meth_set_flags); int RSA_meth_set0_app_data(RSA_METHOD *meth, void *app_data) @@ -167,12 +182,14 @@ RSA_meth_set0_app_data(RSA_METHOD *meth, void *app_data) meth->app_data = app_data; return 1; } +LCRYPTO_ALIAS(RSA_meth_set0_app_data); const char * RSA_meth_get0_name(const RSA_METHOD *meth) { return meth->name; } +LCRYPTO_ALIAS(RSA_meth_get0_name); int (*RSA_meth_get_pub_enc(const RSA_METHOD *meth))(int flen, @@ -180,6 +197,7 @@ int { return meth->rsa_pub_enc; } +LCRYPTO_ALIAS(RSA_meth_get_pub_enc); int (*RSA_meth_get_pub_dec(const RSA_METHOD *meth))(int flen, @@ -187,6 +205,7 @@ int { return meth->rsa_pub_dec; } +LCRYPTO_ALIAS(RSA_meth_get_pub_dec); int (*RSA_meth_get_priv_enc(const RSA_METHOD *meth))(int flen, @@ -194,6 +213,7 @@ int { return meth->rsa_priv_enc; } +LCRYPTO_ALIAS(RSA_meth_get_priv_enc); int (*RSA_meth_get_priv_dec(const RSA_METHOD *meth))(int flen, @@ -201,6 +221,7 @@ int { return meth->rsa_priv_dec; } +LCRYPTO_ALIAS(RSA_meth_get_priv_dec); int (*RSA_meth_get_mod_exp(const RSA_METHOD *meth))(BIGNUM *r0, const BIGNUM *i, @@ -208,6 +229,7 @@ int { return meth->rsa_mod_exp; } +LCRYPTO_ALIAS(RSA_meth_get_mod_exp); int (*RSA_meth_get_bn_mod_exp(const RSA_METHOD *meth))(BIGNUM *r, @@ -216,12 +238,14 @@ int { return meth->bn_mod_exp; } +LCRYPTO_ALIAS(RSA_meth_get_bn_mod_exp); int (*RSA_meth_get_init(const RSA_METHOD *meth))(RSA *rsa) { return meth->init; } +LCRYPTO_ALIAS(RSA_meth_get_init); int (*RSA_meth_get_keygen(const RSA_METHOD *meth))(RSA *rsa, int bits, BIGNUM *e, @@ -229,18 +253,21 @@ int { return meth->rsa_keygen; } +LCRYPTO_ALIAS(RSA_meth_get_keygen); int RSA_meth_get_flags(const RSA_METHOD *meth) { return meth->flags; } +LCRYPTO_ALIAS(RSA_meth_get_flags); void * RSA_meth_get0_app_data(const RSA_METHOD *meth) { return meth->app_data; } +LCRYPTO_ALIAS(RSA_meth_get0_app_data); int (*RSA_meth_get_sign(const RSA_METHOD *meth))(int type, @@ -250,6 +277,7 @@ int { return meth->rsa_sign; } +LCRYPTO_ALIAS(RSA_meth_get_sign); int RSA_meth_set_sign(RSA_METHOD *meth, int (*sign)(int type, @@ -259,6 +287,7 @@ RSA_meth_set_sign(RSA_METHOD *meth, int (*sign)(int type, meth->rsa_sign = sign; return 1; } +LCRYPTO_ALIAS(RSA_meth_set_sign); int (*RSA_meth_get_verify(const RSA_METHOD *meth))(int dtype, @@ -267,6 +296,7 @@ int { return meth->rsa_verify; } +LCRYPTO_ALIAS(RSA_meth_get_verify); int RSA_meth_set_verify(RSA_METHOD *meth, int (*verify)(int dtype, @@ -276,3 +306,4 @@ RSA_meth_set_verify(RSA_METHOD *meth, int (*verify)(int dtype, meth->rsa_verify = verify; return 1; } +LCRYPTO_ALIAS(RSA_meth_set_verify); diff --git a/lib/libcrypto/rsa/rsa_none.c b/lib/libcrypto/rsa/rsa_none.c index 13d3449a9..9c53dcf59 100644 --- a/lib/libcrypto/rsa/rsa_none.c +++ b/lib/libcrypto/rsa/rsa_none.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_none.c,v 1.11 2017/01/29 17:49:23 beck Exp $ */ +/* $OpenBSD: rsa_none.c,v 1.12 2023/07/08 12:26:45 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -80,6 +80,7 @@ RSA_padding_add_none(unsigned char *to, int tlen, const unsigned char *from, memcpy(to, from, flen); return 1; } +LCRYPTO_ALIAS(RSA_padding_add_none); int RSA_padding_check_none(unsigned char *to, int tlen, const unsigned char *from, @@ -94,3 +95,4 @@ RSA_padding_check_none(unsigned char *to, int tlen, const unsigned char *from, memcpy(to + tlen - flen, from, flen); return tlen; } +LCRYPTO_ALIAS(RSA_padding_check_none); diff --git a/lib/libcrypto/rsa/rsa_oaep.c b/lib/libcrypto/rsa/rsa_oaep.c index 083f4a6c8..c2c3a61da 100644 --- a/lib/libcrypto/rsa/rsa_oaep.c +++ b/lib/libcrypto/rsa/rsa_oaep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_oaep.c,v 1.36 2022/11/26 16:08:54 tb Exp $ */ +/* $OpenBSD: rsa_oaep.c,v 1.37 2023/07/08 12:26:45 beck Exp $ */ /* * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. * @@ -90,6 +90,7 @@ RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, return RSA_padding_add_PKCS1_OAEP_mgf1(to, tlen, from, flen, param, plen, NULL, NULL); } +LCRYPTO_ALIAS(RSA_padding_add_PKCS1_OAEP); int RSA_padding_add_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, @@ -156,6 +157,7 @@ RSA_padding_add_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, return rv; } +LCRYPTO_ALIAS(RSA_padding_add_PKCS1_OAEP_mgf1); int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, @@ -165,6 +167,7 @@ RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, return RSA_padding_check_PKCS1_OAEP_mgf1(to, tlen, from, flen, num, param, plen, NULL, NULL); } +LCRYPTO_ALIAS(RSA_padding_check_PKCS1_OAEP); int RSA_padding_check_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, @@ -315,6 +318,7 @@ RSA_padding_check_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, return constant_time_select_int(good, mlen, -1); } +LCRYPTO_ALIAS(RSA_padding_check_PKCS1_OAEP_mgf1); int PKCS1_MGF1(unsigned char *mask, long len, const unsigned char *seed, @@ -356,3 +360,4 @@ PKCS1_MGF1(unsigned char *mask, long len, const unsigned char *seed, EVP_MD_CTX_cleanup(&c); return rv; } +LCRYPTO_ALIAS(PKCS1_MGF1); diff --git a/lib/libcrypto/rsa/rsa_pk1.c b/lib/libcrypto/rsa/rsa_pk1.c index 6de263113..38f7c0be0 100644 --- a/lib/libcrypto/rsa/rsa_pk1.c +++ b/lib/libcrypto/rsa/rsa_pk1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_pk1.c,v 1.15 2017/01/29 17:49:23 beck Exp $ */ +/* $OpenBSD: rsa_pk1.c,v 1.16 2023/07/08 12:26:45 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -90,6 +90,7 @@ RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, return 1; } +LCRYPTO_ALIAS(RSA_padding_add_PKCS1_type_1); int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen, @@ -139,6 +140,7 @@ RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen, return j; } +LCRYPTO_ALIAS(RSA_padding_check_PKCS1_type_1); int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, @@ -172,6 +174,7 @@ RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, memcpy(p, from, flen); return 1; } +LCRYPTO_ALIAS(RSA_padding_add_PKCS1_type_2); int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen, @@ -211,3 +214,4 @@ RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen, return j; } +LCRYPTO_ALIAS(RSA_padding_check_PKCS1_type_2); diff --git a/lib/libcrypto/rsa/rsa_pmeth.c b/lib/libcrypto/rsa/rsa_pmeth.c index 429524d73..cb82b0908 100644 --- a/lib/libcrypto/rsa/rsa_pmeth.c +++ b/lib/libcrypto/rsa/rsa_pmeth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_pmeth.c,v 1.38 2023/05/05 12:21:44 tb Exp $ */ +/* $OpenBSD: rsa_pmeth.c,v 1.39 2023/07/08 12:26:45 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -877,4 +877,3 @@ const EVP_PKEY_METHOD rsa_pss_pkey_meth = { .ctrl = pkey_rsa_ctrl, .ctrl_str = pkey_rsa_ctrl_str }; - diff --git a/lib/libcrypto/rsa/rsa_prn.c b/lib/libcrypto/rsa/rsa_prn.c index 12f600d67..178356366 100644 --- a/lib/libcrypto/rsa/rsa_prn.c +++ b/lib/libcrypto/rsa/rsa_prn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_prn.c,v 1.9 2022/11/08 19:19:08 tobhe Exp $ */ +/* $OpenBSD: rsa_prn.c,v 1.10 2023/07/08 12:26:45 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -77,6 +77,7 @@ RSA_print_fp(FILE *fp, const RSA *x, int off) BIO_free(b); return ret; } +LCRYPTO_ALIAS(RSA_print_fp); int RSA_print(BIO *bp, const RSA *x, int off) @@ -95,3 +96,4 @@ RSA_print(BIO *bp, const RSA *x, int off) EVP_PKEY_free(pk); return ret; } +LCRYPTO_ALIAS(RSA_print); diff --git a/lib/libcrypto/rsa/rsa_pss.c b/lib/libcrypto/rsa/rsa_pss.c index 72c79e3b0..0860409be 100644 --- a/lib/libcrypto/rsa/rsa_pss.c +++ b/lib/libcrypto/rsa/rsa_pss.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_pss.c,v 1.16 2022/11/26 16:08:54 tb Exp $ */ +/* $OpenBSD: rsa_pss.c,v 1.17 2023/07/08 12:26:45 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2005. */ @@ -77,6 +77,7 @@ RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash, const EVP_MD *Hash, { return RSA_verify_PKCS1_PSS_mgf1(rsa, mHash, Hash, NULL, EM, sLen); } +LCRYPTO_ALIAS(RSA_verify_PKCS1_PSS); int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, @@ -178,6 +179,7 @@ err: return ret; } +LCRYPTO_ALIAS(RSA_verify_PKCS1_PSS_mgf1); int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM, @@ -185,6 +187,7 @@ RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM, { return RSA_padding_add_PKCS1_PSS_mgf1(rsa, EM, mHash, Hash, NULL, sLen); } +LCRYPTO_ALIAS(RSA_padding_add_PKCS1_PSS); int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, @@ -282,3 +285,4 @@ err: return ret; } +LCRYPTO_ALIAS(RSA_padding_add_PKCS1_PSS_mgf1); diff --git a/lib/libcrypto/rsa/rsa_saos.c b/lib/libcrypto/rsa/rsa_saos.c index 93492ac50..07a4f5d65 100644 --- a/lib/libcrypto/rsa/rsa_saos.c +++ b/lib/libcrypto/rsa/rsa_saos.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_saos.c,v 1.24 2018/09/05 00:55:33 djm Exp $ */ +/* $OpenBSD: rsa_saos.c,v 1.25 2023/07/08 12:26:45 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -99,6 +99,7 @@ RSA_sign_ASN1_OCTET_STRING(int type, const unsigned char *m, unsigned int m_len, freezero(s, (unsigned int)j + 1); return ret; } +LCRYPTO_ALIAS(RSA_sign_ASN1_OCTET_STRING); int RSA_verify_ASN1_OCTET_STRING(int dtype, const unsigned char *m, @@ -139,3 +140,4 @@ err: freezero(s, (unsigned int)siglen); return ret; } +LCRYPTO_ALIAS(RSA_verify_ASN1_OCTET_STRING); diff --git a/lib/libcrypto/rsa/rsa_sign.c b/lib/libcrypto/rsa/rsa_sign.c index d517fcbcf..535676861 100644 --- a/lib/libcrypto/rsa/rsa_sign.c +++ b/lib/libcrypto/rsa/rsa_sign.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_sign.c,v 1.35 2022/11/26 16:08:54 tb Exp $ */ +/* $OpenBSD: rsa_sign.c,v 1.36 2023/07/08 12:26:45 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -166,6 +166,7 @@ RSA_sign(int type, const unsigned char *m, unsigned int m_len, freezero(tmps, (size_t)encoded_len); return (ret); } +LCRYPTO_ALIAS(RSA_sign); /* * int_rsa_verify verifies an RSA signature in `sigbuf' using `rsa'. It may be @@ -276,3 +277,4 @@ RSA_verify(int dtype, const unsigned char *m, unsigned int m_len, return int_rsa_verify(dtype, m, m_len, NULL, NULL, sigbuf, siglen, rsa); } +LCRYPTO_ALIAS(RSA_verify); diff --git a/lib/libcrypto/sha/sha.h b/lib/libcrypto/sha/sha.h index 87fdf8d18..e1de79f4f 100644 --- a/lib/libcrypto/sha/sha.h +++ b/lib/libcrypto/sha/sha.h @@ -1,25 +1,25 @@ -/* $OpenBSD: sha.h,v 1.21 2015/09/13 21:09:56 doug Exp $ */ +/* $OpenBSD: sha.h,v 1.22 2023/07/08 07:08:11 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -89,21 +89,20 @@ extern "C" { #define SHA_LAST_BLOCK (SHA_CBLOCK-8) #define SHA_DIGEST_LENGTH 20 -typedef struct SHAstate_st - { - SHA_LONG h0,h1,h2,h3,h4; - SHA_LONG Nl,Nh; +typedef struct SHAstate_st { + SHA_LONG h0, h1, h2, h3, h4; + SHA_LONG Nl, Nh; SHA_LONG data[SHA_LBLOCK]; unsigned int num; - } SHA_CTX; +} SHA_CTX; #ifndef OPENSSL_NO_SHA1 int SHA1_Init(SHA_CTX *c); int SHA1_Update(SHA_CTX *c, const void *data, size_t len) - __attribute__ ((__bounded__(__buffer__,2,3))); + __attribute__ ((__bounded__(__buffer__, 2, 3))); int SHA1_Final(unsigned char *md, SHA_CTX *c); unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md) - __attribute__ ((__bounded__(__buffer__,1,2))); + __attribute__ ((__bounded__(__buffer__, 1, 2))); void SHA1_Transform(SHA_CTX *c, const unsigned char *data); #endif @@ -113,27 +112,26 @@ void SHA1_Transform(SHA_CTX *c, const unsigned char *data); #define SHA224_DIGEST_LENGTH 28 #define SHA256_DIGEST_LENGTH 32 -typedef struct SHA256state_st - { +typedef struct SHA256state_st { SHA_LONG h[8]; - SHA_LONG Nl,Nh; + SHA_LONG Nl, Nh; SHA_LONG data[SHA_LBLOCK]; - unsigned int num,md_len; - } SHA256_CTX; + unsigned int num, md_len; +} SHA256_CTX; #ifndef OPENSSL_NO_SHA256 int SHA224_Init(SHA256_CTX *c); int SHA224_Update(SHA256_CTX *c, const void *data, size_t len) - __attribute__ ((__bounded__(__buffer__,2,3))); + __attribute__ ((__bounded__(__buffer__, 2, 3))); int SHA224_Final(unsigned char *md, SHA256_CTX *c); -unsigned char *SHA224(const unsigned char *d, size_t n,unsigned char *md) - __attribute__ ((__bounded__(__buffer__,1,2))); +unsigned char *SHA224(const unsigned char *d, size_t n, unsigned char *md) + __attribute__ ((__bounded__(__buffer__, 1, 2))); int SHA256_Init(SHA256_CTX *c); int SHA256_Update(SHA256_CTX *c, const void *data, size_t len) - __attribute__ ((__bounded__(__buffer__,2,3))); + __attribute__ ((__bounded__(__buffer__, 2, 3))); int SHA256_Final(unsigned char *md, SHA256_CTX *c); -unsigned char *SHA256(const unsigned char *d, size_t n,unsigned char *md) - __attribute__ ((__bounded__(__buffer__,1,2))); +unsigned char *SHA256(const unsigned char *d, size_t n, unsigned char *md) + __attribute__ ((__bounded__(__buffer__, 1, 2))); void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); #endif @@ -157,31 +155,30 @@ void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); #define U64(C) C##ULL #endif -typedef struct SHA512state_st - { +typedef struct SHA512state_st { SHA_LONG64 h[8]; - SHA_LONG64 Nl,Nh; + SHA_LONG64 Nl, Nh; union { SHA_LONG64 d[SHA_LBLOCK]; unsigned char p[SHA512_CBLOCK]; } u; - unsigned int num,md_len; - } SHA512_CTX; + unsigned int num, md_len; +} SHA512_CTX; #endif #ifndef OPENSSL_NO_SHA512 int SHA384_Init(SHA512_CTX *c); int SHA384_Update(SHA512_CTX *c, const void *data, size_t len) - __attribute__ ((__bounded__(__buffer__,2,3))); + __attribute__ ((__bounded__(__buffer__, 2, 3))); int SHA384_Final(unsigned char *md, SHA512_CTX *c); -unsigned char *SHA384(const unsigned char *d, size_t n,unsigned char *md) - __attribute__ ((__bounded__(__buffer__,1,2))); +unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md) + __attribute__ ((__bounded__(__buffer__, 1, 2))); int SHA512_Init(SHA512_CTX *c); int SHA512_Update(SHA512_CTX *c, const void *data, size_t len) - __attribute__ ((__bounded__(__buffer__,2,3))); + __attribute__ ((__bounded__(__buffer__, 2, 3))); int SHA512_Final(unsigned char *md, SHA512_CTX *c); -unsigned char *SHA512(const unsigned char *d, size_t n,unsigned char *md) - __attribute__ ((__bounded__(__buffer__,1,2))); +unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md) + __attribute__ ((__bounded__(__buffer__, 1, 2))); void SHA512_Transform(SHA512_CTX *c, const unsigned char *data); #endif diff --git a/lib/libcrypto/sha/sha1.c b/lib/libcrypto/sha/sha1.c index 25c87e9bc..6e35d797b 100644 --- a/lib/libcrypto/sha/sha1.c +++ b/lib/libcrypto/sha/sha1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sha1.c,v 1.5 2023/04/11 10:39:50 jsing Exp $ */ +/* $OpenBSD: sha1.c,v 1.11 2023/07/08 12:24:10 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -71,19 +71,7 @@ #define HASH_LONG SHA_LONG #define HASH_CTX SHA_CTX #define HASH_CBLOCK SHA_CBLOCK -#define HASH_MAKE_STRING(c, s) do { \ - unsigned long ll; \ - ll=(c)->h0; HOST_l2c(ll,(s)); \ - ll=(c)->h1; HOST_l2c(ll,(s)); \ - ll=(c)->h2; HOST_l2c(ll,(s)); \ - ll=(c)->h3; HOST_l2c(ll,(s)); \ - ll=(c)->h4; HOST_l2c(ll,(s)); \ - } while (0) -#define HASH_UPDATE SHA1_Update -#define HASH_TRANSFORM SHA1_Transform -#define HASH_FINAL SHA1_Final -#define HASH_INIT SHA1_Init #define HASH_BLOCK_DATA_ORDER sha1_block_data_order #define Xupdate(a, ix, ia, ib, ic, id) ( (a)=(ia^ib^ic^id), \ ix=(a)=ROTATE((a),1) \ @@ -94,22 +82,12 @@ static #endif void sha1_block_data_order(SHA_CTX *c, const void *p, size_t num); +#define HASH_NO_UPDATE +#define HASH_NO_TRANSFORM +#define HASH_NO_FINAL + #include "md32_common.h" -int -SHA1_Init(SHA_CTX *c) -{ - memset(c, 0, sizeof(*c)); - - c->h0 = 0x67452301UL; - c->h1 = 0xefcdab89UL; - c->h2 = 0x98badcfeUL; - c->h3 = 0x10325476UL; - c->h4 = 0xc3d2e1f0UL; - - return 1; -} - #define K_00_19 0x5a827999UL #define K_20_39 0x6ed9eba1UL #define K_40_59 0x8f1bbcdcUL @@ -127,7 +105,6 @@ SHA1_Init(SHA_CTX *c) #define F_40_59(b, c, d) (((b) & (c)) | (((b)|(c)) & (d))) #define F_60_79(b, c, d) F_20_39(b, c, d) -#ifndef OPENSSL_SMALL_FOOTPRINT #define BODY_00_15(i, a, b, c, d, e, f, xi) \ (f)=xi+(e)+K_00_19+ROTATE((a),5)+F_00_19((b),(c),(d)); \ @@ -353,90 +330,128 @@ sha1_block_data_order(SHA_CTX *c, const void *p, size_t num) } #endif -#else /* OPENSSL_SMALL_FOOTPRINT */ -#define BODY_00_15(xi) do { \ - T=E+K_00_19+F_00_19(B, C, D); \ - E=D, D=C, C=ROTATE(B,30), B=A; \ - A=ROTATE(A,5)+T+xi; } while(0) - -#define BODY_16_19(xa, xb, xc, xd) do { \ - Xupdate(T, xa, xa, xb, xc, xd); \ - T+=E+K_00_19+F_00_19(B, C, D); \ - E=D, D=C, C=ROTATE(B,30), B=A; \ - A=ROTATE(A,5)+T; } while(0) - -#define BODY_20_39(xa, xb, xc, xd) do { \ - Xupdate(T, xa, xa, xb, xc, xd); \ - T+=E+K_20_39+F_20_39(B, C, D); \ - E=D, D=C, C=ROTATE(B,30), B=A; \ - A=ROTATE(A,5)+T; } while(0) - -#define BODY_40_59(xa, xb, xc, xd) do { \ - Xupdate(T, xa, xa, xb, xc, xd); \ - T+=E+K_40_59+F_40_59(B, C, D); \ - E=D, D=C, C=ROTATE(B,30), B=A; \ - A=ROTATE(A,5)+T; } while(0) - -#define BODY_60_79(xa, xb, xc, xd) do { \ - Xupdate(T, xa, xa, xb, xc, xd); \ - T=E+K_60_79+F_60_79(B, C, D); \ - E=D, D=C, C=ROTATE(B,30), B=A; \ - A=ROTATE(A,5)+T+xa; } while(0) - -#if !defined(SHA1_ASM) -static void -sha1_block_data_order(SHA_CTX *c, const void *p, size_t num) +int +SHA1_Init(SHA_CTX *c) { - const unsigned char *data = p; - unsigned MD32_REG_T A, B, C, D, E, T, l; - int i; - SHA_LONG X[16]; + memset(c, 0, sizeof(*c)); - A = c->h0; - B = c->h1; - C = c->h2; - D = c->h3; - E = c->h4; + c->h0 = 0x67452301UL; + c->h1 = 0xefcdab89UL; + c->h2 = 0x98badcfeUL; + c->h3 = 0x10325476UL; + c->h4 = 0xc3d2e1f0UL; - for (;;) { - for (i = 0; i < 16; i++) { - HOST_c2l(data, l); - X[i] = l; - BODY_00_15(X[i]); - } - for (i = 0; i < 4; i++) { - BODY_16_19(X[i], X[i + 2], X[i + 8], X[(i + 13)&15]); - } - for (; i < 24; i++) { - BODY_20_39(X[i&15], X[(i + 2)&15], X[(i + 8)&15], X[(i + 13)&15]); - } - for (i = 0; i < 20; i++) { - BODY_40_59(X[(i + 8)&15], X[(i + 10)&15], X[i&15], X[(i + 5)&15]); - } - for (i = 4; i < 24; i++) { - BODY_60_79(X[(i + 8)&15], X[(i + 10)&15], X[i&15], X[(i + 5)&15]); - } - - c->h0 = (c->h0 + A)&0xffffffffL; - c->h1 = (c->h1 + B)&0xffffffffL; - c->h2 = (c->h2 + C)&0xffffffffL; - c->h3 = (c->h3 + D)&0xffffffffL; - c->h4 = (c->h4 + E)&0xffffffffL; - - if (--num == 0) - break; - - A = c->h0; - B = c->h1; - C = c->h2; - D = c->h3; - E = c->h4; - - } + return 1; } +LCRYPTO_ALIAS(SHA1_Init); + +int +SHA1_Update(SHA_CTX *c, const void *data_, size_t len) +{ + const unsigned char *data = data_; + unsigned char *p; + SHA_LONG l; + size_t n; + + if (len == 0) + return 1; + + l = (c->Nl + (((SHA_LONG)len) << 3))&0xffffffffUL; + /* 95-05-24 eay Fixed a bug with the overflow handling, thanks to + * Wei Dai for pointing it out. */ + if (l < c->Nl) /* overflow */ + c->Nh++; + c->Nh+=(SHA_LONG)(len>>29); /* might cause compiler warning on 16-bit */ + c->Nl = l; + + n = c->num; + if (n != 0) { + p = (unsigned char *)c->data; + + if (len >= SHA_CBLOCK || len + n >= SHA_CBLOCK) { + memcpy(p + n, data, SHA_CBLOCK - n); + sha1_block_data_order(c, p, 1); + n = SHA_CBLOCK - n; + data += n; + len -= n; + c->num = 0; + memset(p,0,SHA_CBLOCK); /* keep it zeroed */ + } else { + memcpy(p + n, data, len); + c->num += (unsigned int)len; + return 1; + } + } + + n = len/SHA_CBLOCK; + if (n > 0) { + sha1_block_data_order(c, data, n); + n *= SHA_CBLOCK; + data += n; + len -= n; + } + + if (len != 0) { + p = (unsigned char *)c->data; + c->num = (unsigned int)len; + memcpy(p, data, len); + } + return 1; +} +LCRYPTO_ALIAS(SHA1_Update); + +void +SHA1_Transform(SHA_CTX *c, const unsigned char *data) +{ + sha1_block_data_order(c, data, 1); +} +LCRYPTO_ALIAS(SHA1_Transform); + +int +SHA1_Final(unsigned char *md, SHA_CTX *c) +{ + unsigned char *p = (unsigned char *)c->data; + unsigned long ll; + size_t n = c->num; + + p[n] = 0x80; /* there is always room for one */ + n++; + + if (n > (SHA_CBLOCK - 8)) { + memset(p + n, 0, SHA_CBLOCK - n); + n = 0; + sha1_block_data_order(c, p, 1); + } + memset(p + n, 0, SHA_CBLOCK - 8 - n); + + p += SHA_CBLOCK - 8; +#if defined(DATA_ORDER_IS_BIG_ENDIAN) + HOST_l2c(c->Nh, p); + HOST_l2c(c->Nl, p); +#elif defined(DATA_ORDER_IS_LITTLE_ENDIAN) + HOST_l2c(c->Nl, p); + HOST_l2c(c->Nh, p); #endif -#endif + p -= SHA_CBLOCK; + sha1_block_data_order(c, p, 1); + c->num = 0; + memset(p, 0, SHA_CBLOCK); + + ll = c->h0; + HOST_l2c(ll, md); + ll = c->h1; + HOST_l2c(ll, md); + ll = c->h2; + HOST_l2c(ll, md); + ll = c->h3; + HOST_l2c(ll, md); + ll = c->h4; + HOST_l2c(ll, md); + + return 1; +} +LCRYPTO_ALIAS(SHA1_Final); unsigned char * SHA1(const unsigned char *d, size_t n, unsigned char *md) @@ -456,5 +471,6 @@ SHA1(const unsigned char *d, size_t n, unsigned char *md) return (md); } +LCRYPTO_ALIAS(SHA1); #endif diff --git a/lib/libcrypto/sha/sha256.c b/lib/libcrypto/sha/sha256.c index 8432f5fce..0d0c4231e 100644 --- a/lib/libcrypto/sha/sha256.c +++ b/lib/libcrypto/sha/sha256.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sha256.c,v 1.22 2023/05/28 14:54:37 jsing Exp $ */ +/* $OpenBSD: sha256.c,v 1.27 2023/07/08 12:24:10 beck Exp $ */ /* ==================================================================== * Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. * @@ -61,8 +61,13 @@ #include #include +#include "crypto_internal.h" + #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA256) +/* Ensure that SHA_LONG and uint32_t are equivalent. */ +CTASSERT(sizeof(SHA_LONG) == sizeof(uint32_t)); + #define DATA_ORDER_IS_BIG_ENDIAN #define HASH_LONG SHA_LONG @@ -71,10 +76,9 @@ #define HASH_BLOCK_DATA_ORDER sha256_block_data_order -#ifndef SHA256_ASM -static +#ifdef SHA256_ASM +void sha256_block_data_order(SHA256_CTX *ctx, const void *_in, size_t num); #endif -void sha256_block_data_order(SHA256_CTX *ctx, const void *in, size_t num); #define HASH_NO_UPDATE #define HASH_NO_TRANSFORM @@ -115,95 +119,27 @@ static const SHA_LONG K256[64] = { #define Ch(x, y, z) (((x) & (y)) ^ ((~(x)) & (z))) #define Maj(x, y, z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) -#ifdef OPENSSL_SMALL_FOOTPRINT - -static void -sha256_block_data_order(SHA256_CTX *ctx, const void *in, size_t num) -{ - unsigned MD32_REG_T a, b, c, d, e, f, g, h, s0, s1, T1, T2; - SHA_LONG X[16], l; - int i; - const unsigned char *data = in; - - while (num--) { - - a = ctx->h[0]; - b = ctx->h[1]; - c = ctx->h[2]; - d = ctx->h[3]; - e = ctx->h[4]; - f = ctx->h[5]; - g = ctx->h[6]; - h = ctx->h[7]; - - for (i = 0; i < 16; i++) { - HOST_c2l(data, l); - T1 = X[i] = l; - T1 += h + Sigma1(e) + Ch(e, f, g) + K256[i]; - T2 = Sigma0(a) + Maj(a, b, c); - h = g; - g = f; - f = e; - e = d + T1; - d = c; - c = b; - b = a; - a = T1 + T2; - } - - for (; i < 64; i++) { - s0 = X[(i + 1)&0x0f]; - s0 = sigma0(s0); - s1 = X[(i + 14)&0x0f]; - s1 = sigma1(s1); - - T1 = X[i&0xf] += s0 + s1 + X[(i + 9)&0xf]; - T1 += h + Sigma1(e) + Ch(e, f, g) + K256[i]; - T2 = Sigma0(a) + Maj(a, b, c); - h = g; - g = f; - f = e; - e = d + T1; - d = c; - c = b; - b = a; - a = T1 + T2; - } - - ctx->h[0] += a; - ctx->h[1] += b; - ctx->h[2] += c; - ctx->h[3] += d; - ctx->h[4] += e; - ctx->h[5] += f; - ctx->h[6] += g; - ctx->h[7] += h; - } -} - -#else - -#define ROUND_00_15(i, a, b, c, d, e, f, g, h) do { \ - T1 += h + Sigma1(e) + Ch(e, f, g) + K256[i]; \ - h = Sigma0(a) + Maj(a, b, c); \ +#define ROUND_00_15(x, i, a, b, c, d, e, f, g, h) do { \ + T1 = x + h + Sigma1(e) + Ch(e, f, g) + K256[i]; \ + h = Sigma0(a) + Maj(a, b, c); \ d += T1; h += T1; } while (0) #define ROUND_16_63(i, a, b, c, d, e, f, g, h, X) do { \ - s0 = X[(i+1)&0x0f]; s0 = sigma0(s0); \ - s1 = X[(i+14)&0x0f]; s1 = sigma1(s1); \ - T1 = X[(i)&0x0f] += s0 + s1 + X[(i+9)&0x0f]; \ - ROUND_00_15(i, a, b, c, d, e, f, g, h); } while (0) + s0 = X[(i+1)&0x0f]; s0 = sigma0(s0); \ + s1 = X[(i+14)&0x0f]; s1 = sigma1(s1); \ + T1 = X[(i)&0x0f] += s0 + s1 + X[(i+9)&0x0f]; \ + ROUND_00_15(T1, i, a, b, c, d, e, f, g, h); } while (0) static void -sha256_block_data_order(SHA256_CTX *ctx, const void *in, size_t num) +sha256_block_data_order(SHA256_CTX *ctx, const void *_in, size_t num) { + const uint8_t *in = _in; + const SHA_LONG *in32; unsigned MD32_REG_T a, b, c, d, e, f, g, h, s0, s1, T1; SHA_LONG X[16]; int i; - const unsigned char *data = in; while (num--) { - a = ctx->h[0]; b = ctx->h[1]; c = ctx->h[2]; @@ -213,96 +149,63 @@ sha256_block_data_order(SHA256_CTX *ctx, const void *in, size_t num) g = ctx->h[6]; h = ctx->h[7]; - if (BYTE_ORDER != LITTLE_ENDIAN && - sizeof(SHA_LONG) == 4 && ((size_t)in % 4) == 0) { - const SHA_LONG *W = (const SHA_LONG *)data; - - T1 = X[0] = W[0]; - ROUND_00_15(0, a, b, c, d, e, f, g, h); - T1 = X[1] = W[1]; - ROUND_00_15(1, h, a, b, c, d, e, f, g); - T1 = X[2] = W[2]; - ROUND_00_15(2, g, h, a, b, c, d, e, f); - T1 = X[3] = W[3]; - ROUND_00_15(3, f, g, h, a, b, c, d, e); - T1 = X[4] = W[4]; - ROUND_00_15(4, e, f, g, h, a, b, c, d); - T1 = X[5] = W[5]; - ROUND_00_15(5, d, e, f, g, h, a, b, c); - T1 = X[6] = W[6]; - ROUND_00_15(6, c, d, e, f, g, h, a, b); - T1 = X[7] = W[7]; - ROUND_00_15(7, b, c, d, e, f, g, h, a); - T1 = X[8] = W[8]; - ROUND_00_15(8, a, b, c, d, e, f, g, h); - T1 = X[9] = W[9]; - ROUND_00_15(9, h, a, b, c, d, e, f, g); - T1 = X[10] = W[10]; - ROUND_00_15(10, g, h, a, b, c, d, e, f); - T1 = X[11] = W[11]; - ROUND_00_15(11, f, g, h, a, b, c, d, e); - T1 = X[12] = W[12]; - ROUND_00_15(12, e, f, g, h, a, b, c, d); - T1 = X[13] = W[13]; - ROUND_00_15(13, d, e, f, g, h, a, b, c); - T1 = X[14] = W[14]; - ROUND_00_15(14, c, d, e, f, g, h, a, b); - T1 = X[15] = W[15]; - ROUND_00_15(15, b, c, d, e, f, g, h, a); - - data += SHA256_CBLOCK; + if ((size_t)in % 4 == 0) { + /* Input is 32 bit aligned. */ + in32 = (const SHA_LONG *)in; + X[0] = be32toh(in32[0]); + X[1] = be32toh(in32[1]); + X[2] = be32toh(in32[2]); + X[3] = be32toh(in32[3]); + X[4] = be32toh(in32[4]); + X[5] = be32toh(in32[5]); + X[6] = be32toh(in32[6]); + X[7] = be32toh(in32[7]); + X[8] = be32toh(in32[8]); + X[9] = be32toh(in32[9]); + X[10] = be32toh(in32[10]); + X[11] = be32toh(in32[11]); + X[12] = be32toh(in32[12]); + X[13] = be32toh(in32[13]); + X[14] = be32toh(in32[14]); + X[15] = be32toh(in32[15]); } else { - SHA_LONG l; - - HOST_c2l(data, l); - T1 = X[0] = l; - ROUND_00_15(0, a, b, c, d, e, f, g, h); - HOST_c2l(data, l); - T1 = X[1] = l; - ROUND_00_15(1, h, a, b, c, d, e, f, g); - HOST_c2l(data, l); - T1 = X[2] = l; - ROUND_00_15(2, g, h, a, b, c, d, e, f); - HOST_c2l(data, l); - T1 = X[3] = l; - ROUND_00_15(3, f, g, h, a, b, c, d, e); - HOST_c2l(data, l); - T1 = X[4] = l; - ROUND_00_15(4, e, f, g, h, a, b, c, d); - HOST_c2l(data, l); - T1 = X[5] = l; - ROUND_00_15(5, d, e, f, g, h, a, b, c); - HOST_c2l(data, l); - T1 = X[6] = l; - ROUND_00_15(6, c, d, e, f, g, h, a, b); - HOST_c2l(data, l); - T1 = X[7] = l; - ROUND_00_15(7, b, c, d, e, f, g, h, a); - HOST_c2l(data, l); - T1 = X[8] = l; - ROUND_00_15(8, a, b, c, d, e, f, g, h); - HOST_c2l(data, l); - T1 = X[9] = l; - ROUND_00_15(9, h, a, b, c, d, e, f, g); - HOST_c2l(data, l); - T1 = X[10] = l; - ROUND_00_15(10, g, h, a, b, c, d, e, f); - HOST_c2l(data, l); - T1 = X[11] = l; - ROUND_00_15(11, f, g, h, a, b, c, d, e); - HOST_c2l(data, l); - T1 = X[12] = l; - ROUND_00_15(12, e, f, g, h, a, b, c, d); - HOST_c2l(data, l); - T1 = X[13] = l; - ROUND_00_15(13, d, e, f, g, h, a, b, c); - HOST_c2l(data, l); - T1 = X[14] = l; - ROUND_00_15(14, c, d, e, f, g, h, a, b); - HOST_c2l(data, l); - T1 = X[15] = l; - ROUND_00_15(15, b, c, d, e, f, g, h, a); + /* Input is not 32 bit aligned. */ + X[0] = crypto_load_be32toh(&in[0 * 4]); + X[1] = crypto_load_be32toh(&in[1 * 4]); + X[2] = crypto_load_be32toh(&in[2 * 4]); + X[3] = crypto_load_be32toh(&in[3 * 4]); + X[4] = crypto_load_be32toh(&in[4 * 4]); + X[5] = crypto_load_be32toh(&in[5 * 4]); + X[6] = crypto_load_be32toh(&in[6 * 4]); + X[7] = crypto_load_be32toh(&in[7 * 4]); + X[8] = crypto_load_be32toh(&in[8 * 4]); + X[9] = crypto_load_be32toh(&in[9 * 4]); + X[10] = crypto_load_be32toh(&in[10 * 4]); + X[11] = crypto_load_be32toh(&in[11 * 4]); + X[12] = crypto_load_be32toh(&in[12 * 4]); + X[13] = crypto_load_be32toh(&in[13 * 4]); + X[14] = crypto_load_be32toh(&in[14 * 4]); + X[15] = crypto_load_be32toh(&in[15 * 4]); } + in += SHA256_CBLOCK; + + ROUND_00_15(X[0], 0, a, b, c, d, e, f, g, h); + ROUND_00_15(X[1], 1, h, a, b, c, d, e, f, g); + ROUND_00_15(X[2], 2, g, h, a, b, c, d, e, f); + ROUND_00_15(X[3], 3, f, g, h, a, b, c, d, e); + ROUND_00_15(X[4], 4, e, f, g, h, a, b, c, d); + ROUND_00_15(X[5], 5, d, e, f, g, h, a, b, c); + ROUND_00_15(X[6], 6, c, d, e, f, g, h, a, b); + ROUND_00_15(X[7], 7, b, c, d, e, f, g, h, a); + + ROUND_00_15(X[8], 8, a, b, c, d, e, f, g, h); + ROUND_00_15(X[9], 9, h, a, b, c, d, e, f, g); + ROUND_00_15(X[10], 10, g, h, a, b, c, d, e, f); + ROUND_00_15(X[11], 11, f, g, h, a, b, c, d, e); + ROUND_00_15(X[12], 12, e, f, g, h, a, b, c, d); + ROUND_00_15(X[13], 13, d, e, f, g, h, a, b, c); + ROUND_00_15(X[14], 14, c, d, e, f, g, h, a, b); + ROUND_00_15(X[15], 15, b, c, d, e, f, g, h, a); for (i = 16; i < 64; i += 8) { ROUND_16_63(i + 0, a, b, c, d, e, f, g, h, X); @@ -325,8 +228,6 @@ sha256_block_data_order(SHA256_CTX *ctx, const void *in, size_t num) ctx->h[7] += h; } } - -#endif #endif /* SHA256_ASM */ int @@ -347,18 +248,21 @@ SHA224_Init(SHA256_CTX *c) return 1; } +LCRYPTO_ALIAS(SHA224_Init); int SHA224_Update(SHA256_CTX *c, const void *data, size_t len) { return SHA256_Update(c, data, len); } +LCRYPTO_ALIAS(SHA224_Update); int SHA224_Final(unsigned char *md, SHA256_CTX *c) { return SHA256_Final(md, c); } +LCRYPTO_ALIAS(SHA224_Final); unsigned char * SHA224(const unsigned char *d, size_t n, unsigned char *md) @@ -377,6 +281,7 @@ SHA224(const unsigned char *d, size_t n, unsigned char *md) return (md); } +LCRYPTO_ALIAS(SHA224); int SHA256_Init(SHA256_CTX *c) @@ -396,6 +301,7 @@ SHA256_Init(SHA256_CTX *c) return 1; } +LCRYPTO_ALIAS(SHA256_Init); int SHA256_Update(SHA256_CTX *c, const void *data_, size_t len) @@ -450,19 +356,20 @@ SHA256_Update(SHA256_CTX *c, const void *data_, size_t len) } return 1; } +LCRYPTO_ALIAS(SHA256_Update); void SHA256_Transform(SHA256_CTX *c, const unsigned char *data) { sha256_block_data_order(c, data, 1); } +LCRYPTO_ALIAS(SHA256_Transform); int SHA256_Final(unsigned char *md, SHA256_CTX *c) { unsigned char *p = (unsigned char *)c->data; size_t n = c->num; - unsigned long ll; unsigned int nn; p[n] = 0x80; /* there is always room for one */ @@ -473,17 +380,11 @@ SHA256_Final(unsigned char *md, SHA256_CTX *c) n = 0; sha256_block_data_order(c, p, 1); } - memset(p + n, 0, SHA_CBLOCK - 8 - n); - p += SHA_CBLOCK - 8; -#if defined(DATA_ORDER_IS_BIG_ENDIAN) - HOST_l2c(c->Nh, p); - HOST_l2c(c->Nl, p); -#elif defined(DATA_ORDER_IS_LITTLE_ENDIAN) - HOST_l2c(c->Nl, p); - HOST_l2c(c->Nh, p); -#endif - p -= SHA_CBLOCK; + memset(p + n, 0, SHA_CBLOCK - 8 - n); + c->data[SHA_LBLOCK - 2] = htobe32(c->Nh); + c->data[SHA_LBLOCK - 1] = htobe32(c->Nl); + sha256_block_data_order(c, p, 1); c->num = 0; memset(p, 0, SHA_CBLOCK); @@ -499,15 +400,15 @@ SHA256_Final(unsigned char *md, SHA256_CTX *c) switch (c->md_len) { case SHA224_DIGEST_LENGTH: for (nn = 0; nn < SHA224_DIGEST_LENGTH / 4; nn++) { - ll = c->h[nn]; - HOST_l2c(ll, md); + crypto_store_htobe32(md, c->h[nn]); + md += 4; } break; case SHA256_DIGEST_LENGTH: for (nn = 0; nn < SHA256_DIGEST_LENGTH / 4; nn++) { - ll = c->h[nn]; - HOST_l2c(ll, md); + crypto_store_htobe32(md, c->h[nn]); + md += 4; } break; @@ -515,14 +416,15 @@ SHA256_Final(unsigned char *md, SHA256_CTX *c) if (c->md_len > SHA256_DIGEST_LENGTH) return 0; for (nn = 0; nn < c->md_len / 4; nn++) { - ll = c->h[nn]; - HOST_l2c(ll, md); + crypto_store_htobe32(md, c->h[nn]); + md += 4; } break; } return 1; } +LCRYPTO_ALIAS(SHA256_Final); unsigned char * SHA256(const unsigned char *d, size_t n, unsigned char *md) @@ -541,5 +443,6 @@ SHA256(const unsigned char *d, size_t n, unsigned char *md) return (md); } +LCRYPTO_ALIAS(SHA256); #endif /* OPENSSL_NO_SHA256 */ diff --git a/lib/libcrypto/sha/sha512.c b/lib/libcrypto/sha/sha512.c index 6dc91cb0f..360a5c29f 100644 --- a/lib/libcrypto/sha/sha512.c +++ b/lib/libcrypto/sha/sha512.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sha512.c,v 1.40 2023/07/02 14:57:58 jsing Exp $ */ +/* $OpenBSD: sha512.c,v 1.41 2023/07/08 12:24:10 beck Exp $ */ /* ==================================================================== * Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. * @@ -325,18 +325,21 @@ SHA384_Init(SHA512_CTX *c) return 1; } +LCRYPTO_ALIAS(SHA384_Init); int SHA384_Update(SHA512_CTX *c, const void *data, size_t len) { return SHA512_Update(c, data, len); } +LCRYPTO_ALIAS(SHA384_Update); int SHA384_Final(unsigned char *md, SHA512_CTX *c) { return SHA512_Final(md, c); } +LCRYPTO_ALIAS(SHA384_Final); unsigned char * SHA384(const unsigned char *d, size_t n, unsigned char *md) @@ -355,6 +358,7 @@ SHA384(const unsigned char *d, size_t n, unsigned char *md) return (md); } +LCRYPTO_ALIAS(SHA384); int SHA512_Init(SHA512_CTX *c) @@ -374,12 +378,14 @@ SHA512_Init(SHA512_CTX *c) return 1; } +LCRYPTO_ALIAS(SHA512_Init); void SHA512_Transform(SHA512_CTX *c, const unsigned char *data) { sha512_block_data_order(c, data, 1); } +LCRYPTO_ALIAS(SHA512_Transform); int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len) @@ -428,6 +434,7 @@ SHA512_Update(SHA512_CTX *c, const void *_data, size_t len) return 1; } +LCRYPTO_ALIAS(SHA512_Update); int SHA512_Final(unsigned char *md, SHA512_CTX *c) @@ -485,6 +492,7 @@ SHA512_Final(unsigned char *md, SHA512_CTX *c) return 1; } +LCRYPTO_ALIAS(SHA512_Final); unsigned char * SHA512(const unsigned char *d, size_t n, unsigned char *md) @@ -503,6 +511,7 @@ SHA512(const unsigned char *d, size_t n, unsigned char *md) return (md); } +LCRYPTO_ALIAS(SHA512); int SHA512_224_Init(SHA512_CTX *c) diff --git a/lib/libcrypto/sm3/sm3.c b/lib/libcrypto/sm3/sm3.c index 1a9614680..80be935f7 100644 --- a/lib/libcrypto/sm3/sm3.c +++ b/lib/libcrypto/sm3/sm3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sm3.c,v 1.2 2022/11/26 16:08:54 tb Exp $ */ +/* $OpenBSD: sm3.c,v 1.6 2023/07/08 06:36:55 jsing Exp $ */ /* * Copyright (c) 2018, Ribose Inc * @@ -19,7 +19,77 @@ #include -#include "sm3_local.h" +#include + +#include + +#define DATA_ORDER_IS_BIG_ENDIAN + +#define HASH_LONG SM3_WORD +#define HASH_CTX SM3_CTX +#define HASH_CBLOCK SM3_CBLOCK +#define HASH_UPDATE SM3_Update +#define HASH_TRANSFORM SM3_Transform +#define HASH_FINAL SM3_Final +#define HASH_MAKE_STRING(c, s) do { \ + unsigned long ll; \ + ll = (c)->A; HOST_l2c(ll, (s)); \ + ll = (c)->B; HOST_l2c(ll, (s)); \ + ll = (c)->C; HOST_l2c(ll, (s)); \ + ll = (c)->D; HOST_l2c(ll, (s)); \ + ll = (c)->E; HOST_l2c(ll, (s)); \ + ll = (c)->F; HOST_l2c(ll, (s)); \ + ll = (c)->G; HOST_l2c(ll, (s)); \ + ll = (c)->H; HOST_l2c(ll, (s)); \ +} while (0) +#define HASH_BLOCK_DATA_ORDER SM3_block_data_order + +void SM3_block_data_order(SM3_CTX *c, const void *p, size_t num); +void SM3_transform(SM3_CTX *c, const unsigned char *data); + +#include "md32_common.h" + +#define P0(X) (X ^ ROTATE(X, 9) ^ ROTATE(X, 17)) +#define P1(X) (X ^ ROTATE(X, 15) ^ ROTATE(X, 23)) + +#define FF0(X, Y, Z) (X ^ Y ^ Z) +#define GG0(X, Y, Z) (X ^ Y ^ Z) + +#define FF1(X, Y, Z) ((X & Y) | ((X | Y) & Z)) +#define GG1(X, Y, Z) ((Z ^ (X & (Y ^ Z)))) + +#define EXPAND(W0, W7, W13, W3, W10) \ + (P1(W0 ^ W7 ^ ROTATE(W13, 15)) ^ ROTATE(W3, 7) ^ W10) + +#define ROUND(A, B, C, D, E, F, G, H, TJ, Wi, Wj, FF, GG) do { \ + const SM3_WORD A12 = ROTATE(A, 12); \ + const SM3_WORD A12_SM = A12 + E + TJ; \ + const SM3_WORD SS1 = ROTATE(A12_SM, 7); \ + const SM3_WORD TT1 = FF(A, B, C) + D + (SS1 ^ A12) + (Wj); \ + const SM3_WORD TT2 = GG(E, F, G) + H + SS1 + Wi; \ + B = ROTATE(B, 9); \ + D = TT1; \ + F = ROTATE(F, 19); \ + H = P0(TT2); \ +} while(0) + +#define R1(A, B, C, D, E, F, G, H, TJ, Wi, Wj) \ + ROUND(A, B, C, D, E, F, G, H, TJ, Wi, Wj, FF0, GG0) + +#define R2(A, B, C, D, E, F, G, H, TJ, Wi, Wj) \ + ROUND(A, B, C, D, E, F, G, H, TJ, Wi, Wj, FF1, GG1) + +#define SM3_A 0x7380166fUL +#define SM3_B 0x4914b2b9UL +#define SM3_C 0x172442d7UL +#define SM3_D 0xda8a0600UL +#define SM3_E 0xa96f30bcUL +#define SM3_F 0x163138aaUL +#define SM3_G 0xe38dee4dUL +#define SM3_H 0xb0fb0e4eUL + +LCRYPTO_ALIAS(SM3_Update); +LCRYPTO_ALIAS(SM3_Final); int SM3_Init(SM3_CTX *c) @@ -35,6 +105,7 @@ SM3_Init(SM3_CTX *c) c->H = SM3_H; return 1; } +LCRYPTO_ALIAS(SM3_Init); void SM3_block_data_order(SM3_CTX *ctx, const void *p, size_t num) diff --git a/lib/libcrypto/sm3/sm3_local.h b/lib/libcrypto/sm3/sm3_local.h deleted file mode 100644 index a941e59c3..000000000 --- a/lib/libcrypto/sm3/sm3_local.h +++ /dev/null @@ -1,85 +0,0 @@ -/* $OpenBSD: sm3_local.h,v 1.1 2022/11/26 16:08:54 tb Exp $ */ -/* - * Copyright (c) 2018, Ribose Inc - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include - -#include - -#define DATA_ORDER_IS_BIG_ENDIAN - -#define HASH_LONG SM3_WORD -#define HASH_CTX SM3_CTX -#define HASH_CBLOCK SM3_CBLOCK -#define HASH_UPDATE SM3_Update -#define HASH_TRANSFORM SM3_Transform -#define HASH_FINAL SM3_Final -#define HASH_MAKE_STRING(c, s) do { \ - unsigned long ll; \ - ll = (c)->A; HOST_l2c(ll, (s)); \ - ll = (c)->B; HOST_l2c(ll, (s)); \ - ll = (c)->C; HOST_l2c(ll, (s)); \ - ll = (c)->D; HOST_l2c(ll, (s)); \ - ll = (c)->E; HOST_l2c(ll, (s)); \ - ll = (c)->F; HOST_l2c(ll, (s)); \ - ll = (c)->G; HOST_l2c(ll, (s)); \ - ll = (c)->H; HOST_l2c(ll, (s)); \ -} while (0) -#define HASH_BLOCK_DATA_ORDER SM3_block_data_order - -void SM3_block_data_order(SM3_CTX *c, const void *p, size_t num); -void SM3_transform(SM3_CTX *c, const unsigned char *data); - -#include "md32_common.h" - -#define P0(X) (X ^ ROTATE(X, 9) ^ ROTATE(X, 17)) -#define P1(X) (X ^ ROTATE(X, 15) ^ ROTATE(X, 23)) - -#define FF0(X, Y, Z) (X ^ Y ^ Z) -#define GG0(X, Y, Z) (X ^ Y ^ Z) - -#define FF1(X, Y, Z) ((X & Y) | ((X | Y) & Z)) -#define GG1(X, Y, Z) ((Z ^ (X & (Y ^ Z)))) - -#define EXPAND(W0, W7, W13, W3, W10) \ - (P1(W0 ^ W7 ^ ROTATE(W13, 15)) ^ ROTATE(W3, 7) ^ W10) - -#define ROUND(A, B, C, D, E, F, G, H, TJ, Wi, Wj, FF, GG) do { \ - const SM3_WORD A12 = ROTATE(A, 12); \ - const SM3_WORD A12_SM = A12 + E + TJ; \ - const SM3_WORD SS1 = ROTATE(A12_SM, 7); \ - const SM3_WORD TT1 = FF(A, B, C) + D + (SS1 ^ A12) + (Wj); \ - const SM3_WORD TT2 = GG(E, F, G) + H + SS1 + Wi; \ - B = ROTATE(B, 9); \ - D = TT1; \ - F = ROTATE(F, 19); \ - H = P0(TT2); \ -} while(0) - -#define R1(A, B, C, D, E, F, G, H, TJ, Wi, Wj) \ - ROUND(A, B, C, D, E, F, G, H, TJ, Wi, Wj, FF0, GG0) - -#define R2(A, B, C, D, E, F, G, H, TJ, Wi, Wj) \ - ROUND(A, B, C, D, E, F, G, H, TJ, Wi, Wj, FF1, GG1) - -#define SM3_A 0x7380166fUL -#define SM3_B 0x4914b2b9UL -#define SM3_C 0x172442d7UL -#define SM3_D 0xda8a0600UL -#define SM3_E 0xa96f30bcUL -#define SM3_F 0x163138aaUL -#define SM3_G 0xe38dee4dUL -#define SM3_H 0xb0fb0e4eUL diff --git a/lib/libcrypto/sm4/sm4.c b/lib/libcrypto/sm4/sm4.c index 009c780fb..bd1689987 100644 --- a/lib/libcrypto/sm4/sm4.c +++ b/lib/libcrypto/sm4/sm4.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sm4.c,v 1.1 2019/03/17 17:42:37 tb Exp $ */ +/* $OpenBSD: sm4.c,v 1.2 2023/07/07 12:01:32 beck Exp $ */ /* * Copyright (c) 2017, 2019 Ribose Inc * @@ -199,6 +199,7 @@ SM4_set_key(const uint8_t *key, SM4_KEY *k) return 1; } +LCRYPTO_ALIAS(SM4_set_key); #define SM4_ROUNDS(k0, k1, k2, k3, F) \ do { \ @@ -235,6 +236,7 @@ SM4_encrypt(const uint8_t *in, uint8_t *out, const SM4_KEY *k) store_u32_be(B1, out + 8); store_u32_be(B0, out + 12); } +LCRYPTO_ALIAS(SM4_encrypt); void SM4_decrypt(const uint8_t *in, uint8_t *out, const SM4_KEY *k) @@ -259,5 +261,6 @@ SM4_decrypt(const uint8_t *in, uint8_t *out, const SM4_KEY *k) store_u32_be(B1, out + 8); store_u32_be(B0, out + 12); } +LCRYPTO_ALIAS(SM4_decrypt); #endif /* OPENSSL_NO_SM4 */ diff --git a/lib/libcrypto/ts/ts_asn1.c b/lib/libcrypto/ts/ts_asn1.c index 6537f1c85..60ee0b81c 100644 --- a/lib/libcrypto/ts/ts_asn1.c +++ b/lib/libcrypto/ts/ts_asn1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ts_asn1.c,v 1.13 2022/07/24 08:16:47 tb Exp $ */ +/* $OpenBSD: ts_asn1.c,v 1.14 2023/07/07 07:25:21 beck Exp $ */ /* Written by Nils Larsch for the OpenSSL project 2004. */ /* ==================================================================== @@ -97,30 +97,35 @@ d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a, const unsigned char **in, long len) return (TS_MSG_IMPRINT *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &TS_MSG_IMPRINT_it); } +LCRYPTO_ALIAS(d2i_TS_MSG_IMPRINT); int i2d_TS_MSG_IMPRINT(const TS_MSG_IMPRINT *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &TS_MSG_IMPRINT_it); } +LCRYPTO_ALIAS(i2d_TS_MSG_IMPRINT); TS_MSG_IMPRINT * TS_MSG_IMPRINT_new(void) { return (TS_MSG_IMPRINT *)ASN1_item_new(&TS_MSG_IMPRINT_it); } +LCRYPTO_ALIAS(TS_MSG_IMPRINT_new); void TS_MSG_IMPRINT_free(TS_MSG_IMPRINT *a) { ASN1_item_free((ASN1_VALUE *)a, &TS_MSG_IMPRINT_it); } +LCRYPTO_ALIAS(TS_MSG_IMPRINT_free); TS_MSG_IMPRINT * TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *x) { return ASN1_item_dup(&TS_MSG_IMPRINT_it, x); } +LCRYPTO_ALIAS(TS_MSG_IMPRINT_dup); #ifndef OPENSSL_NO_BIO TS_MSG_IMPRINT * @@ -128,12 +133,14 @@ d2i_TS_MSG_IMPRINT_bio(BIO *bp, TS_MSG_IMPRINT **a) { return ASN1_item_d2i_bio(&TS_MSG_IMPRINT_it, bp, a); } +LCRYPTO_ALIAS(d2i_TS_MSG_IMPRINT_bio); int i2d_TS_MSG_IMPRINT_bio(BIO *bp, TS_MSG_IMPRINT *a) { return ASN1_item_i2d_bio(&TS_MSG_IMPRINT_it, bp, a); } +LCRYPTO_ALIAS(i2d_TS_MSG_IMPRINT_bio); #endif TS_MSG_IMPRINT * @@ -141,12 +148,14 @@ d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a) { return ASN1_item_d2i_fp(&TS_MSG_IMPRINT_it, fp, a); } +LCRYPTO_ALIAS(d2i_TS_MSG_IMPRINT_fp); int i2d_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT *a) { return ASN1_item_i2d_fp(&TS_MSG_IMPRINT_it, fp, a); } +LCRYPTO_ALIAS(i2d_TS_MSG_IMPRINT_fp); static const ASN1_TEMPLATE TS_REQ_seq_tt[] = { { @@ -210,30 +219,35 @@ d2i_TS_REQ(TS_REQ **a, const unsigned char **in, long len) return (TS_REQ *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &TS_REQ_it); } +LCRYPTO_ALIAS(d2i_TS_REQ); int i2d_TS_REQ(const TS_REQ *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &TS_REQ_it); } +LCRYPTO_ALIAS(i2d_TS_REQ); TS_REQ * TS_REQ_new(void) { return (TS_REQ *)ASN1_item_new(&TS_REQ_it); } +LCRYPTO_ALIAS(TS_REQ_new); void TS_REQ_free(TS_REQ *a) { ASN1_item_free((ASN1_VALUE *)a, &TS_REQ_it); } +LCRYPTO_ALIAS(TS_REQ_free); TS_REQ * TS_REQ_dup(TS_REQ *x) { return ASN1_item_dup(&TS_REQ_it, x); } +LCRYPTO_ALIAS(TS_REQ_dup); #ifndef OPENSSL_NO_BIO TS_REQ * @@ -241,12 +255,14 @@ d2i_TS_REQ_bio(BIO *bp, TS_REQ **a) { return ASN1_item_d2i_bio(&TS_REQ_it, bp, a); } +LCRYPTO_ALIAS(d2i_TS_REQ_bio); int i2d_TS_REQ_bio(BIO *bp, TS_REQ *a) { return ASN1_item_i2d_bio(&TS_REQ_it, bp, a); } +LCRYPTO_ALIAS(i2d_TS_REQ_bio); #endif TS_REQ * @@ -254,12 +270,14 @@ d2i_TS_REQ_fp(FILE *fp, TS_REQ **a) { return ASN1_item_d2i_fp(&TS_REQ_it, fp, a); } +LCRYPTO_ALIAS(d2i_TS_REQ_fp); int i2d_TS_REQ_fp(FILE *fp, TS_REQ *a) { return ASN1_item_i2d_fp(&TS_REQ_it, fp, a); } +LCRYPTO_ALIAS(i2d_TS_REQ_fp); static const ASN1_TEMPLATE TS_ACCURACY_seq_tt[] = { { @@ -302,30 +320,35 @@ d2i_TS_ACCURACY(TS_ACCURACY **a, const unsigned char **in, long len) return (TS_ACCURACY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &TS_ACCURACY_it); } +LCRYPTO_ALIAS(d2i_TS_ACCURACY); int i2d_TS_ACCURACY(const TS_ACCURACY *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &TS_ACCURACY_it); } +LCRYPTO_ALIAS(i2d_TS_ACCURACY); TS_ACCURACY * TS_ACCURACY_new(void) { return (TS_ACCURACY *)ASN1_item_new(&TS_ACCURACY_it); } +LCRYPTO_ALIAS(TS_ACCURACY_new); void TS_ACCURACY_free(TS_ACCURACY *a) { ASN1_item_free((ASN1_VALUE *)a, &TS_ACCURACY_it); } +LCRYPTO_ALIAS(TS_ACCURACY_free); TS_ACCURACY * TS_ACCURACY_dup(TS_ACCURACY *x) { return ASN1_item_dup(&TS_ACCURACY_it, x); } +LCRYPTO_ALIAS(TS_ACCURACY_dup); static const ASN1_TEMPLATE TS_TST_INFO_seq_tt[] = { { @@ -417,30 +440,35 @@ d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **in, long len) return (TS_TST_INFO *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &TS_TST_INFO_it); } +LCRYPTO_ALIAS(d2i_TS_TST_INFO); int i2d_TS_TST_INFO(const TS_TST_INFO *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &TS_TST_INFO_it); } +LCRYPTO_ALIAS(i2d_TS_TST_INFO); TS_TST_INFO * TS_TST_INFO_new(void) { return (TS_TST_INFO *)ASN1_item_new(&TS_TST_INFO_it); } +LCRYPTO_ALIAS(TS_TST_INFO_new); void TS_TST_INFO_free(TS_TST_INFO *a) { ASN1_item_free((ASN1_VALUE *)a, &TS_TST_INFO_it); } +LCRYPTO_ALIAS(TS_TST_INFO_free); TS_TST_INFO * TS_TST_INFO_dup(TS_TST_INFO *x) { return ASN1_item_dup(&TS_TST_INFO_it, x); } +LCRYPTO_ALIAS(TS_TST_INFO_dup); #ifndef OPENSSL_NO_BIO TS_TST_INFO * @@ -448,12 +476,14 @@ d2i_TS_TST_INFO_bio(BIO *bp, TS_TST_INFO **a) { return ASN1_item_d2i_bio(&TS_TST_INFO_it, bp, a); } +LCRYPTO_ALIAS(d2i_TS_TST_INFO_bio); int i2d_TS_TST_INFO_bio(BIO *bp, TS_TST_INFO *a) { return ASN1_item_i2d_bio(&TS_TST_INFO_it, bp, a); } +LCRYPTO_ALIAS(i2d_TS_TST_INFO_bio); #endif TS_TST_INFO * @@ -461,12 +491,14 @@ d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a) { return ASN1_item_d2i_fp(&TS_TST_INFO_it, fp, a); } +LCRYPTO_ALIAS(d2i_TS_TST_INFO_fp); int i2d_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO *a) { return ASN1_item_i2d_fp(&TS_TST_INFO_it, fp, a); } +LCRYPTO_ALIAS(i2d_TS_TST_INFO_fp); static const ASN1_TEMPLATE TS_STATUS_INFO_seq_tt[] = { { @@ -509,30 +541,35 @@ d2i_TS_STATUS_INFO(TS_STATUS_INFO **a, const unsigned char **in, long len) return (TS_STATUS_INFO *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &TS_STATUS_INFO_it); } +LCRYPTO_ALIAS(d2i_TS_STATUS_INFO); int i2d_TS_STATUS_INFO(const TS_STATUS_INFO *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &TS_STATUS_INFO_it); } +LCRYPTO_ALIAS(i2d_TS_STATUS_INFO); TS_STATUS_INFO * TS_STATUS_INFO_new(void) { return (TS_STATUS_INFO *)ASN1_item_new(&TS_STATUS_INFO_it); } +LCRYPTO_ALIAS(TS_STATUS_INFO_new); void TS_STATUS_INFO_free(TS_STATUS_INFO *a) { ASN1_item_free((ASN1_VALUE *)a, &TS_STATUS_INFO_it); } +LCRYPTO_ALIAS(TS_STATUS_INFO_free); TS_STATUS_INFO * TS_STATUS_INFO_dup(TS_STATUS_INFO *x) { return ASN1_item_dup(&TS_STATUS_INFO_it, x); } +LCRYPTO_ALIAS(TS_STATUS_INFO_dup); static int ts_resp_set_tst_info(TS_RESP *a) @@ -620,30 +657,35 @@ d2i_TS_RESP(TS_RESP **a, const unsigned char **in, long len) return (TS_RESP *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &TS_RESP_it); } +LCRYPTO_ALIAS(d2i_TS_RESP); int i2d_TS_RESP(const TS_RESP *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &TS_RESP_it); } +LCRYPTO_ALIAS(i2d_TS_RESP); TS_RESP * TS_RESP_new(void) { return (TS_RESP *)ASN1_item_new(&TS_RESP_it); } +LCRYPTO_ALIAS(TS_RESP_new); void TS_RESP_free(TS_RESP *a) { ASN1_item_free((ASN1_VALUE *)a, &TS_RESP_it); } +LCRYPTO_ALIAS(TS_RESP_free); TS_RESP * TS_RESP_dup(TS_RESP *x) { return ASN1_item_dup(&TS_RESP_it, x); } +LCRYPTO_ALIAS(TS_RESP_dup); #ifndef OPENSSL_NO_BIO TS_RESP * @@ -651,12 +693,14 @@ d2i_TS_RESP_bio(BIO *bp, TS_RESP **a) { return ASN1_item_d2i_bio(&TS_RESP_it, bp, a); } +LCRYPTO_ALIAS(d2i_TS_RESP_bio); int i2d_TS_RESP_bio(BIO *bp, TS_RESP *a) { return ASN1_item_i2d_bio(&TS_RESP_it, bp, a); } +LCRYPTO_ALIAS(i2d_TS_RESP_bio); #endif TS_RESP * @@ -664,12 +708,14 @@ d2i_TS_RESP_fp(FILE *fp, TS_RESP **a) { return ASN1_item_d2i_fp(&TS_RESP_it, fp, a); } +LCRYPTO_ALIAS(d2i_TS_RESP_fp); int i2d_TS_RESP_fp(FILE *fp, TS_RESP *a) { return ASN1_item_i2d_fp(&TS_RESP_it, fp, a); } +LCRYPTO_ALIAS(i2d_TS_RESP_fp); static const ASN1_TEMPLATE ESS_ISSUER_SERIAL_seq_tt[] = { { @@ -705,30 +751,35 @@ d2i_ESS_ISSUER_SERIAL(ESS_ISSUER_SERIAL **a, const unsigned char **in, long len) return (ESS_ISSUER_SERIAL *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &ESS_ISSUER_SERIAL_it); } +LCRYPTO_ALIAS(d2i_ESS_ISSUER_SERIAL); int i2d_ESS_ISSUER_SERIAL(const ESS_ISSUER_SERIAL *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &ESS_ISSUER_SERIAL_it); } +LCRYPTO_ALIAS(i2d_ESS_ISSUER_SERIAL); ESS_ISSUER_SERIAL * ESS_ISSUER_SERIAL_new(void) { return (ESS_ISSUER_SERIAL *)ASN1_item_new(&ESS_ISSUER_SERIAL_it); } +LCRYPTO_ALIAS(ESS_ISSUER_SERIAL_new); void ESS_ISSUER_SERIAL_free(ESS_ISSUER_SERIAL *a) { ASN1_item_free((ASN1_VALUE *)a, &ESS_ISSUER_SERIAL_it); } +LCRYPTO_ALIAS(ESS_ISSUER_SERIAL_free); ESS_ISSUER_SERIAL * ESS_ISSUER_SERIAL_dup(ESS_ISSUER_SERIAL *x) { return ASN1_item_dup(&ESS_ISSUER_SERIAL_it, x); } +LCRYPTO_ALIAS(ESS_ISSUER_SERIAL_dup); static const ASN1_TEMPLATE ESS_CERT_ID_seq_tt[] = { { @@ -764,30 +815,35 @@ d2i_ESS_CERT_ID(ESS_CERT_ID **a, const unsigned char **in, long len) return (ESS_CERT_ID *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &ESS_CERT_ID_it); } +LCRYPTO_ALIAS(d2i_ESS_CERT_ID); int i2d_ESS_CERT_ID(const ESS_CERT_ID *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &ESS_CERT_ID_it); } +LCRYPTO_ALIAS(i2d_ESS_CERT_ID); ESS_CERT_ID * ESS_CERT_ID_new(void) { return (ESS_CERT_ID *)ASN1_item_new(&ESS_CERT_ID_it); } +LCRYPTO_ALIAS(ESS_CERT_ID_new); void ESS_CERT_ID_free(ESS_CERT_ID *a) { ASN1_item_free((ASN1_VALUE *)a, &ESS_CERT_ID_it); } +LCRYPTO_ALIAS(ESS_CERT_ID_free); ESS_CERT_ID * ESS_CERT_ID_dup(ESS_CERT_ID *x) { return ASN1_item_dup(&ESS_CERT_ID_it, x); } +LCRYPTO_ALIAS(ESS_CERT_ID_dup); static const ASN1_TEMPLATE ESS_SIGNING_CERT_seq_tt[] = { { @@ -823,30 +879,35 @@ d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a, const unsigned char **in, long len) return (ESS_SIGNING_CERT *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &ESS_SIGNING_CERT_it); } +LCRYPTO_ALIAS(d2i_ESS_SIGNING_CERT); int i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &ESS_SIGNING_CERT_it); } +LCRYPTO_ALIAS(i2d_ESS_SIGNING_CERT); ESS_SIGNING_CERT * ESS_SIGNING_CERT_new(void) { return (ESS_SIGNING_CERT *)ASN1_item_new(&ESS_SIGNING_CERT_it); } +LCRYPTO_ALIAS(ESS_SIGNING_CERT_new); void ESS_SIGNING_CERT_free(ESS_SIGNING_CERT *a) { ASN1_item_free((ASN1_VALUE *)a, &ESS_SIGNING_CERT_it); } +LCRYPTO_ALIAS(ESS_SIGNING_CERT_free); ESS_SIGNING_CERT * ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *x) { return ASN1_item_dup(&ESS_SIGNING_CERT_it, x); } +LCRYPTO_ALIAS(ESS_SIGNING_CERT_dup); static const ASN1_TEMPLATE ESS_CERT_ID_V2_seq_tt[] = { { @@ -1013,3 +1074,4 @@ PKCS7_to_TS_TST_INFO(PKCS7 *token) p = tst_info_der->data; return d2i_TS_TST_INFO(NULL, &p, tst_info_der->length); } +LCRYPTO_ALIAS(PKCS7_to_TS_TST_INFO); diff --git a/lib/libcrypto/ts/ts_conf.c b/lib/libcrypto/ts/ts_conf.c index 41d185ee5..103d43027 100644 --- a/lib/libcrypto/ts/ts_conf.c +++ b/lib/libcrypto/ts/ts_conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ts_conf.c,v 1.11 2018/04/14 07:18:37 tb Exp $ */ +/* $OpenBSD: ts_conf.c,v 1.12 2023/07/07 07:25:21 beck Exp $ */ /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL * project 2002. */ @@ -110,6 +110,7 @@ end: BIO_free(cert); return x; } +LCRYPTO_ALIAS(TS_CONF_load_cert); STACK_OF(X509) * TS_CONF_load_certs(const char *file) @@ -144,6 +145,7 @@ end: BIO_free(certs); return othercerts; } +LCRYPTO_ALIAS(TS_CONF_load_certs); EVP_PKEY * TS_CONF_load_key(const char *file, const char *pass) @@ -161,6 +163,7 @@ end: BIO_free(key); return pkey; } +LCRYPTO_ALIAS(TS_CONF_load_key); /* Function definitions for handling configuration options. */ @@ -186,6 +189,7 @@ TS_CONF_get_tsa_section(CONF *conf, const char *section) } return section; } +LCRYPTO_ALIAS(TS_CONF_get_tsa_section); int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb, @@ -205,6 +209,7 @@ TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb, err: return ret; } +LCRYPTO_ALIAS(TS_CONF_set_serial); #ifndef OPENSSL_NO_ENGINE @@ -225,6 +230,7 @@ TS_CONF_set_crypto_device(CONF *conf, const char *section, const char *device) err: return ret; } +LCRYPTO_ALIAS(TS_CONF_set_crypto_device); int TS_CONF_set_default_engine(const char *name) @@ -251,6 +257,7 @@ err: ENGINE_free(e); return ret; } +LCRYPTO_ALIAS(TS_CONF_set_default_engine); #endif @@ -278,6 +285,7 @@ err: X509_free(cert_obj); return ret; } +LCRYPTO_ALIAS(TS_CONF_set_signer_cert); int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs, @@ -302,6 +310,7 @@ err: sk_X509_pop_free(certs_obj, X509_free); return ret; } +LCRYPTO_ALIAS(TS_CONF_set_certs); int TS_CONF_set_signer_key(CONF *conf, const char *section, const char *key, @@ -327,6 +336,7 @@ err: EVP_PKEY_free(key_obj); return ret; } +LCRYPTO_ALIAS(TS_CONF_set_signer_key); int TS_CONF_set_def_policy(CONF *conf, const char *section, const char *policy, @@ -354,6 +364,7 @@ err: ASN1_OBJECT_free(policy_obj); return ret; } +LCRYPTO_ALIAS(TS_CONF_set_def_policy); int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx) @@ -387,6 +398,7 @@ err: sk_CONF_VALUE_pop_free(list, X509V3_conf_free); return ret; } +LCRYPTO_ALIAS(TS_CONF_set_policies); int TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx) @@ -426,6 +438,7 @@ err: sk_CONF_VALUE_pop_free(list, X509V3_conf_free); return ret; } +LCRYPTO_ALIAS(TS_CONF_set_digests); int TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx) @@ -465,6 +478,7 @@ err: sk_CONF_VALUE_pop_free(list, X509V3_conf_free); return ret; } +LCRYPTO_ALIAS(TS_CONF_set_accuracy); int TS_CONF_set_clock_precision_digits(CONF *conf, const char *section, @@ -490,6 +504,7 @@ TS_CONF_set_clock_precision_digits(CONF *conf, const char *section, err: return ret; } +LCRYPTO_ALIAS(TS_CONF_set_clock_precision_digits); static int TS_CONF_add_flag(CONF *conf, const char *section, const char *field, int flag, @@ -515,12 +530,14 @@ TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx) { return TS_CONF_add_flag(conf, section, ENV_ORDERING, TS_ORDERING, ctx); } +LCRYPTO_ALIAS(TS_CONF_set_ordering); int TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx) { return TS_CONF_add_flag(conf, section, ENV_TSA_NAME, TS_TSA_NAME, ctx); } +LCRYPTO_ALIAS(TS_CONF_set_tsa_name); int TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section, TS_RESP_CTX *ctx) @@ -528,3 +545,4 @@ TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section, TS_RESP_CTX *ctx) return TS_CONF_add_flag(conf, section, ENV_ESS_CERT_ID_CHAIN, TS_ESS_CERT_ID_CHAIN, ctx); } +LCRYPTO_ALIAS(TS_CONF_set_ess_cert_id_chain); diff --git a/lib/libcrypto/ts/ts_err.c b/lib/libcrypto/ts/ts_err.c index ddd532a6a..bb8209a85 100644 --- a/lib/libcrypto/ts/ts_err.c +++ b/lib/libcrypto/ts/ts_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ts_err.c,v 1.6 2022/07/12 14:42:50 kn Exp $ */ +/* $OpenBSD: ts_err.c,v 1.7 2023/07/07 07:25:21 beck Exp $ */ /* ==================================================================== * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. * @@ -121,3 +121,4 @@ ERR_load_TS_strings(void) } #endif } +LCRYPTO_ALIAS(ERR_load_TS_strings); diff --git a/lib/libcrypto/ts/ts_lib.c b/lib/libcrypto/ts/ts_lib.c index ae715fb6c..1e94922aa 100644 --- a/lib/libcrypto/ts/ts_lib.c +++ b/lib/libcrypto/ts/ts_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ts_lib.c,v 1.13 2022/11/26 16:08:54 tb Exp $ */ +/* $OpenBSD: ts_lib.c,v 1.14 2023/07/07 07:25:21 beck Exp $ */ /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL * project 2002. */ @@ -89,6 +89,7 @@ TS_ASN1_INTEGER_print_bio(BIO *bio, const ASN1_INTEGER *num) return result; } +LCRYPTO_ALIAS(TS_ASN1_INTEGER_print_bio); int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj) @@ -102,6 +103,7 @@ TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj) BIO_write(bio, "\n", 1); return 1; } +LCRYPTO_ALIAS(TS_OBJ_print_bio); int TS_ext_print_bio(BIO *bio, const STACK_OF(X509_EXTENSION) *extensions) @@ -127,6 +129,7 @@ TS_ext_print_bio(BIO *bio, const STACK_OF(X509_EXTENSION) *extensions) return 1; } +LCRYPTO_ALIAS(TS_ext_print_bio); int TS_X509_ALGOR_print_bio(BIO *bio, const X509_ALGOR *alg) @@ -136,6 +139,7 @@ TS_X509_ALGOR_print_bio(BIO *bio, const X509_ALGOR *alg) return BIO_printf(bio, "Hash Algorithm: %s\n", (i == NID_undef) ? "UNKNOWN" : OBJ_nid2ln(i)); } +LCRYPTO_ALIAS(TS_X509_ALGOR_print_bio); int TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *a) @@ -151,3 +155,4 @@ TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *a) return 1; } +LCRYPTO_ALIAS(TS_MSG_IMPRINT_print_bio); diff --git a/lib/libcrypto/ts/ts_req_print.c b/lib/libcrypto/ts/ts_req_print.c index 64a8133a5..ddcdda97a 100644 --- a/lib/libcrypto/ts/ts_req_print.c +++ b/lib/libcrypto/ts/ts_req_print.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ts_req_print.c,v 1.4 2014/07/11 08:44:49 jsing Exp $ */ +/* $OpenBSD: ts_req_print.c,v 1.5 2023/07/07 07:25:21 beck Exp $ */ /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL * project 2002. */ @@ -102,3 +102,4 @@ TS_REQ_print_bio(BIO *bio, TS_REQ *a) return 1; } +LCRYPTO_ALIAS(TS_REQ_print_bio); diff --git a/lib/libcrypto/ts/ts_req_utils.c b/lib/libcrypto/ts/ts_req_utils.c index 8d9d6f3e6..d67941806 100644 --- a/lib/libcrypto/ts/ts_req_utils.c +++ b/lib/libcrypto/ts/ts_req_utils.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ts_req_utils.c,v 1.7 2022/07/24 08:16:47 tb Exp $ */ +/* $OpenBSD: ts_req_utils.c,v 1.9 2023/07/07 19:37:54 beck Exp $ */ /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL * project 2002. */ @@ -70,12 +70,14 @@ TS_REQ_set_version(TS_REQ *a, long version) { return ASN1_INTEGER_set(a->version, version); } +LCRYPTO_ALIAS(TS_REQ_set_version); long TS_REQ_get_version(const TS_REQ *a) { return ASN1_INTEGER_get(a->version); } +LCRYPTO_ALIAS(TS_REQ_get_version); int TS_REQ_set_msg_imprint(TS_REQ *a, TS_MSG_IMPRINT *msg_imprint) @@ -93,12 +95,14 @@ TS_REQ_set_msg_imprint(TS_REQ *a, TS_MSG_IMPRINT *msg_imprint) a->msg_imprint = new_msg_imprint; return 1; } +LCRYPTO_ALIAS(TS_REQ_set_msg_imprint); TS_MSG_IMPRINT * TS_REQ_get_msg_imprint(TS_REQ *a) { return a->msg_imprint; } +LCRYPTO_ALIAS(TS_REQ_get_msg_imprint); int TS_MSG_IMPRINT_set_algo(TS_MSG_IMPRINT *a, X509_ALGOR *alg) @@ -116,24 +120,28 @@ TS_MSG_IMPRINT_set_algo(TS_MSG_IMPRINT *a, X509_ALGOR *alg) a->hash_algo = new_alg; return 1; } +LCRYPTO_ALIAS(TS_MSG_IMPRINT_set_algo); X509_ALGOR * TS_MSG_IMPRINT_get_algo(TS_MSG_IMPRINT *a) { return a->hash_algo; } +LCRYPTO_ALIAS(TS_MSG_IMPRINT_get_algo); int TS_MSG_IMPRINT_set_msg(TS_MSG_IMPRINT *a, unsigned char *d, int len) { return ASN1_OCTET_STRING_set(a->hashed_msg, d, len); } +LCRYPTO_ALIAS(TS_MSG_IMPRINT_set_msg); ASN1_OCTET_STRING * TS_MSG_IMPRINT_get_msg(TS_MSG_IMPRINT *a) { return a->hashed_msg; } +LCRYPTO_ALIAS(TS_MSG_IMPRINT_get_msg); int TS_REQ_set_policy_id(TS_REQ *a, const ASN1_OBJECT *policy) @@ -151,12 +159,14 @@ TS_REQ_set_policy_id(TS_REQ *a, const ASN1_OBJECT *policy) a->policy_id = new_policy; return 1; } +LCRYPTO_ALIAS(TS_REQ_set_policy_id); ASN1_OBJECT * TS_REQ_get_policy_id(TS_REQ *a) { return a->policy_id; } +LCRYPTO_ALIAS(TS_REQ_get_policy_id); int TS_REQ_set_nonce(TS_REQ *a, const ASN1_INTEGER *nonce) @@ -174,12 +184,14 @@ TS_REQ_set_nonce(TS_REQ *a, const ASN1_INTEGER *nonce) a->nonce = new_nonce; return 1; } +LCRYPTO_ALIAS(TS_REQ_set_nonce); const ASN1_INTEGER * TS_REQ_get_nonce(const TS_REQ *a) { return a->nonce; } +LCRYPTO_ALIAS(TS_REQ_get_nonce); int TS_REQ_set_cert_req(TS_REQ *a, int cert_req) @@ -187,17 +199,20 @@ TS_REQ_set_cert_req(TS_REQ *a, int cert_req) a->cert_req = cert_req ? 0xFF : 0x00; return 1; } +LCRYPTO_ALIAS(TS_REQ_set_cert_req); int TS_REQ_get_cert_req(const TS_REQ *a) { return a->cert_req ? 1 : 0; } +LCRYPTO_ALIAS(TS_REQ_get_cert_req); STACK_OF(X509_EXTENSION) *TS_REQ_get_exts(TS_REQ *a) { return a->extensions; } +LCRYPTO_ALIAS(TS_REQ_get_exts); void TS_REQ_ext_free(TS_REQ *a) @@ -207,51 +222,60 @@ TS_REQ_ext_free(TS_REQ *a) sk_X509_EXTENSION_pop_free(a->extensions, X509_EXTENSION_free); a->extensions = NULL; } +LCRYPTO_ALIAS(TS_REQ_ext_free); int TS_REQ_get_ext_count(TS_REQ *a) { return X509v3_get_ext_count(a->extensions); } +LCRYPTO_ALIAS(TS_REQ_get_ext_count); int TS_REQ_get_ext_by_NID(TS_REQ *a, int nid, int lastpos) { return X509v3_get_ext_by_NID(a->extensions, nid, lastpos); } +LCRYPTO_ALIAS(TS_REQ_get_ext_by_NID); int TS_REQ_get_ext_by_OBJ(TS_REQ *a, const ASN1_OBJECT *obj, int lastpos) { return X509v3_get_ext_by_OBJ(a->extensions, obj, lastpos); } +LCRYPTO_ALIAS(TS_REQ_get_ext_by_OBJ); int TS_REQ_get_ext_by_critical(TS_REQ *a, int crit, int lastpos) { return X509v3_get_ext_by_critical(a->extensions, crit, lastpos); } +LCRYPTO_ALIAS(TS_REQ_get_ext_by_critical); X509_EXTENSION * TS_REQ_get_ext(TS_REQ *a, int loc) { return X509v3_get_ext(a->extensions, loc); } +LCRYPTO_ALIAS(TS_REQ_get_ext); X509_EXTENSION * TS_REQ_delete_ext(TS_REQ *a, int loc) { return X509v3_delete_ext(a->extensions, loc); } +LCRYPTO_ALIAS(TS_REQ_delete_ext); int TS_REQ_add_ext(TS_REQ *a, X509_EXTENSION *ex, int loc) { return X509v3_add_ext(&a->extensions, ex, loc) != NULL; } +LCRYPTO_ALIAS(TS_REQ_add_ext); void * TS_REQ_get_ext_d2i(TS_REQ *a, int nid, int *crit, int *idx) { return X509V3_get_d2i(a->extensions, nid, crit, idx); } +LCRYPTO_ALIAS(TS_REQ_get_ext_d2i); diff --git a/lib/libcrypto/ts/ts_rsp_print.c b/lib/libcrypto/ts/ts_rsp_print.c index cfff955cd..c65d22668 100644 --- a/lib/libcrypto/ts/ts_rsp_print.c +++ b/lib/libcrypto/ts/ts_rsp_print.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ts_rsp_print.c,v 1.6 2022/07/24 08:16:47 tb Exp $ */ +/* $OpenBSD: ts_rsp_print.c,v 1.7 2023/07/07 07:25:21 beck Exp $ */ /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL * project 2002. */ @@ -95,6 +95,7 @@ TS_RESP_print_bio(BIO *bio, TS_RESP *a) return 1; } +LCRYPTO_ALIAS(TS_RESP_print_bio); int TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a) @@ -177,6 +178,7 @@ TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a) return 1; } +LCRYPTO_ALIAS(TS_STATUS_INFO_print_bio); static int TS_status_map_print(BIO *bio, struct status_map_st *a, ASN1_BIT_STRING *v) @@ -275,6 +277,7 @@ TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a) return 1; } +LCRYPTO_ALIAS(TS_TST_INFO_print_bio); static int TS_ACCURACY_print_bio(BIO *bio, const TS_ACCURACY *accuracy) diff --git a/lib/libcrypto/ts/ts_rsp_sign.c b/lib/libcrypto/ts/ts_rsp_sign.c index 7ebadb104..84a699310 100644 --- a/lib/libcrypto/ts/ts_rsp_sign.c +++ b/lib/libcrypto/ts/ts_rsp_sign.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ts_rsp_sign.c,v 1.30 2022/11/26 16:08:54 tb Exp $ */ +/* $OpenBSD: ts_rsp_sign.c,v 1.31 2023/07/07 07:25:21 beck Exp $ */ /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL * project 2002. */ @@ -149,6 +149,7 @@ TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data) ctx->time_cb = cb; ctx->time_cb_data = data; } +LCRYPTO_ALIAS(TS_RESP_CTX_set_time_cb); /* TS_RESP_CTX management functions. */ @@ -169,6 +170,7 @@ TS_RESP_CTX_new(void) return ctx; } +LCRYPTO_ALIAS(TS_RESP_CTX_new); void TS_RESP_CTX_free(TS_RESP_CTX *ctx) @@ -187,6 +189,7 @@ TS_RESP_CTX_free(TS_RESP_CTX *ctx) ASN1_INTEGER_free(ctx->micros); free(ctx); } +LCRYPTO_ALIAS(TS_RESP_CTX_free); int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer) @@ -200,6 +203,7 @@ TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer) CRYPTO_add(&ctx->signer_cert->references, +1, CRYPTO_LOCK_X509); return 1; } +LCRYPTO_ALIAS(TS_RESP_CTX_set_signer_cert); int TS_RESP_CTX_set_signer_key(TS_RESP_CTX *ctx, EVP_PKEY *key) @@ -210,6 +214,7 @@ TS_RESP_CTX_set_signer_key(TS_RESP_CTX *ctx, EVP_PKEY *key) return 1; } +LCRYPTO_ALIAS(TS_RESP_CTX_set_signer_key); int TS_RESP_CTX_set_def_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *def_policy) @@ -224,6 +229,7 @@ err: TSerror(ERR_R_MALLOC_FAILURE); return 0; } +LCRYPTO_ALIAS(TS_RESP_CTX_set_def_policy); int TS_RESP_CTX_set_certs(TS_RESP_CTX *ctx, STACK_OF(X509) *certs) @@ -247,6 +253,7 @@ TS_RESP_CTX_set_certs(TS_RESP_CTX *ctx, STACK_OF(X509) *certs) return 1; } +LCRYPTO_ALIAS(TS_RESP_CTX_set_certs); int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *policy) @@ -268,6 +275,7 @@ err: ASN1_OBJECT_free(copy); return 0; } +LCRYPTO_ALIAS(TS_RESP_CTX_add_policy); int TS_RESP_CTX_add_md(TS_RESP_CTX *ctx, const EVP_MD *md) @@ -285,6 +293,7 @@ err: TSerror(ERR_R_MALLOC_FAILURE); return 0; } +LCRYPTO_ALIAS(TS_RESP_CTX_add_md); #define TS_RESP_CTX_accuracy_free(ctx) \ ASN1_INTEGER_free(ctx->seconds); \ @@ -315,12 +324,14 @@ err: TSerror(ERR_R_MALLOC_FAILURE); return 0; } +LCRYPTO_ALIAS(TS_RESP_CTX_set_accuracy); void TS_RESP_CTX_add_flags(TS_RESP_CTX *ctx, int flags) { ctx->flags |= flags; } +LCRYPTO_ALIAS(TS_RESP_CTX_add_flags); void TS_RESP_CTX_set_serial_cb(TS_RESP_CTX *ctx, TS_serial_cb cb, void *data) @@ -328,6 +339,7 @@ TS_RESP_CTX_set_serial_cb(TS_RESP_CTX *ctx, TS_serial_cb cb, void *data) ctx->serial_cb = cb; ctx->serial_cb_data = data; } +LCRYPTO_ALIAS(TS_RESP_CTX_set_serial_cb); void TS_RESP_CTX_set_extension_cb(TS_RESP_CTX *ctx, TS_extension_cb cb, void *data) @@ -335,6 +347,7 @@ TS_RESP_CTX_set_extension_cb(TS_RESP_CTX *ctx, TS_extension_cb cb, void *data) ctx->extension_cb = cb; ctx->extension_cb_data = data; } +LCRYPTO_ALIAS(TS_RESP_CTX_set_extension_cb); int TS_RESP_CTX_set_status_info(TS_RESP_CTX *ctx, int status, const char *text) @@ -368,6 +381,7 @@ err: ASN1_UTF8STRING_free(utf8_text); return ret; } +LCRYPTO_ALIAS(TS_RESP_CTX_set_status_info); int TS_RESP_CTX_set_status_info_cond(TS_RESP_CTX *ctx, int status, const char *text) @@ -381,6 +395,7 @@ TS_RESP_CTX_set_status_info_cond(TS_RESP_CTX *ctx, int status, const char *text) } return ret; } +LCRYPTO_ALIAS(TS_RESP_CTX_set_status_info_cond); int TS_RESP_CTX_add_failure_info(TS_RESP_CTX *ctx, int failure) @@ -397,18 +412,21 @@ err: TSerror(ERR_R_MALLOC_FAILURE); return 0; } +LCRYPTO_ALIAS(TS_RESP_CTX_add_failure_info); TS_REQ * TS_RESP_CTX_get_request(TS_RESP_CTX *ctx) { return ctx->request; } +LCRYPTO_ALIAS(TS_RESP_CTX_get_request); TS_TST_INFO * TS_RESP_CTX_get_tst_info(TS_RESP_CTX *ctx) { return ctx->tst_info; } +LCRYPTO_ALIAS(TS_RESP_CTX_get_tst_info); int TS_RESP_CTX_set_clock_precision_digits(TS_RESP_CTX *ctx, unsigned precision) @@ -418,6 +436,7 @@ TS_RESP_CTX_set_clock_precision_digits(TS_RESP_CTX *ctx, unsigned precision) ctx->clock_precision_digits = precision; return 1; } +LCRYPTO_ALIAS(TS_RESP_CTX_set_clock_precision_digits); /* Main entry method of the response generation. */ TS_RESP * @@ -488,6 +507,7 @@ end: TS_RESP_CTX_cleanup(ctx); return response; } +LCRYPTO_ALIAS(TS_RESP_create_response); /* Initializes the variable part of the context. */ static void diff --git a/lib/libcrypto/ts/ts_rsp_utils.c b/lib/libcrypto/ts/ts_rsp_utils.c index 2e37f26fd..34994adce 100644 --- a/lib/libcrypto/ts/ts_rsp_utils.c +++ b/lib/libcrypto/ts/ts_rsp_utils.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ts_rsp_utils.c,v 1.9 2022/07/24 19:25:36 tb Exp $ */ +/* $OpenBSD: ts_rsp_utils.c,v 1.11 2023/07/07 19:37:54 beck Exp $ */ /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL * project 2002. */ @@ -84,36 +84,42 @@ TS_RESP_set_status_info(TS_RESP *a, TS_STATUS_INFO *status_info) return 1; } +LCRYPTO_ALIAS(TS_RESP_set_status_info); TS_STATUS_INFO * TS_RESP_get_status_info(TS_RESP *a) { return a->status_info; } +LCRYPTO_ALIAS(TS_RESP_get_status_info); const ASN1_UTF8STRING * TS_STATUS_INFO_get0_failure_info(const TS_STATUS_INFO *si) { return si->failure_info; } +LCRYPTO_ALIAS(TS_STATUS_INFO_get0_failure_info); const STACK_OF(ASN1_UTF8STRING) * TS_STATUS_INFO_get0_text(const TS_STATUS_INFO *si) { return si->text; } +LCRYPTO_ALIAS(TS_STATUS_INFO_get0_text); const ASN1_INTEGER * TS_STATUS_INFO_get0_status(const TS_STATUS_INFO *si) { return si->status; } +LCRYPTO_ALIAS(TS_STATUS_INFO_get0_status); int TS_STATUS_INFO_set_status(TS_STATUS_INFO *si, int i) { return ASN1_INTEGER_set(si->status, i); } +LCRYPTO_ALIAS(TS_STATUS_INFO_set_status); /* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */ void @@ -125,30 +131,35 @@ TS_RESP_set_tst_info(TS_RESP *a, PKCS7 *p7, TS_TST_INFO *tst_info) TS_TST_INFO_free(a->tst_info); a->tst_info = tst_info; } +LCRYPTO_ALIAS(TS_RESP_set_tst_info); PKCS7 * TS_RESP_get_token(TS_RESP *a) { return a->token; } +LCRYPTO_ALIAS(TS_RESP_get_token); TS_TST_INFO * TS_RESP_get_tst_info(TS_RESP *a) { return a->tst_info; } +LCRYPTO_ALIAS(TS_RESP_get_tst_info); int TS_TST_INFO_set_version(TS_TST_INFO *a, long version) { return ASN1_INTEGER_set(a->version, version); } +LCRYPTO_ALIAS(TS_TST_INFO_set_version); long TS_TST_INFO_get_version(const TS_TST_INFO *a) { return ASN1_INTEGER_get(a->version); } +LCRYPTO_ALIAS(TS_TST_INFO_get_version); int TS_TST_INFO_set_policy_id(TS_TST_INFO *a, ASN1_OBJECT *policy) @@ -166,12 +177,14 @@ TS_TST_INFO_set_policy_id(TS_TST_INFO *a, ASN1_OBJECT *policy) a->policy_id = new_policy; return 1; } +LCRYPTO_ALIAS(TS_TST_INFO_set_policy_id); ASN1_OBJECT * TS_TST_INFO_get_policy_id(TS_TST_INFO *a) { return a->policy_id; } +LCRYPTO_ALIAS(TS_TST_INFO_get_policy_id); int TS_TST_INFO_set_msg_imprint(TS_TST_INFO *a, TS_MSG_IMPRINT *msg_imprint) @@ -189,12 +202,14 @@ TS_TST_INFO_set_msg_imprint(TS_TST_INFO *a, TS_MSG_IMPRINT *msg_imprint) a->msg_imprint = new_msg_imprint; return 1; } +LCRYPTO_ALIAS(TS_TST_INFO_set_msg_imprint); TS_MSG_IMPRINT * TS_TST_INFO_get_msg_imprint(TS_TST_INFO *a) { return a->msg_imprint; } +LCRYPTO_ALIAS(TS_TST_INFO_get_msg_imprint); int TS_TST_INFO_set_serial(TS_TST_INFO *a, const ASN1_INTEGER *serial) @@ -212,12 +227,14 @@ TS_TST_INFO_set_serial(TS_TST_INFO *a, const ASN1_INTEGER *serial) a->serial = new_serial; return 1; } +LCRYPTO_ALIAS(TS_TST_INFO_set_serial); const ASN1_INTEGER * TS_TST_INFO_get_serial(const TS_TST_INFO *a) { return a->serial; } +LCRYPTO_ALIAS(TS_TST_INFO_get_serial); int TS_TST_INFO_set_time(TS_TST_INFO *a, const ASN1_GENERALIZEDTIME *gtime) @@ -235,12 +252,14 @@ TS_TST_INFO_set_time(TS_TST_INFO *a, const ASN1_GENERALIZEDTIME *gtime) a->time = new_time; return 1; } +LCRYPTO_ALIAS(TS_TST_INFO_set_time); const ASN1_GENERALIZEDTIME * TS_TST_INFO_get_time(const TS_TST_INFO *a) { return a->time; } +LCRYPTO_ALIAS(TS_TST_INFO_get_time); int TS_TST_INFO_set_accuracy(TS_TST_INFO *a, TS_ACCURACY *accuracy) @@ -258,12 +277,14 @@ TS_TST_INFO_set_accuracy(TS_TST_INFO *a, TS_ACCURACY *accuracy) a->accuracy = new_accuracy; return 1; } +LCRYPTO_ALIAS(TS_TST_INFO_set_accuracy); TS_ACCURACY * TS_TST_INFO_get_accuracy(TS_TST_INFO *a) { return a->accuracy; } +LCRYPTO_ALIAS(TS_TST_INFO_get_accuracy); int TS_ACCURACY_set_seconds(TS_ACCURACY *a, const ASN1_INTEGER *seconds) @@ -281,12 +302,14 @@ TS_ACCURACY_set_seconds(TS_ACCURACY *a, const ASN1_INTEGER *seconds) a->seconds = new_seconds; return 1; } +LCRYPTO_ALIAS(TS_ACCURACY_set_seconds); const ASN1_INTEGER * TS_ACCURACY_get_seconds(const TS_ACCURACY *a) { return a->seconds; } +LCRYPTO_ALIAS(TS_ACCURACY_get_seconds); int TS_ACCURACY_set_millis(TS_ACCURACY *a, const ASN1_INTEGER *millis) @@ -306,12 +329,14 @@ TS_ACCURACY_set_millis(TS_ACCURACY *a, const ASN1_INTEGER *millis) a->millis = new_millis; return 1; } +LCRYPTO_ALIAS(TS_ACCURACY_set_millis); const ASN1_INTEGER * TS_ACCURACY_get_millis(const TS_ACCURACY *a) { return a->millis; } +LCRYPTO_ALIAS(TS_ACCURACY_get_millis); int TS_ACCURACY_set_micros(TS_ACCURACY *a, const ASN1_INTEGER *micros) @@ -331,12 +356,14 @@ TS_ACCURACY_set_micros(TS_ACCURACY *a, const ASN1_INTEGER *micros) a->micros = new_micros; return 1; } +LCRYPTO_ALIAS(TS_ACCURACY_set_micros); const ASN1_INTEGER * TS_ACCURACY_get_micros(const TS_ACCURACY *a) { return a->micros; } +LCRYPTO_ALIAS(TS_ACCURACY_get_micros); int TS_TST_INFO_set_ordering(TS_TST_INFO *a, int ordering) @@ -344,12 +371,14 @@ TS_TST_INFO_set_ordering(TS_TST_INFO *a, int ordering) a->ordering = ordering ? 0xFF : 0x00; return 1; } +LCRYPTO_ALIAS(TS_TST_INFO_set_ordering); int TS_TST_INFO_get_ordering(const TS_TST_INFO *a) { return a->ordering ? 1 : 0; } +LCRYPTO_ALIAS(TS_TST_INFO_get_ordering); int TS_TST_INFO_set_nonce(TS_TST_INFO *a, const ASN1_INTEGER *nonce) @@ -367,12 +396,14 @@ TS_TST_INFO_set_nonce(TS_TST_INFO *a, const ASN1_INTEGER *nonce) a->nonce = new_nonce; return 1; } +LCRYPTO_ALIAS(TS_TST_INFO_set_nonce); const ASN1_INTEGER * TS_TST_INFO_get_nonce(const TS_TST_INFO *a) { return a->nonce; } +LCRYPTO_ALIAS(TS_TST_INFO_get_nonce); int TS_TST_INFO_set_tsa(TS_TST_INFO *a, GENERAL_NAME *tsa) @@ -390,17 +421,20 @@ TS_TST_INFO_set_tsa(TS_TST_INFO *a, GENERAL_NAME *tsa) a->tsa = new_tsa; return 1; } +LCRYPTO_ALIAS(TS_TST_INFO_set_tsa); GENERAL_NAME * TS_TST_INFO_get_tsa(TS_TST_INFO *a) { return a->tsa; } +LCRYPTO_ALIAS(TS_TST_INFO_get_tsa); STACK_OF(X509_EXTENSION) *TS_TST_INFO_get_exts(TS_TST_INFO *a) { return a->extensions; } +LCRYPTO_ALIAS(TS_TST_INFO_get_exts); void TS_TST_INFO_ext_free(TS_TST_INFO *a) @@ -410,51 +444,60 @@ TS_TST_INFO_ext_free(TS_TST_INFO *a) sk_X509_EXTENSION_pop_free(a->extensions, X509_EXTENSION_free); a->extensions = NULL; } +LCRYPTO_ALIAS(TS_TST_INFO_ext_free); int TS_TST_INFO_get_ext_count(TS_TST_INFO *a) { return X509v3_get_ext_count(a->extensions); } +LCRYPTO_ALIAS(TS_TST_INFO_get_ext_count); int TS_TST_INFO_get_ext_by_NID(TS_TST_INFO *a, int nid, int lastpos) { return X509v3_get_ext_by_NID(a->extensions, nid, lastpos); } +LCRYPTO_ALIAS(TS_TST_INFO_get_ext_by_NID); int TS_TST_INFO_get_ext_by_OBJ(TS_TST_INFO *a, const ASN1_OBJECT *obj, int lastpos) { return X509v3_get_ext_by_OBJ(a->extensions, obj, lastpos); } +LCRYPTO_ALIAS(TS_TST_INFO_get_ext_by_OBJ); int TS_TST_INFO_get_ext_by_critical(TS_TST_INFO *a, int crit, int lastpos) { return X509v3_get_ext_by_critical(a->extensions, crit, lastpos); } +LCRYPTO_ALIAS(TS_TST_INFO_get_ext_by_critical); X509_EXTENSION * TS_TST_INFO_get_ext(TS_TST_INFO *a, int loc) { return X509v3_get_ext(a->extensions, loc); } +LCRYPTO_ALIAS(TS_TST_INFO_get_ext); X509_EXTENSION * TS_TST_INFO_delete_ext(TS_TST_INFO *a, int loc) { return X509v3_delete_ext(a->extensions, loc); } +LCRYPTO_ALIAS(TS_TST_INFO_delete_ext); int TS_TST_INFO_add_ext(TS_TST_INFO *a, X509_EXTENSION *ex, int loc) { return X509v3_add_ext(&a->extensions, ex, loc) != NULL; } +LCRYPTO_ALIAS(TS_TST_INFO_add_ext); void * TS_TST_INFO_get_ext_d2i(TS_TST_INFO *a, int nid, int *crit, int *idx) { return X509V3_get_d2i(a->extensions, nid, crit, idx); } +LCRYPTO_ALIAS(TS_TST_INFO_get_ext_d2i); diff --git a/lib/libcrypto/ts/ts_rsp_verify.c b/lib/libcrypto/ts/ts_rsp_verify.c index dc467d860..69236f68a 100644 --- a/lib/libcrypto/ts/ts_rsp_verify.c +++ b/lib/libcrypto/ts/ts_rsp_verify.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ts_rsp_verify.c,v 1.29 2022/11/26 16:08:54 tb Exp $ */ +/* $OpenBSD: ts_rsp_verify.c,v 1.30 2023/07/07 07:25:21 beck Exp $ */ /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL * project 2002. */ @@ -230,6 +230,7 @@ err: return ret; } +LCRYPTO_ALIAS(TS_RESP_verify_signature); /* * The certificate chain is returned in chain. Caller is responsible for @@ -485,6 +486,7 @@ TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response) err: return ret; } +LCRYPTO_ALIAS(TS_RESP_verify_response); /* * Tries to extract a TS_TST_INFO structure from the PKCS7 token and @@ -502,6 +504,7 @@ TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token) } return ret; } +LCRYPTO_ALIAS(TS_RESP_verify_token); /* * Verifies whether the 'token' contains a valid time stamp token diff --git a/lib/libcrypto/ts/ts_verify_ctx.c b/lib/libcrypto/ts/ts_verify_ctx.c index a7b90f9e4..5a2d95c68 100644 --- a/lib/libcrypto/ts/ts_verify_ctx.c +++ b/lib/libcrypto/ts/ts_verify_ctx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ts_verify_ctx.c,v 1.13 2023/04/25 17:52:54 tb Exp $ */ +/* $OpenBSD: ts_verify_ctx.c,v 1.14 2023/07/07 07:25:21 beck Exp $ */ /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL * project 2003. */ @@ -74,6 +74,7 @@ TS_VERIFY_CTX_new(void) return ctx; } +LCRYPTO_ALIAS(TS_VERIFY_CTX_new); void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx) @@ -84,6 +85,7 @@ TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx) TS_VERIFY_CTX_cleanup(ctx); free(ctx); } +LCRYPTO_ALIAS(TS_VERIFY_CTX_free); void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx) @@ -107,6 +109,7 @@ TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx) memset(ctx, 0, sizeof(*ctx)); } +LCRYPTO_ALIAS(TS_VERIFY_CTX_cleanup); /* * XXX: The following accessors demonstrate the amount of care and thought that @@ -127,6 +130,7 @@ TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int flags) return ctx->flags; } +LCRYPTO_ALIAS(TS_VERIFY_CTX_add_flags); int TS_VERIFY_CTX_set_flags(TS_VERIFY_CTX *ctx, int flags) @@ -135,6 +139,7 @@ TS_VERIFY_CTX_set_flags(TS_VERIFY_CTX *ctx, int flags) return ctx->flags; } +LCRYPTO_ALIAS(TS_VERIFY_CTX_set_flags); BIO * TS_VERIFY_CTX_set_data(TS_VERIFY_CTX *ctx, BIO *bio) @@ -143,6 +148,7 @@ TS_VERIFY_CTX_set_data(TS_VERIFY_CTX *ctx, BIO *bio) return ctx->data; } +LCRYPTO_ALIAS(TS_VERIFY_CTX_set_data); X509_STORE * TS_VERIFY_CTX_set_store(TS_VERIFY_CTX *ctx, X509_STORE *store) @@ -151,6 +157,7 @@ TS_VERIFY_CTX_set_store(TS_VERIFY_CTX *ctx, X509_STORE *store) return ctx->store; } +LCRYPTO_ALIAS(TS_VERIFY_CTX_set_store); STACK_OF(X509) * TS_VERIFY_CTX_set_certs(TS_VERIFY_CTX *ctx, STACK_OF(X509) *certs) @@ -159,6 +166,7 @@ TS_VERIFY_CTX_set_certs(TS_VERIFY_CTX *ctx, STACK_OF(X509) *certs) return ctx->certs; } +LCRYPTO_ALIAS(TS_VERIFY_CTX_set_certs); unsigned char * TS_VERIFY_CTX_set_imprint(TS_VERIFY_CTX *ctx, unsigned char *imprint, @@ -171,6 +179,7 @@ TS_VERIFY_CTX_set_imprint(TS_VERIFY_CTX *ctx, unsigned char *imprint, return ctx->imprint; } +LCRYPTO_ALIAS(TS_VERIFY_CTX_set_imprint); TS_VERIFY_CTX * TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx) @@ -224,3 +233,4 @@ err: TS_VERIFY_CTX_free(ret); return NULL; } +LCRYPTO_ALIAS(TS_REQ_to_TS_VERIFY_CTX); diff --git a/lib/libcrypto/txt_db/txt_db.c b/lib/libcrypto/txt_db/txt_db.c index 26df76a9c..7d1f82c49 100644 --- a/lib/libcrypto/txt_db/txt_db.c +++ b/lib/libcrypto/txt_db/txt_db.c @@ -1,4 +1,4 @@ -/* $OpenBSD: txt_db.c,v 1.18 2014/07/11 08:44:49 jsing Exp $ */ +/* $OpenBSD: txt_db.c,v 1.19 2023/07/08 11:28:03 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -184,6 +184,7 @@ err: } else return (ret); } +LCRYPTO_ALIAS(TXT_DB_read); OPENSSL_STRING * TXT_DB_get_by_index(TXT_DB *db, int idx, OPENSSL_STRING *value) @@ -204,6 +205,7 @@ TXT_DB_get_by_index(TXT_DB *db, int idx, OPENSSL_STRING *value) db->error = DB_ERROR_OK; return (ret); } +LCRYPTO_ALIAS(TXT_DB_get_by_index); int TXT_DB_create_index(TXT_DB *db, int field, int (*qual)(OPENSSL_STRING *), @@ -241,6 +243,7 @@ TXT_DB_create_index(TXT_DB *db, int field, int (*qual)(OPENSSL_STRING *), db->qual[field] = qual; return (1); } +LCRYPTO_ALIAS(TXT_DB_create_index); long TXT_DB_write(BIO *out, TXT_DB *db) @@ -291,6 +294,7 @@ err: BUF_MEM_free(buf); return (ret); } +LCRYPTO_ALIAS(TXT_DB_write); int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *row) @@ -329,6 +333,7 @@ TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *row) err: return (0); } +LCRYPTO_ALIAS(TXT_DB_insert); void TXT_DB_free(TXT_DB *db) @@ -370,3 +375,4 @@ TXT_DB_free(TXT_DB *db) } free(db); } +LCRYPTO_ALIAS(TXT_DB_free); diff --git a/lib/libradius/radius.c b/lib/libradius/radius.c index 3dd955952..f1a20cc5c 100644 --- a/lib/libradius/radius.c +++ b/lib/libradius/radius.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radius.c,v 1.3 2015/08/20 21:51:42 deraadt Exp $ */ +/* $OpenBSD: radius.c,v 1.4 2023/07/08 08:53:26 yasuoka Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -26,12 +26,11 @@ * SUCH DAMAGE. */ -#include #include -#include - #include -#include +#include + +#include #include #include #include diff --git a/lib/libradius/radius.h b/lib/libradius/radius.h index 98c5ee61f..1bfcd3d7d 100644 --- a/lib/libradius/radius.h +++ b/lib/libradius/radius.h @@ -1,4 +1,4 @@ -/* $OpenBSD: radius.h,v 1.1 2015/07/20 23:52:29 yasuoka Exp $ */ +/* $OpenBSD: radius.h,v 1.2 2023/07/08 08:53:26 yasuoka Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -313,11 +313,15 @@ #define RADIUS_TUNNEL_MEDIUM_TYPE_E163 7 /* E.163 (POTS) */ #define RADIUS_TUNNEL_MEDIUM_TYPE_E164 8 /* E.164 (SMDS, Frame * Relay, ATM) */ - - - +#include #include +#include +#include + +struct in_addr; +struct in6_addr; + __BEGIN_DECLS /******* packet manipulation support *******/ diff --git a/lib/libradius/radius_attr.c b/lib/libradius/radius_attr.c index e07985ed9..1a994700d 100644 --- a/lib/libradius/radius_attr.c +++ b/lib/libradius/radius_attr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radius_attr.c,v 1.1 2015/07/20 23:52:29 yasuoka Exp $ */ +/* $OpenBSD: radius_attr.c,v 1.2 2023/07/08 08:53:26 yasuoka Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -26,14 +26,13 @@ * SUCH DAMAGE. */ -#include -#include #include +#include -#include +#include #include +#include #include -#include #include #include "radius.h" diff --git a/lib/libradius/radius_eapmsk.c b/lib/libradius/radius_eapmsk.c index 0cb69ddae..95fe0f775 100644 --- a/lib/libradius/radius_eapmsk.c +++ b/lib/libradius/radius_eapmsk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radius_eapmsk.c,v 1.1 2015/07/20 23:52:29 yasuoka Exp $ */ +/* $OpenBSD: radius_eapmsk.c,v 1.2 2023/07/08 08:53:26 yasuoka Exp $ */ /*- * Copyright (c) 2013 Internet Initiative Japan Inc. @@ -26,17 +26,9 @@ * SUCH DAMAGE. */ -#include -#include -#include - -#include -#include -#include +#include #include -#include - #include "radius.h" #include "radius_local.h" diff --git a/lib/libradius/radius_userpass.c b/lib/libradius/radius_userpass.c index 08bbc3d1a..79c949821 100644 --- a/lib/libradius/radius_userpass.c +++ b/lib/libradius/radius_userpass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radius_userpass.c,v 1.1 2015/07/20 23:52:29 yasuoka Exp $ */ +/* $OpenBSD: radius_userpass.c,v 1.2 2023/07/08 08:53:26 yasuoka Exp $ */ /*- * Copyright (c) 2013 Internet Initiative Japan Inc. @@ -26,13 +26,7 @@ * SUCH DAMAGE. */ -#include -#include -#include - -#include #include -#include #include #include diff --git a/lib/libssl/bio_ssl.c b/lib/libssl/bio_ssl.c index 1a8cda84d..08e47dbfa 100644 --- a/lib/libssl/bio_ssl.c +++ b/lib/libssl/bio_ssl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bio_ssl.c,v 1.38 2023/02/16 08:38:17 tb Exp $ */ +/* $OpenBSD: bio_ssl.c,v 1.39 2023/07/08 16:40:13 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -120,6 +120,7 @@ ssl_new(BIO *bi) bi->flags = 0; return (1); } +LSSL_ALIAS(BIO_f_ssl); static int ssl_free(BIO *a) @@ -514,6 +515,7 @@ BIO_new_buffer_ssl_connect(SSL_CTX *ctx) BIO_free(ssl); return (NULL); } +LSSL_ALIAS(BIO_new_buffer_ssl_connect); BIO * BIO_new_ssl_connect(SSL_CTX *ctx) @@ -575,6 +577,7 @@ BIO_ssl_copy_session_id(BIO *t, BIO *f) return (0); return (1); } +LSSL_ALIAS(BIO_new_ssl_connect); void BIO_ssl_shutdown(BIO *b) @@ -590,3 +593,4 @@ BIO_ssl_shutdown(BIO *b) b = b->next_bio; } } +LSSL_ALIAS(BIO_ssl_shutdown); diff --git a/lib/libssl/d1_srtp.c b/lib/libssl/d1_srtp.c index 6073f0d2d..67c4495a1 100644 --- a/lib/libssl/d1_srtp.c +++ b/lib/libssl/d1_srtp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: d1_srtp.c,v 1.32 2022/11/26 16:08:55 tb Exp $ */ +/* $OpenBSD: d1_srtp.c,v 1.33 2023/07/08 16:40:13 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -229,12 +229,14 @@ SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles) { return ssl_ctx_make_profiles(profiles, &ctx->srtp_profiles); } +LSSL_ALIAS(SSL_CTX_set_tlsext_use_srtp); int SSL_set_tlsext_use_srtp(SSL *s, const char *profiles) { return ssl_ctx_make_profiles(profiles, &s->srtp_profiles); } +LSSL_ALIAS(SSL_set_tlsext_use_srtp); STACK_OF(SRTP_PROTECTION_PROFILE) * @@ -251,6 +253,7 @@ SSL_get_srtp_profiles(SSL *s) return NULL; } +LSSL_ALIAS(SSL_get_srtp_profiles); SRTP_PROTECTION_PROFILE * SSL_get_selected_srtp_profile(SSL *s) @@ -258,5 +261,6 @@ SSL_get_selected_srtp_profile(SSL *s) /* XXX cast away the const */ return (SRTP_PROTECTION_PROFILE *)s->srtp_profile; } +LSSL_ALIAS(SSL_get_selected_srtp_profile); #endif diff --git a/lib/libssl/hidden/openssl/srtp.h b/lib/libssl/hidden/openssl/srtp.h new file mode 100644 index 000000000..2440fc93d --- /dev/null +++ b/lib/libssl/hidden/openssl/srtp.h @@ -0,0 +1,33 @@ +/* $OpenBSD: srtp.h,v 1.1 2023/07/08 16:40:14 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBSSL_SRTP_H +#define _LIBSSL_SRTP_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/srtp.h" +#endif +#include "ssl_namespace.h" + +LSSL_USED(SSL_CTX_set_tlsext_use_srtp); +LSSL_USED(SSL_set_tlsext_use_srtp); +LSSL_USED(SSL_get_srtp_profiles); +LSSL_USED(SSL_get_selected_srtp_profile); + +#endif /* _LIBSSL_SRTP_H */ diff --git a/lib/libssl/hidden/openssl/ssl.h b/lib/libssl/hidden/openssl/ssl.h index 3bd2eed74..acc99fe13 100644 --- a/lib/libssl/hidden/openssl/ssl.h +++ b/lib/libssl/hidden/openssl/ssl.h @@ -1,6 +1,6 @@ -/* $OpenBSD: ssl.h,v 1.2 2023/07/05 21:14:54 bcook Exp $ */ +/* $OpenBSD: ssl.h,v 1.3 2023/07/08 16:40:14 beck Exp $ */ /* - * Copyright (c) 2022 Philip Guenther + * Copyright (c) 2023 Bob Beck * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,8 +15,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifndef _LIBSSL_SSL_H_ -#define _LIBSSL_SSL_H_ +#ifndef _LIBSSL_SSL_H +#define _LIBSSL_SSL_H #ifndef _MSC_VER #include_next @@ -25,11 +25,361 @@ #endif #include "ssl_namespace.h" +LSSL_USED(SSL_CTX_set_msg_callback); +LSSL_USED(SSL_set_msg_callback); +LSSL_USED(SSL_CTX_set_keylog_callback); +LSSL_USED(SSL_CTX_get_keylog_callback); +LSSL_USED(SSL_set_num_tickets); +LSSL_USED(SSL_get_num_tickets); +LSSL_USED(SSL_CTX_set_num_tickets); +LSSL_USED(SSL_CTX_get_num_tickets); +LSSL_USED(SSL_get0_verified_chain); +LSSL_USED(SSL_CTX_sessions); +LSSL_USED(SSL_CTX_sess_set_new_cb); +LSSL_USED(SSL_CTX_sess_get_new_cb); +LSSL_USED(SSL_CTX_sess_set_remove_cb); +LSSL_USED(SSL_CTX_sess_get_remove_cb); +LSSL_USED(SSL_CTX_sess_set_get_cb); +LSSL_USED(SSL_CTX_set_info_callback); +LSSL_USED(SSL_CTX_get_info_callback); +LSSL_USED(SSL_CTX_set_client_cert_cb); +LSSL_USED(SSL_CTX_get_client_cert_cb); +LSSL_USED(SSL_CTX_set_client_cert_engine); +LSSL_USED(SSL_CTX_set_cookie_generate_cb); +LSSL_USED(SSL_CTX_set_cookie_verify_cb); +LSSL_USED(SSL_CTX_set_next_protos_advertised_cb); +LSSL_USED(SSL_CTX_set_next_proto_select_cb); +LSSL_USED(SSL_select_next_proto); +LSSL_USED(SSL_get0_next_proto_negotiated); +LSSL_USED(SSL_CTX_set_alpn_protos); +LSSL_USED(SSL_set_alpn_protos); +LSSL_USED(SSL_CTX_set_alpn_select_cb); +LSSL_USED(SSL_get0_alpn_selected); +LSSL_USED(SSL_set_psk_use_session_callback); +LSSL_USED(SSL_get_finished); +LSSL_USED(SSL_get_peer_finished); +LSSL_USED(SSL_verify_client_post_handshake); +LSSL_USED(SSL_CTX_set_post_handshake_auth); +LSSL_USED(SSL_set_post_handshake_auth); +LSSL_USED(PEM_read_bio_SSL_SESSION); +LSSL_USED(PEM_read_SSL_SESSION); +LSSL_USED(PEM_write_bio_SSL_SESSION); +LSSL_USED(PEM_write_SSL_SESSION); +LSSL_USED(SSL_CTX_set0_chain); +LSSL_USED(SSL_CTX_set1_chain); +LSSL_USED(SSL_CTX_add0_chain_cert); +LSSL_USED(SSL_CTX_add1_chain_cert); +LSSL_USED(SSL_CTX_get0_chain_certs); +LSSL_USED(SSL_CTX_clear_chain_certs); +LSSL_USED(SSL_set0_chain); +LSSL_USED(SSL_set1_chain); +LSSL_USED(SSL_add0_chain_cert); +LSSL_USED(SSL_add1_chain_cert); +LSSL_USED(SSL_get0_chain_certs); +LSSL_USED(SSL_clear_chain_certs); +LSSL_USED(SSL_CTX_set1_groups); +LSSL_USED(SSL_CTX_set1_groups_list); +LSSL_USED(SSL_set1_groups); +LSSL_USED(SSL_set1_groups_list); +LSSL_USED(SSL_CTX_get_min_proto_version); +LSSL_USED(SSL_CTX_get_max_proto_version); +LSSL_USED(SSL_CTX_set_min_proto_version); +LSSL_USED(SSL_CTX_set_max_proto_version); +LSSL_USED(SSL_get_min_proto_version); +LSSL_USED(SSL_get_max_proto_version); +LSSL_USED(SSL_set_min_proto_version); +LSSL_USED(SSL_set_max_proto_version); +LSSL_USED(SSL_CTX_get_ssl_method); LSSL_USED(BIO_f_ssl); LSSL_USED(BIO_new_ssl); LSSL_USED(BIO_new_ssl_connect); -LSSL_UNUSED(BIO_new_buffer_ssl_connect); -LSSL_UNUSED(BIO_ssl_copy_session_id); -LSSL_UNUSED(BIO_ssl_shutdown); +LSSL_USED(BIO_new_buffer_ssl_connect); +LSSL_USED(BIO_ssl_copy_session_id); +LSSL_USED(BIO_ssl_shutdown); +LSSL_USED(SSL_CTX_get_ciphers); +LSSL_USED(SSL_CTX_set_cipher_list); +LSSL_USED(SSL_CTX_set_ciphersuites); +LSSL_USED(SSL_CTX_new); +LSSL_USED(SSL_CTX_free); +LSSL_USED(SSL_CTX_up_ref); +LSSL_USED(SSL_CTX_set_timeout); +LSSL_USED(SSL_CTX_get_timeout); +LSSL_USED(SSL_CTX_get_cert_store); +LSSL_USED(SSL_CTX_set_cert_store); +LSSL_USED(SSL_CTX_get0_certificate); +LSSL_USED(SSL_CTX_get0_privatekey); +LSSL_USED(SSL_want); +LSSL_USED(SSL_clear); +LSSL_USED(SSL_CTX_flush_sessions); +LSSL_USED(SSL_get_current_cipher); +LSSL_USED(SSL_CIPHER_get_by_id); +LSSL_USED(SSL_CIPHER_get_by_value); +LSSL_USED(SSL_CIPHER_get_bits); +LSSL_USED(SSL_CIPHER_get_version); +LSSL_USED(SSL_CIPHER_get_name); +LSSL_USED(SSL_CIPHER_get_id); +LSSL_USED(SSL_CIPHER_get_value); +LSSL_USED(SSL_CIPHER_find); +LSSL_USED(SSL_CIPHER_get_cipher_nid); +LSSL_USED(SSL_CIPHER_get_digest_nid); +LSSL_USED(SSL_CIPHER_get_kx_nid); +LSSL_USED(SSL_CIPHER_get_auth_nid); +LSSL_USED(SSL_CIPHER_is_aead); +LSSL_USED(SSL_get_fd); +LSSL_USED(SSL_get_rfd); +LSSL_USED(SSL_get_wfd); +LSSL_USED(SSL_get_cipher_list); +LSSL_USED(SSL_get_shared_ciphers); +LSSL_USED(SSL_get_read_ahead); +LSSL_USED(SSL_pending); +LSSL_USED(SSL_set_fd); +LSSL_USED(SSL_set_rfd); +LSSL_USED(SSL_set_wfd); +LSSL_USED(SSL_set_bio); +LSSL_USED(SSL_get_rbio); +LSSL_USED(SSL_set0_rbio); +LSSL_USED(SSL_get_wbio); +LSSL_USED(SSL_set_cipher_list); +LSSL_USED(SSL_set_ciphersuites); +LSSL_USED(SSL_set_read_ahead); +LSSL_USED(SSL_get_verify_mode); +LSSL_USED(SSL_get_verify_depth); +LSSL_USED(SSL_get_verify_callback); +LSSL_USED(SSL_set_verify); +LSSL_USED(SSL_set_verify_depth); +LSSL_USED(SSL_use_RSAPrivateKey); +LSSL_USED(SSL_use_RSAPrivateKey_ASN1); +LSSL_USED(SSL_use_PrivateKey); +LSSL_USED(SSL_use_PrivateKey_ASN1); +LSSL_USED(SSL_use_certificate); +LSSL_USED(SSL_use_certificate_ASN1); +LSSL_USED(SSL_use_RSAPrivateKey_file); +LSSL_USED(SSL_use_PrivateKey_file); +LSSL_USED(SSL_use_certificate_file); +LSSL_USED(SSL_use_certificate_chain_file); +LSSL_USED(SSL_CTX_use_RSAPrivateKey_file); +LSSL_USED(SSL_CTX_use_PrivateKey_file); +LSSL_USED(SSL_CTX_use_certificate_file); +LSSL_USED(SSL_CTX_use_certificate_chain_file); +LSSL_USED(SSL_CTX_use_certificate_chain_mem); +LSSL_USED(SSL_load_client_CA_file); +LSSL_USED(SSL_add_file_cert_subjects_to_stack); +LSSL_USED(SSL_add_dir_cert_subjects_to_stack); +LSSL_USED(SSL_load_error_strings); +LSSL_USED(SSL_state_string); +LSSL_USED(SSL_rstate_string); +LSSL_USED(SSL_state_string_long); +LSSL_USED(SSL_rstate_string_long); +LSSL_USED(SSL_SESSION_get0_cipher); +LSSL_USED(SSL_SESSION_get_master_key); +LSSL_USED(SSL_SESSION_get_protocol_version); +LSSL_USED(SSL_SESSION_get_time); +LSSL_USED(SSL_SESSION_set_time); +LSSL_USED(SSL_SESSION_get_timeout); +LSSL_USED(SSL_SESSION_set_timeout); +LSSL_USED(SSL_copy_session_id); +LSSL_USED(SSL_SESSION_get0_peer); +LSSL_USED(SSL_SESSION_set1_id); +LSSL_USED(SSL_SESSION_set1_id_context); +LSSL_USED(SSL_SESSION_is_resumable); +LSSL_USED(SSL_SESSION_new); +LSSL_USED(SSL_SESSION_free); +LSSL_USED(SSL_SESSION_up_ref); +LSSL_USED(SSL_SESSION_get_id); +LSSL_USED(SSL_SESSION_get0_id_context); +LSSL_USED(SSL_SESSION_get_max_early_data); +LSSL_USED(SSL_SESSION_set_max_early_data); +LSSL_USED(SSL_SESSION_get_ticket_lifetime_hint); +LSSL_USED(SSL_SESSION_has_ticket); +LSSL_USED(SSL_SESSION_get_compress_id); +LSSL_USED(SSL_SESSION_print_fp); +LSSL_USED(SSL_SESSION_print); +LSSL_USED(i2d_SSL_SESSION); +LSSL_USED(SSL_set_session); +LSSL_USED(SSL_CTX_add_session); +LSSL_USED(SSL_CTX_remove_session); +LSSL_USED(SSL_CTX_set_generate_session_id); +LSSL_USED(SSL_set_generate_session_id); +LSSL_USED(SSL_has_matching_session_id); +LSSL_USED(d2i_SSL_SESSION); +LSSL_USED(SSL_get_peer_cert_chain); +LSSL_USED(SSL_CTX_get_verify_mode); +LSSL_USED(SSL_CTX_get_verify_depth); +LSSL_USED(SSL_CTX_get_verify_callback); +LSSL_USED(SSL_CTX_set_verify); +LSSL_USED(SSL_CTX_set_verify_depth); +LSSL_USED(SSL_CTX_set_cert_verify_callback); +LSSL_USED(SSL_CTX_use_RSAPrivateKey); +LSSL_USED(SSL_CTX_use_RSAPrivateKey_ASN1); +LSSL_USED(SSL_CTX_use_PrivateKey); +LSSL_USED(SSL_CTX_use_PrivateKey_ASN1); +LSSL_USED(SSL_CTX_use_certificate); +LSSL_USED(SSL_CTX_use_certificate_ASN1); +LSSL_USED(SSL_CTX_get_default_passwd_cb); +LSSL_USED(SSL_CTX_set_default_passwd_cb); +LSSL_USED(SSL_CTX_get_default_passwd_cb_userdata); +LSSL_USED(SSL_CTX_set_default_passwd_cb_userdata); +LSSL_USED(SSL_CTX_check_private_key); +LSSL_USED(SSL_check_private_key); +LSSL_USED(SSL_CTX_set_session_id_context); +LSSL_USED(SSL_set_session_id_context); +LSSL_USED(SSL_CTX_set_purpose); +LSSL_USED(SSL_set_purpose); +LSSL_USED(SSL_CTX_set_trust); +LSSL_USED(SSL_set_trust); +LSSL_USED(SSL_set1_host); +LSSL_USED(SSL_set_hostflags); +LSSL_USED(SSL_get0_peername); +LSSL_USED(SSL_CTX_get0_param); +LSSL_USED(SSL_CTX_set1_param); +LSSL_USED(SSL_get0_param); +LSSL_USED(SSL_set1_param); +LSSL_USED(SSL_new); +LSSL_USED(SSL_free); +LSSL_USED(SSL_up_ref); +LSSL_USED(SSL_accept); +LSSL_USED(SSL_connect); +LSSL_USED(SSL_is_dtls); +LSSL_USED(SSL_is_server); +LSSL_USED(SSL_read); +LSSL_USED(SSL_peek); +LSSL_USED(SSL_write); +LSSL_USED(SSL_read_ex); +LSSL_USED(SSL_peek_ex); +LSSL_USED(SSL_write_ex); +LSSL_USED(SSL_CTX_get_max_early_data); +LSSL_USED(SSL_CTX_set_max_early_data); +LSSL_USED(SSL_get_max_early_data); +LSSL_USED(SSL_set_max_early_data); +LSSL_USED(SSL_get_early_data_status); +LSSL_USED(SSL_read_early_data); +LSSL_USED(SSL_write_early_data); +LSSL_USED(SSL_ctrl); +LSSL_USED(SSL_callback_ctrl); +LSSL_USED(SSL_CTX_ctrl); +LSSL_USED(SSL_CTX_callback_ctrl); +LSSL_USED(SSL_get_error); +LSSL_USED(SSL_get_version); +LSSL_USED(SSL_CTX_set_ssl_version); +LSSL_USED(SSLv23_method); +LSSL_USED(SSLv23_server_method); +LSSL_USED(SSLv23_client_method); +LSSL_USED(TLSv1_method); +LSSL_USED(TLSv1_server_method); +LSSL_USED(TLSv1_client_method); +LSSL_USED(TLSv1_1_method); +LSSL_USED(TLSv1_1_server_method); +LSSL_USED(TLSv1_1_client_method); +LSSL_USED(TLSv1_2_method); +LSSL_USED(TLSv1_2_server_method); +LSSL_USED(TLSv1_2_client_method); +LSSL_USED(TLS_method); +LSSL_USED(TLS_server_method); +LSSL_USED(TLS_client_method); +LSSL_USED(DTLSv1_method); +LSSL_USED(DTLSv1_server_method); +LSSL_USED(DTLSv1_client_method); +LSSL_USED(DTLSv1_2_method); +LSSL_USED(DTLSv1_2_server_method); +LSSL_USED(DTLSv1_2_client_method); +LSSL_USED(DTLS_method); +LSSL_USED(DTLS_server_method); +LSSL_USED(DTLS_client_method); +LSSL_USED(SSL_get_ciphers); +LSSL_USED(SSL_get_client_ciphers); +LSSL_USED(SSL_get1_supported_ciphers); +LSSL_USED(SSL_do_handshake); +LSSL_USED(SSL_renegotiate); +LSSL_USED(SSL_renegotiate_abbreviated); +LSSL_USED(SSL_renegotiate_pending); +LSSL_USED(SSL_shutdown); +LSSL_USED(SSL_get_ssl_method); +LSSL_USED(SSL_set_ssl_method); +LSSL_USED(SSL_alert_type_string_long); +LSSL_USED(SSL_alert_type_string); +LSSL_USED(SSL_alert_desc_string_long); +LSSL_USED(SSL_alert_desc_string); +LSSL_USED(SSL_set_client_CA_list); +LSSL_USED(SSL_CTX_set_client_CA_list); +LSSL_USED(SSL_get_client_CA_list); +LSSL_USED(SSL_CTX_get_client_CA_list); +LSSL_USED(SSL_add_client_CA); +LSSL_USED(SSL_CTX_add_client_CA); +LSSL_USED(SSL_set_connect_state); +LSSL_USED(SSL_set_accept_state); +LSSL_USED(SSL_get_default_timeout); +LSSL_USED(SSL_library_init); +LSSL_USED(SSL_CIPHER_description); +LSSL_USED(SSL_dup_CA_list); +LSSL_USED(SSL_dup); +LSSL_USED(SSL_get_certificate); +LSSL_USED(SSL_get_privatekey); +LSSL_USED(SSL_CTX_set_quiet_shutdown); +LSSL_USED(SSL_CTX_get_quiet_shutdown); +LSSL_USED(SSL_set_quiet_shutdown); +LSSL_USED(SSL_get_quiet_shutdown); +LSSL_USED(SSL_set_shutdown); +LSSL_USED(SSL_get_shutdown); +LSSL_USED(SSL_version); +LSSL_USED(SSL_CTX_set_default_verify_paths); +LSSL_USED(SSL_CTX_load_verify_locations); +LSSL_USED(SSL_CTX_load_verify_mem); +LSSL_USED(SSL_get_session); +LSSL_USED(SSL_get1_session); +LSSL_USED(SSL_get_SSL_CTX); +LSSL_USED(SSL_set_SSL_CTX); +LSSL_USED(SSL_set_info_callback); +LSSL_USED(SSL_get_info_callback); +LSSL_USED(SSL_state); +LSSL_USED(SSL_set_state); +LSSL_USED(SSL_set_verify_result); +LSSL_USED(SSL_get_verify_result); +LSSL_USED(SSL_set_ex_data); +LSSL_USED(SSL_get_ex_data); +LSSL_USED(SSL_get_ex_new_index); +LSSL_USED(SSL_SESSION_set_ex_data); +LSSL_USED(SSL_SESSION_get_ex_data); +LSSL_USED(SSL_SESSION_get_ex_new_index); +LSSL_USED(SSL_CTX_set_ex_data); +LSSL_USED(SSL_CTX_get_ex_data); +LSSL_USED(SSL_CTX_get_ex_new_index); +LSSL_USED(SSL_get_ex_data_X509_STORE_CTX_idx); +LSSL_USED(SSL_CTX_set_tmp_rsa_callback); +LSSL_USED(SSL_set_tmp_rsa_callback); +LSSL_USED(SSL_CTX_set_tmp_dh_callback); +LSSL_USED(SSL_set_tmp_dh_callback); +LSSL_USED(SSL_CTX_set_tmp_ecdh_callback); +LSSL_USED(SSL_set_tmp_ecdh_callback); +LSSL_USED(SSL_get_client_random); +LSSL_USED(SSL_get_server_random); +LSSL_USED(SSL_get_current_compression); +LSSL_USED(SSL_get_current_expansion); +LSSL_USED(SSL_get_peer_certificate); +LSSL_USED(SSL_COMP_get_name); +LSSL_USED(SSL_COMP_get_compression_methods); +LSSL_USED(SSL_COMP_add_compression_method); +LSSL_USED(SSL_set_session_ticket_ext); +LSSL_USED(SSL_set_session_ticket_ext_cb); +LSSL_USED(SSL_set_session_secret_cb); +LSSL_USED(SSL_set_debug); +LSSL_USED(SSL_cache_hit); +LSSL_USED(SSL_set_security_level); +LSSL_USED(SSL_get_security_level); +LSSL_USED(SSL_CTX_set_security_level); +LSSL_USED(SSL_CTX_get_security_level); +LSSL_USED(SSL_CTX_set_quic_method); +LSSL_USED(SSL_CTX_sess_get_get_cb); +LSSL_USED(SSL_set_quic_method); +LSSL_USED(SSL_is_quic); +LSSL_USED(SSL_quic_max_handshake_flight_len); +LSSL_USED(SSL_quic_read_level); +LSSL_USED(SSL_quic_write_level); +LSSL_USED(SSL_provide_quic_data); +LSSL_USED(SSL_process_quic_post_handshake); +LSSL_USED(SSL_set_quic_transport_params); +LSSL_USED(SSL_get_peer_quic_transport_params); +LSSL_USED(SSL_set_quic_use_legacy_codepoint); +LSSL_USED(ERR_load_SSL_strings); +LSSL_USED(OPENSSL_init_ssl); -#endif /* _LIBSSL_SSL_H_ */ +#endif /* _LIBSSL_SSL_H */ diff --git a/lib/libssl/hidden/openssl/tls1.h b/lib/libssl/hidden/openssl/tls1.h new file mode 100644 index 000000000..de93f9aa2 --- /dev/null +++ b/lib/libssl/hidden/openssl/tls1.h @@ -0,0 +1,32 @@ +/* $OpenBSD: tls1.h,v 1.1 2023/07/08 16:40:14 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBSSL_TLS1_H +#define _LIBSSL_TLS1_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/tls1.h" +#endif +#include "ssl_namespace.h" + +LSSL_USED(SSL_get_servername); +LSSL_USED(SSL_get_servername_type); +LSSL_USED(SSL_export_keying_material); + +#endif /* _LIBSSL_TLS1_H */ diff --git a/lib/libssl/s3_lib.c b/lib/libssl/s3_lib.c index 756106012..7ab688013 100644 --- a/lib/libssl/s3_lib.c +++ b/lib/libssl/s3_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s3_lib.c,v 1.245 2023/07/02 17:21:32 beck Exp $ */ +/* $OpenBSD: s3_lib.c,v 1.246 2023/07/08 16:40:13 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -1931,24 +1931,28 @@ SSL_set0_chain(SSL *ssl, STACK_OF(X509) *chain) { return ssl_cert_set0_chain(NULL, ssl, chain); } +LSSL_ALIAS(SSL_set0_chain); int SSL_set1_chain(SSL *ssl, STACK_OF(X509) *chain) { return ssl_cert_set1_chain(NULL, ssl, chain); } +LSSL_ALIAS(SSL_set1_chain); int SSL_add0_chain_cert(SSL *ssl, X509 *x509) { return ssl_cert_add0_chain_cert(NULL, ssl, x509); } +LSSL_ALIAS(SSL_add0_chain_cert); int SSL_add1_chain_cert(SSL *ssl, X509 *x509) { return ssl_cert_add1_chain_cert(NULL, ssl, x509); } +LSSL_ALIAS(SSL_add1_chain_cert); int SSL_get0_chain_certs(const SSL *ssl, STACK_OF(X509) **out_chain) @@ -1960,12 +1964,14 @@ SSL_get0_chain_certs(const SSL *ssl, STACK_OF(X509) **out_chain) return 1; } +LSSL_ALIAS(SSL_get0_chain_certs); int SSL_clear_chain_certs(SSL *ssl) { return ssl_cert_set0_chain(NULL, ssl, NULL); } +LSSL_ALIAS(SSL_clear_chain_certs); int SSL_set1_groups(SSL *s, const int *groups, size_t groups_len) @@ -1973,6 +1979,7 @@ SSL_set1_groups(SSL *s, const int *groups, size_t groups_len) return tls1_set_groups(&s->tlsext_supportedgroups, &s->tlsext_supportedgroups_length, groups, groups_len); } +LSSL_ALIAS(SSL_set1_groups); int SSL_set1_groups_list(SSL *s, const char *groups) @@ -1980,6 +1987,7 @@ SSL_set1_groups_list(SSL *s, const char *groups) return tls1_set_group_list(&s->tlsext_supportedgroups, &s->tlsext_supportedgroups_length, groups); } +LSSL_ALIAS(SSL_set1_groups_list); static int _SSL_get_signature_nid(SSL *s, int *nid) @@ -2322,24 +2330,28 @@ SSL_CTX_set0_chain(SSL_CTX *ctx, STACK_OF(X509) *chain) { return ssl_cert_set0_chain(ctx, NULL, chain); } +LSSL_ALIAS(SSL_CTX_set0_chain); int SSL_CTX_set1_chain(SSL_CTX *ctx, STACK_OF(X509) *chain) { return ssl_cert_set1_chain(ctx, NULL, chain); } +LSSL_ALIAS(SSL_CTX_set1_chain); int SSL_CTX_add0_chain_cert(SSL_CTX *ctx, X509 *x509) { return ssl_cert_add0_chain_cert(ctx, NULL, x509); } +LSSL_ALIAS(SSL_CTX_add0_chain_cert); int SSL_CTX_add1_chain_cert(SSL_CTX *ctx, X509 *x509) { return ssl_cert_add1_chain_cert(ctx, NULL, x509); } +LSSL_ALIAS(SSL_CTX_add1_chain_cert); int SSL_CTX_get0_chain_certs(const SSL_CTX *ctx, STACK_OF(X509) **out_chain) @@ -2351,12 +2363,14 @@ SSL_CTX_get0_chain_certs(const SSL_CTX *ctx, STACK_OF(X509) **out_chain) return 1; } +LSSL_ALIAS(SSL_CTX_get0_chain_certs); int SSL_CTX_clear_chain_certs(SSL_CTX *ctx) { return ssl_cert_set0_chain(ctx, NULL, NULL); } +LSSL_ALIAS(SSL_CTX_clear_chain_certs); static int _SSL_CTX_add_extra_chain_cert(SSL_CTX *ctx, X509 *cert) @@ -2402,6 +2416,7 @@ SSL_CTX_set1_groups(SSL_CTX *ctx, const int *groups, size_t groups_len) return tls1_set_groups(&ctx->tlsext_supportedgroups, &ctx->tlsext_supportedgroups_length, groups, groups_len); } +LSSL_ALIAS(SSL_CTX_set1_groups); int SSL_CTX_set1_groups_list(SSL_CTX *ctx, const char *groups) @@ -2409,6 +2424,7 @@ SSL_CTX_set1_groups_list(SSL_CTX *ctx, const char *groups) return tls1_set_group_list(&ctx->tlsext_supportedgroups, &ctx->tlsext_supportedgroups_length, groups); } +LSSL_ALIAS(SSL_CTX_set1_groups_list); long ssl3_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) diff --git a/lib/libssl/ssl_algs.c b/lib/libssl/ssl_algs.c index ab23f4bc4..684697df5 100644 --- a/lib/libssl/ssl_algs.c +++ b/lib/libssl/ssl_algs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_algs.c,v 1.31 2022/11/26 16:08:55 tb Exp $ */ +/* $OpenBSD: ssl_algs.c,v 1.32 2023/07/08 16:40:13 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -122,4 +122,4 @@ SSL_library_init(void) return (1); } - +LSSL_ALIAS(SSL_library_init); diff --git a/lib/libssl/ssl_asn1.c b/lib/libssl/ssl_asn1.c index 768460212..f4552f1c9 100644 --- a/lib/libssl/ssl_asn1.c +++ b/lib/libssl/ssl_asn1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_asn1.c,v 1.66 2022/11/26 16:08:55 tb Exp $ */ +/* $OpenBSD: ssl_asn1.c,v 1.67 2023/07/08 16:40:13 beck Exp $ */ /* * Copyright (c) 2016 Joel Sing * @@ -238,6 +238,7 @@ i2d_SSL_SESSION(SSL_SESSION *ss, unsigned char **pp) return rv; } +LSSL_ALIAS(i2d_SSL_SESSION); SSL_SESSION * d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, long length) @@ -416,3 +417,4 @@ d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, long length) return (NULL); } +LSSL_ALIAS(d2i_SSL_SESSION); diff --git a/lib/libssl/ssl_both.c b/lib/libssl/ssl_both.c index 3feedc18f..14d9aa85a 100644 --- a/lib/libssl/ssl_both.c +++ b/lib/libssl/ssl_both.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_both.c,v 1.45 2022/11/26 16:08:55 tb Exp $ */ +/* $OpenBSD: ssl_both.c,v 1.46 2023/07/07 08:53:55 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -388,6 +388,7 @@ ssl_cert_type(EVP_PKEY *pkey) case NID_id_GostR3410_2001_cc: return SSL_PKEY_GOST01; case EVP_PKEY_RSA: + case EVP_PKEY_RSA_PSS: return SSL_PKEY_RSA; } diff --git a/lib/libssl/ssl_cert.c b/lib/libssl/ssl_cert.c index 8a333b427..a28805026 100644 --- a/lib/libssl/ssl_cert.c +++ b/lib/libssl/ssl_cert.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_cert.c,v 1.106 2023/05/26 13:44:05 tb Exp $ */ +/* $OpenBSD: ssl_cert.c,v 1.107 2023/07/08 16:40:13 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -157,6 +157,7 @@ SSL_get_ex_data_X509_STORE_CTX_idx(void) return ssl_x509_store_ctx_idx; } +LSSL_ALIAS(SSL_get_ex_data_X509_STORE_CTX_idx); SSL_CERT * ssl_cert_new(void) @@ -487,24 +488,28 @@ SSL_dup_CA_list(const STACK_OF(X509_NAME) *sk) sk_X509_NAME_pop_free(ret, X509_NAME_free); return NULL; } +LSSL_ALIAS(SSL_dup_CA_list); void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list) { set_client_CA_list(&(s->client_CA), name_list); } +LSSL_ALIAS(SSL_set_client_CA_list); void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list) { set_client_CA_list(&(ctx->client_CA), name_list); } +LSSL_ALIAS(SSL_CTX_set_client_CA_list); STACK_OF(X509_NAME) * SSL_CTX_get_client_CA_list(const SSL_CTX *ctx) { return (ctx->client_CA); } +LSSL_ALIAS(SSL_CTX_get_client_CA_list); STACK_OF(X509_NAME) * SSL_get_client_CA_list(const SSL *s) @@ -522,6 +527,7 @@ SSL_get_client_CA_list(const SSL *s) return (s->ctx->client_CA); } } +LSSL_ALIAS(SSL_get_client_CA_list); static int add_client_CA(STACK_OF(X509_NAME) **sk, X509 *x) @@ -548,12 +554,14 @@ SSL_add_client_CA(SSL *ssl, X509 *x) { return (add_client_CA(&(ssl->client_CA), x)); } +LSSL_ALIAS(SSL_add_client_CA); int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x) { return (add_client_CA(&(ctx->client_CA), x)); } +LSSL_ALIAS(SSL_CTX_add_client_CA); static int xname_cmp(const X509_NAME * const *a, const X509_NAME * const *b) @@ -628,6 +636,7 @@ SSL_load_client_CA_file(const char *file) return (ret); } +LSSL_ALIAS(SSL_load_client_CA_file); /*! * Add a file of certs to a stack. @@ -688,6 +697,7 @@ SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, return ret; } +LSSL_ALIAS(SSL_add_file_cert_subjects_to_stack); /*! * Add a directory of certs to a stack. @@ -728,3 +738,4 @@ SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, const char *dir) } return ret; } +LSSL_ALIAS(SSL_add_dir_cert_subjects_to_stack); diff --git a/lib/libssl/ssl_ciph.c b/lib/libssl/ssl_ciph.c index a71c5042c..b735cd7b3 100644 --- a/lib/libssl/ssl_ciph.c +++ b/lib/libssl/ssl_ciph.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_ciph.c,v 1.135 2022/11/26 16:08:55 tb Exp $ */ +/* $OpenBSD: ssl_ciph.c,v 1.136 2023/07/08 16:40:13 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -475,9 +475,11 @@ ssl_cipher_get_evp(const SSL_SESSION *ss, const EVP_CIPHER **enc, case SSL_CAMELLIA256: *enc = EVP_camellia_256_cbc(); break; +#ifndef OPENSSL_NO_GOST case SSL_eGOST2814789CNT: *enc = EVP_gost2814789_cnt(); break; +#endif } switch (ss->cipher->algorithm_mac) { @@ -493,6 +495,7 @@ ssl_cipher_get_evp(const SSL_SESSION *ss, const EVP_CIPHER **enc, case SSL_SHA384: *md = EVP_sha384(); break; +#ifndef OPENSSL_NO_GOST case SSL_GOST89MAC: *md = EVP_gost2814789imit(); break; @@ -502,8 +505,8 @@ ssl_cipher_get_evp(const SSL_SESSION *ss, const EVP_CIPHER **enc, case SSL_STREEBOG256: *md = EVP_streebog256(); break; +#endif } - if (*enc == NULL || *md == NULL) return 0; @@ -515,15 +518,18 @@ ssl_cipher_get_evp(const SSL_SESSION *ss, const EVP_CIPHER **enc, return 0; if (EVP_CIPHER_mode(*enc) == EVP_CIPH_GCM_MODE) return 0; - +#ifndef OPENSSL_NO_GOST + /* XXX JFC. die in fire already */ if (ss->cipher->algorithm_mac == SSL_GOST89MAC) { *mac_pkey_type = EVP_PKEY_GOSTIMIT; *mac_secret_size = 32; /* XXX */ } else { +#endif *mac_pkey_type = EVP_PKEY_HMAC; *mac_secret_size = EVP_MD_size(*md); +#ifndef OPENSSL_NO_GOST } - +#endif return 1; } @@ -578,18 +584,20 @@ ssl_get_handshake_evp_md(SSL *s, const EVP_MD **md) case SSL_HANDSHAKE_MAC_DEFAULT: *md = EVP_md5_sha1(); return 1; +#ifndef OPENSSL_NO_GOST case SSL_HANDSHAKE_MAC_GOST94: *md = EVP_gostr341194(); return 1; + case SSL_HANDSHAKE_MAC_STREEBOG256: + *md = EVP_streebog256(); + return 1; +#endif case SSL_HANDSHAKE_MAC_SHA256: *md = EVP_sha256(); return 1; case SSL_HANDSHAKE_MAC_SHA384: *md = EVP_sha384(); return 1; - case SSL_HANDSHAKE_MAC_STREEBOG256: - *md = EVP_streebog256(); - return 1; default: break; } @@ -1406,12 +1414,14 @@ SSL_CIPHER_get_by_id(unsigned int id) { return ssl3_get_cipher_by_id(id); } +LSSL_ALIAS(SSL_CIPHER_get_by_id); const SSL_CIPHER * SSL_CIPHER_get_by_value(uint16_t value) { return ssl3_get_cipher_by_value(value); } +LSSL_ALIAS(SSL_CIPHER_get_by_value); char * SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len) @@ -1565,6 +1575,7 @@ SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len) return (ret); } +LSSL_ALIAS(SSL_CIPHER_description); const char * SSL_CIPHER_get_version(const SSL_CIPHER *c) @@ -1576,6 +1587,7 @@ SSL_CIPHER_get_version(const SSL_CIPHER *c) else return("unknown"); } +LSSL_ALIAS(SSL_CIPHER_get_version); /* return the actual cipher being used */ const char * @@ -1585,6 +1597,7 @@ SSL_CIPHER_get_name(const SSL_CIPHER *c) return (c->name); return("(NONE)"); } +LSSL_ALIAS(SSL_CIPHER_get_name); /* number of bits for symmetric cipher */ int @@ -1599,18 +1612,21 @@ SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits) } return (ret); } +LSSL_ALIAS(SSL_CIPHER_get_bits); unsigned long SSL_CIPHER_get_id(const SSL_CIPHER *c) { return c->id; } +LSSL_ALIAS(SSL_CIPHER_get_id); uint16_t SSL_CIPHER_get_value(const SSL_CIPHER *c) { return ssl3_cipher_get_value(c); } +LSSL_ALIAS(SSL_CIPHER_get_value); const SSL_CIPHER * SSL_CIPHER_find(SSL *ssl, const unsigned char *ptr) @@ -1625,6 +1641,7 @@ SSL_CIPHER_find(SSL *ssl, const unsigned char *ptr) return ssl3_get_cipher_by_value(cipher_value); } +LSSL_ALIAS(SSL_CIPHER_find); int SSL_CIPHER_get_cipher_nid(const SSL_CIPHER *c) @@ -1658,6 +1675,7 @@ SSL_CIPHER_get_cipher_nid(const SSL_CIPHER *c) return NID_undef; } } +LSSL_ALIAS(SSL_CIPHER_get_cipher_nid); int SSL_CIPHER_get_digest_nid(const SSL_CIPHER *c) @@ -1683,6 +1701,7 @@ SSL_CIPHER_get_digest_nid(const SSL_CIPHER *c) return NID_undef; } } +LSSL_ALIAS(SSL_CIPHER_get_digest_nid); int SSL_CIPHER_get_kx_nid(const SSL_CIPHER *c) @@ -1700,6 +1719,7 @@ SSL_CIPHER_get_kx_nid(const SSL_CIPHER *c) return NID_undef; } } +LSSL_ALIAS(SSL_CIPHER_get_kx_nid); int SSL_CIPHER_get_auth_nid(const SSL_CIPHER *c) @@ -1717,27 +1737,32 @@ SSL_CIPHER_get_auth_nid(const SSL_CIPHER *c) return NID_undef; } } +LSSL_ALIAS(SSL_CIPHER_get_auth_nid); int SSL_CIPHER_is_aead(const SSL_CIPHER *c) { return (c->algorithm_mac & SSL_AEAD) == SSL_AEAD; } +LSSL_ALIAS(SSL_CIPHER_is_aead); void * SSL_COMP_get_compression_methods(void) { return NULL; } +LSSL_ALIAS(SSL_COMP_get_compression_methods); int SSL_COMP_add_compression_method(int id, void *cm) { return 1; } +LSSL_ALIAS(SSL_COMP_add_compression_method); const char * SSL_COMP_get_name(const void *comp) { return NULL; } +LSSL_ALIAS(SSL_COMP_get_name); diff --git a/lib/libssl/ssl_clnt.c b/lib/libssl/ssl_clnt.c index 6aea59013..441da643f 100644 --- a/lib/libssl/ssl_clnt.c +++ b/lib/libssl/ssl_clnt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_clnt.c,v 1.160 2023/06/11 19:01:01 tb Exp $ */ +/* $OpenBSD: ssl_clnt.c,v 1.161 2023/07/08 16:40:13 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -2123,12 +2123,14 @@ ssl3_send_client_verify_sigalgs(SSL *s, EVP_PKEY *pkey, SSLerror(s, ERR_R_EVP_LIB); goto err; } +#ifndef OPENSSL_NO_GOST if (sigalg->key_type == EVP_PKEY_GOSTR01 && EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_SIGN, EVP_PKEY_CTRL_GOST_SIG_FORMAT, GOST_SIG_FORMAT_RS_LE, NULL) <= 0) { SSLerror(s, ERR_R_EVP_LIB); goto err; } +#endif if ((sigalg->flags & SIGALG_FLAG_RSA_PSS) && (!EVP_PKEY_CTX_set_rsa_padding(pctx, RSA_PKCS1_PSS_PADDING) || !EVP_PKEY_CTX_set_rsa_pss_saltlen(pctx, -1))) { @@ -2267,11 +2269,13 @@ ssl3_send_client_verify_gost(SSL *s, EVP_PKEY *pkey, CBB *cert_verify) SSLerror(s, ERR_R_EVP_LIB); goto err; } +#ifndef OPENSSL_NO_GOST if (EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_SIGN, EVP_PKEY_CTRL_GOST_SIG_FORMAT, GOST_SIG_FORMAT_RS_LE, NULL) <= 0) { SSLerror(s, ERR_R_EVP_LIB); goto err; } +#endif if (!EVP_DigestSign(mctx, NULL, &signature_len, hdata, hdata_len)) { SSLerror(s, ERR_R_EVP_LIB); goto err; diff --git a/lib/libssl/ssl_err.c b/lib/libssl/ssl_err.c index 59d8119e1..28097ea70 100644 --- a/lib/libssl/ssl_err.c +++ b/lib/libssl/ssl_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_err.c,v 1.45 2022/11/26 16:08:55 tb Exp $ */ +/* $OpenBSD: ssl_err.c,v 1.46 2023/07/08 16:40:13 beck Exp $ */ /* ==================================================================== * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * @@ -482,6 +482,7 @@ ERR_load_SSL_strings(void) } #endif } +LSSL_ALIAS(ERR_load_SSL_strings); void SSL_load_error_strings(void) @@ -491,6 +492,7 @@ SSL_load_error_strings(void) ERR_load_SSL_strings(); #endif } +LSSL_ALIAS(SSL_load_error_strings); int SSL_state_func_code(int state) { diff --git a/lib/libssl/ssl_init.c b/lib/libssl/ssl_init.c index 65f38e25d..a8646cc09 100644 --- a/lib/libssl/ssl_init.c +++ b/lib/libssl/ssl_init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_init.c,v 1.3 2022/11/26 16:08:55 tb Exp $ */ +/* $OpenBSD: ssl_init.c,v 1.4 2023/07/08 16:40:13 beck Exp $ */ /* * Copyright (c) 2018 Bob Beck * @@ -49,3 +49,4 @@ OPENSSL_init_ssl(uint64_t opts, const void *settings) return 1; } +LSSL_ALIAS(OPENSSL_init_ssl); diff --git a/lib/libssl/ssl_lib.c b/lib/libssl/ssl_lib.c index f6c940613..b1169b024 100644 --- a/lib/libssl/ssl_lib.c +++ b/lib/libssl/ssl_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_lib.c,v 1.310 2023/05/26 13:44:05 tb Exp $ */ +/* $OpenBSD: ssl_lib.c,v 1.311 2023/07/08 16:40:13 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -218,6 +218,7 @@ SSL_clear(SSL *s) return (1); } +LSSL_ALIAS(SSL_clear); /* Used to change an SSL_CTXs default SSL method type */ int @@ -236,6 +237,7 @@ SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *meth) } return (1); } +LSSL_ALIAS(SSL_CTX_set_ssl_version); SSL * SSL_new(SSL_CTX *ctx) @@ -360,6 +362,7 @@ SSL_new(SSL_CTX *ctx) SSLerrorx(ERR_R_MALLOC_FAILURE); return (NULL); } +LSSL_ALIAS(SSL_new); int SSL_CTX_set_session_id_context(SSL_CTX *ctx, const unsigned char *sid_ctx, @@ -374,6 +377,7 @@ SSL_CTX_set_session_id_context(SSL_CTX *ctx, const unsigned char *sid_ctx, return (1); } +LSSL_ALIAS(SSL_CTX_set_session_id_context); int SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx, @@ -388,6 +392,7 @@ SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx, return (1); } +LSSL_ALIAS(SSL_set_session_id_context); int SSL_CTX_set_generate_session_id(SSL_CTX *ctx, GEN_SESSION_CB cb) @@ -397,6 +402,7 @@ SSL_CTX_set_generate_session_id(SSL_CTX *ctx, GEN_SESSION_CB cb) CRYPTO_w_unlock(CRYPTO_LOCK_SSL_CTX); return (1); } +LSSL_ALIAS(SSL_CTX_set_generate_session_id); int SSL_set_generate_session_id(SSL *ssl, GEN_SESSION_CB cb) @@ -406,6 +412,7 @@ SSL_set_generate_session_id(SSL *ssl, GEN_SESSION_CB cb) CRYPTO_w_unlock(CRYPTO_LOCK_SSL); return (1); } +LSSL_ALIAS(SSL_set_generate_session_id); int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id, @@ -432,30 +439,35 @@ SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id, CRYPTO_r_unlock(CRYPTO_LOCK_SSL_CTX); return (p != NULL); } +LSSL_ALIAS(SSL_has_matching_session_id); int SSL_CTX_set_purpose(SSL_CTX *s, int purpose) { return (X509_VERIFY_PARAM_set_purpose(s->param, purpose)); } +LSSL_ALIAS(SSL_CTX_set_purpose); int SSL_set_purpose(SSL *s, int purpose) { return (X509_VERIFY_PARAM_set_purpose(s->param, purpose)); } +LSSL_ALIAS(SSL_set_purpose); int SSL_CTX_set_trust(SSL_CTX *s, int trust) { return (X509_VERIFY_PARAM_set_trust(s->param, trust)); } +LSSL_ALIAS(SSL_CTX_set_trust); int SSL_set_trust(SSL *s, int trust) { return (X509_VERIFY_PARAM_set_trust(s->param, trust)); } +LSSL_ALIAS(SSL_set_trust); int SSL_set1_host(SSL *s, const char *hostname) @@ -470,42 +482,49 @@ SSL_set1_host(SSL *s, const char *hostname) else return X509_VERIFY_PARAM_set1_host(s->param, hostname, 0); } +LSSL_ALIAS(SSL_set1_host); void SSL_set_hostflags(SSL *s, unsigned int flags) { X509_VERIFY_PARAM_set_hostflags(s->param, flags); } +LSSL_ALIAS(SSL_set_hostflags); const char * SSL_get0_peername(SSL *s) { return X509_VERIFY_PARAM_get0_peername(s->param); } +LSSL_ALIAS(SSL_get0_peername); X509_VERIFY_PARAM * SSL_CTX_get0_param(SSL_CTX *ctx) { return (ctx->param); } +LSSL_ALIAS(SSL_CTX_get0_param); int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm) { return (X509_VERIFY_PARAM_set1(ctx->param, vpm)); } +LSSL_ALIAS(SSL_CTX_set1_param); X509_VERIFY_PARAM * SSL_get0_param(SSL *ssl) { return (ssl->param); } +LSSL_ALIAS(SSL_get0_param); int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm) { return (X509_VERIFY_PARAM_set1(ssl->param, vpm)); } +LSSL_ALIAS(SSL_set1_param); void SSL_free(SSL *s) @@ -585,6 +604,7 @@ SSL_free(SSL *s) free(s); } +LSSL_ALIAS(SSL_free); int SSL_up_ref(SSL *s) @@ -592,6 +612,7 @@ SSL_up_ref(SSL *s) int refs = CRYPTO_add(&s->references, 1, CRYPTO_LOCK_SSL); return (refs > 1) ? 1 : 0; } +LSSL_ALIAS(SSL_up_ref); void SSL_set_bio(SSL *s, BIO *rbio, BIO *wbio) @@ -611,12 +632,14 @@ SSL_set_bio(SSL *s, BIO *rbio, BIO *wbio) s->rbio = rbio; s->wbio = wbio; } +LSSL_ALIAS(SSL_set_bio); BIO * SSL_get_rbio(const SSL *s) { return (s->rbio); } +LSSL_ALIAS(SSL_get_rbio); void SSL_set0_rbio(SSL *s, BIO *rbio) @@ -624,18 +647,21 @@ SSL_set0_rbio(SSL *s, BIO *rbio) BIO_free_all(s->rbio); s->rbio = rbio; } +LSSL_ALIAS(SSL_set0_rbio); BIO * SSL_get_wbio(const SSL *s) { return (s->wbio); } +LSSL_ALIAS(SSL_get_wbio); int SSL_get_fd(const SSL *s) { return (SSL_get_rfd(s)); } +LSSL_ALIAS(SSL_get_fd); int SSL_get_rfd(const SSL *s) @@ -649,6 +675,7 @@ SSL_get_rfd(const SSL *s) BIO_get_fd(r, &ret); return (ret); } +LSSL_ALIAS(SSL_get_rfd); int SSL_get_wfd(const SSL *s) @@ -662,6 +689,7 @@ SSL_get_wfd(const SSL *s) BIO_get_fd(r, &ret); return (ret); } +LSSL_ALIAS(SSL_get_wfd); int SSL_set_fd(SSL *s, int fd) @@ -681,6 +709,7 @@ SSL_set_fd(SSL *s, int fd) err: return (ret); } +LSSL_ALIAS(SSL_set_fd); int SSL_set_wfd(SSL *s, int fd) @@ -704,6 +733,7 @@ SSL_set_wfd(SSL *s, int fd) err: return (ret); } +LSSL_ALIAS(SSL_set_wfd); int SSL_set_rfd(SSL *s, int fd) @@ -727,6 +757,7 @@ SSL_set_rfd(SSL *s, int fd) err: return (ret); } +LSSL_ALIAS(SSL_set_rfd); /* return length of latest Finished message we sent, copy to 'buf' */ @@ -741,6 +772,7 @@ SSL_get_finished(const SSL *s, void *buf, size_t count) memcpy(buf, s->s3->hs.finished, count); return (ret); } +LSSL_ALIAS(SSL_get_finished); /* return length of latest Finished message we expected, copy to 'buf' */ size_t @@ -754,6 +786,7 @@ SSL_get_peer_finished(const SSL *s, void *buf, size_t count) memcpy(buf, s->s3->hs.peer_finished, count); return (ret); } +LSSL_ALIAS(SSL_get_peer_finished); int @@ -761,30 +794,35 @@ SSL_get_verify_mode(const SSL *s) { return (s->verify_mode); } +LSSL_ALIAS(SSL_get_verify_mode); int SSL_get_verify_depth(const SSL *s) { return (X509_VERIFY_PARAM_get_depth(s->param)); } +LSSL_ALIAS(SSL_get_verify_depth); int (*SSL_get_verify_callback(const SSL *s))(int, X509_STORE_CTX *) { return (s->verify_callback); } +LSSL_ALIAS(SSL_get_verify_callback); void SSL_CTX_set_keylog_callback(SSL_CTX *ctx, SSL_CTX_keylog_cb_func cb) { ctx->keylog_callback = cb; } +LSSL_ALIAS(SSL_CTX_set_keylog_callback); SSL_CTX_keylog_cb_func SSL_CTX_get_keylog_callback(const SSL_CTX *ctx) { return (ctx->keylog_callback); } +LSSL_ALIAS(SSL_CTX_get_keylog_callback); int SSL_set_num_tickets(SSL *s, size_t num_tickets) @@ -793,12 +831,14 @@ SSL_set_num_tickets(SSL *s, size_t num_tickets) return 1; } +LSSL_ALIAS(SSL_set_num_tickets); size_t SSL_get_num_tickets(const SSL *s) { return s->num_tickets; } +LSSL_ALIAS(SSL_get_num_tickets); int SSL_CTX_set_num_tickets(SSL_CTX *ctx, size_t num_tickets) @@ -807,30 +847,35 @@ SSL_CTX_set_num_tickets(SSL_CTX *ctx, size_t num_tickets) return 1; } +LSSL_ALIAS(SSL_CTX_set_num_tickets); size_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx) { return ctx->num_tickets; } +LSSL_ALIAS(SSL_CTX_get_num_tickets); int SSL_CTX_get_verify_mode(const SSL_CTX *ctx) { return (ctx->verify_mode); } +LSSL_ALIAS(SSL_CTX_get_verify_mode); int SSL_CTX_get_verify_depth(const SSL_CTX *ctx) { return (X509_VERIFY_PARAM_get_depth(ctx->param)); } +LSSL_ALIAS(SSL_CTX_get_verify_depth); int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int, X509_STORE_CTX *) { return (ctx->default_verify_callback); } +LSSL_ALIAS(SSL_CTX_get_verify_callback); void SSL_set_verify(SSL *s, int mode, @@ -840,30 +885,35 @@ SSL_set_verify(SSL *s, int mode, if (callback != NULL) s->verify_callback = callback; } +LSSL_ALIAS(SSL_set_verify); void SSL_set_verify_depth(SSL *s, int depth) { X509_VERIFY_PARAM_set_depth(s->param, depth); } +LSSL_ALIAS(SSL_set_verify_depth); void SSL_set_read_ahead(SSL *s, int yes) { s->read_ahead = yes; } +LSSL_ALIAS(SSL_set_read_ahead); int SSL_get_read_ahead(const SSL *s) { return (s->read_ahead); } +LSSL_ALIAS(SSL_get_read_ahead); int SSL_pending(const SSL *s) { return (s->method->ssl_pending(s)); } +LSSL_ALIAS(SSL_pending); X509 * SSL_get_peer_certificate(const SSL *s) @@ -880,6 +930,7 @@ SSL_get_peer_certificate(const SSL *s) return cert; } +LSSL_ALIAS(SSL_get_peer_certificate); STACK_OF(X509) * SSL_get_peer_cert_chain(const SSL *s) @@ -896,6 +947,7 @@ SSL_get_peer_cert_chain(const SSL *s) return s->s3->hs.peer_certs_no_leaf; } +LSSL_ALIAS(SSL_get_peer_cert_chain); STACK_OF(X509) * SSL_get0_verified_chain(const SSL *s) @@ -904,6 +956,7 @@ SSL_get0_verified_chain(const SSL *s) return NULL; return s->s3->hs.verified_chain; } +LSSL_ALIAS(SSL_get0_verified_chain); /* * Now in theory, since the calling process own 't' it should be safe to @@ -939,6 +992,7 @@ SSL_copy_session_id(SSL *t, const SSL *f) return 1; } +LSSL_ALIAS(SSL_copy_session_id); /* Fix this so it checks all the valid key/cert options */ int @@ -956,6 +1010,7 @@ SSL_CTX_check_private_key(const SSL_CTX *ctx) return (X509_check_private_key(ctx->cert->key->x509, ctx->cert->key->privatekey)); } +LSSL_ALIAS(SSL_CTX_check_private_key); /* Fix this function so that it takes an optional type parameter */ int @@ -980,6 +1035,7 @@ SSL_check_private_key(const SSL *ssl) return (X509_check_private_key(ssl->cert->key->x509, ssl->cert->key->privatekey)); } +LSSL_ALIAS(SSL_check_private_key); int SSL_accept(SSL *s) @@ -989,6 +1045,7 @@ SSL_accept(SSL *s) return (s->method->ssl_accept(s)); } +LSSL_ALIAS(SSL_accept); int SSL_connect(SSL *s) @@ -998,18 +1055,21 @@ SSL_connect(SSL *s) return (s->method->ssl_connect(s)); } +LSSL_ALIAS(SSL_connect); int SSL_is_dtls(const SSL *s) { return s->method->dtls; } +LSSL_ALIAS(SSL_is_dtls); int SSL_is_server(const SSL *s) { return s->server; } +LSSL_ALIAS(SSL_is_server); static long ssl_get_default_timeout() @@ -1026,6 +1086,7 @@ SSL_get_default_timeout(const SSL *s) { return (ssl_get_default_timeout()); } +LSSL_ALIAS(SSL_get_default_timeout); int SSL_read(SSL *s, void *buf, int num) @@ -1051,6 +1112,7 @@ SSL_read(SSL *s, void *buf, int num) } return ssl3_read(s, buf, num); } +LSSL_ALIAS(SSL_read); int SSL_read_ex(SSL *s, void *buf, size_t num, size_t *bytes_read) @@ -1070,6 +1132,7 @@ SSL_read_ex(SSL *s, void *buf, size_t num, size_t *bytes_read) return ret > 0; } +LSSL_ALIAS(SSL_read_ex); int SSL_peek(SSL *s, void *buf, int num) @@ -1094,6 +1157,7 @@ SSL_peek(SSL *s, void *buf, int num) } return ssl3_peek(s, buf, num); } +LSSL_ALIAS(SSL_peek); int SSL_peek_ex(SSL *s, void *buf, size_t num, size_t *bytes_peeked) @@ -1113,6 +1177,7 @@ SSL_peek_ex(SSL *s, void *buf, size_t num, size_t *bytes_peeked) return ret > 0; } +LSSL_ALIAS(SSL_peek_ex); int SSL_write(SSL *s, const void *buf, int num) @@ -1139,6 +1204,7 @@ SSL_write(SSL *s, const void *buf, int num) } return ssl3_write(s, buf, num); } +LSSL_ALIAS(SSL_write); int SSL_write_ex(SSL *s, const void *buf, size_t num, size_t *bytes_written) @@ -1164,36 +1230,42 @@ SSL_write_ex(SSL *s, const void *buf, size_t num, size_t *bytes_written) return ret > 0; } +LSSL_ALIAS(SSL_write_ex); uint32_t SSL_CTX_get_max_early_data(const SSL_CTX *ctx) { return 0; } +LSSL_ALIAS(SSL_CTX_get_max_early_data); int SSL_CTX_set_max_early_data(SSL_CTX *ctx, uint32_t max_early_data) { return 1; } +LSSL_ALIAS(SSL_CTX_set_max_early_data); uint32_t SSL_get_max_early_data(const SSL *s) { return 0; } +LSSL_ALIAS(SSL_get_max_early_data); int SSL_set_max_early_data(SSL *s, uint32_t max_early_data) { return 1; } +LSSL_ALIAS(SSL_set_max_early_data); int SSL_get_early_data_status(const SSL *s) { return SSL_EARLY_DATA_REJECTED; } +LSSL_ALIAS(SSL_get_early_data_status); int SSL_read_early_data(SSL *s, void *buf, size_t num, size_t *readbytes) @@ -1207,6 +1279,7 @@ SSL_read_early_data(SSL *s, void *buf, size_t num, size_t *readbytes) return SSL_READ_EARLY_DATA_FINISH; } +LSSL_ALIAS(SSL_read_early_data); int SSL_write_early_data(SSL *s, const void *buf, size_t num, size_t *written) @@ -1215,6 +1288,7 @@ SSL_write_early_data(SSL *s, const void *buf, size_t num, size_t *written) SSLerror(s, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } +LSSL_ALIAS(SSL_write_early_data); int SSL_shutdown(SSL *s) @@ -1236,6 +1310,7 @@ SSL_shutdown(SSL *s) return (1); } +LSSL_ALIAS(SSL_shutdown); int SSL_renegotiate(SSL *s) @@ -1247,6 +1322,7 @@ SSL_renegotiate(SSL *s) return (s->method->ssl_renegotiate(s)); } +LSSL_ALIAS(SSL_renegotiate); int SSL_renegotiate_abbreviated(SSL *s) @@ -1258,6 +1334,7 @@ SSL_renegotiate_abbreviated(SSL *s) return (s->method->ssl_renegotiate(s)); } +LSSL_ALIAS(SSL_renegotiate_abbreviated); int SSL_renegotiate_pending(SSL *s) @@ -1268,6 +1345,7 @@ SSL_renegotiate_pending(SSL *s) */ return (s->renegotiate != 0); } +LSSL_ALIAS(SSL_renegotiate_pending); long SSL_ctrl(SSL *s, int cmd, long larg, void *parg) @@ -1325,6 +1403,7 @@ SSL_ctrl(SSL *s, int cmd, long larg, void *parg) return ssl3_ctrl(s, cmd, larg, parg); } } +LSSL_ALIAS(SSL_ctrl); long SSL_callback_ctrl(SSL *s, int cmd, void (*fp)(void)) @@ -1338,12 +1417,14 @@ SSL_callback_ctrl(SSL *s, int cmd, void (*fp)(void)) return (ssl3_callback_ctrl(s, cmd, fp)); } } +LSSL_ALIAS(SSL_callback_ctrl); struct lhash_st_SSL_SESSION * SSL_CTX_sessions(SSL_CTX *ctx) { return (ctx->sessions); } +LSSL_ALIAS(SSL_CTX_sessions); long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) @@ -1423,6 +1504,7 @@ SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) return (ssl3_ctx_ctrl(ctx, cmd, larg, parg)); } } +LSSL_ALIAS(SSL_CTX_ctrl); long SSL_CTX_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp)(void)) @@ -1436,6 +1518,7 @@ SSL_CTX_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp)(void)) return (ssl3_ctx_callback_ctrl(ctx, cmd, fp)); } } +LSSL_ALIAS(SSL_CTX_callback_ctrl); int ssl_cipher_id_cmp(const SSL_CIPHER *a, const SSL_CIPHER *b) @@ -1459,6 +1542,7 @@ SSL_get_ciphers(const SSL *s) return (s->ctx->cipher_list); } +LSSL_ALIAS(SSL_get_ciphers); STACK_OF(SSL_CIPHER) * SSL_get_client_ciphers(const SSL *s) @@ -1467,6 +1551,7 @@ SSL_get_client_ciphers(const SSL *s) return NULL; return s->session->ciphers; } +LSSL_ALIAS(SSL_get_client_ciphers); STACK_OF(SSL_CIPHER) * SSL_get1_supported_ciphers(SSL *s) @@ -1504,6 +1589,7 @@ SSL_get1_supported_ciphers(SSL *s) sk_SSL_CIPHER_free(supported_ciphers); return NULL; } +LSSL_ALIAS(SSL_get1_supported_ciphers); /* See if we have any ECC cipher suites. */ int @@ -1544,6 +1630,7 @@ SSL_get_cipher_list(const SSL *s, int n) return (cipher->name); } +LSSL_ALIAS(SSL_get_cipher_list); STACK_OF(SSL_CIPHER) * SSL_CTX_get_ciphers(const SSL_CTX *ctx) @@ -1552,6 +1639,7 @@ SSL_CTX_get_ciphers(const SSL_CTX *ctx) return NULL; return ctx->cipher_list; } +LSSL_ALIAS(SSL_CTX_get_ciphers); /* Specify the ciphers to be used by default by the SSL_CTX. */ int @@ -1576,6 +1664,7 @@ SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str) } return (1); } +LSSL_ALIAS(SSL_CTX_set_cipher_list); int SSL_CTX_set_ciphersuites(SSL_CTX *ctx, const char *str) @@ -1590,6 +1679,7 @@ SSL_CTX_set_ciphersuites(SSL_CTX *ctx, const char *str) return 1; } +LSSL_ALIAS(SSL_CTX_set_ciphersuites); /* Specify the ciphers to be used by the SSL. */ int @@ -1611,6 +1701,7 @@ SSL_set_cipher_list(SSL *s, const char *str) } return (1); } +LSSL_ALIAS(SSL_set_cipher_list); int SSL_set_ciphersuites(SSL *s, const char *str) @@ -1630,6 +1721,7 @@ SSL_set_ciphersuites(SSL *s, const char *str) return 1; } +LSSL_ALIAS(SSL_set_ciphersuites); char * SSL_get_shared_ciphers(const SSL *s, char *buf, int len) @@ -1671,6 +1763,7 @@ SSL_get_shared_ciphers(const SSL *s, char *buf, int len) *end = '\0'; return buf; } +LSSL_ALIAS(SSL_get_shared_ciphers); /* * Return a servername extension value if provided in Client Hello, or NULL. @@ -1686,6 +1779,7 @@ SSL_get_servername(const SSL *s, const int type) s->session->tlsext_hostname : s->tlsext_hostname); } +LSSL_ALIAS(SSL_get_servername); int SSL_get_servername_type(const SSL *s) @@ -1696,6 +1790,7 @@ SSL_get_servername_type(const SSL *s) return (TLSEXT_NAMETYPE_host_name); return (-1); } +LSSL_ALIAS(SSL_get_servername_type); /* * SSL_select_next_proto implements standard protocol selection. It is @@ -1749,6 +1844,7 @@ SSL_select_next_proto(unsigned char **out, unsigned char *outlen, *outlen = result[0]; return (status); } +LSSL_ALIAS(SSL_select_next_proto); /* SSL_get0_next_proto_negotiated is deprecated. */ void @@ -1758,6 +1854,7 @@ SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data, *data = NULL; *len = 0; } +LSSL_ALIAS(SSL_get0_next_proto_negotiated); /* SSL_CTX_set_next_protos_advertised_cb is deprecated. */ void @@ -1765,6 +1862,7 @@ SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *ctx, int (*cb) (SSL *ssl, const unsigned char **out, unsigned int *outlen, void *arg), void *arg) { } +LSSL_ALIAS(SSL_CTX_set_next_protos_advertised_cb); /* SSL_CTX_set_next_proto_select_cb is deprecated. */ void @@ -1773,6 +1871,7 @@ SSL_CTX_set_next_proto_select_cb(SSL_CTX *ctx, int (*cb) (SSL *s, unsigned int inlen, void *arg), void *arg) { } +LSSL_ALIAS(SSL_CTX_set_next_proto_select_cb); /* * SSL_CTX_set_alpn_protos sets the ALPN protocol list to the specified @@ -1806,6 +1905,7 @@ SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos, /* NOTE: Return values are the reverse of what you expect. */ return failed; } +LSSL_ALIAS(SSL_CTX_set_alpn_protos); /* * SSL_set_alpn_protos sets the ALPN protocol list to the specified @@ -1839,6 +1939,7 @@ SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos, /* NOTE: Return values are the reverse of what you expect. */ return failed; } +LSSL_ALIAS(SSL_set_alpn_protos); /* * SSL_CTX_set_alpn_select_cb sets a callback function that is called during @@ -1853,6 +1954,7 @@ SSL_CTX_set_alpn_select_cb(SSL_CTX* ctx, ctx->alpn_select_cb = cb; ctx->alpn_select_cb_arg = arg; } +LSSL_ALIAS(SSL_CTX_set_alpn_select_cb); /* * SSL_get0_alpn_selected gets the selected ALPN protocol (if any). On return @@ -1867,12 +1969,14 @@ SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data, *data = ssl->s3->alpn_selected; *len = ssl->s3->alpn_selected_len; } +LSSL_ALIAS(SSL_get0_alpn_selected); void SSL_set_psk_use_session_callback(SSL *s, SSL_psk_use_session_cb_func cb) { return; } +LSSL_ALIAS(SSL_set_psk_use_session_callback); int SSL_export_keying_material(SSL *s, unsigned char *out, size_t out_len, @@ -1891,6 +1995,7 @@ SSL_export_keying_material(SSL *s, unsigned char *out, size_t out_len, return tls12_exporter(s, label, label_len, context, context_len, use_context, out, out_len); } +LSSL_ALIAS(SSL_export_keying_material); static unsigned long ssl_session_hash(const SSL_SESSION *a) @@ -2092,6 +2197,7 @@ SSL_CTX_new(const SSL_METHOD *meth) SSL_CTX_free(ret); return (NULL); } +LSSL_ALIAS(SSL_CTX_new); void SSL_CTX_free(SSL_CTX *ctx) @@ -2146,6 +2252,7 @@ SSL_CTX_free(SSL_CTX *ctx) free(ctx); } +LSSL_ALIAS(SSL_CTX_free); int SSL_CTX_up_ref(SSL_CTX *ctx) @@ -2153,30 +2260,35 @@ SSL_CTX_up_ref(SSL_CTX *ctx) int refs = CRYPTO_add(&ctx->references, 1, CRYPTO_LOCK_SSL_CTX); return ((refs > 1) ? 1 : 0); } +LSSL_ALIAS(SSL_CTX_up_ref); pem_password_cb * SSL_CTX_get_default_passwd_cb(SSL_CTX *ctx) { return (ctx->default_passwd_callback); } +LSSL_ALIAS(SSL_CTX_get_default_passwd_cb); void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb) { ctx->default_passwd_callback = cb; } +LSSL_ALIAS(SSL_CTX_set_default_passwd_cb); void * SSL_CTX_get_default_passwd_cb_userdata(SSL_CTX *ctx) { return ctx->default_passwd_callback_userdata; } +LSSL_ALIAS(SSL_CTX_get_default_passwd_cb_userdata); void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u) { ctx->default_passwd_callback_userdata = u; } +LSSL_ALIAS(SSL_CTX_set_default_passwd_cb_userdata); void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, @@ -2185,6 +2297,7 @@ SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, ctx->app_verify_callback = cb; ctx->app_verify_arg = arg; } +LSSL_ALIAS(SSL_CTX_set_cert_verify_callback); void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, int (*cb)(int, X509_STORE_CTX *)) @@ -2192,12 +2305,14 @@ SSL_CTX_set_verify(SSL_CTX *ctx, int mode, int (*cb)(int, X509_STORE_CTX *)) ctx->verify_mode = mode; ctx->default_verify_callback = cb; } +LSSL_ALIAS(SSL_CTX_set_verify); void SSL_CTX_set_verify_depth(SSL_CTX *ctx, int depth) { X509_VERIFY_PARAM_set_depth(ctx->param, depth); } +LSSL_ALIAS(SSL_CTX_set_verify_depth); void ssl_set_cert_masks(SSL_CERT *c, const SSL_CIPHER *cipher) @@ -2478,6 +2593,7 @@ SSL_get_ssl_method(SSL *s) { return (s->method); } +LSSL_ALIAS(SSL_get_ssl_method); int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method) @@ -2504,6 +2620,7 @@ SSL_set_ssl_method(SSL *s, const SSL_METHOD *method) return (ret); } +LSSL_ALIAS(SSL_set_ssl_method); int SSL_get_error(const SSL *s, int i) @@ -2583,6 +2700,7 @@ SSL_get_error(const SSL *s, int i) return (SSL_ERROR_SYSCALL); } +LSSL_ALIAS(SSL_get_error); int SSL_CTX_set_quic_method(SSL_CTX *ctx, const SSL_QUIC_METHOD *quic_method) @@ -2594,6 +2712,7 @@ SSL_CTX_set_quic_method(SSL_CTX *ctx, const SSL_QUIC_METHOD *quic_method) return 1; } +LSSL_ALIAS(SSL_CTX_set_quic_method); int SSL_set_quic_method(SSL *ssl, const SSL_QUIC_METHOD *quic_method) @@ -2605,6 +2724,7 @@ SSL_set_quic_method(SSL *ssl, const SSL_QUIC_METHOD *quic_method) return 1; } +LSSL_ALIAS(SSL_set_quic_method); size_t SSL_quic_max_handshake_flight_len(const SSL *ssl, @@ -2652,18 +2772,21 @@ SSL_quic_max_handshake_flight_len(const SSL *ssl, return 0; } +LSSL_ALIAS(SSL_quic_max_handshake_flight_len); enum ssl_encryption_level_t SSL_quic_read_level(const SSL *ssl) { return ssl->s3->hs.tls13.quic_read_level; } +LSSL_ALIAS(SSL_quic_read_level); enum ssl_encryption_level_t SSL_quic_write_level(const SSL *ssl) { return ssl->s3->hs.tls13.quic_write_level; } +LSSL_ALIAS(SSL_quic_write_level); int SSL_provide_quic_data(SSL *ssl, enum ssl_encryption_level_t level, @@ -2697,6 +2820,7 @@ SSL_provide_quic_data(SSL *ssl, enum ssl_encryption_level_t level, */ return tls_buffer_append(ssl->s3->hs.tls13.quic_read_buffer, data, len); } +LSSL_ALIAS(SSL_provide_quic_data); int SSL_process_quic_post_handshake(SSL *ssl) @@ -2704,6 +2828,7 @@ SSL_process_quic_post_handshake(SSL *ssl) /* XXX - this needs to run PHH received. */ return 1; } +LSSL_ALIAS(SSL_process_quic_post_handshake); int SSL_do_handshake(SSL *s) @@ -2720,6 +2845,7 @@ SSL_do_handshake(SSL *s) return s->handshake_func(s); } +LSSL_ALIAS(SSL_do_handshake); /* * For the next 2 functions, SSL_clear() sets shutdown and so @@ -2734,6 +2860,7 @@ SSL_set_accept_state(SSL *s) s->handshake_func = s->method->ssl_accept; ssl_clear_cipher_state(s); } +LSSL_ALIAS(SSL_set_accept_state); void SSL_set_connect_state(SSL *s) @@ -2744,6 +2871,7 @@ SSL_set_connect_state(SSL *s) s->handshake_func = s->method->ssl_connect; ssl_clear_cipher_state(s); } +LSSL_ALIAS(SSL_set_connect_state); int ssl_undefined_function(SSL *s) @@ -2792,6 +2920,7 @@ SSL_get_version(const SSL *s) { return ssl_version_string(s->version); } +LSSL_ALIAS(SSL_get_version); SSL * SSL_dup(SSL *s) @@ -2915,6 +3044,7 @@ SSL_dup(SSL *s) SSL_free(ret); return NULL; } +LSSL_ALIAS(SSL_dup); void ssl_clear_cipher_state(SSL *s) @@ -2957,6 +3087,7 @@ SSL_get_certificate(const SSL *s) { return (s->cert->key->x509); } +LSSL_ALIAS(SSL_get_certificate); /* Fix this function so that it takes an optional type parameter */ EVP_PKEY * @@ -2964,6 +3095,7 @@ SSL_get_privatekey(const SSL *s) { return (s->cert->key->privatekey); } +LSSL_ALIAS(SSL_get_privatekey); const SSL_CIPHER * SSL_get_current_cipher(const SSL *s) @@ -2972,17 +3104,20 @@ SSL_get_current_cipher(const SSL *s) return (s->session->cipher); return (NULL); } +LSSL_ALIAS(SSL_get_current_cipher); const void * SSL_get_current_compression(SSL *s) { return (NULL); } +LSSL_ALIAS(SSL_get_current_compression); const void * SSL_get_current_expansion(SSL *s) { return (NULL); } +LSSL_ALIAS(SSL_get_current_expansion); size_t SSL_get_client_random(const SSL *s, unsigned char *out, size_t max_out) @@ -2999,6 +3134,7 @@ SSL_get_client_random(const SSL *s, unsigned char *out, size_t max_out) return len; } +LSSL_ALIAS(SSL_get_client_random); size_t SSL_get_server_random(const SSL *s, unsigned char *out, size_t max_out) @@ -3015,6 +3151,7 @@ SSL_get_server_random(const SSL *s, unsigned char *out, size_t max_out) return len; } +LSSL_ALIAS(SSL_get_server_random); int ssl_init_wbio_buffer(SSL *s, int push) @@ -3069,48 +3206,56 @@ SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode) { ctx->quiet_shutdown = mode; } +LSSL_ALIAS(SSL_CTX_set_quiet_shutdown); int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx) { return (ctx->quiet_shutdown); } +LSSL_ALIAS(SSL_CTX_get_quiet_shutdown); void SSL_set_quiet_shutdown(SSL *s, int mode) { s->quiet_shutdown = mode; } +LSSL_ALIAS(SSL_set_quiet_shutdown); int SSL_get_quiet_shutdown(const SSL *s) { return (s->quiet_shutdown); } +LSSL_ALIAS(SSL_get_quiet_shutdown); void SSL_set_shutdown(SSL *s, int mode) { s->shutdown = mode; } +LSSL_ALIAS(SSL_set_shutdown); int SSL_get_shutdown(const SSL *s) { return (s->shutdown); } +LSSL_ALIAS(SSL_get_shutdown); int SSL_version(const SSL *s) { return (s->version); } +LSSL_ALIAS(SSL_version); SSL_CTX * SSL_get_SSL_CTX(const SSL *ssl) { return (ssl->ctx); } +LSSL_ALIAS(SSL_get_SSL_CTX); SSL_CTX * SSL_set_SSL_CTX(SSL *ssl, SSL_CTX* ctx) @@ -3133,12 +3278,14 @@ SSL_set_SSL_CTX(SSL *ssl, SSL_CTX* ctx) return (ssl->ctx); } +LSSL_ALIAS(SSL_set_SSL_CTX); int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx) { return (X509_STORE_set_default_paths(ctx->cert_store)); } +LSSL_ALIAS(SSL_CTX_set_default_verify_paths); int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, @@ -3146,18 +3293,21 @@ SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, { return (X509_STORE_load_locations(ctx->cert_store, CAfile, CApath)); } +LSSL_ALIAS(SSL_CTX_load_verify_locations); int SSL_CTX_load_verify_mem(SSL_CTX *ctx, void *buf, int len) { return (X509_STORE_load_mem(ctx->cert_store, buf, len)); } +LSSL_ALIAS(SSL_CTX_load_verify_mem); void SSL_set_info_callback(SSL *ssl, void (*cb)(const SSL *ssl, int type, int val)) { ssl->info_callback = cb; } +LSSL_ALIAS(SSL_set_info_callback); void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl, int type, int val) { @@ -3169,42 +3319,49 @@ SSL_state(const SSL *ssl) { return (ssl->s3->hs.state); } +LSSL_ALIAS(SSL_state); void SSL_set_state(SSL *ssl, int state) { ssl->s3->hs.state = state; } +LSSL_ALIAS(SSL_set_state); void SSL_set_verify_result(SSL *ssl, long arg) { ssl->verify_result = arg; } +LSSL_ALIAS(SSL_set_verify_result); long SSL_get_verify_result(const SSL *ssl) { return (ssl->verify_result); } +LSSL_ALIAS(SSL_get_verify_result); int SSL_verify_client_post_handshake(SSL *ssl) { return 0; } +LSSL_ALIAS(SSL_verify_client_post_handshake); void SSL_CTX_set_post_handshake_auth(SSL_CTX *ctx, int val) { return; } +LSSL_ALIAS(SSL_CTX_set_post_handshake_auth); void SSL_set_post_handshake_auth(SSL *ssl, int val) { return; } +LSSL_ALIAS(SSL_set_post_handshake_auth); int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, @@ -3213,18 +3370,21 @@ SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, return (CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL, argl, argp, new_func, dup_func, free_func)); } +LSSL_ALIAS(SSL_get_ex_new_index); int SSL_set_ex_data(SSL *s, int idx, void *arg) { return (CRYPTO_set_ex_data(&s->ex_data, idx, arg)); } +LSSL_ALIAS(SSL_set_ex_data); void * SSL_get_ex_data(const SSL *s, int idx) { return (CRYPTO_get_ex_data(&s->ex_data, idx)); } +LSSL_ALIAS(SSL_get_ex_data); int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, @@ -3233,18 +3393,21 @@ SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, return (CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL_CTX, argl, argp, new_func, dup_func, free_func)); } +LSSL_ALIAS(SSL_CTX_get_ex_new_index); int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg) { return (CRYPTO_set_ex_data(&s->ex_data, idx, arg)); } +LSSL_ALIAS(SSL_CTX_set_ex_data); void * SSL_CTX_get_ex_data(const SSL_CTX *s, int idx) { return (CRYPTO_get_ex_data(&s->ex_data, idx)); } +LSSL_ALIAS(SSL_CTX_get_ex_data); int ssl_ok(SSL *s) @@ -3257,6 +3420,7 @@ SSL_CTX_get_cert_store(const SSL_CTX *ctx) { return (ctx->cert_store); } +LSSL_ALIAS(SSL_CTX_get_cert_store); void SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *store) @@ -3264,6 +3428,7 @@ SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *store) X509_STORE_free(ctx->cert_store); ctx->cert_store = store; } +LSSL_ALIAS(SSL_CTX_set_cert_store); X509 * SSL_CTX_get0_certificate(const SSL_CTX *ctx) @@ -3273,6 +3438,7 @@ SSL_CTX_get0_certificate(const SSL_CTX *ctx) return ctx->cert->key->x509; } +LSSL_ALIAS(SSL_CTX_get0_certificate); EVP_PKEY * SSL_CTX_get0_privatekey(const SSL_CTX *ctx) @@ -3282,12 +3448,14 @@ SSL_CTX_get0_privatekey(const SSL_CTX *ctx) return ctx->cert->key->privatekey; } +LSSL_ALIAS(SSL_CTX_get0_privatekey); int SSL_want(const SSL *s) { return (s->rwstate); } +LSSL_ALIAS(SSL_want); void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx, RSA *(*cb)(SSL *ssl, int is_export, @@ -3295,6 +3463,7 @@ SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx, RSA *(*cb)(SSL *ssl, int is_export, { SSL_CTX_callback_ctrl(ctx, SSL_CTRL_SET_TMP_RSA_CB,(void (*)(void))cb); } +LSSL_ALIAS(SSL_CTX_set_tmp_rsa_callback); void SSL_set_tmp_rsa_callback(SSL *ssl, RSA *(*cb)(SSL *ssl, int is_export, @@ -3302,6 +3471,7 @@ SSL_set_tmp_rsa_callback(SSL *ssl, RSA *(*cb)(SSL *ssl, int is_export, { SSL_callback_ctrl(ssl, SSL_CTRL_SET_TMP_RSA_CB,(void (*)(void))cb); } +LSSL_ALIAS(SSL_set_tmp_rsa_callback); void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, DH *(*dh)(SSL *ssl, int is_export, @@ -3309,6 +3479,7 @@ SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, DH *(*dh)(SSL *ssl, int is_export, { SSL_CTX_callback_ctrl(ctx, SSL_CTRL_SET_TMP_DH_CB,(void (*)(void))dh); } +LSSL_ALIAS(SSL_CTX_set_tmp_dh_callback); void SSL_set_tmp_dh_callback(SSL *ssl, DH *(*dh)(SSL *ssl, int is_export, @@ -3316,6 +3487,7 @@ SSL_set_tmp_dh_callback(SSL *ssl, DH *(*dh)(SSL *ssl, int is_export, { SSL_callback_ctrl(ssl, SSL_CTRL_SET_TMP_DH_CB,(void (*)(void))dh); } +LSSL_ALIAS(SSL_set_tmp_dh_callback); void SSL_CTX_set_tmp_ecdh_callback(SSL_CTX *ctx, EC_KEY *(*ecdh)(SSL *ssl, @@ -3324,6 +3496,7 @@ SSL_CTX_set_tmp_ecdh_callback(SSL_CTX *ctx, EC_KEY *(*ecdh)(SSL *ssl, SSL_CTX_callback_ctrl(ctx, SSL_CTRL_SET_TMP_ECDH_CB, (void (*)(void))ecdh); } +LSSL_ALIAS(SSL_CTX_set_tmp_ecdh_callback); void SSL_set_tmp_ecdh_callback(SSL *ssl, EC_KEY *(*ecdh)(SSL *ssl, int is_export, @@ -3331,6 +3504,7 @@ SSL_set_tmp_ecdh_callback(SSL *ssl, EC_KEY *(*ecdh)(SSL *ssl, int is_export, { SSL_callback_ctrl(ssl, SSL_CTRL_SET_TMP_ECDH_CB,(void (*)(void))ecdh); } +LSSL_ALIAS(SSL_set_tmp_ecdh_callback); void @@ -3340,6 +3514,7 @@ SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, SSL_CTX_callback_ctrl(ctx, SSL_CTRL_SET_MSG_CALLBACK, (void (*)(void))cb); } +LSSL_ALIAS(SSL_CTX_set_msg_callback); void SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int version, @@ -3347,24 +3522,28 @@ SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int version, { SSL_callback_ctrl(ssl, SSL_CTRL_SET_MSG_CALLBACK, (void (*)(void))cb); } +LSSL_ALIAS(SSL_set_msg_callback); void SSL_set_debug(SSL *s, int debug) { s->debug = debug; } +LSSL_ALIAS(SSL_set_debug); int SSL_cache_hit(SSL *s) { return (s->hit); } +LSSL_ALIAS(SSL_cache_hit); int SSL_CTX_get_min_proto_version(SSL_CTX *ctx) { return ctx->min_proto_version; } +LSSL_ALIAS(SSL_CTX_get_min_proto_version); int SSL_CTX_set_min_proto_version(SSL_CTX *ctx, uint16_t version) @@ -3373,12 +3552,14 @@ SSL_CTX_set_min_proto_version(SSL_CTX *ctx, uint16_t version) ctx->max_tls_version, &ctx->min_tls_version, &ctx->min_proto_version); } +LSSL_ALIAS(SSL_CTX_set_min_proto_version); int SSL_CTX_get_max_proto_version(SSL_CTX *ctx) { return ctx->max_proto_version; } +LSSL_ALIAS(SSL_CTX_get_max_proto_version); int SSL_CTX_set_max_proto_version(SSL_CTX *ctx, uint16_t version) @@ -3387,12 +3568,14 @@ SSL_CTX_set_max_proto_version(SSL_CTX *ctx, uint16_t version) ctx->min_tls_version, &ctx->max_tls_version, &ctx->max_proto_version); } +LSSL_ALIAS(SSL_CTX_set_max_proto_version); int SSL_get_min_proto_version(SSL *ssl) { return ssl->min_proto_version; } +LSSL_ALIAS(SSL_get_min_proto_version); int SSL_set_min_proto_version(SSL *ssl, uint16_t version) @@ -3401,11 +3584,13 @@ SSL_set_min_proto_version(SSL *ssl, uint16_t version) ssl->max_tls_version, &ssl->min_tls_version, &ssl->min_proto_version); } +LSSL_ALIAS(SSL_set_min_proto_version); int SSL_get_max_proto_version(SSL *ssl) { return ssl->max_proto_version; } +LSSL_ALIAS(SSL_get_max_proto_version); int SSL_set_max_proto_version(SSL *ssl, uint16_t version) @@ -3414,42 +3599,49 @@ SSL_set_max_proto_version(SSL *ssl, uint16_t version) ssl->min_tls_version, &ssl->max_tls_version, &ssl->max_proto_version); } +LSSL_ALIAS(SSL_set_max_proto_version); const SSL_METHOD * SSL_CTX_get_ssl_method(const SSL_CTX *ctx) { return ctx->method; } +LSSL_ALIAS(SSL_CTX_get_ssl_method); int SSL_CTX_get_security_level(const SSL_CTX *ctx) { return ctx->cert->security_level; } +LSSL_ALIAS(SSL_CTX_get_security_level); void SSL_CTX_set_security_level(SSL_CTX *ctx, int level) { ctx->cert->security_level = level; } +LSSL_ALIAS(SSL_CTX_set_security_level); int SSL_get_security_level(const SSL *ssl) { return ssl->cert->security_level; } +LSSL_ALIAS(SSL_get_security_level); void SSL_set_security_level(SSL *ssl, int level) { ssl->cert->security_level = level; } +LSSL_ALIAS(SSL_set_security_level); int SSL_is_quic(const SSL *ssl) { return ssl->quic_method != NULL; } +LSSL_ALIAS(SSL_is_quic); int SSL_set_quic_transport_params(SSL *ssl, const uint8_t *params, @@ -3468,6 +3660,7 @@ SSL_set_quic_transport_params(SSL *ssl, const uint8_t *params, return 1; } +LSSL_ALIAS(SSL_set_quic_transport_params); void SSL_get_peer_quic_transport_params(const SSL *ssl, const uint8_t **out_params, @@ -3476,12 +3669,14 @@ SSL_get_peer_quic_transport_params(const SSL *ssl, const uint8_t **out_params, *out_params = ssl->s3->peer_quic_transport_params; *out_params_len = ssl->s3->peer_quic_transport_params_len; } +LSSL_ALIAS(SSL_get_peer_quic_transport_params); void SSL_set_quic_use_legacy_codepoint(SSL *ssl, int use_legacy) { /* Not supported. */ } +LSSL_ALIAS(SSL_set_quic_use_legacy_codepoint); static int ssl_cipher_id_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) diff --git a/lib/libssl/ssl_methods.c b/lib/libssl/ssl_methods.c index 8e89ef632..ca80da62f 100644 --- a/lib/libssl/ssl_methods.c +++ b/lib/libssl/ssl_methods.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_methods.c,v 1.30 2023/07/06 07:56:32 beck Exp $ */ +/* $OpenBSD: ssl_methods.c,v 1.31 2023/07/08 16:40:13 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -191,54 +191,63 @@ DTLSv1_client_method(void) { return &DTLSv1_client_method_data; } +LSSL_ALIAS(DTLSv1_client_method); const SSL_METHOD * DTLSv1_method(void) { return &DTLSv1_method_data; } +LSSL_ALIAS(DTLSv1_method); const SSL_METHOD * DTLSv1_server_method(void) { return &DTLSv1_method_data; } +LSSL_ALIAS(DTLSv1_server_method); const SSL_METHOD * DTLSv1_2_client_method(void) { return &DTLSv1_2_client_method_data; } +LSSL_ALIAS(DTLSv1_2_client_method); const SSL_METHOD * DTLSv1_2_method(void) { return &DTLSv1_2_method_data; } +LSSL_ALIAS(DTLSv1_2_method); const SSL_METHOD * DTLSv1_2_server_method(void) { return &DTLSv1_2_method_data; } +LSSL_ALIAS(DTLSv1_2_server_method); const SSL_METHOD * DTLS_client_method(void) { return &DTLS_client_method_data; } +LSSL_ALIAS(DTLS_client_method); const SSL_METHOD * DTLS_method(void) { return &DTLS_method_data; } +LSSL_ALIAS(DTLS_method); const SSL_METHOD * DTLS_server_method(void) { return &DTLS_method_data; } +LSSL_ALIAS(DTLS_server_method); static const SSL_METHOD TLS_method_data = { .dtls = 0, @@ -434,18 +443,21 @@ TLS_client_method(void) { return (&TLS_client_method_data); } +LSSL_ALIAS(TLS_client_method); const SSL_METHOD * TLS_method(void) { return (&TLS_method_data); } +LSSL_ALIAS(TLS_method); const SSL_METHOD * TLS_server_method(void) { return TLS_method(); } +LSSL_ALIAS(TLS_server_method); const SSL_METHOD * tls_legacy_method(void) @@ -458,72 +470,84 @@ SSLv23_client_method(void) { return TLS_client_method(); } +LSSL_ALIAS(SSLv23_client_method); const SSL_METHOD * SSLv23_method(void) { return TLS_method(); } +LSSL_ALIAS(SSLv23_method); const SSL_METHOD * SSLv23_server_method(void) { return TLS_method(); } +LSSL_ALIAS(SSLv23_server_method); const SSL_METHOD * TLSv1_client_method(void) { return (&TLSv1_client_method_data); } +LSSL_ALIAS(TLSv1_client_method); const SSL_METHOD * TLSv1_method(void) { return (&TLSv1_method_data); } +LSSL_ALIAS(TLSv1_method); const SSL_METHOD * TLSv1_server_method(void) { return (&TLSv1_method_data); } +LSSL_ALIAS(TLSv1_server_method); const SSL_METHOD * TLSv1_1_client_method(void) { return (&TLSv1_1_client_method_data); } +LSSL_ALIAS(TLSv1_1_client_method); const SSL_METHOD * TLSv1_1_method(void) { return (&TLSv1_1_method_data); } +LSSL_ALIAS(TLSv1_1_method); const SSL_METHOD * TLSv1_1_server_method(void) { return (&TLSv1_1_method_data); } +LSSL_ALIAS(TLSv1_1_server_method); const SSL_METHOD * TLSv1_2_client_method(void) { return (&TLSv1_2_client_method_data); } +LSSL_ALIAS(TLSv1_2_client_method); const SSL_METHOD * TLSv1_2_method(void) { return (&TLSv1_2_method_data); } +LSSL_ALIAS(TLSv1_2_method); const SSL_METHOD * TLSv1_2_server_method(void) { return (&TLSv1_2_method_data); } +LSSL_ALIAS(TLSv1_2_server_method); const SSL_METHOD * ssl_get_method(uint16_t version) diff --git a/lib/libssl/ssl_rsa.c b/lib/libssl/ssl_rsa.c index f84315ba3..68137bc5f 100644 --- a/lib/libssl/ssl_rsa.c +++ b/lib/libssl/ssl_rsa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_rsa.c,v 1.49 2022/11/26 16:08:56 tb Exp $ */ +/* $OpenBSD: ssl_rsa.c,v 1.50 2023/07/08 16:40:13 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -83,6 +83,7 @@ SSL_use_certificate(SSL *ssl, X509 *x) } return ssl_set_cert(NULL, ssl, x); } +LSSL_ALIAS(SSL_use_certificate); int SSL_use_certificate_file(SSL *ssl, const char *file, int type) @@ -126,6 +127,7 @@ SSL_use_certificate_file(SSL *ssl, const char *file, int type) BIO_free(in); return (ret); } +LSSL_ALIAS(SSL_use_certificate_file); int SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len) @@ -143,6 +145,7 @@ SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len) X509_free(x); return (ret); } +LSSL_ALIAS(SSL_use_certificate_ASN1); int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa) @@ -166,6 +169,7 @@ SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa) EVP_PKEY_free(pkey); return (ret); } +LSSL_ALIAS(SSL_use_RSAPrivateKey); static int ssl_set_pkey(SSL_CTX *ctx, SSL *ssl, EVP_PKEY *pkey) @@ -259,6 +263,7 @@ SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type) BIO_free(in); return (ret); } +LSSL_ALIAS(SSL_use_RSAPrivateKey_file); int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, const unsigned char *d, long len) @@ -275,6 +280,7 @@ SSL_use_RSAPrivateKey_ASN1(SSL *ssl, const unsigned char *d, long len) RSA_free(rsa); return (ret); } +LSSL_ALIAS(SSL_use_RSAPrivateKey_ASN1); int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey) @@ -288,6 +294,7 @@ SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey) ret = ssl_set_pkey(NULL, ssl, pkey); return (ret); } +LSSL_ALIAS(SSL_use_PrivateKey); int SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type) @@ -328,6 +335,7 @@ SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type) BIO_free(in); return (ret); } +LSSL_ALIAS(SSL_use_PrivateKey_file); int SSL_use_PrivateKey_ASN1(int type, SSL *ssl, const unsigned char *d, long len) @@ -344,6 +352,7 @@ SSL_use_PrivateKey_ASN1(int type, SSL *ssl, const unsigned char *d, long len) EVP_PKEY_free(pkey); return (ret); } +LSSL_ALIAS(SSL_use_PrivateKey_ASN1); int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x) @@ -354,6 +363,7 @@ SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x) } return ssl_set_cert(ctx, NULL, x); } +LSSL_ALIAS(SSL_CTX_use_certificate); static int ssl_get_password_cb_and_arg(SSL_CTX *ctx, SSL *ssl, @@ -475,6 +485,7 @@ SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type) BIO_free(in); return (ret); } +LSSL_ALIAS(SSL_CTX_use_certificate_file); int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, const unsigned char *d) @@ -492,6 +503,7 @@ SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, const unsigned char *d) X509_free(x); return (ret); } +LSSL_ALIAS(SSL_CTX_use_certificate_ASN1); int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa) @@ -515,6 +527,7 @@ SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa) EVP_PKEY_free(pkey); return (ret); } +LSSL_ALIAS(SSL_CTX_use_RSAPrivateKey); int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type) @@ -555,6 +568,7 @@ SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type) BIO_free(in); return (ret); } +LSSL_ALIAS(SSL_CTX_use_RSAPrivateKey_file); int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len) @@ -571,6 +585,7 @@ SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len) RSA_free(rsa); return (ret); } +LSSL_ALIAS(SSL_CTX_use_RSAPrivateKey_ASN1); int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey) @@ -581,6 +596,7 @@ SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey) } return ssl_set_pkey(ctx, NULL, pkey); } +LSSL_ALIAS(SSL_CTX_use_PrivateKey); int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type) @@ -621,6 +637,7 @@ SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type) BIO_free(in); return (ret); } +LSSL_ALIAS(SSL_CTX_use_PrivateKey_file); int SSL_CTX_use_PrivateKey_ASN1(int type, SSL_CTX *ctx, const unsigned char *d, @@ -638,6 +655,7 @@ SSL_CTX_use_PrivateKey_ASN1(int type, SSL_CTX *ctx, const unsigned char *d, EVP_PKEY_free(pkey); return (ret); } +LSSL_ALIAS(SSL_CTX_use_PrivateKey_ASN1); /* @@ -721,12 +739,14 @@ SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file) { return ssl_use_certificate_chain_file(ctx, NULL, file); } +LSSL_ALIAS(SSL_CTX_use_certificate_chain_file); int SSL_use_certificate_chain_file(SSL *ssl, const char *file) { return ssl_use_certificate_chain_file(NULL, ssl, file); } +LSSL_ALIAS(SSL_use_certificate_chain_file); int SSL_CTX_use_certificate_chain_mem(SSL_CTX *ctx, void *buf, int len) @@ -746,3 +766,4 @@ SSL_CTX_use_certificate_chain_mem(SSL_CTX *ctx, void *buf, int len) BIO_free(in); return (ret); } +LSSL_ALIAS(SSL_CTX_use_certificate_chain_mem); diff --git a/lib/libssl/ssl_sess.c b/lib/libssl/ssl_sess.c index 5847a43dc..aa6b08eae 100644 --- a/lib/libssl/ssl_sess.c +++ b/lib/libssl/ssl_sess.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_sess.c,v 1.121 2022/11/26 16:08:56 tb Exp $ */ +/* $OpenBSD: ssl_sess.c,v 1.122 2023/07/08 16:40:13 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -154,6 +154,7 @@ SSL_get_session(const SSL *ssl) { return (ssl->session); } +LSSL_ALIAS(SSL_get_session); /* variant of SSL_get_session: caller really gets something */ SSL_SESSION * @@ -174,6 +175,7 @@ SSL_get1_session(SSL *ssl) return (sess); } +LSSL_ALIAS(SSL_get1_session); int SSL_SESSION_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, @@ -182,30 +184,35 @@ SSL_SESSION_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL_SESSION, argl, argp, new_func, dup_func, free_func); } +LSSL_ALIAS(SSL_SESSION_get_ex_new_index); int SSL_SESSION_set_ex_data(SSL_SESSION *s, int idx, void *arg) { return (CRYPTO_set_ex_data(&s->ex_data, idx, arg)); } +LSSL_ALIAS(SSL_SESSION_set_ex_data); void * SSL_SESSION_get_ex_data(const SSL_SESSION *s, int idx) { return (CRYPTO_get_ex_data(&s->ex_data, idx)); } +LSSL_ALIAS(SSL_SESSION_get_ex_data); uint32_t SSL_SESSION_get_max_early_data(const SSL_SESSION *s) { return 0; } +LSSL_ALIAS(SSL_SESSION_get_max_early_data); int SSL_SESSION_set_max_early_data(SSL_SESSION *s, uint32_t max_early_data) { return 1; } +LSSL_ALIAS(SSL_SESSION_set_max_early_data); SSL_SESSION * SSL_SESSION_new(void) @@ -241,6 +248,7 @@ SSL_SESSION_new(void) return (ss); } +LSSL_ALIAS(SSL_SESSION_new); SSL_SESSION * ssl_session_dup(SSL_SESSION *sess, int include_ticket) @@ -354,6 +362,7 @@ SSL_SESSION_get_id(const SSL_SESSION *ss, unsigned int *len) *len = (unsigned int)ss->session_id_length; return ss->session_id; } +LSSL_ALIAS(SSL_SESSION_get_id); const unsigned char * SSL_SESSION_get0_id_context(const SSL_SESSION *ss, unsigned int *len) @@ -362,24 +371,28 @@ SSL_SESSION_get0_id_context(const SSL_SESSION *ss, unsigned int *len) *len = (unsigned int)ss->sid_ctx_length; return ss->sid_ctx; } +LSSL_ALIAS(SSL_SESSION_get0_id_context); unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *ss) { return 0; } +LSSL_ALIAS(SSL_SESSION_get_compress_id); unsigned long SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *s) { return s->tlsext_tick_lifetime_hint; } +LSSL_ALIAS(SSL_SESSION_get_ticket_lifetime_hint); int SSL_SESSION_has_ticket(const SSL_SESSION *s) { return (s->tlsext_ticklen > 0) ? 1 : 0; } +LSSL_ALIAS(SSL_SESSION_has_ticket); /* * SSLv3/TLSv1 has 32 bytes (256 bits) of session ID space. As such, filling @@ -815,12 +828,14 @@ SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *c) CRYPTO_w_unlock(CRYPTO_LOCK_SSL_CTX); return (ret); } +LSSL_ALIAS(SSL_CTX_add_session); int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) { return remove_session_lock(ctx, c, 1); } +LSSL_ALIAS(SSL_CTX_remove_session); static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) @@ -881,6 +896,7 @@ SSL_SESSION_free(SSL_SESSION *ss) freezero(ss, sizeof(*ss)); } +LSSL_ALIAS(SSL_SESSION_free); int SSL_SESSION_up_ref(SSL_SESSION *ss) @@ -888,6 +904,7 @@ SSL_SESSION_up_ref(SSL_SESSION *ss) int refs = CRYPTO_add(&ss->references, 1, CRYPTO_LOCK_SSL_SESSION); return (refs > 1) ? 1 : 0; } +LSSL_ALIAS(SSL_SESSION_up_ref); int SSL_set_session(SSL *s, SSL_SESSION *session) @@ -916,6 +933,7 @@ SSL_set_session(SSL *s, SSL_SESSION *session) return (1); } +LSSL_ALIAS(SSL_set_session); size_t SSL_SESSION_get_master_key(const SSL_SESSION *ss, unsigned char *out, @@ -933,6 +951,7 @@ SSL_SESSION_get_master_key(const SSL_SESSION *ss, unsigned char *out, return len; } +LSSL_ALIAS(SSL_SESSION_get_master_key); long SSL_SESSION_set_timeout(SSL_SESSION *s, long t) @@ -942,6 +961,7 @@ SSL_SESSION_set_timeout(SSL_SESSION *s, long t) s->timeout = t; return (1); } +LSSL_ALIAS(SSL_SESSION_set_timeout); long SSL_SESSION_get_timeout(const SSL_SESSION *s) @@ -950,6 +970,7 @@ SSL_SESSION_get_timeout(const SSL_SESSION *s) return (0); return (s->timeout); } +LSSL_ALIAS(SSL_SESSION_get_timeout); /* XXX 2038 */ long @@ -959,6 +980,7 @@ SSL_SESSION_get_time(const SSL_SESSION *s) return (0); return (s->time); } +LSSL_ALIAS(SSL_SESSION_get_time); /* XXX 2038 */ long @@ -969,24 +991,28 @@ SSL_SESSION_set_time(SSL_SESSION *s, long t) s->time = t; return (t); } +LSSL_ALIAS(SSL_SESSION_set_time); int SSL_SESSION_get_protocol_version(const SSL_SESSION *s) { return s->ssl_version; } +LSSL_ALIAS(SSL_SESSION_get_protocol_version); const SSL_CIPHER * SSL_SESSION_get0_cipher(const SSL_SESSION *s) { return s->cipher; } +LSSL_ALIAS(SSL_SESSION_get0_cipher); X509 * SSL_SESSION_get0_peer(SSL_SESSION *s) { return s->peer_cert; } +LSSL_ALIAS(SSL_SESSION_get0_peer); int SSL_SESSION_set1_id(SSL_SESSION *s, const unsigned char *sid, @@ -1000,6 +1026,7 @@ SSL_SESSION_set1_id(SSL_SESSION *s, const unsigned char *sid, memmove(s->session_id, sid, sid_len); return 1; } +LSSL_ALIAS(SSL_SESSION_set1_id); int SSL_SESSION_set1_id_context(SSL_SESSION *s, const unsigned char *sid_ctx, @@ -1014,12 +1041,14 @@ SSL_SESSION_set1_id_context(SSL_SESSION *s, const unsigned char *sid_ctx, return 1; } +LSSL_ALIAS(SSL_SESSION_set1_id_context); int SSL_SESSION_is_resumable(const SSL_SESSION *s) { return 0; } +LSSL_ALIAS(SSL_SESSION_is_resumable); long SSL_CTX_set_timeout(SSL_CTX *s, long t) @@ -1033,6 +1062,7 @@ SSL_CTX_set_timeout(SSL_CTX *s, long t) return (l); } +LSSL_ALIAS(SSL_CTX_set_timeout); long SSL_CTX_get_timeout(const SSL_CTX *s) @@ -1041,6 +1071,7 @@ SSL_CTX_get_timeout(const SSL_CTX *s) return (0); return (s->session_timeout); } +LSSL_ALIAS(SSL_CTX_get_timeout); int SSL_set_session_secret_cb(SSL *s, int (*tls_session_secret_cb)(SSL *s, @@ -1053,6 +1084,7 @@ SSL_set_session_secret_cb(SSL *s, int (*tls_session_secret_cb)(SSL *s, s->tls_session_secret_cb_arg = arg; return (1); } +LSSL_ALIAS(SSL_set_session_secret_cb); int SSL_set_session_ticket_ext_cb(SSL *s, tls_session_ticket_ext_cb_fn cb, @@ -1064,6 +1096,7 @@ SSL_set_session_ticket_ext_cb(SSL *s, tls_session_ticket_ext_cb_fn cb, s->tls_session_ticket_ext_cb_arg = arg; return (1); } +LSSL_ALIAS(SSL_set_session_ticket_ext_cb); int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len) @@ -1093,6 +1126,7 @@ SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len) return 0; } +LSSL_ALIAS(SSL_set_session_ticket_ext); typedef struct timeout_param_st { SSL_CTX *ctx; @@ -1145,6 +1179,7 @@ SSL_CTX_flush_sessions(SSL_CTX *s, long t) CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load = i; CRYPTO_w_unlock(CRYPTO_LOCK_SSL_CTX); } +LSSL_ALIAS(SSL_CTX_flush_sessions); int ssl_clear_bad_session(SSL *s) @@ -1214,12 +1249,14 @@ SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, int (*cb)(struct ssl_st *ssl, SSL_SESSION *sess)) { ctx->new_session_cb = cb; } +LSSL_ALIAS(SSL_CTX_sess_set_new_cb); int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))(SSL *ssl, SSL_SESSION *sess) { return ctx->new_session_cb; } +LSSL_ALIAS(SSL_CTX_sess_get_new_cb); void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, @@ -1227,12 +1264,14 @@ SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, { ctx->remove_session_cb = cb; } +LSSL_ALIAS(SSL_CTX_sess_set_remove_cb); void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))(SSL_CTX * ctx, SSL_SESSION *sess) { return ctx->remove_session_cb; } +LSSL_ALIAS(SSL_CTX_sess_get_remove_cb); void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, SSL_SESSION *(*cb)(struct ssl_st *ssl, @@ -1240,6 +1279,7 @@ SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, SSL_SESSION *(*cb)(struct ssl_st *ssl, { ctx->get_session_cb = cb; } +LSSL_ALIAS(SSL_CTX_sess_set_get_cb); SSL_SESSION * (*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(SSL *ssl, const unsigned char *data, @@ -1247,6 +1287,7 @@ SSL_SESSION * { return ctx->get_session_cb; } +LSSL_ALIAS(SSL_CTX_sess_get_get_cb); void SSL_CTX_set_info_callback(SSL_CTX *ctx, @@ -1254,12 +1295,14 @@ SSL_CTX_set_info_callback(SSL_CTX *ctx, { ctx->info_callback = cb; } +LSSL_ALIAS(SSL_CTX_set_info_callback); void (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(const SSL *ssl, int type, int val) { return ctx->info_callback; } +LSSL_ALIAS(SSL_CTX_get_info_callback); void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, @@ -1267,6 +1310,7 @@ SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, { ctx->client_cert_cb = cb; } +LSSL_ALIAS(SSL_CTX_set_client_cert_cb); int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(SSL * ssl, X509 ** x509, @@ -1274,6 +1318,7 @@ int { return ctx->client_cert_cb; } +LSSL_ALIAS(SSL_CTX_get_client_cert_cb); #ifndef OPENSSL_NO_ENGINE int @@ -1291,6 +1336,7 @@ SSL_CTX_set_client_cert_engine(SSL_CTX *ctx, ENGINE *e) ctx->client_cert_engine = e; return 1; } +LSSL_ALIAS(SSL_CTX_set_client_cert_engine); #endif void @@ -1299,6 +1345,7 @@ SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx, { ctx->app_gen_cookie_cb = cb; } +LSSL_ALIAS(SSL_CTX_set_cookie_generate_cb); void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, @@ -1306,6 +1353,7 @@ SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, { ctx->app_verify_cookie_cb = cb; } +LSSL_ALIAS(SSL_CTX_set_cookie_verify_cb); int PEM_write_SSL_SESSION(FILE *fp, SSL_SESSION *x) @@ -1313,6 +1361,7 @@ PEM_write_SSL_SESSION(FILE *fp, SSL_SESSION *x) return PEM_ASN1_write((i2d_of_void *)i2d_SSL_SESSION, PEM_STRING_SSL_SESSION, fp, x, NULL, NULL, 0, NULL, NULL); } +LSSL_ALIAS(PEM_write_SSL_SESSION); SSL_SESSION * PEM_read_SSL_SESSION(FILE *fp, SSL_SESSION **x, pem_password_cb *cb, void *u) @@ -1320,6 +1369,7 @@ PEM_read_SSL_SESSION(FILE *fp, SSL_SESSION **x, pem_password_cb *cb, void *u) return PEM_ASN1_read((d2i_of_void *)d2i_SSL_SESSION, PEM_STRING_SSL_SESSION, fp, (void **)x, cb, u); } +LSSL_ALIAS(PEM_read_SSL_SESSION); SSL_SESSION * PEM_read_bio_SSL_SESSION(BIO *bp, SSL_SESSION **x, pem_password_cb *cb, void *u) @@ -1327,6 +1377,7 @@ PEM_read_bio_SSL_SESSION(BIO *bp, SSL_SESSION **x, pem_password_cb *cb, void *u) return PEM_ASN1_read_bio((d2i_of_void *)d2i_SSL_SESSION, PEM_STRING_SSL_SESSION, bp, (void **)x, cb, u); } +LSSL_ALIAS(PEM_read_bio_SSL_SESSION); int PEM_write_bio_SSL_SESSION(BIO *bp, SSL_SESSION *x) @@ -1334,3 +1385,4 @@ PEM_write_bio_SSL_SESSION(BIO *bp, SSL_SESSION *x) return PEM_ASN1_write_bio((i2d_of_void *)i2d_SSL_SESSION, PEM_STRING_SSL_SESSION, bp, x, NULL, NULL, 0, NULL, NULL); } +LSSL_ALIAS(PEM_write_bio_SSL_SESSION); diff --git a/lib/libssl/ssl_srvr.c b/lib/libssl/ssl_srvr.c index 8edbf7715..a518e1ac9 100644 --- a/lib/libssl/ssl_srvr.c +++ b/lib/libssl/ssl_srvr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_srvr.c,v 1.155 2023/06/11 19:01:01 tb Exp $ */ +/* $OpenBSD: ssl_srvr.c,v 1.156 2023/07/08 16:40:13 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -1832,8 +1832,10 @@ ssl3_get_client_kex_gost(SSL *s, CBS *cbs) CBS gostblob; /* Get our certificate private key*/ +#ifndef OPENSSL_NO_GOST if ((s->s3->hs.cipher->algorithm_auth & SSL_aGOST01) != 0) pkey = s->cert->pkeys[SSL_PKEY_GOST01].privatekey; +#endif if ((pkey_ctx = EVP_PKEY_CTX_new(pkey, NULL)) == NULL) goto err; @@ -2047,6 +2049,7 @@ ssl3_get_cert_verify(SSL *s) al = SSL_AD_INTERNAL_ERROR; goto fatal_err; } +#ifndef OPENSSL_NO_GOST if (sigalg->key_type == EVP_PKEY_GOSTR01 && EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_VERIFY, EVP_PKEY_CTRL_GOST_SIG_FORMAT, GOST_SIG_FORMAT_RS_LE, @@ -2054,6 +2057,7 @@ ssl3_get_cert_verify(SSL *s) al = SSL_AD_INTERNAL_ERROR; goto fatal_err; } +#endif if (EVP_DigestVerify(mctx, CBS_data(&signature), CBS_len(&signature), hdata, hdatalen) <= 0) { SSLerror(s, ERR_R_EVP_LIB); diff --git a/lib/libssl/ssl_stat.c b/lib/libssl/ssl_stat.c index b423033e4..803b83bb9 100644 --- a/lib/libssl/ssl_stat.c +++ b/lib/libssl/ssl_stat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_stat.c,v 1.20 2022/11/26 16:08:56 tb Exp $ */ +/* $OpenBSD: ssl_stat.c,v 1.21 2023/07/08 16:40:13 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -319,6 +319,7 @@ SSL_state_string_long(const SSL *s) } return (str); } +LSSL_ALIAS(SSL_state_string_long); const char * SSL_rstate_string_long(const SSL *s) @@ -341,6 +342,7 @@ SSL_rstate_string_long(const SSL *s) } return (str); } +LSSL_ALIAS(SSL_rstate_string_long); const char * SSL_state_string(const SSL *s) @@ -547,6 +549,7 @@ SSL_state_string(const SSL *s) } return (str); } +LSSL_ALIAS(SSL_state_string); const char * SSL_alert_type_string_long(int value) @@ -559,6 +562,7 @@ SSL_alert_type_string_long(int value) else return ("unknown"); } +LSSL_ALIAS(SSL_alert_type_string_long); const char * SSL_alert_type_string(int value) @@ -571,6 +575,7 @@ SSL_alert_type_string(int value) else return ("U"); } +LSSL_ALIAS(SSL_alert_type_string); const char * SSL_alert_desc_string(int value) @@ -668,6 +673,7 @@ SSL_alert_desc_string(int value) } return (str); } +LSSL_ALIAS(SSL_alert_desc_string); const char * SSL_alert_desc_string_long(int value) @@ -765,6 +771,7 @@ SSL_alert_desc_string_long(int value) } return (str); } +LSSL_ALIAS(SSL_alert_desc_string_long); const char * SSL_rstate_string(const SSL *s) @@ -787,3 +794,4 @@ SSL_rstate_string(const SSL *s) } return (str); } +LSSL_ALIAS(SSL_rstate_string); diff --git a/lib/libssl/ssl_txt.c b/lib/libssl/ssl_txt.c index 270e60a38..ee3d218d6 100644 --- a/lib/libssl/ssl_txt.c +++ b/lib/libssl/ssl_txt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_txt.c,v 1.36 2022/11/26 16:08:56 tb Exp $ */ +/* $OpenBSD: ssl_txt.c,v 1.37 2023/07/08 16:40:13 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -103,6 +103,7 @@ SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *x) BIO_free(b); return ret; } +LSSL_ALIAS(SSL_SESSION_print_fp); int SSL_SESSION_print(BIO *bp, const SSL_SESSION *x) @@ -197,3 +198,4 @@ SSL_SESSION_print(BIO *bp, const SSL_SESSION *x) err: return ret; } +LSSL_ALIAS(SSL_SESSION_print); diff --git a/lib/libssl/tls12_record_layer.c b/lib/libssl/tls12_record_layer.c index 59f5d3245..997026be9 100644 --- a/lib/libssl/tls12_record_layer.c +++ b/lib/libssl/tls12_record_layer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tls12_record_layer.c,v 1.38 2022/11/26 16:08:56 tb Exp $ */ +/* $OpenBSD: tls12_record_layer.c,v 1.40 2023/07/08 20:38:23 beck Exp $ */ /* * Copyright (c) 2020 Joel Sing * @@ -485,6 +485,8 @@ tls12_record_layer_ccs_cipher(struct tls12_record_layer *rl, if (EVP_CIPHER_key_length(rl->cipher) != CBS_len(key)) goto err; +#ifndef OPENSSL_NO_GOST + /* XXX die die die */ /* Special handling for GOST... */ if (EVP_MD_type(rl->mac_hash) == NID_id_Gost28147_89_MAC) { if (CBS_len(mac_key) != 32) @@ -492,11 +494,14 @@ tls12_record_layer_ccs_cipher(struct tls12_record_layer *rl, mac_type = EVP_PKEY_GOSTIMIT; rp->stream_mac = 1; } else { +#endif if (CBS_len(mac_key) > INT_MAX) goto err; if (EVP_MD_size(rl->mac_hash) != CBS_len(mac_key)) goto err; +#ifndef OPENSSL_NO_GOST } +#endif if ((rp->cipher_ctx = EVP_CIPHER_CTX_new()) == NULL) goto err; diff --git a/libexec/ld.so/.resolve.c.swp b/libexec/ld.so/.resolve.c.swp new file mode 100644 index 000000000..e69de29bb diff --git a/libexec/ld.so/Makefile b/libexec/ld.so/Makefile index c58213954..a90c15150 100644 --- a/libexec/ld.so/Makefile +++ b/libexec/ld.so/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.84 2023/02/18 01:22:50 deraadt Exp $ +# $OpenBSD: Makefile,v 1.85 2023/07/08 11:03:45 jasper Exp $ SUBDIR=ldconfig ldd MAN= ld.so.1 @@ -29,7 +29,7 @@ SRCS+= malloc.c reallocarray.c tib.c ffs.c syscall=close exit fstat getdents getentropy getthrid issetugid kbind \ mimmutable mmap mprotect munmap msyscall open pledge pinsyscall \ - read __realpath sendsyslog __set_tcb sysctl thrkill utrace write \ + read __realpath sendsyslog __set_tcb sysctl thrkill utrace write .if (${MACHINE_ARCH} == "i386") syscall+=mquery diff --git a/libexec/ld.so/aarch64/ldasm.S b/libexec/ld.so/aarch64/ldasm.S index 451888522..6ed729473 100644 --- a/libexec/ld.so/aarch64/ldasm.S +++ b/libexec/ld.so/aarch64/ldasm.S @@ -1,4 +1,4 @@ -/* $OpenBSD: ldasm.S,v 1.10 2023/04/24 22:06:05 kettenis Exp $ */ +/* $OpenBSD: ldasm.S,v 1.11 2023/07/08 14:09:43 jasper Exp $ */ /* * Copyright (c) 2016 Dale Rahn diff --git a/libexec/ld.so/dlfcn.c b/libexec/ld.so/dlfcn.c index 7987f91d7..3b3dbdb83 100644 --- a/libexec/ld.so/dlfcn.c +++ b/libexec/ld.so/dlfcn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dlfcn.c,v 1.113 2022/11/09 18:44:11 deraadt Exp $ */ +/* $OpenBSD: dlfcn.c,v 1.114 2023/07/08 14:09:43 jasper Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c index 01742b94e..7a32013d9 100644 --- a/libexec/ld.so/loader.c +++ b/libexec/ld.so/loader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: loader.c,v 1.212 2023/02/20 00:51:57 gnezdo Exp $ */ +/* $OpenBSD: loader.c,v 1.213 2023/07/08 14:09:43 jasper Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB diff --git a/libexec/ld.so/resolve.c b/libexec/ld.so/resolve.c index f3000100f..191634115 100644 --- a/libexec/ld.so/resolve.c +++ b/libexec/ld.so/resolve.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resolve.c,v 1.99 2023/04/13 19:57:30 millert Exp $ */ +/* $OpenBSD: resolve.c,v 1.100 2023/07/08 14:09:43 jasper Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -275,10 +275,9 @@ _dl_finalize_object(const char *objname, Elf_Dyn *dynp, Elf_Phdr *phdrp, elf_object_t *object; Elf_Addr gnu_hash = 0; -#if 0 - _dl_printf("objname [%s], dynp %p, objtype %x lbase %lx, obase %lx\n", - objname, dynp, objtype, lbase, obase); -#endif + DL_DEB(("objname [%s], dynp %p, objtype %x lbase %lx, obase %lx\n", + objname, dynp, objtype, lbase, obase)); + object = _dl_calloc(1, sizeof(elf_object_t)); if (object == NULL) _dl_oom(); diff --git a/libexec/login_ldap/aldap.c b/libexec/login_ldap/aldap.c index d5f5769f5..74a43520a 100644 --- a/libexec/login_ldap/aldap.c +++ b/libexec/login_ldap/aldap.c @@ -265,9 +265,9 @@ aldap_search(struct aldap *ldap, char *basedn, enum scope scope, char *filter, goto fail; } - c = ber; + c = ber; ber = ober_printf_elements(ber, "sEEddb", basedn, (long long)scope, - (long long)LDAP_DEREF_NEVER, sizelimit, + (long long)LDAP_DEREF_NEVER, sizelimit, timelimit, typesonly); if (ber == NULL) { ldap->err = ALDAP_ERR_OPERATION_FAILED; @@ -339,7 +339,7 @@ aldap_create_page_control(struct ber_element *elm, int size, fail: if (ber != NULL) ober_free_elements(ber); - ober_free(&c); + ober_free(&c); return (-1); } @@ -451,7 +451,7 @@ parsefail: } struct aldap_page_control * -aldap_parse_page_control(struct ber_element *control, size_t len) +aldap_parse_page_control(struct ber_element *control, size_t len) { char *oid, *s; char *encoded; diff --git a/libexec/login_ldap/aldap.h b/libexec/login_ldap/aldap.h index af594caab..707fca3c5 100644 --- a/libexec/login_ldap/aldap.h +++ b/libexec/login_ldap/aldap.h @@ -77,7 +77,7 @@ struct aldap_message { } search; } body; struct ber_element *references; - struct aldap_page_control *page; + struct aldap_page_control *page; }; enum aldap_protocol { diff --git a/libexec/login_ldap/login_ldap.c b/libexec/login_ldap/login_ldap.c index 83de3b945..5f3243fd0 100644 --- a/libexec/login_ldap/login_ldap.c +++ b/libexec/login_ldap/login_ldap.c @@ -246,7 +246,7 @@ auth_ldap(char *user, char *class, char *pass) } dlog(1, "group filter matched!"); } - + if (ctx.basedn != NULL) { if (!bind_password(&ctx, ctx.userdn, pass)) { diff --git a/libexec/login_token/tokendb.h b/libexec/login_token/tokendb.h index 4dac2aef0..7bd368a10 100644 --- a/libexec/login_token/tokendb.h +++ b/libexec/login_token/tokendb.h @@ -35,7 +35,7 @@ */ /* - * Structure defining a record for a user. All fields + * Structure defining a record for a user. All fields * stored in ascii to facilitate backup/reconstruction. * A null byte is required after the share secret field. */ @@ -68,7 +68,7 @@ typedef struct { #define TOKEN_GROUP "_token" /* group that owns token database */ /* - * Function prototypes for routines which manipulate the + * Function prototypes for routines which manipulate the * database for the token. These routines have no knowledge * of DES or encryption. However, they will manipulate the * flags field of the database record with complete abandon. diff --git a/libexec/snmpd/snmpd_metrics/mib.c b/libexec/snmpd/snmpd_metrics/mib.c index 0846307f5..5659901fc 100644 --- a/libexec/snmpd/snmpd_metrics/mib.c +++ b/libexec/snmpd/snmpd_metrics/mib.c @@ -1170,12 +1170,12 @@ mib_ifrcvtable(struct agentx_varbind *vb) } /* - * Defined in + * Defined in * - OPENBSD-PF-MIB.txt * - OPENBSD-SENSORS-MIB.txt * - OPENBSD-CARP-MIB.txt * (http://www.packetmischief.ca/openbsd-snmp-mibs/) - */ + */ #define OIDVER_OPENBSD_MEM 1 struct carpif { @@ -1466,7 +1466,7 @@ mib_pftimeouts(struct agentx_varbind *vb) pt.timeout = PFTM_SRC_NODE; else fatal("%s: Unexpected object", __func__); - + if (ioctl(devpf, DIOCGETTIMEOUT, &pt) == -1) { log_warn("DIOCGETTIMEOUT"); agentx_varbind_error(vb); @@ -1699,7 +1699,7 @@ mib_pftableaddrs(struct agentx_varbind *vb) as.pfras_a.pfra_net = agentx_varbind_get_index_integer(vb, pfTblAddrMaskIdx); - if (pfta_get_nextaddr(&as, &tblidx)){ + if (pfta_get_nextaddr(&as, &tblidx)){ agentx_varbind_notfound(vb); return; } @@ -2063,7 +2063,7 @@ static const char * const sensor_drive_s[SENSOR_DRIVE_STATES] = { static const char * const sensor_unit_s[SENSOR_MAX_TYPES + 1] = { "degC", "RPM", "V DC", "V AC", "Ohm", "W", "A", "Wh", "Ah", - "", "", "%", "lx", "", "sec", "%RH", "Hz", "degree", + "", "", "%", "lx", "", "sec", "%RH", "Hz", "degree", "m", "Pa", "m/s^2", "m/s", "" }; @@ -3086,16 +3086,16 @@ mib_diskio(struct agentx_varbind *vb) else if (obj == diskIODevice) agentx_varbind_string(vb, stats[idx - 1].ds_name); else if (obj == diskIONRead) - agentx_varbind_counter32(vb, + agentx_varbind_counter32(vb, (u_int32_t)stats[idx - 1].ds_rbytes); else if (obj == diskIONWritten) - agentx_varbind_counter32(vb, + agentx_varbind_counter32(vb, (u_int32_t)stats[idx - 1].ds_wbytes); else if (obj == diskIOReads) - agentx_varbind_counter32(vb, + agentx_varbind_counter32(vb, (u_int32_t)stats[idx - 1].ds_rxfer); else if (obj == diskIOWrites) - agentx_varbind_counter32(vb, + agentx_varbind_counter32(vb, (u_int32_t)stats[idx - 1].ds_wxfer); else if (obj == diskIONReadX) agentx_varbind_counter64(vb, stats[idx - 1].ds_rbytes); @@ -4339,7 +4339,7 @@ snmp_connect(struct agentx *sa, void *cookie, int close) snmp_read, sa); event_add(&connev, NULL); init = 1; - } else + } else snmp_tryconnect(-1, 0, sa); } diff --git a/libexec/snmpd/snmpd_metrics/pf.c b/libexec/snmpd/snmpd_metrics/pf.c index a4b60962e..fd9cff092 100644 --- a/libexec/snmpd/snmpd_metrics/pf.c +++ b/libexec/snmpd/snmpd_metrics/pf.c @@ -89,7 +89,7 @@ pfr_get_astats(struct pfr_table *tbl, struct pfr_astats *addr, int *size, extern int devpf; if (tbl == NULL || size == NULL || *size < 0 || - (*size && addr == NULL)) + (*size && addr == NULL)) return (-1); bzero(&io, sizeof io); @@ -98,7 +98,7 @@ pfr_get_astats(struct pfr_table *tbl, struct pfr_astats *addr, int *size, io.pfrio_buffer = addr; io.pfrio_esize = sizeof(*addr); io.pfrio_size = *size; - if (ioctl(devpf, DIOCRGETASTATS, &io) == -1) + if (ioctl(devpf, DIOCRGETASTATS, &io) == -1) return (-1); *size = io.pfrio_size; return (0); @@ -168,7 +168,7 @@ pfr_buf_next(struct pfr_buffer *b, const void *prev) return (NULL); if (b->pfrb_size == 0) return (NULL); - if (prev == NULL) + if (prev == NULL) return (b->pfrb_caddr); bs = buf_esize[b->pfrb_type]; if ((((const char *)prev)-((char *)b->pfrb_caddr)) / bs >= @@ -274,7 +274,7 @@ pft_get(struct pfr_buffer *b, struct pfr_table *filter) { bzero(b, sizeof(struct pfr_buffer)); b->pfrb_type = PFRB_TSTATS; - + for (;;) { pfr_buf_grow(b, b->pfrb_size); b->pfrb_size = b->pfrb_msize; @@ -298,7 +298,7 @@ pft_get_table(struct pfr_tstats *rts, int idx) free(b.pfrb_caddr); return (-1); } - + PFRB_FOREACH(ts, &b) { if (!(ts->pfrts_flags & PFR_TFLAG_ACTIVE)) continue; @@ -355,7 +355,7 @@ pfta_get(struct pfr_buffer *b, struct pfr_table *filter) if (b->pfrb_size <= b->pfrb_msize) break; } - + return (0); } diff --git a/libexec/spamd-setup/spamd-setup.c b/libexec/spamd-setup/spamd-setup.c index eb2cb7dff..503db9c0f 100644 --- a/libexec/spamd-setup/spamd-setup.c +++ b/libexec/spamd-setup/spamd-setup.c @@ -395,7 +395,7 @@ void do_message(FILE *sdc, char *msg) { size_t i, bs = 0, bu = 0, len; - ssize_t n; + ssize_t n; char *buf = NULL, last, *tmp; int fd; diff --git a/libexec/spamd/grey.c b/libexec/spamd/grey.c index b777c93cb..d3d178a30 100644 --- a/libexec/spamd/grey.c +++ b/libexec/spamd/grey.c @@ -1093,7 +1093,7 @@ greywatcher(void) syslog_r(LOG_ERR, &sdata, "pledge failed (%m)"); exit(1); } - + startup = time(NULL); db_pid = fork(); switch (db_pid) { diff --git a/libexec/spamlogd/spamlogd.c b/libexec/spamlogd/spamlogd.c index c3e4a6665..015d6782f 100644 --- a/libexec/spamlogd/spamlogd.c +++ b/libexec/spamlogd/spamlogd.c @@ -277,7 +277,7 @@ logpkt_handler(u_char *user, const struct pcap_pkthdr *h, const u_char *sp) if (ipstraddr[0] != '\0') { if (hdr->dir == PF_IN) logmsg(LOG_DEBUG,"inbound %s", ipstraddr); - else + else logmsg(LOG_DEBUG,"outbound %s", ipstraddr); dbupdate(PATH_SPAMD_DB, ipstraddr); } diff --git a/libexec/tradcpp/eval.c b/libexec/tradcpp/eval.c index 6a6bcad81..666b53eed 100644 --- a/libexec/tradcpp/eval.c +++ b/libexec/tradcpp/eval.c @@ -475,7 +475,7 @@ tryreduce(void) continue; } - + t4 = (num >= 4) ? tokenarray_get(&tokens, num-4) : NULL; if (num >= 4 && diff --git a/libexec/tradcpp/macro.c b/libexec/tradcpp/macro.c index 3ad0f6cf4..c42efb944 100644 --- a/libexec/tradcpp/macro.c +++ b/libexec/tradcpp/macro.c @@ -890,7 +890,7 @@ expand_domacro(struct expstate *es, struct place *p) name = stringarray_get(&es->args, 0); m = macrotable_find(name, false); val = (m != NULL) ? "1" : "0"; - debuglog(p, "defined(%s): %s", name, val); + debuglog(p, "defined(%s): %s", name, val); expand_send(es, p, val, 1); expstate_destroyargs(es); return; diff --git a/libexec/tradcpp/main.c b/libexec/tradcpp/main.c index 318c456f7..e1ff9acbb 100644 --- a/libexec/tradcpp/main.c +++ b/libexec/tradcpp/main.c @@ -116,7 +116,7 @@ commandline_macros_cleanup(void) dofree(cm, sizeof(*cm)); } array_setsize(&commandline_macros, 0); - + array_cleanup(&commandline_macros); } diff --git a/libexec/tradcpp/utils.c b/libexec/tradcpp/utils.c index 8be2d1e85..d71e85819 100644 --- a/libexec/tradcpp/utils.c +++ b/libexec/tradcpp/utils.c @@ -39,7 +39,7 @@ const char ws[] = " \t\f\v" ; -const char alnum[] = +const char alnum[] = "0123456789" "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" diff --git a/regress/gnu/usr.bin/perl/Makefile b/regress/gnu/usr.bin/perl/Makefile index 9ca83dee6..d6f5eaabb 100644 --- a/regress/gnu/usr.bin/perl/Makefile +++ b/regress/gnu/usr.bin/perl/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.3 2023/07/05 21:38:22 bluhm Exp $ +# $OpenBSD: Makefile,v 1.5 2023/07/09 13:30:03 bluhm Exp $ .if ! (make(clean) || make(cleandir) || make(obj)) NCPU != /sbin/sysctl -n hw.ncpuonline @@ -12,13 +12,22 @@ build: REGRESS_SETUP += permissions permissions: - # The permissions in CVS tree are not as in the Perl distribution. - # Match expectations of t/porting/exec-bit.t and - # cpan/Test-Harness/t/source_tests/source.sh - awk '{print $$1}' ${BSDSRCDIR}/gnu/usr.bin/perl/MANIFEST |\ - ( cd ${BSDOBJDIR}/gnu/usr.bin/perl/ && xargs chmod -x ) - grep -v '^#' ${BSDSRCDIR}/gnu/usr.bin/perl/Porting/exec-bit.txt |\ - ( cd ${BSDOBJDIR}/gnu/usr.bin/perl/ && xargs chmod +x ) + # Permissions in CVS src tree are not as in the Perl distribution. + # Match expectations of cpan/Test-Harness/t/source_handler.t for + # cpan/Test-Harness/t/source_tests/source*.sh executalbe bits. + # Remove symlink and fix permissions of copy in obj directory. + # cpan/autodie/t/chmod.t and cpan/autodie/t/chown.t modify themself, + # and cpan/autodie/t/utime.t touches touch_me. Replace symlink. +.for f in \ + cpan/Test-Harness/t/source_tests/source.sh \ + cpan/Test-Harness/t/source_tests/source_args.sh \ + cpan/autodie/t/chmod.t \ + cpan/autodie/t/chown.t \ + cpan/autodie/t/touch_me + rm -f ${BSDOBJDIR}/gnu/usr.bin/perl/$f + cp ${BSDSRCDIR}/gnu/usr.bin/perl/$f ${BSDOBJDIR}/gnu/usr.bin/perl/$f + chmod +x ${BSDOBJDIR}/gnu/usr.bin/perl/$f +.endfor REGRESS_TARGETS += test test: diff --git a/regress/lib/libcrypto/aead/aeadtest.c b/regress/lib/libcrypto/aead/aeadtest.c index 2c798a291..4d24a8176 100644 --- a/regress/lib/libcrypto/aead/aeadtest.c +++ b/regress/lib/libcrypto/aead/aeadtest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aeadtest.c,v 1.23 2022/08/20 19:25:14 jsing Exp $ */ +/* $OpenBSD: aeadtest.c,v 1.24 2023/07/07 07:44:59 bcook Exp $ */ /* * Copyright (c) 2022 Joel Sing * Copyright (c) 2014, Google Inc. @@ -48,6 +48,13 @@ #define BUF_MAX 1024 +/* MS defines in global headers, remove it */ +#ifdef _MSC_VER +#ifdef IN +#undef IN +#endif +#endif + /* These are the different types of line that are found in the input file. */ enum { AEAD = 0, /* name of the AEAD algorithm. */ diff --git a/regress/lib/libcrypto/bn/bn_print.c b/regress/lib/libcrypto/bn/bn_print.c index ce3d50d26..24f261d92 100644 --- a/regress/lib/libcrypto/bn/bn_print.c +++ b/regress/lib/libcrypto/bn/bn_print.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_print.c,v 1.2 2023/07/06 15:11:21 tb Exp $ */ +/* $OpenBSD: bn_print.c,v 1.3 2023/07/07 07:47:25 tb Exp $ */ /* * Copyright (c) 2023 Theo Buehler @@ -134,6 +134,11 @@ const struct print_test { " 47:e2:1a:e6:63:b8:3d:2e:2f:78:c4:4f:db:f4:0f:\n" " a4:68:4c:55:72:6b:95:1d:4e:18:42:95:78:cc:37\n", }, + { + .desc = "high bit of first nibble is set", + .want = " mana mana\n" + " 00:80:00:00:00:00:00:00:00:00\n", + }, }; #define N_TESTCASES (sizeof(bn_print_tests) / sizeof(bn_print_tests[0])) @@ -267,6 +272,15 @@ main(void) test = &bn_print_tests[testcase++]; failed |= bn_print_testcase(bn, test); + /* high bit of first nibble is set. */ + BN_zero(bn); + if (!BN_set_bit(bn, 71)) + errx(1, "BN_set_bit"); + if (testcase >= N_TESTCASES) + errx(1, "Too many tests"); + test = &bn_print_tests[testcase++]; + failed |= bn_print_testcase(bn, test); + if (testcase != N_TESTCASES) { warnx("Not all tests run"); failed |= 1; diff --git a/regress/lib/libcrypto/ocsp/ocsp_test.c b/regress/lib/libcrypto/ocsp/ocsp_test.c index 591472982..a38d28135 100644 --- a/regress/lib/libcrypto/ocsp/ocsp_test.c +++ b/regress/lib/libcrypto/ocsp/ocsp_test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ocsp_test.c,v 1.6 2018/07/18 16:24:16 tb Exp $ */ +/* $OpenBSD: ocsp_test.c,v 1.7 2023/07/07 19:54:36 bcook Exp $ */ /* * Copyright (c) 2016 Bob Beck * @@ -35,6 +35,11 @@ tcp_connect(char *host, char *port) hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; + if (BIO_sock_init() != 1) { + perror("BIO_sock_init()"); + exit(-1); + } + error = getaddrinfo(host, port, &hints, &res); if (error != 0) { perror("getaddrinfo()"); diff --git a/regress/lib/libcrypto/wycheproof/Makefile b/regress/lib/libcrypto/wycheproof/Makefile index 4017fe0a4..f2f7910b5 100644 --- a/regress/lib/libcrypto/wycheproof/Makefile +++ b/regress/lib/libcrypto/wycheproof/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.7 2023/03/08 05:36:45 tb Exp $ +# $OpenBSD: Makefile,v 1.9 2023/07/08 19:41:07 tb Exp $ WYCHEPROOF_TESTVECTORS = /usr/local/share/wycheproof/testvectors/ @@ -32,12 +32,11 @@ DPADD += ${LIBCRYPTO} CFLAGS += -I${.CURDIR} -I${.OBJDIR} primality_testcases.h: wycheproof-json.pl ${WYCHEPROOF_TESTVECTORS}/primality_test.json - perl ${.CURDIR}/wycheproof-json.pl > $@.tmp - mv -f $@.tmp $@ + perl ${.CURDIR}/wycheproof-json.pl > $@.tmp && mv $@.tmp $@ -wycheproof-primes: wycheproof-primes.c primality_testcases.h +wycheproof-primes.o: primality_testcases.h -regress-wycheproof-primes: primality_testcases.h wycheproof-primes +regress-wycheproof-primes: wycheproof-primes ./wycheproof-primes CLEANFILES += primality_testcases.h diff --git a/regress/sys/kern/unixsockets/unsendrecvthr.c b/regress/sys/kern/unixsockets/unsendrecvthr.c index 9a4f36287..e22493712 100644 --- a/regress/sys/kern/unixsockets/unsendrecvthr.c +++ b/regress/sys/kern/unixsockets/unsendrecvthr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: unsendrecvthr.c,v 1.1 2021/12/09 23:37:18 mvs Exp $ */ +/* $OpenBSD: unsendrecvthr.c,v 1.2 2023/07/09 09:33:30 bluhm Exp $ */ /* * Copyright (c) 2021 Vitaliy Makkoveev @@ -180,7 +180,7 @@ main(int argc, char *argv[]) err(1, "socketpair"); for (i = 0; i < 2; ++i) { - if (!(rx_data[i] = calloc(ncpu, sizeof(*rx_data)))) + if (!(rx_data[i] = calloc(ncpu, sizeof(struct rx_data)))) err(1, "calloc"); for (j = 0; j < ncpu; ++j) @@ -194,7 +194,7 @@ main(int argc, char *argv[]) } for (i = 0; i < 2; ++i) { - if (!(tx_args[i] = calloc(ncpu, sizeof(*tx_args)))) + if (!(tx_args[i] = calloc(ncpu, sizeof(struct thr_tx_arg)))) err(1, "calloc"); for (j = 0; j < ncpu; ++j) { diff --git a/regress/sys/net/pf_trans/Makefile b/regress/sys/net/pf_trans/Makefile new file mode 100644 index 000000000..9bcbc0214 --- /dev/null +++ b/regress/sys/net/pf_trans/Makefile @@ -0,0 +1,33 @@ +# $OpenBSD: Makefile,v 1.1 2023/07/06 19:55:57 sashan Exp $ + +PROGS+= dev-limit +PROGS+= iocmd-limit + +CFLAGS+= -Wall + +REGRESS_ROOT_TARGETS= run-regress-dev-limit \ + run-regress-iocmd-limit + + +# +# Create 2048 processes. Each child process will attempt +# open /dev/pf and waith for 10secs on success. If +# /dev/pf can not be opened child exits immediately. +# There should be 1023 children, which could open /dev/pf. +# +run-regress-dev-limit: + ${SUDO} ./dev-limit -c 2048 -s 1023 -t 10 + +# +# Open 1024 tickets for DIOCGETRULES without closing them. +# Program expects to see EBUSY and returns 0 in that case. +# +# Open and close 1024 tickets. Program closes ticket by +# DIOCXEND before issuing next DIOCGETRULES command. +# Program expects to see no error and returns 0 in tat case. +# +run-regress-iocmd-limit: + ${SUDO} ./iocmd-limit -c DIOCGETRULES -i 513 + ${SUDO} ./iocmd-limit -c DIOCXEND -i 1024 + +.include diff --git a/regress/sys/net/pf_trans/dev-limit.c b/regress/sys/net/pf_trans/dev-limit.c new file mode 100644 index 000000000..b766a1e5a --- /dev/null +++ b/regress/sys/net/pf_trans/dev-limit.c @@ -0,0 +1,148 @@ +/* $OpenBSD: dev-limit.c,v 1.1 2023/07/06 19:55:58 sashan Exp $ */ + +/* + * Copyright (c) 2023 Alexandr Nedvedicky + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +static int sigchild; + +static void +usage(const char *progname) +{ + fprintf(stderr, + "%s [-d] [-s success_count] [-c child_count] [-t timeout]\n" + "if no options are specified program opens '/dev/pf'\n" + "and waits for 5s before it exits\n" + "\t-s how many children should successfully open /dev/pf\n" + "\t-c children to fork, each child opens /dev/pf\n" + "\t-t timeout in seconds each child should wait\n" + "after successfully opening /dev/pf. Child exits immediately\n" + "if /dev/pf can not be opened\n", progname); + exit(1); +} + +static void +handle_sigchild(int signum) +{ + if (signum == SIGCHLD) + sigchild = 1; +} + +static void +open_pf_and_exit(unsigned int sleep_time) +{ + if (open("/dev/pf", O_RDONLY) == -1) + exit(1); + + sleep(sleep_time); + exit(0); +} + +int +main(int argc, char *const argv[]) +{ + pid_t *pids; + unsigned int chld_count = 0; + unsigned int sleep_time = 5; + unsigned int expect_success = 0; + unsigned int success, errors, i; + const char *errstr, *sleep_arg; + int status; + int c; + + while ((c = getopt(argc, argv, "t:c:s:")) != -1) { + switch (c) { + case 't': + sleep_arg = (char *const)optarg; + sleep_time = strtonum(optarg, 1, 60, &errstr); + if (errstr != NULL) { + fprintf(stderr, + "%s invalid sleep time %s: %s, must be in " + "range <1, 60>\n", argv[0], errstr, optarg); + usage(argv[0]); + } + break; + case 'c': + chld_count = strtonum(optarg, 1, 32768, &errstr); + if (errstr != NULL) { + fprintf(stderr, + "%s invalid children count %s: %s, must be " + "in range <1, 32768>\n", argv[0], optarg, + errstr); + usage(argv[0]); + } + break; + case 's': + expect_success = strtonum(optarg, 0, 32768, &errstr); + if (errstr != NULL) { + fprintf(stderr, + "%s invalid expect success count %s: %s " + "must be in range <1, 32768>\n", argv[0], + optarg, errstr); + usage(argv[0]); + } + break; + default: + usage(argv[0]); + } + } + + if (chld_count == 0) + open_pf_and_exit(sleep_time); + + signal(SIGCHLD, handle_sigchild); + pids = (pid_t *)malloc(sizeof(pid_t) * chld_count); + if (pids == 0) + err(1, "%s malloc: ", argv[0]); + + i = 0; + while ((sigchild == 0) && (i < chld_count)) { + if ((pids[i++] = fork()) == 0) + execl(argv[0], argv[0], "-t", sleep_arg, NULL); + } + chld_count = i; + + success = 0; + errors = 0; + for (i = 0; i < chld_count; i++) { + waitpid(pids[i], &status, 0); + if (status == 0) + success++; + else + errors++; + } + + free(pids); + + if (success != expect_success) { + printf("Successful opens: %u\n", success); + printf("Failures: %u\n", errors); + printf("Expected opens: %u\n", expect_success); + printf("%u vs %u = %u + %u\n", + chld_count, errors + success, errors, success); + return (1); + } + + return (0); +} diff --git a/regress/sys/net/pf_trans/iocmd-limit.c b/regress/sys/net/pf_trans/iocmd-limit.c new file mode 100644 index 000000000..53d197a54 --- /dev/null +++ b/regress/sys/net/pf_trans/iocmd-limit.c @@ -0,0 +1,202 @@ +/* $OpenBSD: iocmd-limit.c,v 1.1 2023/07/06 19:55:58 sashan Exp $ */ + +/* + * Copyright (c) 2023 Alexandr Nedvedicky + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define REGRESS_ANCHOR "regress" + +static void +usage(const char *progname) +{ + fprintf(stderr, + "%s -c iocmd [-i iterations ]\n" + "\t-c iocmd to test, currently DIOCGETRULES " + "and DIOCXEND are supported\n" + "\t-i number of iterations is 1 by default\n", progname); + exit(1); +} + +static int +do_DIOCGETRULES_test(int dev) +{ + struct pfioc_rule pr; + int rv; + + memset(&pr, 0, sizeof(pr)); + memcpy(pr.anchor, REGRESS_ANCHOR, sizeof(REGRESS_ANCHOR)); + pr.rule.action = PF_PASS; + + if ((rv = ioctl(dev, DIOCGETRULES, &pr)) == -1) { + /* + * we expect to see EBUSY anything else is odd and we should + * exit right away. + */ + if (errno != EBUSY) + err(1, "%s DIOCGETRULES: ", __func__); + } + + return (rv); +} + +static int +result_DIOCGETRULES(unsigned int iterations, unsigned int limit) +{ + int rv; + /* + * DIOCGETRULES must see EBUSY before iterations reach limit + * to conclude test is successful. + */ + rv = (iterations < limit) ? 0 : 1; + if (rv) + printf( + "DIOCGETRULES could obtain %u tickets, reaching the limit " + "of %u tickets\n", + iterations, limit); + + return (rv); +} + +static int +do_DIOCXEND_test(int dev) +{ + struct pfioc_rule pr; + int rv; + + memset(&pr, 0, sizeof(pr)); + memcpy(pr.anchor, REGRESS_ANCHOR, sizeof(REGRESS_ANCHOR)); + pr.rule.action = PF_PASS; + + if ((rv = ioctl(dev, DIOCGETRULES, &pr)) == -1) + warn("%s DIOCGETRULES: ", __func__); + else if ((rv = ioctl(dev, DIOCXEND, &pr.ticket)) == -1) + warn("%s DIOCXEND: ", __func__); + + return (rv); +} + +static int +result_DIOCXEND(unsigned int iterations, unsigned int limit) +{ + int rv; + /* + * failing to reach limit when also closing tickets + * using DIOXXEND is an error. + */ + rv = (iterations < limit) ? 1 : 0; + if (rv) + printf( + "Although test is is using DIOCXEND it still" + "hits limit (%u)\n", iterations); + return (rv); +} + +static struct iocmd_test { + const char *iocmd_name; + int (*iocmd_test)(int); + int (*iocmd_result)(unsigned int, unsigned int); +} iocmd_test_tab[] = { + { "DIOCGETRULES", do_DIOCGETRULES_test, result_DIOCGETRULES }, + { "DIOCXEND", do_DIOCXEND_test, result_DIOCXEND }, + { NULL, NULL } +}; + +static struct iocmd_test * +parse_iocmd_name(const char *iocmd_name) +{ + int i = 0; + + while (iocmd_test_tab[i].iocmd_name != NULL) { + if (strcasecmp(iocmd_test_tab[i].iocmd_name, iocmd_name) == 0) + break; + i++; + } + + return ((iocmd_test_tab[i].iocmd_name == NULL) ? + NULL : &iocmd_test_tab[i]); +} + +int +main(int argc, char *const argv[]) +{ + const char *errstr = NULL; + unsigned int iterations = 1; + unsigned int i = 0; + int dev; + int c; + struct iocmd_test *test_iocmd = NULL; + + while ((c = getopt(argc, argv, "i:c:")) != -1) { + switch (c) { + case 'i': + iterations = strtonum(optarg, 1, UINT32_MAX, &errstr); + if (errstr != NULL) { + fprintf(stderr, + "%s: number of iteration (-i %s) " + "is invalid: %s\n", + argv[0], optarg, errstr); + usage(argv[0]); + } + break; + case 'c': + test_iocmd = parse_iocmd_name(optarg); + if (test_iocmd == NULL) { + fprintf(stderr, "%s invalid iocmd: %s\n", + argv[0], optarg); + usage(argv[0]); + } + break; + default: + usage(argv[0]); + } + } + + if (test_iocmd == NULL) { + fprintf(stderr, "%s -c option is required\n", argv[0]); + usage(argv[0]); + } + + dev = open("/dev/pf", O_RDONLY); + if (dev < 0) + err(1, "open(\"dev/pf\"): "); + + while (i < iterations) { + if (test_iocmd->iocmd_test(dev) != 0) + break; + i++; + } + + return (test_iocmd->iocmd_result(i, iterations)); +} diff --git a/regress/sys/net/rtable/kern_compat.h b/regress/sys/net/rtable/kern_compat.h index 5fc616d94..80e40a263 100644 --- a/regress/sys/net/rtable/kern_compat.h +++ b/regress/sys/net/rtable/kern_compat.h @@ -1,8 +1,12 @@ -/* $OpenBSD: kern_compat.h,v 1.14 2023/04/18 16:57:44 bluhm Exp $ */ +/* $OpenBSD: kern_compat.h,v 1.15 2023/07/07 20:38:17 bluhm Exp $ */ #ifndef _KERN_COMPAT_H_ #define _KERN_COMPAT_H_ +#define _KERNEL +#include +#undef _KERNEL + #include #include #include @@ -78,8 +82,6 @@ extern struct domain *domains[]; #define rw_exit_write(rwl) #define rw_assert_wrlock(rwl) -#define refcnt_read(cnt) 1 - #define SET(t, f) ((t) |= (f)) #define CLR(t, f) ((t) &= ~(f)) #define ISSET(t, f) ((t) & (f)) diff --git a/regress/sys/net/rtable/util.c b/regress/sys/net/rtable/util.c index b948d231c..58cc81ec2 100644 --- a/regress/sys/net/rtable/util.c +++ b/regress/sys/net/rtable/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.12 2022/11/23 14:51:00 kn Exp $ */ +/* $OpenBSD: util.c,v 1.13 2023/07/07 20:38:17 bluhm Exp $ */ /* * Copyright (c) 2015 Martin Pieuchot @@ -44,6 +44,10 @@ * SUCH DAMAGE. */ +#define _KERNEL +#include +#undef _KERNEL + #include "srp_compat.h" #include @@ -112,6 +116,7 @@ route_insert(unsigned int rid, sa_family_t af, char *string) rt = calloc(1, sizeof(*rt)); if (rt == NULL) errx(1, "out of memory"); + refcnt_init(&rt->rt_refcnt); plen = inet_net_ptosa(af, string, dst, mask); if (plen == -1) @@ -132,6 +137,8 @@ route_insert(unsigned int rid, sa_family_t af, char *string) inet_net_satop(af, rt_key(rt), plen, ip, sizeof(ip)); errx(1, "added route not found: %s\n", ip); } + rtfree(rt); + rtfree(nrt); } /* @@ -173,6 +180,9 @@ route_delete(unsigned int rid, sa_family_t af, char *string) errx(1, "found: %s after deleting: %s", ip, ip0); } + rtfree(rt); + assert(refcnt_read(&rt->rt_refcnt) == 0); + free(rt_key(rt)); free(rt); } @@ -201,6 +211,8 @@ route_lookup(unsigned int rid, sa_family_t af, char *string) } assert(memcmp(rt_key(rt), dst, dst->sa_len) == 0); assert(rt_plen(rt) == rtable_satoplen(af, mask)); + + rtfree(rt); } int @@ -254,6 +266,7 @@ rtentry_delete(struct rtentry *rt, void *w, unsigned int rid) inet_net_satop(af, rt_key(rt), rt_plen(rt), dest, sizeof(dest)); errx(1, "can't rm route: %s, %s\n", dest, strerror(error)); } + assert(refcnt_read(&rt->rt_refcnt) == 0); return (0); } @@ -281,13 +294,47 @@ rt_maskedcopy(struct sockaddr *src, struct sockaddr *dst, void rtref(struct rtentry *rt) { - rt->rt_refcnt.r_refs++; + refcnt_take(&rt->rt_refcnt); } void rtfree(struct rtentry *rt) { - assert(--(rt->rt_refcnt.r_refs) >= 0); + if (refcnt_rele(&rt->rt_refcnt) == 0) + return; +} + +void +refcnt_init(struct refcnt *r) +{ + r->r_refs = 1; +} + +void +refcnt_take(struct refcnt *r) +{ + u_int refs; + + refs = ++r->r_refs; + assert(refs != 0); +} + +int +refcnt_rele(struct refcnt *r) +{ + u_int refs; + + refs = --r->r_refs; + assert(refs != ~0); + if (r->r_refs == 0) + return (1); + return (0); +} + +unsigned int +refcnt_read(struct refcnt *r) +{ + return (r->r_refs); } void diff --git a/regress/sys/net/rtable/util.h b/regress/sys/net/rtable/util.h index 99529c0c5..8b0c24a77 100644 --- a/regress/sys/net/rtable/util.h +++ b/regress/sys/net/rtable/util.h @@ -1,4 +1,4 @@ -/* $OpenBSD: util.h,v 1.4 2020/11/07 09:53:21 denis Exp $ */ +/* $OpenBSD: util.h,v 1.5 2023/07/07 20:38:17 bluhm Exp $ */ /* * Copyright (c) 2015 Martin Pieuchot diff --git a/sbin/bioctl/bioctl.8 b/sbin/bioctl/bioctl.8 index 21496f01d..d6617b145 100644 --- a/sbin/bioctl/bioctl.8 +++ b/sbin/bioctl/bioctl.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: bioctl.8,v 1.110 2022/08/26 09:14:00 kn Exp $ +.\" $OpenBSD: bioctl.8,v 1.111 2023/07/06 21:08:50 kn Exp $ .\" .\" Copyright (c) 2004, 2005 Marco Peereboom .\" @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: August 26 2022 $ +.Dd $Mdocdate: July 6 2023 $ .Dt BIOCTL 8 .Os .Sh NAME @@ -292,7 +292,6 @@ Read the passphrase for the selected crypto volume from .Pa /dev/stdin rather than .Pa /dev/tty . -This option cannot be used during the initial creation of the crypto volume. .El .Sh EXAMPLES Configure a new diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index b85be1433..736dd7633 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.842 2023/07/01 16:39:11 drahn Exp $ +# $OpenBSD: Makefile,v 1.843 2023/07/08 02:43:02 jcs Exp $ MAN= aac.4 abcrtc.4 abl.4 ac97.4 acphy.4 acrtc.4 \ acpi.4 acpiac.4 acpials.4 acpiasus.4 acpibat.4 \ @@ -43,7 +43,7 @@ MAN= aac.4 abcrtc.4 abl.4 ac97.4 acphy.4 acrtc.4 \ hireset.4 hitemp.4 hme.4 hotplug.4 hsq.4 \ hvn.4 hvs.4 hyperv.4 \ iatp.4 iavf.4 icc.4 ichiic.4 ichwdt.4 \ - icmp.4 icmp6.4 icsphy.4 ifmedia.4 \ + icmp.4 icmp6.4 icsphy.4 ietp.4 ifmedia.4 \ igc.4 iha.4 ihidev.4 iic.4 iicmux.4 ikbd.4 ims.4 imt.4 imxanatop.4 \ imxdog.4 imxesdhc.4 imxgpc.4 imxgpio.4 imxiic.4 imxpciephy.4 \ imxpwm.4 imxrtc.4 imxspi.4 imxsrc.4 imxtmu.4 imxuart.4 \ diff --git a/share/man/man4/ietp.4 b/share/man/man4/ietp.4 new file mode 100644 index 000000000..124366d8c --- /dev/null +++ b/share/man/man4/ietp.4 @@ -0,0 +1,47 @@ +.\" $OpenBSD: ietp.4,v 1.2 2023/07/09 01:12:04 jsg Exp $ +.\" +.\" Copyright (c) 2016 joshua stein +.\" Copyright (c) 2023 vladimir serbinenko +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd $Mdocdate: July 9 2023 $ +.Dt IETP 4 +.Os +.Sh NAME +.Nm ietp +.Nd Elantech touchpad +.Sh SYNOPSIS +.Cd "ietp* at iic?" +.Cd "wsmouse* at ietp? mux 0" +.Sh DESCRIPTION +The +.Nm +driver provides support for Elantech touchpad +devices connected over Inter-Integrated Circuit (I2C) buses. +Access to these devices is through the +.Xr wscons 4 +driver. +.Sh SEE ALSO +.Xr iic 4 , +.Xr wsmouse 4 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Ox 7.4 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Vladimir Serbinenko Aq Mt phcoder@gmail.com . diff --git a/share/man/man4/iic.4 b/share/man/man4/iic.4 index 838abcfea..5a0247d1d 100644 --- a/share/man/man4/iic.4 +++ b/share/man/man4/iic.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: iic.4,v 1.133 2023/04/27 20:35:16 jmc Exp $ +.\" $OpenBSD: iic.4,v 1.134 2023/07/08 05:35:24 jmc Exp $ .\" .\" Copyright (c) 2004, 2006 Alexander Yurchenko .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: April 27 2023 $ +.Dd $Mdocdate: July 8 2023 $ .Dt IIC 4 .Os .Sh NAME @@ -194,6 +194,8 @@ Fairchild FUSB302 USB Type-C Port controller Genesys Logic GL518SM temperature, voltage, and fan sensor .It Xr iatp 4 Atmel maXTouch touchpad and touchscreen +.It Xr ietp 4 +Elantech touchpad .It Xr ihidev 4 HID over I2C support .It Xr ipmi 4 diff --git a/share/man/man4/man4.riscv64/Makefile b/share/man/man4/man4.riscv64/Makefile index 188cd1920..73a91e7c8 100644 --- a/share/man/man4/man4.riscv64/Makefile +++ b/share/man/man4/man4.riscv64/Makefile @@ -1,7 +1,8 @@ -# $OpenBSD: Makefile,v 1.9 2022/06/08 10:49:08 kettenis Exp $ +# $OpenBSD: Makefile,v 1.10 2023/07/08 10:19:19 kettenis Exp $ MAN= intro.4 mpfclock.4 mpfgpio.4 mpfiic.4 plic.4 \ - sfcc.4 sfclock.4 sfgpio.4 sfuart.4 stfclock.4 stfpinctrl.4 + sfcc.4 sfclock.4 sfgpio.4 sfuart.4 \ + stfclock.4 stfpcie.4 stfpciephy.4 stfpinctrl.4 MANSUBDIR=riscv64 diff --git a/share/man/man4/man4.riscv64/stfclock.4 b/share/man/man4/man4.riscv64/stfclock.4 index fb33637bb..2010a56c5 100644 --- a/share/man/man4/man4.riscv64/stfclock.4 +++ b/share/man/man4/man4.riscv64/stfclock.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: stfclock.4,v 1.1 2022/06/06 22:28:57 kettenis Exp $ +.\" $OpenBSD: stfclock.4,v 1.2 2023/07/08 10:17:35 kettenis Exp $ .\" .\" Copyright (c) 2022 Jonathan Gray .\" @@ -14,19 +14,19 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: June 6 2022 $ +.Dd $Mdocdate: July 8 2023 $ .Dt STFCLOCK 4 riscv64 .Os .Sh NAME .Nm stfclock -.Nd StarFive JH7100 clock controller +.Nd StarFive JH7100/JH7110 clock controller .Sh SYNOPSIS .Cd "sfclock* at fdt?" .Sh DESCRIPTION The .Nm driver controls the clock signals for integrated components of the -StarFive JH7100 SoC. +StarFive JH7100/JH7110 SoCs. .Sh SEE ALSO .Xr intro 4 .Sh HISTORY diff --git a/share/man/man4/man4.riscv64/stfpcie.4 b/share/man/man4/man4.riscv64/stfpcie.4 new file mode 100644 index 000000000..14a623ef1 --- /dev/null +++ b/share/man/man4/man4.riscv64/stfpcie.4 @@ -0,0 +1,45 @@ +.\" $OpenBSD: stfpcie.4,v 1.1 2023/07/08 10:18:34 kettenis Exp $ +.\" +.\" Copyright (c) 2023 Mark Kettenis +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd $Mdocdate: July 8 2023 $ +.Dt STFPCIE 4 riscv64 +.Os +.Sh NAME +.Nm stfpcie +.Nd StarFive JH7110 Host/PCIe bridge +.Sh SYNOPSIS +.Cd "stfpcie* at fdt?" +.Cd "pci* at dwpcie?" +.Sh DESCRIPTION +The +.Nm +driver provides support for the PLDA XpressRICH-AXI PCIe controller, +which is built into the StarFive JH7110 SoC. +.Sh SEE ALSO +.Xr intro 4 , +.Xr pci 4 , +.Xr stfpciephy 4 +.Sh HISTORY +The +.Nm +driver first appeared in +.Ox 7.4 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Mark Kettenis Aq Mt kettenis@openbsd.org . diff --git a/share/man/man4/man4.riscv64/stfpciephy.4 b/share/man/man4/man4.riscv64/stfpciephy.4 new file mode 100644 index 000000000..ca7cdbb7a --- /dev/null +++ b/share/man/man4/man4.riscv64/stfpciephy.4 @@ -0,0 +1,43 @@ +.\" $OpenBSD: stfpciephy.4,v 1.1 2023/07/08 10:18:51 kettenis Exp $ +.\" +.\" Copyright (c) 2023 Mark Kettenis +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd $Mdocdate: July 8 2023 $ +.Dt STFPCIEPHY 4 riscv64 +.Os +.Sh NAME +.Nm stfpciephy +.Nd StarFive JH7110 PCIe 2.0 and USB 3.0 PHY +.Sh SYNOPSIS +.Cd "stfpciephy* at fdt?" +.Sh DESCRIPTION +The +.Nm +driver controls the PCIe 2.0 and USB 3.0 PHY integrated on the +StarFive JH7110 SoC. +.Sh SEE ALSO +.Xr intro 4 , +.Xr stfpcie 4 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Ox 7.4 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Mark Kettenis Aq Mt kettenis@openbsd.org . diff --git a/share/man/man4/man4.riscv64/stfpinctrl.4 b/share/man/man4/man4.riscv64/stfpinctrl.4 index bc98da2e2..ab383cd41 100644 --- a/share/man/man4/man4.riscv64/stfpinctrl.4 +++ b/share/man/man4/man4.riscv64/stfpinctrl.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: stfpinctrl.4,v 1.2 2022/09/07 00:44:03 jsg Exp $ +.\" $OpenBSD: stfpinctrl.4,v 1.3 2023/07/08 10:17:35 kettenis Exp $ .\" .\" Copyright (c) 2022 Mark Kettenis .\" @@ -14,19 +14,19 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: September 7 2022 $ +.Dd $Mdocdate: July 8 2023 $ .Dt STFPINCTRL 4 riscv64 .Os .Sh NAME .Nm stfpinctrl -.Nd StarFive JH7100 pin configuration +.Nd StarFive JH7100/JH7110 pin configuration .Sh SYNOPSIS .Cd "stfpinctrl* at fdt?" .Sh DESCRIPTION The .Nm driver uses pin control data from the device tree to configure -pins on the StarFive JH7100 SoC. +pins on the StarFive JH7100/JH7110 SoCs. .Sh SEE ALSO .Xr intro 4 .Sh HISTORY diff --git a/share/man/man5/fstab.5 b/share/man/man5/fstab.5 index 055e2b2f1..28671e59c 100644 --- a/share/man/man5/fstab.5 +++ b/share/man/man5/fstab.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: fstab.5,v 1.54 2022/03/31 17:27:22 naddy Exp $ +.\" $OpenBSD: fstab.5,v 1.55 2023/07/07 13:21:28 job Exp $ .\" $NetBSD: fstab.5,v 1.5.2.1 1995/11/16 20:11:11 pk Exp $ .\" .\" Copyright (c) 1980, 1989, 1991, 1993 @@ -30,7 +30,7 @@ .\" .\" @(#)fstab.5 8.1 (Berkeley) 6/5/93 .\" -.Dd $Mdocdate: March 31 2022 $ +.Dd $Mdocdate: July 7 2023 $ .Dt FSTAB 5 .Os .Sh NAME @@ -295,7 +295,7 @@ swap /tmp mfs rw,nodev,nosuid,-s=153600 0 0 /dev/sd0g /usr ffs rw,nodev 1 2 /dev/sd0h /usr/local ffs rw,nodev 1 2 /dev/sd0i /home ffs rw,nodev,nosuid 1 2 -/dev/sd0j /usr/src ffs rw,nodev,nosuid,softdep 1 2 +/dev/sd0j /usr/src ffs rw,nodev,nosuid 1 2 /dev/cd0a /cdrom cd9660 ro,noauto 0 0 5b27c2761a9b0b06.i /mnt/key msdos rw,noauto 0 0 server:/export/ports /usr/ports nfs rw,nodev,nosuid,soft,intr 0 0 diff --git a/share/man/man9/refcnt_init.9 b/share/man/man9/refcnt_init.9 index 22bf643ec..96fa94e7e 100644 --- a/share/man/man9/refcnt_init.9 +++ b/share/man/man9/refcnt_init.9 @@ -1,4 +1,4 @@ -.\" $OpenBSD: refcnt_init.9,v 1.3 2022/04/30 14:44:04 visa Exp $ +.\" $OpenBSD: refcnt_init.9,v 1.5 2023/07/06 20:53:53 kn Exp $ .\" .\" Copyright (c) 2015 David Gwynne .\" @@ -14,11 +14,12 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: April 30 2022 $ +.Dd $Mdocdate: July 6 2023 $ .Dt REFCNT_INIT 9 .Os .Sh NAME .Nm refcnt_init , +.Nm refcnt_init_trace , .Nm refcnt_take , .Nm refcnt_rele , .Nm refcnt_rele_wake , @@ -32,6 +33,8 @@ .Ft void .Fn "refcnt_init" "struct refcnt *r" .Ft void +.Fn "refcnt_init_trace" "struct refcnt *r" "int idx" +.Ft void .Fn "refcnt_take" "struct refcnt *r" .Ft int .Fn "refcnt_rele" "struct refcnt *r" @@ -51,6 +54,10 @@ to manage the lifetime of a shared object. .Fn refcnt_init sets the initial value of the counter to 1 to account for the caller's reference to the object. +.Fn refcnt_init_trace +additionally accepts a +.Xr dt 4 +static probe index. .Pp .Fn refcnt_take is used to acquire a new reference. @@ -99,6 +106,7 @@ whenever possible. initialises a declaration of a refcnt to 1. .Sh CONTEXT .Fn refcnt_init , +.Fn refcnt_init_trace , .Fn refcnt_take , .Fn refcnt_rele , .Fn refcnt_rele_wake , diff --git a/sys/arch/amd64/amd64/efi_machdep.c b/sys/arch/amd64/amd64/efi_machdep.c index 97be06b22..7486ff106 100644 --- a/sys/arch/amd64/amd64/efi_machdep.c +++ b/sys/arch/amd64/amd64/efi_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efi_machdep.c,v 1.6 2023/04/30 17:24:24 kettenis Exp $ */ +/* $OpenBSD: efi_machdep.c,v 1.7 2023/07/08 07:18:39 kettenis Exp $ */ /* * Copyright (c) 2022 Mark Kettenis @@ -208,11 +208,15 @@ efi_enter(struct efi_softc *sc) fpu_kernel_enter(); curpcb->pcb_onfault = (void *)efi_fault; + if (curcpu()->ci_feature_sefflags_edx & SEFF0EDX_IBT) + lcr4(rcr4() & ~CR4_CET); } void efi_leave(struct efi_softc *sc) { + if (curcpu()->ci_feature_sefflags_edx & SEFF0EDX_IBT) + lcr4(rcr4() | CR4_CET); curpcb->pcb_onfault = NULL; fpu_kernel_exit(); diff --git a/sys/arch/amd64/conf/GENERIC b/sys/arch/amd64/conf/GENERIC index 62aecdcd3..f7ac97071 100644 --- a/sys/arch/amd64/conf/GENERIC +++ b/sys/arch/amd64/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.517 2023/04/23 00:50:29 dlg Exp $ +# $OpenBSD: GENERIC,v 1.518 2023/07/08 02:43:02 jcs Exp $ # # For further information on compiling SecBSD kernels, see the config(8) # man page. @@ -197,6 +197,8 @@ imt* at ihidev? # HID-over-i2c multitouch trackpad wsmouse* at imt? mux 0 iatp* at iic? # Atmel maXTouch i2c touchpad/touchscreen wsmouse* at iatp? mux 0 +ietp* at iic? # Elantech touchpad +wsmouse* at ietp? mux 0 icc* at ihidev? # Consumer Control keyboards wskbd* at icc? mux 1 diff --git a/sys/arch/amd64/conf/files.amd64 b/sys/arch/amd64/conf/files.amd64 index b565f2ed7..a3452d972 100644 --- a/sys/arch/amd64/conf/files.amd64 +++ b/sys/arch/amd64/conf/files.amd64 @@ -1,4 +1,4 @@ -# $OpenBSD: files.amd64,v 1.108 2023/04/26 15:11:21 mlarkin Exp $ +# $OpenBSD: files.amd64,v 1.109 2023/07/08 08:01:10 tobhe Exp $ maxpartitions 16 maxusers 2 16 128 @@ -237,6 +237,7 @@ attach acpi at bios file arch/amd64/amd64/acpi_machdep.c acpi file arch/amd64/amd64/acpi_wakecode.S acpi & !small_kernel file dev/acpi/acpi_x86.c acpi & suspend & !small_kernel +file dev/acpi/acpi_apm.c acpi device acpipci attach acpipci at acpi diff --git a/sys/arch/arm64/dev/agintc.c b/sys/arch/arm64/dev/agintc.c index 8dce79c82..be312fda0 100644 --- a/sys/arch/arm64/dev/agintc.c +++ b/sys/arch/arm64/dev/agintc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agintc.c,v 1.51 2023/07/06 09:40:36 patrick Exp $ */ +/* $OpenBSD: agintc.c,v 1.52 2023/07/07 10:11:39 patrick Exp $ */ /* * Copyright (c) 2007, 2009, 2011, 2017 Dale Rahn * Copyright (c) 2018 Mark Kettenis @@ -148,10 +148,18 @@ struct agintc_mbi_range { void **mr_mbi; }; +struct agintc_lpi_info { + struct agintc_msi_softc *li_msic; + struct cpu_info *li_ci; + uint32_t li_deviceid; + uint32_t li_eventid; + struct intrhand *li_ih; +}; + struct agintc_softc { struct simplebus_softc sc_sbus; struct intrq *sc_handler; - struct intrhand **sc_lpi_handler; + struct agintc_lpi_info **sc_lpi; bus_space_tag_t sc_iot; bus_space_handle_t sc_d_ioh; bus_space_handle_t *sc_r_ioh; @@ -257,7 +265,8 @@ int agintc_ipi_nop(void *v); int agintc_ipi_combined(void *); void agintc_send_ipi(struct cpu_info *, int); -void agintc_msi_invall(void); +void agintc_msi_discard(struct agintc_lpi_info *); +void agintc_msi_inv(struct agintc_lpi_info *); const struct cfattach agintc_ca = { sizeof (struct agintc_softc), agintc_match, agintc_attach @@ -536,8 +545,8 @@ agintc_attach(struct device *parent, struct device *self, void *aux) sizeof(*sc->sc_handler), M_DEVBUF, M_ZERO | M_WAITOK); for (i = 0; i < nintr; i++) TAILQ_INIT(&sc->sc_handler[i].iq_list); - sc->sc_lpi_handler = mallocarray(sc->sc_nlpi, - sizeof(*sc->sc_lpi_handler), M_DEVBUF, M_ZERO | M_WAITOK); + sc->sc_lpi = mallocarray(sc->sc_nlpi, + sizeof(*sc->sc_lpi), M_DEVBUF, M_ZERO | M_WAITOK); /* set priority to IPL_HIGH until configure lowers to desired IPL */ agintc_setipl(IPL_HIGH); @@ -834,8 +843,11 @@ agintc_enable_wakeup(void) } for (irq = 0; irq < sc->sc_nlpi; irq++) { - ih = sc->sc_lpi_handler[irq]; - if (ih == NULL || (ih->ih_flags & IPL_WAKEUP)) + if (sc->sc_lpi[irq] == NULL) + continue; + ih = sc->sc_lpi[irq]->li_ih; + KASSERT(ih != NULL); + if (ih->ih_flags & IPL_WAKEUP) continue; prop = AGINTC_DMA_KVA(sc->sc_prop); prop[irq] &= ~GICR_PROP_ENABLE; @@ -843,10 +855,9 @@ agintc_enable_wakeup(void) cpu_dcache_wb_range((vaddr_t)&prop[irq], sizeof(*prop)); __asm volatile("dsb sy"); + /* Invalidate cache */ + agintc_msi_inv(sc->sc_lpi[irq]); } - - /* Invalidate cache. */ - agintc_msi_invall(); } void @@ -874,8 +885,11 @@ agintc_disable_wakeup(void) } for (irq = 0; irq < sc->sc_nlpi; irq++) { - ih = sc->sc_lpi_handler[irq]; - if (ih == NULL || (ih->ih_flags & IPL_WAKEUP)) + if (sc->sc_lpi[irq] == NULL) + continue; + ih = sc->sc_lpi[irq]->li_ih; + KASSERT(ih != NULL); + if (ih->ih_flags & IPL_WAKEUP) continue; prop = AGINTC_DMA_KVA(sc->sc_prop); prop[irq] |= GICR_PROP_ENABLE; @@ -883,10 +897,9 @@ agintc_disable_wakeup(void) cpu_dcache_wb_range((vaddr_t)&prop[irq], sizeof(*prop)); __asm volatile("dsb sy"); + /* Invalidate cache */ + agintc_msi_inv(sc->sc_lpi[irq]); } - - /* Invalidate cache. */ - agintc_msi_invall(); } void @@ -1144,9 +1157,10 @@ agintc_irq_handler(void *frame) } if (irq >= LPI_BASE) { - ih = sc->sc_lpi_handler[irq - LPI_BASE]; - if (ih == NULL) + if (sc->sc_lpi[irq - LPI_BASE] == NULL) return; + ih = sc->sc_lpi[irq - LPI_BASE]->li_ih; + KASSERT(ih != NULL); s = agintc_splraise(ih->ih_ipl); intr_enable(); @@ -1234,8 +1248,7 @@ agintc_intr_establish(int irqno, int type, int level, struct cpu_info *ci, } TAILQ_INSERT_TAIL(&sc->sc_handler[irqno].iq_list, ih, ih_list); sc->sc_handler[irqno].iq_ci = ci; - } else - sc->sc_lpi_handler[irqno - LPI_BASE] = ih; + } if (name != NULL) evcount_attach(&ih->ih_count, name, &ih->ih_irq); @@ -1292,15 +1305,12 @@ agintc_intr_disestablish(void *cookie) } else { uint8_t *prop = AGINTC_DMA_KVA(sc->sc_prop); - sc->sc_lpi_handler[irqno - LPI_BASE] = NULL; prop[irqno - LPI_BASE] = 0; /* Make globally visible. */ cpu_dcache_wb_range((vaddr_t)&prop[irqno - LPI_BASE], sizeof(*prop)); __asm volatile("dsb sy"); - - /* XXX: Invalidate cache? */ } if (ih->ih_name != NULL) @@ -1521,6 +1531,7 @@ struct gits_cmd { #define MAPTI 0x0a #define INV 0x0c #define INVALL 0x0d +#define DISCARD 0x0f #define GITS_CMDQ_SIZE (64 * 1024) #define GITS_CMDQ_NENTRIES (GITS_CMDQ_SIZE / sizeof(struct gits_cmd)) @@ -1549,9 +1560,6 @@ struct agintc_msi_softc { bus_addr_t sc_msi_addr; int sc_msi_delta; - int sc_nlpi; - void **sc_lpi; - struct agintc_dmamem *sc_cmdq; uint16_t sc_cmdidx; @@ -1631,10 +1639,6 @@ agintc_msi_attach(struct device *parent, struct device *self, void *aux) else sc->sc_cidbits = 16; - sc->sc_nlpi = agintc_sc->sc_nlpi; - sc->sc_lpi = mallocarray(sc->sc_nlpi, sizeof(void *), M_DEVBUF, - M_WAITOK|M_ZERO); - /* Set up command queue. */ sc->sc_cmdq = agintc_dmamem_alloc(sc->sc_dmat, GITS_CMDQ_SIZE, GITS_CMDQ_SIZE); @@ -1802,9 +1806,6 @@ unmap: if (sc->sc_cmdq) agintc_dmamem_free(sc->sc_dmat, sc->sc_cmdq); - if (sc->sc_lpi) - free(sc->sc_lpi, M_DEVBUF, sc->sc_nlpi * sizeof(void *)); - bus_space_unmap(sc->sc_iot, sc->sc_ioh, faa->fa_reg[0].size); } @@ -1878,25 +1879,53 @@ agintc_msi_find_device(struct agintc_msi_softc *sc, uint32_t deviceid) } void -agintc_msi_invall(void) +agintc_msi_discard(struct agintc_lpi_info *li) { - struct cfdriver *cd = &agintcmsi_cd; struct agintc_msi_softc *sc; + struct cpu_info *ci; struct gits_cmd cmd; - int i, j; + int hwcpu; - for (i = 0; i < cd->cd_ndevs; i++) { - if (cd->cd_devs[i] == NULL) - continue; - sc = cd->cd_devs[i]; - for (j = 0; j < ncpus; j++) { - memset(&cmd, 0, sizeof(cmd)); - cmd.cmd = INVALL; - cmd.dw2 = j; - agintc_msi_send_cmd(sc, &cmd); - agintc_msi_wait_cmd(sc); - } - } + sc = li->li_msic; + ci = li->li_ci; + hwcpu = agintc_sc->sc_cpuremap[ci->ci_cpuid]; + + memset(&cmd, 0, sizeof(cmd)); + cmd.cmd = DISCARD; + cmd.deviceid = li->li_deviceid; + cmd.eventid = li->li_eventid; + agintc_msi_send_cmd(sc, &cmd); + + memset(&cmd, 0, sizeof(cmd)); + cmd.cmd = SYNC; + cmd.dw2 = agintc_sc->sc_processor[hwcpu] << 16; + agintc_msi_send_cmd(sc, &cmd); + agintc_msi_wait_cmd(sc); +} + +void +agintc_msi_inv(struct agintc_lpi_info *li) +{ + struct agintc_msi_softc *sc; + struct cpu_info *ci; + struct gits_cmd cmd; + int hwcpu; + + sc = li->li_msic; + ci = li->li_ci; + hwcpu = agintc_sc->sc_cpuremap[ci->ci_cpuid]; + + memset(&cmd, 0, sizeof(cmd)); + cmd.cmd = INV; + cmd.deviceid = li->li_deviceid; + cmd.eventid = li->li_eventid; + agintc_msi_send_cmd(sc, &cmd); + + memset(&cmd, 0, sizeof(cmd)); + cmd.cmd = SYNC; + cmd.dw2 = agintc_sc->sc_processor[hwcpu] << 16; + agintc_msi_send_cmd(sc, &cmd); + agintc_msi_wait_cmd(sc); } void * @@ -1908,7 +1937,6 @@ agintc_intr_establish_msi(void *self, uint64_t *addr, uint64_t *data, struct gits_cmd cmd; uint32_t deviceid = *data; uint32_t eventid; - void *cookie; int i, hwcpu; if (ci == NULL) @@ -1923,14 +1951,25 @@ agintc_intr_establish_msi(void *self, uint64_t *addr, uint64_t *data, if (eventid >= 32) return NULL; - for (i = 0; i < sc->sc_nlpi; i++) { - if (sc->sc_lpi[i] != NULL) + for (i = 0; i < agintc_sc->sc_nlpi; i++) { + if (agintc_sc->sc_lpi[i] != NULL) continue; - cookie = agintc_intr_establish(LPI_BASE + i, + agintc_sc->sc_lpi[i] = malloc(sizeof(struct agintc_lpi_info), + M_DEVBUF, M_WAITOK | M_ZERO); + agintc_sc->sc_lpi[i]->li_msic = sc; + agintc_sc->sc_lpi[i]->li_ci = ci; + agintc_sc->sc_lpi[i]->li_deviceid = deviceid; + agintc_sc->sc_lpi[i]->li_eventid = eventid; + agintc_sc->sc_lpi[i]->li_ih = + agintc_intr_establish(LPI_BASE + i, IST_EDGE_RISING, level, ci, func, arg, name); - if (cookie == NULL) + if (agintc_sc->sc_lpi[i]->li_ih == NULL) { + free(agintc_sc->sc_lpi[i], M_DEVBUF, + sizeof(struct agintc_lpi_info)); + agintc_sc->sc_lpi[i] = NULL; return NULL; + } memset(&cmd, 0, sizeof(cmd)); cmd.cmd = MAPTI; @@ -1948,8 +1987,7 @@ agintc_intr_establish_msi(void *self, uint64_t *addr, uint64_t *data, *addr = sc->sc_msi_addr + deviceid * sc->sc_msi_delta; *data = eventid; - sc->sc_lpi[i] = cookie; - return &sc->sc_lpi[i]; + return &agintc_sc->sc_lpi[i]; } return NULL; @@ -1958,17 +1996,22 @@ agintc_intr_establish_msi(void *self, uint64_t *addr, uint64_t *data, void agintc_intr_disestablish_msi(void *cookie) { - agintc_intr_disestablish(*(void **)cookie); - *(void **)cookie = NULL; + struct agintc_lpi_info *li = *(void **)cookie; - /* Invalidate cache. */ - agintc_msi_invall(); + agintc_intr_disestablish(li->li_ih); + agintc_msi_discard(li); + agintc_msi_inv(li); + + free(li, M_DEVBUF, sizeof(*li)); + *(void **)cookie = NULL; } void agintc_intr_barrier_msi(void *cookie) { - agintc_intr_barrier(*(void **)cookie); + struct agintc_lpi_info *li = *(void **)cookie; + + agintc_intr_barrier(li->li_ih); } struct agintc_dmamem * diff --git a/sys/arch/arm64/dev/aplsmc.c b/sys/arch/arm64/dev/aplsmc.c index 6ace251fa..1fc9692ac 100644 --- a/sys/arch/arm64/dev/aplsmc.c +++ b/sys/arch/arm64/dev/aplsmc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aplsmc.c,v 1.23 2023/05/29 04:24:39 deraadt Exp $ */ +/* $OpenBSD: aplsmc.c,v 1.24 2023/07/08 14:44:43 tobhe Exp $ */ /* * Copyright (c) 2021 Mark Kettenis * @@ -366,7 +366,6 @@ aplsmc_handle_notification(struct aplsmc_softc *sc, uint64_t data) extern int allowpowerdown; #ifdef SUSPEND extern int cpu_suspended; - extern void suspend(void); if (cpu_suspended) { switch (SMC_EV_TYPE(data)) { @@ -433,7 +432,7 @@ aplsmc_handle_notification(struct aplsmc_softc *sc, uint64_t data) } case 1: #ifdef SUSPEND - suspend(); + request_sleep(SLEEP_SUSPEND); #endif break; case 2: diff --git a/sys/arch/arm64/dev/apm.c b/sys/arch/arm64/dev/apm.c index 2ccc82299..903b35535 100644 --- a/sys/arch/arm64/dev/apm.c +++ b/sys/arch/arm64/dev/apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apm.c,v 1.23 2023/07/05 08:26:56 tobhe Exp $ */ +/* $OpenBSD: apm.c,v 1.24 2023/07/08 14:44:43 tobhe Exp $ */ /*- * Copyright (c) 2001 Alexander Guy. All rights reserved. @@ -57,10 +57,13 @@ #endif #ifdef SUSPEND -struct taskq *suspend_taskq; +struct taskq *sleep_taskq; struct task suspend_task; void do_suspend(void *); -void suspend(void); +#ifdef HIBERNATE +struct task hibernate_task; +void do_hibernate(void *); +#endif #endif struct apm_softc { @@ -128,8 +131,11 @@ void apmattach(struct device *parent, struct device *self, void *aux) { #ifdef SUSPEND - suspend_taskq = taskq_create("suspend", 1, IPL_NONE, 0); + sleep_taskq = taskq_create("sleep", 1, IPL_NONE, 0); task_set(&suspend_task, do_suspend, NULL); +#ifdef HIBERNATE + task_set(&hibernate_task, do_hibernate, NULL); +#endif #endif acpiapm_open = apmopen; @@ -224,7 +230,7 @@ apmioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) error = EBADF; break; } - suspend(); + error = request_sleep(SLEEP_SUSPEND); break; #ifdef HIBERNATE case APM_IOC_HIBERNATE: @@ -234,11 +240,7 @@ apmioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) error = EBADF; break; } - if (get_hibernate_io_function(swdevt[0].sw_dev) == NULL) { - error = EOPNOTSUPP; - break; - } - sleep_state(NULL, SLEEP_HIBERNATE); + error = request_sleep(SLEEP_HIBERNATE); break; #endif #endif @@ -358,11 +360,34 @@ do_suspend(void *v) sleep_state(v, SLEEP_SUSPEND); } +#ifdef HIBERNATE void -suspend(void) +do_hibernate(void *v) { - if (suspend_taskq) - task_add(suspend_taskq, &suspend_task); + sleep_state(v, SLEEP_HIBERNATE); +} +#endif + +int +request_sleep(int sleepmode) +{ + if (sleep_taskq == NULL) + return EINVAL; + + switch (sleepmode) { + case SLEEP_SUSPEND: + task_add(sleep_taskq, &suspend_task); + break; +#ifdef HIBERNATE + case SLEEP_HIBERNATE: + if (get_hibernate_io_function(swdevt[0].sw_dev) == NULL) + return EOPNOTSUPP; + task_add(sleep_taskq, &hibernate_task); + break; +#endif + } + + return 0; } #ifdef MULTIPROCESSOR diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC index fcc3d91c7..1f2e036c6 100644 --- a/sys/arch/i386/conf/GENERIC +++ b/sys/arch/i386/conf/GENERIC @@ -87,7 +87,7 @@ ppb* at pci? # PCI-PCI bridges pci* at ppb? pci* at pchb? pcib* at pci? # PCI-ISA bridge -amdpcib* at pci? # AMD 8111 LPC bridge +amdpcib* at pci? # AMD 8111 LPC bridge tcpcib* at pci? # Intel Atom E600 LPC bridge ichpcib* at pci? # Intel ICHx/ICHx-M LPC bridges gscpcib* at pci? # NS Geode SC1100 PCI-ISA bridge @@ -386,7 +386,7 @@ agp* at amdagp? # AGP bridges agp* at intelagp? # AGP bridges agp* at sisagp? # AGP bridges agp* at viaagp? # AGP bridges -#agp* at mmuagp? +#agp* at mmuagp? inteldrm* at pci? # Intel i915, i945 DRM driver intagp* at inteldrm? @@ -407,7 +407,7 @@ com0 at isa? port 0x3f8 irq 4 # standard PC serial ports com1 at isa? port 0x2f8 irq 3 com2 at isa? port 0x3e8 irq 5 com3 at isa? disable port 0x2e8 irq 9 # (conflicts with some video cards) -#com4 at isa? port 0x220 irq 4 # Fujitsu Stylistic Touchscreen +#com4 at isa? port 0x220 irq 4 # Fujitsu Stylistic Touchscreen ast0 at isa? port 0x1a0 irq 5 # AST 4-port serial card #ast1 at isa? port 0x2a0 irq 6 # 2nd AST 4-port serial card com* at ast? diff --git a/sys/arch/i386/conf/files.i386 b/sys/arch/i386/conf/files.i386 index a4ae58284..f94cb646f 100644 --- a/sys/arch/i386/conf/files.i386 +++ b/sys/arch/i386/conf/files.i386 @@ -1,4 +1,4 @@ -# $OpenBSD: files.i386,v 1.249 2023/01/17 10:10:11 jsg Exp $ +# $OpenBSD: files.i386,v 1.250 2023/07/08 08:01:10 tobhe Exp $ # # new style config file for i386 architecture # @@ -377,6 +377,7 @@ attach acpi at bios file arch/i386/i386/acpi_machdep.c acpi file arch/i386/i386/acpi_wakecode.S acpi & !small_kernel file dev/acpi/acpi_x86.c acpi & suspend & !small_kernel +file dev/acpi/acpi_apm.c acpi # # IPMI diff --git a/sys/arch/i386/eisa/eisa_machdep.c b/sys/arch/i386/eisa/eisa_machdep.c index 1b7e7370f..c95c4269d 100644 --- a/sys/arch/i386/eisa/eisa_machdep.c +++ b/sys/arch/i386/eisa/eisa_machdep.c @@ -142,7 +142,7 @@ eisa_intr_string(eisa_chipset_tag_t ec, eisa_intr_handle_t ih) snprintf(irqstr, sizeof irqstr, "irq %d", ih); return (irqstr); - + } void * diff --git a/sys/arch/i386/i386/acpi_machdep.c b/sys/arch/i386/i386/acpi_machdep.c index 74dba69b1..ffd9e8092 100644 --- a/sys/arch/i386/i386/acpi_machdep.c +++ b/sys/arch/i386/i386/acpi_machdep.c @@ -404,7 +404,7 @@ acpi_sleep_cpu(struct acpi_softc *sc, int state) * will cause the least number of unexpected side effects. We re-start * the clocks early because we will soon run AML whigh might do DELAY. * Then PM, and then further system/CPU work for the BSP cpu. - */ + */ void acpi_resume_cpu(struct acpi_softc *sc, int state) { @@ -434,7 +434,7 @@ acpi_resume_cpu(struct acpi_softc *sc, int state) cpu_init(&cpu_info_primary); cpu_ucode_apply(&cpu_info_primary); cpu_tsx_disable(&cpu_info_primary); - + /* Re-initialise memory range handling on BSP */ if (mem_range_softc.mr_op != NULL) mem_range_softc.mr_op->initAP(&mem_range_softc); @@ -446,7 +446,7 @@ sleep_mp(void) { int i; - /* + /* * Wait for cpus to halt so we know their FPU state has been * saved and their caches have been written back. */ diff --git a/sys/arch/i386/i386/acpi_wakecode.S b/sys/arch/i386/i386/acpi_wakecode.S index 426dd86c5..4e9f62847 100644 --- a/sys/arch/i386/i386/acpi_wakecode.S +++ b/sys/arch/i386/i386/acpi_wakecode.S @@ -362,7 +362,7 @@ NENTRY(hibernate_activate_resume_pt_machdep) andl $(~CR4_PGE), %eax movl %eax, %cr4 - /* + /* * Switch to the hibernate resume pagetable if we're running * in non-PAE mode. If we're running in PAE mode, this will * switch to the PTPDEs we stashed into the hibernate resume diff --git a/sys/arch/i386/i386/amd64errata.c b/sys/arch/i386/i386/amd64errata.c index dcfbe7a48..0ee198209 100644 --- a/sys/arch/i386/i386/amd64errata.c +++ b/sys/arch/i386/i386/amd64errata.c @@ -134,7 +134,7 @@ static const uint8_t amd64_errata_set7[] = { static const uint8_t amd64_errata_set8[] = { BH_E4, CH_CG, CH_CG, CH_D0, CH_D0, DH_CG, DH_CG, DH_CG, DH_D0, DH_D0, DH_E3, DH_E3, DH_E6, DH_E6, JH_E1, JH_E6, - JH_E6, SH_B0, SH_B3, SH_C0, SH_C0, SH_CG, SH_CG, SH_CG, + JH_E6, SH_B0, SH_B3, SH_C0, SH_C0, SH_CG, SH_CG, SH_CG, SH_D0, SH_D0, SH_D0, SH_E4, SH_E4, SH_E5, OINK }; @@ -257,7 +257,7 @@ static errata_t errata[] = { }, }; -int +int amd64_errata_testmsr(struct cpu_info *ci, errata_t *e) { uint64_t val; @@ -272,7 +272,7 @@ amd64_errata_testmsr(struct cpu_info *ci, errata_t *e) return 1; /* found */ } -int +int amd64_errata_setmsr(struct cpu_info *ci, errata_t *e) { uint64_t val; diff --git a/sys/arch/i386/i386/bus_dma.c b/sys/arch/i386/i386/bus_dma.c index 70b16c588..bf607b93d 100644 --- a/sys/arch/i386/i386/bus_dma.c +++ b/sys/arch/i386/i386/bus_dma.c @@ -128,7 +128,7 @@ void _bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map) { size_t mapsize; - + mapsize = sizeof(struct bus_dmamap) + (sizeof(bus_dma_segment_t) * (map->_dm_segcnt - 1)); free(map, M_DEVBUF, mapsize); diff --git a/sys/arch/i386/i386/conf.c b/sys/arch/i386/i386/conf.c index 6761ca19a..e1eb703c1 100644 --- a/sys/arch/i386/i386/conf.c +++ b/sys/arch/i386/i386/conf.c @@ -279,7 +279,7 @@ struct cdevsw cdevsw[] = cdev_vscsi_init(NVSCSI,vscsi), /* 90: vscsi */ cdev_disk_init(1,diskmap), /* 91: disk mapper */ cdev_pppx_init(NPPPX,pppx), /* 92: pppx */ - cdev_fuse_init(NFUSE,fuse), /* 93: fuse */ + cdev_fuse_init(NFUSE,fuse), /* 93: fuse */ cdev_tun_init(NTUN,tap), /* 94: Ethernet network tunnel */ cdev_pvbus_init(NPVBUS,pvbus), /* 95: pvbus(4) control interface */ cdev_ipmi_init(NIPMI,ipmi), /* 96: ipmi */ diff --git a/sys/arch/i386/i386/cpu.c b/sys/arch/i386/i386/cpu.c index c0b989e0d..f973f85ce 100644 --- a/sys/arch/i386/i386/cpu.c +++ b/sys/arch/i386/i386/cpu.c @@ -401,7 +401,7 @@ cpu_init(struct cpu_info *ci) * what we do. */ patinit(ci); - + /* * Enable ring 0 write protection. */ @@ -495,7 +495,7 @@ patinit(struct cpu_info *ci) if ((ci->ci_feature_flags & CPUID_PAT) == 0) return; - /* + /* * Set up PAT bits. * The default pat table is the following: * WB, WT, UC- UC, WB, WT, UC-, UC diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index 778a3fcf4..ba6a3c468 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.423 2023/07/06 06:58:07 deraadt Exp $ */ +/* $OpenBSD: acpi.c,v 1.425 2023/07/08 08:01:10 tobhe Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -28,10 +28,6 @@ #include #include -#ifdef HIBERNATE -#include -#endif - #include #include @@ -47,10 +43,6 @@ #include #include -#define APMUNIT(dev) (minor(dev)&0xf0) -#define APMDEV(dev) (minor(dev)&0x0f) -#define APMDEV_NORMAL 0 -#define APMDEV_CTL 8 #include "wd.h" @@ -3270,6 +3262,17 @@ acpi_foundsbs(struct aml_node *node, void *arg) return (0); } +int +acpi_batcount(struct acpi_softc *sc) +{ + struct acpi_bat *bat; + int count = 0; + + SLIST_FOREACH(bat, &sc->sc_bat, aba_link) + count++; + return count; +} + int acpi_apminfo(struct apm_power_info *pi) { @@ -3373,134 +3376,6 @@ acpi_apminfo(struct apm_power_info *pi) return 0; } -int -acpiopen(dev_t dev, int flag, int mode, struct proc *p) -{ - int error = 0; - struct acpi_softc *sc; - int s; - - if (!acpi_cd.cd_ndevs || APMUNIT(dev) != 0 || - !(sc = acpi_cd.cd_devs[APMUNIT(dev)])) - return (ENXIO); - - s = splbio(); - switch (APMDEV(dev)) { - case APMDEV_CTL: - if (!(flag & FWRITE)) { - error = EINVAL; - break; - } - if (sc->sc_flags & SCFLAG_OWRITE) { - error = EBUSY; - break; - } - sc->sc_flags |= SCFLAG_OWRITE; - break; - case APMDEV_NORMAL: - if (!(flag & FREAD) || (flag & FWRITE)) { - error = EINVAL; - break; - } - sc->sc_flags |= SCFLAG_OREAD; - break; - default: - error = ENXIO; - break; - } - splx(s); - return (error); -} - -int -acpiclose(dev_t dev, int flag, int mode, struct proc *p) -{ - int error = 0; - struct acpi_softc *sc; - int s; - - if (!acpi_cd.cd_ndevs || APMUNIT(dev) != 0 || - !(sc = acpi_cd.cd_devs[APMUNIT(dev)])) - return (ENXIO); - - s = splbio(); - switch (APMDEV(dev)) { - case APMDEV_CTL: - sc->sc_flags &= ~SCFLAG_OWRITE; - break; - case APMDEV_NORMAL: - sc->sc_flags &= ~SCFLAG_OREAD; - break; - default: - error = ENXIO; - break; - } - splx(s); - return (error); -} - -int -acpiioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) -{ - int error = 0; - struct acpi_softc *sc; - struct apm_power_info *pi = (struct apm_power_info *)data; - int s; - - if (!acpi_cd.cd_ndevs || APMUNIT(dev) != 0 || - !(sc = acpi_cd.cd_devs[APMUNIT(dev)])) - return (ENXIO); - - s = splbio(); - /* fake APM */ - switch (cmd) { - case APM_IOC_SUSPEND: - case APM_IOC_STANDBY: - if ((flag & FWRITE) == 0) { - error = EBADF; - break; - } - acpi_addtask(sc, acpi_sleep_task, sc, SLEEP_SUSPEND); - acpi_wakeup(sc); - break; -#ifdef HIBERNATE - case APM_IOC_HIBERNATE: - if ((error = suser(p)) != 0) - break; - if ((flag & FWRITE) == 0) { - error = EBADF; - break; - } - if (get_hibernate_io_function(swdevt[0].sw_dev) == NULL) { - error = EOPNOTSUPP; - break; - } - acpi_addtask(sc, acpi_sleep_task, sc, SLEEP_HIBERNATE); - acpi_wakeup(sc); - break; -#endif - case APM_IOC_GETPOWER: - error = acpi_apminfo(pi); - break; - - default: - error = ENOTTY; - } - - splx(s); - return (error); -} - -void acpi_filtdetach(struct knote *); -int acpi_filtread(struct knote *, long); - -const struct filterops acpiread_filtops = { - .f_flags = FILTEROP_ISFD, - .f_attach = NULL, - .f_detach = acpi_filtdetach, - .f_event = acpi_filtread, -}; - int acpi_evindex; int @@ -3514,77 +3389,4 @@ acpi_record_event(struct acpi_softc *sc, u_int type) return (0); } -void -acpi_filtdetach(struct knote *kn) -{ - struct acpi_softc *sc = kn->kn_hook; - int s; - - s = splbio(); - klist_remove_locked(&sc->sc_note, kn); - splx(s); -} - -int -acpi_filtread(struct knote *kn, long hint) -{ - /* XXX weird kqueue_scan() semantics */ - if (hint && !kn->kn_data) - kn->kn_data = hint; - return (1); -} - -int -acpikqfilter(dev_t dev, struct knote *kn) -{ - struct acpi_softc *sc; - int s; - - if (!acpi_cd.cd_ndevs || APMUNIT(dev) != 0 || - !(sc = acpi_cd.cd_devs[APMUNIT(dev)])) - return (ENXIO); - - switch (kn->kn_filter) { - case EVFILT_READ: - kn->kn_fop = &acpiread_filtops; - break; - default: - return (EINVAL); - } - - kn->kn_hook = sc; - - s = splbio(); - klist_insert_locked(&sc->sc_note, kn); - splx(s); - - return (0); -} - -#else /* SMALL_KERNEL */ - -int -acpiopen(dev_t dev, int flag, int mode, struct proc *p) -{ - return (ENXIO); -} - -int -acpiclose(dev_t dev, int flag, int mode, struct proc *p) -{ - return (ENXIO); -} - -int -acpiioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) -{ - return (ENXIO); -} - -int -acpikqfilter(dev_t dev, struct knote *kn) -{ - return (EOPNOTSUPP); -} - #endif /* SMALL_KERNEL */ diff --git a/sys/dev/acpi/acpi_apm.c b/sys/dev/acpi/acpi_apm.c new file mode 100644 index 000000000..dc222cec1 --- /dev/null +++ b/sys/dev/acpi/acpi_apm.c @@ -0,0 +1,251 @@ +/* $OpenBSD: acpi_apm.c,v 1.2 2023/07/08 14:44:43 tobhe Exp $ */ +/* + * Copyright (c) 2005 Thorsten Lockert + * Copyright (c) 2005 Jordan Hargrave + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#ifdef HIBERNATE +#include +#endif + +#include +#define APMUNIT(dev) (minor(dev)&0xf0) +#define APMDEV(dev) (minor(dev)&0x0f) +#define APMDEV_NORMAL 0 +#define APMDEV_CTL 8 + +#ifndef SMALL_KERNEL + +int +acpiopen(dev_t dev, int flag, int mode, struct proc *p) +{ + int error = 0; + struct acpi_softc *sc = acpi_softc; + int s; + + s = splbio(); + switch (APMDEV(dev)) { + case APMDEV_CTL: + if (!(flag & FWRITE)) { + error = EINVAL; + break; + } + if (sc->sc_flags & SCFLAG_OWRITE) { + error = EBUSY; + break; + } + sc->sc_flags |= SCFLAG_OWRITE; + break; + case APMDEV_NORMAL: + if (!(flag & FREAD) || (flag & FWRITE)) { + error = EINVAL; + break; + } + sc->sc_flags |= SCFLAG_OREAD; + break; + default: + error = ENXIO; + break; + } + splx(s); + return (error); +} + +int +acpiclose(dev_t dev, int flag, int mode, struct proc *p) +{ + int error = 0; + struct acpi_softc *sc = acpi_softc; + int s; + + s = splbio(); + switch (APMDEV(dev)) { + case APMDEV_CTL: + sc->sc_flags &= ~SCFLAG_OWRITE; + break; + case APMDEV_NORMAL: + sc->sc_flags &= ~SCFLAG_OREAD; + break; + default: + error = ENXIO; + break; + } + splx(s); + return (error); +} + +int +acpiioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) +{ + int error = 0; + struct acpi_softc *sc = acpi_softc; + struct apm_power_info *pi = (struct apm_power_info *)data; + int s; + + s = splbio(); + /* fake APM */ + switch (cmd) { +#ifdef SUSPEND + case APM_IOC_SUSPEND: + case APM_IOC_STANDBY: + if ((flag & FWRITE) == 0) { + error = EBADF; + break; + } + error = request_sleep(SLEEP_SUSPEND); + if (error) + break; + acpi_wakeup(sc); + break; +#ifdef HIBERNATE + case APM_IOC_HIBERNATE: + if ((error = suser(p)) != 0) + break; + if ((flag & FWRITE) == 0) { + error = EBADF; + break; + } + if (get_hibernate_io_function(swdevt[0].sw_dev) == NULL) { + error = EOPNOTSUPP; + break; + } + error = request_sleep(SLEEP_HIBERNATE); + if (error) + break; + acpi_wakeup(sc); + break; +#endif +#endif + case APM_IOC_GETPOWER: + error = acpi_apminfo(pi); + break; + + default: + error = ENOTTY; + } + + splx(s); + return (error); +} + +void acpi_filtdetach(struct knote *); +int acpi_filtread(struct knote *, long); + +const struct filterops acpiread_filtops = { + .f_flags = FILTEROP_ISFD, + .f_attach = NULL, + .f_detach = acpi_filtdetach, + .f_event = acpi_filtread, +}; + +int +acpikqfilter(dev_t dev, struct knote *kn) +{ + struct acpi_softc *sc = acpi_softc; + int s; + + switch (kn->kn_filter) { + case EVFILT_READ: + kn->kn_fop = &acpiread_filtops; + break; + default: + return (EINVAL); + } + + kn->kn_hook = sc; + + s = splbio(); + klist_insert_locked(&sc->sc_note, kn); + splx(s); + + return (0); +} + +void +acpi_filtdetach(struct knote *kn) +{ + struct acpi_softc *sc = kn->kn_hook; + int s; + + s = splbio(); + klist_remove_locked(&sc->sc_note, kn); + splx(s); +} + +int +acpi_filtread(struct knote *kn, long hint) +{ + /* XXX weird kqueue_scan() semantics */ + if (hint && !kn->kn_data) + kn->kn_data = hint; + return (1); +} + +#ifdef SUSPEND +int +request_sleep(int sleepmode) +{ + struct acpi_softc *sc = acpi_softc; + +#ifdef HIBERNATE + if (sleepmode == SLEEP_HIBERNATE) { + if (get_hibernate_io_function(swdevt[0].sw_dev) == NULL) + return EOPNOTSUPP; + } +#endif + acpi_addtask(sc, acpi_sleep_task, sc, sleepmode); + return 0; +} +#endif /* SUSPEND */ + +#else /* SMALL_KERNEL */ + +int +acpiopen(dev_t dev, int flag, int mode, struct proc *p) +{ + return (ENXIO); +} + +int +acpiclose(dev_t dev, int flag, int mode, struct proc *p) +{ + return (ENXIO); +} + +int +acpiioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) +{ + return (ENXIO); +} + +int +acpikqfilter(dev_t dev, struct knote *kn) +{ + return (EOPNOTSUPP); +} + +#endif /* SMALL_KERNEL */ diff --git a/sys/dev/acpi/acpithinkpad.c b/sys/dev/acpi/acpithinkpad.c index e9f7a0247..f2f994758 100644 --- a/sys/dev/acpi/acpithinkpad.c +++ b/sys/dev/acpi/acpithinkpad.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpithinkpad.c,v 1.73 2023/05/20 12:02:46 kettenis Exp $ */ +/* $OpenBSD: acpithinkpad.c,v 1.74 2023/07/07 07:37:59 claudio Exp $ */ /* * Copyright (c) 2008 joshua stein * @@ -906,16 +906,18 @@ thinkpad_battery_inhibit_charge(int state) { struct acpithinkpad_softc *sc = acpithinkpad_cd.cd_devs[0]; struct aml_value arg; - int battery = 1; + int battery, count; uint64_t ret; - memset(&arg, 0, sizeof(arg)); - arg.type = AML_OBJTYPE_INTEGER; - arg.v_integer = (0xffff << 8) | (battery << 4) | state; - if (aml_evalinteger(sc->sc_acpi, sc->sc_devnode, "BICS", - 1, &arg, &ret) || (ret & THINKPAD_BATTERY_ERROR)) - return EIO; - + count = acpi_batcount(sc->sc_acpi); + for (battery = 1; battery <= count; battery++) { + memset(&arg, 0, sizeof(arg)); + arg.type = AML_OBJTYPE_INTEGER; + arg.v_integer = (0xffff << 8) | (battery << 4) | state; + if (aml_evalinteger(sc->sc_acpi, sc->sc_devnode, "BICS", + 1, &arg, &ret) || (ret & THINKPAD_BATTERY_ERROR)) + return EIO; + } return 0; } @@ -924,16 +926,18 @@ thinkpad_battery_force_discharge(int state) { struct acpithinkpad_softc *sc = acpithinkpad_cd.cd_devs[0]; struct aml_value arg; - int battery = 1; + int battery, count; uint64_t ret; - memset(&arg, 0, sizeof(arg)); - arg.type = AML_OBJTYPE_INTEGER; - arg.v_integer = (battery << THINKPAD_BATTERY_SHIFT) | state; - if (aml_evalinteger(sc->sc_acpi, sc->sc_devnode, "BDSS", - 1, &arg, &ret) || (ret & THINKPAD_BATTERY_ERROR)) - return EIO; - + count = acpi_batcount(sc->sc_acpi); + for (battery = 1; battery <= count; battery++) { + memset(&arg, 0, sizeof(arg)); + arg.type = AML_OBJTYPE_INTEGER; + arg.v_integer = (battery << THINKPAD_BATTERY_SHIFT) | state; + if (aml_evalinteger(sc->sc_acpi, sc->sc_devnode, "BDSS", + 1, &arg, &ret) || (ret & THINKPAD_BATTERY_ERROR)) + return EIO; + } return 0; } @@ -980,19 +984,21 @@ thinkpad_battery_setchargestart(int start) { struct acpithinkpad_softc *sc = acpithinkpad_cd.cd_devs[0]; struct aml_value arg; - int battery = 1; + int battery, count; uint64_t ret; if (start >= hw_battery_chargestop) return EINVAL; - memset(&arg, 0, sizeof(arg)); - arg.type = AML_OBJTYPE_INTEGER; - arg.v_integer = (battery << THINKPAD_BATTERY_SHIFT) | start; - if (aml_evalinteger(sc->sc_acpi, sc->sc_devnode, "BCCS", - 1, &arg, &ret) || (ret & THINKPAD_BATTERY_ERROR)) - return EIO; - + count = acpi_batcount(sc->sc_acpi); + for (battery = 1; battery <= count; battery++) { + memset(&arg, 0, sizeof(arg)); + arg.type = AML_OBJTYPE_INTEGER; + arg.v_integer = (battery << THINKPAD_BATTERY_SHIFT) | start; + if (aml_evalinteger(sc->sc_acpi, sc->sc_devnode, "BCCS", + 1, &arg, &ret) || (ret & THINKPAD_BATTERY_ERROR)) + return EIO; + } hw_battery_chargestart = start; return 0; } @@ -1002,7 +1008,7 @@ thinkpad_battery_setchargestop(int stop) { struct acpithinkpad_softc *sc = acpithinkpad_cd.cd_devs[0]; struct aml_value arg; - int battery = 1; + int battery, count; uint64_t ret; if (stop <= hw_battery_chargestart) @@ -1011,13 +1017,15 @@ thinkpad_battery_setchargestop(int stop) if (stop == 100) stop = 0; - memset(&arg, 0, sizeof(arg)); - arg.type = AML_OBJTYPE_INTEGER; - arg.v_integer = (battery << THINKPAD_BATTERY_SHIFT) | stop; - if (aml_evalinteger(sc->sc_acpi, sc->sc_devnode, "BCSS", - 1, &arg, &ret) || (ret & THINKPAD_BATTERY_ERROR)) - return EIO; - + count = acpi_batcount(sc->sc_acpi); + for (battery = 1; battery <= count; battery++) { + memset(&arg, 0, sizeof(arg)); + arg.type = AML_OBJTYPE_INTEGER; + arg.v_integer = (battery << THINKPAD_BATTERY_SHIFT) | stop; + if (aml_evalinteger(sc->sc_acpi, sc->sc_devnode, "BCSS", + 1, &arg, &ret) || (ret & THINKPAD_BATTERY_ERROR)) + return EIO; + } hw_battery_chargestop = (stop == 0) ? 100 : stop; return 0; } diff --git a/sys/dev/acpi/acpivar.h b/sys/dev/acpi/acpivar.h index d783dd26d..51eae666f 100644 --- a/sys/dev/acpi/acpivar.h +++ b/sys/dev/acpi/acpivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: acpivar.h,v 1.123 2023/06/29 20:58:08 dv Exp $ */ +/* $OpenBSD: acpivar.h,v 1.124 2023/07/07 07:37:59 claudio Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * @@ -385,6 +385,7 @@ void acpi_indicator(struct acpi_softc *, int); void acpi_disable_allgpes(struct acpi_softc *); void acpi_enable_wakegpes(struct acpi_softc *, int); +int acpi_batcount(struct acpi_softc *); struct apm_power_info; int acpi_apminfo(struct apm_power_info *); diff --git a/sys/dev/acpi/dwiic_acpi.c b/sys/dev/acpi/dwiic_acpi.c index acfe7b532..1dd92de53 100644 --- a/sys/dev/acpi/dwiic_acpi.c +++ b/sys/dev/acpi/dwiic_acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwiic_acpi.c,v 1.21 2023/04/23 00:33:02 dlg Exp $ */ +/* $OpenBSD: dwiic_acpi.c,v 1.22 2023/07/08 02:43:02 jcs Exp $ */ /* * Synopsys DesignWare I2C controller * @@ -50,6 +50,8 @@ int dwiic_acpi_found_ihidev(struct dwiic_softc *, struct aml_node *, char *, struct dwiic_crs); int dwiic_acpi_found_iatp(struct dwiic_softc *, struct aml_node *, char *, struct dwiic_crs); +int dwiic_acpi_found_ietp(struct dwiic_softc *, struct aml_node *, + char *, struct dwiic_crs); void dwiic_acpi_get_params(struct dwiic_softc *, char *, uint16_t *, uint16_t *, uint32_t *); void dwiic_acpi_power(struct dwiic_softc *, int); @@ -87,6 +89,63 @@ const char *ihidev_hids[] = { NULL }; +const char *ietp_hids[] = { + "ELAN0000", + "ELAN0100", + "ELAN0600", + "ELAN0601", + "ELAN0602", + "ELAN0603", + "ELAN0604", + "ELAN0605", + "ELAN0606", + "ELAN0607", + "ELAN0608", + "ELAN0609", + "ELAN060B", + "ELAN060C", + "ELAN060F", + "ELAN0610", + "ELAN0611", + "ELAN0612", + "ELAN0615", + "ELAN0616", + "ELAN0617", + "ELAN0618", + "ELAN0619", + "ELAN061A", + "ELAN061B", + "ELAN061C", + "ELAN061D", + "ELAN061E", + "ELAN061F", + "ELAN0620", + "ELAN0621", + "ELAN0622", + "ELAN0623", + "ELAN0624", + "ELAN0625", + "ELAN0626", + "ELAN0627", + "ELAN0628", + "ELAN0629", + "ELAN062A", + "ELAN062B", + "ELAN062C", + "ELAN062D", + "ELAN062E", /* Lenovo V340 Whiskey Lake U */ + "ELAN062F", /* Lenovo V340 Comet Lake U */ + "ELAN0631", + "ELAN0632", + "ELAN0633", /* Lenovo S145 */ + "ELAN0634", /* Lenovo V340 Ice lake */ + "ELAN0635", /* Lenovo V1415-IIL */ + "ELAN0636", /* Lenovo V1415-Dali */ + "ELAN0637", /* Lenovo V1415-IGLR */ + "ELAN1000", + NULL +}; + const char *iatp_hids[] = { "ATML0000", "ATML0001", @@ -417,6 +476,8 @@ dwiic_acpi_found_hid(struct aml_node *node, void *arg) return dwiic_acpi_found_ihidev(sc, node, dev, crs); else if (dwiic_matchhids(dev, iatp_hids)) return dwiic_acpi_found_iatp(sc, node, dev, crs); + else if (dwiic_matchhids(dev, ietp_hids) || dwiic_matchhids(cdev, ietp_hids)) + return dwiic_acpi_found_ietp(sc, node, dev, crs); memset(&ia, 0, sizeof(ia)); ia.ia_tag = sc->sc_iba.iba_tag; @@ -504,6 +565,32 @@ dwiic_acpi_found_ihidev(struct dwiic_softc *sc, struct aml_node *node, return 1; } +int +dwiic_acpi_found_ietp(struct dwiic_softc *sc, struct aml_node *node, + char *dev, struct dwiic_crs crs) +{ + struct i2c_attach_args ia; + + memset(&ia, 0, sizeof(ia)); + ia.ia_tag = sc->sc_iba.iba_tag; + ia.ia_size = 1; + ia.ia_name = "ietp"; + ia.ia_addr = crs.i2c_addr; + ia.ia_cookie = dev; + + if (sc->sc_poll_ihidev) + ia.ia_poll = 1; + if (!(crs.irq_int == 0 && crs.gpio_int_node == NULL)) + ia.ia_intr = &crs; + + if (config_found(sc->sc_iic, &ia, dwiic_i2c_print)) { + node->parent->attached = 1; + return 0; + } + + return 1; +} + int dwiic_acpi_found_iatp(struct dwiic_softc *sc, struct aml_node *node, char *dev, struct dwiic_crs crs) diff --git a/sys/dev/dt/dt_prov_static.c b/sys/dev/dt/dt_prov_static.c index e446844f5..dc2398175 100644 --- a/sys/dev/dt/dt_prov_static.c +++ b/sys/dev/dt/dt_prov_static.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dt_prov_static.c,v 1.19 2023/06/28 11:49:49 kn Exp $ */ +/* $OpenBSD: dt_prov_static.c,v 1.20 2023/07/06 19:46:53 kn Exp $ */ /* * Copyright (c) 2019 Martin Pieuchot @@ -92,6 +92,7 @@ DT_STATIC_PROBE2(smr, thread, "uint64_t", "uint64_t"); * reference counting, keep in sync with sys/refcnt.h */ DT_STATIC_PROBE0(refcnt, none); +DT_STATIC_PROBE3(refcnt, ethmulti, "void *", "int", "int"); DT_STATIC_PROBE3(refcnt, ifaddr, "void *", "int", "int"); DT_STATIC_PROBE3(refcnt, ifmaddr, "void *", "int", "int"); DT_STATIC_PROBE3(refcnt, inpcb, "void *", "int", "int"); @@ -140,6 +141,7 @@ struct dt_probe *const dtps_static[] = { &_DT_STATIC_P(smr, thread), /* refcnt */ &_DT_STATIC_P(refcnt, none), + &_DT_STATIC_P(refcnt, ethmulti), &_DT_STATIC_P(refcnt, ifaddr), &_DT_STATIC_P(refcnt, ifmaddr), &_DT_STATIC_P(refcnt, inpcb), diff --git a/sys/dev/fdt/axppmic.c b/sys/dev/fdt/axppmic.c index d11d3ce9e..ec089ad40 100644 --- a/sys/dev/fdt/axppmic.c +++ b/sys/dev/fdt/axppmic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: axppmic.c,v 1.16 2022/09/03 18:05:10 kettenis Exp $ */ +/* $OpenBSD: axppmic.c,v 1.17 2023/07/06 20:02:36 uaa Exp $ */ /* * Copyright (c) 2017 Mark Kettenis * @@ -65,180 +65,180 @@ struct axppmic_regdata { const char *name; uint8_t ereg, emask, eval, dval; uint8_t vreg, vmask; - uint32_t base, delta; - uint32_t base2, delta2; + uint32_t base, delta, nsteps; + uint32_t base2, delta2, nsteps2; }; const struct axppmic_regdata axp209_regdata[] = { { "dcdc2", 0x12, (1 << 4), (1 << 4), (0 << 4), - 0x23, 0x3f, 700000, 25000 }, + 0x23, 0x3f, 700000, 25000, 64 }, { "dcdc3", 0x12, (1 << 1), (1 << 1), (0 << 1), - 0x27, 0x3f, 700000, 25000 }, + 0x27, 0x7f, 700000, 25000, 113 }, /* LDO1 can't be controlled */ { "ldo2", 0x12, (1 << 2), (1 << 2), (0 << 2), - 0x28, 0xf0, 1800000, (100000 >> 4) }, + 0x28, 0xf0, 1800000, (100000 >> 4), (16 << 4) }, { "ldo3", 0x12, (1 << 6), (1 << 6), (0 << 6), - 0x29, 0x7f, 700000, 25000 }, + 0x29, 0x7f, 700000, 25000, 113 }, /* LDO4 voltage levels are complicated */ { "ldo5", 0x90, 0x07, 0x03, 0x07, - 0x91, 0xf0, 1800000, (100000 >> 4) }, + 0x91, 0xf0, 1800000, (100000 >> 4), (16 << 4) }, { NULL } }; const struct axppmic_regdata axp221_regdata[] = { { "dcdc1", 0x10, (1 << 1), (1 << 1), (0 << 1), - 0x21, 0x1f, 1600000, 100000 }, + 0x21, 0x1f, 1600000, 100000, 19 }, { "dcdc2", 0x10, (1 << 2), (1 << 2), (0 << 2), - 0x22, 0x3f, 600000, 20000 }, + 0x22, 0x3f, 600000, 20000, 48 }, { "dcdc3", 0x10, (1 << 3), (1 << 3), (0 << 3), - 0x23, 0x3f, 600000, 20000 }, + 0x23, 0x3f, 600000, 20000, 64 }, { "dcdc4", 0x10, (1 << 4), (1 << 4), (0 << 4), - 0x24, 0x3f, 600000, 20000 }, + 0x24, 0x3f, 600000, 20000, 48 }, { "dcdc5", 0x10, (1 << 5), (1 << 5), (0 << 5), - 0x25, 0x1f, 1000000, 50000 }, + 0x25, 0x1f, 1000000, 50000, 32 }, { "dc1sw", 0x12, (1 << 7), (1 << 7), (0 << 7) }, { "dc5ldo", 0x10, (1 << 0), (1 << 0), (0 << 0), - 0x1c, 0x07, 700000, 100000 }, + 0x1c, 0x07, 700000, 100000, 8 }, { "aldo1", 0x10, (1 << 6), (1 << 6), (0 << 6), - 0x28, 0x1f, 700000, 100000 }, + 0x28, 0x1f, 700000, 100000, 27 }, { "aldo2", 0x10, (1 << 7), (1 << 7), (0 << 7), - 0x29, 0x1f, 700000, 100000 }, + 0x29, 0x1f, 700000, 100000, 27 }, { "aldo3", 0x13, (1 << 7), (1 << 7), (0 << 7), - 0x2a, 0x1f, 700000, 100000 }, + 0x2a, 0x1f, 700000, 100000, 27 }, { "dldo1", 0x12, (1 << 3), (1 << 3), (0 << 3), - 0x15, 0x1f, 700000, 100000 }, + 0x15, 0x1f, 700000, 100000, 27 }, { "dldo2", 0x12, (1 << 4), (1 << 4), (0 << 4), - 0x16, 0x1f, 700000, 100000 }, + 0x16, 0x1f, 700000, 100000, 27 }, { "dldo3", 0x12, (1 << 5), (1 << 5), (0 << 5), - 0x17, 0x1f, 700000, 100000 }, + 0x17, 0x1f, 700000, 100000, 27 }, { "dldo4", 0x12, (1 << 6), (1 << 6), (0 << 6), - 0x18, 0x1f, 700000, 100000 }, + 0x18, 0x1f, 700000, 100000, 27 }, { "eldo1", 0x12, (1 << 0), (1 << 0), (0 << 0), - 0x19, 0x1f, 700000, 100000 }, + 0x19, 0x1f, 700000, 100000, 27 }, { "eldo2", 0x12, (1 << 1), (1 << 1), (0 << 1), - 0x1a, 0x1f, 700000, 100000 }, + 0x1a, 0x1f, 700000, 100000, 27 }, { "eldo3", 0x12, (1 << 2), (1 << 2), (0 << 2), - 0x1b, 0x1f, 700000, 100000 }, + 0x1b, 0x1f, 700000, 100000, 27 }, { "ldo_io0", 0x90, 0x07, 0x03, 0x04, - 0x91, 0x1f, 700000, 100000 }, + 0x91, 0x1f, 700000, 100000, 27 }, { "ldo_io1", 0x92, 0x07, 0x03, 0x04, - 0x93, 0x1f, 700000, 100000 }, + 0x93, 0x1f, 700000, 100000, 27 }, { NULL } }; const struct axppmic_regdata axp803_regdata[] = { { "dcdc1", 0x10, (1 << 0), (1 << 0), (0 << 0), - 0x20, 0x1f, 1600000, 100000 }, + 0x20, 0x1f, 1600000, 100000, 19 }, { "dcdc2", 0x10, (1 << 1), (1 << 1), (0 << 1), - 0x21, 0x7f, 500000, 10000, 1220000, 20000 }, + 0x21, 0x7f, 500000, 10000, 71, 1220000, 20000, 5 }, { "dcdc3", 0x10, (1 << 2), (1 << 2), (0 << 2), - 0x22, 0x7f, 500000, 10000, 1220000, 20000 }, + 0x22, 0x7f, 500000, 10000, 71, 1220000, 20000, 5 }, { "dcdc4", 0x10, (1 << 3), (1 << 3), (0 << 3), - 0x23, 0x7f, 500000, 10000, 1220000, 20000 }, + 0x23, 0x7f, 500000, 10000, 71, 1220000, 20000, 5 }, { "dcdc5", 0x10, (1 << 4), (1 << 4), (0 << 4), - 0x24, 0x7f, 800000, 10000, 1140000, 20000 }, + 0x24, 0x7f, 800000, 10000, 33, 1140000, 20000, 36 }, { "dcdc6", 0x10, (1 << 5), (1 << 5), (0 << 5), - 0x25, 0x7f, 600000, 10000, 1120000, 20000 }, + 0x25, 0x7f, 600000, 10000, 51, 1120000, 20000, 21 }, { "dc1sw", 0x12, (1 << 7), (1 << 7), (0 << 7) }, { "aldo1", 0x13, (1 << 5), (1 << 5), (0 << 5), - 0x28, 0x1f, 700000, 100000 }, + 0x28, 0x1f, 700000, 100000, 27 }, { "aldo2", 0x13, (1 << 6), (1 << 6), (0 << 6), - 0x29, 0x1f, 700000, 100000 }, + 0x29, 0x1f, 700000, 100000, 27 }, { "aldo3", 0x13, (1 << 7), (1 << 7), (0 << 7), - 0x2a, 0x1f, 700000, 100000 }, + 0x2a, 0x1f, 700000, 100000, 27 }, { "dldo1", 0x12, (1 << 3), (1 << 3), (0 << 3), - 0x15, 0x1f, 700000, 100000 }, + 0x15, 0x1f, 700000, 100000, 27 }, { "dldo2", 0x12, (1 << 4), (1 << 4), (0 << 4), - 0x16, 0x1f, 700000, 100000, 3400000, 200000 }, + 0x16, 0x1f, 700000, 100000, 27, 3400000, 200000, 5 }, { "dldo3", 0x12, (1 << 5), (1 << 5), (0 << 5), - 0x17, 0x1f, 700000, 100000 }, + 0x17, 0x1f, 700000, 100000, 27 }, { "dldo4", 0x12, (1 << 6), (1 << 6), (0 << 6), - 0x18, 0x1f, 700000, 100000 }, + 0x18, 0x1f, 700000, 100000, 27 }, { "eldo1", 0x12, (1 << 0), (1 << 0), (0 << 0), - 0x19, 0x1f, 700000, 50000 }, + 0x19, 0x1f, 700000, 50000, 25 }, { "eldo2", 0x12, (1 << 1), (1 << 1), (0 << 1), - 0x1a, 0x1f, 700000, 50000 }, + 0x1a, 0x1f, 700000, 50000, 25 }, { "eldo3", 0x12, (1 << 2), (1 << 2), (0 << 2), - 0x1b, 0x1f, 700000, 50000 }, + 0x1b, 0x1f, 700000, 50000, 25 }, { "fldo1", 0x13, (1 << 2), (1 << 2), (0 << 2), - 0x1c, 0x0f, 700000, 50000 }, + 0x1c, 0x0f, 700000, 50000, 16 }, { "fldo2", 0x13, (1 << 3), (1 << 3), (0 << 3), - 0x1d, 0x0f, 700000, 50000 }, + 0x1d, 0x0f, 700000, 50000, 16 }, { "ldo-io0", 0x90, 0x07, 0x03, 0x04, - 0x91, 0x1f, 700000, 100000 }, + 0x91, 0x1f, 700000, 100000, 27 }, { "ldo-io1", 0x92, 0x07, 0x03, 0x04, - 0x93, 0x1f, 700000, 100000 }, + 0x93, 0x1f, 700000, 100000, 27 }, { NULL } }; const struct axppmic_regdata axp806_regdata[] = { { "dcdca", 0x10, (1 << 0), (1 << 0), (0 << 0), - 0x12, 0x7f, 600000, 10000, 1120000, 20000 }, + 0x12, 0x7f, 600000, 10000, 51, 1120000, 20000, 21 }, { "dcdcb", 0x10, (1 << 1), (1 << 1), (0 << 1), - 0x13, 0x1f, 1000000, 50000 }, + 0x13, 0x1f, 1000000, 50000, 32 }, { "dcdcc", 0x10, (1 << 2), (1 << 2), (0 << 2), - 0x14, 0x7f, 600000, 10000, 1120000, 20000 }, + 0x14, 0x7f, 600000, 10000, 51, 1120000, 20000, 21 }, { "dcdcd", 0x10, (1 << 3), (1 << 3), (0 << 3), - 0x15, 0x3f, 600000, 20000, 1600000, 100000 }, + 0x15, 0x3f, 600000, 20000, 46, 1600000, 100000, 18 }, { "dcdce", 0x10, (1 << 4), (1 << 4), (0 << 4), - 0x16, 0x1f, 1100000, 100000 }, + 0x16, 0x1f, 1100000, 100000, 24 }, { "aldo1", 0x10, (1 << 5), (1 << 5), (0 << 5), - 0x17, 0x1f, 700000, 100000 }, + 0x17, 0x1f, 700000, 100000, 27 }, { "aldo2", 0x10, (1 << 6), (1 << 6), (0 << 6), - 0x18, 0x1f, 700000, 100000 }, + 0x18, 0x1f, 700000, 100000, 27 }, { "aldo3", 0x10, (1 << 7), (1 << 7), (0 << 7), - 0x19, 0x1f, 700000, 100000 }, + 0x19, 0x1f, 700000, 100000, 27 }, { "bldo1", 0x11, (1 << 0), (1 << 0), (0 << 0), - 0x20, 0x0f, 700000, 100000 }, + 0x20, 0x0f, 700000, 100000, 13 }, { "bldo2", 0x11, (1 << 1), (1 << 1), (0 << 1), - 0x21, 0x0f, 700000, 100000 }, + 0x21, 0x0f, 700000, 100000, 13 }, { "bldo3", 0x11, (1 << 2), (1 << 2), (0 << 2), - 0x22, 0x0f, 700000, 100000 }, + 0x22, 0x0f, 700000, 100000, 13 }, { "bldo4", 0x11, (1 << 3), (1 << 3), (0 << 3), - 0x23, 0x0f, 700000, 100000 }, + 0x23, 0x0f, 700000, 100000, 13 }, { "cldo1", 0x11, (1 << 4), (1 << 4), (0 << 4), - 0x24, 0x1f, 700000, 100000 }, + 0x24, 0x1f, 700000, 100000 , 27}, { "cldo2", 0x11, (1 << 5), (1 << 5), (0 << 5), - 0x25, 0x1f, 700000, 100000, 3600000, 200000 }, + 0x25, 0x1f, 700000, 100000, 28, 3600000, 200000, 4 }, { "cldo3", 0x11, (1 << 6), (1 << 6), (0 << 6), - 0x26, 0x1f, 700000, 100000 }, + 0x26, 0x1f, 700000, 100000, 27 }, { "sw", 0x11, (1 << 7), (1 << 7), (0 << 7) }, { NULL } }; const struct axppmic_regdata axp809_regdata[] = { { "dcdc1", 0x10, (1 << 1), (1 << 1), (0 << 1), - 0x21, 0x1f, 1600000, 100000 }, + 0x21, 0x1f, 1600000, 100000, 19 }, { "dcdc2", 0x10, (1 << 2), (1 << 2), (0 << 2), - 0x22, 0x3f, 600000, 20000 }, + 0x22, 0x3f, 600000, 20000, 48 }, { "dcdc3", 0x10, (1 << 3), (1 << 3), (0 << 3), - 0x23, 0x3f, 600000, 20000 }, + 0x23, 0x3f, 600000, 20000, 64 }, { "dcdc4", 0x10, (1 << 4), (1 << 4), (0 << 4), - 0x24, 0x3f, 600000, 20000, 1800000, 100000 }, + 0x24, 0x3f, 600000, 20000, 48, 1800000, 100000, 9 }, { "dcdc5", 0x10, (1 << 5), (1 << 5), (0 << 5), - 0x25, 0x1f, 1000000, 50000 }, + 0x25, 0x1f, 1000000, 50000, 32 }, { "dc5ldo", 0x10, (1 << 0), (1 << 0), (0 << 0), - 0x1c, 0x07, 700000, 100000 }, + 0x1c, 0x07, 700000, 100000, 8 }, { "aldo1", 0x10, (1 << 6), (1 << 6), (0 << 6), - 0x28, 0x1f, 700000, 100000 }, + 0x28, 0x1f, 700000, 100000, 27 }, { "aldo2", 0x10, (1 << 7), (1 << 7), (0 << 7), - 0x29, 0x1f, 700000, 100000 }, + 0x29, 0x1f, 700000, 100000, 27 }, { "aldo3", 0x12, (1 << 5), (1 << 5), (0 << 5), - 0x2a, 0x1f, 700000, 100000 }, + 0x2a, 0x1f, 700000, 100000, 27 }, { "dldo1", 0x12, (1 << 3), (1 << 3), (0 << 3), - 0x15, 0x1f, 700000, 100000 }, + 0x15, 0x1f, 700000, 100000, 27, 3400000, 200000, 5 }, { "dldo2", 0x12, (1 << 4), (1 << 4), (0 << 4), - 0x16, 0x1f, 700000, 100000 }, + 0x16, 0x1f, 700000, 100000, 27 }, { "eldo1", 0x12, (1 << 0), (1 << 0), (0 << 0), - 0x19, 0x1f, 700000, 100000 }, + 0x19, 0x1f, 700000, 100000, 27 }, { "eldo2", 0x12, (1 << 1), (1 << 1), (0 << 1), - 0x1a, 0x1f, 700000, 100000 }, + 0x1a, 0x1f, 700000, 100000, 27 }, { "eldo3", 0x12, (1 << 2), (1 << 2), (0 << 2), - 0x1b, 0x1f, 700000, 100000 }, + 0x1b, 0x1f, 700000, 100000, 27 }, { "ldo_io0", 0x90, 0x07, 0x03, 0x04, - 0x91, 0x1f, 700000, 100000 }, + 0x91, 0x1f, 700000, 100000, 27 }, { "ldo_io1", 0x92, 0x07, 0x03, 0x04, - 0x93, 0x1f, 700000, 100000 }, + 0x93, 0x1f, 700000, 100000, 27 }, { NULL } }; @@ -306,6 +306,7 @@ const struct axppmic_device axppmic_devices[] = { { "x-powers,axp209", "AXP209", axp209_regdata, axp209_sensdata }, { "x-powers,axp221", "AXP221", axp221_regdata, axp221_sensdata }, { "x-powers,axp223", "AXP223", axp221_regdata, axp221_sensdata }, + { "x-powers,axp305", "AXP305", axp806_regdata }, { "x-powers,axp803", "AXP803", axp803_regdata, axp803_sensdata }, { "x-powers,axp805", "AXP805", axp806_regdata }, { "x-powers,axp806", "AXP806", axp806_regdata }, @@ -511,7 +512,8 @@ axppmic_attach_common(struct axppmic_softc *sc, const char *name, int node) sc->sc_sensdata = device->sensdata; /* Switch AXP806 into master or slave mode. */ - if (strcmp(name, "x-powers,axp805") == 0 || + if (strcmp(name, "x-powers,axp305") == 0 || + strcmp(name, "x-powers,axp805") == 0 || strcmp(name, "x-powers,axp806") == 0) { if (OF_getproplen(node, "x-powers,master-mode") == 0 || OF_getproplen(node, "x-powers,self-working-mode") == 0) { @@ -626,8 +628,8 @@ struct axppmic_regulator { uint8_t ar_eval, ar_dval; uint8_t ar_vreg, ar_vmask; - uint32_t ar_base, ar_delta; - uint32_t ar_base2, ar_delta2; + uint32_t ar_base, ar_delta, ar_nsteps; + uint32_t ar_base2, ar_delta2, ar_nsteps2; struct regulator_device ar_rd; }; @@ -676,6 +678,10 @@ axppmic_attach_regulator(struct axppmic_softc *sc, int node) ar->ar_vmask = sc->sc_regdata[i].vmask; ar->ar_base = sc->sc_regdata[i].base; ar->ar_delta = sc->sc_regdata[i].delta; + ar->ar_nsteps = sc->sc_regdata[i].nsteps; + ar->ar_base2 = sc->sc_regdata[i].base2; + ar->ar_delta2 = sc->sc_regdata[i].delta2; + ar->ar_nsteps2 = sc->sc_regdata[i].nsteps2; ar->ar_rd.rd_node = node; ar->ar_rd.rd_cookie = ar; @@ -694,10 +700,11 @@ axppmic_get_voltage(void *cookie) value = axppmic_read_reg(ar->ar_sc, ar->ar_vreg); value &= ar->ar_vmask; - voltage = ar->ar_base + value * ar->ar_delta; - if (ar->ar_base2 > 0 && voltage > ar->ar_base2) { - value -= (ar->ar_base2 - ar->ar_base) / ar->ar_delta; - voltage = ar->ar_base2 + value * ar->ar_delta2; + if (ar->ar_base2 > 0 && value >= ar->ar_nsteps) { + voltage = + ar->ar_base2 + (value - ar->ar_nsteps) * ar->ar_delta2; + } else { + voltage = ar->ar_base + value * ar->ar_delta; } return voltage; } @@ -710,17 +717,22 @@ axppmic_set_voltage(void *cookie, uint32_t voltage) if (voltage < ar->ar_base) return EINVAL; - value = (voltage - ar->ar_base) / ar->ar_delta; - if (ar->ar_base2 > 0 && voltage > ar->ar_base2) { - value = (ar->ar_base2 - ar->ar_base) / ar->ar_delta; - value += (voltage - ar->ar_base2) / ar->ar_delta2; + if (ar->ar_base2 > 0 && voltage >= ar->ar_base2) { + value = (voltage - ar->ar_base2) / ar->ar_delta2; + if (value >= ar->ar_nsteps2) + return EINVAL; + value += ar->ar_nsteps; + } else { + value = (voltage - ar->ar_base) / ar->ar_delta; + if (value >= ar->ar_nsteps) + return EINVAL; } if (value > ar->ar_vmask) return EINVAL; reg = axppmic_read_reg(ar->ar_sc, ar->ar_vreg); - reg &= ~ar->ar_vmask; - axppmic_write_reg(ar->ar_sc, ar->ar_vreg, reg | value); + axppmic_write_reg(ar->ar_sc, ar->ar_vreg, + (reg & ~ar->ar_vmask) | (value & ar->ar_vmask)); return 0; } diff --git a/sys/dev/fdt/if_dwge.c b/sys/dev/fdt/if_dwge.c index ccd298eaf..528a4516f 100644 --- a/sys/dev/fdt/if_dwge.c +++ b/sys/dev/fdt/if_dwge.c @@ -475,7 +475,7 @@ dwge_attach(struct device *parent, struct device *self, void *aux) sc->sc_fixed_media = IFM_ETHER | IFM_AUTO; break; } - + if (OF_getpropbool(node, "full-duplex")) { ifp->if_link_state = LINK_STATE_FULL_DUPLEX; sc->sc_fixed_media |= IFM_FDX; diff --git a/sys/dev/fdt/if_dwqe_fdt.c b/sys/dev/fdt/if_dwqe_fdt.c index 1e98c2e9d..af0f4e470 100644 --- a/sys/dev/fdt/if_dwqe_fdt.c +++ b/sys/dev/fdt/if_dwqe_fdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_dwqe_fdt.c,v 1.13 2023/07/04 12:58:42 kettenis Exp $ */ +/* $OpenBSD: if_dwqe_fdt.c,v 1.14 2023/07/08 08:18:30 kettenis Exp $ */ /* * Copyright (c) 2008, 2019 Mark Kettenis * Copyright (c) 2017, 2022 Patrick Wildt @@ -141,6 +141,7 @@ dwqe_fdt_attach(struct device *parent, struct device *self, void *aux) sc->sc_phyloc = OF_getpropint(node, "reg", MII_PHY_ANY); else sc->sc_phyloc = MII_PHY_ANY; + sc->sc_mii.mii_node = node; pinctrl_byname(faa->fa_node, "default"); diff --git a/sys/dev/fdt/qccpu.c b/sys/dev/fdt/qccpu.c index 033f622ca..5732dfaa0 100644 --- a/sys/dev/fdt/qccpu.c +++ b/sys/dev/fdt/qccpu.c @@ -279,7 +279,7 @@ qccpu_refresh_sensor(void *arg) for (idx = 0; idx < NUM_GROUP; idx++) { ioh = sc->sc_ioh[idx]; - + lval = (bus_space_read_4(iot, ioh, CPUF_DOMAIN_STATE) >> CPUF_DOMAIN_STATE_LVAL_S) & CPUF_DOMAIN_STATE_LVAL_M; sc->sc_hz_sensor[idx].value = 1000000ULL * lval * XO_FREQ_HZ; diff --git a/sys/dev/fdt/rkclock.c b/sys/dev/fdt/rkclock.c index c4ef4b765..c93a152b4 100644 --- a/sys/dev/fdt/rkclock.c +++ b/sys/dev/fdt/rkclock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rkclock.c,v 1.77 2023/06/19 09:54:15 kettenis Exp $ */ +/* $OpenBSD: rkclock.c,v 1.82 2023/07/09 16:33:49 patrick Exp $ */ /* * Copyright (c) 2017, 2018 Mark Kettenis * @@ -3839,6 +3839,46 @@ const struct rkclock rk3588_clocks[] = { SEL(5, 5), DIV(4, 0), { RK3588_PLL_GPLL, RK3588_PLL_CPLL } }, + { + RK3588_CLK_I2C1, RK3588_CRU_CLKSEL_CON(38), + SEL(6, 6), 0, + { RK3588_CLK_200M_SRC , RK3588_CLK_100M_SRC }, + }, + { + RK3588_CLK_I2C2, RK3588_CRU_CLKSEL_CON(38), + SEL(7, 7), 0, + { RK3588_CLK_200M_SRC , RK3588_CLK_100M_SRC }, + }, + { + RK3588_CLK_I2C3, RK3588_CRU_CLKSEL_CON(38), + SEL(8, 8), 0, + { RK3588_CLK_200M_SRC , RK3588_CLK_100M_SRC }, + }, + { + RK3588_CLK_I2C4, RK3588_CRU_CLKSEL_CON(38), + SEL(9, 9), 0, + { RK3588_CLK_200M_SRC , RK3588_CLK_100M_SRC }, + }, + { + RK3588_CLK_I2C5, RK3588_CRU_CLKSEL_CON(38), + SEL(10, 10), 0, + { RK3588_CLK_200M_SRC , RK3588_CLK_100M_SRC }, + }, + { + RK3588_CLK_I2C6, RK3588_CRU_CLKSEL_CON(38), + SEL(11, 11), 0, + { RK3588_CLK_200M_SRC , RK3588_CLK_100M_SRC }, + }, + { + RK3588_CLK_I2C7, RK3588_CRU_CLKSEL_CON(38), + SEL(12, 12), 0, + { RK3588_CLK_200M_SRC , RK3588_CLK_100M_SRC }, + }, + { + RK3588_CLK_I2C8, RK3588_CRU_CLKSEL_CON(38), + SEL(13, 13), 0, + { RK3588_CLK_200M_SRC , RK3588_CLK_100M_SRC }, + }, { RK3588_CLK_UART1_SRC, RK3588_CRU_CLKSEL_CON(41), SEL(14, 14), DIV(13, 9), @@ -4066,6 +4106,11 @@ const struct rkclock rk3588_clocks[] = { { RK3588_ACLK_VOP_ROOT, 0 /* RK3588_ACLK_VOP_DIV2_SRC */ }, SET_PARENT }, + { + RK3588_CLK_I2C0, RK3588_CRU_CLKSEL_CON(3), + SEL(6, 6), 0, + { RK3588_CLK_PMU1_200M_SRC, RK3588_CLK_PMU1_100M_SRC }, + }, { RK3588_CLK_PMU1_50M_SRC, RK3588_PMUCRU_CLKSEL_CON(0), 0, DIV(3, 0), @@ -4103,6 +4148,12 @@ const struct rkclock rk3588_clocks[] = { { RK3588_CLK_PMU1_400M_SRC, RK3588_CLK_PMU1_200M_SRC, RK3588_CLK_PMU1_100M_SRC, RK3588_XIN24M } }, + { + RK3588_CLK_PMU1PWM, RK3588_PMUCRU_CLKSEL_CON(2), + SEL(10, 9), 0, + { RK3588_CLK_PMU1_100M_SRC, RK3588_CLK_PMU1_50M_SRC, + RK3588_XIN24M } + }, { RK3588_CLK_UART0_SRC, RK3588_PMUCRU_CLKSEL_CON(3), 0, DIV(11, 7), @@ -4121,17 +4172,47 @@ const struct rkclock rk3588_clocks[] = { RK3588_CLK_REF_PIPE_PHY0_OSC_SRC, 0, 0, 0, { RK3588_XIN24M } }, + { + RK3588_CLK_REF_PIPE_PHY1_OSC_SRC, 0, 0, 0, + { RK3588_XIN24M } + }, + { + RK3588_CLK_REF_PIPE_PHY2_OSC_SRC, 0, 0, 0, + { RK3588_XIN24M } + }, { RK3588_CLK_REF_PIPE_PHY0_PLL_SRC, RK3588_CRU_CLKSEL_CON(176), 0, DIV(5, 0), { RK3588_PLL_PPLL } }, + { + RK3588_CLK_REF_PIPE_PHY1_PLL_SRC, RK3588_CRU_CLKSEL_CON(176), + 0, DIV(11, 6), + { RK3588_PLL_PPLL } + }, + { + RK3588_CLK_REF_PIPE_PHY2_PLL_SRC, RK3588_CRU_CLKSEL_CON(177), + 0, DIV(5, 0), + { RK3588_PLL_PPLL } + }, { RK3588_CLK_REF_PIPE_PHY0, RK3588_CRU_CLKSEL_CON(177), SEL(6, 6), 0, { RK3588_CLK_REF_PIPE_PHY0_OSC_SRC, RK3588_CLK_REF_PIPE_PHY0_PLL_SRC }, }, + { + RK3588_CLK_REF_PIPE_PHY1, RK3588_CRU_CLKSEL_CON(177), + SEL(7, 7), 0, + { RK3588_CLK_REF_PIPE_PHY1_OSC_SRC, + RK3588_CLK_REF_PIPE_PHY1_PLL_SRC }, + }, + { + RK3588_CLK_REF_PIPE_PHY2, RK3588_CRU_CLKSEL_CON(177), + SEL(8, 8), 0, + { RK3588_CLK_REF_PIPE_PHY2_OSC_SRC, + RK3588_CLK_REF_PIPE_PHY2_PLL_SRC }, + }, { /* Sentinel */ } @@ -4337,22 +4418,82 @@ rk3588_reset(void *cookie, uint32_t *cells, int on) uint32_t bit, mask, reg; switch (idx) { + case RK3588_SRST_PCIE0_POWER_UP: + reg = RK3588_CRU_SOFTRST_CON(32); + bit = 13; + break; + case RK3588_SRST_PCIE1_POWER_UP: + reg = RK3588_CRU_SOFTRST_CON(32); + bit = 14; + break; + case RK3588_SRST_PCIE2_POWER_UP: + reg = RK3588_CRU_SOFTRST_CON(32); + bit = 15; + break; + case RK3588_SRST_PCIE3_POWER_UP: + reg = RK3588_CRU_SOFTRST_CON(33); + bit = 0; + break; case RK3588_SRST_PCIE4_POWER_UP: reg = RK3588_CRU_SOFTRST_CON(33); bit = 1; break; + case RK3588_SRST_P_PCIE0: + reg = RK3588_CRU_SOFTRST_CON(33); + bit = 12; + break; + case RK3588_SRST_P_PCIE1: + reg = RK3588_CRU_SOFTRST_CON(33); + bit = 13; + break; + case RK3588_SRST_P_PCIE2: + reg = RK3588_CRU_SOFTRST_CON(33); + bit = 14; + break; + case RK3588_SRST_P_PCIE3: + reg = RK3588_CRU_SOFTRST_CON(33); + bit = 15; + break; case RK3588_SRST_P_PCIE4: reg = RK3588_CRU_SOFTRST_CON(34); bit = 0; break; + case RK3588_SRST_A_USB3OTG0: + reg = RK3588_CRU_SOFTRST_CON(42); + bit = 4; + break; + case RK3588_SRST_A_USB3OTG1: + reg = RK3588_CRU_SOFTRST_CON(42); + bit = 7; + break; case RK3588_SRST_REF_PIPE_PHY0: reg = RK3588_CRU_SOFTRST_CON(77); bit = 6; break; + case RK3588_SRST_REF_PIPE_PHY1: + reg = RK3588_CRU_SOFTRST_CON(77); + bit = 7; + break; + case RK3588_SRST_REF_PIPE_PHY2: + reg = RK3588_CRU_SOFTRST_CON(77); + bit = 8; + break; case RK3588_SRST_P_PCIE2_PHY0: reg = RK3588_PHPTOPCRU_SOFTRST_CON(0); bit = 5; break; + case RK3588_SRST_P_PCIE2_PHY1: + reg = RK3588_PHPTOPCRU_SOFTRST_CON(0); + bit = 6; + break; + case RK3588_SRST_P_PCIE2_PHY2: + reg = RK3588_PHPTOPCRU_SOFTRST_CON(0); + bit = 7; + break; + case RK3588_SRST_PCIE30_PHY: + reg = RK3588_PHPTOPCRU_SOFTRST_CON(0); + bit = 10; + break; default: printf("%s: 0x%08x\n", __func__, idx); return; diff --git a/sys/dev/fdt/rkclock_clocks.h b/sys/dev/fdt/rkclock_clocks.h index f506b0b43..55f696f19 100644 --- a/sys/dev/fdt/rkclock_clocks.h +++ b/sys/dev/fdt/rkclock_clocks.h @@ -394,6 +394,14 @@ #define RK3588_PLL_PPLL 8 #define RK3588_ACLK_BUS_ROOT 113 +#define RK3588_CLK_I2C1 131 +#define RK3588_CLK_I2C2 132 +#define RK3588_CLK_I2C3 133 +#define RK3588_CLK_I2C4 134 +#define RK3588_CLK_I2C5 135 +#define RK3588_CLK_I2C6 136 +#define RK3588_CLK_I2C7 137 +#define RK3588_CLK_I2C8 138 #define RK3588_CLK_UART1_SRC 168 #define RK3588_CLK_UART1_FRAC 169 #define RK3588_CLK_UART1 170 @@ -449,6 +457,7 @@ #define RK3588_ACLK_VOP_ROOT 600 #define RK3588_ACLK_VOP 605 #define RK3588_ACLK_VOP_SUB_SRC 619 +#define RK3588_CLK_I2C0 628 #define RK3588_CLK_PMU1_50M_SRC 639 #define RK3588_CLK_PMU1_100M_SRC 640 #define RK3588_CLK_PMU1_200M_SRC 641 @@ -456,18 +465,40 @@ #define RK3588_PCLK_PMU1_ROOT 645 #define RK3588_PCLK_PMU0_ROOT 646 #define RK3588_HCLK_PMU_CM0_ROOT 647 +#define RK3588_CLK_PMU1PWM 658 #define RK3588_CLK_UART0_SRC 664 #define RK3588_CLK_UART0_FRAC 665 #define RK3588_CLK_UART0 666 #define RK3588_SCLK_UART0 667 #define RK3588_CLK_REF_PIPE_PHY0_OSC_SRC 674 +#define RK3588_CLK_REF_PIPE_PHY1_OSC_SRC 675 +#define RK3588_CLK_REF_PIPE_PHY2_OSC_SRC 676 #define RK3588_CLK_REF_PIPE_PHY0_PLL_SRC 677 +#define RK3588_CLK_REF_PIPE_PHY1_PLL_SRC 678 +#define RK3588_CLK_REF_PIPE_PHY2_PLL_SRC 679 #define RK3588_CLK_REF_PIPE_PHY0 680 +#define RK3588_CLK_REF_PIPE_PHY1 681 +#define RK3588_CLK_REF_PIPE_PHY2 682 #define RK3588_PLL_SPLL 1022 #define RK3588_XIN24M 1023 +#define RK3588_SRST_PCIE0_POWER_UP 294 +#define RK3588_SRST_PCIE1_POWER_UP 295 +#define RK3588_SRST_PCIE2_POWER_UP 296 +#define RK3588_SRST_PCIE3_POWER_UP 297 #define RK3588_SRST_PCIE4_POWER_UP 298 +#define RK3588_SRST_P_PCIE0 299 +#define RK3588_SRST_P_PCIE1 300 +#define RK3588_SRST_P_PCIE2 301 +#define RK3588_SRST_P_PCIE3 302 #define RK3588_SRST_P_PCIE4 303 +#define RK3588_SRST_A_USB3OTG0 338 +#define RK3588_SRST_A_USB3OTG1 339 #define RK3588_SRST_REF_PIPE_PHY0 572 +#define RK3588_SRST_REF_PIPE_PHY1 573 +#define RK3588_SRST_REF_PIPE_PHY2 574 #define RK3588_SRST_P_PCIE2_PHY0 579 +#define RK3588_SRST_P_PCIE2_PHY1 580 +#define RK3588_SRST_P_PCIE2_PHY2 581 +#define RK3588_SRST_PCIE30_PHY 584 diff --git a/sys/dev/fdt/rkpciephy.c b/sys/dev/fdt/rkpciephy.c index 75fac8ea7..da5b50e84 100644 --- a/sys/dev/fdt/rkpciephy.c +++ b/sys/dev/fdt/rkpciephy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rkpciephy.c,v 1.1 2023/03/19 11:17:16 kettenis Exp $ */ +/* $OpenBSD: rkpciephy.c,v 1.2 2023/07/08 09:12:28 patrick Exp $ */ /* * Copyright (c) 2023 Mark Kettenis * @@ -28,7 +28,7 @@ #include #include -/* GRF registers */ +/* RK3568 GRF registers */ #define GRF_PCIE30PHY_CON(idx) ((idx) * 4) /* CON1 */ #define GRF_PCIE30PHY_DA_OCM 0x80008000 @@ -42,6 +42,22 @@ #define GRF_PCIE30PHY_STATUS0 0x80 #define GRF_PCIE30PHY_SRAM_INIT_DONE (1 << 14) +/* RK3588 GRF registers */ +#define RK3588_PCIE3PHY_GRF_CMN_CON(idx) ((idx) * 4) +#define RK3588_GRF_PCIE3PHY_DA_OCM ((0x1 << 24) | (1 << 8)) +#define RK3588_GRF_PCIE3PHY_LANE_BIFURCATE_0_1 (1 << 0) +#define RK3588_GRF_PCIE3PHY_LANE_BIFURCATE_2_3 (1 << 1) +#define RK3588_GRF_PCIE3PHY_LANE_AGGREGATE (1 << 2) +#define RK3588_GRF_PCIE3PHY_LANE_MASK (0x7 << 16) +#define RK3588_PCIE3PHY_GRF_PHY0_STATUS1 0x904 +#define RK3588_PCIE3PHY_GRF_PHY1_STATUS1 0xa04 +#define RK3588_PCIE3PHY_SRAM_INIT_DONE (1 << 0) +#define RK3588_PHP_GRF_PCIESEL_CON 0x100 +#define RK3588_PHP_GRF_PCIE0L0_PCIE3 (1 << 0) +#define RK3588_PHP_GRF_PCIE0L1_PCIE3 (1 << 1) +#define RK3588_PHP_GRF_PCIE0L0_MASK (0x1 << 16) +#define RK3588_PHP_GRF_PCIE0L1_MASK (0x1 << 17) + struct rkpciephy_softc { struct device sc_dev; bus_space_tag_t sc_iot; @@ -61,14 +77,16 @@ struct cfdriver rkpciephy_cd = { NULL, "rkpciephy", DV_DULL }; -int rkpciephy_enable(void *, uint32_t *); +int rk3568_pciephy_enable(void *, uint32_t *); +int rk3588_pciephy_enable(void *, uint32_t *); int rkpciephy_match(struct device *parent, void *match, void *aux) { struct fdt_attach_args *faa = aux; - return OF_is_compatible(faa->fa_node, "rockchip,rk3568-pcie3-phy"); + return (OF_is_compatible(faa->fa_node, "rockchip,rk3568-pcie3-phy") || + OF_is_compatible(faa->fa_node, "rockchip,rk3588-pcie3-phy")); } void @@ -81,12 +99,15 @@ rkpciephy_attach(struct device *parent, struct device *self, void *aux) sc->sc_pd.pd_node = faa->fa_node; sc->sc_pd.pd_cookie = sc; - sc->sc_pd.pd_enable = rkpciephy_enable; + if (OF_is_compatible(faa->fa_node, "rockchip,rk3568-pcie3-phy")) + sc->sc_pd.pd_enable = rk3568_pciephy_enable; + if (OF_is_compatible(faa->fa_node, "rockchip,rk3588-pcie3-phy")) + sc->sc_pd.pd_enable = rk3588_pciephy_enable; phy_register(&sc->sc_pd); } int -rkpciephy_enable(void *cookie, uint32_t *cells) +rk3568_pciephy_enable(void *cookie, uint32_t *cells) { struct rkpciephy_softc *sc = cookie; struct regmap *rm; @@ -135,3 +156,85 @@ rkpciephy_enable(void *cookie, uint32_t *cells) return 0; } + +int +rk3588_pciephy_enable(void *cookie, uint32_t *cells) +{ + struct rkpciephy_softc *sc = cookie; + struct regmap *phy, *pipe; + int node = sc->sc_pd.pd_node; + uint32_t data_lanes[4] = { 1, 1, 1, 1 }; + uint32_t grf, reg, stat; + int num_lanes, timo; + + grf = OF_getpropint(node, "rockchip,phy-grf", 0); + phy = regmap_byphandle(grf); + if (phy == NULL) + return ENXIO; + + clock_enable_all(node); + reset_assert(node, "phy"); + delay(1); + + regmap_write_4(phy, RK3588_PCIE3PHY_GRF_CMN_CON(0), + RK3588_GRF_PCIE3PHY_DA_OCM); + + num_lanes = OF_getpropintarray(node, "data-lanes", data_lanes, + sizeof(data_lanes)); + /* Use default setting in case of missing properties. */ + if (num_lanes <= 0) + num_lanes = sizeof(data_lanes); + num_lanes /= sizeof(uint32_t); + + reg = RK3588_GRF_PCIE3PHY_LANE_MASK; + /* If all links go to the first, aggregate toward x4 */ + if (num_lanes >= 4 && + data_lanes[0] == 1 && data_lanes[1] == 1 && + data_lanes[2] == 1 && data_lanes[3] == 1) { + reg |= RK3588_GRF_PCIE3PHY_LANE_AGGREGATE; + } else { + /* If lanes 0+1 are not towards the same controller, split. */ + if (num_lanes >= 2 && data_lanes[0] != data_lanes[1]) + reg |= RK3588_GRF_PCIE3PHY_LANE_BIFURCATE_0_1; + /* If lanes 2+3 are not towards the same controller, split. */ + if (num_lanes >= 4 && data_lanes[2] != data_lanes[3]) + reg |= RK3588_GRF_PCIE3PHY_LANE_BIFURCATE_2_3; + } + regmap_write_4(phy, RK3588_PCIE3PHY_GRF_CMN_CON(0), reg); + + grf = OF_getpropint(node, "rockchip,phy-grf", 0); + pipe = regmap_byphandle(grf); + if (pipe != NULL) { + reg = RK3588_PHP_GRF_PCIE0L0_MASK | RK3588_PHP_GRF_PCIE0L1_MASK; + /* If lane 1 is configured, move it from Combo to PCIE3 PHY */ + if (num_lanes >= 2 && data_lanes[1] != 0) { + reg |= RK3588_PHP_GRF_PCIE0L0_PCIE3; + } + /* If lane 3 is configured, move it from Combo to PCIE3 PHY */ + if (num_lanes >= 4 && data_lanes[3] != 0) { + reg |= RK3588_PHP_GRF_PCIE0L1_PCIE3; + } + regmap_write_4(pipe, RK3588_PHP_GRF_PCIESEL_CON, reg); + } + + reset_deassert(node, "phy"); + + for (timo = 500; timo > 0; timo--) { + stat = regmap_read_4(phy, RK3588_PCIE3PHY_GRF_PHY0_STATUS1); + if (stat & RK3588_PCIE3PHY_SRAM_INIT_DONE) + break; + delay(100); + } + for (; timo > 0; timo--) { + stat = regmap_read_4(phy, RK3588_PCIE3PHY_GRF_PHY1_STATUS1); + if (stat & RK3588_PCIE3PHY_SRAM_INIT_DONE) + break; + delay(100); + } + if (timo == 0) { + printf("%s: timeout\n", sc->sc_dev.dv_xname); + return ETIMEDOUT; + } + + return 0; +} diff --git a/sys/dev/fdt/sncodec.c b/sys/dev/fdt/sncodec.c index 956d02067..adbd2a88f 100644 --- a/sys/dev/fdt/sncodec.c +++ b/sys/dev/fdt/sncodec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sncodec.c,v 1.2 2023/02/04 18:58:19 kettenis Exp $ */ +/* $OpenBSD: sncodec.c,v 1.3 2023/07/09 12:32:22 kettenis Exp $ */ /* * Copyright (c) 2023 Mark Kettenis * @@ -36,6 +36,7 @@ #define MODE_CTRL_BOP_SRC (1 << 7) #define MODE_CTRL_ISNS_PD (1 << 4) #define MODE_CTRL_VSNS_PD (1 << 3) +#define MODE_CTRL_MODE_MASK (7 << 0) #define MODE_CTRL_MODE_ACTIVE (0 << 0) #define MODE_CTRL_MODE_MUTE (1 << 0) #define MODE_CTRL_MODE_SHUTDOWN (2 << 0) @@ -67,7 +68,6 @@ uint8_t sncodec_bop_cfg[] = { 0x06, 0x3e, 0x37, 0x30, 0xff, 0xe6 }; - struct sncodec_softc { struct device sc_dev; i2c_tag_t sc_tag; @@ -75,6 +75,7 @@ struct sncodec_softc { struct dai_device sc_dai; uint8_t sc_dvc; + uint8_t sc_mute; }; int sncodec_match(struct device *, void *, void *); @@ -148,6 +149,7 @@ sncodec_attach(struct device *parent, struct device *self, void *aux) /* Set volume to a reasonable level. */ sc->sc_dvc = DVC_LVL_30DB; + sc->sc_mute = MODE_CTRL_MODE_ACTIVE; sncodec_write(sc, DVC, sc->sc_dvc); /* Default to stereo downmix mode for now. */ @@ -251,13 +253,14 @@ sncodec_set_tdm_slot(void *cookie, int slot) } /* - * Mixer controls; the gain of the TAS2770 is determined by the + * Mixer controls; the gain of the TAS2764 is determined by the * amplifier gain and digital volume control setting, but we only * expose the digital volume control setting through the mixer * interface. */ enum { SNCODEC_MASTER_VOL, + SNCODEC_MASTER_MUTE, SNCODEC_OUTPUT_CLASS }; @@ -266,6 +269,7 @@ sncodec_set_port(void *priv, mixer_ctrl_t *mc) { struct sncodec_softc *sc = priv; u_char level; + uint8_t mode; switch (mc->dev) { case SNCODEC_MASTER_VOL: @@ -273,6 +277,18 @@ sncodec_set_port(void *priv, mixer_ctrl_t *mc) sc->sc_dvc = (DVC_LVL_MIN * (255 - level)) / 255; sncodec_write(sc, DVC, sc->sc_dvc); return 0; + + case SNCODEC_MASTER_MUTE: + sc->sc_mute = mc->un.ord ? + MODE_CTRL_MODE_MUTE : MODE_CTRL_MODE_ACTIVE; + mode = sncodec_read(sc, MODE_CTRL); + if ((mode & MODE_CTRL_MODE_MASK) == MODE_CTRL_MODE_ACTIVE || + (mode & MODE_CTRL_MODE_MASK) == MODE_CTRL_MODE_MUTE) { + mode &= ~MODE_CTRL_MODE_MASK; + mode |= sc->sc_mute; + sncodec_write(sc, MODE_CTRL, mode); + } + return 0; } return EINVAL; @@ -290,6 +306,10 @@ sncodec_get_port(void *priv, mixer_ctrl_t *mc) level = 255 - ((255 * sc->sc_dvc) / DVC_LVL_MIN); mc->un.value.level[AUDIO_MIXER_LEVEL_MONO] = level; return 0; + + case SNCODEC_MASTER_MUTE: + mc->un.ord = (sc->sc_mute == MODE_CTRL_MODE_MUTE); + return 0; } return EINVAL; @@ -301,7 +321,8 @@ sncodec_query_devinfo(void *priv, mixer_devinfo_t *di) switch (di->index) { case SNCODEC_MASTER_VOL: di->mixer_class = SNCODEC_OUTPUT_CLASS; - di->next = di->prev = AUDIO_MIXER_LAST; + di->prev = AUDIO_MIXER_LAST; + di->next = SNCODEC_MASTER_MUTE; strlcpy(di->label.name, AudioNmaster, sizeof(di->label.name)); di->type = AUDIO_MIXER_VALUE; di->un.v.num_channels = 1; @@ -309,6 +330,21 @@ sncodec_query_devinfo(void *priv, mixer_devinfo_t *di) sizeof(di->un.v.units.name)); return 0; + case SNCODEC_MASTER_MUTE: + di->mixer_class = SNCODEC_OUTPUT_CLASS; + di->prev = SNCODEC_MASTER_VOL; + di->next = AUDIO_MIXER_LAST; + strlcpy(di->label.name, AudioNmute, sizeof(di->label.name)); + di->type = AUDIO_MIXER_ENUM; + di->un.e.num_mem = 2; + di->un.e.member[0].ord = 0; + strlcpy(di->un.e.member[0].label.name, AudioNoff, + MAX_AUDIO_DEV_LEN); + di->un.e.member[1].ord = 1; + strlcpy(di->un.e.member[1].label.name, AudioNon, + MAX_AUDIO_DEV_LEN); + return 0; + case SNCODEC_OUTPUT_CLASS: di->mixer_class = SNCODEC_OUTPUT_CLASS; di->next = di->prev = AUDIO_MIXER_LAST; @@ -327,7 +363,7 @@ sncodec_trigger_output(void *cookie, void *start, void *end, int blksize, struct sncodec_softc *sc = cookie; sncodec_write(sc, MODE_CTRL, MODE_CTRL_BOP_SRC | - MODE_CTRL_ISNS_PD | MODE_CTRL_VSNS_PD | MODE_CTRL_MODE_ACTIVE); + MODE_CTRL_ISNS_PD | MODE_CTRL_VSNS_PD | sc->sc_mute); return 0; } diff --git a/sys/dev/gpio/gpiodcf.c b/sys/dev/gpio/gpiodcf.c index 2a3c70d7c..35b4b7d29 100644 --- a/sys/dev/gpio/gpiodcf.c +++ b/sys/dev/gpio/gpiodcf.c @@ -349,7 +349,7 @@ gpiodcf_mg_probe(void *xsc) if (gettime() - sc->sc_last_mg < 57) { DPRINTF(("\nunexpected gap, resync\n")); sc->sc_sync = sc->sc_minute = 1; - goto cleanbits; + goto cleanbits; } /* extract bits w/o parity */ diff --git a/sys/dev/hid/hidkbd.c b/sys/dev/hid/hidkbd.c index c1faded21..ef57b4f16 100644 --- a/sys/dev/hid/hidkbd.c +++ b/sys/dev/hid/hidkbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hidkbd.c,v 1.8 2022/11/09 10:05:18 robert Exp $ */ +/* $OpenBSD: hidkbd.c,v 1.9 2023/07/09 08:02:13 tobhe Exp $ */ /* $NetBSD: ukbd.c,v 1.85 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -144,6 +144,7 @@ static const struct hidkbd_translation apple_fn_trans[] = { { 61, 129 }, /* F4 -> audio lower */ { 62, 128 }, /* F5 -> audio raise */ #else + { 63, 102 }, /* F6 -> sleep */ { 67, 127 }, /* F10 -> audio mute */ { 68, 129 }, /* F11 -> audio lower */ { 69, 128 }, /* F12 -> audio raise */ @@ -557,11 +558,12 @@ hidkbd_decode(struct hidkbd *kbd, struct hidkbd_data *ud) wskbd_rawinput(kbd->sc_wskbddev, cbuf, j); /* - * Pass audio and brightness keys to wskbd_input anyway. + * Pass audio, brightness and sleep keys to wskbd_input anyway. */ for (i = 0; i < nkeys; i++) { key = ibuf[i]; switch (key & CODEMASK) { + case 102: case 127: case 128: case 129: diff --git a/sys/dev/i2c/files.i2c b/sys/dev/i2c/files.i2c index fd7d61da9..6498e3a3b 100644 --- a/sys/dev/i2c/files.i2c +++ b/sys/dev/i2c/files.i2c @@ -1,4 +1,4 @@ -# $OpenBSD: files.i2c,v 1.71 2022/11/11 15:25:13 matthieu Exp $ +# $OpenBSD: files.i2c,v 1.72 2023/07/08 02:43:02 jcs Exp $ # $NetBSD: files.i2c,v 1.3 2003/10/20 16:24:10 briggs Exp $ define i2c {[addr = -1], [size = -1]} @@ -230,6 +230,11 @@ device iatp: wsmousedev attach iatp at i2c file dev/i2c/iatp.c iatp +# Elantech touchpad +device ietp: wsmousedev +attach ietp at i2c +file dev/i2c/ietp.c ietp + # Bosch BMC150 6-axis eCompass device bgw attach bgw at i2c diff --git a/sys/dev/i2c/ietp.c b/sys/dev/i2c/ietp.c new file mode 100644 index 000000000..4e870b393 --- /dev/null +++ b/sys/dev/i2c/ietp.c @@ -0,0 +1,686 @@ +/* $OpenBSD: ietp.c,v 1.1 2023/07/08 02:43:02 jcs Exp $ */ +/* + * elan-i2c driver + * + * Copyright (c) 2015, 2016 joshua stein + * Copyright (c) 2020, 2022 Vladimir Kondratyev + * Copyright (c) 2023 vladimir serbinenko + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* Protocol documentation: https://lkml.indiana.edu/hypermail/linux/kernel/1205.0/02551.html. + Based on FreeBSD ietp driver. +*/ + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +/* #define IETP_DEBUG */ + +#ifdef IETP_DEBUG +#define DPRINTF(x) printf x +#else +#define DPRINTF(x) +#endif + +enum { + I2C_HID_CMD_DESCR = 0x0, + I2C_HID_CMD_RESET = 0x1, + I2C_HID_CMD_SET_POWER = 0x8, +}; + +#define I2C_HID_POWER_ON 0x0 +#define I2C_HID_POWER_OFF 0x1 + +#define IETP_PATTERN 0x0100 +#define IETP_UNIQUEID 0x0101 +#define IETP_IC_TYPE 0x0103 +#define IETP_OSM_VERSION 0x0103 +#define IETP_NSM_VERSION 0x0104 +#define IETP_TRACENUM 0x0105 +#define IETP_MAX_X_AXIS 0x0106 +#define IETP_MAX_Y_AXIS 0x0107 +#define IETP_RESOLUTION 0x0108 +#define IETP_PRESSURE 0x010A + +#define IETP_CONTROL 0x0300 +#define IETP_CTRL_ABSOLUTE 0x0001 +#define IETP_CTRL_STANDARD 0x0000 + +#define IETP_REPORT_LEN_LO 31 +#define IETP_REPORT_LEN_HI 36 +#define IETP_MAX_FINGERS 5 + +#define IETP_REPORT_ID_LO 0x5D +#define IETP_REPORT_ID_HI 0x60 + +#define IETP_TOUCH_INFO 0 +#define IETP_FINGER_DATA 1 +#define IETP_FINGER_DATA_LEN 5 +#define IETP_WH_DATA 31 + +#define IETP_TOUCH_LMB (1 << 0) +#define IETP_TOUCH_RMB (1 << 1) +#define IETP_TOUCH_MMB (1 << 2) + +#define IETP_MAX_PRESSURE 255 +#define IETP_FWIDTH_REDUCE 90 +#define IETP_PRESSURE_BASE 25 + +int ietp_match(struct device *, void *, void *); +void ietp_attach(struct device *, struct device *, void *); +int ietp_detach(struct device *, int); +int ietp_activate(struct device *, int); + +int ietp_intr(void *); +int ietp_reset(struct ietp_softc *); + +int ietp_fetch_descriptor(struct ietp_softc *sc); +int ietp_set_power(struct ietp_softc *sc, int power); +int ietp_reset_cmd(struct ietp_softc *sc); + +int32_t ietp_res2dpmm(uint8_t, bool); + +int ietp_iic_read_reg(struct ietp_softc *, uint16_t, size_t, void *); +int ietp_iic_write_reg(struct ietp_softc *, uint16_t, uint16_t); +int ietp_iic_set_absolute_mode(struct ietp_softc *, bool); + +const struct cfattach ietp_ca = { + sizeof(struct ietp_softc), + ietp_match, + ietp_attach, + ietp_detach, + ietp_activate, +}; + +const struct wsmouse_accessops ietp_mouse_access = { + ietp_enable, + ietp_ioctl, + ietp_disable +}; + +struct cfdriver ietp_cd = { + NULL, "ietp", DV_DULL +}; + +int +ietp_match(struct device *parent, void *match, void *aux) +{ + struct i2c_attach_args *ia = aux; + + if (strcmp(ia->ia_name, "ietp") == 0) + return (1); + + return (0); +} + +int32_t +ietp_res2dpmm(uint8_t res, bool hi_precision) +{ + int32_t dpi; + + dpi = hi_precision ? 300 + res * 100 : 790 + res * 10; + + return (dpi * 10 /254); +} + +void +ietp_attach(struct device *parent, struct device *self, void *aux) +{ + struct ietp_softc *sc = (struct ietp_softc *)self; + struct i2c_attach_args *ia = aux; + uint16_t buf, reg; + uint8_t *buf8; + uint8_t pattern; + struct wsmousedev_attach_args a; + struct wsmousehw *hw; + + sc->sc_tag = ia->ia_tag; + sc->sc_addr = ia->ia_addr; + + ietp_fetch_descriptor(sc); + + if (ia->ia_intr) { + printf(" %s", iic_intr_string(sc->sc_tag, ia->ia_intr)); + + sc->sc_ih = iic_intr_establish(sc->sc_tag, ia->ia_intr, + IPL_TTY, ietp_intr, sc, sc->sc_dev.dv_xname); + if (sc->sc_ih == NULL) { + printf(", can't establish interrupt"); + return; + } + } + + sc->sc_buttons = 0; + sc->sc_refcnt = 0; + + buf8 = (uint8_t *)&buf; + + if (ietp_iic_read_reg(sc, IETP_UNIQUEID, sizeof(buf), &buf) != 0) { + printf("%s: failed reading product ID\n", sc->sc_dev.dv_xname); + return; + } + sc->product_id = le16toh(buf); + + if (ietp_iic_read_reg(sc, IETP_PATTERN, sizeof(buf), &buf) != 0) { + printf("%s: failed reading pattern\n", sc->sc_dev.dv_xname); + return; + } + pattern = buf == 0xFFFF ? 0 : buf8[1]; + sc->hi_precision = pattern >= 0x02; + + reg = pattern >= 0x01 ? IETP_IC_TYPE : IETP_OSM_VERSION; + if (ietp_iic_read_reg(sc, reg, sizeof(buf), &buf) != 0) { + printf("%s: failed reading IC type\n", sc->sc_dev.dv_xname); + return; + } + sc->ic_type = pattern >= 0x01 ? be16toh(buf) : buf8[1]; + + if (ietp_iic_read_reg(sc, IETP_NSM_VERSION, sizeof(buf), &buf) != 0) { + printf("%s: failed reading SM version\n", sc->sc_dev.dv_xname); + return; + } + sc->is_clickpad = (buf8[0] & 0x10) != 0; + + if (ietp_iic_set_absolute_mode(sc, true) != 0) { + printf("%s: failed to set absolute mode\n", sc->sc_dev.dv_xname); + return; + } + + if (ietp_iic_read_reg(sc, IETP_MAX_X_AXIS, sizeof(buf), &buf) != 0) { + printf("%s: failed reading max x\n", sc->sc_dev.dv_xname); + return; + } + sc->max_x = le16toh(buf); + + if (ietp_iic_read_reg(sc, IETP_MAX_Y_AXIS, sizeof(buf), &buf) != 0) { + printf("%s: failed reading max y\n", sc->sc_dev.dv_xname); + return; + } + sc->max_y = le16toh(buf); + + if (ietp_iic_read_reg(sc, IETP_TRACENUM, sizeof(buf), &buf) != 0) { + printf("%s: failed reading trace info\n", sc->sc_dev.dv_xname); + return; + } + sc->trace_x = sc->max_x / buf8[0]; + sc->trace_y = sc->max_y / buf8[1]; + + if (ietp_iic_read_reg(sc, IETP_PRESSURE, sizeof(buf), &buf) != 0) { + printf("%s: failed reading pressure format\n", sc->sc_dev.dv_xname); + return; + } + sc->pressure_base = (buf8[0] & 0x10) ? 0 : IETP_PRESSURE_BASE; + + if (ietp_iic_read_reg(sc, IETP_RESOLUTION, sizeof(buf), &buf) != 0) { + printf("%s: failed reading resolution\n", sc->sc_dev.dv_xname); + return; + } + /* Conversion from internal format to dot per mm */ + sc->res_x = ietp_res2dpmm(buf8[0], sc->hi_precision); + sc->res_y = ietp_res2dpmm(buf8[1], sc->hi_precision); + + sc->report_id = sc->hi_precision ? + IETP_REPORT_ID_HI : IETP_REPORT_ID_LO; + sc->report_len = sc->hi_precision ? + IETP_REPORT_LEN_HI : IETP_REPORT_LEN_LO; + + sc->sc_ibuf = malloc(IETP_REPORT_LEN_HI + 12, M_DEVBUF, M_NOWAIT | M_ZERO); + sc->sc_isize = sc->report_len + 3; + + a.accessops = &ietp_mouse_access; + a.accesscookie = sc; + sc->sc_wsmousedev = config_found(self, &a, wsmousedevprint); + + hw = wsmouse_get_hw(sc->sc_wsmousedev); + hw->type = WSMOUSE_TYPE_TOUCHPAD; + hw->hw_type = sc->is_clickpad ? WSMOUSEHW_CLICKPAD : WSMOUSEHW_TOUCHPAD; + hw->x_min = 0; + hw->x_max = sc->max_x; + hw->y_min = 0; + hw->y_max = sc->max_y; + hw->h_res = sc->res_x; + hw->v_res = sc->res_y; + hw->mt_slots = IETP_MAX_FINGERS; + + wsmouse_configure(sc->sc_wsmousedev, NULL, 0); + + /* power down until we're opened */ + if (ietp_set_power(sc, I2C_HID_POWER_OFF)) { + printf("%s: failed to power down\n", sc->sc_dev.dv_xname); + return; + } + + DPRINTF(("%s: max_x=%d, max_y=%d, %s\n", sc->sc_dev.dv_xname, + sc->max_x, sc->max_y, + sc->is_clickpad ? "clickpad" : "touchpad")); + + return; +} + +int +ietp_detach(struct device *self, int flags) +{ + struct ietp_softc *sc = (struct ietp_softc *)self; + + if (sc->sc_ih != NULL) { + iic_intr_disestablish(sc->sc_tag, sc->sc_ih); + sc->sc_ih = NULL; + } + + if (sc->sc_ibuf != NULL) { + free(sc->sc_ibuf, M_DEVBUF, sc->sc_isize); + sc->sc_ibuf = NULL; + } + + return (0); +} + +int +ietp_activate(struct device *self, int act) +{ + struct ietp_softc *sc = (struct ietp_softc *)self; + + DPRINTF(("%s(%d)\n", __func__, act)); + + switch (act) { + case DVACT_QUIESCE: + sc->sc_dying = 1; + if (ietp_set_power(sc, I2C_HID_POWER_OFF)) + printf("%s: failed to power down\n", + sc->sc_dev.dv_xname); + break; + case DVACT_WAKEUP: + ietp_reset(sc); + sc->sc_dying = 0; + break; + } + + config_activate_children(self, act); + + return 0; +} + +void +ietp_sleep(struct ietp_softc *sc, int ms) +{ + if (cold) + delay(ms * 1000); + else + tsleep_nsec(&sc, PWAIT, "ietp", MSEC_TO_NSEC(ms)); +} + +int +ietp_iic_set_absolute_mode(struct ietp_softc *sc, bool enable) +{ + static const struct { + uint16_t ic_type; + uint16_t product_id; + } special_fw[] = { + { 0x0E, 0x05 }, { 0x0E, 0x06 }, { 0x0E, 0x07 }, { 0x0E, 0x09 }, + { 0x0E, 0x13 }, { 0x08, 0x26 }, + }; + uint16_t val; + int i, error; + bool require_wakeup; + + error = 0; + + /* + * Some ASUS touchpads need to be powered on to enter absolute mode. + */ + require_wakeup = false; + for (i = 0; i < nitems(special_fw); i++) { + if (sc->ic_type == special_fw[i].ic_type && + sc->product_id == special_fw[i].product_id) { + require_wakeup = true; + break; + } + } + + if (require_wakeup && ietp_set_power(sc, I2C_HID_POWER_ON) != 0) { + printf("%s: failed writing poweron command\n", sc->sc_dev.dv_xname); + return (EIO); + } + + val = enable ? IETP_CTRL_ABSOLUTE : IETP_CTRL_STANDARD; + if (ietp_iic_write_reg(sc, IETP_CONTROL, val) != 0) { + printf("%s: failed setting absolute mode\n", sc->sc_dev.dv_xname); + error = EIO; + } + + if (require_wakeup && ietp_set_power(sc, I2C_HID_POWER_OFF) != 0) { + printf("%s: failed writing poweroff command\n", sc->sc_dev.dv_xname); + error = EIO; + } + + return (error); +} + +int +ietp_iic_read_reg(struct ietp_softc *sc, uint16_t reg, size_t len, void *val) +{ + uint8_t cmd[] = { + reg & 0xff, + reg >> 8, + }; + + return iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, + &cmd, 2, val, len, 0); +} + +int +ietp_iic_write_reg(struct ietp_softc *sc, uint16_t reg, uint16_t val) +{ + uint8_t cmd[] = { + reg & 0xff, + reg >> 8, + val & 0xff, + val >> 8, + }; + + return iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_addr, + &cmd, 4, NULL, 0, 0); +} + +int +ietp_set_power(struct ietp_softc *sc, int power) +{ + int res = 1; + uint8_t cmd[] = { + htole16(sc->hid_desc.wCommandRegister) & 0xff, + htole16(sc->hid_desc.wCommandRegister) >> 8, + power, + I2C_HID_CMD_SET_POWER, + }; + + iic_acquire_bus(sc->sc_tag, 0); + + DPRINTF(("%s: HID command I2C_HID_CMD_SET_POWER(%d)\n", + sc->sc_dev.dv_xname, power)); + + /* 22 00 00 08 */ + res = iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_addr, + &cmd, sizeof(cmd), NULL, 0, 0); + + iic_release_bus(sc->sc_tag, 0); + + return (res); +} + +int +ietp_reset_cmd(struct ietp_softc *sc) +{ + int res = 1; + uint8_t cmd[] = { + htole16(sc->hid_desc.wCommandRegister) & 0xff, + htole16(sc->hid_desc.wCommandRegister) >> 8, + 0, + I2C_HID_CMD_RESET, + }; + + iic_acquire_bus(sc->sc_tag, 0); + + DPRINTF(("%s: HID command I2C_HID_CMD_RESET\n", + sc->sc_dev.dv_xname)); + + /* 22 00 00 01 */ + res = iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_addr, + &cmd, sizeof(cmd), NULL, 0, 0); + + iic_release_bus(sc->sc_tag, 0); + + return (res); +} + +int +ietp_fetch_descriptor(struct ietp_softc *sc) +{ + int i, res = 1; + /* + * 5.2.2 - HID Descriptor Retrieval + * register is passed from the controller + */ + uint8_t cmd[] = { + 1, + 0, + }; + + iic_acquire_bus(sc->sc_tag, 0); + + DPRINTF(("%s: HID command I2C_HID_CMD_DESCR at 0x1\n", + sc->sc_dev.dv_xname)); + + /* 20 00 */ + res = iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, + &cmd, sizeof(cmd), &sc->hid_desc_buf, + sizeof(struct i2c_hid_desc), 0); + + DPRINTF(("%s: HID descriptor:", sc->sc_dev.dv_xname)); + for (i = 0; i < sizeof(struct i2c_hid_desc); i++) + DPRINTF((" %.2x", sc->hid_desc_buf[i])); + DPRINTF(("\n")); + + iic_release_bus(sc->sc_tag, 0); + + return (res); +} + +int +ietp_reset(struct ietp_softc *sc) +{ + DPRINTF(("%s: resetting\n", sc->sc_dev.dv_xname)); + + if (ietp_set_power(sc, I2C_HID_POWER_ON)) { + printf("%s: failed to power on\n", sc->sc_dev.dv_xname); + return (1); + } + + ietp_sleep(sc, 100); + + if (ietp_reset_cmd(sc)) { + printf("%s: failed to reset hardware\n", sc->sc_dev.dv_xname); + + ietp_set_power(sc, I2C_HID_POWER_OFF); + + return (1); + } + + ietp_sleep(sc, 100); + + return (0); +} + +void +parse_input(struct ietp_softc *sc, u_char *report, int len) +{ + uint8_t *fdata; + int32_t finger; + int32_t x, y, p; + int buttons = 0; + int s; + + /* we seem to get 0 length reports sometimes, ignore them */ + if (len == 0) + return; + if (len != sc->report_len) { + printf("%s: wrong report length (%d vs %d expected)", sc->sc_dev.dv_xname, len, (int) sc->report_len); + return; + } + + s = spltty(); + + buttons = report[IETP_TOUCH_INFO] & 7; + + if (sc->sc_buttons != buttons) { + wsmouse_buttons(sc->sc_wsmousedev, buttons); + sc->sc_buttons = buttons; + } + + for (finger = 0, fdata = report + IETP_FINGER_DATA; + finger < IETP_MAX_FINGERS; + finger++, fdata += IETP_FINGER_DATA_LEN) { + if ((report[IETP_TOUCH_INFO] & (1 << (finger + 3))) != 0) { + if (sc->hi_precision) { + x = fdata[0] << 8 | fdata[1]; + y = fdata[2] << 8 | fdata[3]; + } else { + x = (fdata[0] & 0xf0) << 4 | fdata[1]; + y = (fdata[0] & 0x0f) << 8 | fdata[2]; + } + + if (x > sc->max_x || y > sc->max_y) { + printf("%s: [%d] x=%d y=%d over max (%d, %d)\n", + sc->sc_dev.dv_xname, finger, x, y, sc->max_x, sc->max_y); + continue; + } + + + p = MIN((int32_t)fdata[4] + sc->pressure_base, + IETP_MAX_PRESSURE); + + } else { + x = 0; + y = 0; + p = 0; + } + + DPRINTF(("position: [finger=%d, x=%d, y=%d, p=%d]\n", finger, x, y, p)); + wsmouse_mtstate(sc->sc_wsmousedev, finger, x, y, p); + } + + wsmouse_input_sync(sc->sc_wsmousedev); + + splx(s); +} + +int +ietp_intr(void *arg) +{ + struct ietp_softc *sc = arg; + int psize, i; + u_char *p; + u_int rep = 0; + + if (sc->sc_dying) + return 1; + + /* + * XXX: force I2C_F_POLL for now to avoid dwiic interrupting + * while we are interrupting + */ + + iic_acquire_bus(sc->sc_tag, I2C_F_POLL); + iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, NULL, 0, + sc->sc_ibuf, letoh16(sc->hid_desc.wMaxInputLength), I2C_F_POLL); + iic_release_bus(sc->sc_tag, I2C_F_POLL); + + /* + * 6.1.1 - First two bytes are the packet length, which must be less + * than or equal to wMaxInputLength + */ + psize = sc->sc_ibuf[0] | sc->sc_ibuf[1] << 8; + if (psize <= 2 || psize > sc->sc_isize) { + DPRINTF(("%s: %s: invalid packet size (%d vs. %d)\n", + sc->sc_dev.dv_xname, __func__, psize, + sc->sc_isize)); + return (1); + } + + /* 3rd byte is the report id */ + p = sc->sc_ibuf + 2; + psize -= 2; + rep = *p++; + psize--; + + DPRINTF(("%s: %s: hid input (rep 0x%x):", sc->sc_dev.dv_xname, __func__, + rep)); + for (i = 0; i < psize; i++) { + DPRINTF((" %.2x", p[i])); + } + DPRINTF(("\n")); + + if (sc->sc_refcnt && rep == sc->report_id) { + parse_input(sc, p, psize); + } + + return (1); +} + +int +ietp_enable(void *dev) +{ + struct ietp_softc *sc = dev; + + DPRINTF(("%s: %s: refcnt=%d\n", sc->sc_dev.dv_xname, + __func__, sc->sc_refcnt)); + + if (sc->sc_refcnt++ || sc->sc_isize == 0) + return (0); + + /* power on */ + ietp_reset(sc); + + return (0); +} + +void +ietp_disable(void *dev) +{ + struct ietp_softc *sc = dev; + DPRINTF(("%s: %s: refcnt=%d\n", sc->sc_dev.dv_xname, + __func__, sc->sc_refcnt)); + + if (--sc->sc_refcnt) + return; + + /* no sub-devices open, conserve power */ + + if (ietp_set_power(sc, I2C_HID_POWER_OFF)) + printf("%s: failed to power down\n", sc->sc_dev.dv_xname); +} + +int +ietp_ioctl(void *dev, u_long cmd, caddr_t data, int flag, + struct proc *p) +{ + struct ietp_softc *sc = dev; + struct wsmouse_calibcoords *wsmc = (struct wsmouse_calibcoords *)data; + + switch (cmd) { + case WSMOUSEIO_GTYPE: + *(u_int *)data = WSMOUSE_TYPE_TOUCHPAD; + return 0; + + case WSMOUSEIO_GCALIBCOORDS: + wsmc->minx = 0; + wsmc->maxx = sc->max_x; + wsmc->miny = 0; + wsmc->maxy = sc->max_y; + wsmc->swapxy = 0; + wsmc->resx = sc->res_x; + wsmc->resy = sc->res_y; + return 0; + } + return -1; +} diff --git a/sys/dev/i2c/ietp.h b/sys/dev/i2c/ietp.h new file mode 100644 index 000000000..c0ba21632 --- /dev/null +++ b/sys/dev/i2c/ietp.h @@ -0,0 +1,66 @@ +/* $OpenBSD: ietp.h,v 1.1 2023/07/08 02:43:02 jcs Exp $ */ +/* + * Elantech touchpad I2C driver + * + * Copyright (c) 2015, 2016 joshua stein + * Copyright (c) 2020, 2022 Vladimir Kondratyev + * Copyright (c) 2023 vladimir serbinenko + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "ihidev.h" // For i2c_hid_desc + +struct ietp_softc { + struct device sc_dev; + i2c_tag_t sc_tag; + i2c_addr_t sc_addr; + void *sc_ih; + union { + uint8_t hid_desc_buf[sizeof(struct i2c_hid_desc)]; + struct i2c_hid_desc hid_desc; + }; + + u_int sc_isize; + u_char *sc_ibuf; + + int sc_refcnt; + + int sc_dying; + + struct device *sc_wsmousedev; + + uint8_t sc_buttons; + + uint8_t report_id; + size_t report_len; + + uint16_t product_id; + uint16_t ic_type; + + int32_t pressure_base; + uint16_t max_x; + uint16_t max_y; + uint16_t trace_x; + uint16_t trace_y; + uint16_t res_x; /* dots per mm */ + uint16_t res_y; + bool hi_precision; + bool is_clickpad; +}; + +int ietp_open(struct ietp_softc *); +void ietp_close(struct ietp_softc *); +int ietp_ioctl(void *, u_long, caddr_t, int, struct proc *); +int ietp_enable(void *dev); +void ietp_disable(void *dev); diff --git a/sys/dev/ic/amireg.h b/sys/dev/ic/amireg.h index a41194518..7296760fb 100644 --- a/sys/dev/ic/amireg.h +++ b/sys/dev/ic/amireg.h @@ -47,7 +47,7 @@ #define AMI_MAXIOCTLCMDS 1 /* number of parallel ioctl calls */ #define AMI_MAXPROCS 2 /* number of processors on a channel */ #define AMI_MAXRAWCMDS 2 /* number of parallel processor cmds */ - + #define AMI_MAXFER (AMI_MAXOFFSETS * PAGE_SIZE) #define AMI_QIDB 0x20 diff --git a/sys/dev/ic/an.c b/sys/dev/ic/an.c index a834c72b6..d38038fdc 100644 --- a/sys/dev/ic/an.c +++ b/sys/dev/ic/an.c @@ -205,7 +205,7 @@ an_attach(struct an_softc *sc) return(EIO); } - an_swap16((u_int16_t *)&sc->sc_config.an_macaddr, 3); + an_swap16((u_int16_t *)&sc->sc_config.an_macaddr, 3); /* Read the card capabilities */ buflen = sizeof(sc->sc_caps); @@ -214,7 +214,7 @@ an_attach(struct an_softc *sc) return(EIO); } - an_swap16((u_int16_t *)&sc->sc_caps.an_oemaddr, 3); + an_swap16((u_int16_t *)&sc->sc_caps.an_oemaddr, 3); an_swap16((u_int16_t *)&sc->sc_caps.an_rates, 4); /* Read WEP settings from persistent memory */ @@ -222,8 +222,8 @@ an_attach(struct an_softc *sc) buflen = sizeof(struct an_rid_wepkey); rid = AN_RID_WEP_VOLATILE; /* first persistent key */ while (an_read_rid(sc, rid, akey, &buflen) == 0) { - an_swap16((u_int16_t *)&akey->an_mac_addr, 3); - an_swap16((u_int16_t *)&akey->an_key, 8); + an_swap16((u_int16_t *)&akey->an_mac_addr, 3); + an_swap16((u_int16_t *)&akey->an_key, 8); kid = akey->an_key_index; DPRINTF(("an_attach: wep rid=0x%x len=%d(%d) index=0x%04x " "mac[0]=%02x keylen=%d\n", @@ -260,7 +260,7 @@ an_attach(struct an_softc *sc) printf("unknown (%x)", sc->sc_config.an_radiotype); printf(", address %s\n", ether_sprintf(ic->ic_myaddr)); - + ifp->if_softc = sc; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = an_ioctl; @@ -783,14 +783,14 @@ an_mwrite_bap(struct an_softc *sc, int id, int off, struct mbuf *m, int totlen) if ((mtod(m, u_long) & 0x1) || (len & 0x1)) { m_copydata(m, 0, totlen, &sc->sc_buf.sc_txbuf); cnt = (totlen + 1) / 2; - an_swap16((u_int16_t *)&sc->sc_buf.sc_txbuf, cnt); + an_swap16((u_int16_t *)&sc->sc_buf.sc_txbuf, cnt); CSR_WRITE_MULTI_STREAM_2(sc, AN_DATA0, sc->sc_buf.sc_val, cnt); off += cnt * 2; break; } cnt = len / 2; - an_swap16((u_int16_t *)mtod(m, u_int16_t *), cnt); + an_swap16((u_int16_t *)mtod(m, u_int16_t *), cnt); CSR_WRITE_MULTI_STREAM_2(sc, AN_DATA0, mtod(m, u_int16_t *), cnt); off += len; @@ -961,7 +961,7 @@ an_init(struct ifnet *ifp) sc->sc_txcur = sc->sc_txnext = 0; IEEE80211_ADDR_COPY(sc->sc_config.an_macaddr, ic->ic_myaddr); - an_swap16((u_int16_t *)&sc->sc_config.an_macaddr, 3); + an_swap16((u_int16_t *)&sc->sc_config.an_macaddr, 3); sc->sc_config.an_scanmode = AN_SCANMODE_ACTIVE; sc->sc_config.an_authtype = AN_AUTHTYPE_OPEN; /*XXX*/ if (ic->ic_flags & IEEE80211_F_WEPON) { @@ -1014,7 +1014,7 @@ an_init(struct ifnet *ifp) if (ic->ic_des_esslen) memcpy(sc->sc_buf.sc_ssidlist.an_entry[0].an_ssid, ic->ic_des_essid, ic->ic_des_esslen); - an_swap16((u_int16_t *)&sc->sc_buf.sc_ssidlist.an_entry[0].an_ssid, 16); + an_swap16((u_int16_t *)&sc->sc_buf.sc_ssidlist.an_entry[0].an_ssid, 16); if ((error = an_write_rid(sc, AN_RID_SSIDLIST, &sc->sc_buf, sizeof(sc->sc_buf.sc_ssidlist)))) { printf("%s: failed to write ssid list\n", ifp->if_xname); @@ -1172,7 +1172,7 @@ an_start(struct ifnet *ifp) struct mbuf mb; struct an_tx_radiotap_header *tap = &sc->sc_txtap; - tap->at_rate = + tap->at_rate = ic->ic_bss->ni_rates.rs_rates[ic->ic_bss->ni_txrate]; tap->at_chan_freq = ic->ic_bss->ni_chan->ic_freq; @@ -1556,9 +1556,9 @@ an_write_wepkey(struct an_softc *sc, int type, struct an_wepkey *keys, int kid) akey->an_key_len = keys[i].an_wep_keylen; akey->an_key_index = i; akey->an_mac_addr[0] = 1; /* default mac */ - an_swap16((u_int16_t *)&akey->an_mac_addr, 3); + an_swap16((u_int16_t *)&akey->an_mac_addr, 3); memcpy(akey->an_key, keys[i].an_wep_key, keys[i].an_wep_keylen); - an_swap16((u_int16_t *)&akey->an_key, 8); + an_swap16((u_int16_t *)&akey->an_key, 8); if ((error = an_write_rid(sc, type, akey, sizeof(*akey))) != 0) return error; } @@ -1566,7 +1566,7 @@ an_write_wepkey(struct an_softc *sc, int type, struct an_wepkey *keys, int kid) memset(akey, 0, sizeof(struct an_rid_wepkey)); akey->an_key_index = 0xffff; akey->an_mac_addr[0] = kid; - an_swap16((u_int16_t *)&akey->an_mac_addr, 3); + an_swap16((u_int16_t *)&akey->an_mac_addr, 3); akey->an_key_len = 0; memset(akey->an_key, 0, sizeof(akey->an_key)); error = an_write_rid(sc, type, akey, sizeof(*akey)); @@ -1594,8 +1594,8 @@ an_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg) case IEEE80211_S_RUN: buflen = sizeof(sc->sc_buf); an_read_rid(sc, AN_RID_STATUS, &sc->sc_buf, &buflen); - an_swap16((u_int16_t *)&sc->sc_buf.sc_status.an_cur_bssid, 3); - an_swap16((u_int16_t *)&sc->sc_buf.sc_status.an_ssid, 16); + an_swap16((u_int16_t *)&sc->sc_buf.sc_status.an_cur_bssid, 3); + an_swap16((u_int16_t *)&sc->sc_buf.sc_status.an_ssid, 16); IEEE80211_ADDR_COPY(ni->ni_bssid, sc->sc_buf.sc_status.an_cur_bssid); IEEE80211_ADDR_COPY(ni->ni_macaddr, ni->ni_bssid); diff --git a/sys/dev/ic/ar5008.c b/sys/dev/ic/ar5008.c index eeadd6eb2..9fbbdc2f4 100644 --- a/sys/dev/ic/ar5008.c +++ b/sys/dev/ic/ar5008.c @@ -1341,7 +1341,7 @@ ar5008_swba_intr(struct athn_softc *sc) wh = mtod(m, struct ieee80211_frame *); wh->i_fc[1] |= IEEE80211_FC1_MORE_DATA; } - + if (sc->ops.tx(sc, m, ni, ATHN_TXFLAG_CAB) != 0) { ieee80211_release_node(ic, ni); ifp->if_oerrors++; @@ -1559,7 +1559,7 @@ ar5008_tx(struct athn_softc *sc, struct mbuf *m, struct ieee80211_node *ni, } else { /* Use fallback table of the node. */ int txrate; - + if (ni->ni_flags & IEEE80211_NODE_HT) txrate = ATHN_NUM_LEGACY_RATES + ni->ni_txmcs; else @@ -1684,7 +1684,7 @@ ar5008_tx(struct athn_softc *sc, struct mbuf *m, struct ieee80211_node *ni, ds->ds_ctl0 |= AR_TXC0_CTS_ENABLE; } } - /* + /* * Disable multi-rate retries when protection is used. * The RTS/CTS frame's duration field is fixed and won't be * updated by hardware when the data rate changes. diff --git a/sys/dev/ic/ar5211.c b/sys/dev/ic/ar5211.c index 1033a063d..6feb48ad3 100644 --- a/sys/dev/ic/ar5211.c +++ b/sys/dev/ic/ar5211.c @@ -651,7 +651,7 @@ ar5k_ar5211_reset(struct ath_hal *hal, HAL_OPMODE op_mode, HAL_CHANNEL *channel, ar5k_ar5211_set_gpio_intr(hal, 0, 0); } - /* + /* * Disable beacons and reset the register */ AR5K_REG_DISABLE_BITS(AR5K_AR5211_BEACON, diff --git a/sys/dev/ic/ar5212.c b/sys/dev/ic/ar5212.c index f2128ac78..c3fbea646 100644 --- a/sys/dev/ic/ar5212.c +++ b/sys/dev/ic/ar5212.c @@ -828,7 +828,7 @@ ar5k_ar5212_reset(struct ath_hal *hal, HAL_OPMODE op_mode, HAL_CHANNEL *channel, AR5K_REG_WRITE(AR5K_AR5212_PHY_SDELAY, AR5K_AR5212_PHY_SDELAY_32MHZ); AR5K_REG_WRITE(AR5K_AR5212_PHY_SPENDING, hal->ah_phy_spending); - /* + /* * Disable beacons and reset the register */ AR5K_REG_DISABLE_BITS(AR5K_AR5212_BEACON, @@ -2998,7 +2998,7 @@ ar5k_ar5212_txpower(struct ath_hal *hal, HAL_CHANNEL *channel, u_int txpower) /* Initialize TX power table */ ar5k_txpower_table(hal, channel, txpower); - /* + /* * Write TX power values */ for (i = 0; i < (AR5K_EEPROM_POWER_TABLE_SIZE / 2); i++) { diff --git a/sys/dev/ic/ar5xxx.c b/sys/dev/ic/ar5xxx.c index 416ab96b9..f469f0077 100644 --- a/sys/dev/ic/ar5xxx.c +++ b/sys/dev/ic/ar5xxx.c @@ -1160,7 +1160,7 @@ ar5k_ar5111_chan2athchan(u_int ieee, struct ar5k_athchan_2ghz *athchan) { int channel; - /* Cast this value to catch negative channel numbers (>= -19) */ + /* Cast this value to catch negative channel numbers (>= -19) */ channel = (int)ieee; /* diff --git a/sys/dev/ic/ar9003.c b/sys/dev/ic/ar9003.c index ad5fced16..56a119406 100644 --- a/sys/dev/ic/ar9003.c +++ b/sys/dev/ic/ar9003.c @@ -1291,7 +1291,7 @@ ar9003_swba_intr(struct athn_softc *sc) wh = mtod(m, struct ieee80211_frame *); wh->i_fc[1] |= IEEE80211_FC1_MORE_DATA; } - + if (sc->ops.tx(sc, m, ni, ATHN_TXFLAG_CAB) != 0) { ieee80211_release_node(ic, ni); ifp->if_oerrors++; @@ -1610,7 +1610,7 @@ ar9003_tx(struct athn_softc *sc, struct mbuf *m, struct ieee80211_node *ni, ds->ds_ctl11 |= AR_TXC11_CTS_ENABLE; } } - /* + /* * Disable multi-rate retries when protection is used. * The RTS/CTS frame's duration field is fixed and won't be * updated by hardware when the data rate changes. diff --git a/sys/dev/ic/ath.c b/sys/dev/ic/ath.c index 49113c59a..29484341b 100644 --- a/sys/dev/ic/ath.c +++ b/sys/dev/ic/ath.c @@ -38,7 +38,7 @@ * * This software is derived from work of Atsushi Onoe; his contribution * is greatly appreciated. It has been modified for OpenBSD to use an - * open source HAL instead of the original binary-only HAL. + * open source HAL instead of the original binary-only HAL. */ #include "bpfilter.h" @@ -1375,7 +1375,7 @@ ath_beacon_config(struct ath_softc *sc) bs.bs_nextdtim = nexttbtt; /* * Calculate the number of consecutive beacons to miss - * before taking a BMISS interrupt. + * before taking a BMISS interrupt. * Note that we clamp the result to at most 7 beacons. */ bs.bs_bmissthreshold = ic->ic_bmissthres; @@ -1834,7 +1834,7 @@ ath_rx_proc(void *arg, int npending) * discard the frame. */ - /* + /* * Enable this if you want to see error * frames in Monitor mode. */ @@ -2011,7 +2011,7 @@ ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni, pktlen = m0->m_pkthdr.len; if (ath_softcrypto && iswep) { - k = ieee80211_get_txkey(ic, wh, ni); + k = ieee80211_get_txkey(ic, wh, ni); if ((m0 = ieee80211_encrypt(ic, m0, k)) == NULL) return ENOMEM; wh = mtod(m0, struct ieee80211_frame *); diff --git a/sys/dev/ic/athnreg.h b/sys/dev/ic/athnreg.h index a5dff33f5..cadd604c5 100644 --- a/sys/dev/ic/athnreg.h +++ b/sys/dev/ic/athnreg.h @@ -282,7 +282,7 @@ /* Bits for AR_MIRT. */ #define AR_MIRT_RATE_THRES_M 0x0000ffff -#define AR_MIRT_RATE_THRES_S 0 +#define AR_MIRT_RATE_THRES_S 0 /* Bits for AR_TIMT. */ #define AR_TIMT_LAST_M 0x0000ffff diff --git a/sys/dev/ic/athnvar.h b/sys/dev/ic/athnvar.h index db6bdf443..6c5410c81 100644 --- a/sys/dev/ic/athnvar.h +++ b/sys/dev/ic/athnvar.h @@ -82,7 +82,7 @@ struct athn_tx_buf { int bf_txmcs; int bf_txflags; #define ATHN_TXFLAG_PAPRD (1 << 0) -#define ATHN_TXFLAG_CAB (1 << 1) +#define ATHN_TXFLAG_CAB (1 << 1) }; struct athn_txq { diff --git a/sys/dev/ic/athvar.h b/sys/dev/ic/athvar.h index 2d42be4f7..248b3df78 100644 --- a/sys/dev/ic/athvar.h +++ b/sys/dev/ic/athvar.h @@ -161,8 +161,8 @@ struct ath_tx_radiotap_header { u_int8_t wt_antenna; } __packed; -/* - * driver-specific node +/* + * driver-specific node */ struct ath_node { struct ieee80211_node an_node; /* base class */ @@ -289,7 +289,7 @@ struct ath_softc { gpio_pin_t sc_gpio_pins[ATH_MAXGPIO]; }; -/* unaligned little endian access */ +/* unaligned little endian access */ #define LE_READ_2(p) \ ((u_int16_t) \ ((((u_int8_t *)(p))[0] ) | (((u_int8_t *)(p))[1] << 8))) diff --git a/sys/dev/ic/atw.c b/sys/dev/ic/atw.c index 1013c861b..c3deba59d 100644 --- a/sys/dev/ic/atw.c +++ b/sys/dev/ic/atw.c @@ -797,7 +797,7 @@ atw_attach(struct atw_softc *sc) #ifndef IEEE80211_STA_ONLY ic->ic_caps |= IEEE80211_C_IBSS; #endif - ic->ic_sup_rates[IEEE80211_MODE_11B] = ieee80211_std_rateset_11b; + ic->ic_sup_rates[IEEE80211_MODE_11B] = ieee80211_std_rateset_11b; /* * Call MI attach routines. @@ -3442,7 +3442,7 @@ atw_compute_duration1(int len, int use_ack, uint32_t flags, int rate, * * wh: 802.11 header * - * len: packet length + * len: packet length * * rate: MSDU speed, units 500kb/s * @@ -3620,7 +3620,7 @@ atw_start(struct ifnet *ifp) m0 = ieee80211_encrypt(ic, m0, k); if (m0 == NULL) { ifp->if_oerrors++; - break; + break; } } } diff --git a/sys/dev/ic/atwreg.h b/sys/dev/ic/atwreg.h index fcca5b2d3..02f03489c 100644 --- a/sys/dev/ic/atwreg.h +++ b/sys/dev/ic/atwreg.h @@ -221,7 +221,7 @@ #define ATW_C_FRCTL_CTX_DATA (1<<22) /* 0: set by CSR28 * 1: random */ -#define ATW_C_FRCTL_RSVFRM (1<<21) /* 1: receive "reserved" +#define ATW_C_FRCTL_RSVFRM (1<<21) /* 1: receive "reserved" * frames, 0: ignore * reserved frames */ @@ -342,7 +342,7 @@ #define ATW_IER_REIE (1<<12) /* RX packet filled its first * descriptor */ -#define ATW_IER_RCIE (1<<6) /* completed RX */ +#define ATW_IER_RCIE (1<<6) /* completed RX */ #define ATW_IER_TDUIE (1<<2) /* transmit descriptor * unavailable */ @@ -417,7 +417,7 @@ /* Running - close transmit descriptor */ #define ATW_TEST0_TS_CLOSE LSHIFT(7, ATW_TEST0_TS_MASK) -/* ADM8211C/CR registers */ +/* ADM8211C/CR registers */ /* Suspended */ #define ATW_C_TEST0_TS_SUSPENDED LSHIFT(4, ATW_TEST0_TS_MASK) /* Descriptor write */ @@ -676,7 +676,7 @@ #define ATW_PAR0_PAB2_MASK 0xff0000 /* MAC address byte 2 */ #define ATW_PAR0_PAB3_MASK 0xff000000 /* MAC address byte 3 */ -#define ATW_C_PAR1_CTD 0xffff0000 /* Continuous Tx pattern */ +#define ATW_C_PAR1_CTD 0xffff0000 /* Continuous Tx pattern */ #define ATW_PAR1_PAB5_MASK 0xff00 /* MAC address byte 5 */ #define ATW_PAR1_PAB4_MASK 0xff /* MAC address byte 4 */ @@ -880,8 +880,8 @@ /* Function Event/Status registers */ -#define ATW_FER_INTR (1<<15) /* interrupt: set regardless of mask */ -#define ATW_FER_GWAKE (1<<4) /* general wake-up: set regardless of mask */ +#define ATW_FER_INTR (1<<15) /* interrupt: set regardless of mask */ +#define ATW_FER_GWAKE (1<<4) /* general wake-up: set regardless of mask */ #define ATW_FEMR_INTR_EN (1<<15) /* enable INTA# */ #define ATW_FEMR_WAKEUP_EN (1<<14) /* enable wake-up */ @@ -939,7 +939,7 @@ #define ATW_SR_CHECKSUM (0x7e/2) /* for data 0x00-0x7d */ #define ATW_SR_CIS (0x80/2) /* Cardbus CIS */ -/* Tx descriptor */ +/* Tx descriptor */ struct atw_txdesc { u_int32_t at_ctl; #define at_stat at_ctl @@ -973,7 +973,7 @@ struct atw_txdesc { #define ATW_TXFLAG_TBS2_MASK 0xfff000 /* at_buf2 byte count */ #define ATW_TXFLAG_TBS1_MASK 0xfff /* at_buf1 byte count */ -/* Rx descriptor */ +/* Rx descriptor */ struct atw_rxdesc { u_int32_t ar_stat; u_int32_t ar_ctl; @@ -989,7 +989,7 @@ struct atw_rxdesc { #define ATW_RXCTL_RBS1_MASK 0xfff /* ar_buf1 byte count */ #define ATW_RXSTAT_OWN (1<<31) /* 1: NIC may fill descriptor */ -#define ATW_RXSTAT_ES (1<<30) /* error summary, 0 on +#define ATW_RXSTAT_ES (1<<30) /* error summary, 0 on * success */ #define ATW_RXSTAT_SQL (1<<29) /* has signal quality (?) */ diff --git a/sys/dev/ic/bcmgenetvar.h b/sys/dev/ic/bcmgenetvar.h index 8076b8027..062cb14b6 100644 --- a/sys/dev/ic/bcmgenetvar.h +++ b/sys/dev/ic/bcmgenetvar.h @@ -64,7 +64,7 @@ struct genet_softc { enum genet_phy_mode sc_phy_mode; void *sc_ih; - + struct arpcom sc_ac; #define sc_lladdr sc_ac.ac_enaddr struct mii_data sc_mii; diff --git a/sys/dev/ic/bt463.c b/sys/dev/ic/bt463.c index 1ee7a8197..2a56c27c4 100644 --- a/sys/dev/ic/bt463.c +++ b/sys/dev/ic/bt463.c @@ -59,7 +59,7 @@ */ /* This code was derived from and originally located in sys/dev/pci/ - * NetBSD: tga_bt463.c,v 1.5 2000/03/04 10:27:59 elric Exp + * NetBSD: tga_bt463.c,v 1.5 2000/03/04 10:27:59 elric Exp */ #include @@ -134,7 +134,7 @@ struct bt463data { * around, and is probably * struct tga_devconfig * */ - + int (*ramdac_sched_update)(void *, void (*)(void *)); void (*ramdac_wr)(void *, u_int, u_int8_t); u_int8_t (*ramdac_rd)(void *, u_int); @@ -151,7 +151,7 @@ struct bt463data { /* When we're doing console initialization, there's no * way to get our cookie back to the video card's softc - * before we call sched_update. So we stash it here, + * before we call sched_update. So we stash it here, * and bt463_update will look for it here first. */ static struct bt463data *console_data; @@ -177,7 +177,7 @@ inline void bt463_wraddr(struct bt463data *, u_int16_t); void bt463_update(void *); - + /*****************************************************************************/ /* @@ -254,9 +254,9 @@ bt463_init(rc) /* * Setup: * reg 0: 4:1 multiplexing, 25/75 blink. - * reg 1: Overlay mapping: mapped to common palette, + * reg 1: Overlay mapping: mapped to common palette, * 14 window type entries, 24-plane configuration mode, - * 4 overlay planes, underlays disabled, no cursor. + * 4 overlay planes, underlays disabled, no cursor. * reg 2: sync-on-green enabled, pedestal enabled. */ @@ -307,7 +307,7 @@ bt463_init(rc) * Entry 0: 24-plane truecolor, overlays enabled, bypassed. * * Lookup table bypass: yes ( 1 << 23 & 0x800000) 800000 - * Colormap address: 0x000 (0x000 << 17 & 0x7e0000) 0 + * Colormap address: 0x000 (0x000 << 17 & 0x7e0000) 0 * Overlay mask: 0xf ( 0xf << 13 & 0x01e000) 1e000 * Overlay location: P<27:24> ( 0 << 12 & 0x001000) 0 * Display mode: Truecolor ( 0 << 9 & 0x000e00) 000 @@ -315,14 +315,14 @@ bt463_init(rc) * Plane shift: 0 ( 0 << 0 & 0x00001f) 0 * -------- * 0x81e100 - */ + */ data->window_type[0] = 0x81e100; - /* Entry 1: 8-plane pseudocolor in the bottom 8 bits, - * overlays enabled, colormap starting at 0. + /* Entry 1: 8-plane pseudocolor in the bottom 8 bits, + * overlays enabled, colormap starting at 0. * * Lookup table bypass: no ( 0 << 23 & 0x800000) 0 - * Colormap address: 0x000 (0x000 << 17 & 0x7e0000) 0 + * Colormap address: 0x000 (0x000 << 17 & 0x7e0000) 0 * Overlay mask: 0xf ( 0xf << 13 & 0x01e000) 0x1e000 * Overlay location: P<27:24> ( 0 << 12 & 0x001000) 0 * Display mode: Pseudocolor ( 1 << 9 & 0x000e00) 0x200 @@ -330,15 +330,15 @@ bt463_init(rc) * Plane shift: 16 ( 0x10 << 0 & 0x00001f) 10 * -------- * 0x01e310 - */ + */ data->window_type[1] = 0x01e310; - /* The colormap interface to the world only supports one colormap, - * so having an entry for the 'alternate' colormap in the bt463 + /* The colormap interface to the world only supports one colormap, + * so having an entry for the 'alternate' colormap in the bt463 * probably isn't useful. */ - /* Fill the remaining table entries with clones of entry 0 until we + /* Fill the remaining table entries with clones of entry 0 until we * figure out a better use for them. */ @@ -494,7 +494,7 @@ bt463_get_curcmap(rc, cursorp) #ifdef BT463_DEBUG int bt463_store(void *v) { - struct bt463data *data = (struct bt463data *)v; + struct bt463data *data = (struct bt463data *)v; data->changed = DATA_ALL_CHANGED; data->ramdac_sched_update(data->cookie, bt463_update); @@ -506,7 +506,7 @@ int bt463_store(void *v) int bt463_readback(void *v) { - struct bt463data *data = (struct bt463data *)v; + struct bt463data *data = (struct bt463data *)v; data->ramdac_sched_update(data->cookie, bt463_copyback); printf("Scheduled bt463 copyback\n"); @@ -540,7 +540,7 @@ bt463_debug(v) return 0; } -void +void bt463_copyback(p) void *p; { @@ -583,7 +583,7 @@ bt463_update(p) /* The Bt463 won't accept window type data except during a blanking * interval, so we do this early in the interrupt. - * Blanking the screen might also be a good idea, but it can cause + * Blanking the screen might also be a good idea, but it can cause * unpleasant flashing and is hard to do from this side of the * ramdac interface. */ @@ -596,7 +596,7 @@ bt463_update(p) BTWNREG(data, (data->window_type[i] >> 16) & 0xff); /* B16-23 */ } } - + if (v & DATA_CURCMAP_CHANGED) { bt463_wraddr(data, BT463_IREG_CURSOR_COLOR_0); /* spit out the cursor data */ @@ -606,16 +606,16 @@ bt463_update(p) BTWNREG(data, data->curcmap_b[i]); } } - + if (v & DATA_CMAP_CHANGED) { bt463_wraddr(data, BT463_IREG_CPALETTE_RAM); /* spit out the colormap data */ for (i = 0; i < BT463_NCMAP_ENTRIES; i++) { - data->ramdac_wr(data->cookie, BT463_REG_CMAP_DATA, + data->ramdac_wr(data->cookie, BT463_REG_CMAP_DATA, data->cmap_r[i]); - data->ramdac_wr(data->cookie, BT463_REG_CMAP_DATA, + data->ramdac_wr(data->cookie, BT463_REG_CMAP_DATA, data->cmap_g[i]); - data->ramdac_wr(data->cookie, BT463_REG_CMAP_DATA, + data->ramdac_wr(data->cookie, BT463_REG_CMAP_DATA, data->cmap_b[i]); } } diff --git a/sys/dev/ic/bt485.c b/sys/dev/ic/bt485.c index 263742f45..df157dc11 100644 --- a/sys/dev/ic/bt485.c +++ b/sys/dev/ic/bt485.c @@ -29,7 +29,7 @@ */ /* This code was derived from and originally located in sys/dev/pci/ - * NetBSD: tga_bt485.c,v 1.4 1999/03/24 05:51:21 mrg Exp + * NetBSD: tga_bt485.c,v 1.4 1999/03/24 05:51:21 mrg Exp */ #include @@ -93,7 +93,7 @@ struct bt485data { * around, and is probably * struct tga_devconfig * */ - + int (*ramdac_sched_update)(void *, void (*)(void *)); void (*ramdac_wr)(void *, u_int, u_int8_t); u_int8_t (*ramdac_rd)(void *, u_int); @@ -576,7 +576,7 @@ bt485_update(vp) for (i = 0; i < count; i++) data->ramdac_wr(data->cookie, BT485_REG_CURSOR_RAM, data->curimage[i]); - + /* * Write the cursor mask data: * set addr[9:8] to 2, diff --git a/sys/dev/ic/bt485reg.h b/sys/dev/ic/bt485reg.h index 21c3d25f5..0bb0783ba 100644 --- a/sys/dev/ic/bt485reg.h +++ b/sys/dev/ic/bt485reg.h @@ -6,17 +6,17 @@ * All rights reserved. * * Author: Chris G. Demetriou - * + * * Permission to use, copy, modify and distribute this software and * its documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU diff --git a/sys/dev/ic/bt8xx.h b/sys/dev/ic/bt8xx.h index 9f8ea37b3..67cfc8e5f 100644 --- a/sys/dev/ic/bt8xx.h +++ b/sys/dev/ic/bt8xx.h @@ -172,7 +172,7 @@ struct meteor_video { #define METEOR_SIG_FIELD 0x00010000 /* signal every field */ /* following structure is used to coordinate the synchronous */ - + struct meteor_mem { /* kernel write only */ int frame_size; /* row*columns*depth */ @@ -296,7 +296,7 @@ struct eeProm { #define TVTUNER_GETSTATUS _IOR('x', 34, unsigned int) /* get tuner status */ #define TVTUNER_SETFREQ _IOW('x', 35, unsigned int) /* set frequency */ #define TVTUNER_GETFREQ _IOR('x', 36, unsigned int) /* get frequency */ - + #define BT848_SHUE _IOW('x', 37, int) /* set hue */ #define BT848_GHUE _IOR('x', 37, int) /* get hue */ @@ -333,9 +333,9 @@ struct eeProm { /* Read/Write the BT848's I2C bus directly * b7-b0: data (read/write) - * b15-b8: internal peripheral register (write) + * b15-b8: internal peripheral register (write) * b23-b16: i2c addr (write) - * b31-b24: 1 = write, 0 = read + * b31-b24: 1 = write, 0 = read */ #define BT848_I2CWR _IOWR('x', 57, u_int) /* i2c read-write */ @@ -460,10 +460,10 @@ struct bktr_remote { /*control receiver*/ /*returns raw data*/ - + /* * Direct access to GPIO pins. You must add BKTR_GPIO_ACCESS to your kernel - * configuration file to use these + * configuration file to use these */ #define BT848_GPIO_SET_EN _IOW('x', 72, int) /* set gpio_out_en */ #define BT848_GPIO_GET_EN _IOR('x', 73, int) /* get gpio_out_en */ diff --git a/sys/dev/ic/bwfm.c b/sys/dev/ic/bwfm.c index 2a25c94cd..0546bc97b 100644 --- a/sys/dev/ic/bwfm.c +++ b/sys/dev/ic/bwfm.c @@ -656,7 +656,7 @@ bwfm_rate2vhtmcs(int *mcs, int *ss, uint32_t txrate) { const struct ieee80211_vht_rateset *rs; int i, j; - + *mcs = -1; *ss = -1; /* TODO: Select specific ratesets based on BSS channel width. */ @@ -677,7 +677,7 @@ bwfm_rate2htmcs(uint32_t txrate) { const struct ieee80211_ht_rateset *rs; int i, j; - + /* TODO: Select specific ratesets based on BSS channel width. */ for (i = 0; i < IEEE80211_HT_NUM_RATESETS; i++) { rs = &ieee80211_std_ratesets_11n[i]; diff --git a/sys/dev/ic/bwi.c b/sys/dev/ic/bwi.c index 3389a33b2..96a90f7a9 100644 --- a/sys/dev/ic/bwi.c +++ b/sys/dev/ic/bwi.c @@ -2,14 +2,14 @@ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. - * + * * This code is derived from software contributed to The DragonFly Project * by Sepherosa Ziehau - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright @@ -19,7 +19,7 @@ * 3. Neither the name of The DragonFly Project nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific, prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -32,7 +32,7 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * $DragonFly: src/sys/dev/netif/bwi/bwimac.c,v 1.1 2007/09/08 06:15:54 sephe Exp $ */ @@ -7044,7 +7044,7 @@ bwi_init_statechg(struct bwi_softc *sc, int statechg) goto back; bwi_bbp_power_on(sc, BWI_CLOCK_MODE_DYN); - + IEEE80211_ADDR_COPY(ic->ic_myaddr, LLADDR(ifp->if_sadl)); bwi_set_bssid(sc, bwi_zero_addr); /* Clear BSSID */ @@ -7514,7 +7514,7 @@ bwi_dma_alloc(struct bwi_softc *sc) switch (sc->sc_bus_space) { case BWI_BUS_SPACE_30BIT: - /* + /* * 30bit devices must use bounce buffers but * otherwise work like 32bit devices. */ @@ -8701,7 +8701,7 @@ bwi_ack_rate(struct ieee80211_node *ni, uint8_t rate) for (i = 0; i < rs->rs_nrates; ++i) { uint8_t rate1 = rs->rs_rates[i] & IEEE80211_RATE_VAL; - + if (rate1 > rate) { if (ack_rate != 0) return ack_rate; @@ -8759,7 +8759,7 @@ bwi_ack_rate(struct ieee80211_node *ni, uint8_t rate) #define IEEE80211_OFDM_SIGNAL_TIME 4 #define IEEE80211_OFDM_PLCP_SERVICE_NBITS 16 -#define IEEE80211_OFDM_TAIL_NBITS 6 +#define IEEE80211_OFDM_TAIL_NBITS 6 #define IEEE80211_OFDM_NBITS(frmlen) \ (IEEE80211_OFDM_PLCP_SERVICE_NBITS + \ diff --git a/sys/dev/ic/bwireg.h b/sys/dev/ic/bwireg.h index 443ef1a58..5f1701965 100644 --- a/sys/dev/ic/bwireg.h +++ b/sys/dev/ic/bwireg.h @@ -2,14 +2,14 @@ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. - * + * * This code is derived from software contributed to The DragonFly Project * by Sepherosa Ziehau - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright @@ -19,7 +19,7 @@ * 3. Neither the name of The DragonFly Project nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific, prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -32,7 +32,7 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * $DragonFly: src/sys/dev/netif/bwi/if_bwireg.h,v 1.1 2007/09/08 06:15:54 sephe Exp $ */ diff --git a/sys/dev/ic/bwivar.h b/sys/dev/ic/bwivar.h index fd6e28ef2..785a4d5aa 100644 --- a/sys/dev/ic/bwivar.h +++ b/sys/dev/ic/bwivar.h @@ -2,14 +2,14 @@ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. - * + * * This code is derived from software contributed to The DragonFly Project * by Sepherosa Ziehau - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright @@ -19,7 +19,7 @@ * 3. Neither the name of The DragonFly Project nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific, prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -32,7 +32,7 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * $DragonFly: src/sys/dev/netif/bwi/if_bwivar.h,v 1.1 2007/09/08 06:15:54 sephe Exp $ */ @@ -553,7 +553,7 @@ struct bwi_softc { struct timeout sc_led_blink_end_ch; int sc_led_blink_offdur; struct bwi_led sc_leds[BWI_LED_MAX]; - + enum bwi_bus_space sc_bus_space; /* bounce buffers for 30 bit bus space devices */ @@ -596,7 +596,7 @@ struct bwi_softc { void (*sc_txeof_status)(struct bwi_softc *); - int (*sc_enable)(struct bwi_softc *); + int (*sc_enable)(struct bwi_softc *); void (*sc_disable)(struct bwi_softc *); void (*sc_conf_write)(void *, uint32_t, uint32_t); @@ -610,14 +610,14 @@ struct bwi_softc { #if NBPFILTER > 0 caddr_t sc_drvbpf; - + union { struct bwi_rx_radiotap_hdr th; uint8_t pad[64]; } sc_rxtapu; #define sc_rxtap sc_rxtapu.th int sc_rxtap_len; - + union { struct bwi_tx_radiotap_hdr th; uint8_t pad[64]; diff --git a/sys/dev/ic/cacreg.h b/sys/dev/ic/cacreg.h index 2069b4457..fc3e02573 100644 --- a/sys/dev/ic/cacreg.h +++ b/sys/dev/ic/cacreg.h @@ -247,5 +247,5 @@ struct cac_sgb { u_int32_t length; /* length of S/G segment */ u_int32_t addr; /* physical address of block */ } __packed; - + #endif /* !_IC_CACREG_H_ */ diff --git a/sys/dev/ic/cacvar.h b/sys/dev/ic/cacvar.h index ca777864a..3938391d3 100644 --- a/sys/dev/ic/cacvar.h +++ b/sys/dev/ic/cacvar.h @@ -104,7 +104,7 @@ struct cac_softc { const struct cac_linkage *sc_cl; caddr_t sc_ccbs; paddr_t sc_ccbs_paddr; - SIMPLEQ_HEAD(, cac_ccb) sc_ccb_free; + SIMPLEQ_HEAD(, cac_ccb) sc_ccb_free; SIMPLEQ_HEAD(, cac_ccb) sc_ccb_queue; struct cac_drive_info *sc_dinfos; int (*sc_ioctl)(struct device *, u_long, caddr_t); diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index 46d0cbeba..41b4f4bc0 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -1162,7 +1162,7 @@ cominit(bus_space_tag_t iot, bus_space_handle_t ioh, int rate, int frequency) } #ifdef COM_CONSOLE -void +void comcnprobe(struct consdev *cp) { bus_space_handle_t ioh; diff --git a/sys/dev/ic/cy.c b/sys/dev/ic/cy.c index a2f3848c1..2af39ad73 100644 --- a/sys/dev/ic/cy.c +++ b/sys/dev/ic/cy.c @@ -159,7 +159,7 @@ cy_probe_common(bus_space_tag_t memt, bus_space_handle_t memh, int bustype) } #ifdef CY_DEBUG printf("firmware version 0x%x\n", firmware_ver); -#endif +#endif if ((firmware_ver & 0xf0) != 0x40) break; @@ -216,7 +216,7 @@ cy_attach(struct device *parent, struct device *self) /* Set cy_clock depending on firmware version */ if (cd_read_reg_sc(sc, cy_chip, CD1400_GFRCR) <= 0x46) cy_clock = CY_CLOCK; - else + else cy_clock = CY_CLOCK_60; /* set up a receive timeout period (1ms) */ @@ -964,7 +964,7 @@ cy_poll(void *arg) doesn't change RTS if RTSCTS is on */ cd_write_reg(cy, CD1400_CAR, port & CD1400_CAR_CHAN); - + if ((cd_read_reg(cy, CD1400_MSVR1) & CD1400_MSVR1_RTS) == 0) { cd_write_reg(cy, CD1400_MSVR1, diff --git a/sys/dev/ic/cyreg.h b/sys/dev/ic/cyreg.h index 9a4263604..c09b06a4c 100644 --- a/sys/dev/ic/cyreg.h +++ b/sys/dev/ic/cyreg.h @@ -85,7 +85,7 @@ #define RX_DTR_THRESHOLD 9 /* - * Maximum number of ports per card + * Maximum number of ports per card */ #define CY_MAX_PORTS (CD1400_NO_OF_CHANNELS * CY_MAX_CD1400s) diff --git a/sys/dev/ic/dc.c b/sys/dev/ic/dc.c index 67dfc69d3..10272e524 100644 --- a/sys/dev/ic/dc.c +++ b/sys/dev/ic/dc.c @@ -534,7 +534,7 @@ dc_mii_readreg(struct dc_softc *sc, struct dc_mii_frame *frame) frame->mii_opcode = DC_MII_READOP; frame->mii_turnaround = 0; frame->mii_data = 0; - + /* * Sync the PHYs. */ @@ -606,7 +606,7 @@ dc_mii_writereg(struct dc_softc *sc, struct dc_mii_frame *frame) /* * Sync the PHYs. - */ + */ dc_mii_sync(sc); dc_mii_send(sc, frame->mii_stdelim, 2); @@ -946,7 +946,7 @@ dc_setfilt_21143(struct dc_softc *sc) bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap, offsetof(struct dc_list_data, dc_sbuf[0]), - sizeof(struct dc_list_data) - + sizeof(struct dc_list_data) - offsetof(struct dc_list_data, dc_sbuf[0]), BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); @@ -1592,7 +1592,7 @@ dc_attach(struct dc_softc *sc) case DC_TYPE_21143: case DC_TYPE_21145: case DC_TYPE_ASIX: - dc_read_eeprom(sc, (caddr_t)&sc->sc_arpcom.ac_enaddr, + dc_read_eeprom(sc, (caddr_t)&sc->sc_arpcom.ac_enaddr, DC_EE_NODEADDR, 3, 0); break; case DC_TYPE_AL981: @@ -1668,7 +1668,7 @@ hasmac: BUS_DMA_NOWAIT, &sc->sc_rx_sparemap) != 0) { printf(": can't create rx spare map\n"); return; - } + } for (i = 0; i < DC_TX_LIST_CNT; i++) { if (bus_dmamap_create(sc->sc_dmat, MCLBYTES, @@ -2023,7 +2023,7 @@ dc_pnic_rx_bug_war(struct dc_softc *sc, int idx) * frame reception. */ dc_newbuf(sc, i, m); - bcopy(ptr, mtod(m, char *), total_len); + bcopy(ptr, mtod(m, char *), total_len); cur_rx->dc_status = htole32(rxstat | DC_RXSTAT_FIRSTFRAG); } @@ -2148,7 +2148,7 @@ dc_rxeof(struct dc_softc *sc) } } - /* No errors; receive the packet. */ + /* No errors; receive the packet. */ total_len -= ETHER_CRC_LEN; m0 = m_devget(mtod(m, char *), total_len, ETHER_ALIGN); @@ -2703,10 +2703,10 @@ dc_init(void *xsc) break; case 16: DC_SETBIT(sc, DC_BUSCTL, DC_CACHEALIGN_16LONG); - break; + break; case 8: DC_SETBIT(sc, DC_BUSCTL, DC_CACHEALIGN_8LONG); - break; + break; case 0: default: DC_SETBIT(sc, DC_BUSCTL, DC_CACHEALIGN_NONE); diff --git a/sys/dev/ic/dc21040reg.h b/sys/dev/ic/dc21040reg.h index 8ec3e1828..e4a849cc6 100644 --- a/sys/dev/ic/dc21040reg.h +++ b/sys/dev/ic/dc21040reg.h @@ -421,7 +421,7 @@ typedef struct { #define TULIP_GP_ZX346_FULLDUPLEX 0x00000004 /* Full Duplex Sensed */ #define TULIP_GP_ZX34X_LB102 0x00000002 /* 100tx twister LB */ #define TULIP_GP_ZX34X_NLB101 0x00000001 /* PDT/PDR LB */ -#define TULIP_GP_ZX34X_INIT 0x00000009 +#define TULIP_GP_ZX34X_INIT 0x00000009 /* * Compex's OUI. We need to twiddle a bit on their 21041 card. diff --git a/sys/dev/ic/dcreg.h b/sys/dev/ic/dcreg.h index 4efe93031..ec7926c7d 100644 --- a/sys/dev/ic/dcreg.h +++ b/sys/dev/ic/dcreg.h @@ -573,7 +573,7 @@ struct dc_mii_frame { /* * Special ASIX-specific bits in the ASIX NETCFG register (CSR6). */ -#define DC_AX_NETCFG_RX_BROAD 0x00000100 +#define DC_AX_NETCFG_RX_BROAD 0x00000100 /* * RX Filter Index Register values @@ -665,7 +665,7 @@ struct dc_mii_frame { DC_SETBIT(sc, DC_PN_GPIO, ((r) << 4)); \ DC_CLRBIT(sc, DC_PN_GPIO, (r)); \ } - + /* shortcut MII access register */ #define DC_PN_MII_DATA 0x0000FFFF #define DC_PN_MII_RESERVER 0x00020000 diff --git a/sys/dev/ic/dl10019.c b/sys/dev/ic/dl10019.c index 1f0d36a79..09741ab6a 100644 --- a/sys/dev/ic/dl10019.c +++ b/sys/dev/ic/dl10019.c @@ -210,7 +210,7 @@ dl10019_mii_writereg(struct device *self, int phy, int reg, int val) { struct ne2000_softc *nsc = (void *) self; const struct mii_bitbang_ops *ops; - + ops = (nsc->sc_type == NE2000_TYPE_DL10022) ? &dl10022_mii_bitbang_ops : &dl10019_mii_bitbang_ops; diff --git a/sys/dev/ic/dp8390reg.h b/sys/dev/ic/dp8390reg.h index b3e84c509..246d17b4a 100644 --- a/sys/dev/ic/dp8390reg.h +++ b/sys/dev/ic/dp8390reg.h @@ -358,7 +358,7 @@ * algorithm to allow prioritization of nodes. */ #define ED_TCR_OFST 0x10 - + /* * bits 5, 6, and 7 are unused/reserved */ diff --git a/sys/dev/ic/dwhdmi.c b/sys/dev/ic/dwhdmi.c index 7003f3bad..6ed927444 100644 --- a/sys/dev/ic/dwhdmi.c +++ b/sys/dev/ic/dwhdmi.c @@ -526,7 +526,7 @@ dwhdmi_audio_init(struct dwhdmi_softc *sc) val &= ~HDMI_AUD_CONF0_I2S_IN_EN; val |= (1 << 0); /* XXX 2ch */ dwhdmi_write(sc, HDMI_AUD_CONF0, val); - + val = (16 << 0); dwhdmi_write(sc, HDMI_AUD_CONF1, val); diff --git a/sys/dev/ic/dwiic.c b/sys/dev/ic/dwiic.c index 5076de0c2..7a9dad87b 100644 --- a/sys/dev/ic/dwiic.c +++ b/sys/dev/ic/dwiic.c @@ -176,7 +176,7 @@ dwiic_init(struct dwiic_softc *sc) sc->tx_fifo_depth = tx_fifo_depth; if (rx_fifo_depth > 1 && rx_fifo_depth < sc->rx_fifo_depth) sc->rx_fifo_depth = rx_fifo_depth; - + dwiic_write(sc, DW_IC_TX_TL, sc->tx_fifo_depth / 2); dwiic_write(sc, DW_IC_RX_TL, 0); diff --git a/sys/dev/ic/elink3.c b/sys/dev/ic/elink3.c index ccec2d00a..bdb540bcf 100644 --- a/sys/dev/ic/elink3.c +++ b/sys/dev/ic/elink3.c @@ -65,7 +65,7 @@ #include /* - * Structure to map media-present bits in boards to + * Structure to map media-present bits in boards to * ifmedia codes and printable media names. Used for table-driven * ifmedia initialization. */ @@ -79,11 +79,11 @@ struct ep_media { /* * ep_media table for Vortex/Demon/Boomerang: - * map from media-present bits in register RESET_OPTIONS+2 + * map from media-present bits in register RESET_OPTIONS+2 * to ifmedia "media words" and printable names. * * XXX indexed directly by INTERNAL_CONFIG default_media field, - * (i.e., EPMEDIA_ constants) forcing order of entries. + * (i.e., EPMEDIA_ constants) forcing order of entries. * Note that 3 is reserved. */ const struct ep_media ep_vortex_media[] = { @@ -288,14 +288,14 @@ epconfig(struct ep_softc *sc, u_short chipset, u_int8_t *enaddr) * packets. Commands only take an 11-bit parameter, and 11 bits * isn't enough to hold a full-size packet length. * Commands to these cards implicitly upshift a packet size - * or threshold by 2 bits. + * or threshold by 2 bits. * To detect cards with large-packet support, we probe by setting * the transmit threshold register, then change windows and * read back the threshold register directly, and see if the * threshold value was shifted or not. */ bus_space_write_2(iot, ioh, EP_COMMAND, - SET_TX_AVAIL_THRESH | EP_LARGEWIN_PROBE ); + SET_TX_AVAIL_THRESH | EP_LARGEWIN_PROBE ); GO_WINDOW(5); i = bus_space_read_2(iot, ioh, EP_W5_TX_AVAIL_THRESH); GO_WINDOW(1); @@ -319,7 +319,7 @@ epconfig(struct ep_softc *sc, u_short chipset, u_int8_t *enaddr) timeout_set(&sc->sc_epmbuffill_tmo, epmbuffill, sc); /* - * Ensure Tx-available interrupts are enabled for + * Ensure Tx-available interrupts are enabled for * start the interface. * XXX should be in epinit()? */ @@ -340,7 +340,7 @@ epconfig(struct ep_softc *sc, u_short chipset, u_int8_t *enaddr) ether_ifattach(ifp); /* - * Finish configuration: + * Finish configuration: * determine chipset if the front-end couldn't do so, * show board details, set media. */ @@ -545,11 +545,11 @@ ep_vortex_probemedia(struct ep_softc *sc) medium_name, (autoselect) ? "/autoselect" : ""); /* sc->sc_media = ep_vortex_media[default_media].epm_ifdata;*/ -#ifdef notyet +#ifdef notyet /* * Set default: either the active interface the card * reads from the EEPROM, or if autoselect is true, - * whatever we find is actually connected. + * whatever we find is actually connected. * * XXX autoselect not yet implemented. */ @@ -666,7 +666,7 @@ epinit(struct ep_softc *sc) } /* - * Set multicast receive filter. + * Set multicast receive filter. * elink3 hardware has no selective multicast filter in hardware. * Enable reception of all multicasts and filter in software. */ @@ -818,7 +818,7 @@ epsetmedia(struct ep_softc *sc, int medium) printf("%s unknown media 0x%x\n", sc->sc_dev.dv_xname, medium); #endif break; - + } /* @@ -839,7 +839,7 @@ epsetmedia(struct ep_softc *sc, int medium) #endif config1 = config1 & ~CONFIG_MEDIAMASK; config1 |= (medium << CONFIG_MEDIAMASK_SHIFT); - + #if defined(EP_DEBUG) printf("epsetmedia: %s: medium 0x%x, 0x%x to EP_W3_CONFIG\n", sc->sc_dev.dv_xname, medium, config1); @@ -888,7 +888,7 @@ ep_media_status(struct ifnet *ifp, struct ifmediareq *req) /* XXX read from softc when we start autosensing media */ req->ifm_active = sc->sc_mii.mii_media.ifm_cur->ifm_media; - + switch (sc->ep_chipset) { case EP_CHIPSET_VORTEX: case EP_CHIPSET_BOOMERANG: @@ -898,7 +898,7 @@ ep_media_status(struct ifnet *ifp, struct ifmediareq *req) config1 = bus_space_read_2(iot, ioh, EP_W3_INTERNAL_CONFIG + 2); GO_WINDOW(1); - config1 = + config1 = (config1 & CONFIG_MEDIAMASK) >> CONFIG_MEDIAMASK_SHIFT; req->ifm_active = ep_default_to_media[config1]; @@ -1056,7 +1056,7 @@ readcheck: if ((status & S_INTR_LATCH) == 0) { /* * No interrupt, read the packet and continue - * Is this supposed to happen? Is my motherboard + * Is this supposed to happen? Is my motherboard * completely busted? */ epread(sc); @@ -1227,7 +1227,7 @@ epintr(void *arg) eptxstat(sc); epstart(ifp); } - } + } /* no more interrupts */ return (ret); diff --git a/sys/dev/ic/elink3reg.h b/sys/dev/ic/elink3reg.h index 3e13c46a4..7de095ee1 100644 --- a/sys/dev/ic/elink3reg.h +++ b/sys/dev/ic/elink3reg.h @@ -104,7 +104,7 @@ #define EP_W2_ADDR_1 0x01 #define EP_W2_ADDR_0 0x00 -/* +/* * Window 3 registers. FIFO Management. */ /* Read */ @@ -234,7 +234,7 @@ #define SET_TX_AVAIL_THRESH (u_short) (0x12<<11) #define SET_TX_START_THRESH (u_short) (0x13<<11) #define START_DMA (u_short) (0x14<<11) /* busmaster-only */ -# define START_DMA_TX (START_DMA | 0x0)) /* busmaster-only */ +# define START_DMA_TX (START_DMA | 0x0) /* busmaster-only */ # define START_DMA_RX (START_DMA | 0x1) /* busmaster-only */ #define STATS_ENABLE (u_short) (0x15<<11) #define STATS_DISABLE (u_short) (0x16<<11) @@ -350,7 +350,7 @@ * 4-5: ram speed * 6-7: rom size * 8-15: reserved - * + * * 16-17: ram split (5:3, 3:1, or 1:1). * 18-19: reserved * 20-22: selected media type diff --git a/sys/dev/ic/fxp.c b/sys/dev/ic/fxp.c index 349b17f71..877254c34 100644 --- a/sys/dev/ic/fxp.c +++ b/sys/dev/ic/fxp.c @@ -283,7 +283,7 @@ int fxp_activate(struct device *self, int act) { struct fxp_softc *sc = (struct fxp_softc *)self; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct ifnet *ifp = &sc->sc_arpcom.ac_if; int rv = 0; switch (act) { @@ -794,7 +794,7 @@ fxp_intr(void *arg) while ((statack = CSR_READ_2(sc, FXP_CSR_SCB_STATUS)) & FXP_SCB_STATACK_MASK) { claimed = 1; - rnr = (statack & (FXP_SCB_STATACK_RNR | + rnr = (statack & (FXP_SCB_STATACK_RNR | FXP_SCB_STATACK_SWI)) ? 1 : 0; /* * First ACK all the interrupts in this pass. @@ -1414,7 +1414,7 @@ fxp_init(void *xsc) ifq_clr_oactive(&ifp->if_snd); /* - * Request a software generated interrupt that will be used to + * Request a software generated interrupt that will be used to * (re)start the RU processing. If we direct the chip to start * receiving from the start of queue now, instead of letting the * interrupt handler first process all received packets, we run @@ -1707,7 +1707,7 @@ fxp_mc_setup(struct fxp_softc *sc, int doit) if (doit == 0) return; - /* + /* * Initialize multicast setup descriptor. */ mcsp->cb_status = htole16(0); @@ -1763,13 +1763,13 @@ struct ucode { } const ucode_table[] = { { FXP_REV_82558_A4, D101_CPUSAVER_DWORD, 0, 0, - "fxp-d101a" }, + "fxp-d101a" }, { FXP_REV_82558_B0, D101_CPUSAVER_DWORD, 0, 0, "fxp-d101b0" }, - { FXP_REV_82559_A0, D101M_CPUSAVER_DWORD, + { FXP_REV_82559_A0, D101M_CPUSAVER_DWORD, D101M_CPUSAVER_BUNDLE_MAX_DWORD, D101M_CPUSAVER_MIN_SIZE_DWORD, "fxp-d101ma" }, @@ -1792,7 +1792,7 @@ struct ucode { { FXP_REV_82551_10, D102_E_CPUSAVER_DWORD, D102_E_CPUSAVER_BUNDLE_MAX_DWORD, D102_E_CPUSAVER_MIN_SIZE_DWORD, "fxp-d102e" }, - + { 0, 0, 0, 0, NULL } @@ -1862,7 +1862,7 @@ reloadit: if (uc->min_size_mask_offset) *((u_int16_t *)&cbp->ucode[uc->min_size_mask_offset]) = htole16(sc->sc_min_size_mask); - + FXP_UCODE_SYNC(sc, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); /* diff --git a/sys/dev/ic/fxpreg.h b/sys/dev/ic/fxpreg.h index ccae328a1..1b4863a40 100644 --- a/sys/dev/ic/fxpreg.h +++ b/sys/dev/ic/fxpreg.h @@ -263,7 +263,7 @@ struct fxp_stats { }; #define FXP_STATS_DUMP_COMPLETE 0xa005 #define FXP_STATS_DR_COMPLETE 0xa007 - + /* * Serial EEPROM control register bits */ @@ -343,7 +343,7 @@ struct fxp_cb_ucode { volatile u_int32_t ucode[MAXUCODESIZE]; }; -/* +/* * Chip revision values. */ #define FXP_REV_82557_A 0 /* 82557 A */ diff --git a/sys/dev/ic/fxpvar.h b/sys/dev/ic/fxpvar.h index 6fa8c5415..44528c58e 100644 --- a/sys/dev/ic/fxpvar.h +++ b/sys/dev/ic/fxpvar.h @@ -1,19 +1,19 @@ /* $OpenBSD: fxpvar.h,v 1.38 2022/01/09 05:42:38 jsg Exp $ */ /* $NetBSD: if_fxpvar.h,v 1.1 1997/06/05 02:01:58 thorpej Exp $ */ -/* +/* * Copyright (c) 1995, David Greenman * All rights reserved. - * + * * Modifications to support NetBSD: * Copyright (c) 1997 Jason R. Thorpe. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions - * are met: + * are met: * 1. Redistributions of source code must retain the above copyright * notice unmodified, this list of conditions, and the following - * disclaimer. + * disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -46,7 +46,7 @@ #define FXP_NTXCB 128 /* - * Minimum and maximum number of receive frame area buffers. + * Minimum and maximum number of receive frame area buffers. */ #define FXP_NRFABUFS_MIN 4 #define FXP_NRFABUFS_MAX 64 /* These are large so choose wisely. */ @@ -57,7 +57,7 @@ * microcode is loaded. */ #ifndef FXP_INT_DELAY -#define FXP_INT_DELAY 128 +#define FXP_INT_DELAY 128 #endif /* @@ -69,7 +69,7 @@ #define FXP_BUNDLE_MAX 16 #endif -/* +/* * Bit-mask describing minimum size frame that will be bundled. * This is only effective if the Intel microcode is loaded. * This is not present in all microcode revisions. Disabled by default, @@ -137,7 +137,7 @@ struct fxp_softc { struct fxp_ctrl *sc_ctrl; bus_dmamap_t sc_rxmaps[FXP_NRFABUFS_MAX]; int sc_rxfree; - u_int32_t sc_revision; /* chip revision */ + u_int32_t sc_revision; /* chip revision */ u_int16_t sc_int_delay; /* interrupt delay value for ucode */ u_int16_t sc_bundle_max; /* max # frames per interrupt (ucode) */ u_int16_t sc_min_size_mask; /* bit-mask describing the minimum @@ -190,7 +190,7 @@ void fxp_wakeup(struct fxp_softc *); #define FXP_STATS_SYNC(sc, p) \ bus_dmamap_sync((sc)->sc_dmat, (sc)->tx_cb_map, \ - offsetof(struct fxp_ctrl, stats), sizeof(struct fxp_stats), (p)) + offsetof(struct fxp_ctrl, stats), sizeof(struct fxp_stats), (p)) #define FXP_MBUF_SYNC(sc, m, p) \ bus_dmamap_sync((sc)->sc_dmat, (m), 0, (m)->dm_mapsize, (p)) diff --git a/sys/dev/ic/gdtreg.h b/sys/dev/ic/gdtreg.h index 7ab6e9c58..413769ac1 100644 --- a/sys/dev/ic/gdtreg.h +++ b/sys/dev/ic/gdtreg.h @@ -84,7 +84,7 @@ #define GDT_RELEASE_ALL 17 /* release all devices */ #define GDT_RESET_BUS 18 /* reset bus */ #define GDT_SCAN_START 19 /* start device scan */ -#define GDT_SCAN_END 20 /* stop device scan */ +#define GDT_SCAN_END 20 /* stop device scan */ /* IOCTL command defines */ #define GDT_SCSI_DR_INFO 0x00 /* SCSI drive info */ diff --git a/sys/dev/ic/gdtvar.h b/sys/dev/ic/gdtvar.h index fce26c7c9..2a7e7c778 100644 --- a/sys/dev/ic/gdtvar.h +++ b/sys/dev/ic/gdtvar.h @@ -82,7 +82,7 @@ struct gdt_ccb { u_int8_t gc_cmd_index; u_int8_t gc_flags; #define GDT_GCF_CMD_MASK 0x3 -#define GDT_GCF_UNUSED 0 +#define GDT_GCF_UNUSED 0 #define GDT_GCF_INTERNAL 1 #define GDT_GCF_SCREEN 2 #define GDT_GCF_SCSI 3 diff --git a/sys/dev/ic/gemreg.h b/sys/dev/ic/gemreg.h index a95bdd84e..7578b9bf9 100644 --- a/sys/dev/ic/gemreg.h +++ b/sys/dev/ic/gemreg.h @@ -441,7 +441,7 @@ #define GEM_MII_SLINK_STATUS 0x905c /* serial link status */ /* GEM_MII_CONTROL bits */ -/* +/* * DO NOT TOUCH THIS REGISTER ON ERI -- IT HARD HANGS. */ #define GEM_MII_CONTROL_RESET 0x00008000 diff --git a/sys/dev/ic/hme.c b/sys/dev/ic/hme.c index 732d33eed..1d189fdb2 100644 --- a/sys/dev/ic/hme.c +++ b/sys/dev/ic/hme.c @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include #include @@ -220,7 +220,7 @@ hme_config(struct hme_softc *sc) /* Initialize ifmedia structures and MII info */ mii->mii_ifp = ifp; - mii->mii_readreg = hme_mii_readreg; + mii->mii_readreg = hme_mii_readreg; mii->mii_writereg = hme_mii_writereg; mii->mii_statchg = hme_mii_statchg; @@ -533,7 +533,7 @@ hme_init(struct hme_softc *sc) /* * Init seed for backoff * (source suggested by manual: low 10 bits of MAC address) - */ + */ v = ((ea[4] << 8) | ea[5]) & 0x3fff; bus_space_write_4(t, mac, HME_MACI_RANDSEED, v); @@ -980,7 +980,7 @@ hme_mii_readreg(struct device *self, int phy, int reg) v |= HME_MIF_CFG_PHY; bus_space_write_4(t, mif, HME_MIFI_CFG, v); - /* Enable MII drivers on external transceiver */ + /* Enable MII drivers on external transceiver */ v = xif_cfg = bus_space_read_4(t, mac, HME_MACI_XIF); if (phy == HME_PHYAD_EXTERNAL) v |= HME_MAC_XIF_MIIENABLE; @@ -1037,7 +1037,7 @@ hme_mii_writereg(struct device *self, int phy, int reg, int val) v |= HME_MIF_CFG_PHY; bus_space_write_4(t, mif, HME_MIFI_CFG, v); - /* Enable MII drivers on external transceiver */ + /* Enable MII drivers on external transceiver */ v = xif_cfg = bus_space_read_4(t, mac, HME_MACI_XIF); if (phy == HME_PHYAD_EXTERNAL) v |= HME_MAC_XIF_MIIENABLE; @@ -1233,7 +1233,7 @@ hme_iff(struct hme_softc *sc) ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { crc = ether_crc32_le(enm->enm_addrlo, - ETHER_ADDR_LEN) >> 26; + ETHER_ADDR_LEN) >> 26; /* Set the corresponding bit in the filter. */ hash[crc >> 4] |= 1 << (crc & 0xf); diff --git a/sys/dev/ic/i82365.c b/sys/dev/ic/i82365.c index 285b3ea62..6921a33eb 100644 --- a/sys/dev/ic/i82365.c +++ b/sys/dev/ic/i82365.c @@ -465,7 +465,7 @@ pcic_event_process(struct pcic_handle *h, struct pcic_event *pe) } } splx(s); - + DPRINTF(("%s: insertion event\n", h->ph_parent->dv_xname)); pcic_attach_card(h); break; @@ -824,7 +824,7 @@ pcic_power(int why, void *arg) } } -int +int pcic_chip_mem_alloc(pcmcia_chipset_handle_t pch, bus_size_t size, struct pcmcia_mem_handle *pcmhp) { @@ -862,7 +862,7 @@ pcic_chip_mem_alloc(pcmcia_chipset_handle_t pch, bus_size_t size, pcmhp->size = size; pcmhp->mhandle = mhandle; pcmhp->realsize = sizepg * PCIC_MEM_PAGESIZE; - + DPRINTF(("pcic_chip_mem_alloc bus addr 0x%lx+0x%lx\n", (u_long) addr, (u_long) size)); @@ -873,7 +873,7 @@ pcic_chip_mem_alloc(pcmcia_chipset_handle_t pch, bus_size_t size, return (1); } -void +void pcic_chip_mem_free(pcmcia_chipset_handle_t pch, struct pcmcia_mem_handle *pcmhp) { struct pcic_handle *h = (struct pcic_handle *) pch; @@ -938,7 +938,7 @@ static struct mem_map_index_st { }, }; -void +void pcic_chip_do_mem_map(struct pcic_handle *h, int win) { int reg; @@ -992,7 +992,7 @@ pcic_chip_do_mem_map(struct pcic_handle *h, int win) #endif } -int +int pcic_chip_mem_map(pcmcia_chipset_handle_t pch, int kind, bus_addr_t card_addr, bus_size_t size, struct pcmcia_mem_handle *pcmhp, bus_size_t *offsetp, int *windowp) @@ -1057,7 +1057,7 @@ pcic_chip_mem_map(pcmcia_chipset_handle_t pch, int kind, bus_addr_t card_addr, return (0); } -void +void pcic_chip_mem_unmap(pcmcia_chipset_handle_t pch, int window) { struct pcic_handle *h = (struct pcic_handle *) pch; @@ -1073,7 +1073,7 @@ pcic_chip_mem_unmap(pcmcia_chipset_handle_t pch, int window) h->memalloc &= ~(1 << window); } -int +int pcic_chip_io_alloc(pcmcia_chipset_handle_t pch, bus_addr_t start, bus_size_t size, bus_size_t align, struct pcmcia_io_handle *pcihp) { @@ -1158,7 +1158,7 @@ pcic_chip_io_alloc(pcmcia_chipset_handle_t pch, bus_addr_t start, return (0); } -void +void pcic_chip_io_free(pcmcia_chipset_handle_t pch, struct pcmcia_io_handle *pcihp) { bus_space_tag_t iot = pcihp->iot; @@ -1215,7 +1215,7 @@ static struct io_map_index_st { }, }; -void +void pcic_chip_do_io_map(struct pcic_handle *h, int win) { int reg; @@ -1243,7 +1243,7 @@ pcic_chip_do_io_map(struct pcic_handle *h, int win) pcic_write(h, PCIC_ADDRWIN_ENABLE, reg); } -int +int pcic_chip_io_map(pcmcia_chipset_handle_t pch, int width, bus_addr_t offset, bus_size_t size, struct pcmcia_io_handle *pcihp, int *windowp) { @@ -1288,7 +1288,7 @@ pcic_chip_io_map(pcmcia_chipset_handle_t pch, int width, bus_addr_t offset, return (0); } -void +void pcic_chip_io_unmap(pcmcia_chipset_handle_t pch, int window) { struct pcic_handle *h = (struct pcic_handle *) pch; @@ -1337,7 +1337,7 @@ pcic_chip_socket_enable(pcmcia_chipset_handle_t pch) pcic_write(h, PCIC_PWRCTL, 0); - /* + /* * wait 300ms until power fails (Tpf). Then, wait 100ms since * we are changing Vcc (Toff). */ diff --git a/sys/dev/ic/i8237reg.h b/sys/dev/ic/i8237reg.h index f8cc83307..4dd182d83 100644 --- a/sys/dev/ic/i8237reg.h +++ b/sys/dev/ic/i8237reg.h @@ -11,6 +11,6 @@ #define DMA37MD_LOOP 0x10 /* auto-initialize mode */ #define DMA37MD_SINGLE 0x40 /* single pass mode */ #define DMA37MD_CASCADE 0xc0 /* cascade mode */ - + #define DMA37SM_CLEAR 0x00 /* clear mask bit */ #define DMA37SM_SET 0x04 /* set mask bit */ diff --git a/sys/dev/ic/i82596reg.h b/sys/dev/ic/i82596reg.h index 93eb7d2e2..7433cc183 100644 --- a/sys/dev/ic/i82596reg.h +++ b/sys/dev/ic/i82596reg.h @@ -270,7 +270,7 @@ struct __ie_recv_buf_desc { * All commands share this in common. *- struct __ie_cmd_common { - u_int16_t ie_cmd_status; // status of this command + u_int16_t ie_cmd_status; // status of this command u_int16_t ie_cmd_cmd; // command word u_int16_t ie_cmd_link; // link to next command } __packed; diff --git a/sys/dev/ic/i82596var.h b/sys/dev/ic/i82596var.h index eb5933a16..334ac0f5d 100644 --- a/sys/dev/ic/i82596var.h +++ b/sys/dev/ic/i82596var.h @@ -278,7 +278,7 @@ struct ie_softc { int i82596_intr(void *); int i82596_probe(struct ie_softc *); int i82596_proberam(struct ie_softc *); -void i82596_attach(struct ie_softc *, const char *, u_int8_t *, +void i82596_attach(struct ie_softc *, const char *, u_int8_t *, uint64_t *, int, uint64_t); int i82596_start_cmd(struct ie_softc *, int, int, int, int); diff --git a/sys/dev/ic/i82802reg.h b/sys/dev/ic/i82802reg.h index 2acb3b505..e8f681275 100644 --- a/sys/dev/ic/i82802reg.h +++ b/sys/dev/ic/i82802reg.h @@ -29,7 +29,7 @@ /* * Intel 82802AB/82802AC Firmware Hub * - * see: ftp://download.intel.com/design/chipsets/datashts/29065804.pdf + * see: ftp://download.intel.com/design/chipsets/datashts/29065804.pdf * and http://www.intel.com/Assets/PDF/manual/298029.pdf */ diff --git a/sys/dev/ic/ibm561.c b/sys/dev/ic/ibm561.c index 6581384aa..aceddbad2 100644 --- a/sys/dev/ic/ibm561.c +++ b/sys/dev/ic/ibm561.c @@ -80,7 +80,7 @@ struct ramdac_funcs ibm561_funcsstruct = { NULL, /* check_curcmap; not needed */ NULL, /* set_curcmap; not needed */ NULL, /* get_curcmap; not needed */ - ibm561_set_dotclock, + ibm561_set_dotclock, }; /* diff --git a/sys/dev/ic/if_wi.c b/sys/dev/ic/if_wi.c index dc6fbc39f..52227e21b 100644 --- a/sys/dev/ic/if_wi.c +++ b/sys/dev/ic/if_wi.c @@ -157,7 +157,7 @@ STATIC int wi_get_txpower(struct wi_softc *, struct ieee80211_txpower *); STATIC int wi_get_debug(struct wi_softc *, struct wi_req *); STATIC int wi_set_debug(struct wi_softc *, struct wi_req *); -STATIC void wi_do_hostencrypt(struct wi_softc *, caddr_t, int); +STATIC void wi_do_hostencrypt(struct wi_softc *, caddr_t, int); STATIC int wi_do_hostdecrypt(struct wi_softc *, caddr_t, int); STATIC int wi_alloc_nicmem_io(struct wi_softc *, int, int *); @@ -674,7 +674,7 @@ wi_rxeof(struct wi_softc *sc) "wi_status=0x%x)\n", sc->sc_dev.dv_xname, rxlen, letoh16(rx_frame.wi_status)); m_freem(m); - ifp->if_ierrors++; + ifp->if_ierrors++; return; } @@ -776,7 +776,7 @@ wi_rxeof(struct wi_softc *sc) if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG) printf(WI_PRT_FMT ": Error decrypting incoming packet.\n", WI_PRT_ARG(sc)); m_freem(m); - ifp->if_ierrors++; + ifp->if_ierrors++; return; } len -= IEEE80211_WEP_IVLEN + @@ -900,7 +900,7 @@ wi_update_stats(struct wi_softc *sc) if (sc->wi_flags & WI_FLAGS_BUS_USB) { wi_read_data(sc, id, 4 + i*2, (char *)&t, 2); t = letoh16(t); - } else + } else t = CSR_READ_2(sc, WI_DATA1); #ifdef WI_HERMES_STATS_WAR if (t > 0xF000) @@ -2046,7 +2046,7 @@ wi_scan_timeout(void *arg) WI_PRT_ARG(sc), sc->wi_scan_lock); /* Wakeup the userland */ - wakeup(&sc->wi_scan_lock); + wakeup(&sc->wi_scan_lock); sc->wi_scan_lock = 0; } @@ -2566,7 +2566,7 @@ wi_detach(struct wi_softc *sc) if (ifp->if_flags & IFF_RUNNING) wi_stop(sc); - + if (sc->wi_flags & WI_FLAGS_ATTACHED) { sc->wi_flags &= ~WI_FLAGS_ATTACHED; } @@ -2966,7 +2966,7 @@ wi_set_txpower(struct wi_softc *sc, struct ieee80211_txpower *txpower) sc->wi_flags |= WI_FLAGS_TXPOWER; sc->wi_txpower = txpower->i_val; } - } + } /* Set ALC */ cmd = WI_CMD_DEBUG | (WI_DEBUG_CONFBITS << 8); @@ -3035,7 +3035,7 @@ wi_get_txpower(struct wi_softc *sc, struct ieee80211_txpower *txpower) txpower->i_mode = IEEE80211_TXPOWER_MODE_FIXED; else txpower->i_mode = IEEE80211_TXPOWER_MODE_AUTO; - + return (0); } diff --git a/sys/dev/ic/if_wi_hostap.c b/sys/dev/ic/if_wi_hostap.c index 64e3c10f3..82a804b62 100644 --- a/sys/dev/ic/if_wi_hostap.c +++ b/sys/dev/ic/if_wi_hostap.c @@ -640,7 +640,7 @@ wihap_auth_req(struct wi_softc *sc, struct wi_frame *rxfrm, for (i = 0; i < 32; i++) challenge[i] = sta->challenge[i] = arc4random(); - + if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG) printf("\tchallenge: 0x%x 0x%x ...\n", challenge[0], challenge[1]); diff --git a/sys/dev/ic/if_wi_ieee.h b/sys/dev/ic/if_wi_ieee.h index 37a0ab828..3b7ca0e75 100644 --- a/sys/dev/ic/if_wi_ieee.h +++ b/sys/dev/ic/if_wi_ieee.h @@ -355,7 +355,7 @@ struct wi_apinfo { int quality; /* Quality */ int namelen; /* Length of SSID string */ char name[32]; /* SSID string */ - int capinfo; /* Capability info. */ + int capinfo; /* Capability info. */ int interval; /* BSS Beacon Interval */ int rate; /* Data Rate */ }; diff --git a/sys/dev/ic/iosf.c b/sys/dev/ic/iosf.c index 16f4a4018..086b8f487 100644 --- a/sys/dev/ic/iosf.c +++ b/sys/dev/ic/iosf.c @@ -157,7 +157,7 @@ iosf_mbi_mdr_modify(struct iosf_mbi *mbi, uint8_t port, uint8_t op, mdr = (*mbi->mbi_mdr_rd)(mbi, mcr, mcrx); CLR(mdr, mask); - SET(mdr, bits & mask); + SET(mdr, bits & mask); (*mbi->mbi_mdr_wr)(mbi, mcr, mcrx, mdr); mtx_leave(&iosf_mbi_mtx); diff --git a/sys/dev/ic/lemac.c b/sys/dev/ic/lemac.c index 0bd9a4ef7..5406ca4b6 100644 --- a/sys/dev/ic/lemac.c +++ b/sys/dev/ic/lemac.c @@ -349,17 +349,17 @@ lemac_read_macaddr(unsigned char *hwaddr, const bus_space_tag_t iot, { int cksum, rom_cksum; unsigned char addrbuf[6]; - + if (!skippat) { int idx, idx2, found, octet; static u_char testpat[] = { 0xFF, 0, 0x55, 0xAA, 0xFF, 0, 0x55, 0xAA }; idx2 = found = 0; - + for (idx = 0; idx < 32; idx++) { octet = bus_space_read_1(iot, ioh, ioreg); - + if (octet == testpat[idx2]) { if (++idx2 == sizeof(testpat)) { ++found; @@ -423,7 +423,7 @@ lemac_read_macaddr(unsigned char *hwaddr, const bus_space_tag_t iot, rom_cksum = bus_space_read_1(iot, ioh, ioreg); rom_cksum |= bus_space_read_1(iot, ioh, ioreg) << 8; - + if (cksum != rom_cksum) return (-1); return (0); @@ -489,7 +489,7 @@ lemac_multicast_filter(struct lemac_softc *sc) sc->sc_if.if_flags &= ~IFF_ALLMULTI; } -/* +/* * Do a hard reset of the board; */ void @@ -512,7 +512,7 @@ lemac_reset(struct lemac_softc *const sc) * is important because functions hereafter may rely on information * read from the EEPROM. */ - if ((data = lemac_read_eeprom(sc)) != LEMAC_EEP_CKSUM) { + if ((data = lemac_read_eeprom(sc)) != LEMAC_EEP_CKSUM) { printf("%s: reset: EEPROM checksum failed (0x%x)\n", sc->sc_if.if_xname, data); return; @@ -621,7 +621,7 @@ lemac_init(struct lemac_softc *const sc) } } -void +void lemac_ifstart(struct ifnet *ifp) { struct lemac_softc *const sc = LEMAC_IFP_TO_SOFTC(ifp); @@ -976,7 +976,7 @@ lemac_ifattach(struct lemac_softc *sc) lemac_read_macaddr(sc->sc_arpcom.ac_enaddr, sc->sc_iot, sc->sc_ioh, LEMAC_REG_APD, 0); - + printf(": %s\n", sc->sc_prodname); printf("%s: address %s, %dKB RAM, %s\n", ifp->if_xname, diff --git a/sys/dev/ic/lemacreg.h b/sys/dev/ic/lemacreg.h index c96a02efc..1a3ad736f 100644 --- a/sys/dev/ic/lemacreg.h +++ b/sys/dev/ic/lemacreg.h @@ -133,7 +133,7 @@ /* Transmit Done Queue Status Definitions */ -#define LEMAC_TDQ_COL 0x03 /* Collision Mask */ +#define LEMAC_TDQ_COL 0x03 /* Collision Mask */ #define LEMAC_TDQ_NOCOL 0x00 /* No Collisions */ #define LEMAC_TDQ_ONECOL 0x01 /* One Collision */ #define LEMAC_TDQ_MULCOL 0x02 /* Multiple Collisions */ diff --git a/sys/dev/ic/lm78.c b/sys/dev/ic/lm78.c index e60f38577..39cc169b6 100644 --- a/sys/dev/ic/lm78.c +++ b/sys/dev/ic/lm78.c @@ -159,8 +159,8 @@ const struct lm_sensor w83627ehf_sensors[] = { { NULL } }; -/* - * w83627dhg is almost identical to w83627ehf, except that +/* + * w83627dhg is almost identical to w83627ehf, except that * it has 9 instead of 10 voltage sensors */ const struct lm_sensor w83627dhg_sensors[] = { @@ -859,7 +859,7 @@ wb_refresh_fanrpm(struct lm_softc *sc, int n) struct ksensor *sensor = &sc->sensors[n]; int fan, data, divisor = 0; - /* + /* * This is madness; the fan divisor bits are scattered all * over the place. */ diff --git a/sys/dev/ic/lm78var.h b/sys/dev/ic/lm78var.h index c3e1b84e0..49d310e11 100644 --- a/sys/dev/ic/lm78var.h +++ b/sys/dev/ic/lm78var.h @@ -26,7 +26,7 @@ #define LM_FAN2 0x29 /* FAN2 reading */ #define LM_FAN3 0x2a /* FAN3 reading */ -#define LM_CONFIG 0x40 /* Configuration */ +#define LM_CONFIG 0x40 /* Configuration */ #define LM_ISR1 0x41 /* Interrupt Status 1 */ #define LM_ISR2 0x42 /* Interrupt Status 2 */ #define LM_SMI1 0x43 /* SMI# Mask 1 */ diff --git a/sys/dev/ic/lpt.c b/sys/dev/ic/lpt.c index ca3c0dfd0..00999ed83 100644 --- a/sys/dev/ic/lpt.c +++ b/sys/dev/ic/lpt.c @@ -16,25 +16,25 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This software is a component of "386BSD" developed by + * This software is a component of "386BSD" developed by * William F. Jolitz, TeleMuse. * 4. Neither the name of the developer nor the name "386BSD" * may be used to endorse or promote products derived from this software * without specific prior written permission. * - * THIS SOFTWARE IS A COMPONENT OF 386BSD DEVELOPED BY WILLIAM F. JOLITZ - * AND IS INTENDED FOR RESEARCH AND EDUCATIONAL PURPOSES ONLY. THIS - * SOFTWARE SHOULD NOT BE CONSIDERED TO BE A COMMERCIAL PRODUCT. - * THE DEVELOPER URGES THAT USERS WHO REQUIRE A COMMERCIAL PRODUCT + * THIS SOFTWARE IS A COMPONENT OF 386BSD DEVELOPED BY WILLIAM F. JOLITZ + * AND IS INTENDED FOR RESEARCH AND EDUCATIONAL PURPOSES ONLY. THIS + * SOFTWARE SHOULD NOT BE CONSIDERED TO BE A COMMERCIAL PRODUCT. + * THE DEVELOPER URGES THAT USERS WHO REQUIRE A COMMERCIAL PRODUCT * NOT MAKE USE OF THIS WORK. * * FOR USERS WHO WISH TO UNDERSTAND THE 386BSD SYSTEM DEVELOPED - * BY WILLIAM F. JOLITZ, WE RECOMMEND THE USER STUDY WRITTEN - * REFERENCES SUCH AS THE "PORTING UNIX TO THE 386" SERIES - * (BEGINNING JANUARY 1991 "DR. DOBBS JOURNAL", USA AND BEGINNING - * JUNE 1991 "UNIX MAGAZIN", GERMANY) BY WILLIAM F. JOLITZ AND - * LYNNE GREER JOLITZ, AS WELL AS OTHER BOOKS ON UNIX AND THE - * ON-LINE 386BSD USER MANUAL BEFORE USE. A BOOK DISCUSSING THE INTERNALS + * BY WILLIAM F. JOLITZ, WE RECOMMEND THE USER STUDY WRITTEN + * REFERENCES SUCH AS THE "PORTING UNIX TO THE 386" SERIES + * (BEGINNING JANUARY 1991 "DR. DOBBS JOURNAL", USA AND BEGINNING + * JUNE 1991 "UNIX MAGAZIN", GERMANY) BY WILLIAM F. JOLITZ AND + * LYNNE GREER JOLITZ, AS WELL AS OTHER BOOKS ON UNIX AND THE + * ON-LINE 386BSD USER MANUAL BEFORE USE. A BOOK DISCUSSING THE INTERNALS * OF 386BSD ENTITLED "386BSD FROM THE INSIDE OUT" WILL BE AVAILABLE LATE 1992. * * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND @@ -358,7 +358,7 @@ lptpushbytes(struct lpt_softc *sc) return 0; } -/* +/* * Copy a line from user space to a local buffer, then call putc to get the * chars moved to the output queue. */ @@ -448,7 +448,7 @@ lpt_activate(struct device *self, int act) lpt_control, LPC_SELECT); delay(100); } - + bus_space_write_1(sc->sc_iot, sc->sc_ioh, lpt_control, LPC_SELECT | LPC_NINIT); @@ -470,6 +470,6 @@ lpt_activate(struct device *self, int act) fail: break; } - + return (0); } diff --git a/sys/dev/ic/lptvar.h b/sys/dev/ic/lptvar.h index 98a52d2ea..dc4df36c2 100644 --- a/sys/dev/ic/lptvar.h +++ b/sys/dev/ic/lptvar.h @@ -16,25 +16,25 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This software is a component of "386BSD" developed by + * This software is a component of "386BSD" developed by * William F. Jolitz, TeleMuse. * 4. Neither the name of the developer nor the name "386BSD" * may be used to endorse or promote products derived from this software * without specific prior written permission. * - * THIS SOFTWARE IS A COMPONENT OF 386BSD DEVELOPED BY WILLIAM F. JOLITZ - * AND IS INTENDED FOR RESEARCH AND EDUCATIONAL PURPOSES ONLY. THIS - * SOFTWARE SHOULD NOT BE CONSIDERED TO BE A COMMERCIAL PRODUCT. - * THE DEVELOPER URGES THAT USERS WHO REQUIRE A COMMERCIAL PRODUCT + * THIS SOFTWARE IS A COMPONENT OF 386BSD DEVELOPED BY WILLIAM F. JOLITZ + * AND IS INTENDED FOR RESEARCH AND EDUCATIONAL PURPOSES ONLY. THIS + * SOFTWARE SHOULD NOT BE CONSIDERED TO BE A COMMERCIAL PRODUCT. + * THE DEVELOPER URGES THAT USERS WHO REQUIRE A COMMERCIAL PRODUCT * NOT MAKE USE OF THIS WORK. * * FOR USERS WHO WISH TO UNDERSTAND THE 386BSD SYSTEM DEVELOPED - * BY WILLIAM F. JOLITZ, WE RECOMMEND THE USER STUDY WRITTEN - * REFERENCES SUCH AS THE "PORTING UNIX TO THE 386" SERIES - * (BEGINNING JANUARY 1991 "DR. DOBBS JOURNAL", USA AND BEGINNING - * JUNE 1991 "UNIX MAGAZIN", GERMANY) BY WILLIAM F. JOLITZ AND - * LYNNE GREER JOLITZ, AS WELL AS OTHER BOOKS ON UNIX AND THE - * ON-LINE 386BSD USER MANUAL BEFORE USE. A BOOK DISCUSSING THE INTERNALS + * BY WILLIAM F. JOLITZ, WE RECOMMEND THE USER STUDY WRITTEN + * REFERENCES SUCH AS THE "PORTING UNIX TO THE 386" SERIES + * (BEGINNING JANUARY 1991 "DR. DOBBS JOURNAL", USA AND BEGINNING + * JUNE 1991 "UNIX MAGAZIN", GERMANY) BY WILLIAM F. JOLITZ AND + * LYNNE GREER JOLITZ, AS WELL AS OTHER BOOKS ON UNIX AND THE + * ON-LINE 386BSD USER MANUAL BEFORE USE. A BOOK DISCUSSING THE INTERNALS * OF 386BSD ENTITLED "386BSD FROM THE INSIDE OUT" WILL BE AVAILABLE LATE 1992. * * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND diff --git a/sys/dev/ic/lsi64854.c b/sys/dev/ic/lsi64854.c index 069e37219..e107d1453 100644 --- a/sys/dev/ic/lsi64854.c +++ b/sys/dev/ic/lsi64854.c @@ -307,7 +307,7 @@ lsi64854_setup(struct lsi64854_softc *sc, caddr_t *addr, size_t *len, DPRINTF(LDB_ANY, ("dma_setup: dmasize = %ld\n", (long)sc->sc_dmasize)); /* - * XXX what length? + * XXX what length? */ if (sc->sc_rev == DMAREV_HME) { @@ -322,7 +322,7 @@ lsi64854_setup(struct lsi64854_softc *sc, caddr_t *addr, size_t *len, sc->sc_dvmaaddr = *sc->sc_dmaaddr; if (bus_dmamap_load(sc->sc_dmatag, sc->sc_dmamap, *sc->sc_dmaaddr, sc->sc_dmasize, - NULL /* kernel address */, + NULL /* kernel address */, BUS_DMA_NOWAIT | BUS_DMA_STREAMING)) panic("%s: cannot allocate DVMA address", sc->sc_dev.dv_xname); @@ -563,7 +563,7 @@ lsi64854_setup_pp(struct lsi64854_softc *sc, caddr_t *addr, size_t *len, sc->sc_dvmaaddr = *sc->sc_dmaaddr; if (bus_dmamap_load(sc->sc_dmatag, sc->sc_dmamap, *sc->sc_dmaaddr, sc->sc_dmasize, - NULL /* kernel address */, + NULL /* kernel address */, BUS_DMA_NOWAIT/*|BUS_DMA_COHERENT*/)) panic("%s: pp cannot allocate DVMA address", sc->sc_dev.dv_xname); diff --git a/sys/dev/ic/malo.c b/sys/dev/ic/malo.c index ef922c006..f87694b6e 100644 --- a/sys/dev/ic/malo.c +++ b/sys/dev/ic/malo.c @@ -1922,7 +1922,7 @@ malo_hexdump(void *buf, int len) printf("%4i:", i); l = min(sizeof(b), len - i); bcopy(buf + i, b, l); - + for (j = 0; j < sizeof(b); j++) { if (j % 2 == 0) printf(" "); diff --git a/sys/dev/ic/max2820reg.h b/sys/dev/ic/max2820reg.h index bb1d7f23e..4e8718a2d 100644 --- a/sys/dev/ic/max2820reg.h +++ b/sys/dev/ic/max2820reg.h @@ -163,7 +163,7 @@ #define MAX2820_RECEIVE_1C_DEFAULT LSHIFT(7, MAX2820_RECEIVE_1C_MASK) #define MAX2820_RECEIVE_DL_DEFAULT LSHIFT(1, MAX2820_RECEIVE_DL_MASK) #define MAX2820_RECEIVE_SF_DEFAULT LSHIFT(0, MAX2820_RECEIVE_SF) -#define MAX2820_RECEIVE_BW_DEFAULT MAX2820_RECEIVE_BW_7_5MHZ +#define MAX2820_RECEIVE_BW_DEFAULT MAX2820_RECEIVE_BW_7_5MHZ #define MAX2820A_RECEIVE 4 /* Receiver Settings Register, * MAX2820A/MAX2821A @@ -172,7 +172,7 @@ #define MAX2820A_RECEIVE_2C_MASK 0xe00 #define MAX2820A_RECEIVE_2C_DEFAULT LSHIFT(7, MAX2820A_RECEIVE_2C_MASK) /* VGA DC Offset Nulling Parameter 1 */ -#define MAX2820A_RECEIVE_1C_MASK 0x1c0 +#define MAX2820A_RECEIVE_1C_MASK 0x1c0 #define MAX2820A_RECEIVE_1C_DEFAULT LSHIFT(7, MAX2820A_RECEIVE_1C_MASK) #define MAX2820A_RECEIVE_RSVD0_MASK 0x38 #define MAX2820A_RECEIVE_RSVD0_DEFAULT LSHIFT(2, MAX2820A_RECEIVE_RSVD0_MASK) diff --git a/sys/dev/ic/mc146818reg.h b/sys/dev/ic/mc146818reg.h index 517af982e..253b95ce1 100644 --- a/sys/dev/ic/mc146818reg.h +++ b/sys/dev/ic/mc146818reg.h @@ -4,17 +4,17 @@ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. - * + * * Permission to use, copy, modify and distribute this software and * its documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU diff --git a/sys/dev/ic/mc6845.h b/sys/dev/ic/mc6845.h index 34ab71078..632d922e5 100644 --- a/sys/dev/ic/mc6845.h +++ b/sys/dev/ic/mc6845.h @@ -20,8 +20,8 @@ * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL diff --git a/sys/dev/ic/mpi.c b/sys/dev/ic/mpi.c index a8ef8fa3b..8b85d2af6 100644 --- a/sys/dev/ic/mpi.c +++ b/sys/dev/ic/mpi.c @@ -1358,7 +1358,7 @@ mpi_scsi_cmd(struct scsi_xfer *xs) if (sc->sc_porttype != MPI_PORTFACTS_PORTTYPE_SCSI && (link->quirks & SDEV_NOTAGS)) io->tagging = MPI_SCSIIO_ATTR_UNTAGGED; - else + else io->tagging = MPI_SCSIIO_ATTR_SIMPLE_Q; memcpy(io->cdb, &xs->cmd, xs->cmdlen); diff --git a/sys/dev/ic/mtd8xx.c b/sys/dev/ic/mtd8xx.c index 2b58cd054..68989be1f 100644 --- a/sys/dev/ic/mtd8xx.c +++ b/sys/dev/ic/mtd8xx.c @@ -908,7 +908,7 @@ mtd_rxeof(struct mtd_softc *sc) } } - /* No errors; receive the packet. */ + /* No errors; receive the packet. */ total_len -= ETHER_CRC_LEN; bus_dmamap_sync(sc->sc_dmat, sc->mtd_cdata.mtd_rx_chain[i].sd_map, diff --git a/sys/dev/ic/ncr53c9xreg.h b/sys/dev/ic/ncr53c9xreg.h index e889999db..47f9935f7 100644 --- a/sys/dev/ic/ncr53c9xreg.h +++ b/sys/dev/ic/ncr53c9xreg.h @@ -196,7 +196,7 @@ /* The following registers are only on the ESP406/FAS408. The documentation refers to them as "Control Register Set #1". - These are the registers that are visible when bit 7 of + These are the registers that are visible when bit 7 of register 0x0d is set. This bit is common to both register sets. */ diff --git a/sys/dev/ic/nvmereg.h b/sys/dev/ic/nvmereg.h index 1c7311544..180dbbf7e 100644 --- a/sys/dev/ic/nvmereg.h +++ b/sys/dev/ic/nvmereg.h @@ -238,8 +238,8 @@ struct nvme_cqe { #define NVM_ADMIN_DEL_IOSQ 0x00 /* Delete I/O Submission Queue */ #define NVM_ADMIN_ADD_IOSQ 0x01 /* Create I/O Submission Queue */ #define NVM_ADMIN_GET_LOG_PG 0x02 /* Get Log Page */ -#define NVM_ADMIN_DEL_IOCQ 0x04 /* Delete I/O Completion Queue */ -#define NVM_ADMIN_ADD_IOCQ 0x05 /* Create I/O Completion Queue */ +#define NVM_ADMIN_DEL_IOCQ 0x04 /* Delete I/O Completion Queue */ +#define NVM_ADMIN_ADD_IOCQ 0x05 /* Create I/O Completion Queue */ #define NVM_ADMIN_IDENTIFY 0x06 /* Identify */ #define NVM_ADMIN_ABORT 0x08 /* Abort */ #define NVM_ADMIN_SET_FEATURES 0x09 /* Set Features */ diff --git a/sys/dev/ic/osiopvar.h b/sys/dev/ic/osiopvar.h index f77670221..e5f53d5b5 100644 --- a/sys/dev/ic/osiopvar.h +++ b/sys/dev/ic/osiopvar.h @@ -69,8 +69,8 @@ #define osiop_read_4(sc, reg) \ bus_space_read_4((sc)->sc_bst, (sc)->sc_reg, reg) #define osiop_write_4(sc, reg, val) \ - bus_space_write_4((sc)->sc_bst, (sc)->sc_reg, reg, val) - + bus_space_write_4((sc)->sc_bst, (sc)->sc_reg, reg, val) + /* * The largest single request will be MAXPHYS bytes which will require * at most MAXPHYS/NBPG+1 chain elements to describe, i.e. if none of diff --git a/sys/dev/ic/p9000.h b/sys/dev/ic/p9000.h index d1ee87fd8..a20999830 100644 --- a/sys/dev/ic/p9000.h +++ b/sys/dev/ic/p9000.h @@ -161,7 +161,7 @@ /* * Parameter engine - */ + */ /* Status register */ #define P9000_PE_STATUS 0x00000000 diff --git a/sys/dev/ic/pcdisplay_subr.c b/sys/dev/ic/pcdisplay_subr.c index e8bdd13b6..c7a1608f4 100644 --- a/sys/dev/ic/pcdisplay_subr.c +++ b/sys/dev/ic/pcdisplay_subr.c @@ -6,17 +6,17 @@ * All rights reserved. * * Author: Chris G. Demetriou - * + * * Permission to use, copy, modify and distribute this software and * its documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU @@ -99,7 +99,7 @@ pcdisplay_cursor(void *id, int on, int row, int col) else scr->mem[off] = scr->cursortmp; } - + scr->vc_crow = row; scr->vc_ccol = col; @@ -175,13 +175,13 @@ pcdisplay_getchar(void *id, int row, int col, struct wsdisplay_charcell *cell) int off; int s; u_int16_t data; - + off = row * scr->type->ncols + col; /* XXX bounds check? */ - + s = spltty(); if (scr->active) - data = (bus_space_read_2(memt, memh, + data = (bus_space_read_2(memt, memh, scr->dispoffset + off * 2)); else data = (scr->mem[off]); diff --git a/sys/dev/ic/pckbcvar.h b/sys/dev/ic/pckbcvar.h index bc254bcf7..4b8ec57bd 100644 --- a/sys/dev/ic/pckbcvar.h +++ b/sys/dev/ic/pckbcvar.h @@ -45,7 +45,7 @@ typedef int pckbc_slot_t; * external representation (pckbc_tag_t), * needed early for console operation */ -struct pckbc_internal { +struct pckbc_internal { bus_space_tag_t t_iot; bus_space_handle_t t_ioh_d, t_ioh_c; /* data port, cmd port */ bus_addr_t t_addr; diff --git a/sys/dev/ic/pgt.c b/sys/dev/ic/pgt.c index 0888a2e89..83f229611 100644 --- a/sys/dev/ic/pgt.c +++ b/sys/dev/ic/pgt.c @@ -358,7 +358,7 @@ pgt_load_firmware(struct pgt_softc *sc) DELAY(PGT_WRITEIO_DELAY); free(ucode, M_DEVBUF, 0); - + return (0); } @@ -449,7 +449,7 @@ pgt_reset(struct pgt_softc *sc) DELAY(PGT_WRITEIO_DELAY); /* await only the initialization interrupt */ - pgt_write_4_flush(sc, PGT_REG_INT_EN, PGT_INT_STAT_INIT); + pgt_write_4_flush(sc, PGT_REG_INT_EN, PGT_INT_STAT_INIT); DELAY(PGT_WRITEIO_DELAY); return (0); @@ -531,7 +531,7 @@ trying_again: } else { /* await all interrupts */ pgt_write_4_flush(sc, PGT_REG_INT_EN, - PGT_INT_STAT_SOURCES); + PGT_INT_STAT_SOURCES); DELAY(PGT_WRITEIO_DELAY); ic->ic_if.if_flags |= IFF_RUNNING; } @@ -678,8 +678,8 @@ pgt_update_intr(struct pgt_softc *sc, int hack) { /* priority order */ enum pgt_queue pqs[PGT_QUEUE_COUNT] = { - PGT_QUEUE_MGMT_TX, PGT_QUEUE_MGMT_RX, - PGT_QUEUE_DATA_HIGH_TX, PGT_QUEUE_DATA_HIGH_RX, + PGT_QUEUE_MGMT_TX, PGT_QUEUE_MGMT_RX, + PGT_QUEUE_DATA_HIGH_TX, PGT_QUEUE_DATA_HIGH_RX, PGT_QUEUE_DATA_LOW_TX, PGT_QUEUE_DATA_LOW_RX }; struct mbuf *m; @@ -756,7 +756,7 @@ pgt_update_intr(struct pgt_softc *sc, int hack) /* * This is the deferred completion for received management frames - * and where we queue network frames for stack input. + * and where we queue network frames for stack input. */ dirtycount = sc->sc_dirtyq_count[PGT_QUEUE_MGMT_RX]; while (!TAILQ_EMPTY(&sc->sc_dirtyq[PGT_QUEUE_MGMT_RX])) { diff --git a/sys/dev/ic/pgtreg.h b/sys/dev/ic/pgtreg.h index bc78e0f18..000d3ecea 100644 --- a/sys/dev/ic/pgtreg.h +++ b/sys/dev/ic/pgtreg.h @@ -90,7 +90,7 @@ * set of indices that gives the index (modulo queue size) of the current * progress in each. Nearly all configuration is done from the management * queue interface. Almost every structure is little-endian. - */ + */ enum pgt_queue { PGT_QUEUE_DATA_LOW_RX = 0, PGT_QUEUE_DATA_LOW_TX = 1, diff --git a/sys/dev/ic/pgtvar.h b/sys/dev/ic/pgtvar.h index d20923afc..f531b8eb0 100644 --- a/sys/dev/ic/pgtvar.h +++ b/sys/dev/ic/pgtvar.h @@ -160,7 +160,7 @@ struct pgt_softc { #define SC_DEBUG_RXFRAG 0x00000200 #define SC_DEBUG_RXETHER 0x00000400 bus_space_tag_t sc_iotag; - bus_space_handle_t sc_iohandle; + bus_space_handle_t sc_iohandle; bus_dma_tag_t sc_dmat; bus_dmamap_t sc_cbdmam; diff --git a/sys/dev/ic/ramdac.h b/sys/dev/ic/ramdac.h index 456fb578e..0d9299989 100644 --- a/sys/dev/ic/ramdac.h +++ b/sys/dev/ic/ramdac.h @@ -42,7 +42,7 @@ struct ramdac_funcs { struct ramdac_cookie *(*ramdac_register)(void *, int (*)(void *, void (*)(void *)), void (*)(void *, u_int, u_int8_t), - u_int8_t (*)(void *, u_int)); + u_int8_t (*)(void *, u_int)); void (*ramdac_init)(struct ramdac_cookie *); int (*ramdac_set_cmap)(struct ramdac_cookie *, diff --git a/sys/dev/ic/rt2661.c b/sys/dev/ic/rt2661.c index 478fdcac9..aabaa8952 100644 --- a/sys/dev/ic/rt2661.c +++ b/sys/dev/ic/rt2661.c @@ -415,7 +415,7 @@ rt2661_wakeup(void *xsc) struct ifnet *ifp = &sc->sc_ic.ic_if; if (ifp->if_flags & IFF_UP) - rt2661_init(ifp); + rt2661_init(ifp); } int diff --git a/sys/dev/ic/rt2860.c b/sys/dev/ic/rt2860.c index 55b76f440..f4d1cfa14 100644 --- a/sys/dev/ic/rt2860.c +++ b/sys/dev/ic/rt2860.c @@ -2715,7 +2715,7 @@ rt5390_rf_wakeup(struct rt2860_softc *sc) { uint32_t tmp; uint8_t rf; - + rf = rt3090_rf_read(sc, 1); rf |= RT3070_RF_BLOCK | RT3070_PLL_PD | RT3070_RX0_PD | RT3070_TX0_PD; @@ -3670,7 +3670,7 @@ rt2860_init(struct ifnet *ifp) printf("%s: could not enable wlan\n", sc->sc_dev.dv_xname); rt2860_stop(ifp, 1); - return error; + return error; } } diff --git a/sys/dev/ic/rtl80x9reg.h b/sys/dev/ic/rtl80x9reg.h index b5f45afc8..031d8f526 100644 --- a/sys/dev/ic/rtl80x9reg.h +++ b/sys/dev/ic/rtl80x9reg.h @@ -56,7 +56,7 @@ */ #define NERTL_RTL3_EECR 0x01 /* EEPROM Command Register */ #define RTL3_EECR_EEM1 0x80 /* EEPROM Operating Mode */ -#define RTL3_EECR_EEM0 0x40 +#define RTL3_EECR_EEM0 0x40 /* 0 0 Normal operation */ /* 0 1 Auto-load */ /* 1 0 9346 programming */ diff --git a/sys/dev/ic/rtl81x9reg.h b/sys/dev/ic/rtl81x9reg.h index f8d1b1372..959cb2013 100644 --- a/sys/dev/ic/rtl81x9reg.h +++ b/sys/dev/ic/rtl81x9reg.h @@ -211,7 +211,7 @@ #define RL_HWREV_8168GU 0x50800000 #define RL_HWREV_8168H 0x54000000 #define RL_HWREV_8168FP 0x54800000 -#define RL_HWREV_8411B 0x5c800000 +#define RL_HWREV_8411B 0x5c800000 #define RL_HWREV_8139 0x60000000 #define RL_HWREV_8139A 0x70000000 #define RL_HWREV_8139AG 0x70800000 @@ -373,7 +373,7 @@ #define RL_9346_ADDR_LEN 6 /* 93C46 1K: 128x16 */ #define RL_9356_ADDR_LEN 8 /* 93C56 2K: 256x16 */ - + #define RL_9346_WRITE 0x5 #define RL_9346_READ 0x6 #define RL_9346_ERASE 0x7 @@ -495,7 +495,7 @@ #define RL_BUSFREQ_33MHZ 0x00 #define RL_BUSFREQ_66MHZ 0x01 - + #define RL_BUSWIDTH_32BITS 0x00 #define RL_BUSWIDTH_64BITS 0x08 @@ -519,7 +519,7 @@ /* C+ early transmit threshold */ -#define RL_EARLYTXTHRESH_CNT 0x003F /* byte count times 8 */ +#define RL_EARLYTXTHRESH_CNT 0x003F /* byte count times 8 */ /* * Gigabit PHY access register (8169 only) @@ -772,7 +772,7 @@ struct re_stats { #define RL_ADDR_LO(y) ((u_int64_t) (y) & 0xFFFFFFFF) #define RL_ADDR_HI(y) ((u_int64_t) (y) >> 32) -#define RL_JUMBO_FRAMELEN (9 * 1024) +#define RL_JUMBO_FRAMELEN (9 * 1024) #define RL_JUMBO_MTU_4K \ ((4 * 1024) - ETHER_HDR_LEN - ETHER_CRC_LEN - ETHER_VLAN_ENCAP_LEN) #define RL_JUMBO_MTU_6K \ diff --git a/sys/dev/ic/rtsx.c b/sys/dev/ic/rtsx.c index 900eadbb6..584e89261 100644 --- a/sys/dev/ic/rtsx.c +++ b/sys/dev/ic/rtsx.c @@ -31,7 +31,7 @@ #include #include -/* +/* * We use three DMA buffers: a command buffer, a data buffer, and a buffer for * ADMA transfer descriptors which describe scatter-gather (SG) I/O operations. * @@ -232,7 +232,7 @@ rtsx_attach(struct rtsx_softc *sc, bus_space_tag_t iot, /* Now handle cards discovered during attachment. */ if (ISSET(sc->flags, RTSX_F_CARD_PRESENT)) rtsx_card_insert(sc); - + return 0; unmap_adma: @@ -729,7 +729,7 @@ rtsx_read(struct rtsx_softc *sc, u_int16_t addr, u_int8_t *val) { int tries = 1024; u_int32_t reg; - + WRITE4(sc, RTSX_HAIMR, RTSX_HAIMR_BUSY | (u_int32_t)((addr & 0x3FFF) << 16)); @@ -783,10 +783,10 @@ rtsx_read_phy(struct rtsx_softc *sc, u_int8_t addr, u_int16_t *val) if (!(rwctl & RTSX_PHY_BUSY)) break; } - + if (timeout == 0) return ETIMEDOUT; - + RTSX_READ(sc, RTSX_PHY_DATA0, &data0); RTSX_READ(sc, RTSX_PHY_DATA1, &data1); *val = data0 | (data1 << 8); @@ -811,10 +811,10 @@ rtsx_write_phy(struct rtsx_softc *sc, u_int8_t addr, u_int16_t val) if (!(rwctl & RTSX_PHY_BUSY)) break; } - + if (timeout == 0) return ETIMEDOUT; - + return 0; } @@ -837,7 +837,7 @@ rtsx_read_cfg(struct rtsx_softc *sc, u_int8_t func, u_int16_t addr, if (tries == 0) return EIO; - + RTSX_READ(sc, RTSX_CFGDATA0, &data0); RTSX_READ(sc, RTSX_CFGDATA1, &data1); RTSX_READ(sc, RTSX_CFGDATA2, &data2); @@ -880,7 +880,7 @@ rtsx_write_cfg(struct rtsx_softc *sc, u_int8_t func, u_int16_t addr, if (tries == 0) return EIO; - + return 0; } #endif @@ -1050,7 +1050,7 @@ rtsx_xfer(struct rtsx_softc *sc, struct sdmmc_command *cmd, u_int32_t *cmdbuf) ncmd = 0; rtsx_hostcmd(cmdbuf, &ncmd, RTSX_WRITE_REG_CMD, RTSX_SD_CFG2, - 0xff, cfg2); + 0xff, cfg2); /* Queue commands to configure data transfer size. */ rtsx_hostcmd(cmdbuf, &ncmd, @@ -1262,7 +1262,7 @@ rtsx_exec_command(sdmmc_chipset_handle_t sch, struct sdmmc_command *cmd) /* Queue commands to set SD command index and argument. */ rtsx_hostcmd(cmdbuf, &ncmd, - RTSX_WRITE_REG_CMD, RTSX_SD_CMD0, 0xff, 0x40 | cmd->c_opcode); + RTSX_WRITE_REG_CMD, RTSX_SD_CMD0, 0xff, 0x40 | cmd->c_opcode); rtsx_hostcmd(cmdbuf, &ncmd, RTSX_WRITE_REG_CMD, RTSX_SD_CMD1, 0xff, cmd->c_arg >> 24); rtsx_hostcmd(cmdbuf, &ncmd, diff --git a/sys/dev/ic/rtsxreg.h b/sys/dev/ic/rtsxreg.h index b2f0576f8..fa55a2b0f 100644 --- a/sys/dev/ic/rtsxreg.h +++ b/sys/dev/ic/rtsxreg.h @@ -98,7 +98,7 @@ #define RTSX_CARD_DRIVE_SEL 0xFE53 /* Card clock. */ -#define RTSX_CARD_CLK_EN 0xFD69 +#define RTSX_CARD_CLK_EN 0xFD69 #define RTSX_XD_CLK_EN 0x02 #define RTSX_SD_CLK_EN 0x04 #define RTSX_MS_CLK_EN 0x08 @@ -303,14 +303,14 @@ #define RTSX_TM_AUTO_WRITE3 0x01 /* Like AUTO_WRITE3, plus automatically send CMD 12 when done. - * The response to CMD 12 is written to SD_CMD{0,1,2,3,4}. */ + * The response to CMD 12 is written to SD_CMD{0,1,2,3,4}. */ #define RTSX_TM_AUTO_WRITE4 0x02 /* Read (SD_BYTE_CNT * SD_BLOCK_CNT) bytes from card into ring buffer. */ #define RTSX_TM_AUTO_READ3 0x05 /* Like AUTO_READ3, plus automatically send CMD 12 when done. - * The response to CMD 12 is written to SD_CMD{0,1,2,3,4}. */ + * The response to CMD 12 is written to SD_CMD{0,1,2,3,4}. */ #define RTSX_TM_AUTO_READ4 0x06 /* Send an SD command described in SD_CMD{0,1,2,3,4} to the card and put @@ -320,7 +320,7 @@ /* Send write command, get response from the card, write data from ring * buffer to card, and send CMD 12 when done. - * The response to CMD 12 is written to SD_CMD{0,1,2,3,4}. */ + * The response to CMD 12 is written to SD_CMD{0,1,2,3,4}. */ #define RTSX_TM_AUTO_WRITE1 0x09 /* Like AUTO_WRITE1 except no CMD 12 is sent. */ diff --git a/sys/dev/ic/rtw.c b/sys/dev/ic/rtw.c index e875bb62b..8376c2f07 100644 --- a/sys/dev/ic/rtw.c +++ b/sys/dev/ic/rtw.c @@ -680,7 +680,7 @@ rtw_srom_read(struct rtw_regs *regs, u_int32_t flags, struct rtw_srom *sr, sd.sd_CS = RTW_9346CR_EECS; sd.sd_DI = RTW_9346CR_EEDO; sd.sd_DO = RTW_9346CR_EEDI; - /* make read_seeprom enter EEPROM read/write mode */ + /* make read_seeprom enter EEPROM read/write mode */ sd.sd_MS = ecr; sd.sd_RDY = 0; @@ -692,7 +692,7 @@ rtw_srom_read(struct rtw_regs *regs, u_int32_t flags, struct rtw_srom *sr, return -1; /* XXX */ } - /* end EEPROM read/write mode */ + /* end EEPROM read/write mode */ RTW_WRITE8(regs, RTW_9346CR, (ecr & ~RTW_9346CR_EEM_MASK) | RTW_9346CR_EEM_NORMAL); RTW_WBRW(regs, RTW_9346CR, RTW_9346CR); @@ -1970,7 +1970,7 @@ rtw_maxim_pwrstate(struct rtw_regs *regs, enum rtw_pwrstate power, } /* XXX I am using the RFMD settings gleaned from the reference - * driver. They agree + * driver. They agree */ void rtw_rfmd_pwrstate(struct rtw_regs *regs, enum rtw_pwrstate power, @@ -2462,7 +2462,7 @@ rtw_led_init(struct rtw_regs *regs) rtw_set_access(regs, RTW_ACCESS_NONE); } -/* +/* * IEEE80211_S_INIT: LED1 off * * IEEE80211_S_AUTH, @@ -2961,7 +2961,7 @@ rtw_compute_duration1(int len, int use_ack, uint32_t flags, int rate, * * wh: 802.11 header * - * len: packet length + * len: packet length * * rate: MSDU speed, units 500kb/s * diff --git a/sys/dev/ic/rtwreg.h b/sys/dev/ic/rtwreg.h index 985670375..101e4c639 100644 --- a/sys/dev/ic/rtwreg.h +++ b/sys/dev/ic/rtwreg.h @@ -553,7 +553,7 @@ * allow RTW_ANAPARM writes. */ #define RTW_CONFIG3_MAGIC (1<<5) /* Valid when RTW_CONFIG1_PMEN is - * set. If set, RTL8180 wakes up + * set. If set, RTL8180 wakes up * OS when Magic Packet is Rx'd. */ #define RTW_CONFIG3_CARDBEN (1<<3) /* Cardbus-related registers @@ -627,11 +627,11 @@ #define RTW8180_SCR_KM_WEP40 LSHIFT(0, RTW8180_SCR_KM_MASK) #define RTW8180_SCR_TXSECON (1<<1) /* Enable Tx WEP. Invalid if * neither RTW_CONFIG0_WEP40 nor - * RTW_CONFIG0_WEP104 is set. + * RTW_CONFIG0_WEP104 is set. */ #define RTW8180_SCR_RXSECON (1<<0) /* Enable Rx WEP. Invalid if * neither RTW_CONFIG0_WEP40 nor - * RTW_CONFIG0_WEP104 is set. + * RTW_CONFIG0_WEP104 is set. */ #define RTW8185_RFPARM 0x60 /* RF Parameter Register, 32b */ @@ -959,9 +959,9 @@ #define RTW_SR_TXPOWER13 0x2c #define RTW_SR_TXPOWER14 0x2d #define RTW_SR_CHANNELPLAN 0x2e /* bitmap of channels to scan */ -#define RTW_SR_ENERGYDETTHR 0x2f /* energy-detect threshold */ -#define RTW_SR_ENERGYDETTHR_DEFAULT 0x0c /* use this if old SROM */ -#define RTW_SR_CISPOINTER 0x30 /* 16b */ +#define RTW_SR_ENERGYDETTHR 0x2f /* energy-detect threshold */ +#define RTW_SR_ENERGYDETTHR_DEFAULT 0x0c /* use this if old SROM */ +#define RTW_SR_CISPOINTER 0x30 /* 16b */ #define RTW_SR_RFPARM 0x32 /* RF-specific parameter */ #define RTW_SR_RFPARM_DIGPHY (1<<0) /* 1: digital PHY */ #define RTW_SR_RFPARM_DFLANTB (1<<1) /* 1: antenna B is default */ @@ -978,7 +978,7 @@ /* the first descriptor in each ring must be on a 256-byte boundary */ #define RTW_DESC_ALIGNMENT 256 -/* Tx descriptor */ +/* Tx descriptor */ struct rtw_txdesc { u_int32_t td_ctl0; u_int32_t td_ctl1; @@ -1040,7 +1040,7 @@ struct rtw_txdesc { #define RTW_TXLEN_LENGTH_MASK 0xfff /* Tx buffer length in bytes */ -/* Rx descriptor */ +/* Rx descriptor */ struct rtw_rxdesc { u_int32_t rd_ctl; u_int32_t rd_rsvd0; diff --git a/sys/dev/ic/s3_617.h b/sys/dev/ic/s3_617.h index e9d4c8a1c..9c273f3e0 100644 --- a/sys/dev/ic/s3_617.h +++ b/sys/dev/ic/s3_617.h @@ -15,7 +15,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The author's name or those of the contributors may be used to - * endorse or promote products derived from this software without + * endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS @@ -43,7 +43,7 @@ enum { SV_GAME_PORTBASE_SLOT = 0x20 }; -/* +/* * Enhanced CODEC registers * These are offset from the base specified in the PCI configuration area */ @@ -52,10 +52,10 @@ enum { SV_CODEC_CONTROL = 0, SV_CODEC_STATUS = 2, SV_CODEC_IADDR = 4, SV_CODEC_IDATA = 5 }; - + /* - * DMA Configuration register + * DMA Configuration register */ enum { @@ -123,7 +123,7 @@ enum { SV_INTSTATUS_MIDI = 0x80 }; -enum { +enum { SV_IADDR_MASK = 0x3f, SV_IADDR_MCE = 0x40, /* TRD = DMA Transfer request disable */ diff --git a/sys/dev/ic/sa2400reg.h b/sys/dev/ic/sa2400reg.h index a665e2fcc..437d9374c 100644 --- a/sys/dev/ic/sa2400reg.h +++ b/sys/dev/ic/sa2400reg.h @@ -258,6 +258,6 @@ * the result of * calibration (VCOCAL). * 0 = highest - * frequencies + * frequencies */ #endif /* _DEV_IC_SA2400REG_H_ */ diff --git a/sys/dev/ic/sili.c b/sys/dev/ic/sili.c index 82d57e3a9..f112277ba 100644 --- a/sys/dev/ic/sili.c +++ b/sys/dev/ic/sili.c @@ -636,7 +636,7 @@ fatal: PORTNAME(sp), pss_masked); } KASSERT(pss_masked == 0); - + /* if we had a timeout on a PMP port, do a portreset. * exclude the control port here as there isn't a real * device there to reset. @@ -692,7 +692,7 @@ fatal: } sp->sp_err_cmds = 0; sp->sp_pmp_error_recovery = 0; - + /* * Finally, run atascsi completion for any finished CCBs. If * we had run these during cmd_done above, any ccbs that their @@ -1105,19 +1105,19 @@ sili_pmp_portreset(struct sili_softc *sc, int port, int pmp_port) if (sili_pmp_write(sp, pmp_port, SATA_PMREG_SCTL, data)) goto err; delay(100000); - + if (sili_pmp_phy_status(sp, pmp_port, &data)) { printf("%s: cannot clear phy status for PMP probe\n", PORTNAME(sp)); goto err; } - + sili_pmp_write(sp, pmp_port, SATA_PMREG_SERR, -1); data = SATA_PM_SCTL_IPM_DISABLED | SATA_PM_SCTL_DET_NONE; if (sili_pmp_write(sp, pmp_port, SATA_PMREG_SCTL, data)) goto err; delay(100000); - + /* wait for PHYRDY by polling SStatus */ for (loop = 3; loop; loop--) { if (sili_pmp_read(sp, pmp_port, SATA_PMREG_SSTS, &data)) @@ -1131,7 +1131,7 @@ sili_pmp_portreset(struct sili_softc *sc, int port, int pmp_port) PORTNAME(sp), pmp_port); goto err; } - + /* give it a bit more time to complete negotiation */ for (loop = 30; loop; loop--) { if (sili_pmp_read(sp, pmp_port, SATA_PMREG_SSTS, &data)) @@ -1208,7 +1208,7 @@ sili_pmp_softreset(struct sili_softc *sc, int port, int pmp_port) ccb->ccb_xa.flags = ATA_F_POLL | ATA_F_GET_RFIS; ccb->ccb_xa.complete = sili_dummy_done; ccb->ccb_xa.pmp_port = pmp_port; - + prb = ccb->ccb_cmd; bzero(prb, sizeof(*prb)); fis = (struct ata_fis_h2d *)&prb->fis; @@ -1770,7 +1770,7 @@ sili_pmp_read(struct sili_port *sp, int target, int which, u_int32_t *datap) ccb->ccb_xa.complete = sili_dummy_done; ccb->ccb_xa.pmp_port = SATA_PMP_CONTROL_PORT; ccb->ccb_xa.state = ATA_S_PENDING; - + prb = ccb->ccb_cmd; bzero(prb, sizeof(*prb)); fis = (struct ata_fis_h2d *)&prb->fis; diff --git a/sys/dev/ic/siop_common.c b/sys/dev/ic/siop_common.c index de8374456..fbd16d3d5 100644 --- a/sys/dev/ic/siop_common.c +++ b/sys/dev/ic/siop_common.c @@ -269,7 +269,7 @@ siop_setuptables(struct siop_common_cmd *siop_cmd) if ((sc->features & SF_CHIP_GEBUG) && (*targ_flags & TARF_WIDE) == 0) - /* + /* * 1010 workaround: can't do disconnect if not wide, * so can't do tag */ diff --git a/sys/dev/ic/smc91cxx.c b/sys/dev/ic/smc91cxx.c index 814c1e370..ee9a4c3f8 100644 --- a/sys/dev/ic/smc91cxx.c +++ b/sys/dev/ic/smc91cxx.c @@ -31,10 +31,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* +/* * Copyright (c) 1996 Gardner Buchanan * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -49,7 +49,7 @@ * 4. The name of Gardner Buchanan may not be used to endorse or promote * products derived from this software without specific prior written * permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. @@ -60,9 +60,9 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * from FreeBSD Id: if_sn.c,v 1.4 1996/03/18 15:47:16 gardner Exp - */ + */ /* * Core driver for the SMC 91Cxx family of Ethernet chips. @@ -73,7 +73,7 @@ #include "bpfilter.h" -#include +#include #include #include #include @@ -82,16 +82,16 @@ #include #include #include -#include +#include #include #include #include #include -#include +#include -#include +#include #include #if NBPFILTER > 0 diff --git a/sys/dev/ic/smc93cx6var.h b/sys/dev/ic/smc93cx6var.h index 0685611d3..0cd5fd0a1 100644 --- a/sys/dev/ic/smc93cx6var.h +++ b/sys/dev/ic/smc93cx6var.h @@ -17,8 +17,8 @@ * 2. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * - * Where this Software is combined with software released under the terms of - * the GNU Public License ("GPL") and the terms of the GPL would require the + * Where this Software is combined with software released under the terms of + * the GNU Public License ("GPL") and the terms of the GPL would require the * combined work to also be released under the terms of the GPL, the terms * and conditions of this License will apply in addition to those of the * GPL with the exception of any terms or conditions of this License that diff --git a/sys/dev/ic/sti.c b/sys/dev/ic/sti.c index 25bcbb146..30b673da4 100644 --- a/sys/dev/ic/sti.c +++ b/sys/dev/ic/sti.c @@ -1269,7 +1269,7 @@ static const u_int8_t sti_unitoroman[0x100 - 0xa0] = { 0xa0, 0xb8, 0xbf, 0xbb, 0xba, 0xbc, 0, 0xbd, 0xab, 0, 0xf9, 0xfb, 0, 0xf6, 0, 0xb0, - + 0xb3, 0xfe, 0, 0, 0xa8, 0xf3, 0xf4, 0xf2, 0, 0, 0xfa, 0xfd, 0xf7, 0xf8, 0, 0xb9, diff --git a/sys/dev/ic/tcic2.c b/sys/dev/ic/tcic2.c index 11dc78c8b..3e3f517f0 100644 --- a/sys/dev/ic/tcic2.c +++ b/sys/dev/ic/tcic2.c @@ -357,12 +357,12 @@ tcic_attach(struct tcic_softc *sc) /* XXX make more clear what happens here -chb */ tcic_sel_sock(&sc->handle[i]); tcic_write_ind_2(&sc->handle[i], TCIC_IR_SCF1_N(i), 0); - tcic_write_ind_2(&sc->handle[i], TCIC_IR_SCF2_N(i), + tcic_write_ind_2(&sc->handle[i], TCIC_IR_SCF2_N(i), (TCIC_SCF2_MCD|TCIC_SCF2_MWP|TCIC_SCF2_MRDY #if 1 /* XXX explain byte routing issue */ - |TCIC_SCF2_MLBAT2|TCIC_SCF2_MLBAT1|TCIC_SCF2_IDBR)); + |TCIC_SCF2_MLBAT2|TCIC_SCF2_MLBAT1|TCIC_SCF2_IDBR); #else - |TCIC_SCF2_MLBAT2|TCIC_SCF2_MLBAT1)); + |(TCIC_SCF2_MLBAT2|TCIC_SCF2_MLBAT1)); #endif tcic_write_1(&sc->handle[i], TCIC_R_MODE, 0); reg = tcic_read_aux_2(sc->iot, sc->ioh, TCIC_AR_SYSCFG); @@ -757,7 +757,7 @@ tcic_deactivate_card(struct tcic_handle *h) } /* XXX the following routine may need to be rewritten. -chb */ -int +int tcic_chip_mem_alloc(pcmcia_chipset_handle_t pch, bus_size_t size, struct pcmcia_mem_handle *pcmhp) { @@ -820,7 +820,7 @@ tcic_chip_mem_alloc(pcmcia_chipset_handle_t pch, bus_size_t size, } /* XXX the following routine may need to be rewritten. -chb */ -void +void tcic_chip_mem_free(pcmcia_chipset_handle_t pch, struct pcmcia_mem_handle *pcmhp) { struct tcic_handle *h = (struct tcic_handle *) pch; @@ -828,7 +828,7 @@ tcic_chip_mem_free(pcmcia_chipset_handle_t pch, struct pcmcia_mem_handle *pcmhp) h->sc->subregionmask |= pcmhp->mhandle; } -void +void tcic_chip_do_mem_map(struct tcic_handle *h, int win) { int reg, hwwin, wscnt; @@ -907,7 +907,7 @@ tcic_chip_do_mem_map(struct tcic_handle *h, int win) } /* XXX needs work */ -int +int tcic_chip_mem_map(pcmcia_chipset_handle_t pch, int kind, bus_addr_t card_addr, bus_size_t size, struct pcmcia_mem_handle *pcmhp, bus_size_t *offsetp, int *windowp) @@ -975,7 +975,7 @@ tcic_chip_mem_map(pcmcia_chipset_handle_t pch, int kind, bus_addr_t card_addr, return (0); } -void +void tcic_chip_mem_unmap(pcmcia_chipset_handle_t pch, int window) { struct tcic_handle *h = (struct tcic_handle *) pch; @@ -992,7 +992,7 @@ tcic_chip_mem_unmap(pcmcia_chipset_handle_t pch, int window) h->memalloc &= ~(1 << window); } -int +int tcic_chip_io_alloc(pcmcia_chipset_handle_t pch, bus_addr_t start, bus_size_t size, bus_size_t align, struct pcmcia_io_handle *pcihp) { @@ -1054,7 +1054,7 @@ tcic_chip_io_alloc(pcmcia_chipset_handle_t pch, bus_addr_t start, return (0); } -void +void tcic_chip_io_free(pcmcia_chipset_handle_t pch, struct pcmcia_io_handle *pcihp) { bus_space_tag_t iot = pcihp->iot; @@ -1070,7 +1070,7 @@ tcic_chip_io_free(pcmcia_chipset_handle_t pch, struct pcmcia_io_handle *pcihp) static int tcic_iowidth_map[] = { TCIC_ICTL_AUTOSZ, TCIC_ICTL_B8, TCIC_ICTL_B16 }; -void +void tcic_chip_do_io_map(struct tcic_handle *h, int win) { int reg, size2, iotiny, wbase, hwwin, wscnt; @@ -1126,7 +1126,7 @@ tcic_chip_do_io_map(struct tcic_handle *h, int win) #endif } -int +int tcic_chip_io_map(pcmcia_chipset_handle_t pch, int width, bus_addr_t offset, bus_size_t size, struct pcmcia_io_handle *pcihp, int *windowp) { @@ -1176,7 +1176,7 @@ tcic_chip_io_map(pcmcia_chipset_handle_t pch, int width, bus_addr_t offset, return (0); } -void +void tcic_chip_io_unmap(pcmcia_chipset_handle_t pch, int window) { struct tcic_handle *h = (struct tcic_handle *) pch; diff --git a/sys/dev/ic/tcic2reg.h b/sys/dev/ic/tcic2reg.h index b8d12b95b..aae71691c 100644 --- a/sys/dev/ic/tcic2reg.h +++ b/sys/dev/ic/tcic2reg.h @@ -109,7 +109,7 @@ */ /* Bits in address register */ -#define TCIC_ADDR_REG (u_int32_t) TCIC_ADDR2_REG << 16) /* OR with this for REG space */ +#define TCIC_ADDR_REG ((u_int32_t) TCIC_ADDR2_REG << 16) /* OR with this for REG space */ #define TCIC_ADDR_SS_SHFT ((u_int32_t) TCIC_ADDR2_SS_SHFT + 16) /* shift count, cast so that * you'll get the right type @@ -326,7 +326,7 @@ /* * If set, assume presence of an external buffer for MCS16: operate * the driver as a totem-pole output. - * + * * If clear, run in pseudo-ISA mode; output is open drain. But note * that on the 082 the output buffers cannot drive a 300-ohm * load. @@ -335,7 +335,7 @@ /* * If set, assume presence of an external buffer for IOCS16*; operate * the buffer as a totem-pole output. - * + * * If clear, run in pseudo-ISA mode; output is open drain. But note * that on the 082 the output buffers cannot drive a 300-ohm * load. @@ -345,7 +345,7 @@ * If set, disable the auto power-down sequencing. The chip will * run card cycles somewhat more quickly (though perhaps not * significantly so); but it will dissipate significantly more power. - * + * * If clear, the low-power operating modes are enabled. This * causes the part to go into low-power mode automatically at * system reset. @@ -412,27 +412,27 @@ * then the busy light will be off, even if a socket is enabled. * If AUTOBUSY is clear, then the busy light will be on if either * socket is enabled. - * + * * Note, that when in a programming mode, you should either clear this * bit (causing the busy light to be on whenever the socket is enabled) * or set both this bit and the ACC bit (causing the light to be on * all the time). - * + * * On the '084 and '184, this bit is per-socket. */ -#define TCIC_SYSCFG_ACC (1<<15) +#define TCIC_SYSCFG_ACC (1<<15) /* * This bit will be set automatically by the hardware whenever the CPU * accesses data on a card. It can be cleared under software control. - * + * * In AUTOBUSY mode, it has the additional effect of turning on the * busy light. - * + * * Since we'll tristate the command lines as the card is going out of * the socket, and since the shared lines idle low, there's no real * danger if the busy light is off even though the socket is enabled. - * + * * On the '084 and '184, this bit is per-socket. */ @@ -509,22 +509,22 @@ * * In diagnostic mode, the high byte of the interlock register is defined * as the silicon identity byte. - * + * * In order to read this byte, the chip must be placed in diagnostic * mode by setting bit 15 of the TESTDIAG register. (This may or may * not be enforced by the silicon.) - * + * * The layout is: - * + * * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 * m <-------ID-------> <----ILOCK----> - * + * * The fields are: - * + * * m Always reset. - * + * * ID This field is one of the following: - * + * * 0x02 the db86082 * 0x03 the db86082a * 0x04 the db86084 diff --git a/sys/dev/ic/ti.c b/sys/dev/ic/ti.c index 61c9b4937..853587ce6 100644 --- a/sys/dev/ic/ti.c +++ b/sys/dev/ic/ti.c @@ -403,14 +403,14 @@ ti_loadfw(struct ti_softc *sc) sc->sc_dv.dv_xname); return; } - + error = loadfirmware(name, &buf, &buflen); if (error) return; /* convert firmware to host byte order */ b = (u_int32_t *)buf; cnt = buflen / sizeof(u_int32_t); - for (i = 0; i < cnt; i++) + for (i = 0; i < cnt; i++) b[i] = letoh32(b[i]); tf = (struct tigon_firmware *)buf; @@ -979,7 +979,7 @@ ti_iff(struct ti_softc *sc) TI_DO_CMD(TI_CMD_SET_PROMISC_MODE, TI_CMD_CODE_PROMISC_DIS, 0); ifp->if_flags &= ~IFF_ALLMULTI; - if (ifp->if_flags & IFF_PROMISC || ac->ac_multirangecnt > 0) { + if (ifp->if_flags & IFF_PROMISC || ac->ac_multirangecnt > 0) { ifp->if_flags |= IFF_ALLMULTI; if (ifp->if_flags & IFF_PROMISC) { TI_DO_CMD(TI_CMD_SET_PROMISC_MODE, diff --git a/sys/dev/ic/tireg.h b/sys/dev/ic/tireg.h index 542c658e8..16c78c50c 100644 --- a/sys/dev/ic/tireg.h +++ b/sys/dev/ic/tireg.h @@ -409,7 +409,7 @@ typedef struct { /* * Ring control block structure. The rules for the max_len field * are as follows: - * + * * For the send ring, max_len indicates the number of entries in the * ring (128, 256 or 512). * @@ -1059,7 +1059,7 @@ struct ti_ring_data { * chosen to make the total struct size an even power of two. It's * critical that no TxCB be split across a page boundary since * no attempt is made to allocate physically contiguous memory. - * + * */ #ifdef __LP64__ #define TI_NTXSEG 30 diff --git a/sys/dev/ic/ufshci.c b/sys/dev/ic/ufshci.c index 14cb889fc..ac3f0e924 100644 --- a/sys/dev/ic/ufshci.c +++ b/sys/dev/ic/ufshci.c @@ -1444,7 +1444,7 @@ ufshci_hexdump(void *buf, int len, char *title, int dbglvl) for (j = 0; j < sizeof(b); j++) { if (j % 2 == 0) - printf(" "); + printf(" "); if (j % 8 == 0) printf(" "); if (j < l) @@ -1796,7 +1796,7 @@ ufshci_scsi_capacity(struct scsi_xfer *xs) } goto error2; } - + return; error2: diff --git a/sys/dev/ic/vga.c b/sys/dev/ic/vga.c index 0866e92fd..31288041a 100644 --- a/sys/dev/ic/vga.c +++ b/sys/dev/ic/vga.c @@ -35,17 +35,17 @@ * All rights reserved. * * Author: Chris G. Demetriou - * + * * Permission to use, copy, modify and distribute this software and * its documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU @@ -978,7 +978,7 @@ vga_scrollback(void *v, void *cookie, int lines) p = st; scr->pcs.visibleoffset = (p + ul) % we; } - + /* update visible position */ vga_6845_write(vh, startadrh, scr->pcs.visibleoffset >> 9); vga_6845_write(vh, startadrl, scr->pcs.visibleoffset >> 1); @@ -1155,7 +1155,7 @@ vga_putchar(void *c, int row, int col, u_int uc, uint32_t attr) struct vgascreen *scr = c; int rc; int s; - + s = spltty(); if (scr->pcs.active && scr->pcs.visibleoffset != scr->pcs.dispoffset) vga_scrollback(scr->cfg, scr, 0); @@ -1196,9 +1196,9 @@ int vga_getchar(void *c, int row, int col, struct wsdisplay_charcell *cell) { struct vga_config *vc = c; - + return (pcdisplay_getchar(vc->active, row, col, cell)); -} +} void vga_save_palette(struct vga_config *vc) diff --git a/sys/dev/ic/vgavar.h b/sys/dev/ic/vgavar.h index a3b52ccd4..fef99e408 100644 --- a/sys/dev/ic/vgavar.h +++ b/sys/dev/ic/vgavar.h @@ -6,17 +6,17 @@ * All rights reserved. * * Author: Chris G. Demetriou - * + * * Permission to use, copy, modify and distribute this software and * its documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU @@ -197,5 +197,5 @@ void vga_save_palette(struct vga_config *); void vga_setfontset(struct vga_handle *, int, int); void vga_setscreentype(struct vga_handle *, const struct wsscreen_descr *); #if NVGA_PCI > 0 -int vga_pci_ioctl(void *, u_long, caddr_t, int, struct proc *); +int vga_pci_ioctl(void *, u_long, caddr_t, int, struct proc *); #endif diff --git a/sys/dev/ic/w83l518d.c b/sys/dev/ic/w83l518d.c index 9aad19704..670ae14c4 100644 --- a/sys/dev/ic/w83l518d.c +++ b/sys/dev/ic/w83l518d.c @@ -109,7 +109,7 @@ wb_detach(struct wb_softc *wb, int flags) } /* - * intr handler + * intr handler */ int wb_intr(void *opaque) diff --git a/sys/dev/ic/w83l518d_sdmmc.c b/sys/dev/ic/w83l518d_sdmmc.c index 51d4fdde6..35313fd5c 100644 --- a/sys/dev/ic/w83l518d_sdmmc.c +++ b/sys/dev/ic/w83l518d_sdmmc.c @@ -543,7 +543,7 @@ done: cmd->c_blklen, cmd->c_datalen, cmd->c_resid); } } - + void wb_sdmmc_card_intr_mask(sdmmc_chipset_handle_t sch, int enable) { @@ -557,7 +557,7 @@ wb_sdmmc_card_intr_ack(sdmmc_chipset_handle_t sch) } /* - * intr handler + * intr handler */ int wb_sdmmc_intr(struct wb_softc *wb) diff --git a/sys/dev/ic/wdc.c b/sys/dev/ic/wdc.c index 32ec659e4..0a85a69d8 100644 --- a/sys/dev/ic/wdc.c +++ b/sys/dev/ic/wdc.c @@ -185,7 +185,7 @@ wdc_log(struct channel_softc *chp, enum wdcevent_type type, if (log_size < 0) log_size += wdc_log_cap; if (log_size + request_size >= wdc_log_cap) { - int nb = 0; + int nb = 0; int rec_size; while (nb <= (request_size * 2)) { @@ -963,7 +963,7 @@ wdcintr(void *arg) } chp->ch_flags &= ~WDCF_DMA_WAIT; } - + chp->ch_flags &= ~WDCF_IRQ_WAIT; ret = xfer->c_intr(chp, xfer, 1); if (ret == 0) /* irq was not for us, still waiting for irq */ @@ -1728,7 +1728,7 @@ __wdccommand_start(struct channel_softc *chp, struct wdc_xfer *xfer) __wdccommand_intr(chp, xfer, 0); return; -timeout: +timeout: wdc_c->flags |= AT_TIMEOU; __wdccommand_done(chp, xfer); } diff --git a/sys/dev/ic/wdcreg.h b/sys/dev/ic/wdcreg.h index e45deddf4..10b069a4b 100644 --- a/sys/dev/ic/wdcreg.h +++ b/sys/dev/ic/wdcreg.h @@ -122,7 +122,7 @@ /* security mode commands */ #define WDCC_SEC_SET_PASSWORD 0xf1 /* set user or master password */ #define WDCC_SEC_UNLOCK 0xf2 /* authenticate */ -#define WDCC_SEC_ERASE_PREPARE 0xf3 +#define WDCC_SEC_ERASE_PREPARE 0xf3 #define WDCC_SEC_ERASE_UNIT 0xf4 /* erase all user data */ #define WDCC_SEC_FREEZE_LOCK 0xf5 /* prevent password changes */ #define WDCC_SEC_DISABLE_PASSWORD 0xf6 diff --git a/sys/dev/ic/xl.c b/sys/dev/ic/xl.c index 087c6521a..17500a7cf 100644 --- a/sys/dev/ic/xl.c +++ b/sys/dev/ic/xl.c @@ -128,7 +128,7 @@ #include -/* +/* * TX Checksumming is disabled by default for two reasons: * - TX Checksumming will occasionally produce corrupt packets * - TX Checksumming seems to reduce performance @@ -312,7 +312,7 @@ xl_mii_readreg(struct xl_softc *sc, struct xl_mii_frame *frame) frame->mii_opcode = XL_MII_READOP; frame->mii_turnaround = 0; frame->mii_data = 0; - + /* * Select register window 4. */ @@ -397,7 +397,7 @@ xl_mii_writereg(struct xl_softc *sc, struct xl_mii_frame *frame) frame->mii_stdelim = XL_MII_STARTDELIM; frame->mii_opcode = XL_MII_WRITEOP; frame->mii_turnaround = XL_MII_TURNAROUND; - + /* * Select the window 4. */ @@ -545,7 +545,7 @@ xl_read_eeprom(struct xl_softc *sc, caddr_t dest, int off, int cnt, int swap) if (swap) *ptr = ntohs(word); else - *ptr = word; + *ptr = word; } return (err ? 1 : 0); @@ -800,11 +800,11 @@ xl_reset(struct xl_softc *sc) CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_TX_RESET); xl_wait(sc); - if (sc->xl_flags & XL_FLAG_INVERT_LED_PWR || + if (sc->xl_flags & XL_FLAG_INVERT_LED_PWR || sc->xl_flags & XL_FLAG_INVERT_MII_PWR) { XL_SEL_WIN(2); CSR_WRITE_2(sc, XL_W2_RESET_OPTIONS, CSR_READ_2(sc, - XL_W2_RESET_OPTIONS) + XL_W2_RESET_OPTIONS) | ((sc->xl_flags & XL_FLAG_INVERT_LED_PWR)?XL_RESETOPT_INVERT_LED:0) | ((sc->xl_flags & XL_FLAG_INVERT_MII_PWR)?XL_RESETOPT_INVERT_MII:0) ); @@ -1003,7 +1003,7 @@ xl_list_tx_init_90xB(struct xl_softc *sc) prev = i - 1; cd->xl_tx_chain[i].xl_ptr = &ld->xl_tx_list[i]; cd->xl_tx_chain[i].xl_phys = - sc->sc_listmap->dm_segs[0].ds_addr + + sc->sc_listmap->dm_segs[0].ds_addr + offsetof(struct xl_list_data, xl_tx_list[i]); cd->xl_tx_chain[i].xl_next = &cd->xl_tx_chain[next]; cd->xl_tx_chain[i].xl_prev = &cd->xl_tx_chain[prev]; @@ -1056,7 +1056,7 @@ xl_list_rx_init(struct xl_softc *sc) void xl_fill_rx_ring(struct xl_softc *sc) -{ +{ struct xl_chain_data *cd; u_int slots; @@ -1143,13 +1143,13 @@ again: while (if_rxr_inuse(&sc->xl_cdata.xl_rx_ring) > 0) { cur_rx = sc->xl_cdata.xl_rx_cons; - bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap, + bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap, ((caddr_t)cur_rx->xl_ptr - sc->sc_listkva), sizeof(struct xl_list), BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); if ((rxstat = letoh32(sc->xl_cdata.xl_rx_cons->xl_ptr->xl_status)) == 0) break; - m = cur_rx->xl_mbuf; + m = cur_rx->xl_mbuf; cur_rx->xl_mbuf = NULL; sc->xl_cdata.xl_rx_cons = cur_rx->xl_next; if_rxr_put(&sc->xl_cdata.xl_rx_ring, 1); @@ -1582,7 +1582,7 @@ reload: return (1); } } - m_copydata(m_head, 0, m_head->m_pkthdr.len, + m_copydata(m_head, 0, m_head->m_pkthdr.len, mtod(m_new, caddr_t)); m_new->m_pkthdr.len = m_new->m_len = m_head->m_pkthdr.len; m_freem(m_head); @@ -2655,7 +2655,7 @@ xl_wol(struct ifnet *ifp, int enable) CSR_WRITE_2(sc, XL_W7_BM_PME, 0); sc->xl_flags &= ~XL_FLAG_WOL; } - return (0); + return (0); } #endif diff --git a/sys/dev/mii/miidevs b/sys/dev/mii/miidevs index ceed41f5b..d68fae976 100644 --- a/sys/dev/mii/miidevs +++ b/sys/dev/mii/miidevs @@ -1,4 +1,4 @@ -$OpenBSD: miidevs,v 1.132 2023/03/31 13:37:02 kettenis Exp $ +$OpenBSD: miidevs,v 1.133 2023/07/08 08:18:30 kettenis Exp $ /* $NetBSD: miidevs,v 1.3 1998/11/05 03:43:43 thorpej Exp $ */ /*- @@ -72,6 +72,7 @@ oui XAQTI 0x00e0ae XaQti oui PLESSEYSEMI 0x046b40 Plessey Semi. oui NATSEMI 0x080017 National Semi. oui TI 0x080028 Texas Instruments +oui MOTORCOMM 0x13d47a Motorcomm /* in the 79c873, AMD uses another OUI (which matches Davicom!) */ oui xxALTIMA 0x000895 Altima @@ -268,6 +269,9 @@ model MARVELL E1545 0x002a 88E1545 Quad 10/100/1000 PHY model MICREL KSZ9021 0x0021 KSZ9021 10/100/1000 PHY model MICREL KSZ9031 0x0022 KSZ9031 10/100/1000 PHY +/* Motorcomm PHYs */ +model MOTORCOMM YT8531 0x0011 YT8531 10/100/1000 PHY + /* Myson PHYs */ model MYSON MTD972 0x0000 MTD972 10/100 PHY diff --git a/sys/dev/mii/miidevs.h b/sys/dev/mii/miidevs.h index 57ff89647..57dfc113e 100644 --- a/sys/dev/mii/miidevs.h +++ b/sys/dev/mii/miidevs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: miidevs.h,v 1.135 2023/03/31 13:37:41 kettenis Exp $ */ +/* $OpenBSD: miidevs.h,v 1.137 2023/07/08 08:13:31 kettenis Exp $ */ /* * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. @@ -79,6 +79,7 @@ #define MII_OUI_PLESSEYSEMI 0x046b40 /* Plessey Semi. */ #define MII_OUI_NATSEMI 0x080017 /* National Semi. */ #define MII_OUI_TI 0x080028 /* Texas Instruments */ +#define MII_OUI_MOTORCOMM 0x13d47a /* Motorcomm */ /* in the 79c873, AMD uses another OUI (which matches Davicom!) */ #define MII_OUI_xxALTIMA 0x000895 /* Altima */ @@ -396,6 +397,10 @@ #define MII_MODEL_MICREL_KSZ9031 0x0022 #define MII_STR_MICREL_KSZ9031 "KSZ9031 10/100/1000 PHY" +/* Motorcomm PHYs */ +#define MII_MODEL_MOTORCOMM_YT8531 0x0011 +#define MII_STR_MOTORCOMM_YT8531 "YT8531 10/100/1000 PHY" + /* Myson PHYs */ #define MII_MODEL_MYSON_MTD972 0x0000 #define MII_STR_MYSON_MTD972 "MTD972 10/100 PHY" diff --git a/sys/dev/mii/miivar.h b/sys/dev/mii/miivar.h index e3f506194..2349072be 100644 --- a/sys/dev/mii/miivar.h +++ b/sys/dev/mii/miivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: miivar.h,v 1.37 2023/04/05 10:45:07 kettenis Exp $ */ +/* $OpenBSD: miivar.h,v 1.38 2023/07/08 08:18:30 kettenis Exp $ */ /* $NetBSD: miivar.h,v 1.17 2000/03/06 20:56:57 thorpej Exp $ */ /*- @@ -63,6 +63,7 @@ struct mii_data { struct ifnet *mii_ifp; /* pointer back to network interface */ int mii_flags; /* misc. flags; see below */ + int mii_node; /* FDT node */ /* * For network interfaces with multiple PHYs, a list of all diff --git a/sys/dev/mii/ytphy.c b/sys/dev/mii/ytphy.c index 6e3b253f9..00aa82e2c 100644 --- a/sys/dev/mii/ytphy.c +++ b/sys/dev/mii/ytphy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ytphy.c,v 1.2 2023/03/04 22:40:37 kettenis Exp $ */ +/* $OpenBSD: ytphy.c,v 1.3 2023/07/08 08:18:30 kettenis Exp $ */ /* * Copyright (c) 2001 Theo de Raadt * Copyright (c) 2023 Mark Kettenis @@ -28,6 +28,15 @@ #include #include +#include + +#ifdef __HAVE_FDT +#include +#include +#endif + +#define MII_MODEL_MOTORCOMM_YT8511 0x10 +#define MII_MODEL_MOTORCOMM_YT8521 0x11 #define YT8511_REG_ADDR 0x1e #define YT8511_REG_DATA 0x1f @@ -46,6 +55,15 @@ #define YT8511_EXT_SLEEP_CTRL 0x27 #define YT8511_PLL_ON_IN_SLEEP (1 << 14) +#define YT8521_EXT_CHIP_CONFIG 0xa001 +#define YT8521_RXC_DLY_EN (1 << 8) +#define YT8521_EXT_RGMII_CONFIG1 0xa003 +#define YT8521_TX_CLK_SEL (1 << 14) +#define YT8521_RX_DELAY_SEL_MASK (0xf << 10) +#define YT8521_RX_DELAY_SEL_SHIFT 10 +#define YT8521_TX_DELAY_SEL_MASK (0xf << 0) +#define YT8521_TX_DELAY_SEL_SHIFT 0 + int ytphy_match(struct device *, void *, void *); void ytphy_attach(struct device *, struct device *, void *); @@ -58,22 +76,37 @@ struct cfdriver ytphy_cd = { }; int ytphy_service(struct mii_softc *, struct mii_data *, int); +void ytphy_yt8511_init(struct mii_softc *); +void ytphy_yt8521_init(struct mii_softc *); +void ytphy_yt8521_update(struct mii_softc *); const struct mii_phy_funcs ytphy_funcs = { ytphy_service, ukphy_status, mii_phy_reset, }; +static const struct mii_phydesc ytphys[] = { + { MII_OUI_MOTORCOMM, MII_MODEL_MOTORCOMM_YT8531, + MII_STR_MOTORCOMM_YT8531 }, + { 0, 0, + NULL }, +}; + int ytphy_match(struct device *parent, void *match, void *aux) { struct mii_attach_args *ma = aux; /* - * The MotorComm YT8511 has a bogus MII OUIs, so match the - * complete ID including the rev. + * The MotorComm YT8511 and TY8521 have bogus MII OUIs, so + * match the complete ID including the rev. */ if (ma->mii_id1 == 0x0000 && ma->mii_id2 == 0x010a) return (10); + if (ma->mii_id1 == 0x0000 && ma->mii_id2 == 0x011a) + return (10); + + if (mii_phy_match(ma, ytphys) != NULL) + return (10); return (0); } @@ -84,12 +117,16 @@ ytphy_attach(struct device *parent, struct device *self, void *aux) struct mii_softc *sc = (struct mii_softc *)self; struct mii_attach_args *ma = aux; struct mii_data *mii = ma->mii_data; - uint16_t tx_clk_delay_sel; - uint16_t rx_clk_delay_en; - uint16_t txc_delay_sel_fe; - uint16_t addr, data; + const struct mii_phydesc *mpd; - printf(": YT8511 10/100/1000 PHY\n"); + mpd = mii_phy_match(ma, ytphys); + + if (mpd) + printf(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + else if (ma->mii_id1 == 0x0000 && ma->mii_id2 == 0x010a) + printf(": YT8511 10/100/1000 PHY\n"); + else + printf(": YT8521 10/100/1000 PHY\n"); sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; @@ -99,45 +136,10 @@ ytphy_attach(struct device *parent, struct device *self, void *aux) sc->mii_pdata = mii; sc->mii_flags = ma->mii_flags; - if (ma->mii_flags & MIIF_RXID) - rx_clk_delay_en = YT8511_RX_CLK_DELAY_EN; + if (ma->mii_id1 == 0x0000 && ma->mii_id2 == 0x010a) + ytphy_yt8511_init(sc); else - rx_clk_delay_en = 0; - - if (ma->mii_flags & MIIF_TXID) { - tx_clk_delay_sel = YT8511_TX_CLK_DELAY_SEL_EN; - txc_delay_sel_fe = YT8511_TXC_DELAY_SEL_FE_EN; - } else { - tx_clk_delay_sel = YT8511_TX_CLK_DELAY_SEL_DIS; - txc_delay_sel_fe = YT8511_TXC_DELAY_SEL_FE_DIS; - } - - /* Save address register. */ - addr = PHY_READ(sc, YT8511_REG_ADDR); - - PHY_WRITE(sc, YT8511_REG_ADDR, YT8511_EXT_CLK_GATE); - data = PHY_READ(sc, YT8511_REG_DATA); - data &= ~YT8511_TX_CLK_DELAY_SEL_MASK; - data &= ~YT8511_RX_CLK_DELAY_EN; - data &= ~YT8511_CLK_25M_SEL_MASK; - data |= tx_clk_delay_sel; - data |= rx_clk_delay_en; - data |= YT8511_CLK_25M_SEL_125M; - PHY_WRITE(sc, YT8511_REG_DATA, data); - - PHY_WRITE(sc, YT8511_REG_ADDR, YT8511_EXT_DELAY_DRIVE); - data = PHY_READ(sc, YT8511_REG_DATA); - data &= ~YT8511_TXC_DELAY_SEL_FE_MASK; - data |= txc_delay_sel_fe; - PHY_WRITE(sc, YT8511_REG_DATA, data); - - PHY_WRITE(sc, YT8511_REG_ADDR, YT8511_EXT_SLEEP_CTRL); - data = PHY_READ(sc, YT8511_REG_DATA); - data |= YT8511_PLL_ON_IN_SLEEP; - PHY_WRITE(sc, YT8511_REG_DATA, data); - - /* Restore address register. */ - PHY_WRITE(sc, YT8511_REG_ADDR, addr); + ytphy_yt8521_init(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; @@ -208,6 +210,155 @@ ytphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) mii_phy_status(sc); /* Callback if something changed. */ + if (sc->mii_model != MII_MODEL_MOTORCOMM_YT8511) + ytphy_yt8521_update(sc); mii_phy_update(sc, cmd); return (0); } + +void +ytphy_yt8511_init(struct mii_softc *sc) +{ + uint16_t tx_clk_delay_sel; + uint16_t rx_clk_delay_en; + uint16_t txc_delay_sel_fe; + uint16_t addr, data; + + if (sc->mii_flags & MIIF_RXID) + rx_clk_delay_en = YT8511_RX_CLK_DELAY_EN; + else + rx_clk_delay_en = 0; + + if (sc->mii_flags & MIIF_TXID) { + tx_clk_delay_sel = YT8511_TX_CLK_DELAY_SEL_EN; + txc_delay_sel_fe = YT8511_TXC_DELAY_SEL_FE_EN; + } else { + tx_clk_delay_sel = YT8511_TX_CLK_DELAY_SEL_DIS; + txc_delay_sel_fe = YT8511_TXC_DELAY_SEL_FE_DIS; + } + + /* Save address register. */ + addr = PHY_READ(sc, YT8511_REG_ADDR); + + PHY_WRITE(sc, YT8511_REG_ADDR, YT8511_EXT_CLK_GATE); + data = PHY_READ(sc, YT8511_REG_DATA); + data &= ~YT8511_TX_CLK_DELAY_SEL_MASK; + data &= ~YT8511_RX_CLK_DELAY_EN; + data &= ~YT8511_CLK_25M_SEL_MASK; + data |= tx_clk_delay_sel; + data |= rx_clk_delay_en; + data |= YT8511_CLK_25M_SEL_125M; + PHY_WRITE(sc, YT8511_REG_DATA, data); + + PHY_WRITE(sc, YT8511_REG_ADDR, YT8511_EXT_DELAY_DRIVE); + data = PHY_READ(sc, YT8511_REG_DATA); + data &= ~YT8511_TXC_DELAY_SEL_FE_MASK; + data |= txc_delay_sel_fe; + PHY_WRITE(sc, YT8511_REG_DATA, data); + + PHY_WRITE(sc, YT8511_REG_ADDR, YT8511_EXT_SLEEP_CTRL); + data = PHY_READ(sc, YT8511_REG_DATA); + data |= YT8511_PLL_ON_IN_SLEEP; + PHY_WRITE(sc, YT8511_REG_DATA, data); + + /* Restore address register. */ + PHY_WRITE(sc, YT8511_REG_ADDR, addr); +} + +void +ytphy_yt8521_init(struct mii_softc *sc) +{ + uint32_t rx_delay = 1950; + uint32_t tx_delay = 1950; + int rx_delay_en = 0; + uint16_t addr, data; + +#ifdef __HAVE_FDT + if (sc->mii_pdata->mii_node) { + rx_delay = OF_getpropint(sc->mii_pdata->mii_node, + "rx-internal-delay-ps", rx_delay); + tx_delay = OF_getpropint(sc->mii_pdata->mii_node, + "tx-internal-delay-ps", tx_delay); + } +#endif + + /* Save address register. */ + addr = PHY_READ(sc, YT8511_REG_ADDR); + + if ((sc->mii_flags & MIIF_RXID) == 0) + rx_delay = 0; + if ((sc->mii_flags & MIIF_TXID) == 0) + tx_delay = 0; + + if (rx_delay >= 1900 && ((rx_delay - 1900) % 150) == 0) { + rx_delay -= 1900; + rx_delay_en = 1; + } + + PHY_WRITE(sc, YT8511_REG_ADDR, YT8521_EXT_CHIP_CONFIG); + data = PHY_READ(sc, YT8511_REG_DATA); + if (rx_delay_en) + data |= YT8521_RXC_DLY_EN; + else + data &= ~YT8521_RXC_DLY_EN; + PHY_WRITE(sc, YT8511_REG_DATA, data); + + PHY_WRITE(sc, YT8511_REG_ADDR, YT8521_EXT_RGMII_CONFIG1); + data = PHY_READ(sc, YT8511_REG_DATA); + data &= ~YT8521_RX_DELAY_SEL_MASK; + data |= (((rx_delay + 75) / 150) << YT8521_RX_DELAY_SEL_SHIFT); + data &= ~YT8521_TX_DELAY_SEL_MASK; + data |= (((tx_delay + 75) / 150) << YT8521_TX_DELAY_SEL_SHIFT); + PHY_WRITE(sc, YT8511_REG_DATA, data); + + /* Restore address register. */ + PHY_WRITE(sc, YT8511_REG_ADDR, addr); +} + +void +ytphy_yt8521_update(struct mii_softc *sc) +{ +#ifdef __HAVE_FDT + struct mii_data *mii = sc->mii_pdata; + int tx_clk_adj_en; + int tx_clk_inv = 0; + uint16_t addr, data; + + if (sc->mii_media_active == mii->mii_media_active) + return; + + tx_clk_adj_en = OF_getpropbool(mii->mii_node, + "motorcomm,tx-clk-adj-enabled"); + if (!tx_clk_adj_en) + return; + + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_1000_T: + tx_clk_inv = OF_getpropbool(mii->mii_node, + "motorcomm,tx-clk-1000-inverted"); + break; + case IFM_100_TX: + tx_clk_inv = OF_getpropbool(mii->mii_node, + "motorcomm,tx-clk-100-inverted"); + break; + case IFM_10_T: + tx_clk_inv = OF_getpropbool(mii->mii_node, + "motorcomm,tx-clk-10-inverted"); + break; + } + + /* Save address register. */ + addr = PHY_READ(sc, YT8511_REG_ADDR); + + PHY_WRITE(sc, YT8511_REG_ADDR, YT8521_EXT_RGMII_CONFIG1); + data = PHY_READ(sc, YT8511_REG_DATA); + if (tx_clk_inv) + data |= YT8521_TX_CLK_SEL; + else + data &= ~YT8521_TX_CLK_SEL; + PHY_WRITE(sc, YT8511_REG_DATA, data); + + /* Restore address register. */ + PHY_WRITE(sc, YT8511_REG_ADDR, addr); +#endif +} diff --git a/sys/dev/pci/if_ix.c b/sys/dev/pci/if_ix.c index b250ee48d..195b5d638 100644 --- a/sys/dev/pci/if_ix.c +++ b/sys/dev/pci/if_ix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ix.c,v 1.197 2023/06/01 09:05:33 jan Exp $ */ +/* $OpenBSD: if_ix.c,v 1.198 2023/07/08 09:01:30 jmatthew Exp $ */ /****************************************************************************** @@ -3094,8 +3094,11 @@ ixgbe_free_receive_buffers(struct rx_ring *rxr) m_freem(rxbuf->buf); rxbuf->buf = NULL; } - bus_dmamap_destroy(rxr->rxdma.dma_tag, rxbuf->map); - rxbuf->map = NULL; + if (rxbuf->map != NULL) { + bus_dmamap_destroy(rxr->rxdma.dma_tag, + rxbuf->map); + rxbuf->map = NULL; + } } free(rxr->rx_buffers, M_DEVBUF, sc->num_rx_desc * sizeof(struct ixgbe_rx_buf)); diff --git a/sys/dev/pci/pcidevs b/sys/dev/pci/pcidevs index 2cf293c3b..33751af87 100644 --- a/sys/dev/pci/pcidevs +++ b/sys/dev/pci/pcidevs @@ -1,4 +1,4 @@ -$OpenBSD: pcidevs,v 1.2041 2023/06/29 07:58:15 jsg Exp $ +$OpenBSD: pcidevs,v 1.2043 2023/07/08 09:11:51 kettenis Exp $ /* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */ /* @@ -274,6 +274,7 @@ vendor TOPIC 0x151f Topic/SmartLink vendor ENE 0x1524 ENE vendor ARALION 0x1538 Aralion vendor TERRATEC 0x153b TerraTec +vendor PLDA 0x1556 PLDA vendor PERLE 0x155f Perle vendor SYMBOL 0x1562 Symbol vendor SYBA 0x1592 Syba @@ -6949,6 +6950,7 @@ product INTEL RPL_U_HB_2 0xa71b Core 13G Host product INTEL RPL_U_HB_3 0xa71c Core 13G Host product INTEL RPL_DTT 0xa71d Core 13G DTT product INTEL RPL_XHCI 0xa71e Core 13G xHCI +product INTEL RPL_TBT_PCIE3 0xa71f Core 13G PCIE product INTEL RPL_P_GT_1 0xa720 Graphics product INTEL RPL_P_GT_2 0xa721 Graphics product INTEL RPL_HX_HB_4 0xa728 Core 13G Host @@ -6957,6 +6959,7 @@ product INTEL RPL_HX_HB_6 0xa72a Core 13G Host product INTEL RPL_PCIE_2 0xa72d Core 13G PCIE product INTEL RPL_TBT_PCIE2 0xa72f Core 13G PCIE product INTEL RPL_TBT_DMA0 0xa73e Core 13G TBT +product INTEL RPL_TBT_PCIE1 0xa73f Core 13G PCIE product INTEL RPL_PCIE_3 0xa74d Core 13G PCIE product INTEL RPL_GNA 0xa74f Core 13G GNA product INTEL RPL_IPU 0xa75d Core 13G IPU @@ -8247,6 +8250,9 @@ product PLANEX FNW_3800_TX 0xab07 FNW-3800-TX /* Platform */ product PLATFORM ES1849 0x0100 ES1849 +/* PLDA products */ +product PLDA XR_AXI 0x1111 XpressRICH-AXI + /* PLX products */ product PLX 1076 0x1076 I/O 1076 product PLX 1077 0x1077 I/O 1077 diff --git a/sys/dev/pci/pcidevs.h b/sys/dev/pci/pcidevs.h index 3a14e5277..127731a67 100644 --- a/sys/dev/pci/pcidevs.h +++ b/sys/dev/pci/pcidevs.h @@ -2,7 +2,7 @@ * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * OpenBSD: pcidevs,v 1.2041 2023/06/29 07:58:15 jsg Exp + * OpenBSD: pcidevs,v 1.2043 2023/07/08 09:11:51 kettenis Exp */ /* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */ @@ -279,6 +279,7 @@ #define PCI_VENDOR_ENE 0x1524 /* ENE */ #define PCI_VENDOR_ARALION 0x1538 /* Aralion */ #define PCI_VENDOR_TERRATEC 0x153b /* TerraTec */ +#define PCI_VENDOR_PLDA 0x1556 /* PLDA */ #define PCI_VENDOR_PERLE 0x155f /* Perle */ #define PCI_VENDOR_SYMBOL 0x1562 /* Symbol */ #define PCI_VENDOR_SYBA 0x1592 /* Syba */ @@ -6954,6 +6955,7 @@ #define PCI_PRODUCT_INTEL_RPL_U_HB_3 0xa71c /* Core 13G Host */ #define PCI_PRODUCT_INTEL_RPL_DTT 0xa71d /* Core 13G DTT */ #define PCI_PRODUCT_INTEL_RPL_XHCI 0xa71e /* Core 13G xHCI */ +#define PCI_PRODUCT_INTEL_RPL_TBT_PCIE3 0xa71f /* Core 13G PCIE */ #define PCI_PRODUCT_INTEL_RPL_P_GT_1 0xa720 /* Graphics */ #define PCI_PRODUCT_INTEL_RPL_P_GT_2 0xa721 /* Graphics */ #define PCI_PRODUCT_INTEL_RPL_HX_HB_4 0xa728 /* Core 13G Host */ @@ -6962,6 +6964,7 @@ #define PCI_PRODUCT_INTEL_RPL_PCIE_2 0xa72d /* Core 13G PCIE */ #define PCI_PRODUCT_INTEL_RPL_TBT_PCIE2 0xa72f /* Core 13G PCIE */ #define PCI_PRODUCT_INTEL_RPL_TBT_DMA0 0xa73e /* Core 13G TBT */ +#define PCI_PRODUCT_INTEL_RPL_TBT_PCIE1 0xa73f /* Core 13G PCIE */ #define PCI_PRODUCT_INTEL_RPL_PCIE_3 0xa74d /* Core 13G PCIE */ #define PCI_PRODUCT_INTEL_RPL_GNA 0xa74f /* Core 13G GNA */ #define PCI_PRODUCT_INTEL_RPL_IPU 0xa75d /* Core 13G IPU */ @@ -8252,6 +8255,9 @@ /* Platform */ #define PCI_PRODUCT_PLATFORM_ES1849 0x0100 /* ES1849 */ +/* PLDA products */ +#define PCI_PRODUCT_PLDA_XR_AXI 0x1111 /* XpressRICH-AXI */ + /* PLX products */ #define PCI_PRODUCT_PLX_1076 0x1076 /* I/O 1076 */ #define PCI_PRODUCT_PLX_1077 0x1077 /* I/O 1077 */ diff --git a/sys/dev/pci/pcidevs_data.h b/sys/dev/pci/pcidevs_data.h index 88740c36a..edd1dd654 100644 --- a/sys/dev/pci/pcidevs_data.h +++ b/sys/dev/pci/pcidevs_data.h @@ -2,7 +2,7 @@ * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * OpenBSD: pcidevs,v 1.2041 2023/06/29 07:58:15 jsg Exp + * OpenBSD: pcidevs,v 1.2043 2023/07/08 09:11:51 kettenis Exp */ /* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */ @@ -25171,6 +25171,10 @@ static const struct pci_known_product pci_known_products[] = { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_RPL_XHCI, "Core 13G xHCI", }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_RPL_TBT_PCIE3, + "Core 13G PCIE", + }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_RPL_P_GT_1, "Graphics", @@ -25203,6 +25207,10 @@ static const struct pci_known_product pci_known_products[] = { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_RPL_TBT_DMA0, "Core 13G TBT", }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_RPL_TBT_PCIE1, + "Core 13G PCIE", + }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_RPL_PCIE_3, "Core 13G PCIE", @@ -29687,6 +29695,10 @@ static const struct pci_known_product pci_known_products[] = { PCI_VENDOR_PLATFORM, PCI_PRODUCT_PLATFORM_ES1849, "ES1849", }, + { + PCI_VENDOR_PLDA, PCI_PRODUCT_PLDA_XR_AXI, + "XpressRICH-AXI", + }, { PCI_VENDOR_PLX, PCI_PRODUCT_PLX_1076, "I/O 1076", @@ -35871,6 +35883,10 @@ static const struct pci_known_vendor pci_known_vendors[] = { PCI_VENDOR_TERRATEC, "TerraTec", }, + { + PCI_VENDOR_PLDA, + "PLDA", + }, { PCI_VENDOR_PERLE, "Perle", diff --git a/sys/dev/pci/virtio_pci.c b/sys/dev/pci/virtio_pci.c index 28087f1ac..398dc960f 100644 --- a/sys/dev/pci/virtio_pci.c +++ b/sys/dev/pci/virtio_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: virtio_pci.c,v 1.34 2023/07/05 18:11:08 patrick Exp $ */ +/* $OpenBSD: virtio_pci.c,v 1.35 2023/07/07 10:23:39 patrick Exp $ */ /* $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $ */ /* @@ -961,6 +961,13 @@ virtio_pci_setup_msix(struct virtio_pci_softc *sc, struct pci_attach_args *pa, struct virtio_softc *vsc = &sc->sc_sc; int i; + /* Shared needs config + queue */ + if (shared && pci_intr_msix_count(pa) < 1 + 1) + return 1; + /* Per VQ needs config + N * queue */ + if (!shared && pci_intr_msix_count(pa) < 1 + vsc->sc_nvqs) + return 1; + if (virtio_pci_msix_establish(sc, pa, 0, virtio_pci_config_intr, vsc)) return 1; sc->sc_devcfg_offset = VIRTIO_CONFIG_DEVICE_CONFIG_MSI; @@ -1059,10 +1066,9 @@ int virtio_pci_queue_intr(void *arg) { struct virtqueue *vq = arg; + struct virtio_softc *vsc = vq->vq_owner; - if (vq->vq_done) - return (vq->vq_done)(vq); - return 0; + return virtio_check_vq(vsc, vq); } int diff --git a/sys/dev/pv/virtio.c b/sys/dev/pv/virtio.c index d085376d0..e9be61c0b 100644 --- a/sys/dev/pv/virtio.c +++ b/sys/dev/pv/virtio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: virtio.c,v 1.22 2023/04/20 19:28:31 jcs Exp $ */ +/* $OpenBSD: virtio.c,v 1.23 2023/07/07 10:23:39 patrick Exp $ */ /* $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $ */ /* @@ -218,26 +218,31 @@ vq_sync_indirect(struct virtio_softc *sc, struct virtqueue *vq, int slot, int virtio_check_vqs(struct virtio_softc *sc) { - struct virtqueue *vq; int i, r = 0; /* going backwards is better for if_vio */ - for (i = sc->sc_nvqs - 1; i >= 0; i--) { - vq = &sc->sc_vqs[i]; - if (vq->vq_queued) { - vq->vq_queued = 0; - vq_sync_aring(sc, vq, BUS_DMASYNC_POSTWRITE); - } - vq_sync_uring(sc, vq, BUS_DMASYNC_POSTREAD); - if (vq->vq_used_idx != vq->vq_used->idx) { - if (vq->vq_done) - r |= (vq->vq_done)(vq); - } - } + for (i = sc->sc_nvqs - 1; i >= 0; i--) + r |= virtio_check_vq(sc, &sc->sc_vqs[i]); return r; } +int +virtio_check_vq(struct virtio_softc *sc, struct virtqueue *vq) +{ + if (vq->vq_queued) { + vq->vq_queued = 0; + vq_sync_aring(sc, vq, BUS_DMASYNC_POSTWRITE); + } + vq_sync_uring(sc, vq, BUS_DMASYNC_POSTREAD); + if (vq->vq_used_idx != vq->vq_used->idx) { + if (vq->vq_done) + return (vq->vq_done)(vq); + } + + return 0; +} + /* * Initialize vq structure. */ diff --git a/sys/dev/pv/virtiovar.h b/sys/dev/pv/virtiovar.h index 9e3e9c9a2..7f2aea701 100644 --- a/sys/dev/pv/virtiovar.h +++ b/sys/dev/pv/virtiovar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: virtiovar.h,v 1.14 2019/05/26 15:22:31 sf Exp $ */ +/* $OpenBSD: virtiovar.h,v 1.15 2023/07/07 10:23:39 patrick Exp $ */ /* $NetBSD: virtiovar.h,v 1.1 2011/10/30 12:12:21 hannken Exp $ */ /* @@ -233,6 +233,7 @@ int virtio_dequeue_commit(struct virtqueue*, int); int virtio_intr(void *arg); int virtio_check_vqs(struct virtio_softc *); +int virtio_check_vq(struct virtio_softc *, struct virtqueue *); void virtio_stop_vq_intr(struct virtio_softc *, struct virtqueue *); int virtio_start_vq_intr(struct virtio_softc *, struct virtqueue *); diff --git a/sys/dev/usb/makemap.awk b/sys/dev/usb/makemap.awk index 8a258dc9b..547f19bfa 100644 --- a/sys/dev/usb/makemap.awk +++ b/sys/dev/usb/makemap.awk @@ -1,5 +1,5 @@ #! /usr/bin/awk -f -# $OpenBSD: makemap.awk,v 1.15 2020/11/02 19:45:18 tobhe Exp $ +# $OpenBSD: makemap.awk,v 1.16 2023/07/09 08:02:13 tobhe Exp $ # # Copyright (c) 2005, Miodrag Vallat # @@ -31,7 +31,7 @@ # BEGIN { - rcsid = "$OpenBSD: makemap.awk,v 1.15 2020/11/02 19:45:18 tobhe Exp $" + rcsid = "$OpenBSD: makemap.awk,v 1.16 2023/07/09 08:02:13 tobhe Exp $" ifdepth = 0 ignore = 0 declk = 0 @@ -329,7 +329,7 @@ $1 == "#define" || $1 == "#undef" { # the ``menu'' key. # if (nmaps++ == 0) { - # 102 Suspend + lines[102] = " KC(102),\tKS_Cmd_Sleep," lines[116] = " KC(116),\tKS_Open," lines[117] = " KC(117),\tKS_Help," lines[118] = " KC(118),\tKS_Props," diff --git a/sys/dev/usb/ukbdmap.c b/sys/dev/usb/ukbdmap.c index da8a33e47..e7e51f99e 100644 --- a/sys/dev/usb/ukbdmap.c +++ b/sys/dev/usb/ukbdmap.c @@ -1,10 +1,10 @@ -/* $OpenBSD: ukbdmap.c,v 1.47 2023/01/23 09:38:03 nicm Exp $ */ +/* $OpenBSD: ukbdmap.c,v 1.48 2023/07/09 08:04:09 tobhe Exp $ */ /* * THIS FILE IS AUTOMAGICALLY GENERATED. DO NOT EDIT. * * generated by: - * OpenBSD: makemap.awk,v 1.15 2020/11/02 19:45:18 tobhe Exp + * OpenBSD: makemap.awk,v 1.16 2023/07/09 08:02:13 tobhe Exp * generated from: */ /* OpenBSD: wskbdmap_mfii.c,v 1.48 2023/01/23 09:36:40 nicm Exp */ @@ -150,6 +150,7 @@ static const keysym_t ukbd_keydesc_us[] = { KC(98), KS_KP_Insert, KS_KP_0, KC(99), KS_KP_Delete, KS_KP_Decimal, KC(101), KS_Menu, + KC(102), KS_Cmd_Sleep, KC(104), KS_f13, KC(105), KS_f14, KC(106), KS_f15, diff --git a/sys/dev/wscons/wskbd.c b/sys/dev/wscons/wskbd.c index d651f119c..23a0744b0 100644 --- a/sys/dev/wscons/wskbd.c +++ b/sys/dev/wscons/wskbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wskbd.c,v 1.114 2022/11/10 12:10:54 matthieu Exp $ */ +/* $OpenBSD: wskbd.c,v 1.115 2023/07/09 08:02:14 tobhe Exp $ */ /* $NetBSD: wskbd.c,v 1.80 2005/05/04 01:52:16 augustss Exp $ */ /* @@ -1513,6 +1513,13 @@ internal_command(struct wskbd_softc *sc, u_int *type, keysym_t ksym, if (*type != WSCONS_EVENT_KEY_DOWN) return (0); +#ifdef SUSPEND + if (ksym == KS_Cmd_Sleep) { + request_sleep(SLEEP_SUSPEND); + return (1); + } +#endif + #ifdef HAVE_SCROLLBACK_SUPPORT #if NWSDISPLAY > 0 switch (ksym) { diff --git a/sys/dev/wscons/wsksymdef.h b/sys/dev/wscons/wsksymdef.h index 881510d1e..69cc685d9 100644 --- a/sys/dev/wscons/wsksymdef.h +++ b/sys/dev/wscons/wsksymdef.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wsksymdef.h,v 1.40 2023/01/23 09:36:40 nicm Exp $ */ +/* $OpenBSD: wsksymdef.h,v 1.41 2023/07/09 08:02:14 tobhe Exp $ */ /* $NetBSD: wsksymdef.h,v 1.34.4.1 2000/07/07 09:49:54 hannken Exp $ */ /*- @@ -667,6 +667,7 @@ #define KS_Cmd_ScrollBack 0xf42c #define KS_Cmd_ScrollFwd 0xf42d #define KS_Cmd_KbdReset 0xf42e +#define KS_Cmd_Sleep 0xf42f /* * Group 5 (internal) diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index a4f87f214..ee235e8cc 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.416 2023/07/02 19:02:27 cheloha Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.417 2023/07/07 16:27:46 bluhm Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -515,20 +515,22 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, case KERN_MBSTAT: { extern struct cpumem *mbstat; uint64_t counters[MBSTAT_COUNT]; - struct mbstat mbs; + struct mbstat *mbs; unsigned int i; + int ret; - memset(&mbs, 0, sizeof(mbs)); + mbs = malloc(sizeof(*mbs), M_TEMP, M_WAITOK | M_ZERO); counters_read(mbstat, counters, MBSTAT_COUNT); for (i = 0; i < MBSTAT_TYPES; i++) - mbs.m_mtypes[i] = counters[i]; + mbs->m_mtypes[i] = counters[i]; - mbs.m_drops = counters[MBSTAT_DROPS]; - mbs.m_wait = counters[MBSTAT_WAIT]; - mbs.m_drain = counters[MBSTAT_DRAIN]; + mbs->m_drops = counters[MBSTAT_DROPS]; + mbs->m_wait = counters[MBSTAT_WAIT]; + mbs->m_drain = counters[MBSTAT_DRAIN]; - return (sysctl_rdstruct(oldp, oldlenp, newp, - &mbs, sizeof(mbs))); + ret = sysctl_rdstruct(oldp, oldlenp, newp, mbs, sizeof(*mbs)); + free(mbs, M_TEMP, sizeof(*mbs)); + return (ret); } case KERN_MSGBUFSIZE: case KERN_CONSBUFSIZE: { diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c index 76556c2cc..a99417b66 100644 --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_timeout.c,v 1.92 2023/06/28 08:23:25 claudio Exp $ */ +/* $OpenBSD: kern_timeout.c,v 1.93 2023/07/06 23:24:37 cheloha Exp $ */ /* * Copyright (c) 2001 Thomas Nordin * Copyright (c) 2000-2001 Artur Grabowski @@ -545,9 +545,6 @@ timeout_hardclock_update(void) struct timespec *lastscan = &timeout_kclock[KCLOCK_UPTIME].kc_lastscan; int b, done, first, i, last, level, need_softclock = 1, off; - nanouptime(&now); - timespecsub(&now, lastscan, &elapsed); - mtx_enter(&timeout_mutex); MOVEBUCKET(0, ticks); @@ -573,6 +570,8 @@ timeout_hardclock_update(void) * completed a lap of the level and need to process buckets in the * next level. */ + nanouptime(&now); + timespecsub(&now, lastscan, &elapsed); for (level = 0; level < nitems(timeout_level_width); level++) { first = timeout_maskwheel(level, lastscan); if (elapsed.tv_sec >= timeout_level_width[level]) { diff --git a/sys/net/if.c b/sys/net/if.c index 1c43c17e7..8dc61bfcd 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.704 2023/07/06 04:55:04 dlg Exp $ */ +/* $OpenBSD: if.c,v 1.706 2023/07/07 19:45:26 bluhm Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -782,6 +782,7 @@ int if_input_local(struct ifnet *ifp, struct mbuf *m, sa_family_t af) { int keepflags, keepcksum; + uint16_t keepmss; #if NBPFILTER > 0 /* @@ -807,9 +808,11 @@ if_input_local(struct ifnet *ifp, struct mbuf *m, sa_family_t af) keepcksum = m->m_pkthdr.csum_flags & (M_IPV4_CSUM_OUT | M_TCP_CSUM_OUT | M_UDP_CSUM_OUT | M_ICMP_CSUM_OUT | M_TCP_TSO); + keepmss = m->m_pkthdr.ph_mss; m_resethdr(m); m->m_flags |= M_LOOP | keepflags; m->m_pkthdr.csum_flags = keepcksum; + m->m_pkthdr.ph_mss = keepmss; m->m_pkthdr.ph_ifidx = ifp->if_index; m->m_pkthdr.ph_rtableid = ifp->if_rdomain; @@ -885,6 +888,57 @@ if_output_ml(struct ifnet *ifp, struct mbuf_list *ml, return error; } +int +if_output_tso(struct ifnet *ifp, struct mbuf **mp, struct sockaddr *dst, + struct rtentry *rt, u_int mtu) +{ + uint32_t ifcap; + int error; + + switch (dst->sa_family) { + case AF_INET: + ifcap = IFCAP_TSOv4; + break; +#ifdef INET6 + case AF_INET6: + ifcap = IFCAP_TSOv6; + break; +#endif + default: + unhandled_af(dst->sa_family); + } + + /* + * Try to send with TSO first. When forwarding LRO may set + * maximium segment size in mbuf header. Chop TCP segment + * even if it would fit interface MTU to preserve maximum + * path MTU. + */ + error = tcp_if_output_tso(ifp, mp, dst, rt, ifcap, mtu); + if (error || *mp == NULL) + return error; + + if ((*mp)->m_pkthdr.len <= mtu) { + switch (dst->sa_family) { + case AF_INET: + in_hdr_cksum_out(*mp, ifp); + in_proto_cksum_out(*mp, ifp); + break; +#ifdef INET6 + case AF_INET6: + in6_proto_cksum_out(*mp, ifp); + break; +#endif + } + error = ifp->if_output(ifp, *mp, dst, rt); + *mp = NULL; + return error; + } + + /* mp still contains mbuf that has to be fragmented or dropped. */ + return 0; +} + int if_output_mq(struct ifnet *ifp, struct mbuf_queue *mq, unsigned int *total, struct sockaddr *dst, struct rtentry *rt) diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 4656fd8d2..20f7a9aee 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ethersubr.c,v 1.289 2023/07/03 15:52:51 kn Exp $ */ +/* $OpenBSD: if_ethersubr.c,v 1.290 2023/07/06 19:46:53 kn Exp $ */ /* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */ /* @@ -931,7 +931,7 @@ ether_addmulti(struct ifreq *ifr, struct arpcom *ac) /* * Found it; just increment the reference count. */ - ++enm->enm_refcount; + refcnt_take(&enm->enm_refcnt); splx(s); return (0); } @@ -946,7 +946,7 @@ ether_addmulti(struct ifreq *ifr, struct arpcom *ac) } memcpy(enm->enm_addrlo, addrlo, ETHER_ADDR_LEN); memcpy(enm->enm_addrhi, addrhi, ETHER_ADDR_LEN); - enm->enm_refcount = 1; + refcnt_init_trace(&enm->enm_refcnt, DT_REFCNT_IDX_ETHMULTI); LIST_INSERT_HEAD(&ac->ac_multiaddrs, enm, enm_list); ac->ac_multicnt++; if (memcmp(addrlo, addrhi, ETHER_ADDR_LEN) != 0) @@ -984,7 +984,7 @@ ether_delmulti(struct ifreq *ifr, struct arpcom *ac) splx(s); return (ENXIO); } - if (--enm->enm_refcount != 0) { + if (refcnt_rele(&enm->enm_refcnt) == 0) { /* * Still some claims to this record. */ diff --git a/sys/net/if_var.h b/sys/net/if_var.h index a4eabc52c..73d6e8ea3 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_var.h,v 1.128 2023/06/28 11:49:49 kn Exp $ */ +/* $OpenBSD: if_var.h,v 1.129 2023/07/07 08:05:02 bluhm Exp $ */ /* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */ /* @@ -329,6 +329,8 @@ int if_output_ml(struct ifnet *, struct mbuf_list *, struct sockaddr *, struct rtentry *); int if_output_mq(struct ifnet *, struct mbuf_queue *, unsigned int *, struct sockaddr *, struct rtentry *); +int if_output_tso(struct ifnet *, struct mbuf **, struct sockaddr *, + struct rtentry *, u_int); int if_output_local(struct ifnet *, struct mbuf *, sa_family_t); void if_rtrequest_dummy(struct ifnet *, int, struct rtentry *); void p2p_rtrequest(struct ifnet *, int, struct rtentry *); diff --git a/sys/net/pf.c b/sys/net/pf.c index f5ad04dfa..eb233a8af 100644 --- a/sys/net/pf.c +++ b/sys/net/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.1182 2023/07/06 04:55:05 dlg Exp $ */ +/* $OpenBSD: pf.c,v 1.1183 2023/07/07 08:05:02 bluhm Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -6610,15 +6610,8 @@ pf_route(struct pf_pdesc *pd, struct pf_state *st) ip = mtod(m0, struct ip *); } - if (ntohs(ip->ip_len) <= ifp->if_mtu) { - in_hdr_cksum_out(m0, ifp); - in_proto_cksum_out(m0, ifp); - ifp->if_output(ifp, m0, sintosa(dst), rt); - goto done; - } - - if (tcp_if_output_tso(ifp, &m0, sintosa(dst), rt, - IFCAP_TSOv4, ifp->if_mtu) || m0 == NULL) + if (if_output_tso(ifp, &m0, sintosa(dst), rt, ifp->if_mtu) || + m0 == NULL) goto done; /* @@ -6745,14 +6738,8 @@ pf_route6(struct pf_pdesc *pd, struct pf_state *st) goto done; } - if (m0->m_pkthdr.len <= ifp->if_mtu) { - in6_proto_cksum_out(m0, ifp); - ifp->if_output(ifp, m0, sin6tosa(dst), rt); - goto done; - } - - if (tcp_if_output_tso(ifp, &m0, sin6tosa(dst), rt, - IFCAP_TSOv6, ifp->if_mtu) || m0 == NULL) + if (if_output_tso(ifp, &m0, sin6tosa(dst), rt, ifp->if_mtu) || + m0 == NULL) goto done; ip6stat_inc(ip6s_cantfrag); diff --git a/sys/netinet/if_ether.h b/sys/netinet/if_ether.h index f05dbf41c..9ff5baeae 100644 --- a/sys/netinet/if_ether.h +++ b/sys/netinet/if_ether.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.h,v 1.88 2023/02/07 16:14:55 bluhm Exp $ */ +/* $OpenBSD: if_ether.h,v 1.89 2023/07/06 19:46:53 kn Exp $ */ /* $NetBSD: if_ether.h,v 1.22 1996/05/11 13:00:00 mycroft Exp $ */ /* @@ -181,6 +181,9 @@ struct sockaddr_inarp { #define RTF_PERMANENT_ARP RTF_PROTO3 /* only manual overwrite of entry */ #ifdef _KERNEL + +#include + /* * Macro to map an IP multicast address to an Ethernet multicast address. * The high-order 25 bits of the Ethernet address are statically assigned, @@ -318,7 +321,7 @@ void ether_extract_headers(struct mbuf *, struct ether_extracted *); struct ether_multi { u_int8_t enm_addrlo[ETHER_ADDR_LEN]; /* low or only address of range */ u_int8_t enm_addrhi[ETHER_ADDR_LEN]; /* high or only address of range */ - u_int enm_refcount; /* no. claims to this addr/range */ + struct refcnt enm_refcnt; /* no. claims to this addr/range */ LIST_ENTRY(ether_multi) enm_list; }; diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 0e56ffb3f..1094c495a 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_output.c,v 1.389 2023/07/04 10:48:19 bluhm Exp $ */ +/* $OpenBSD: ip_output.c,v 1.390 2023/07/07 08:05:02 bluhm Exp $ */ /* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */ /* @@ -451,17 +451,9 @@ sendit: #endif /* - * If small enough for interface, can just send directly. + * If TSO or small enough for interface, can just send directly. */ - if (ntohs(ip->ip_len) <= mtu) { - in_hdr_cksum_out(m, ifp); - in_proto_cksum_out(m, ifp); - error = ifp->if_output(ifp, m, sintosa(dst), ro->ro_rt); - goto done; - } - - error = tcp_if_output_tso(ifp, &m, sintosa(dst), ro->ro_rt, - IFCAP_TSOv4, mtu); + error = if_output_tso(ifp, &m, sintosa(dst), ro->ro_rt, mtu); if (error || m == NULL) goto done; diff --git a/sys/netinet6/ip6_forward.c b/sys/netinet6/ip6_forward.c index db68b32ec..7de1e0ec7 100644 --- a/sys/netinet6/ip6_forward.c +++ b/sys/netinet6/ip6_forward.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_forward.c,v 1.111 2023/06/16 19:18:56 bluhm Exp $ */ +/* $OpenBSD: ip6_forward.c,v 1.112 2023/07/07 08:05:02 bluhm Exp $ */ /* $KAME: ip6_forward.c,v 1.75 2001/06/29 12:42:13 jinmei Exp $ */ /* @@ -319,8 +319,7 @@ reroute: } #endif - error = tcp_if_output_tso(ifp, &m, sin6tosa(sin6), rt, IFCAP_TSOv6, - ifp->if_mtu); + error = if_output_tso(ifp, &m, sin6tosa(sin6), rt, ifp->if_mtu); if (error) ip6stat_inc(ip6s_cantforward); else if (m == NULL) @@ -328,17 +327,6 @@ reroute: if (error || m == NULL) goto senderr; - /* Check the size after pf_test to give pf a chance to refragment. */ - if (m->m_pkthdr.len <= ifp->if_mtu) { - in6_proto_cksum_out(m, ifp); - error = ifp->if_output(ifp, m, sin6tosa(sin6), rt); - if (error) - ip6stat_inc(ip6s_cantforward); - else - ip6stat_inc(ip6s_forward); - goto senderr; - } - if (mcopy != NULL) icmp6_error(mcopy, ICMP6_PACKET_TOO_BIG, 0, ifp->if_mtu); m_freem(m); diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index f2fa35119..8057f26e8 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_output.c,v 1.278 2023/06/13 19:34:12 bluhm Exp $ */ +/* $OpenBSD: ip6_output.c,v 1.279 2023/07/07 08:05:02 bluhm Exp $ */ /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ /* @@ -677,7 +677,8 @@ reroute: * 2-a: send as is if tlen <= interface mtu * 2-b: error if tlen > interface mtu */ - tlen = m->m_pkthdr.len; + tlen = ISSET(m->m_pkthdr.csum_flags, M_TCP_TSO) ? + m->m_pkthdr.ph_mss : m->m_pkthdr.len; if (ISSET(m->m_pkthdr.csum_flags, M_IPV6_DF_OUT)) { CLR(m->m_pkthdr.csum_flags, M_IPV6_DF_OUT); @@ -686,9 +687,8 @@ reroute: dontfrag = 1; else dontfrag = 0; - if (dontfrag && /* case 2-b */ - (ISSET(m->m_pkthdr.csum_flags, M_TCP_TSO) ? - m->m_pkthdr.ph_mss : tlen) > ifp->if_mtu) { + + if (dontfrag && tlen > ifp->if_mtu) { /* case 2-b */ #ifdef IPSEC if (ip_mtudisc) ipsec_adjust_mtu(m, mtu); @@ -701,16 +701,13 @@ reroute: * transmit packet without fragmentation */ if (dontfrag || tlen <= mtu) { /* case 1-a and 2-a */ - in6_proto_cksum_out(m, ifp); - error = ifp->if_output(ifp, m, sin6tosa(dst), ro->ro_rt); - goto done; + error = if_output_tso(ifp, &m, sin6tosa(dst), ro->ro_rt, + ifp->if_mtu); + if (error || m == NULL) + goto done; + goto bad; /* should not happen */ } - error = tcp_if_output_tso(ifp, &m, sin6tosa(dst), ro->ro_rt, - IFCAP_TSOv6, mtu); - if (error || m == NULL) - goto done; - /* * try to fragment the packet. case 1-b */ diff --git a/sys/sys/device.h b/sys/sys/device.h index e99f2d75e..77fc2b1b2 100644 --- a/sys/sys/device.h +++ b/sys/sys/device.h @@ -1,4 +1,4 @@ -/* $OpenBSD: device.h,v 1.65 2023/05/17 20:23:14 patrick Exp $ */ +/* $OpenBSD: device.h,v 1.66 2023/07/08 14:44:43 tobhe Exp $ */ /* $NetBSD: device.h,v 1.15 1996/04/09 20:55:24 cgd Exp $ */ /* @@ -199,6 +199,7 @@ void config_pending_decr(void); void config_mountroot(struct device *, void (*)(struct device *)); void config_process_deferred_mountroot(void); +int request_sleep(int); int sleep_state(void *, int); #define SLEEP_SUSPEND 0x01 #define SLEEP_HIBERNATE 0x02 diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index c2002113a..8e8fb131f 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mbuf.h,v 1.259 2023/07/04 09:47:51 jsg Exp $ */ +/* $OpenBSD: mbuf.h,v 1.260 2023/07/07 14:17:34 yasuoka Exp $ */ /* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */ /* @@ -372,7 +372,7 @@ struct mbstat { u_long m_drops; /* times failed to find space */ u_long m_wait; /* times waited for space */ u_long m_drain; /* times drained protocols for space */ - u_short m_mtypes[256]; /* type specific mbuf allocations */ + u_long m_mtypes[256]; /* type specific mbuf allocations */ }; #define MBSTAT_TYPES MT_NTYPES diff --git a/sys/sys/refcnt.h b/sys/sys/refcnt.h index 47a40f61b..c0f048214 100644 --- a/sys/sys/refcnt.h +++ b/sys/sys/refcnt.h @@ -1,4 +1,4 @@ -/* $OpenBSD: refcnt.h,v 1.10 2023/06/28 11:49:49 kn Exp $ */ +/* $OpenBSD: refcnt.h,v 1.11 2023/07/06 19:46:53 kn Exp $ */ /* * Copyright (c) 2015 David Gwynne @@ -44,11 +44,12 @@ int refcnt_shared(struct refcnt *); unsigned int refcnt_read(struct refcnt *); /* sorted alphabetically, keep in sync with dev/dt/dt_prov_static.c */ -#define DT_REFCNT_IDX_IFADDR 1 -#define DT_REFCNT_IDX_IFMADDR 2 -#define DT_REFCNT_IDX_INPCB 3 -#define DT_REFCNT_IDX_RTENTRY 4 -#define DT_REFCNT_IDX_TDB 5 +#define DT_REFCNT_IDX_ETHMULTI 1 +#define DT_REFCNT_IDX_IFADDR 2 +#define DT_REFCNT_IDX_IFMADDR 3 +#define DT_REFCNT_IDX_INPCB 4 +#define DT_REFCNT_IDX_RTENTRY 5 +#define DT_REFCNT_IDX_TDB 6 #endif /* _KERNEL */ diff --git a/usr.bin/libtool/LT/Library.pm b/usr.bin/libtool/LT/Library.pm index 8cb18a37d..13f08103d 100644 --- a/usr.bin/libtool/LT/Library.pm +++ b/usr.bin/libtool/LT/Library.pm @@ -1,4 +1,4 @@ -# $OpenBSD: Library.pm,v 1.13 2018/10/28 15:21:49 naddy Exp $ +# $OpenBSD: Library.pm,v 1.14 2023/07/08 08:15:32 espie Exp $ # Copyright (c) 2007-2010 Steven Mestdagh # Copyright (c) 2012 Marc Espie @@ -15,22 +15,17 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -use strict; -use warnings; -use feature qw(say switch state); +use v5.36; package LT::Library::Stash; -sub new +sub new($class) { - my $class = shift; - bless {}, $class; } -sub create +sub create($self, $key) { - my ($self, $key) = @_; if (!exists $self->{$key}) { $self->{$key} = LT::Library->new($key); } @@ -44,9 +39,8 @@ use LT::Trace; # find actual library filename # XXX pick the right one if multiple are found! -sub resolve_library +sub resolve_library($self, $dirs, $shared, $staticflag, $linkmode, $gp = undef) { - my ($self, $dirs, $shared, $staticflag, $linkmode, $gp) = @_; my $libtofind = $self->{key}; my $libfile = 0; @@ -96,7 +90,7 @@ sub resolve_library } } else { # search in .libs when priority is high - push @$dirs, $gp->libsearchdirs if $gp; + push @$dirs, $gp->libsearchdirs if defined $gp; tsay {"searching for $libtofind"}; tsay {"search path= ", join(':', @$dirs)}; tsay {"search type= ", $shared ? 'shared' : 'static'}; @@ -143,9 +137,8 @@ sub resolve_library } } -sub findbest +sub findbest($self, $sd, $name) { - my ($self, $sd, $name) = @_; my $best = undef; if (opendir(my $dir, $sd)) { my ($major, $minor) = (-1, -1); @@ -168,10 +161,8 @@ sub findbest } # give a list of library dependencies found in the actual shared library -sub inspect +sub inspect($self) { - my $self = shift; - my $filename = $self->{fullpath}; my @deps; @@ -192,10 +183,8 @@ sub inspect } # give the list of RPATH/RUNPATH directories -sub findrpaths +sub findrpaths($self) { - my $self = shift; - my $filename = $self->{fullpath}; my @dirs; @@ -216,9 +205,8 @@ sub findrpaths return @dirs; } -sub new +sub new($class, $key) { - my ($class, $key) = @_; bless { key => $key }, $class; } diff --git a/usr.bin/libtool/LT/Mode/Compile.pm b/usr.bin/libtool/LT/Mode/Compile.pm index 89bed0e3b..8d69b5b03 100644 --- a/usr.bin/libtool/LT/Mode/Compile.pm +++ b/usr.bin/libtool/LT/Mode/Compile.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Compile.pm,v 1.13 2014/04/16 14:39:06 zhuk Exp $ +# $OpenBSD: Compile.pm,v 1.14 2023/07/08 08:15:32 espie Exp $ # # Copyright (c) 2007-2010 Steven Mestdagh # Copyright (c) 2012 Marc Espie @@ -15,8 +15,7 @@ # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -use strict; -use warnings; +use v5.36; package LT::Mode::Compile; our @ISA = qw(LT::Mode); @@ -26,7 +25,7 @@ use LT::LoFile; use LT::Util; use LT::Trace; -sub help +sub help($) { print <<"EOH"; @@ -38,9 +37,8 @@ EOH } my @valid_src = qw(asm c cc cpp cxx f s); -sub run +sub run($class, $ltprog, $gp, $ltconfig) { - my ($class, $ltprog, $gp, $ltconfig) = @_; my $lofile = LT::LoFile->new; my $pic = !$ltconfig->noshared; diff --git a/usr.bin/libtool/LT/Mode/Install.pm b/usr.bin/libtool/LT/Mode/Install.pm index 6c252a790..1204703fd 100644 --- a/usr.bin/libtool/LT/Mode/Install.pm +++ b/usr.bin/libtool/LT/Mode/Install.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Install.pm,v 1.8 2014/09/05 10:36:39 espie Exp $ +# $OpenBSD: Install.pm,v 1.9 2023/07/08 08:15:32 espie Exp $ # # Copyright (c) 2007-2010 Steven Mestdagh # Copyright (c) 2012 Marc Espie @@ -15,8 +15,7 @@ # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -use strict; -use warnings; +use v5.36; package LT::Mode::Install; our @ISA = qw(LT::Mode); @@ -26,7 +25,7 @@ use LT::Trace; use Getopt::Std; use File::Basename; -sub help +sub help($) { print <<"EOH"; @@ -35,9 +34,9 @@ Install executables/libraries. EOH } -sub run +# don't care about gp or ltconfig for install ! +sub run($class, $ltprog, $, $) { - my ($class, $ltprog) = @_; # we just parse the options in order to find the actual arguments my @argvcopy = @ARGV; my %install_opts; @@ -96,10 +95,8 @@ sub run } } -sub is_wrapper +sub is_wrapper($program) { - my $program = shift; - open(my $pw, '<', $program) or die "Cannot open $program: $!\n"; my $line = <$pw>; # if the first line isn't a shell, don't even bother diff --git a/usr.bin/libtool/LT/Mode/Link.pm b/usr.bin/libtool/LT/Mode/Link.pm index 5efd91fd6..da8b65eef 100644 --- a/usr.bin/libtool/LT/Mode/Link.pm +++ b/usr.bin/libtool/LT/Mode/Link.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Link.pm,v 1.37 2020/02/27 11:27:47 jca Exp $ +# $OpenBSD: Link.pm,v 1.38 2023/07/08 08:15:32 espie Exp $ # # Copyright (c) 2007-2010 Steven Mestdagh # Copyright (c) 2012 Marc Espie @@ -15,9 +15,7 @@ # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -use strict; -use warnings; -use feature qw(say); +use v5.36; # supplement OSConfig with stuff needed. package LT::OSConfig; @@ -26,7 +24,7 @@ require LT::UList; my $search_dir_list = LT::UList->new; my $search_dir_obj = tied(@$search_dir_list); -sub fillup_search_dirs +sub fillup_search_dirs($) { return if @$search_dir_list; open(my $fh, '-|', '/sbin/ldconfig -r'); @@ -42,16 +40,14 @@ sub fillup_search_dirs close($fh); } -sub search_dirs +sub search_dirs($self) { - my $self = shift; $self->fillup_search_dirs; return @$search_dir_list; } -sub is_search_dir +sub is_search_dir($self, $dir) { - my ($self, $dir) = @_; $self->fillup_search_dirs; return $search_dir_obj->exists($dir); } @@ -60,28 +56,24 @@ sub is_search_dir # let's add the libsearchdirs and -R options there package LT::Options; -sub add_libsearchdir +sub add_libsearchdir($self, @p) { - my $self = shift; - push(@{$self->{libsearchdir}}, @_); + push(@{$self->{libsearchdir}}, @p); } -sub libsearchdirs +sub libsearchdirs($self) { - my $self = shift; return @{$self->{libsearchdir}}; } # -R options originating from .la resolution -sub add_R +sub add_R($self, @p) { - my $self = shift; - push(@{$self->{Rresolved}}, @_); + push(@{$self->{Rresolved}}, @p); } -sub Rresolved +sub Rresolved($self) { - my $self = shift; $self->{Rresolved} //= []; return @{$self->{Rresolved}}; } @@ -100,7 +92,7 @@ use constant { PROGRAM => 2, }; -sub help +sub help($) { print <<"EOH"; @@ -112,9 +104,8 @@ EOH my $shared = 0; my $static = 1; -sub run +sub run($class, $ltprog, $gp, $ltconfig) { - my ($class, $ltprog, $gp, $ltconfig) = @_; my $noshared = $ltconfig->noshared; my $cmd; @@ -357,12 +348,8 @@ sub run } # populate arrays of non-pic and pic objects and remove these from @ARGV -sub generate_objlist +sub generate_objlist($objs, $sobjs, $objsource) { - my $objs = shift; - my $sobjs = shift; - my $objsource = shift; - my $result = []; foreach my $a (@$objsource) { if ($a =~ m/\S+\.lo$/) { @@ -392,10 +379,8 @@ sub generate_objlist } # convert 4:5:8 into a list of numbers -sub parse_version_info +sub parse_version_info($vinfo) { - my $vinfo = shift; - if ($vinfo =~ m/^(\d+):(\d+):(\d+)$/) { return ($1, $2, $3); } elsif ($vinfo =~ m/^(\d+):(\d+)$/) { @@ -410,10 +395,8 @@ sub parse_version_info # prepare dependency_libs information for the .la file which is installed # i.e. remove any .libs directories and use the final libdir for all the # .la files -sub process_deplibs +sub process_deplibs($linkflags) { - my $linkflags = shift; - my $result; foreach my $lf (@$linkflags) { @@ -447,9 +430,8 @@ use LT::Trace; my $calls = 0; -sub build_cache +sub build_cache($self, $lainfo, $level = 0) { - my ($self, $lainfo, $level) = @_; my $o = $lainfo->{cached} = { deplibs => LT::UList->new, libdirs => LT::UList->new, @@ -463,10 +445,8 @@ sub build_cache } } -sub internal_resolve_la +sub internal_resolve_la($self, $o, $args, $level = 0) { - my ($self, $o, $args, $level) = @_; - $level //= 0; tsay {"resolve level: $level"}; $o->{pthread} = 0; foreach my $arg (@$args) { @@ -497,10 +477,8 @@ END } # resolve .la files until a level with empty dependency_libs is reached. -sub resolve_la +sub resolve_la($self, $deplibs, $libdirs) { - my ($self, $deplibs, $libdirs) = @_; - tsay {"argvstring (pre resolve_la): @{$self->{args}}"}; my $o = { result => [], deplibs => $deplibs, libdirs => $libdirs}; @@ -518,10 +496,8 @@ sub resolve_la # Find first library or .la file for given library name. # Returns pair of (type, file path), or empty list on error. -sub find_first_lib +sub find_first_lib($self, $lib, $dirs, $gp) { - my ($self, $lib, $dirs, $gp) = @_; - my $name = $lib->{key}; require LT::LaFile; @@ -559,11 +535,9 @@ sub find_first_lib # -Lfoo, -lfoo, foo.a, foo.la # recursively find .la files corresponding to -l flags; if there is no .la # file, just inspect the library file itself for any dependencies. -sub internal_parse_linkargs1 +sub internal_parse_linkargs1($self, $deplibs, $gp, $dirs, $libs, $args, + $level = 0) { - my ($self, $deplibs, $gp, $dirs, $libs, $args, $level) = @_; - - $level //= 0; tsay {"parse_linkargs1, level: $level"}; tsay {" args: @$args"}; my $result = $self->{result}; @@ -675,9 +649,8 @@ sub internal_parse_linkargs1 } } -sub parse_linkargs1 +sub parse_linkargs1($self, $deplibs, $gp, $dirs, $libs) { - my ($self, $deplibs, $gp, $dirs, $libs, $args) = @_; $self->{result} = []; $self->internal_parse_linkargs1($deplibs, $gp, $dirs, $libs, $self->{args}); @@ -697,9 +670,8 @@ sub parse_linkargs1 # a .la file is found which refers to a shared library and which is not # yet installed # this is used to decide where to link executables and create wrappers -sub parse_linkargs2 +sub parse_linkargs2($self, $gp, $orderedlibs, $staticlibs, $dirs, $libs) { - my ($self, $gp, $orderedlibs, $staticlibs, $dirs, $libs) = @_; tsay {"parse_linkargs2"}; tsay {" args: @{$self->{args}}"}; my $result = []; @@ -765,9 +737,8 @@ sub parse_linkargs2 return $result; } -sub new +sub new($class, $args) { - my ($class, $args) = @_; bless { args => $args, pthread => 0 }, $class; } @@ -777,15 +748,13 @@ use LT::Util; use File::Basename; use Cwd qw(abs_path); -sub new +sub new($class) { - my $class = shift; bless {}, $class; } -sub create_symlinks +sub create_symlinks($self, $dir, $libs) { - my ($self, $dir, $libs) = @_; if (! -d $dir) { mkdir($dir) or die "Cannot mkdir($dir) : $!\n"; } @@ -817,15 +786,13 @@ sub create_symlinks return $dir; } -sub common1 +sub common1($self, $parser, $gp, $deplibs, $libdirs, $dirs, $libs) { - my ($self, $parser, $gp, $deplibs, $libdirs, $dirs, $libs) = @_; - $parser->resolve_la($deplibs, $libdirs); my $orderedlibs = LT::UList->new; my $staticlibs = []; - my $args = $parser->parse_linkargs2($gp, $orderedlibs, $staticlibs, $dirs, - $libs); + my $args = $parser->parse_linkargs2($gp, $orderedlibs, $staticlibs, + $dirs, $libs); my $tiedlibs = tied(@$orderedlibs); my $ie = $tiedlibs->indexof("estdc++"); @@ -846,9 +813,8 @@ sub common1 return ($staticlibs, $orderedlibs, $args); } -sub infer_libparameter +sub infer_libparameter($self, $a, $k) { - my ($self, $a, $k) = @_; my $lib = basename($a); if ($lib =~ m/^lib(.*)\.so(\.\d+){2}$/) { $lib = $1; @@ -862,9 +828,8 @@ sub infer_libparameter return "-l$lib"; } -sub export_symbols +sub export_symbols($self, $ltconfig, $base, $gp, @o) { - my ($self, $ltconfig, $base, $gp, @o) = @_; my $symbolsfile; my $comment; if ($gp->export_symbols) { diff --git a/usr.bin/libtool/LT/Mode/Link/Library.pm b/usr.bin/libtool/LT/Mode/Link/Library.pm index cbbde047c..e1d84fe78 100644 --- a/usr.bin/libtool/LT/Mode/Link/Library.pm +++ b/usr.bin/libtool/LT/Mode/Link/Library.pm @@ -1,4 +1,4 @@ -# $OpenBSD: Library.pm,v 1.7 2018/12/11 05:45:14 semarie Exp $ +# $OpenBSD: Library.pm,v 1.8 2023/07/08 08:15:32 espie Exp $ # Copyright (c) 2007-2010 Steven Mestdagh # Copyright (c) 2012 Marc Espie @@ -15,16 +15,15 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -use strict; -use warnings; +use v5.36; use feature qw(say); use LT::LaFile; package LT::LaFile; -sub link +sub link(@p) { - return LT::Linker::LaFile->new->link(@_); + return LT::Linker::LaFile->new->link(@p); } package LT::Linker::LaFile; diff --git a/usr.bin/libtool/LT/Program.pm b/usr.bin/libtool/LT/Program.pm index d49dffc31..131b2cf0e 100644 --- a/usr.bin/libtool/LT/Program.pm +++ b/usr.bin/libtool/LT/Program.pm @@ -1,4 +1,4 @@ -# $OpenBSD: Program.pm,v 1.19 2012/07/13 11:56:12 espie Exp $ +# $OpenBSD: Program.pm,v 1.20 2023/07/08 08:15:32 espie Exp $ # Copyright (c) 2007-2010 Steven Mestdagh # Copyright (c) 2012 Marc Espie @@ -15,9 +15,7 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -use strict; -use warnings; -use feature qw(say switch state); +use v5.36; package LT::Program; use File::Basename; @@ -25,18 +23,15 @@ use LT::Archive; use LT::Util; use LT::Trace; -sub new +sub new($class) { - my $class = shift; bless {}, $class; } # write a wrapper script for an executable so it can be executed within # the build directory -sub write_wrapper +sub write_wrapper($self) { - my $self = shift; - my $program = $self->{outfilepath}; my $pfile = basename($program); my $realprogram = $ltdir . '/' . $pfile; @@ -68,10 +63,8 @@ EOF chmod 0755, $program; } -sub install +sub install($class, $src, $dst, $instprog, $instopts) { - my ($class, $src, $dst, $instprog, $instopts) = @_; - my $srcdir = dirname $src; my $srcfile = basename $src; my $realpath = "$srcdir/$ltdir/$srcfile"; diff --git a/usr.bin/libtool/LT/UList.pm b/usr.bin/libtool/LT/UList.pm index e7a5d7985..922575e6d 100644 --- a/usr.bin/libtool/LT/UList.pm +++ b/usr.bin/libtool/LT/UList.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: UList.pm,v 1.5 2022/12/26 19:16:01 jmc Exp $ +# $OpenBSD: UList.pm,v 1.6 2023/07/08 08:45:54 espie Exp $ # # Copyright (c) 2013 Vadim Zhukov # @@ -15,9 +15,7 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -use strict; -use warnings; -use feature qw(say); +use v5.36; # Hash that preserves order of adding items and avoids duplicates. # Also, some additional restrictions are applied to make sure @@ -28,7 +26,8 @@ require Tie::Array; our @ISA = qw(Tie::Array); -sub _translate_num_key($$;$) { +sub _translate_num_key +{ if ($_[1] < 0) { $_[1] = @{$_[0]} - (-$_[1]); die "invalid index" if $_[1] < 1; @@ -38,9 +37,11 @@ sub _translate_num_key($$;$) { die "invalid index $_[1]" if $_[1] - int($_[2] // 0) >= @{$_[0]}; } + # Construct new UList and returns reference to the array, # not to the tied object itself. -sub new { +sub new +{ my $class = shift; tie(my @a, $class, @_); return \@a; @@ -50,7 +51,8 @@ sub new { # self->[0] = { directory => 1 } # self->[1 .. N] = directories in the order of addition, represented as 0..N-1 -sub TIEARRAY { +sub TIEARRAY +{ my $class = shift; my $self = bless [ {} ], $class; $self->PUSH(@_); @@ -61,16 +63,33 @@ sub TIEARRAY { # case we have EXISTS() outta there. So if you really need to check the # presence of particular item, call the method below on the reference # returned by tie() or tied() instead. -sub exists { return exists $_[0]->[0]->{$_[1]}; } +sub exists +{ + return exists $_[0]->[0]->{$_[1]}; +} -sub indexof { return exists($_[0]->[0]->{$_[1]}) ? ($_[0]->[0]->{$_[1]} - 1) : undef; } +sub indexof +{ + return exists($_[0]->[0]->{$_[1]}) ? ($_[0]->[0]->{$_[1]} - 1) : undef; +} -sub FETCHSIZE { return scalar(@{$_[0]}) - 1; } +sub FETCHSIZE +{ + return scalar(@{$_[0]}) - 1; +} -# not needed -sub STORE { die "unimplemented and should not be used"; } -sub DELETE { die "unimplemented and should not be used"; } -sub EXTEND { } +# not needed ? +sub STORE { + die "unimplemented and should not be used"; +} +sub DELETE +{ + die "unimplemented and should not be used"; +} + +sub EXTEND +{ +} sub FETCH { diff --git a/usr.bin/libtool/LT/Util.pm b/usr.bin/libtool/LT/Util.pm index dbb694c26..2dfb90074 100644 --- a/usr.bin/libtool/LT/Util.pm +++ b/usr.bin/libtool/LT/Util.pm @@ -1,4 +1,4 @@ -# $OpenBSD: Util.pm,v 1.6 2014/04/16 10:31:27 zhuk Exp $ +# $OpenBSD: Util.pm,v 1.7 2023/07/08 08:15:32 espie Exp $ # Copyright (c) 2007-2010 Steven Mestdagh # Copyright (c) 2012 Marc Espie @@ -15,8 +15,7 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -use strict; -use warnings; +use v5.36; package LT::Util; require Exporter; our @ISA = qw(Exporter); @@ -27,16 +26,15 @@ use Cwd; our $ltdir = '.libs'; our $version = '1.5.26'; # pretend to be this version of libtool -sub abs_dir +sub abs_dir($a) { - my $a = shift; return dirname(Cwd::abs_path($a)); } -sub shortdie +sub shortdie(@p) { $SIG{__DIE__} = 'DEFAULT'; - die @_; + die @p; } 1; diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index ba052b5ee..ee8a79c44 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.130 2023/05/30 04:42:21 espie Exp $ */ +/* $OpenBSD: main.c,v 1.131 2023/07/08 21:51:45 jmc Exp $ */ /* $NetBSD: main.c,v 1.34 1997/03/24 20:56:36 gwr Exp $ */ /* @@ -941,7 +941,7 @@ usage() { (void)fprintf(stderr, "usage: make [-BeiknpqrSst] [-C directory] [-D variable] [-d flags] [-f mk]\n\ - [-I directory] [-j max_processes] [-m directory] [-V variable]\n\ + [-I directory] [-j max_jobs] [-m directory] [-V variable]\n\ [NAME=value ...] [target ...]\n"); exit(2); } diff --git a/usr.bin/make/make.1 b/usr.bin/make/make.1 index 37e3ef289..9ed033b32 100644 --- a/usr.bin/make/make.1 +++ b/usr.bin/make/make.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: make.1,v 1.139 2023/01/17 13:03:22 kn Exp $ +.\" $OpenBSD: make.1,v 1.140 2023/07/08 18:02:00 espie Exp $ .\" $NetBSD: make.1,v 1.18 1997/03/10 21:19:53 christos Exp $ .\" .\" Copyright (c) 1990, 1993 @@ -30,7 +30,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd $Mdocdate: January 17 2023 $ +.Dd $Mdocdate: July 8 2023 $ .Dt MAKE 1 .Os .Sh NAME @@ -44,7 +44,7 @@ .Op Fl d Ar flags .Op Fl f Ar mk .Op Fl I Ar directory -.Op Fl j Ar max_processes +.Op Fl j Ar max_jobs .Op Fl m Ar directory .Op Fl V Ar variable .Op Ar NAME Ns = Ns Ar value ... @@ -154,7 +154,7 @@ Extended options are as follows: Try to be backwards compatible by executing the commands to make the prerequisites in a target rule in sequence. This is the default, in the absence of -.Fl j Ar max_processes . +.Fl j Ar max_jobs . .It Fl C Ar directory Enter .Ar directory @@ -241,10 +241,12 @@ Multiple directories can be added to form a search path. Furthermore, the system include path (see the .Fl m option) will be used after this search path. -.It Fl j Ar max_processes -Specify the maximum number of processes that +.It Fl j Ar max_jobs +Specify the maximum number of jobs that .Nm may have running at any one time. +See the discussion about recursive invocations under +.Sx BUGS . .It Fl m Ar directory Specify a directory in which to search for system include files: .Pa sys.mk diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c index cdeff0279..039bd4aa5 100644 --- a/usr.bin/make/make.c +++ b/usr.bin/make/make.c @@ -1,4 +1,4 @@ -/* $OpenBSD: make.c,v 1.82 2020/01/26 12:41:21 espie Exp $ */ +/* $OpenBSD: make.c,v 1.83 2023/07/08 18:42:27 espie Exp $ */ /* $NetBSD: make.c,v 1.10 1996/11/06 17:59:15 christos Exp $ */ /* @@ -488,8 +488,9 @@ add_targets_to_make(Lst todo) if (gn->children_left != 0) { if (DEBUG(MAKE)) - printf("%s: not queuing (%d children left to build)\n", - gn->name, gn->children_left); + printf("%s: not queuing (%d child%s left to build)\n", + gn->name, gn->children_left, + gn->children_left > 1 ? "ren" : ""); Lst_ForEach(&gn->children, MakeAddChild, &examine); } else { diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 1718f345c..a677d22a3 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet.c,v 1.177 2023/07/02 19:59:15 bluhm Exp $ */ +/* $OpenBSD: inet.c,v 1.178 2023/07/07 09:15:13 yasuoka Exp $ */ /* $NetBSD: inet.c,v 1.14 1995/10/03 21:42:37 thorpej Exp $ */ /* @@ -1556,8 +1556,8 @@ tcpcb_dump(u_long off) p("%lu", snd_cwnd, ", "); p("%lu", snd_ssthresh, ", "); p("%lu", max_sndwnd, "\n "); - p("%u", t_rcvtime, ", "); - p("%u", t_rtttime, ", "); + p("%llu", t_rcvtime, ", "); + p("%llu", t_rtttime, ", "); p("%u", t_rtseq, "\n "); p("%u", t_srtt, ", "); p("%u", t_rttvar, ", "); @@ -1570,7 +1570,7 @@ tcpcb_dump(u_long off) p("%u", request_r_scale, ", "); p("%u", requested_s_scale, "\n "); p("%u", ts_recent, ", "); - p("%u", ts_recent_age, "\n "); + p("%llu", ts_recent_age, "\n "); p("%u", last_ack_sent, "\n "); HTONS(tcpcb.t_pmtud_ip_len); HTONS(tcpcb.t_pmtud_nextmtu); diff --git a/usr.bin/netstat/mbuf.c b/usr.bin/netstat/mbuf.c index b52a76f59..dfb7695b7 100644 --- a/usr.bin/netstat/mbuf.c +++ b/usr.bin/netstat/mbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mbuf.c,v 1.43 2019/07/16 17:39:02 bluhm Exp $ */ +/* $OpenBSD: mbuf.c,v 1.44 2023/07/07 14:17:35 yasuoka Exp $ */ /* $NetBSD: mbuf.c,v 1.9 1996/05/07 02:55:03 thorpej Exp $ */ /* @@ -78,7 +78,7 @@ static struct mbtypes { { 0, 0 } }; -int nmbtypes = sizeof(mbstat.m_mtypes) / sizeof(short); +int nmbtypes = sizeof(mbstat.m_mtypes) / sizeof(u_long); bool seen[256]; /* "have we seen this type yet?" */ /* @@ -172,7 +172,7 @@ mbpr(void) for (mp = mbtypes; mp->mt_name; mp++) if (mbstat.m_mtypes[mp->mt_type]) { seen[mp->mt_type] = YES; - printf("\t%u mbuf%s allocated to %s\n", + printf("\t%lu mbuf%s allocated to %s\n", mbstat.m_mtypes[mp->mt_type], plural(mbstat.m_mtypes[mp->mt_type]), mp->mt_name); @@ -180,7 +180,7 @@ mbpr(void) seen[MT_FREE] = YES; for (i = 0; i < nmbtypes; i++) if (!seen[i] && mbstat.m_mtypes[i]) { - printf("\t%u mbuf%s allocated to \n", + printf("\t%lu mbuf%s allocated to \n", mbstat.m_mtypes[i], plural(mbstat.m_mtypes[i]), i); } diff --git a/usr.bin/ssh/ssh-add.c b/usr.bin/ssh/ssh-add.c index 6af24882e..ab92a540f 100644 --- a/usr.bin/ssh/ssh-add.c +++ b/usr.bin/ssh/ssh-add.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-add.c,v 1.167 2023/03/08 00:05:58 djm Exp $ */ +/* $OpenBSD: ssh-add.c,v 1.168 2023/07/06 22:17:59 dtucker Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -856,7 +856,7 @@ main(int argc, char **argv) confirm = 1; break; case 'm': - minleft = (int)strtonum(optarg, 1, UINT_MAX, NULL); + minleft = (u_int)strtonum(optarg, 1, UINT_MAX, NULL); if (minleft == 0) { usage(); ret = 1; @@ -864,7 +864,7 @@ main(int argc, char **argv) } break; case 'M': - maxsign = (int)strtonum(optarg, 1, UINT_MAX, NULL); + maxsign = (u_int)strtonum(optarg, 1, UINT_MAX, NULL); if (maxsign == 0) { usage(); ret = 1; diff --git a/usr.sbin/smtpd/lka_filter.c b/usr.sbin/smtpd/lka_filter.c index 9b18173c7..b7ac56853 100644 --- a/usr.sbin/smtpd/lka_filter.c +++ b/usr.sbin/smtpd/lka_filter.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lka_filter.c,v 1.72 2023/06/21 17:59:24 op Exp $ */ +/* $OpenBSD: lka_filter.c,v 1.73 2023/07/07 14:52:00 op Exp $ */ /* * Copyright (c) 2018 Gilles Chehade @@ -24,7 +24,7 @@ #include "smtpd.h" #include "log.h" -#define PROTOCOL_VERSION "0.6" +#define PROTOCOL_VERSION "0.7" struct filter; struct filter_session; @@ -1444,7 +1444,7 @@ lka_report_smtp_link_auth(const char *direction, struct timeval *tv, uint64_t re fs->username = xstrdup(username); } report_smtp_broadcast(reqid, direction, tv, "link-auth", "%s|%s\n", - username, result); + result, username); } void diff --git a/usr.sbin/smtpd/smtpd-filters.7 b/usr.sbin/smtpd/smtpd-filters.7 index 313404c11..e8affac81 100644 --- a/usr.sbin/smtpd/smtpd-filters.7 +++ b/usr.sbin/smtpd/smtpd-filters.7 @@ -1,4 +1,4 @@ -.\" $OpenBSD: smtpd-filters.7,v 1.9 2022/03/31 17:27:31 naddy Exp $ +.\" $OpenBSD: smtpd-filters.7,v 1.10 2023/07/07 14:52:00 op Exp $ .\" .\" Copyright (c) 2008 Janne Johansson .\" Copyright (c) 2009 Jacek Masiulaniec @@ -17,7 +17,7 @@ .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" .\" -.Dd $Mdocdate: March 31 2022 $ +.Dd $Mdocdate: July 7 2023 $ .Dt SMTPD-FILTERS 7 .Os .Sh NAME @@ -271,12 +271,9 @@ contains a colon-separated list of TLS properties including the TLS version, the cipher suite used by the session and the cipher strength in bits. .It Ic link-disconnect This event is generated upon disconnection of the client. -.It Ic link-auth : Ar username result +.It Ic link-auth : Ar result username This event is generated upon an authentication attempt by the client. .Pp -.Ar username -contains the username used for the authentication attempt. -.Pp .Ar result contains the string .Dq pass , @@ -284,6 +281,9 @@ contains the string or .Dq error depending on the result of the authentication attempt. +.Pp +.Ar username +contains the username used for the authentication attempt. .It Ic tx-reset : Op message-id This event is generated when a transaction is reset. .Pp